Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrTransform / Lang.php
blobacb1786ae9ad639f9b4f0231f61d9ec18458454b
1 <?php
3 require_once 'HTMLPurifier/AttrTransform.php';
5 /**
6 * Post-transform that copies lang's value to xml:lang (and vice-versa)
7 * @note Theoretically speaking, this could be a pre-transform, but putting
8 * post is more efficient.
9 */
10 class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
13 function transform($attr, $config, &$context) {
15 $lang = isset($attr['lang']) ? $attr['lang'] : false;
16 $xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
18 if ($lang !== false && $xml_lang === false) {
19 $attr['xml:lang'] = $lang;
20 } elseif ($xml_lang !== false) {
21 $attr['lang'] = $xml_lang;
24 return $attr;