@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public static function init() : void |
| 121 | 121 | { |
| 122 | - if(self::$initDone) { |
|
| 122 | + if (self::$initDone) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public static function getLocalesByNS(string $namespace) |
| 165 | 165 | { |
| 166 | - if(isset(self::$locales[$namespace])) { |
|
| 166 | + if (isset(self::$locales[$namespace])) { |
|
| 167 | 167 | return array_values(self::$locales[$namespace]); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public static function addLocaleByNS(string $localeName, string $namespace) : Localization_Locale |
| 210 | 210 | { |
| 211 | - if(!isset(self::$locales[$namespace])) { |
|
| 211 | + if (!isset(self::$locales[$namespace])) { |
|
| 212 | 212 | self::$locales[$namespace] = array(); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if(!isset(self::$locales[$namespace][$localeName])) |
|
| 215 | + if (!isset(self::$locales[$namespace][$localeName])) |
|
| 216 | 216 | { |
| 217 | 217 | self::$locales[$namespace][$localeName] = self::createLocale($localeName); |
| 218 | 218 | |
@@ -274,11 +274,11 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public static function createCountry(string $id) : Localization_Country |
| 276 | 276 | { |
| 277 | - $className = Localization_Country::class.'_' . strtoupper($id); |
|
| 277 | + $className = Localization_Country::class.'_'.strtoupper($id); |
|
| 278 | 278 | |
| 279 | 279 | $country = new $className(); |
| 280 | 280 | |
| 281 | - if($country instanceof Localization_Country) |
|
| 281 | + if ($country instanceof Localization_Country) |
|
| 282 | 282 | { |
| 283 | 283 | return $country; |
| 284 | 284 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | self::requireNamespace($namespace); |
| 388 | 388 | |
| 389 | - if(isset(self::$selected[$namespace])) { |
|
| 389 | + if (isset(self::$selected[$namespace])) { |
|
| 390 | 390 | return self::$selected[$namespace]; |
| 391 | 391 | } |
| 392 | 392 | |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | $locale = self::addLocaleByNS($localeName, $namespace); |
| 426 | 426 | $previous = null; |
| 427 | 427 | |
| 428 | - if(isset(self::$selected[$namespace])) |
|
| 428 | + if (isset(self::$selected[$namespace])) |
|
| 429 | 429 | { |
| 430 | - if(self::$selected[$namespace]->getName() === $localeName) { |
|
| 430 | + if (self::$selected[$namespace]->getName() === $localeName) { |
|
| 431 | 431 | return $locale; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -463,11 +463,11 @@ discard block |
||
| 463 | 463 | $class = Localization_Event::class.'_'.$name; |
| 464 | 464 | $event = new $class($argsList); |
| 465 | 465 | |
| 466 | - if(!isset(self::$listeners[$name])) { |
|
| 466 | + if (!isset(self::$listeners[$name])) { |
|
| 467 | 467 | return $event; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - foreach(self::$listeners[$name] as $listener) |
|
| 470 | + foreach (self::$listeners[$name] as $listener) |
|
| 471 | 471 | { |
| 472 | 472 | $callArgs = $listener['args']; |
| 473 | 473 | array_unshift($callArgs, $event); |
@@ -489,15 +489,15 @@ discard block |
||
| 489 | 489 | * @throws Localization_Exception |
| 490 | 490 | * @see Localization::ERROR_UNKNOWN_EVENT_NAME |
| 491 | 491 | */ |
| 492 | - public static function addEventListener(string $eventName, $callback, array $args=array()) : int |
|
| 492 | + public static function addEventListener(string $eventName, $callback, array $args = array()) : int |
|
| 493 | 493 | { |
| 494 | - if(!isset(self::$listeners[$eventName])) { |
|
| 494 | + if (!isset(self::$listeners[$eventName])) { |
|
| 495 | 495 | self::$listeners[$eventName] = array(); |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | $className = Localization_Event::class.'_'.$eventName; |
| 499 | 499 | |
| 500 | - if(!class_exists($className)) |
|
| 500 | + if (!class_exists($className)) |
|
| 501 | 501 | { |
| 502 | 502 | throw new Localization_Exception( |
| 503 | 503 | sprintf('Unknown localization event [%s].', $eventName), |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | * @throws Localization_Exception |
| 532 | 532 | * @see Localization_Event_LocaleChanged |
| 533 | 533 | */ |
| 534 | - public static function onLocaleChanged($callback, array $args=array()) : int |
|
| 534 | + public static function onLocaleChanged($callback, array $args = array()) : int |
|
| 535 | 535 | { |
| 536 | 536 | return self::addEventListener(self::EVENT_LOCALE_CHANGED, $callback, $args); |
| 537 | 537 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | { |
| 659 | 659 | self::requireNamespace($namespace); |
| 660 | 660 | |
| 661 | - if(isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) { |
|
| 661 | + if (isset(self::$locales[$namespace]) && isset(self::$locales[$namespace][$localeName])) { |
|
| 662 | 662 | return self::$locales[$namespace][$localeName]; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -737,9 +737,9 @@ discard block |
||
| 737 | 737 | * @param Localization_Locale|null $locale |
| 738 | 738 | * @return Localization_Translator |
| 739 | 739 | */ |
| 740 | - public static function getTranslator(?Localization_Locale $locale=null) : Localization_Translator |
|
| 740 | + public static function getTranslator(?Localization_Locale $locale = null) : Localization_Translator |
|
| 741 | 741 | { |
| 742 | - if($locale !== null) |
|
| 742 | + if ($locale !== null) |
|
| 743 | 743 | { |
| 744 | 744 | $obj = new Localization_Translator(); |
| 745 | 745 | $obj->addSources(self::getSources()); |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | return $obj; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - if(!isset(self::$translator)) |
|
| 750 | + if (!isset(self::$translator)) |
|
| 751 | 751 | { |
| 752 | 752 | $obj = new Localization_Translator(); |
| 753 | 753 | $obj->addSources(self::getSources()); |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | { |
| 773 | 773 | self::requireNamespace($namespace); |
| 774 | 774 | |
| 775 | - if(isset(self::$locales[$namespace])) { |
|
| 775 | + if (isset(self::$locales[$namespace])) { |
|
| 776 | 776 | return count(self::$locales[$namespace]); |
| 777 | 777 | } |
| 778 | 778 | |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | protected static function requireNamespace(string $namespace) : void |
| 787 | 787 | { |
| 788 | - if(isset(self::$locales[$namespace])) { |
|
| 788 | + if (isset(self::$locales[$namespace])) { |
|
| 789 | 789 | return; |
| 790 | 790 | } |
| 791 | 791 | |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | * @param string $label |
| 809 | 809 | * @return HTML_QuickForm2_Element_Select |
| 810 | 810 | */ |
| 811 | - public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
| 811 | + public static function injectContentLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
| 812 | 812 | { |
| 813 | 813 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_CONTENT, $container, $label); |
| 814 | 814 | } |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | * @param string $label |
| 823 | 823 | * @return HTML_QuickForm2_Element_Select |
| 824 | 824 | */ |
| 825 | - public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
| 825 | + public static function injectAppLocalesSelector(string $elementName, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
| 826 | 826 | { |
| 827 | 827 | return self::injectLocalesSelectorNS($elementName, self::NAMESPACE_APPLICATION, $container, $label); |
| 828 | 828 | } |
@@ -839,9 +839,9 @@ discard block |
||
| 839 | 839 | * @return HTML_QuickForm2_Element_Select |
| 840 | 840 | * @throws Localization_Exception |
| 841 | 841 | */ |
| 842 | - public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label='') : HTML_QuickForm2_Element_Select |
|
| 842 | + public static function injectLocalesSelectorNS(string $elementName, string $namespace, HTML_QuickForm2_Container $container, string $label = '') : HTML_QuickForm2_Element_Select |
|
| 843 | 843 | { |
| 844 | - if(empty($label)) { |
|
| 844 | + if (empty($label)) { |
|
| 845 | 845 | $label = t('Language'); |
| 846 | 846 | } |
| 847 | 847 | |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | $locales = self::getLocalesByNS($namespace); |
| 852 | 852 | |
| 853 | - foreach($locales as $locale) { |
|
| 853 | + foreach ($locales as $locale) { |
|
| 854 | 854 | $select->addOption($locale->getLabel(), $locale->getName()); |
| 855 | 855 | } |
| 856 | 856 | |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | public static function addExcludeFolder(string $folderName) : void |
| 886 | 886 | { |
| 887 | - if(!in_array($folderName, self::$excludeFolders)) { |
|
| 887 | + if (!in_array($folderName, self::$excludeFolders)) { |
|
| 888 | 888 | self::$excludeFolders[] = $folderName; |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | public static function addExcludeFile(string $fileName) : void |
| 893 | 893 | { |
| 894 | - if(!in_array($fileName, self::$excludeFiles)) { |
|
| 894 | + if (!in_array($fileName, self::$excludeFiles)) { |
|
| 895 | 895 | self::$excludeFiles[] = $fileName; |
| 896 | 896 | } |
| 897 | 897 | } |
@@ -918,11 +918,11 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | $grouped = array(); |
| 920 | 920 | |
| 921 | - foreach($sources as $source) |
|
| 921 | + foreach ($sources as $source) |
|
| 922 | 922 | { |
| 923 | 923 | $group = $source->getGroup(); |
| 924 | 924 | |
| 925 | - if(!isset($grouped[$group])) { |
|
| 925 | + if (!isset($grouped[$group])) { |
|
| 926 | 926 | $grouped[$group] = array(); |
| 927 | 927 | } |
| 928 | 928 | |
@@ -940,8 +940,8 @@ discard block |
||
| 940 | 940 | public static function sourceExists(string $sourceID) : bool |
| 941 | 941 | { |
| 942 | 942 | $sources = self::getSources(); |
| 943 | - foreach($sources as $source) { |
|
| 944 | - if($source->getID() == $sourceID) { |
|
| 943 | + foreach ($sources as $source) { |
|
| 944 | + if ($source->getID() == $sourceID) { |
|
| 945 | 945 | return true; |
| 946 | 946 | } |
| 947 | 947 | } |
@@ -957,8 +957,8 @@ discard block |
||
| 957 | 957 | public static function sourceAliasExists(string $sourceAlias) : bool |
| 958 | 958 | { |
| 959 | 959 | $sources = self::getSources(); |
| 960 | - foreach($sources as $source) { |
|
| 961 | - if($source->getAlias() == $sourceAlias) { |
|
| 960 | + foreach ($sources as $source) { |
|
| 961 | + if ($source->getAlias() == $sourceAlias) { |
|
| 962 | 962 | return true; |
| 963 | 963 | } |
| 964 | 964 | } |
@@ -976,8 +976,8 @@ discard block |
||
| 976 | 976 | public static function getSourceByID(string $sourceID) : Localization_Source |
| 977 | 977 | { |
| 978 | 978 | $sources = self::getSources(); |
| 979 | - foreach($sources as $source) { |
|
| 980 | - if($source->getID() == $sourceID) { |
|
| 979 | + foreach ($sources as $source) { |
|
| 980 | + if ($source->getID() == $sourceID) { |
|
| 981 | 981 | return $source; |
| 982 | 982 | } |
| 983 | 983 | } |
@@ -1002,8 +1002,8 @@ discard block |
||
| 1002 | 1002 | public static function getSourceByAlias(string $sourceAlias) : Localization_Source |
| 1003 | 1003 | { |
| 1004 | 1004 | $sources = self::getSources(); |
| 1005 | - foreach($sources as $source) { |
|
| 1006 | - if($source->getAlias() == $sourceAlias) { |
|
| 1005 | + foreach ($sources as $source) { |
|
| 1006 | + if ($source->getAlias() == $sourceAlias) { |
|
| 1007 | 1007 | return $source; |
| 1008 | 1008 | } |
| 1009 | 1009 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | * @throws FileHelper_Exception |
| 1048 | 1048 | * @throws Localization_Exception |
| 1049 | 1049 | */ |
| 1050 | - public static function configure(string $storageFile, string $clientLibrariesFolder='') : void |
|
| 1050 | + public static function configure(string $storageFile, string $clientLibrariesFolder = '') : void |
|
| 1051 | 1051 | { |
| 1052 | 1052 | self::$configured = true; |
| 1053 | 1053 | |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | |
| 1057 | 1057 | // only write the client libraries to disk if the folder |
| 1058 | 1058 | // has been specified. |
| 1059 | - if(!empty($clientLibrariesFolder)) |
|
| 1059 | + if (!empty($clientLibrariesFolder)) |
|
| 1060 | 1060 | { |
| 1061 | 1061 | self::writeClientFiles(); |
| 1062 | 1062 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | * @throws Localization_Exception|FileHelper_Exception |
| 1115 | 1115 | * @see Localization_ClientGenerator |
| 1116 | 1116 | */ |
| 1117 | - public static function writeClientFiles(bool $force=false) : void |
|
| 1117 | + public static function writeClientFiles(bool $force = false) : void |
|
| 1118 | 1118 | { |
| 1119 | 1119 | self::createGenerator()->writeFiles($force); |
| 1120 | 1120 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | */ |
| 1148 | 1148 | protected static function requireConfiguration() : void |
| 1149 | 1149 | { |
| 1150 | - if(!self::$configured) |
|
| 1150 | + if (!self::$configured) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | throw new Localization_Exception( |
| 1153 | 1153 | 'The localization configuration is incomplete.', |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | ); |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | - if(empty(self::$storageFile)) |
|
| 1159 | + if (empty(self::$storageFile)) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | throw new Localization_Exception( |
| 1162 | 1162 | 'No localization storage file set', |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | ); |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - if(empty(self::$sources)) |
|
| 1168 | + if (empty(self::$sources)) |
|
| 1169 | 1169 | { |
| 1170 | 1170 | throw new Localization_Exception( |
| 1171 | 1171 | 'No source folders have been defined.', |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | { |
| 1199 | 1199 | $ids = array(); |
| 1200 | 1200 | |
| 1201 | - foreach(self::$sources as $source) { |
|
| 1201 | + foreach (self::$sources as $source) { |
|
| 1202 | 1202 | $ids[] = $source->getID(); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | { |
| 1214 | 1214 | $aliases = array(); |
| 1215 | 1215 | |
| 1216 | - foreach(self::$sources as $source) { |
|
| 1216 | + foreach (self::$sources as $source) { |
|
| 1217 | 1217 | $aliases[] = $source->getAlias(); |
| 1218 | 1218 | } |
| 1219 | 1219 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | */ |
| 1252 | 1252 | public static function getSupportedLocaleNames() : array |
| 1253 | 1253 | { |
| 1254 | - if(empty(self::$supportedLocales)) |
|
| 1254 | + if (empty(self::$supportedLocales)) |
|
| 1255 | 1255 | { |
| 1256 | 1256 | self::$supportedLocales = FileHelper::createFileFinder(__DIR__.'/Localization/Locale') |
| 1257 | 1257 | ->getPHPClassNames(); |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | */ |
| 138 | 138 | public function getCountry() : Localization_Country |
| 139 | 139 | { |
| 140 | - if(!isset($this->country)) { |
|
| 140 | + if (!isset($this->country)) { |
|
| 141 | 141 | $this->country = Localization::createCountry($this->countryCode); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getID() : string |
| 99 | 99 | { |
| 100 | - if(!isset($this->id)) { |
|
| 100 | + if (!isset($this->id)) { |
|
| 101 | 101 | $this->id = str_replace(Localization_Parser_Language::class.'_', '', get_class($this)); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function parseFile(string $path) : void |
| 124 | 124 | { |
| 125 | - if(!file_exists($path)) |
|
| 125 | + if (!file_exists($path)) |
|
| 126 | 126 | { |
| 127 | 127 | throw new Localization_Exception( |
| 128 | 128 | sprintf('Source code file [%s] not found', basename($path)), |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | $this->tokens = $this->getTokens(); |
| 176 | 176 | $this->totalTokens = count($this->tokens); |
| 177 | 177 | |
| 178 | - for($i = 0; $i < $this->totalTokens; $i++) |
|
| 178 | + for ($i = 0; $i < $this->totalTokens; $i++) |
|
| 179 | 179 | { |
| 180 | 180 | $token = $this->createToken($this->tokens[$i]); |
| 181 | 181 | |
| 182 | - if($token->isTranslationFunction()) { |
|
| 183 | - $this->parseToken($i+1, $token); |
|
| 182 | + if ($token->isTranslationFunction()) { |
|
| 183 | + $this->parseToken($i + 1, $token); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | return self::$allowedContextTags; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - protected function addResult(string $text, int $line=0, string $explanation='') : void |
|
| 207 | + protected function addResult(string $text, int $line = 0, string $explanation = '') : void |
|
| 208 | 208 | { |
| 209 | 209 | $this->log(sprintf('Line [%1$s] | Found string [%2$s]', $line, $text)); |
| 210 | 210 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param Localization_Parser_Token|NULL $parentToken |
| 274 | 274 | * @return Localization_Parser_Token |
| 275 | 275 | */ |
| 276 | - protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token |
|
| 276 | + protected function createToken($definition, Localization_Parser_Token $parentToken = null) : Localization_Parser_Token |
|
| 277 | 277 | { |
| 278 | 278 | $class = Localization_Parser_Token::class.'_'.$this->getID(); |
| 279 | 279 | |
@@ -293,48 +293,48 @@ discard block |
||
| 293 | 293 | $open = false; |
| 294 | 294 | $explanation = ''; |
| 295 | 295 | |
| 296 | - for($i = $number; $i < $max; $i++) |
|
| 296 | + for ($i = $number; $i < $max; $i++) |
|
| 297 | 297 | { |
| 298 | - if(!isset($this->tokens[$i])) { |
|
| 298 | + if (!isset($this->tokens[$i])) { |
|
| 299 | 299 | break; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $subToken = $this->createToken($this->tokens[$i], $token); |
| 303 | 303 | |
| 304 | - if(!$open && $subToken->isOpeningFuncParams()) |
|
| 304 | + if (!$open && $subToken->isOpeningFuncParams()) |
|
| 305 | 305 | { |
| 306 | 306 | $open = true; |
| 307 | 307 | continue; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if($open && $subToken->isClosingFuncParams()) { |
|
| 310 | + if ($open && $subToken->isClosingFuncParams()) { |
|
| 311 | 311 | break; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // additional parameters in the translation function, we don't want to capture these now. |
| 315 | - if($open && $subToken->isArgumentSeparator()) |
|
| 315 | + if ($open && $subToken->isArgumentSeparator()) |
|
| 316 | 316 | { |
| 317 | - if($token->isExplanationFunction()) { |
|
| 318 | - $leftover = array_slice($this->tokens, $i+1); |
|
| 317 | + if ($token->isExplanationFunction()) { |
|
| 318 | + $leftover = array_slice($this->tokens, $i + 1); |
|
| 319 | 319 | $explanation = $this->parseExplanation($token, $leftover); |
| 320 | 320 | } |
| 321 | 321 | break; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if($open && $subToken->isEncapsedString()) |
|
| 324 | + if ($open && $subToken->isEncapsedString()) |
|
| 325 | 325 | { |
| 326 | 326 | $textParts[] = $this->trimText(strval($subToken->getValue())); |
| 327 | 327 | continue; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if($open && $subToken->isVariableOrFunction()) { |
|
| 330 | + if ($open && $subToken->isVariableOrFunction()) { |
|
| 331 | 331 | $textParts = null; |
| 332 | 332 | $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.')); |
| 333 | 333 | break; |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if(empty($textParts)) { |
|
| 337 | + if (empty($textParts)) { |
|
| 338 | 338 | return; |
| 339 | 339 | } |
| 340 | 340 | |
@@ -348,38 +348,38 @@ discard block |
||
| 348 | 348 | $textParts = array(); |
| 349 | 349 | $max = 200; |
| 350 | 350 | |
| 351 | - for($i = 0; $i < $max; $i++) |
|
| 351 | + for ($i = 0; $i < $max; $i++) |
|
| 352 | 352 | { |
| 353 | - if(!isset($tokens[$i])) { |
|
| 353 | + if (!isset($tokens[$i])) { |
|
| 354 | 354 | break; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | $subToken = $this->createToken($tokens[$i], $token); |
| 358 | 358 | |
| 359 | - if($subToken->isClosingFuncParams()) { |
|
| 359 | + if ($subToken->isClosingFuncParams()) { |
|
| 360 | 360 | break; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | // additional parameters in the translation function, we don't want to capture these now. |
| 364 | - if($subToken->isArgumentSeparator()) |
|
| 364 | + if ($subToken->isArgumentSeparator()) |
|
| 365 | 365 | { |
| 366 | 366 | break; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if($subToken->isEncapsedString()) |
|
| 369 | + if ($subToken->isEncapsedString()) |
|
| 370 | 370 | { |
| 371 | 371 | $textParts[] = $this->trimText(strval($subToken->getValue())); |
| 372 | 372 | continue; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if($subToken->isVariableOrFunction()) { |
|
| 375 | + if ($subToken->isVariableOrFunction()) { |
|
| 376 | 376 | $textParts = null; |
| 377 | 377 | $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.')); |
| 378 | 378 | break; |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if(empty($textParts)) { |
|
| 382 | + if (empty($textParts)) { |
|
| 383 | 383 | return ''; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | protected function debug(string $text) : void |
| 390 | 390 | { |
| 391 | - if($this->debug) { |
|
| 391 | + if ($this->debug) { |
|
| 392 | 392 | echo $text; |
| 393 | 393 | } |
| 394 | 394 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $autoload = realpath($root.'/../vendor/autoload.php'); |
| 18 | 18 | |
| 19 | 19 | // we need the autoloader to be present |
| 20 | - if($autoload === false) { |
|
| 20 | + if ($autoload === false) { |
|
| 21 | 21 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $entries = array(); |
| 55 | 55 | |
| 56 | - foreach($this->strings as $string) { |
|
| 56 | + foreach ($this->strings as $string) { |
|
| 57 | 57 | $entries[] = $string->toArray(); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $amount = 0; |
| 75 | 75 | |
| 76 | - foreach($this->strings as $string) { |
|
| 77 | - if($string->isFile()) { |
|
| 76 | + foreach ($this->strings as $string) { |
|
| 77 | + if ($string->isFile()) { |
|
| 78 | 78 | $amount++; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function hasLanguageType(string $type) : bool |
| 91 | 91 | { |
| 92 | - foreach($this->strings as $string) { |
|
| 93 | - if($string->getLanguageType() == $type) { |
|
| 92 | + foreach ($this->strings as $string) { |
|
| 93 | + if ($string->getLanguageType() == $type) { |
|
| 94 | 94 | return true; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function getText() : ?Text |
| 102 | 102 | { |
| 103 | - if(isset($this->strings[0])) { |
|
| 103 | + if (isset($this->strings[0])) { |
|
| 104 | 104 | return $this->strings[0]->getText(); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $translator = Localization::getTranslator(); |
| 133 | 133 | $text = $translator->getHashTranslation($this->getHash()); |
| 134 | 134 | |
| 135 | - if($text !== null) { |
|
| 135 | + if ($text !== null) { |
|
| 136 | 136 | return $text; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $files = array(); |
| 149 | 149 | |
| 150 | - foreach($this->strings as $string) |
|
| 150 | + foreach ($this->strings as $string) |
|
| 151 | 151 | { |
| 152 | - if(!$string->isFile()) { |
|
| 152 | + if (!$string->isFile()) { |
|
| 153 | 153 | continue; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $file = $string->getSourceFile(); |
| 157 | - if(!in_array($file, $files)) { |
|
| 157 | + if (!in_array($file, $files)) { |
|
| 158 | 158 | $files[] = $file; |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $files = $this->getFiles(); |
| 174 | 174 | $result = array(); |
| 175 | 175 | |
| 176 | - foreach($files as $path) { |
|
| 176 | + foreach ($files as $path) { |
|
| 177 | 177 | $result[] = basename($path); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | $text = $this->getText(); |
| 204 | 204 | |
| 205 | - if($text !== null) |
|
| 205 | + if ($text !== null) |
|
| 206 | 206 | { |
| 207 | 207 | return $text->getText(); |
| 208 | 208 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | <?php $this->renderAppLocales(); ?> |
| 73 | 73 | <?php |
| 74 | 74 | $backURL = $this->editor->getBackURL(); |
| 75 | - if(!empty($backURL)) |
|
| 75 | + if (!empty($backURL)) |
|
| 76 | 76 | { |
| 77 | 77 | ?> |
| 78 | 78 | <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm"> |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | <?php |
| 110 | 110 | $warnings = $this->editor->getScannerWarnings(); |
| 111 | 111 | |
| 112 | - foreach($warnings as $warning) |
|
| 112 | + foreach ($warnings as $warning) |
|
| 113 | 113 | { |
| 114 | 114 | ?> |
| 115 | 115 | <dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt> |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $strings = $this->editor->getFilteredStrings(); |
| 128 | 128 | |
| 129 | - if(empty($strings)) |
|
| 129 | + if (empty($strings)) |
|
| 130 | 130 | { |
| 131 | 131 | ?> |
| 132 | 132 | <div class="alert alert-info"> |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | <div class="form-hiddens"> |
| 149 | 149 | <?php |
| 150 | 150 | $params = $this-> editor->getRequestParams(); |
| 151 | - foreach($params as $name => $value) { |
|
| 151 | + foreach ($params as $name => $value) { |
|
| 152 | 152 | ?> |
| 153 | 153 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
| 154 | 154 | <?php |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | </thead> |
| 167 | 167 | <tbody> |
| 168 | 168 | <?php |
| 169 | - foreach($keep as $string) |
|
| 169 | + foreach ($keep as $string) |
|
| 170 | 170 | { |
| 171 | 171 | $this->renderTextEditorEntry($string); |
| 172 | 172 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | </tbody> |
| 175 | 175 | </table> |
| 176 | 176 | <?php |
| 177 | - if($pager->hasPages()) |
|
| 177 | + if ($pager->hasPages()) |
|
| 178 | 178 | { |
| 179 | 179 | $prevUrl = $this->editor->getPaginationURL($pager->getPreviousPage()); |
| 180 | 180 | $nextUrl = $this->editor->getPaginationURL($pager->getNextPage()); |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | </li> |
| 190 | 190 | <?php |
| 191 | 191 | $numbers = $pager->getPageNumbers(); |
| 192 | - foreach($numbers as $number) |
|
| 192 | + foreach ($numbers as $number) |
|
| 193 | 193 | { |
| 194 | 194 | $url = $this->editor->getPaginationURL($number); |
| 195 | 195 | |
| 196 | 196 | ?> |
| 197 | - <li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
|
| 197 | + <li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
|
| 198 | 198 | <a class="page-link" href="<?php echo $url ?>"> |
| 199 | 199 | <?php echo $number ?> |
| 200 | 200 | </a> |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $hash = $string->getHash(); |
| 230 | 230 | $text = $string->getText(); |
| 231 | 231 | |
| 232 | - if($text===null) |
|
| 232 | + if ($text === null) |
|
| 233 | 233 | { |
| 234 | 234 | throw new EditorException( |
| 235 | 235 | 'String hash has no text', |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $previewText = $string->getTranslatedText(); |
| 242 | - if(empty($previewText)) { |
|
| 242 | + if (empty($previewText)) { |
|
| 243 | 243 | $previewText = $text->getText(); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $shortText = $this->renderText($previewText, 50); |
|
| 246 | + $shortText = $this->renderText($previewText, 50); |
|
| 247 | 247 | |
| 248 | 248 | $files = $string->getFiles(); |
| 249 | 249 | $labelID = JSHelper::nextElementID(); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | </p> |
| 265 | 265 | <?php |
| 266 | 266 | $explanation = $text->getExplanation(); |
| 267 | - if(!empty($explanation)) |
|
| 267 | + if (!empty($explanation)) |
|
| 268 | 268 | { |
| 269 | 269 | ?> |
| 270 | 270 | <p> |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | <?php |
| 288 | 288 | $totalFiles = count($files); |
| 289 | 289 | |
| 290 | - if($totalFiles == 1) |
|
| 290 | + if ($totalFiles == 1) |
|
| 291 | 291 | { |
| 292 | 292 | pt('Found in a single file:'); |
| 293 | 293 | } |
@@ -302,16 +302,16 @@ discard block |
||
| 302 | 302 | <?php |
| 303 | 303 | $locations = $string->getStrings(); |
| 304 | 304 | |
| 305 | - foreach($locations as $location) |
|
| 305 | + foreach ($locations as $location) |
|
| 306 | 306 | { |
| 307 | 307 | $file = $location->getSourceFile(); |
| 308 | 308 | $line = $location->getLine(); |
| 309 | 309 | |
| 310 | 310 | $ext = FileHelper::getExtension($file); |
| 311 | 311 | |
| 312 | - if($ext == 'php') { |
|
| 312 | + if ($ext == 'php') { |
|
| 313 | 313 | $icon = 'fab fa-php'; |
| 314 | - } else if($ext == 'js') { |
|
| 314 | + } else if ($ext == 'js') { |
|
| 315 | 315 | $icon = 'fab fa-js-square'; |
| 316 | 316 | } else { |
| 317 | 317 | $icon = 'fas fa-file-code'; |
@@ -333,13 +333,13 @@ discard block |
||
| 333 | 333 | <?php |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - protected function renderText(string $text, int $cutAt=0) : string |
|
| 336 | + protected function renderText(string $text, int $cutAt = 0) : string |
|
| 337 | 337 | { |
| 338 | - if(empty($text)) { |
|
| 338 | + if (empty($text)) { |
|
| 339 | 339 | return ''; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if($cutAt > 0) { |
|
| 342 | + if ($cutAt > 0) { |
|
| 343 | 343 | $text = ConvertHelper::text_cut($text, $cutAt); |
| 344 | 344 | } |
| 345 | 345 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | $vars = $this->editor->detectVariables($text); |
| 349 | 349 | |
| 350 | - foreach($vars as $var) { |
|
| 350 | + foreach ($vars as $var) { |
|
| 351 | 351 | $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text); |
| 352 | 352 | } |
| 353 | 353 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | <?php |
| 533 | 533 | pt( |
| 534 | 534 | 'You are translating to %1$s', |
| 535 | - '<span class="badge badge-info">' . $activeLocale->getLabel() . '</span>' |
|
| 535 | + '<span class="badge badge-info">'.$activeLocale->getLabel().'</span>' |
|
| 536 | 536 | ); |
| 537 | 537 | ?><br> |
| 538 | 538 | |
@@ -572,10 +572,10 @@ discard block |
||
| 572 | 572 | |
| 573 | 573 | // add a counter of the additional files if the total |
| 574 | 574 | // is higher than the maximum to show |
| 575 | - if($total > $max) |
|
| 575 | + if ($total > $max) |
|
| 576 | 576 | { |
| 577 | 577 | $length = $max; |
| 578 | - if($length > $keepTotal) { |
|
| 578 | + if ($length > $keepTotal) { |
|
| 579 | 579 | $length = $keepTotal; |
| 580 | 580 | } |
| 581 | 581 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | protected function renderStatus(Localization_Scanner_StringHash $hash) : string |
| 590 | 590 | { |
| 591 | - if($hash->isTranslated()) { |
|
| 591 | + if ($hash->isTranslated()) { |
|
| 592 | 592 | return '<i class="fa fa-check text-success"></i>'; |
| 593 | 593 | } |
| 594 | 594 | |
@@ -599,11 +599,11 @@ discard block |
||
| 599 | 599 | { |
| 600 | 600 | $types = array(); |
| 601 | 601 | |
| 602 | - if($hash->hasLanguageType('PHP')) { |
|
| 602 | + if ($hash->hasLanguageType('PHP')) { |
|
| 603 | 603 | $types[] = t('Server'); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - if($hash->hasLanguageType('Javascript')) { |
|
| 606 | + if ($hash->hasLanguageType('Javascript')) { |
|
| 607 | 607 | $types[] = t('Client'); |
| 608 | 608 | } |
| 609 | 609 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $texts = $language->getTexts(); |
| 61 | 61 | |
| 62 | - foreach($texts as $text) |
|
| 62 | + foreach ($texts as $text) |
|
| 63 | 63 | { |
| 64 | 64 | $this->collection->addFromFile( |
| 65 | 65 | $this->source->getID(), |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $warnings = $language->getWarnings(); |
| 73 | 73 | |
| 74 | - foreach($warnings as $warning) |
|
| 74 | + foreach ($warnings as $warning) |
|
| 75 | 75 | { |
| 76 | 76 | $this->collection->addWarning($warning); |
| 77 | 77 | } |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $hashes = $this->getHashes(); |
| 95 | 95 | |
| 96 | - foreach($hashes as $hash) |
|
| 96 | + foreach ($hashes as $hash) |
|
| 97 | 97 | { |
| 98 | 98 | $text = $translator->getHashTranslation($hash->getHash()); |
| 99 | 99 | |
| 100 | - if(empty($text)) |
|
| 100 | + if (empty($text)) |
|
| 101 | 101 | { |
| 102 | 102 | $amount++; |
| 103 | 103 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function __construct() |
| 103 | 103 | { |
| 104 | 104 | $path = realpath(__DIR__.'/../'); |
| 105 | - if($path === false) |
|
| 105 | + if ($path === false) |
|
| 106 | 106 | { |
| 107 | 107 | throw new Localization_Exception( |
| 108 | 108 | 'Local path not found', |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | protected function initSession() : void |
| 152 | 152 | { |
| 153 | - if(session_status() != PHP_SESSION_ACTIVE) { |
|
| 153 | + if (session_status() != PHP_SESSION_ACTIVE) { |
|
| 154 | 154 | session_start(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if(!isset($_SESSION['localization_messages'])) { |
|
| 157 | + if (!isset($_SESSION['localization_messages'])) { |
|
| 158 | 158 | $_SESSION['localization_messages'] = array(); |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $this->sources = Localization::getSources(); |
| 173 | 173 | |
| 174 | - if(empty($this->sources)) |
|
| 174 | + if (empty($this->sources)) |
|
| 175 | 175 | { |
| 176 | 176 | throw new Localization_Exception( |
| 177 | 177 | 'Cannot start editor: no sources defined.', |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get(); |
| 184 | - if(empty($activeID)) { |
|
| 184 | + if (empty($activeID)) { |
|
| 185 | 185 | $activeID = $this->getDefaultSourceID(); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | protected function getDefaultSourceID() : string |
| 192 | 192 | { |
| 193 | 193 | $default = $this->getOption('default-source'); |
| 194 | - if(!empty($default) && Localization::sourceAliasExists($default)) { |
|
| 194 | + if (!empty($default) && Localization::sourceAliasExists($default)) { |
|
| 195 | 195 | return Localization::getSourceByAlias($default)->getID(); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -203,21 +203,21 @@ discard block |
||
| 203 | 203 | $names = array(); |
| 204 | 204 | |
| 205 | 205 | $locales = Localization::getAppLocales(); |
| 206 | - foreach($locales as $locale) { |
|
| 207 | - if(!$locale->isNative()) { |
|
| 206 | + foreach ($locales as $locale) { |
|
| 207 | + if (!$locale->isNative()) { |
|
| 208 | 208 | $this->appLocales[] = $locale; |
| 209 | 209 | $names[] = $locale->getName(); |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // use the default locale if no other is available. |
| 214 | - if(empty($names)) { |
|
| 214 | + if (empty($names)) { |
|
| 215 | 215 | $this->activeAppLocale = Localization::getAppLocale(); |
| 216 | 216 | return; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get(); |
| 220 | - if(empty($activeID)) { |
|
| 220 | + if (empty($activeID)) { |
|
| 221 | 221 | $activeID = $this->appLocales[0]->getName(); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $this->filters = new Localization_Editor_Filters($this); |
| 270 | 270 | |
| 271 | - if($this->request->getBool($this->getVarName(self::VARIABLE_SCAN))) |
|
| 271 | + if ($this->request->getBool($this->getVarName(self::VARIABLE_SCAN))) |
|
| 272 | 272 | { |
| 273 | 273 | $this->executeScan(); |
| 274 | 274 | } |
| 275 | - else if($this->request->getBool($this->getSaveVariableName())) |
|
| 275 | + else if ($this->request->getBool($this->getSaveVariableName())) |
|
| 276 | 276 | { |
| 277 | 277 | $this->executeSave(); |
| 278 | 278 | } |
@@ -326,9 +326,9 @@ discard block |
||
| 326 | 326 | |
| 327 | 327 | $result = array(); |
| 328 | 328 | |
| 329 | - foreach($strings as $string) |
|
| 329 | + foreach ($strings as $string) |
|
| 330 | 330 | { |
| 331 | - if($this->filters->isStringMatch($string)) { |
|
| 331 | + if ($this->filters->isStringMatch($string)) { |
|
| 332 | 332 | $result[] = $string; |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | return $this->activeAppLocale; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - public function getPaginationURL(int $page, array $params=array()) : string |
|
| 368 | + public function getPaginationURL(int $page, array $params = array()) : string |
|
| 369 | 369 | { |
| 370 | 370 | $params[$this->getVarName('page')] = $page; |
| 371 | 371 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $result = array(); |
| 378 | 378 | preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER); |
| 379 | 379 | |
| 380 | - if(isset($result[0]) && !empty($result[0])) { |
|
| 380 | + if (isset($result[0]) && !empty($result[0])) { |
|
| 381 | 381 | return $result[0]; |
| 382 | 382 | } |
| 383 | 383 | |
@@ -389,14 +389,14 @@ discard block |
||
| 389 | 389 | echo $this->render(); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - public function getSourceURL(Localization_Source $source, array $params=array()) : string |
|
| 392 | + public function getSourceURL(Localization_Source $source, array $params = array()) : string |
|
| 393 | 393 | { |
| 394 | 394 | $params[$this->getVarName('source')] = $source->getID(); |
| 395 | 395 | |
| 396 | 396 | return $this->getURL($params); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - public function getLocaleURL(Localization_Locale $locale, array $params=array()) : string |
|
| 399 | + public function getLocaleURL(Localization_Locale $locale, array $params = array()) : string |
|
| 400 | 400 | { |
| 401 | 401 | $params[$this->getVarName('locale')] = $locale->getName(); |
| 402 | 402 | |
@@ -413,12 +413,12 @@ discard block |
||
| 413 | 413 | return $this->getSourceURL($this->activeSource, array($this->getVarName(self::VARIABLE_WARNINGS) => 'yes')); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - public function getURL(array $params=array()) : string |
|
| 416 | + public function getURL(array $params = array()) : string |
|
| 417 | 417 | { |
| 418 | 418 | $persist = $this->getRequestParams(); |
| 419 | 419 | |
| 420 | - foreach($persist as $name => $value) { |
|
| 421 | - if(!isset($params[$name])) { |
|
| 420 | + foreach ($persist as $name => $value) { |
|
| 421 | + if (!isset($params[$name])) { |
|
| 422 | 422 | $params[$name] = $value; |
| 423 | 423 | } |
| 424 | 424 | } |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | $translator = Localization::getTranslator($this->activeAppLocale); |
| 456 | 456 | |
| 457 | 457 | $strings = $data[$this->getVarName(self::VARIABLE_STRINGS)]; |
| 458 | - foreach($strings as $hash => $text) |
|
| 458 | + foreach ($strings as $hash => $text) |
|
| 459 | 459 | { |
| 460 | 460 | $text = trim($text); |
| 461 | 461 | |
| 462 | - if(empty($text)) { |
|
| 462 | + if (empty($text)) { |
|
| 463 | 463 | continue; |
| 464 | 464 | } |
| 465 | 465 | |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $this->redirect($this->getURL()); |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - protected function addMessage(string $message, string $type=self::MESSAGE_INFO) : void |
|
| 482 | + protected function addMessage(string $message, string $type = self::MESSAGE_INFO) : void |
|
| 483 | 483 | { |
| 484 | 484 | $_SESSION['localization_messages'][] = array( |
| 485 | 485 | 'text' => $message, |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | public function getAppName() : string |
| 517 | 517 | { |
| 518 | 518 | $name = $this->getOption('appname'); |
| 519 | - if(!empty($name)) { |
|
| 519 | + if (!empty($name)) { |
|
| 520 | 520 | return $name; |
| 521 | 521 | } |
| 522 | 522 | |