~andy-freeborough/sahana-agasti/krakatoa

« back to all changes in this revision

Viewing changes to sahana-phase2/3rd/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php

  • Committer: Greg Miernicki
  • Date: 2011-01-13 18:39:51 UTC
  • Revision ID: g@miernicki.com-20110113183951-7o6e8mpjgkw7bj2w
new htmlpurifier added

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Decorator which enables CSS properties to be disabled for specific elements.
 
5
 */
 
6
class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
 
7
{
 
8
    public $def, $element;
 
9
 
 
10
    /**
 
11
     * @param $def Definition to wrap
 
12
     * @param $element Element to deny
 
13
     */
 
14
    public function __construct($def, $element) {
 
15
        $this->def = $def;
 
16
        $this->element = $element;
 
17
    }
 
18
    /**
 
19
     * Checks if CurrentToken is set and equal to $this->element
 
20
     */
 
21
    public function validate($string, $config, $context) {
 
22
        $token = $context->get('CurrentToken', true);
 
23
        if ($token && $token->name == $this->element) return false;
 
24
        return $this->def->validate($string, $config, $context);
 
25
    }
 
26
}
 
27
 
 
28
// vim: et sw=4 sts=4