~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to lib/htmlpurifier/HTMLPurifier/AttrTransform/Lang.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
require_once 'HTMLPurifier/AttrTransform.php';
 
4
 
 
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
 
11
{
 
12
    
 
13
    function transform($attr, $config, &$context) {
 
14
        
 
15
        $lang     = isset($attr['lang']) ? $attr['lang'] : false;
 
16
        $xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
 
17
        
 
18
        if ($lang !== false && $xml_lang === false) {
 
19
            $attr['xml:lang'] = $lang;
 
20
        } elseif ($xml_lang !== false) {
 
21
            $attr['lang'] = $xml_lang;
 
22
        }
 
23
        
 
24
        return $attr;
 
25
        
 
26
    }
 
27
    
 
28
}
 
29