HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
00009 {
00010 
00011     public function validate($string, $config, $context) {
00012 
00013         static $allowed_values = array(
00014             'line-through' => true,
00015             'overline' => true,
00016             'underline' => true,
00017         );
00018 
00019         $string = strtolower($this->parseCDATA($string));
00020 
00021         if ($string === 'none') return $string;
00022 
00023         $parts = explode(' ', $string);
00024         $final = '';
00025         foreach ($parts as $part) {
00026             if (isset($allowed_values[$part])) {
00027                 $final .= $part . ' ';
00028             }
00029         }
00030         $final = rtrim($final);
00031         if ($final === '') return false;
00032         return $final;
00033 
00034     }
00035 
00036 }
00037 
00038 // vim: et sw=4 sts=4