mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
[1.7.0] Modify addElement to return a reference to the created definition, shorten other HTMLModules accordingly.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1046 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -17,7 +17,7 @@ class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
|
||||
|
||||
function HTMLPurifier_HTMLModule_Bdo() {
|
||||
$dir = new HTMLPurifier_AttrDef_Enum(array('ltr','rtl'), false);
|
||||
$this->addElement(
|
||||
$bdo =& $this->addElement(
|
||||
'bdo', true, 'Inline', 'Inline', array('Core', 'Lang'),
|
||||
array(
|
||||
'dir' => $dir, // required
|
||||
@@ -28,7 +28,8 @@ class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
|
||||
// be managed with a global attribute transform)
|
||||
)
|
||||
);
|
||||
$this->info['bdo']->attr_transform_post['required-dir'] = new HTMLPurifier_AttrTransform_BdoDir();
|
||||
$bdo->attr_transform_post['required-dir'] = new HTMLPurifier_AttrTransform_BdoDir();
|
||||
|
||||
$this->attr_collections['I18N']['dir'] = $dir;
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
|
||||
var $name = 'Hypertext';
|
||||
|
||||
function HTMLPurifier_HTMLModule_Hypertext() {
|
||||
$this->addElement(
|
||||
$a =& $this->addElement(
|
||||
'a', true, 'Inline', 'Inline', 'Common',
|
||||
array(
|
||||
// 'accesskey' => 'Character',
|
||||
@@ -25,7 +25,7 @@ class HTMLPurifier_HTMLModule_Hypertext extends HTMLPurifier_HTMLModule
|
||||
// 'type' => 'ContentType',
|
||||
)
|
||||
);
|
||||
$this->info['a']->excludes = array('a' => true);
|
||||
$a->excludes = array('a' => true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
|
||||
var $content_sets = array('Inline' => 'img');
|
||||
|
||||
function HTMLPurifier_HTMLModule_Image() {
|
||||
$this->addElement(
|
||||
$img =& $this->addElement(
|
||||
'img', true, 'Inline', 'Empty', 'Common',
|
||||
array(
|
||||
'alt' => 'Text',
|
||||
@@ -28,7 +28,7 @@ class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
|
||||
'width' => 'Length'
|
||||
)
|
||||
);
|
||||
$this->info['img']->attr_transform_post[] =
|
||||
$img->attr_transform_post[] =
|
||||
new HTMLPurifier_AttrTransform_ImgRequired();
|
||||
}
|
||||
|
||||
|
@@ -26,8 +26,8 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
|
||||
$this->addElement('ul', true, 'List', 'Required: li', 'Common');
|
||||
$this->addElement('dl', true, 'List', 'Required: dt | dd', 'Common');
|
||||
|
||||
$this->addElement('li', true, false, 'Flow', 'Common');
|
||||
$this->info['li']->auto_close = array('li' => true);
|
||||
$li =& $this->addElement('li', true, false, 'Flow', 'Common');
|
||||
$li->auto_close = array('li' => true);
|
||||
|
||||
$this->addElement('dd', true, false, 'Flow', 'Common');
|
||||
$this->addElement('dt', true, false, 'Inline', 'Common');
|
||||
|
Reference in New Issue
Block a user