mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-03-23 22:37:02 +00:00
[3.1.1] Migrate all HTMLModules to use setup($config) rather than __construct
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1761 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
8d0d0d1a03
commit
fcebb7731d
7
NEWS
7
NEWS
@ -23,9 +23,12 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
to __construct($min, $max). __construct(true) is equivalent to
|
to __construct($min, $max). __construct(true) is equivalent to
|
||||||
__construct('0').
|
__construct('0').
|
||||||
. Added HTMLPurifier_AttrDef_Switch class
|
. Added HTMLPurifier_AttrDef_Switch class
|
||||||
. Rename HTMLPurifier_HTMLModule_Tidy->construct() to setup(), and bubble
|
. Rename HTMLPurifier_HTMLModule_Tidy->construct() to setup() and bubble method
|
||||||
up inheritance hierarchy to HTMLPurifier_HTMLModule. All HTMLModules
|
up inheritance hierarchy to HTMLPurifier_HTMLModule. All HTMLModules
|
||||||
get this called with the configuration object.
|
get this called with the configuration object. All modules now
|
||||||
|
use this rather than __construct(), although legacy code using constructors
|
||||||
|
will still work--the new format, however, lets modules access the
|
||||||
|
configuration object for HTML namespace dependant tweaks.
|
||||||
|
|
||||||
3.1.0, released 2008-05-18
|
3.1.0, released 2008-05-18
|
||||||
# Unnecessary references to objects (vestiges of PHP4) removed from method
|
# Unnecessary references to objects (vestiges of PHP4) removed from method
|
||||||
|
@ -12,7 +12,7 @@ class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
|
|||||||
'I18N' => array('dir' => false)
|
'I18N' => array('dir' => false)
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$bdo = $this->addElement(
|
$bdo = $this->addElement(
|
||||||
'bdo', 'Inline', 'Inline', array('Core', 'Lang'),
|
'bdo', 'Inline', 'Inline', array('Core', 'Lang'),
|
||||||
array(
|
array(
|
||||||
|
@ -9,7 +9,7 @@ class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Edit';
|
public $name = 'Edit';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
|
$contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
|
||||||
$attr = array(
|
$attr = array(
|
||||||
'cite' => 'URI',
|
'cite' => 'URI',
|
||||||
|
@ -8,7 +8,7 @@ class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Hypertext';
|
public $name = 'Hypertext';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$a = $this->addElement(
|
$a = $this->addElement(
|
||||||
'a', 'Inline', 'Inline', 'Common',
|
'a', 'Inline', 'Inline', 'Common',
|
||||||
array(
|
array(
|
||||||
|
@ -10,7 +10,7 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Image';
|
public $name = 'Image';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$img = $this->addElement(
|
$img = $this->addElement(
|
||||||
'img', 'Inline', 'Empty', 'Common',
|
'img', 'Inline', 'Empty', 'Common',
|
||||||
array(
|
array(
|
||||||
|
@ -21,7 +21,7 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Legacy';
|
public $name = 'Legacy';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
|
|
||||||
$this->addElement('basefont', 'Inline', 'Empty', false, array(
|
$this->addElement('basefont', 'Inline', 'Empty', false, array(
|
||||||
'color' => 'Color',
|
'color' => 'Color',
|
||||||
|
@ -19,7 +19,7 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $content_sets = array('Flow' => 'List');
|
public $content_sets = array('Flow' => 'List');
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$this->addElement('ol', 'List', 'Required: li', 'Common');
|
$this->addElement('ol', 'List', 'Required: li', 'Common');
|
||||||
$this->addElement('ul', 'List', 'Required: li', 'Common');
|
$this->addElement('ul', 'List', 'Required: li', 'Common');
|
||||||
$this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
|
$this->addElement('dl', 'List', 'Required: dt | dd', 'Common');
|
||||||
|
@ -11,7 +11,7 @@ class HTMLPurifier_HTMLModule_Object extends HTMLPurifier_HTMLModule
|
|||||||
public $name = 'Object';
|
public $name = 'Object';
|
||||||
public $safe = false;
|
public $safe = false;
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
|
|
||||||
$this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common',
|
$this->addElement('object', 'Inline', 'Optional: #PCDATA | Flow | param', 'Common',
|
||||||
array(
|
array(
|
||||||
|
@ -15,7 +15,7 @@ class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Presentation';
|
public $name = 'Presentation';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$this->addElement('b', 'Inline', 'Inline', 'Common');
|
$this->addElement('b', 'Inline', 'Inline', 'Common');
|
||||||
$this->addElement('big', 'Inline', 'Inline', 'Common');
|
$this->addElement('big', 'Inline', 'Inline', 'Common');
|
||||||
$this->addElement('hr', 'Block', 'Empty', 'Common');
|
$this->addElement('hr', 'Block', 'Empty', 'Common');
|
||||||
|
@ -9,7 +9,7 @@ class HTMLPurifier_HTMLModule_Proprietary extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Proprietary';
|
public $name = 'Proprietary';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
|
|
||||||
$this->addElement('marquee', 'Inline', 'Flow', 'Common',
|
$this->addElement('marquee', 'Inline', 'Flow', 'Common',
|
||||||
array(
|
array(
|
||||||
|
@ -9,7 +9,7 @@ class HTMLPurifier_HTMLModule_Ruby extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Ruby';
|
public $name = 'Ruby';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$this->addElement('ruby', 'Inline',
|
$this->addElement('ruby', 'Inline',
|
||||||
'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
|
'Custom: ((rb, (rt | (rp, rt, rp))) | (rbc, rtc, rtc?))',
|
||||||
'Common');
|
'Common');
|
||||||
|
@ -20,7 +20,7 @@ class HTMLPurifier_HTMLModule_Scripting extends HTMLPurifier_HTMLModule
|
|||||||
public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
|
public $content_sets = array('Block' => 'script | noscript', 'Inline' => 'script | noscript');
|
||||||
public $safe = false;
|
public $safe = false;
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
// TODO: create custom child-definition for noscript that
|
// TODO: create custom child-definition for noscript that
|
||||||
// auto-wraps stray #PCDATA in a similar manner to
|
// auto-wraps stray #PCDATA in a similar manner to
|
||||||
// blockquote's custom definition (we would use it but
|
// blockquote's custom definition (we would use it but
|
||||||
|
@ -15,7 +15,7 @@ class HTMLPurifier_HTMLModule_StyleAttribute extends HTMLPurifier_HTMLModule
|
|||||||
'Core' => array(0 => array('Style'))
|
'Core' => array(0 => array('Style'))
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
|
$this->attr_collections['Style']['style'] = new HTMLPurifier_AttrDef_CSS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class HTMLPurifier_HTMLModule_Tables extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Tables';
|
public $name = 'Tables';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
|
|
||||||
$this->addElement('caption', false, 'Inline', 'Common');
|
$this->addElement('caption', false, 'Inline', 'Common');
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ class HTMLPurifier_HTMLModule_Target extends HTMLPurifier_HTMLModule
|
|||||||
|
|
||||||
public $name = 'Target';
|
public $name = 'Target';
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
$elements = array('a');
|
$elements = array('a');
|
||||||
foreach ($elements as $name) {
|
foreach ($elements as $name) {
|
||||||
$e = $this->addBlankElement($name);
|
$e = $this->addBlankElement($name);
|
||||||
|
@ -20,7 +20,7 @@ class HTMLPurifier_HTMLModule_Text extends HTMLPurifier_HTMLModule
|
|||||||
'Flow' => 'Heading | Block | Inline'
|
'Flow' => 'Heading | Block | Inline'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct() {
|
public function setup($config) {
|
||||||
|
|
||||||
// Inline Phrasal -------------------------------------------------
|
// Inline Phrasal -------------------------------------------------
|
||||||
$this->addElement('abbr', 'Inline', 'Inline', 'Common');
|
$this->addElement('abbr', 'Inline', 'Inline', 'Common');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user