htmlpurifier 4.15.0 버전으로 수정

This commit is contained in:
thisgun
2024-10-25 17:52:55 +09:00
parent 5e6549a22c
commit 0d586e2101
8 changed files with 28429 additions and 28382 deletions

View File

@ -7,7 +7,7 @@
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS * primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
* FILE, changes will be overwritten the next time the script is run. * FILE, changes will be overwritten the next time the script is run.
* *
* @version 4.14.0 * @version 4.15.0
* *
* @warning * @warning
* You must *not* include any other HTML Purifier files before this file, * You must *not* include any other HTML Purifier files before this file,
@ -39,7 +39,7 @@
*/ */
/* /*
HTML Purifier 4.14.0 - Standards Compliant HTML Filtering HTML Purifier 4.15.0 - Standards Compliant HTML Filtering
Copyright (C) 2006-2008 Edward Z. Yang Copyright (C) 2006-2008 Edward Z. Yang
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -78,12 +78,12 @@ class HTMLPurifier
* Version of HTML Purifier. * Version of HTML Purifier.
* @type string * @type string
*/ */
public $version = '4.14.0'; public $version = '4.15.0';
/** /**
* Constant with version of HTML Purifier. * Constant with version of HTML Purifier.
*/ */
const VERSION = '4.14.0'; const VERSION = '4.15.0';
/** /**
* Global configuration object. * Global configuration object.
@ -786,6 +786,7 @@ class HTMLPurifier_AttrTypes
$this->info['IAlign'] = self::makeEnum('top,middle,bottom,left,right'); $this->info['IAlign'] = self::makeEnum('top,middle,bottom,left,right');
$this->info['LAlign'] = self::makeEnum('top,bottom,left,right'); $this->info['LAlign'] = self::makeEnum('top,bottom,left,right');
$this->info['FrameTarget'] = new HTMLPurifier_AttrDef_HTML_FrameTarget(); $this->info['FrameTarget'] = new HTMLPurifier_AttrDef_HTML_FrameTarget();
$this->info['ContentEditable'] = new HTMLPurifier_AttrDef_HTML_ContentEditable();
// unimplemented aliases // unimplemented aliases
$this->info['ContentType'] = new HTMLPurifier_AttrDef_Text(); $this->info['ContentType'] = new HTMLPurifier_AttrDef_Text();
@ -1827,7 +1828,7 @@ class HTMLPurifier_Config
* HTML Purifier's version * HTML Purifier's version
* @type string * @type string
*/ */
public $version = '4.14.0'; public $version = '4.15.0';
/** /**
* Whether or not to automatically finalize * Whether or not to automatically finalize
@ -4240,8 +4241,8 @@ class HTMLPurifier_Encoder
// characters to their true byte-wise ASCII/UTF-8 equivalents. // characters to their true byte-wise ASCII/UTF-8 equivalents.
$str = strtr($str, self::testEncodingSupportsASCII($encoding)); $str = strtr($str, self::testEncodingSupportsASCII($encoding));
return $str; return $str;
} elseif ($encoding === 'iso-8859-1') { } elseif ($encoding === 'iso-8859-1' && function_exists('mb_convert_encoding')) {
$str = utf8_encode($str); $str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
return $str; return $str;
} }
$bug = HTMLPurifier_Encoder::testIconvTruncateBug(); $bug = HTMLPurifier_Encoder::testIconvTruncateBug();
@ -4292,8 +4293,8 @@ class HTMLPurifier_Encoder
// Normal stuff // Normal stuff
$str = self::iconv('utf-8', $encoding . '//IGNORE', $str); $str = self::iconv('utf-8', $encoding . '//IGNORE', $str);
return $str; return $str;
} elseif ($encoding === 'iso-8859-1') { } elseif ($encoding === 'iso-8859-1' && function_exists('mb_convert_encoding')) {
$str = utf8_decode($str); $str = mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8');
return $str; return $str;
} }
trigger_error('Encoding not supported', E_USER_ERROR); trigger_error('Encoding not supported', E_USER_ERROR);
@ -7688,6 +7689,11 @@ class HTMLPurifier_Lexer
*/ */
public $tracksLineNumbers = false; public $tracksLineNumbers = false;
/**
* @type HTMLPurifier_EntityParser
*/
private $_entity_parser;
// -- STATIC ---------------------------------------------------------- // -- STATIC ----------------------------------------------------------
/** /**
@ -8336,8 +8342,6 @@ class HTMLPurifier_PropertyListIterator extends FilterIterator
/** /**
* @return bool * @return bool
*
* {@inheritdoc}
*/ */
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function accept() public function accept()
@ -8457,8 +8461,6 @@ class HTMLPurifier_StringHash extends ArrayObject
* Retrieves a value, and logs the access. * Retrieves a value, and logs the access.
* @param mixed $index * @param mixed $index
* @return mixed * @return mixed
*
* {@inheritdoc}
*/ */
#[\ReturnTypeWillChange] #[\ReturnTypeWillChange]
public function offsetGet($index) public function offsetGet($index)
@ -12886,6 +12888,23 @@ class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
class HTMLPurifier_AttrDef_HTML_ContentEditable extends HTMLPurifier_AttrDef
{
public function validate($string, $config, $context)
{
$allowed = array('false');
if ($config->get('HTML.Trusted')) {
$allowed = array('', 'true', 'false');
}
$enum = new HTMLPurifier_AttrDef_Enum($allowed);
return $enum->validate($string, $config, $context);
}
}
/** /**
* Special-case enum attribute definition that lazy loads allowed frame targets * Special-case enum attribute definition that lazy loads allowed frame targets
*/ */
@ -14154,6 +14173,11 @@ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform class HTMLPurifier_AttrTransform_NameSync extends HTMLPurifier_AttrTransform
{ {
/**
* @type HTMLPurifier_AttrDef_HTML_ID
*/
public $idDef;
public function __construct() public function __construct()
{ {
$this->idDef = new HTMLPurifier_AttrDef_HTML_ID(); $this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
@ -14320,6 +14344,11 @@ class HTMLPurifier_AttrTransform_SafeParam extends HTMLPurifier_AttrTransform
*/ */
private $uri; private $uri;
/**
* @type HTMLPurifier_AttrDef_Enum
*/
public $wmode;
public function __construct() public function __construct()
{ {
$this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded $this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
@ -14782,6 +14811,8 @@ class HTMLPurifier_ChildDef_List extends HTMLPurifier_ChildDef
// XXX: This whole business with 'wrap' is all a bit unsatisfactory // XXX: This whole business with 'wrap' is all a bit unsatisfactory
public $elements = array('li' => true, 'ul' => true, 'ol' => true); public $elements = array('li' => true, 'ul' => true, 'ol' => true);
public $whitespace;
/** /**
* @param array $children * @param array $children
* @param HTMLPurifier_Config $config * @param HTMLPurifier_Config $config
@ -16083,6 +16114,7 @@ class HTMLPurifier_HTMLModule_CommonAttributes extends HTMLPurifier_HTMLModule
'class' => 'Class', 'class' => 'Class',
'id' => 'ID', 'id' => 'ID',
'title' => 'CDATA', 'title' => 'CDATA',
'contenteditable' => 'ContentEditable',
), ),
'Lang' => array(), 'Lang' => array(),
'I18N' => array( 'I18N' => array(
@ -18775,6 +18807,16 @@ class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_In
*/ */
private $context; private $context;
/**
* @type SplObjectStorage
*/
private $markForDeletion;
public function __construct()
{
$this->markForDeletion = new SplObjectStorage();
}
public function prepare($config, $context) public function prepare($config, $context)
{ {
$this->attrValidator = new HTMLPurifier_AttrValidator(); $this->attrValidator = new HTMLPurifier_AttrValidator();
@ -18808,7 +18850,7 @@ class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_In
if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') { if ($current instanceof HTMLPurifier_Token_End && $current->name === 'span') {
// Mark closing span tag for deletion // Mark closing span tag for deletion
$current->markForDeletion = true; $this->markForDeletion->attach($current);
// Delete open span tag // Delete open span tag
$token = false; $token = false;
} }
@ -18819,7 +18861,8 @@ class HTMLPurifier_Injector_RemoveSpansWithoutAttributes extends HTMLPurifier_In
*/ */
public function handleEnd(&$token) public function handleEnd(&$token)
{ {
if ($token->markForDeletion) { if ($this->markForDeletion->contains($token)) {
$this->markForDeletion->detach($token);
$token = false; $token = false;
} }
} }
@ -21643,7 +21686,7 @@ class HTMLPurifier_URIFilter_HostBlacklist extends HTMLPurifier_URIFilter
public function filter(&$uri, $config, $context) public function filter(&$uri, $config, $context)
{ {
foreach ($this->blacklist as $blacklisted_host_fragment) { foreach ($this->blacklist as $blacklisted_host_fragment) {
if (strpos($uri->host, $blacklisted_host_fragment) !== false) { if ($uri->host !== null && strpos($uri->host, $blacklisted_host_fragment) !== false) {
return false; return false;
} }
} }
@ -21914,11 +21957,15 @@ class HTMLPurifier_URIFilter_Munge extends HTMLPurifier_URIFilter
$string = $uri->toString(); $string = $uri->toString();
// always available // always available
$this->replace['%s'] = $string; $this->replace['%s'] = $string;
$this->replace['%r'] = $context->get('EmbeddedURI', true); $e = $context->get('EmbeddedURI', true);
$token = $context->get('CurrentToken', true); $this->replace['%r'] = $e ? $e : '';
$e = $context->get('CurrentToken', true);
$token = $e ? $e: '';
$this->replace['%n'] = $token ? $token->name : ''; $this->replace['%n'] = $token ? $token->name : '';
$this->replace['%m'] = $context->get('CurrentAttr', true); $e = $context->get('CurrentAttr', true);
$this->replace['%p'] = $context->get('CurrentCSSProperty', true); $this->replace['%m'] = $e ? $e : '';
$e = $context->get('CurrentCSSProperty', true);
$this->replace['%p'] = $e ? $e : '';
// not always available // not always available
if ($this->secretKey) { if ($this->secretKey) {
$this->replace['%t'] = hash_hmac("sha256", $string, $this->secretKey); $this->replace['%t'] = hash_hmac("sha256", $string, $this->secretKey);