1 | <?php |
||
9 | class CTextFilter |
||
10 | { |
||
11 | use \Anax\TConfigure, |
||
12 | \Anax\DI\TInjectionAware; |
||
13 | |||
14 | |||
15 | |||
16 | /** |
||
17 | * Call each filter. |
||
18 | * |
||
19 | * @param string $text the text to filter. |
||
20 | * @param string $filters as comma separated list of filter. |
||
21 | * |
||
22 | * @return string the formatted text. |
||
23 | */ |
||
24 | public function doFilter($text, $filters) |
||
50 | |||
51 | |||
52 | |||
53 | /** |
||
54 | * Helper, BBCode formatting converting to HTML. |
||
55 | * |
||
56 | * @param string $text The text to be converted. |
||
57 | * |
||
58 | * @return string the formatted text. |
||
59 | * |
||
60 | * @link http://dbwebb.se/coachen/reguljara-uttryck-i-php-ger-bbcode-formattering |
||
61 | */ |
||
62 | public function bbcode2html($text) |
||
84 | |||
85 | |||
86 | |||
87 | /** |
||
88 | * Make clickable links from URLs in text. |
||
89 | * |
||
90 | * @param string $text the text that should be formatted. |
||
91 | * |
||
92 | * @return string with formatted anchors. |
||
93 | * |
||
94 | * @link http://dbwebb.se/coachen/lat-php-funktion-make-clickable-automatiskt-skapa-klickbara-lankar |
||
95 | */ |
||
96 | public function makeClickable($text) |
||
106 | |||
107 | |||
108 | |||
109 | /** |
||
110 | * Format text according to Markdown syntax. |
||
111 | * |
||
112 | * @param string $text the text that should be formatted. |
||
113 | * |
||
114 | * @return string as the formatted html-text. |
||
115 | * |
||
116 | * @link http://dbwebb.se/coachen/skriv-for-webben-med-markdown-och-formattera-till-html-med-php |
||
117 | */ |
||
118 | public function markdown($text) |
||
122 | |||
123 | |||
124 | |||
125 | /** |
||
126 | * For convenience access to nl2br |
||
127 | * |
||
128 | * @param string $text text to be converted. |
||
129 | * |
||
130 | * @return string the formatted text. |
||
131 | */ |
||
132 | public function nl2br($text) |
||
136 | |||
137 | |||
138 | |||
139 | /** |
||
140 | * Shortcode to to quicker format text as HTML. |
||
141 | * |
||
142 | * @param string $text text to be converted. |
||
143 | * |
||
144 | * @return string the formatted text. |
||
145 | */ |
||
146 | public function shortCode($text) |
||
183 | |||
184 | |||
185 | |||
186 | /** |
||
187 | * Init shortcode handling by preparing the option list to an array, for those using arguments. |
||
188 | * |
||
189 | * @param string $options for the shortcode. |
||
190 | * |
||
191 | * @return array with all the options. |
||
192 | */ |
||
193 | protected static function shortCodeInit($options) |
||
211 | |||
212 | |||
213 | |||
214 | /** |
||
215 | * Shortcode for <figure>. |
||
216 | * |
||
217 | * Usage example: [FIGURE src="img/home/me.jpg" caption="Me" alt="Bild på mig" nolink="nolink"] |
||
218 | * |
||
219 | * @param string $options for the shortcode. |
||
220 | * |
||
221 | * @return array with all the options. |
||
222 | */ |
||
223 | protected static function shortCodeFigure($options) |
||
271 | |||
272 | |||
273 | |||
274 | /** |
||
275 | * Shortcode for adding BASEURL to links. |
||
276 | * |
||
277 | * Usage example: [BASEURL] |
||
278 | * |
||
279 | * @return array with all the options. |
||
280 | */ |
||
281 | protected function shortCodeBaseurl() |
||
285 | |||
286 | |||
287 | |||
288 | /** |
||
289 | * Shortcode for adding RELURL to links. |
||
290 | * |
||
291 | * Usage example: [RELURL] |
||
292 | * |
||
293 | * @return array with all the options. |
||
294 | */ |
||
295 | protected function shortCodeRelurl() |
||
299 | |||
300 | |||
301 | /** |
||
302 | * Shortcode for adding RELURL to links. |
||
303 | * |
||
304 | * Usage example: [RELURL] |
||
305 | * |
||
306 | * @return array with all the options. |
||
307 | */ |
||
308 | protected function shortCodeAsset() |
||
312 | } |
||
313 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.