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

« back to all changes in this revision

Viewing changes to lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/TextDecoration.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/AttrDef.php';
 
4
 
 
5
/**
 
6
 * Validates the value for the CSS property text-decoration
 
7
 * @note This class could be generalized into a version that acts sort of
 
8
 *       like Enum except you can compound the allowed values.
 
9
 */
 
10
class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
 
11
{
 
12
    
 
13
    function validate($string, $config, &$context) {
 
14
        
 
15
        static $allowed_values = array(
 
16
            'line-through' => true,
 
17
            'overline' => true,
 
18
            'underline' => true,
 
19
        );
 
20
        
 
21
        $string = strtolower($this->parseCDATA($string));
 
22
        
 
23
        if ($string === 'none') return $string;
 
24
        
 
25
        $parts = explode(' ', $string);
 
26
        $final = '';
 
27
        foreach ($parts as $part) {
 
28
            if (isset($allowed_values[$part])) {
 
29
                $final .= $part . ' ';
 
30
            }
 
31
        }
 
32
        $final = rtrim($final);
 
33
        if ($final === '') return false;
 
34
        return $final;
 
35
        
 
36
    }
 
37
    
 
38
}
 
39