| Conditions | 5 |
| Paths | 9 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public static function getText($key, array $data = []) |
||
| 35 | { |
||
| 36 | |||
| 37 | $stringsJson = json_decode(file_get_contents(VDIR.'/strings_'.APP_LANG.'.json'), true); |
||
|
|
|||
| 38 | |||
| 39 | if (empty(self::$_texts)) { |
||
| 40 | $texts=$stringsJson['TEXTS']; |
||
| 41 | self::$_texts = is_array($texts) ? $texts : []; |
||
| 42 | } |
||
| 43 | if (array_key_exists($key, self::$_texts)) { |
||
| 44 | $text = self::$_texts[$key]; |
||
| 45 | |||
| 46 | foreach ($data as $search => $replace) { |
||
| 47 | $text = str_replace($search, $replace, $text); |
||
| 48 | } |
||
| 49 | return $text; |
||
| 50 | } |
||
| 51 | return ""; |
||
| 52 | } |
||
| 56 |