update plugin/htmlpurifier
This commit is contained in:
parent
9ed4e6c33d
commit
11f801c71b
154 changed files with 4630 additions and 3829 deletions
File diff suppressed because it is too large
Load diff
80
AvocadoEdition_Light/plugin/htmlpurifier/extend.video.php
Normal file
80
AvocadoEdition_Light/plugin/htmlpurifier/extend.video.php
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
|
//https://stackoverflow.com/questions/4739284/htmlpurifier-iframe-vimeo-and-youtube-video
|
||||||
|
/**
|
||||||
|
* Based on: http://sachachua.com/blog/2011/08/drupal-html-purifier-embedding-iframes-youtube/
|
||||||
|
* Iframe filter that does some primitive whitelisting in a somewhat recognizable and tweakable way
|
||||||
|
*/
|
||||||
|
|
||||||
|
if( !class_exists('HTMLPurifier_Filter_Iframevideo') ){
|
||||||
|
class HTMLPurifier_Filter_Iframevideo extends HTMLPurifier_Filter
|
||||||
|
{
|
||||||
|
public $name = 'Iframevideo';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $html
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function preFilter($html, $config, $context)
|
||||||
|
{
|
||||||
|
if (strstr($html, '<iframe')) {
|
||||||
|
$html = preg_replace_callback('/<iframe.*?src="https?:\/\/www\.youtube\.com\/embed\/([^"]*)[^>]*>(.*?)?\/iframe>/i', array($this, 'trust_url_match'), $html);
|
||||||
|
$html = preg_replace_callback('/<iframe.*?src="https?:\/\/player\.vimeo.com\/video\/([^"]*)[^>]*>(.*?)?\/iframe>/i', array($this, 'trust_url_match'), $html);
|
||||||
|
$html = preg_replace_callback('/<iframe.*?src="https?:\/\/www\.facebook.com\/plugins\/([^"]*)[^>]*>(.*?)?\/iframe>/i', array($this, 'trust_url_match'), $html);
|
||||||
|
//$html = preg_replace('#<iframe#i', '<img class="Iframevideo"', $html);
|
||||||
|
//$html = preg_replace('#</iframe>#i', '</img>', $html);
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function trust_url_match($matches)
|
||||||
|
{
|
||||||
|
$str = $matches[0];
|
||||||
|
if( $matches[1] ){
|
||||||
|
$str = preg_replace('#<iframe#i', '<img class="Iframevideo"', $str);
|
||||||
|
$str = preg_replace('#</iframe>#i', '</img>', $str);
|
||||||
|
}
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $html
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function postFilter($html, $config, $context)
|
||||||
|
{
|
||||||
|
$post_regex = '#<img class="Iframevideo"([^>]+?)>#';
|
||||||
|
return preg_replace_callback($post_regex, array($this, 'postFilterCallback'), $html);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param array $matches
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function postFilterCallback($matches)
|
||||||
|
{
|
||||||
|
// Domain Whitelist
|
||||||
|
$youTubeMatch = preg_match('#src="https?://www\.youtube(-nocookie)?\.com/#i', $matches[1]);
|
||||||
|
$vimeoMatch = preg_match('#src="https?://player\.vimeo\.com/#i', $matches[1]);
|
||||||
|
$fackbookMatch = preg_match('#src="https?://www\.facebook\.com/#i', $matches[1]);
|
||||||
|
if ($youTubeMatch || $vimeoMatch || $fackbookMatch) {
|
||||||
|
$extra = ' frameborder="0"';
|
||||||
|
if ($youTubeMatch || $fackbookMatch) {
|
||||||
|
$extra .= ' allowfullscreen';
|
||||||
|
} elseif ($vimeoMatch) {
|
||||||
|
$extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
|
||||||
|
}
|
||||||
|
return '<iframe ' . $matches[1] . $extra . '></iframe>';
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,9 +4,13 @@ www.youtube(?:-nocookie)?.com/
|
||||||
serviceapi.rmcnmv.naver.com/
|
serviceapi.rmcnmv.naver.com/
|
||||||
videofarm.daum.net/
|
videofarm.daum.net/
|
||||||
player.vimeo.com/
|
player.vimeo.com/
|
||||||
|
www.google.com/
|
||||||
maps.google.com/
|
maps.google.com/
|
||||||
play.afreeca.com/
|
play.afreeca.com/
|
||||||
v.nate.com/
|
v.nate.com/
|
||||||
www.microsoft.com/showcase/video.aspx/
|
www.microsoft.com/showcase/video.aspx/
|
||||||
w.soundcloud.com/
|
w.soundcloud.com/
|
||||||
www.facebook.com/
|
www.facebook.com/
|
||||||
|
kakaotv.daum.net/
|
||||||
|
v.afree.ca/
|
||||||
|
play-tv.kakao.com/
|
||||||
Binary file not shown.
|
|
@ -6,7 +6,7 @@ DEFAULT: false
|
||||||
<p>
|
<p>
|
||||||
When enabled, HTML Purifier will treat any elements that contain only
|
When enabled, HTML Purifier will treat any elements that contain only
|
||||||
non-breaking spaces as well as regular whitespace as empty, and remove
|
non-breaking spaces as well as regular whitespace as empty, and remove
|
||||||
them when %AutoForamt.RemoveEmpty is enabled.
|
them when %AutoFormat.RemoveEmpty is enabled.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements
|
See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
Core.AggressivelyRemoveScript
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 4.9.0
|
||||||
|
DEFAULT: true
|
||||||
|
--DESCRIPTION--
|
||||||
|
<p>
|
||||||
|
This directive enables aggressive pre-filter removal of
|
||||||
|
script tags. This is not necessary for security,
|
||||||
|
but it can help work around a bug in libxml where embedded
|
||||||
|
HTML elements inside script sections cause the parser to
|
||||||
|
choke. To revert to pre-4.9.0 behavior, set this to false.
|
||||||
|
This directive has no effect if %Core.Trusted is true,
|
||||||
|
%Core.RemoveScriptContents is false, or %Core.HiddenElements
|
||||||
|
does not contain script.
|
||||||
|
</p>
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
Core.AllowParseManyTags
|
||||||
|
TYPE: bool
|
||||||
|
DEFAULT: false
|
||||||
|
VERSION: 4.10.1
|
||||||
|
--DESCRIPTION--
|
||||||
|
<p>
|
||||||
|
This directive allows parsing of many nested tags.
|
||||||
|
If you set true, relaxes any hardcoded limit from the parser.
|
||||||
|
However, in that case it may cause a Dos attack.
|
||||||
|
Be careful when enabling it.
|
||||||
|
</p>
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
|
@ -3,23 +3,154 @@ TYPE: hash
|
||||||
VERSION: 2.0.0
|
VERSION: 2.0.0
|
||||||
--DEFAULT--
|
--DEFAULT--
|
||||||
array (
|
array (
|
||||||
'maroon' => '#800000',
|
'aliceblue' => '#F0F8FF',
|
||||||
'red' => '#FF0000',
|
'antiquewhite' => '#FAEBD7',
|
||||||
'orange' => '#FFA500',
|
|
||||||
'yellow' => '#FFFF00',
|
|
||||||
'olive' => '#808000',
|
|
||||||
'purple' => '#800080',
|
|
||||||
'fuchsia' => '#FF00FF',
|
|
||||||
'white' => '#FFFFFF',
|
|
||||||
'lime' => '#00FF00',
|
|
||||||
'green' => '#008000',
|
|
||||||
'navy' => '#000080',
|
|
||||||
'blue' => '#0000FF',
|
|
||||||
'aqua' => '#00FFFF',
|
'aqua' => '#00FFFF',
|
||||||
'teal' => '#008080',
|
'aquamarine' => '#7FFFD4',
|
||||||
|
'azure' => '#F0FFFF',
|
||||||
|
'beige' => '#F5F5DC',
|
||||||
|
'bisque' => '#FFE4C4',
|
||||||
'black' => '#000000',
|
'black' => '#000000',
|
||||||
'silver' => '#C0C0C0',
|
'blanchedalmond' => '#FFEBCD',
|
||||||
|
'blue' => '#0000FF',
|
||||||
|
'blueviolet' => '#8A2BE2',
|
||||||
|
'brown' => '#A52A2A',
|
||||||
|
'burlywood' => '#DEB887',
|
||||||
|
'cadetblue' => '#5F9EA0',
|
||||||
|
'chartreuse' => '#7FFF00',
|
||||||
|
'chocolate' => '#D2691E',
|
||||||
|
'coral' => '#FF7F50',
|
||||||
|
'cornflowerblue' => '#6495ED',
|
||||||
|
'cornsilk' => '#FFF8DC',
|
||||||
|
'crimson' => '#DC143C',
|
||||||
|
'cyan' => '#00FFFF',
|
||||||
|
'darkblue' => '#00008B',
|
||||||
|
'darkcyan' => '#008B8B',
|
||||||
|
'darkgoldenrod' => '#B8860B',
|
||||||
|
'darkgray' => '#A9A9A9',
|
||||||
|
'darkgrey' => '#A9A9A9',
|
||||||
|
'darkgreen' => '#006400',
|
||||||
|
'darkkhaki' => '#BDB76B',
|
||||||
|
'darkmagenta' => '#8B008B',
|
||||||
|
'darkolivegreen' => '#556B2F',
|
||||||
|
'darkorange' => '#FF8C00',
|
||||||
|
'darkorchid' => '#9932CC',
|
||||||
|
'darkred' => '#8B0000',
|
||||||
|
'darksalmon' => '#E9967A',
|
||||||
|
'darkseagreen' => '#8FBC8F',
|
||||||
|
'darkslateblue' => '#483D8B',
|
||||||
|
'darkslategray' => '#2F4F4F',
|
||||||
|
'darkslategrey' => '#2F4F4F',
|
||||||
|
'darkturquoise' => '#00CED1',
|
||||||
|
'darkviolet' => '#9400D3',
|
||||||
|
'deeppink' => '#FF1493',
|
||||||
|
'deepskyblue' => '#00BFFF',
|
||||||
|
'dimgray' => '#696969',
|
||||||
|
'dimgrey' => '#696969',
|
||||||
|
'dodgerblue' => '#1E90FF',
|
||||||
|
'firebrick' => '#B22222',
|
||||||
|
'floralwhite' => '#FFFAF0',
|
||||||
|
'forestgreen' => '#228B22',
|
||||||
|
'fuchsia' => '#FF00FF',
|
||||||
|
'gainsboro' => '#DCDCDC',
|
||||||
|
'ghostwhite' => '#F8F8FF',
|
||||||
|
'gold' => '#FFD700',
|
||||||
|
'goldenrod' => '#DAA520',
|
||||||
'gray' => '#808080',
|
'gray' => '#808080',
|
||||||
|
'grey' => '#808080',
|
||||||
|
'green' => '#008000',
|
||||||
|
'greenyellow' => '#ADFF2F',
|
||||||
|
'honeydew' => '#F0FFF0',
|
||||||
|
'hotpink' => '#FF69B4',
|
||||||
|
'indianred' => '#CD5C5C',
|
||||||
|
'indigo' => '#4B0082',
|
||||||
|
'ivory' => '#FFFFF0',
|
||||||
|
'khaki' => '#F0E68C',
|
||||||
|
'lavender' => '#E6E6FA',
|
||||||
|
'lavenderblush' => '#FFF0F5',
|
||||||
|
'lawngreen' => '#7CFC00',
|
||||||
|
'lemonchiffon' => '#FFFACD',
|
||||||
|
'lightblue' => '#ADD8E6',
|
||||||
|
'lightcoral' => '#F08080',
|
||||||
|
'lightcyan' => '#E0FFFF',
|
||||||
|
'lightgoldenrodyellow' => '#FAFAD2',
|
||||||
|
'lightgray' => '#D3D3D3',
|
||||||
|
'lightgrey' => '#D3D3D3',
|
||||||
|
'lightgreen' => '#90EE90',
|
||||||
|
'lightpink' => '#FFB6C1',
|
||||||
|
'lightsalmon' => '#FFA07A',
|
||||||
|
'lightseagreen' => '#20B2AA',
|
||||||
|
'lightskyblue' => '#87CEFA',
|
||||||
|
'lightslategray' => '#778899',
|
||||||
|
'lightslategrey' => '#778899',
|
||||||
|
'lightsteelblue' => '#B0C4DE',
|
||||||
|
'lightyellow' => '#FFFFE0',
|
||||||
|
'lime' => '#00FF00',
|
||||||
|
'limegreen' => '#32CD32',
|
||||||
|
'linen' => '#FAF0E6',
|
||||||
|
'magenta' => '#FF00FF',
|
||||||
|
'maroon' => '#800000',
|
||||||
|
'mediumaquamarine' => '#66CDAA',
|
||||||
|
'mediumblue' => '#0000CD',
|
||||||
|
'mediumorchid' => '#BA55D3',
|
||||||
|
'mediumpurple' => '#9370DB',
|
||||||
|
'mediumseagreen' => '#3CB371',
|
||||||
|
'mediumslateblue' => '#7B68EE',
|
||||||
|
'mediumspringgreen' => '#00FA9A',
|
||||||
|
'mediumturquoise' => '#48D1CC',
|
||||||
|
'mediumvioletred' => '#C71585',
|
||||||
|
'midnightblue' => '#191970',
|
||||||
|
'mintcream' => '#F5FFFA',
|
||||||
|
'mistyrose' => '#FFE4E1',
|
||||||
|
'moccasin' => '#FFE4B5',
|
||||||
|
'navajowhite' => '#FFDEAD',
|
||||||
|
'navy' => '#000080',
|
||||||
|
'oldlace' => '#FDF5E6',
|
||||||
|
'olive' => '#808000',
|
||||||
|
'olivedrab' => '#6B8E23',
|
||||||
|
'orange' => '#FFA500',
|
||||||
|
'orangered' => '#FF4500',
|
||||||
|
'orchid' => '#DA70D6',
|
||||||
|
'palegoldenrod' => '#EEE8AA',
|
||||||
|
'palegreen' => '#98FB98',
|
||||||
|
'paleturquoise' => '#AFEEEE',
|
||||||
|
'palevioletred' => '#DB7093',
|
||||||
|
'papayawhip' => '#FFEFD5',
|
||||||
|
'peachpuff' => '#FFDAB9',
|
||||||
|
'peru' => '#CD853F',
|
||||||
|
'pink' => '#FFC0CB',
|
||||||
|
'plum' => '#DDA0DD',
|
||||||
|
'powderblue' => '#B0E0E6',
|
||||||
|
'purple' => '#800080',
|
||||||
|
'rebeccapurple' => '#663399',
|
||||||
|
'red' => '#FF0000',
|
||||||
|
'rosybrown' => '#BC8F8F',
|
||||||
|
'royalblue' => '#4169E1',
|
||||||
|
'saddlebrown' => '#8B4513',
|
||||||
|
'salmon' => '#FA8072',
|
||||||
|
'sandybrown' => '#F4A460',
|
||||||
|
'seagreen' => '#2E8B57',
|
||||||
|
'seashell' => '#FFF5EE',
|
||||||
|
'sienna' => '#A0522D',
|
||||||
|
'silver' => '#C0C0C0',
|
||||||
|
'skyblue' => '#87CEEB',
|
||||||
|
'slateblue' => '#6A5ACD',
|
||||||
|
'slategray' => '#708090',
|
||||||
|
'slategrey' => '#708090',
|
||||||
|
'snow' => '#FFFAFA',
|
||||||
|
'springgreen' => '#00FF7F',
|
||||||
|
'steelblue' => '#4682B4',
|
||||||
|
'tan' => '#D2B48C',
|
||||||
|
'teal' => '#008080',
|
||||||
|
'thistle' => '#D8BFD8',
|
||||||
|
'tomato' => '#FF6347',
|
||||||
|
'turquoise' => '#40E0D0',
|
||||||
|
'violet' => '#EE82EE',
|
||||||
|
'wheat' => '#F5DEB3',
|
||||||
|
'white' => '#FFFFFF',
|
||||||
|
'whitesmoke' => '#F5F5F5',
|
||||||
|
'yellow' => '#FFFF00',
|
||||||
|
'yellowgreen' => '#9ACD32'
|
||||||
)
|
)
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
Core.LegacyEntityDecoder
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 4.9.0
|
||||||
|
DEFAULT: false
|
||||||
|
--DESCRIPTION--
|
||||||
|
<p>
|
||||||
|
Prior to HTML Purifier 4.9.0, entities were decoded by performing
|
||||||
|
a global search replace for all entities whose decoded versions
|
||||||
|
did not have special meanings under HTML, and replaced them with
|
||||||
|
their decoded versions. We would match all entities, even if they did
|
||||||
|
not have a trailing semicolon, but only if there weren't any trailing
|
||||||
|
alphanumeric characters.
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>Original</th><th>Text</th><th>Attribute</th></tr>
|
||||||
|
<tr><td>&yen;</td><td>¥</td><td>¥</td></tr>
|
||||||
|
<tr><td>&yen</td><td>¥</td><td>¥</td></tr>
|
||||||
|
<tr><td>&yena</td><td>&yena</td><td>&yena</td></tr>
|
||||||
|
<tr><td>&yen=</td><td>¥=</td><td>¥=</td></tr>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
In HTML Purifier 4.9.0, we changed the behavior of entity parsing
|
||||||
|
to match entities that had missing trailing semicolons in less
|
||||||
|
cases, to more closely match HTML5 parsing behavior:
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>Original</th><th>Text</th><th>Attribute</th></tr>
|
||||||
|
<tr><td>&yen;</td><td>¥</td><td>¥</td></tr>
|
||||||
|
<tr><td>&yen</td><td>¥</td><td>¥</td></tr>
|
||||||
|
<tr><td>&yena</td><td>¥a</td><td>&yena</td></tr>
|
||||||
|
<tr><td>&yen=</td><td>¥=</td><td>&yen=</td></tr>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
This flag reverts back to pre-HTML Purifier 4.9.0 behavior.
|
||||||
|
</p>
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
HTML.Forms
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 4.13.0
|
||||||
|
DEFAULT: false
|
||||||
|
--DESCRIPTION--
|
||||||
|
<p>
|
||||||
|
Whether or not to permit form elements in the user input, regardless of
|
||||||
|
%HTML.Trusted value. Please be very careful when using this functionality, as
|
||||||
|
enabling forms in untrusted documents may allow for phishing attacks.
|
||||||
|
</p>
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
HTML.TargetNoopener
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 4.8.0
|
||||||
|
DEFAULT: TRUE
|
||||||
|
--DESCRIPTION--
|
||||||
|
If enabled, noopener rel attributes are added to links which have
|
||||||
|
a target attribute associated with them. This prevents malicious
|
||||||
|
destinations from overwriting the original window.
|
||||||
|
--# vim: et sw=4 sts=4
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
URI.DefaultScheme
|
URI.DefaultScheme
|
||||||
TYPE: string
|
TYPE: string/null
|
||||||
DEFAULT: 'http'
|
DEFAULT: 'http'
|
||||||
--DESCRIPTION--
|
--DESCRIPTION--
|
||||||
|
|
||||||
|
|
@ -7,4 +7,9 @@ DEFAULT: 'http'
|
||||||
Defines through what scheme the output will be served, in order to
|
Defines through what scheme the output will be served, in order to
|
||||||
select the proper object validator when no scheme information is present.
|
select the proper object validator when no scheme information is present.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Starting with HTML Purifier 4.9.0, the default scheme can be null, in
|
||||||
|
which case we reject all URIs which do not have explicit schemes.
|
||||||
|
</p>
|
||||||
--# vim: et sw=4 sts=4
|
--# vim: et sw=4 sts=4
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,10 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
|
||||||
if ($tidy !== null) {
|
if ($tidy !== null) {
|
||||||
$this->_tidy = $tidy;
|
$this->_tidy = $tidy;
|
||||||
}
|
}
|
||||||
$html = preg_replace_callback('#<style(?:\s.*)?>(.+)</style>#isU', array($this, 'styleCallback'), $html);
|
// NB: this must be NON-greedy because if we have
|
||||||
|
// <style>foo</style> <style>bar</style>
|
||||||
|
// we must not grab foo</style> <style>bar
|
||||||
|
$html = preg_replace_callback('#<style(?:\s.*)?>(.*)<\/style>#isU', array($this, 'styleCallback'), $html);
|
||||||
$style_blocks = $this->_styleMatches;
|
$style_blocks = $this->_styleMatches;
|
||||||
$this->_styleMatches = array(); // reset
|
$this->_styleMatches = array(); // reset
|
||||||
$context->register('StyleBlocks', $style_blocks); // $context must not be reused
|
$context->register('StyleBlocks', $style_blocks); // $context must not be reused
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// private class for unit testing
|
|
||||||
|
|
||||||
class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: et sw=4 sts=4
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// private language message file for unit testing purposes
|
|
||||||
|
|
||||||
$fallback = 'en';
|
|
||||||
|
|
||||||
$messages = array(
|
|
||||||
'HTMLPurifier' => 'HTML Purifier X'
|
|
||||||
);
|
|
||||||
|
|
||||||
// vim: et sw=4 sts=4
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// private language message file for unit testing purposes
|
|
||||||
// this language file has no class associated with it
|
|
||||||
|
|
||||||
$fallback = 'en';
|
|
||||||
|
|
||||||
$messages = array(
|
|
||||||
'HTMLPurifier' => 'HTML Purifier XNone'
|
|
||||||
);
|
|
||||||
|
|
||||||
// vim: et sw=4 sts=4
|
|
||||||
|
|
@ -21,7 +21,7 @@ class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex
|
||||||
public function tokenizeHTML($html, $config, $context)
|
public function tokenizeHTML($html, $config, $context)
|
||||||
{
|
{
|
||||||
$new_html = $this->normalize($html, $config, $context);
|
$new_html = $this->normalize($html, $config, $context);
|
||||||
$new_html = $this->wrapHTML($new_html, $config, $context);
|
$new_html = $this->wrapHTML($new_html, $config, $context, false /* no div */);
|
||||||
try {
|
try {
|
||||||
$parser = new HTML5($new_html);
|
$parser = new HTML5($new_html);
|
||||||
$doc = $parser->save();
|
$doc = $parser->save();
|
||||||
|
|
@ -34,9 +34,9 @@ class HTMLPurifier_Lexer_PH5P extends HTMLPurifier_Lexer_DOMLex
|
||||||
$tokens = array();
|
$tokens = array();
|
||||||
$this->tokenizeDOM(
|
$this->tokenizeDOM(
|
||||||
$doc->getElementsByTagName('html')->item(0)-> // <html>
|
$doc->getElementsByTagName('html')->item(0)-> // <html>
|
||||||
getElementsByTagName('body')->item(0) // <body>
|
getElementsByTagName('body')->item(0) // <body>
|
||||||
,
|
,
|
||||||
$tokens
|
$tokens, $config
|
||||||
);
|
);
|
||||||
return $tokens;
|
return $tokens;
|
||||||
}
|
}
|
||||||
|
|
@ -1507,7 +1507,7 @@ class HTML5
|
||||||
$entity = $this->character($start, $this->char);
|
$entity = $this->character($start, $this->char);
|
||||||
$cond = strlen($e_name) > 0;
|
$cond = strlen($e_name) > 0;
|
||||||
|
|
||||||
// The rest of the parsing happens bellow.
|
// The rest of the parsing happens below.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Anything else
|
// Anything else
|
||||||
|
|
@ -1515,6 +1515,7 @@ class HTML5
|
||||||
// Consume the maximum number of characters possible, with the
|
// Consume the maximum number of characters possible, with the
|
||||||
// consumed characters case-sensitively matching one of the
|
// consumed characters case-sensitively matching one of the
|
||||||
// identifiers in the first column of the entities table.
|
// identifiers in the first column of the entities table.
|
||||||
|
|
||||||
$e_name = $this->characters('0-9A-Za-z;', $this->char + 1);
|
$e_name = $this->characters('0-9A-Za-z;', $this->char + 1);
|
||||||
$len = strlen($e_name);
|
$len = strlen($e_name);
|
||||||
|
|
||||||
|
|
@ -1534,7 +1535,7 @@ class HTML5
|
||||||
}
|
}
|
||||||
|
|
||||||
$cond = isset($entity);
|
$cond = isset($entity);
|
||||||
// The rest of the parsing happens bellow.
|
// The rest of the parsing happens below.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1547,7 +1548,7 @@ class HTML5
|
||||||
|
|
||||||
// Return a character token for the character corresponding to the
|
// Return a character token for the character corresponding to the
|
||||||
// entity name (as given by the second column of the entities table).
|
// entity name (as given by the second column of the entities table).
|
||||||
return html_entity_decode('&' . $entity . ';', ENT_QUOTES, 'UTF-8');
|
return html_entity_decode('&' . rtrim($entity, ';') . ';', ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function emitToken($token)
|
private function emitToken($token)
|
||||||
|
|
@ -4409,7 +4410,7 @@ class HTML5TreeConstructer
|
||||||
|
|
||||||
foreach ($token['attr'] as $attr) {
|
foreach ($token['attr'] as $attr) {
|
||||||
if (!$el->hasAttribute($attr['name'])) {
|
if (!$el->hasAttribute($attr['name'])) {
|
||||||
$el->setAttribute($attr['name'], $attr['value']);
|
$el->setAttribute($attr['name'], (string)$attr['value']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
|
||||||
$this->compress = $compress;
|
$this->compress = $compress;
|
||||||
// initialize sub-printers
|
// initialize sub-printers
|
||||||
$this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
|
$this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
|
||||||
$this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
|
$this->fields[HTMLPurifier_VarParser::C_BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -339,7 +339,7 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer
|
||||||
$value = '';
|
$value = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($type === HTMLPurifier_VarParser::MIXED) {
|
if ($type === HTMLPurifier_VarParser::C_MIXED) {
|
||||||
return 'Not supported';
|
return 'Not supported';
|
||||||
$value = serialize($value);
|
$value = serialize($value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
|
||||||
$ret .= $this->element('caption', 'Doctype');
|
$ret .= $this->element('caption', 'Doctype');
|
||||||
$ret .= $this->row('Name', $doctype->name);
|
$ret .= $this->row('Name', $doctype->name);
|
||||||
$ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
|
$ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
|
||||||
$ret .= $this->row('Default Modules', implode($doctype->modules, ', '));
|
$ret .= $this->row('Default Modules', implode(', ', $doctype->modules));
|
||||||
$ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', '));
|
$ret .= $this->row('Default Tidy Modules', implode(', ', $doctype->tidyModules));
|
||||||
$ret .= $this->end('table');
|
$ret .= $this->end('table');
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue