]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php
remove autoload section in composer.json
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / AttrDef / CSS / DenyElementDecorator.php
CommitLineData
d4949327
NL
1<?php\r
2\r
3/**\r
4 * Decorator which enables CSS properties to be disabled for specific elements.\r
5 */\r
6class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef\r
7{\r
8 /**\r
9 * @type HTMLPurifier_AttrDef\r
10 */\r
11 public $def;\r
12 /**\r
13 * @type string\r
14 */\r
15 public $element;\r
16\r
17 /**\r
18 * @param HTMLPurifier_AttrDef $def Definition to wrap\r
19 * @param string $element Element to deny\r
20 */\r
21 public function __construct($def, $element)\r
22 {\r
23 $this->def = $def;\r
24 $this->element = $element;\r
25 }\r
26\r
27 /**\r
28 * Checks if CurrentToken is set and equal to $this->element\r
29 * @param string $string\r
30 * @param HTMLPurifier_Config $config\r
31 * @param HTMLPurifier_Context $context\r
32 * @return bool|string\r
33 */\r
34 public function validate($string, $config, $context)\r
35 {\r
36 $token = $context->get('CurrentToken', true);\r
37 if ($token && $token->name == $this->element) {\r
38 return false;\r
39 }\r
40 return $this->def->validate($string, $config, $context);\r
41 }\r
42}\r
43\r
44// vim: et sw=4 sts=4\r