diff options
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php new file mode 100644 index 00000000..3ee81711 --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/ConfigSchema/Interchange/Id.php | |||
@@ -0,0 +1,58 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Represents a directive ID in the interchange format. | ||
5 | */ | ||
6 | class HTMLPurifier_ConfigSchema_Interchange_Id | ||
7 | { | ||
8 | |||
9 | /** | ||
10 | * @type string | ||
11 | */ | ||
12 | public $key; | ||
13 | |||
14 | /** | ||
15 | * @param string $key | ||
16 | */ | ||
17 | public function __construct($key) | ||
18 | { | ||
19 | $this->key = $key; | ||
20 | } | ||
21 | |||
22 | /** | ||
23 | * @return string | ||
24 | * @warning This is NOT magic, to ensure that people don't abuse SPL and | ||
25 | * cause problems for PHP 5.0 support. | ||
26 | */ | ||
27 | public function toString() | ||
28 | { | ||
29 | return $this->key; | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * @return string | ||
34 | */ | ||
35 | public function getRootNamespace() | ||
36 | { | ||
37 | return substr($this->key, 0, strpos($this->key, ".")); | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * @return string | ||
42 | */ | ||
43 | public function getDirective() | ||
44 | { | ||
45 | return substr($this->key, strpos($this->key, ".") + 1); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @param string $id | ||
50 | * @return HTMLPurifier_ConfigSchema_Interchange_Id | ||
51 | */ | ||
52 | public static function make($id) | ||
53 | { | ||
54 | return new HTMLPurifier_ConfigSchema_Interchange_Id($id); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | // vim: et sw=4 sts=4 | ||