mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 15:28:40 +00:00
[3.1.0] Implement Proprietary HTML module with <marquee>
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1572 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
f2863557f5
commit
b5f1c76ee8
3
NEWS
3
NEWS
@ -26,6 +26,9 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
You may find a use for these in your own project, but right now they
|
You may find a use for these in your own project, but right now they
|
||||||
are highly experimental and volatile.
|
are highly experimental and volatile.
|
||||||
! Integration with PHPT allows for automated smoketests
|
! Integration with PHPT allows for automated smoketests
|
||||||
|
! Limited support for proprietary HTML elements, namely <marquee>, sponsored
|
||||||
|
by Chris. You can enable them with %HTML.Proprietary if your client
|
||||||
|
demands them.
|
||||||
- Autoclose now operates iteratively, i.e. <span><span><div> now has
|
- Autoclose now operates iteratively, i.e. <span><span><div> now has
|
||||||
both span tags closed.
|
both span tags closed.
|
||||||
- Various HTMLPurifier_Config convenience functions now accept another parameter
|
- Various HTMLPurifier_Config convenience functions now accept another parameter
|
||||||
|
11
library/HTMLPurifier/ConfigSchema/HTML.Proprietary.txt
Normal file
11
library/HTMLPurifier/ConfigSchema/HTML.Proprietary.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
HTML.Proprietary
|
||||||
|
TYPE: bool
|
||||||
|
VERSION: 3.1.0
|
||||||
|
DEFAULT: false
|
||||||
|
--DESCRIPTION--
|
||||||
|
<p>
|
||||||
|
Whether or not to allow proprietary elements and attributes in your
|
||||||
|
documents, as per <code>HTMLPurifier_HTMLModule_Proprietary</code>.
|
||||||
|
<strong>Warning:</strong> This can cause your documents to stop
|
||||||
|
validating!
|
||||||
|
</p>
|
File diff suppressed because one or more lines are too long
32
library/HTMLPurifier/HTMLModule/Proprietary.php
Normal file
32
library/HTMLPurifier/HTMLModule/Proprietary.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module defines proprietary tags and attributes in HTML.
|
||||||
|
* @warning If this module is enabled, standards-compliance is off!
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
|
||||||
|
{
|
||||||
|
|
||||||
|
public $name = 'Proprietary';
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
|
||||||
|
$this->addElement('marquee', true, 'Inline', 'Flow', 'Common',
|
||||||
|
array(
|
||||||
|
'direction' => 'Enum#left,right,up,down',
|
||||||
|
'behavior' => 'Enum#alternate',
|
||||||
|
'width' => 'Length',
|
||||||
|
'height' => 'Length',
|
||||||
|
'scrolldelay' => 'Number',
|
||||||
|
'scrollamount' => 'Number',
|
||||||
|
'loop' => 'Number',
|
||||||
|
'bgcolor' => 'Color',
|
||||||
|
'hspace' => 'Pixels',
|
||||||
|
'vspace' => 'Pixels',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -213,6 +213,12 @@ class HTMLPurifier_HTMLModuleManager
|
|||||||
// merge in custom modules
|
// merge in custom modules
|
||||||
$modules = array_merge($modules, $this->userModules);
|
$modules = array_merge($modules, $this->userModules);
|
||||||
|
|
||||||
|
// add proprietary module (this gets special treatment because
|
||||||
|
// it is completely removed from doctypes, etc.)
|
||||||
|
if ($config->get('HTML', 'Proprietary')) {
|
||||||
|
$modules[] = 'Proprietary';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$this->processModule($module);
|
$this->processModule($module);
|
||||||
}
|
}
|
||||||
|
29
tests/HTMLPurifier/HTMLModule/ProprietaryTest.php
Normal file
29
tests/HTMLPurifier/HTMLModule/ProprietaryTest.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class HTMLPurifier_HTMLModule_ProprietaryTest extends HTMLPurifier_HTMLModuleHarness
|
||||||
|
{
|
||||||
|
|
||||||
|
function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
$this->config->set('HTML', 'Proprietary', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function testMarquee() {
|
||||||
|
$this->assertResult(
|
||||||
|
'<span><marquee
|
||||||
|
width="20%"
|
||||||
|
height="34"
|
||||||
|
direction="left"
|
||||||
|
behavior="alternate"
|
||||||
|
scrolldelay="3"
|
||||||
|
scrollamount="5"
|
||||||
|
loop="4"
|
||||||
|
bgcolor="red"
|
||||||
|
hspace="5"
|
||||||
|
vspace="3"
|
||||||
|
><div>Block</div><span>Inline</span>Text</marquee></span>'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user