mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-02 20:27:40 +02:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
08e27c97e4 | ||
|
d7be9d2a8c | ||
|
ce7efc11b2 | ||
|
3bdc031224 | ||
|
d148edbcf1 | ||
|
ced089434d | ||
|
c2c91f52d0 | ||
|
37dd61c45f | ||
|
d15890222b | ||
|
fe0452d688 | ||
|
df923d1f15 | ||
|
4faca32a4d | ||
|
a617e55bc6 | ||
|
3060a5606c | ||
|
b4ec8c8036 | ||
|
06b3fc4cf4 | ||
|
c6ca293eab | ||
|
ab2887e423 | ||
|
029d1df5e3 | ||
|
b88fcd180c |
28
.gitattributes
vendored
28
.gitattributes
vendored
@@ -1,13 +1,23 @@
|
||||
/.gitattributes export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/Doxyfile export-ignore
|
||||
/art/ export-ignore
|
||||
/benchmarks/ export-ignore
|
||||
/configdoc/ export-ignore
|
||||
/art export-ignore
|
||||
/benchmarks export-ignore
|
||||
/configdoc export-ignore
|
||||
/configdoc/usage.xml -crlf
|
||||
/docs/ export-ignore
|
||||
/phpdoc.ini
|
||||
/smoketests/ export-ignore
|
||||
/tests/* export-ignore
|
||||
/tests/path2class.func.php -export-ignore
|
||||
/docs export-ignore
|
||||
/Doxyfile export-ignore
|
||||
/extras export-ignore
|
||||
/INSTALL* export-ignore
|
||||
/maintenance export-ignore
|
||||
/NEWS export-ignore
|
||||
/package.php export-ignore
|
||||
/plugins export-ignore
|
||||
/phpdoc.ini export-ignore
|
||||
/smoketests export-ignore
|
||||
/test-* export-ignore
|
||||
/tests export-ignore
|
||||
/TODO export-ignore
|
||||
/update-for-release export-ignore
|
||||
/WHATSNEW export-ignore
|
||||
/WYSIWYG export-ignore
|
||||
|
@@ -1,12 +1,17 @@
|
||||
language: php
|
||||
php:
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
- '7.4'
|
||||
matrix:
|
||||
include:
|
||||
- php: '5.4'
|
||||
dist: trusty
|
||||
- php: '5.5'
|
||||
dist: trusty
|
||||
before_script:
|
||||
- git clone --depth=50 https://github.com/ezyang/simpletest.git
|
||||
- cp test-settings.travis.php test-settings.php
|
||||
|
2
Doxyfile
2
Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = HTMLPurifier
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 4.11.0
|
||||
PROJECT_NUMBER = 4.13.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
28
NEWS
28
NEWS
@@ -9,6 +9,34 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
||||
. Internal change
|
||||
==========================
|
||||
|
||||
4.13.0, released 2020-06-28
|
||||
! Add %HTML.Forms directive, which lets you accept forms in user
|
||||
HTML without requiring full %HTML.Trusted. Note that forms can
|
||||
be (trivially) used to setup phishing; e.g., an attacker can
|
||||
use CSS absolute positioning to overlay a form on top of a login
|
||||
element, so please be sure to use this with care! Fixes #213.
|
||||
Thanks Mateusz Turcza for contributing this feature.
|
||||
! tr@bgcolor attribute is now supported. Thanks Kieran Brahney
|
||||
for this enhancement.
|
||||
- Further improvements to PHP 6.4 support, contributed by Witold
|
||||
Wasiczko and Eloy Lafuente.
|
||||
- Fix PSR-0 compatibility. Thanks Jordi Boggiano for contributing
|
||||
part of this fix.
|
||||
- Fix bug with purifyArray where it doesn't work on empty arrays.
|
||||
Thanks Fräntz Miccoli for the fix.
|
||||
- Reduce amount of maintenance scripts included in distribution
|
||||
packages. Thanks Sergei Morozov for this patch.
|
||||
- Remove leading zeros unless if it is only a zero, fixes #239. Thanks
|
||||
lubomirbartos for this fix.
|
||||
- Correct type hinting of maybeGet*, fixes #240. Thanks Anders Jenbo
|
||||
for this fix.
|
||||
|
||||
4.12.0, released 2019-10-27
|
||||
! PHP 7.4 is supported, thank you Witold Wasiczko, Mateuz Turcza and
|
||||
Edi Modrić
|
||||
- PHPDocs for HTMLModule::addElement() and Bool attr are fixed (thanks
|
||||
Mateusz)
|
||||
|
||||
4.11.0, released 2019-07-14
|
||||
# SafeScripting now matches case-sensitively against its whitelist (previously it was
|
||||
case-insensitive.) Thanks Dimitri Gritsajuk <gritsajuk.dimitri@gmail.com>
|
||||
|
11
WHATSNEW
11
WHATSNEW
@@ -1,7 +1,4 @@
|
||||
HTML Purifier 4.11.x is a maintenance release, collecting a year
|
||||
and a half of accumulated bug fixes. Most notable fixes are
|
||||
compatibility with PHP 7.3, and case-sensitive matching for
|
||||
the SafeScripting whitelist. There are a number small feature
|
||||
enhancements, including an expanded supported color list,
|
||||
initial and inherit support for {min-,max-,}{width,height}
|
||||
and multidimensional array support for purifyArray.
|
||||
HTML Purifier 4.13.x is a maintenance release which fixes
|
||||
PSR-0 compatibility of our package. There are also a few
|
||||
new features (%HTML.Forms and tg@bgcolor support) and
|
||||
a number of minor bugfixes.
|
||||
|
@@ -20,6 +20,9 @@
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "HTMLPurifier": "library/" },
|
||||
"files": ["library/HTMLPurifier.composer.php"]
|
||||
"files": ["library/HTMLPurifier.composer.php"],
|
||||
"exclude-from-classmap": [
|
||||
"/library/HTMLPurifier/Language/"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -480,6 +480,11 @@
|
||||
<line>330</line>
|
||||
</file>
|
||||
</directive>
|
||||
<directive id="HTML.Forms">
|
||||
<file name="HTMLPurifier/HTMLModule/Forms.php">
|
||||
<line>31</line>
|
||||
</file>
|
||||
</directive>
|
||||
<directive id="HTML.SafeIframe">
|
||||
<file name="HTMLPurifier/HTMLModule/Iframe.php">
|
||||
<line>28</line>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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.
|
||||
*
|
||||
* @version 4.11.0
|
||||
* @version 4.13.0
|
||||
*
|
||||
* @warning
|
||||
* You must *not* include any other HTML Purifier files before this file,
|
||||
|
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
HTML Purifier 4.11.0 - Standards Compliant HTML Filtering
|
||||
HTML Purifier 4.13.0 - Standards Compliant HTML Filtering
|
||||
Copyright (C) 2006-2008 Edward Z. Yang
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@@ -58,12 +58,12 @@ class HTMLPurifier
|
||||
* Version of HTML Purifier.
|
||||
* @type string
|
||||
*/
|
||||
public $version = '4.11.0';
|
||||
public $version = '4.13.0';
|
||||
|
||||
/**
|
||||
* Constant with version of HTML Purifier.
|
||||
*/
|
||||
const VERSION = '4.11.0';
|
||||
const VERSION = '4.13.0';
|
||||
|
||||
/**
|
||||
* Global configuration object.
|
||||
@@ -240,6 +240,7 @@ class HTMLPurifier
|
||||
public function purifyArray($array_of_html, $config = null)
|
||||
{
|
||||
$context_array = array();
|
||||
$array = array();
|
||||
foreach($array_of_html as $key=>$value){
|
||||
if (is_array($value)) {
|
||||
$array[$key] = $this->purifyArray($value, $config);
|
||||
|
@@ -69,7 +69,13 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
|
||||
return false;
|
||||
}
|
||||
|
||||
$left = ltrim($left, '0');
|
||||
// Remove leading zeros until positive number or a zero stays left
|
||||
if (ltrim($left, '0') != '') {
|
||||
$left = ltrim($left, '0');
|
||||
} else {
|
||||
$left = '0';
|
||||
}
|
||||
|
||||
$right = rtrim($right, '0');
|
||||
|
||||
if ($right === '') {
|
||||
|
@@ -7,7 +7,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
||||
{
|
||||
|
||||
/**
|
||||
* @type bool
|
||||
* @type string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
@@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
||||
public $minimized = true;
|
||||
|
||||
/**
|
||||
* @param bool $name
|
||||
* @param bool|string $name
|
||||
*/
|
||||
public function __construct($name = false)
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
|
||||
protected function _compileRegex()
|
||||
{
|
||||
$raw = str_replace(' ', '', $this->dtd_regex);
|
||||
if ($raw{0} != '(') {
|
||||
if ($raw[0] != '(') {
|
||||
$raw = "($raw)";
|
||||
}
|
||||
$el = '[#a-zA-Z0-9_.-]+';
|
||||
|
@@ -21,7 +21,7 @@ class HTMLPurifier_Config
|
||||
* HTML Purifier's version
|
||||
* @type string
|
||||
*/
|
||||
public $version = '4.11.0';
|
||||
public $version = '4.13.0';
|
||||
|
||||
/**
|
||||
* Whether or not to automatically finalize
|
||||
@@ -408,7 +408,7 @@ class HTMLPurifier_Config
|
||||
* maybeGetRawHTMLDefinition, which is more explicitly
|
||||
* named, instead.
|
||||
*
|
||||
* @return HTMLPurifier_HTMLDefinition
|
||||
* @return HTMLPurifier_HTMLDefinition|null
|
||||
*/
|
||||
public function getHTMLDefinition($raw = false, $optimized = false)
|
||||
{
|
||||
@@ -427,7 +427,7 @@ class HTMLPurifier_Config
|
||||
* maybeGetRawCSSDefinition, which is more explicitly
|
||||
* named, instead.
|
||||
*
|
||||
* @return HTMLPurifier_CSSDefinition
|
||||
* @return HTMLPurifier_CSSDefinition|null
|
||||
*/
|
||||
public function getCSSDefinition($raw = false, $optimized = false)
|
||||
{
|
||||
@@ -446,7 +446,7 @@ class HTMLPurifier_Config
|
||||
* maybeGetRawURIDefinition, which is more explicitly
|
||||
* named, instead.
|
||||
*
|
||||
* @return HTMLPurifier_URIDefinition
|
||||
* @return HTMLPurifier_URIDefinition|null
|
||||
*/
|
||||
public function getURIDefinition($raw = false, $optimized = false)
|
||||
{
|
||||
@@ -468,7 +468,7 @@ class HTMLPurifier_Config
|
||||
* maybe semantics is the "right thing to do."
|
||||
*
|
||||
* @throws HTMLPurifier_Exception
|
||||
* @return HTMLPurifier_Definition
|
||||
* @return HTMLPurifier_Definition|null
|
||||
*/
|
||||
public function getDefinition($type, $raw = false, $optimized = false)
|
||||
{
|
||||
@@ -647,7 +647,7 @@ class HTMLPurifier_Config
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HTMLPurifier_HTMLDefinition
|
||||
* @return HTMLPurifier_HTMLDefinition|null
|
||||
*/
|
||||
public function maybeGetRawHTMLDefinition()
|
||||
{
|
||||
@@ -655,7 +655,7 @@ class HTMLPurifier_Config
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HTMLPurifier_CSSDefinition
|
||||
* @return HTMLPurifier_CSSDefinition|null
|
||||
*/
|
||||
public function maybeGetRawCSSDefinition()
|
||||
{
|
||||
@@ -663,7 +663,7 @@ class HTMLPurifier_Config
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HTMLPurifier_URIDefinition
|
||||
* @return HTMLPurifier_URIDefinition|null
|
||||
*/
|
||||
public function maybeGetRawURIDefinition()
|
||||
{
|
||||
|
File diff suppressed because one or more lines are too long
11
library/HTMLPurifier/ConfigSchema/schema/HTML.Forms.txt
Normal file
11
library/HTMLPurifier/ConfigSchema/schema/HTML.Forms.txt
Normal file
@@ -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
|
@@ -159,7 +159,7 @@ class HTMLPurifier_Encoder
|
||||
|
||||
$len = strlen($str);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$in = ord($str{$i});
|
||||
$in = ord($str[$i]);
|
||||
$char .= $str[$i]; // append byte to char
|
||||
if (0 == $mState) {
|
||||
// When mState is zero we expect either a US-ASCII character
|
||||
|
@@ -132,9 +132,9 @@ class HTMLPurifier_HTMLModule
|
||||
* @param string $element Name of element to add
|
||||
* @param string|bool $type What content set should element be registered to?
|
||||
* Set as false to skip this step.
|
||||
* @param string $contents Allowed children in form of:
|
||||
* @param string|HTMLPurifier_ChildDef $contents Allowed children in form of:
|
||||
* "$content_model_type: $content_model"
|
||||
* @param array $attr_includes What attribute collections to register to
|
||||
* @param array|string $attr_includes What attribute collections to register to
|
||||
* element?
|
||||
* @param array $attr What unique attributes does the element define?
|
||||
* @see HTMLPurifier_ElementDef:: for in-depth descriptions of these parameters.
|
||||
|
@@ -28,6 +28,10 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
|
||||
*/
|
||||
public function setup($config)
|
||||
{
|
||||
if ($config->get('HTML.Forms')) {
|
||||
$this->safe = true;
|
||||
}
|
||||
|
||||
$form = $this->addElement(
|
||||
'form',
|
||||
'Form',
|
||||
|
@@ -96,6 +96,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
|
||||
|
||||
// @bgcolor for table, tr, td, th ---------------------------------
|
||||
$r['table@bgcolor'] =
|
||||
$r['tr@bgcolor'] =
|
||||
$r['td@bgcolor'] =
|
||||
$r['th@bgcolor'] =
|
||||
new HTMLPurifier_AttrTransform_BgColor();
|
||||
|
@@ -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,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
// private language message file for unit testing purposes
|
||||
|
||||
$fallback = 'en';
|
||||
|
||||
$messages = array(
|
||||
'HTMLPurifier' => 'HTML Purifier X'
|
||||
);
|
||||
|
||||
$errorNames = array();
|
||||
|
||||
// vim: et sw=4 sts=4
|
@@ -1,14 +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'
|
||||
);
|
||||
|
||||
$errorNames = array();
|
||||
|
||||
// vim: et sw=4 sts=4
|
@@ -74,7 +74,12 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
|
||||
}
|
||||
|
||||
set_error_handler(array($this, 'muteErrorHandler'));
|
||||
$doc->loadHTML($html, $options);
|
||||
// loadHTML() fails on PHP 5.3 when second parameter is given
|
||||
if ($options) {
|
||||
$doc->loadHTML($html, $options);
|
||||
} else {
|
||||
$doc->loadHTML($html);
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
$body = $doc->getElementsByTagName('html')->item(0)-> // <html>
|
||||
|
@@ -43,8 +43,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
|
||||
$ret .= $this->element('caption', 'Doctype');
|
||||
$ret .= $this->row('Name', $doctype->name);
|
||||
$ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
|
||||
$ret .= $this->row('Default Modules', implode($doctype->modules, ', '));
|
||||
$ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', '));
|
||||
$ret .= $this->row('Default Modules', implode(', ', $doctype->modules));
|
||||
$ret .= $this->row('Default Tidy Modules', implode(', ', $doctype->tidyModules));
|
||||
$ret .= $this->end('table');
|
||||
return $ret;
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
|
||||
if (isset($attr['size'])) {
|
||||
// normalize large numbers
|
||||
if ($attr['size'] !== '') {
|
||||
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
|
||||
if ($attr['size'][0] == '+' || $attr['size'][0] == '-') {
|
||||
$size = (int)$attr['size'];
|
||||
if ($size < -2) {
|
||||
$attr['size'] = '-2';
|
||||
|
@@ -9,7 +9,7 @@ class HTMLPurifier_AttrDef_CSS_AlphaValueTest extends HTMLPurifier_AttrDefHarnes
|
||||
|
||||
$this->assertDef('0');
|
||||
$this->assertDef('1');
|
||||
$this->assertDef('.2');
|
||||
$this->assertDef('0.2');
|
||||
|
||||
// clamping to [0.0, 1,0]
|
||||
$this->assertDef('1.2', '1');
|
||||
|
@@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_CSS_BackgroundTest extends HTMLPurifier_AttrDefHarnes
|
||||
);
|
||||
$this->assertDef(
|
||||
'rgba(74, 12, 85, 0.35) repeat fixed bottom',
|
||||
'rgba(74,12,85,.35) repeat fixed bottom'
|
||||
'rgba(74,12,85,0.35) repeat fixed bottom'
|
||||
);
|
||||
$this->assertDef(
|
||||
'hsl(244, 47.4%, 88.1%) right center',
|
||||
|
@@ -20,8 +20,8 @@ class HTMLPurifier_AttrDef_CSS_ColorTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('rgb(12%,150%,0%)', 'rgb(12%,100%,0%)'); // percentage max values
|
||||
|
||||
$this->assertDef('rgba(255, 0, 0, 0)', 'rgba(255,0,0,0)'); // rm spaces
|
||||
$this->assertDef('rgba(100%,0%,0%,.4)');
|
||||
$this->assertDef('rgba(38.1%,59.7%,1.8%,0.7)', 'rgba(38.1%,59.7%,1.8%,.7)'); // decimals okay
|
||||
$this->assertDef('rgba(100%,0%,0%,0.4)');
|
||||
$this->assertDef('rgba(38.1%,59.7%,1.8%,0.7)', 'rgba(38.1%,59.7%,1.8%,0.7)'); // decimals okay
|
||||
|
||||
$this->assertDef('hsl(275, 45%, 81%)', 'hsl(275,45%,81%)'); // rm spaces
|
||||
$this->assertDef('hsl(100,0%,0%)');
|
||||
@@ -30,8 +30,8 @@ class HTMLPurifier_AttrDef_CSS_ColorTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('hsl(380,125%,0%)', 'hsl(360,100%,0%)'); // max values
|
||||
|
||||
$this->assertDef('hsla(100, 74%, 29%, 0)', 'hsla(100,74%,29%,0)'); // rm spaces
|
||||
$this->assertDef('hsla(154,87%,21%,.4)');
|
||||
$this->assertDef('hsla(45,94.3%,4.1%,0.7)', 'hsla(45,94.3%,4.1%,.7)'); // decimals okay
|
||||
$this->assertDef('hsla(154,87%,21%,0.4)');
|
||||
$this->assertDef('hsla(45,94.3%,4.1%,0.7)', 'hsla(45,94.3%,4.1%,0.7)'); // decimals okay
|
||||
|
||||
$this->assertDef('#G00', false);
|
||||
$this->assertDef('cmyk(40, 23, 43, 23)', false);
|
||||
|
@@ -12,8 +12,8 @@ class HTMLPurifier_AttrDef_CSS_NumberTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('1.0', '1');
|
||||
$this->assertDef('34');
|
||||
$this->assertDef('4.5');
|
||||
$this->assertDef('.5');
|
||||
$this->assertDef('0.5', '.5');
|
||||
$this->assertDef('0.5');
|
||||
$this->assertDef('0.5', '0.5');
|
||||
$this->assertDef('-56.9');
|
||||
|
||||
$this->assertDef('0.', '0');
|
||||
@@ -21,10 +21,10 @@ class HTMLPurifier_AttrDef_CSS_NumberTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('0.0', '0');
|
||||
|
||||
$this->assertDef('1.', '1');
|
||||
$this->assertDef('.1', '.1');
|
||||
$this->assertDef('.1', '0.1');
|
||||
|
||||
$this->assertDef('1.0', '1');
|
||||
$this->assertDef('0.1', '.1');
|
||||
$this->assertDef('0.1', '0.1');
|
||||
|
||||
$this->assertDef('000', '0');
|
||||
$this->assertDef(' 9', '9');
|
||||
|
@@ -140,8 +140,8 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('scrollbar-highlight-color:#ff69b4;');
|
||||
$this->assertDef('scrollbar-shadow-color:#f0f;');
|
||||
|
||||
$this->assertDef('-moz-opacity:.2;');
|
||||
$this->assertDef('-khtml-opacity:.2;');
|
||||
$this->assertDef('-moz-opacity:0.2;');
|
||||
$this->assertDef('-khtml-opacity:0.2;');
|
||||
$this->assertDef('filter:alpha(opacity=20);');
|
||||
|
||||
$this->assertDef('border-top-left-radius:55pt 25pt;');
|
||||
@@ -160,7 +160,7 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
|
||||
$this->assertDef('display:none;');
|
||||
$this->assertDef('visibility:visible;');
|
||||
$this->assertDef('overflow:scroll;');
|
||||
$this->assertDef('opacity:.2;');
|
||||
$this->assertDef('opacity:0.2;');
|
||||
}
|
||||
|
||||
public function testForbidden()
|
||||
|
@@ -161,6 +161,13 @@ class HTMLPurifier_HTMLModule_FormsTest extends HTMLPurifier_HTMLModuleHarness
|
||||
$this->assertResult('<form action=""><input align="left" /></form>');
|
||||
}
|
||||
|
||||
public function testHTMLFormsConfigDirective()
|
||||
{
|
||||
$this->config->set('HTML.Trusted', false);
|
||||
$this->config->set('HTML.Forms', true);
|
||||
|
||||
$this->assertResult('<form action="..." method="post"><input type="text" /><textarea cols="20" rows="3"></textarea></form>');
|
||||
}
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
@@ -29,45 +29,6 @@ class HTMLPurifier_LanguageFactoryTest extends HTMLPurifier_Harness
|
||||
|
||||
}
|
||||
|
||||
public function testFallback()
|
||||
{
|
||||
$this->config->set('Core.Language', 'en-x-test');
|
||||
$language = $this->factory->create($this->config, $this->context);
|
||||
|
||||
$this->assertIsA($language, 'HTMLPurifier_Language_en_x_test');
|
||||
$this->assertIdentical($language->code, 'en-x-test');
|
||||
|
||||
$language->load();
|
||||
|
||||
// test overloaded message
|
||||
$this->assertIdentical($language->getMessage('HTMLPurifier'), 'HTML Purifier X');
|
||||
|
||||
// test inherited message
|
||||
$this->assertIdentical($language->getMessage('LanguageFactoryTest: Pizza'), 'Pizza');
|
||||
|
||||
}
|
||||
|
||||
public function testFallbackWithNoClass()
|
||||
{
|
||||
$this->config->set('Core.Language', 'en-x-testmini');
|
||||
$language = $this->factory->create($this->config, $this->context);
|
||||
$this->assertIsA($language, 'HTMLPurifier_Language');
|
||||
$this->assertIdentical($language->code, 'en-x-testmini');
|
||||
$language->load();
|
||||
$this->assertIdentical($language->getMessage('HTMLPurifier'), 'HTML Purifier XNone');
|
||||
$this->assertIdentical($language->getMessage('LanguageFactoryTest: Pizza'), 'Pizza');
|
||||
$this->assertIdentical($language->error, false);
|
||||
}
|
||||
|
||||
public function testNoSuchLanguage()
|
||||
{
|
||||
$this->config->set('Core.Language', 'en-x-testnone');
|
||||
$language = $this->factory->create($this->config, $this->context);
|
||||
$this->assertIsA($language, 'HTMLPurifier_Language');
|
||||
$this->assertIdentical($language->code, 'en-x-testnone');
|
||||
$this->assertIdentical($language->error, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
@@ -32,6 +32,13 @@ class HTMLPurifierTest extends HTMLPurifier_Harness
|
||||
);
|
||||
}
|
||||
|
||||
public function test_purifyArray_empty() {
|
||||
$purifiedEmptyArray = $this->purifier->purifyArray(array());
|
||||
$this->assertTrue(
|
||||
empty($purifiedEmptyArray)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetInstance()
|
||||
{
|
||||
$purifier = HTMLPurifier::getInstance();
|
||||
|
@@ -104,7 +104,7 @@ file_put_contents('library/HTMLPurifier/Config.php', $config_c);
|
||||
|
||||
passthru('maintenance/flush.sh');
|
||||
|
||||
if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL;
|
||||
if ($is_dev) echo "Review changes, write something in WHATSNEW, and then commit with log 'Release $version.'" . PHP_EOL;
|
||||
else echo "Numbers updated to dev, no other modifications necessary!";
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
Reference in New Issue
Block a user