| @@ 405-432 (lines=28) @@ | ||
| 402 | * |
|
| 403 | * @return string|array |
|
| 404 | */ |
|
| 405 | public function getText($name, $separator = '; ') |
|
| 406 | { |
|
| 407 | $getResult = function ($name, $texts) { |
|
| 408 | if (is_array($name)) { |
|
| 409 | $name = implode('_', $name); |
|
| 410 | } |
|
| 411 | if (!isset($texts[$name])) { |
|
| 412 | return null; |
|
| 413 | } |
|
| 414 | if (is_array($texts[$name])) { |
|
| 415 | if (isset($texts[$name][$this->lang])) { |
|
| 416 | return $texts[$name][$this->lang]; |
|
| 417 | } |
|
| 418 | ||
| 419 | return array_values($texts[$name])[0]; |
|
| 420 | } |
|
| 421 | ||
| 422 | return $texts[$name]; |
|
| 423 | }; |
|
| 424 | $result = $getResult($name, $this->texts); |
|
| 425 | if (is_array($result)) { |
|
| 426 | if ($separator) { |
|
| 427 | $result = implode($separator, $result); |
|
| 428 | } |
|
| 429 | } |
|
| 430 | ||
| 431 | return $result; |
|
| 432 | } |
|
| 433 | ||
| 434 | protected function viewInstall() |
|
| 435 | { |
|
| @@ 104-131 (lines=28) @@ | ||
| 101 | * |
|
| 102 | * @return string|array |
|
| 103 | */ |
|
| 104 | public function getText($name, $separator = '; ') |
|
| 105 | { |
|
| 106 | $getResult = function ($name, $texts) { |
|
| 107 | if (is_array($name)) { |
|
| 108 | $name = implode('_', $name); |
|
| 109 | } |
|
| 110 | if (!isset($texts[$name])) { |
|
| 111 | return null; |
|
| 112 | } |
|
| 113 | if (is_array($texts[$name])) { |
|
| 114 | if (isset($texts[$name][$this->lang])) { |
|
| 115 | return $texts[$name][$this->lang]; |
|
| 116 | } |
|
| 117 | ||
| 118 | return array_values($texts[$name])[0]; |
|
| 119 | } |
|
| 120 | ||
| 121 | return $texts[$name]; |
|
| 122 | }; |
|
| 123 | $result = $getResult($name, $this->texts); |
|
| 124 | if (is_array($result)) { |
|
| 125 | if ($separator) { |
|
| 126 | $result = implode($separator, $result); |
|
| 127 | } |
|
| 128 | } |
|
| 129 | ||
| 130 | return $result; |
|
| 131 | } |
|
| 132 | ||
| 133 | protected function viewMenu($master = '') |
|
| 134 | { |
|