1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 06:07:26 +02:00

Implement lang and xml:lang. Fixed a bunch of bugs too.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@162 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-05 01:50:13 +00:00
parent 1945ddca5c
commit 8a23710405
11 changed files with 312 additions and 7 deletions

View File

@@ -45,6 +45,9 @@ class HTMLPurifier_Definition
// used solely by HTMLPurifier_Strategy_RemoveForeignElements
var $info_tag_transform = array();
// used solely by HTMLPurifier_Strategy_ValidateAttributes
var $info_attr_transform = array();
// WARNING! Prototype is not passed by reference, so in order to get
// a copy of the real one, you'll have to destroy your copy and
// use instance() to get it.
@@ -238,11 +241,22 @@ class HTMLPurifier_Definition
// which manually override these in their local definitions
$this->info_global_attr = array(
// core attrs
'id' => new HTMLPurifier_AttrDef_ID(),
'id' => new HTMLPurifier_AttrDef_ID(),
'class' => new HTMLPurifier_AttrDef_Class(),
'title' => new HTMLPurifier_AttrDef_Text(),
// i18n
'dir' => new HTMLPurifier_AttrDef_Enum(array('ltr','rtl'), false),
'dir' => new HTMLPurifier_AttrDef_Enum(array('ltr','rtl'), false),
'lang' => new HTMLPurifier_AttrDef_Lang(),
'xml:lang' => new HTMLPurifier_AttrDef_Lang(),
);
// required attribute stipulation handled in attribute transformation
$this->info['bdo']->attr = array();
$this->info['br']->attr = array(
'dir' => false,
'lang' => false,
'xml:lang' => false,
);
//////////////////////////////////////////////////////////////////////
@@ -275,9 +289,11 @@ class HTMLPurifier_Definition
// UNIMP : info[]->attr_transform : attribute transformations in elements
//////////////////////////////////////////////////////////////////////
// UNIMP : info_attr_transform : global attribute transform (for xml:lang)
// info_attr_transform : global attribute transformation that is
// unconditionally called. Good for transformations that have complex
// start conditions
// this might have bad implications for performance
$this->info_attr_transform[] = new HTMLPurifier_AttrTransform_Lang();
}