Conditions | 8 |
Paths | 8 |
Total Lines | 29 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace EvolutionCMS\Legacy; |
||
17 | public function htmlspecialchars($str = '', $flags = ENT_COMPAT, $encode = '', $safecount = 0) |
||
18 | { |
||
19 | $safecount++; |
||
20 | $modx = evolutionCMS(); |
||
21 | |||
22 | if (1000 < $safecount) { |
||
23 | exit("error too many loops '{$safecount}'"); |
||
24 | } |
||
25 | |||
26 | if (is_array($str)) { |
||
27 | foreach ($str as $i => $v) { |
||
28 | $str[$i] = $this->htmlspecialchars($v, $flags, $encode, $safecount); |
||
29 | } |
||
30 | } elseif ($str !== '') { |
||
31 | if ($encode !== '') { |
||
32 | $encode = $modx->config['modx_charset']; |
||
33 | } |
||
34 | $ent_str = htmlspecialchars($str, $flags, $encode); |
||
35 | |||
36 | if (!empty($str) && empty($ent_str)) { |
||
37 | $detect_order = implode(',', mb_detect_order()); |
||
38 | $ent_str = mb_convert_encoding($str, $encode, $detect_order); |
||
39 | } |
||
40 | } else { |
||
41 | $ent_str = ''; |
||
42 | } |
||
43 | |||
44 | return $ent_str; |
||
45 | } |
||
46 | } |
||
47 |
This check looks
TODO
comments that have been left in the code.``TODO``s show that something is left unfinished and should be attended to.