1 | <?php |
||
16 | class Highlighter { |
||
17 | |||
18 | // Highlighter ID for no types |
||
19 | const TYPE_NOTYPE = 0; |
||
20 | // Highlighter ID for properties |
||
21 | const TYPE_PROPERTY = 1; |
||
22 | // Highlighter ID for text |
||
23 | const TYPE_TEXT = 2; |
||
24 | // Highlighter ID for quantities |
||
25 | const TYPE_QUANTITY = 3; |
||
26 | // Highlighter ID for warnings |
||
27 | const TYPE_WARNING = 4; |
||
28 | // Highlighter ID for informations |
||
29 | const TYPE_INFO = 5; |
||
30 | // Highlighter ID for help |
||
31 | const TYPE_HELP = 6; |
||
32 | // Highlighter ID for notes |
||
33 | const TYPE_NOTE = 7; |
||
34 | // Highlighter ID for service links |
||
35 | const TYPE_SERVICE = 8; |
||
36 | const TYPE_REFERENCE = 9; |
||
37 | |||
38 | /** |
||
39 | * @var array $options |
||
40 | */ |
||
41 | private $options; |
||
42 | |||
43 | /** |
||
44 | * @var int $type |
||
45 | */ |
||
46 | private $type; |
||
47 | |||
48 | /** |
||
49 | * @var string|null |
||
50 | */ |
||
51 | private $language = null; |
||
52 | |||
53 | /** |
||
54 | * @since 1.9 |
||
55 | * |
||
56 | * @param int $type |
||
57 | * @param string|null $language |
||
58 | */ |
||
59 | 78 | public function __construct( $type, $language = null ) { |
|
63 | |||
64 | /** |
||
65 | * @since 1.9 |
||
66 | * |
||
67 | * @param string|int $type |
||
68 | * @param string|null $language |
||
69 | * |
||
70 | * @return Highlighter |
||
71 | */ |
||
72 | 78 | public static function factory( $type, $language = null ) { |
|
79 | |||
80 | /** |
||
81 | * Returns html output |
||
82 | * |
||
83 | * @since 1.9 |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 65 | public function getHtml() { |
|
91 | |||
92 | /** |
||
93 | * Set content |
||
94 | * |
||
95 | * An external class that invokes content via setContent has to ensure |
||
96 | * that all data are appropriately escaped. |
||
97 | * |
||
98 | * @since 1.9 |
||
99 | * |
||
100 | * @param array $content |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | 65 | public function setContent( array $content ) { |
|
112 | |||
113 | /** |
||
114 | * Returns type id |
||
115 | * |
||
116 | * @since 1.9 |
||
117 | * |
||
118 | * @param string $type |
||
119 | * |
||
120 | * @return integer |
||
121 | */ |
||
122 | 65 | public static function getTypeId( $type ) { |
|
147 | |||
148 | /** |
||
149 | * Builds Html container |
||
150 | * |
||
151 | * Content that is being invoked has to be escaped |
||
152 | * @see Highlighter::setContent |
||
153 | * |
||
154 | * @since 1.9 |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | 65 | private function getContainer() { |
|
193 | |||
194 | /** |
||
195 | * Returns initial configuation settings |
||
196 | * |
||
197 | * @note You could create a class per entity type but does this |
||
198 | * really make sense just to get some configuration parameters? |
||
199 | * |
||
200 | * @since 1.9 |
||
201 | * |
||
202 | * @param string $type |
||
203 | * |
||
204 | * @return array |
||
205 | */ |
||
206 | 65 | private function getTypeConfiguration( $type ) { |
|
263 | } |
||
264 |