mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-23 17:01:51 +00:00
24c64dbbac
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@256 48356398-32a2-884e-a903-53898d9a118a
28 lines
712 B
PHP
28 lines
712 B
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrTransform.php';
|
|
|
|
// this transformation may be done pre or post validation, but post is
|
|
// preferred, since invalid languages then will have been dropped.
|
|
|
|
class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
|
|
{
|
|
|
|
function transform($attr, $config) {
|
|
|
|
$lang = isset($attr['lang']) ? $attr['lang'] : false;
|
|
$xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
|
|
|
|
if ($lang !== false && $xml_lang === false) {
|
|
$attr['xml:lang'] = $lang;
|
|
} elseif ($xml_lang !== false) {
|
|
$attr['lang'] = $xml_lang;
|
|
}
|
|
|
|
return $attr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|