@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $autoload = realpath($root.'/../vendor/autoload.php'); |
| 14 | 14 | |
| 15 | 15 | // we need the autoloader to be present |
| 16 | - if(!file_exists($autoload)) { |
|
| 16 | + if (!file_exists($autoload)) { |
|
| 17 | 17 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The composer autoloader |
|
| 21 | - */ |
|
| 19 | + /** |
|
| 20 | + * The composer autoloader |
|
| 21 | + */ |
|
| 22 | 22 | require_once $autoload; |
| 23 | 23 | |
| 24 | 24 | // the folder in which the localization .ini files are stored |
@@ -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 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | $text = t('This text is in the global scope.'); |
| 4 | 4 | |
| 5 | 5 | $text2 = t( |
| 6 | - 'It is possible to write long texts ' . |
|
| 7 | - 'using text concatenation in the source ' . |
|
| 6 | + 'It is possible to write long texts '. |
|
| 7 | + 'using text concatenation in the source '. |
|
| 8 | 8 | 'code to keep it readable.' |
| 9 | 9 | ); |
| 10 | 10 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function excludeFolder(string $folder) : Localization_Source_Folder |
| 51 | 51 | { |
| 52 | - if(!in_array($folder, $this->excludes['folders'])) { |
|
| 52 | + if (!in_array($folder, $this->excludes['folders'])) { |
|
| 53 | 53 | $this->excludes['folders'][] = $folder; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function excludeFolders(array $folders) : Localization_Source_Folder |
| 60 | 60 | { |
| 61 | - foreach($folders as $folder) { |
|
| 61 | + foreach ($folders as $folder) { |
|
| 62 | 62 | $this->excludeFolder($folder); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -23,24 +23,24 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Localization_Source_Folder extends Localization_Source |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * The folder under which all translatable files are kept. |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 26 | + /** |
|
| 27 | + * The folder under which all translatable files are kept. |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | 30 | protected $sourcesFolder; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var string |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | 35 | protected $id; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param string $alias An alias for this source, to recognize it by. |
|
| 39 | - * @param string $label The human-readable label, used in the editor. |
|
| 40 | - * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
| 41 | - * @param string $storageFolder The folder in which to store the localization files. |
|
| 42 | - * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
| 43 | - */ |
|
| 37 | + /** |
|
| 38 | + * @param string $alias An alias for this source, to recognize it by. |
|
| 39 | + * @param string $label The human-readable label, used in the editor. |
|
| 40 | + * @param string $group A human-readable group label to group several sources by. Used in the editor. |
|
| 41 | + * @param string $storageFolder The folder in which to store the localization files. |
|
| 42 | + * @param string $sourcesFolder The folder in which to analyze files to find translatable strings. |
|
| 43 | + */ |
|
| 44 | 44 | public function __construct(string $alias, string $label, string $group, string $storageFolder, string $sourcesFolder) |
| 45 | 45 | { |
| 46 | 46 | parent::__construct($alias, $label, $group, $storageFolder); |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class Localization_Event |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | 26 | protected $args; |
| 27 | 27 | |
| 28 | 28 | public function __construct(array $args) |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | $this->args = $args; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Fetches the argument at the specified index in the |
|
| 35 | - * event's arguments list, if it exists. |
|
| 36 | - * |
|
| 37 | - * @param int $index Zero-based index number. |
|
| 38 | - * @return mixed|NULL |
|
| 39 | - */ |
|
| 33 | + /** |
|
| 34 | + * Fetches the argument at the specified index in the |
|
| 35 | + * event's arguments list, if it exists. |
|
| 36 | + * |
|
| 37 | + * @param int $index Zero-based index number. |
|
| 38 | + * @return mixed|NULL |
|
| 39 | + */ |
|
| 40 | 40 | public function getArgument(int $index) |
| 41 | 41 | { |
| 42 | 42 | if(isset($this->args[$index])) { |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function getArgument(int $index) |
| 41 | 41 | { |
| 42 | - if(isset($this->args[$index])) { |
|
| 42 | + if (isset($this->args[$index])) { |
|
| 43 | 43 | return $this->args[$index]; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -258,8 +258,7 @@ |
||
| 258 | 258 | if(empty($tokens)) |
| 259 | 259 | { |
| 260 | 260 | $content = '/* No strings found. */'; |
| 261 | - } |
|
| 262 | - else |
|
| 261 | + } else |
|
| 263 | 262 | { |
| 264 | 263 | $content = |
| 265 | 264 | '/**'.PHP_EOL. |
@@ -17,24 +17,24 @@ discard block |
||
| 17 | 17 | const FILES_LOCALES = 'locales'; |
| 18 | 18 | const FILES_CACHE_KEY = 'cachekey'; |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var bool |
|
| 22 | - */ |
|
| 20 | + /** |
|
| 21 | + * @var bool |
|
| 22 | + */ |
|
| 23 | 23 | protected $force = false; |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var Localization_Translator |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var Localization_Translator |
|
| 27 | + */ |
|
| 28 | 28 | protected $translator; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | 33 | protected $targetFolder; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | protected $cacheKeyFile; |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | $this->writeCacheKey(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Retrieves a list of all localization client |
|
| 124 | - * files that are written to disk. This includes |
|
| 125 | - * the locale files and the libraries required |
|
| 126 | - * to make it work clientside. |
|
| 127 | - * |
|
| 128 | - * @return string[] |
|
| 129 | - */ |
|
| 122 | + /** |
|
| 123 | + * Retrieves a list of all localization client |
|
| 124 | + * files that are written to disk. This includes |
|
| 125 | + * the locale files and the libraries required |
|
| 126 | + * to make it work clientside. |
|
| 127 | + * |
|
| 128 | + * @return string[] |
|
| 129 | + */ |
|
| 130 | 130 | public function getFilesList() : array |
| 131 | 131 | { |
| 132 | 132 | $files = array(); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | $this->written[self::FILES_LOCALES] = true; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * Generates the cache key file, which is used to determine |
|
| 284 | - * automatically whether the client libraries need to be |
|
| 285 | - * refreshed. |
|
| 286 | - */ |
|
| 282 | + /** |
|
| 283 | + * Generates the cache key file, which is used to determine |
|
| 284 | + * automatically whether the client libraries need to be |
|
| 285 | + * refreshed. |
|
| 286 | + */ |
|
| 287 | 287 | protected function writeCacheKey() : void |
| 288 | 288 | { |
| 289 | 289 | if(file_exists($this->cacheKeyFile) && !$this->force) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | protected function initCache() : void |
| 67 | 67 | { |
| 68 | 68 | // ignore it if it does not exist. |
| 69 | - if(!file_exists($this->cacheKeyFile)) { |
|
| 69 | + if (!file_exists($this->cacheKeyFile)) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -78,22 +78,22 @@ discard block |
||
| 78 | 78 | * @throws Localization_Exception |
| 79 | 79 | * @throws FileHelper_Exception |
| 80 | 80 | */ |
| 81 | - public function writeFiles(bool $force=false) : void |
|
| 81 | + public function writeFiles(bool $force = false) : void |
|
| 82 | 82 | { |
| 83 | 83 | // reset the write states for all files |
| 84 | 84 | $fileIDs = array_keys($this->written); |
| 85 | - foreach($fileIDs as $fileID) { |
|
| 85 | + foreach ($fileIDs as $fileID) { |
|
| 86 | 86 | $this->written[$fileID] = false; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // no client libraries folder set: ignore. |
| 90 | - if(empty($this->targetFolder)) { |
|
| 90 | + if (empty($this->targetFolder)) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | FileHelper::createFolder($this->targetFolder); |
| 95 | 95 | |
| 96 | - if(!is_writable($this->targetFolder)) |
|
| 96 | + if (!is_writable($this->targetFolder)) |
|
| 97 | 97 | { |
| 98 | 98 | throw new Localization_Exception( |
| 99 | 99 | sprintf( |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if($this->cacheKey !== Localization::getClientLibrariesCacheKey()) { |
|
| 111 | + if ($this->cacheKey !== Localization::getClientLibrariesCacheKey()) { |
|
| 112 | 112 | $force = true; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -131,16 +131,16 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $files = array(); |
| 133 | 133 | |
| 134 | - foreach($this->libraries as $fileName) |
|
| 134 | + foreach ($this->libraries as $fileName) |
|
| 135 | 135 | { |
| 136 | 136 | $files[] = $this->getLibraryFilePath($fileName); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $locales = Localization::getAppLocales(); |
| 140 | 140 | |
| 141 | - foreach($locales as $locale) |
|
| 141 | + foreach ($locales as $locale) |
|
| 142 | 142 | { |
| 143 | - if($locale->isNative()) { |
|
| 143 | + if ($locale->isNative()) { |
|
| 144 | 144 | continue; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $locales = Localization::getAppLocales(); |
| 156 | 156 | |
| 157 | - foreach($locales as $locale) |
|
| 157 | + foreach ($locales as $locale) |
|
| 158 | 158 | { |
| 159 | - if($locale->isNative()) { |
|
| 159 | + if ($locale->isNative()) { |
|
| 160 | 160 | continue; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $sourceFolder = realpath(__DIR__.'/../js'); |
| 182 | 182 | |
| 183 | - if($sourceFolder === false) |
|
| 183 | + if ($sourceFolder === false) |
|
| 184 | 184 | { |
| 185 | 185 | throw new Localization_Exception( |
| 186 | 186 | 'Unexpected folder structure encountered.', |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - foreach($this->libraries as $fileName) |
|
| 195 | + foreach ($this->libraries as $fileName) |
|
| 196 | 196 | { |
| 197 | 197 | $targetFile = $this->getLibraryFilePath($fileName); |
| 198 | 198 | |
| 199 | - if(file_exists($targetFile) && !$this->force) { |
|
| 199 | + if (file_exists($targetFile) && !$this->force) { |
|
| 200 | 200 | continue; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -241,16 +241,16 @@ discard block |
||
| 241 | 241 | { |
| 242 | 242 | $path = $this->getLocaleFilePath($locale); |
| 243 | 243 | |
| 244 | - if(file_exists($path) && !$this->force) { |
|
| 244 | + if (file_exists($path) && !$this->force) { |
|
| 245 | 245 | return; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | $strings = $this->translator->getClientStrings($locale); |
| 249 | 249 | |
| 250 | 250 | $tokens = array(); |
| 251 | - foreach($strings as $hash => $text) |
|
| 251 | + foreach ($strings as $hash => $text) |
|
| 252 | 252 | { |
| 253 | - if(empty($text)) { |
|
| 253 | + if (empty($text)) { |
|
| 254 | 254 | continue; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | ); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if(empty($tokens)) |
|
| 264 | + if (empty($tokens)) |
|
| 265 | 265 | { |
| 266 | 266 | $content = '/* No strings found. */'; |
| 267 | 267 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | protected function writeCacheKey() : void |
| 288 | 288 | { |
| 289 | - if(file_exists($this->cacheKeyFile) && !$this->force) { |
|
| 289 | + if (file_exists($this->cacheKeyFile) && !$this->force) { |
|
| 290 | 290 | return; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function areFilesWritten(string $filesID) : bool |
| 313 | 313 | { |
| 314 | - if(isset($this->written[$filesID])) { |
|
| 314 | + if (isset($this->written[$filesID])) { |
|
| 315 | 315 | return $this->written[$filesID]; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | protected function parseDefinition() : void |
| 10 | 10 | { |
| 11 | 11 | // some entries are strings, like parenthesises, semicolons and the like. |
| 12 | - if(is_string($this->definition)) |
|
| 12 | + if (is_string($this->definition)) |
|
| 13 | 13 | { |
| 14 | 14 | $this->token = $this->definition; |
| 15 | 15 | $this->value = null; |
| 16 | 16 | |
| 17 | - if(isset($this->parentToken)) { |
|
| 17 | + if (isset($this->parentToken)) { |
|
| 18 | 18 | $this->line = $this->parentToken->getLine(); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -19,8 +19,7 @@ |
||
| 19 | 19 | if(isset($this->parentToken)) { |
| 20 | 20 | $this->line = $this->parentToken->getLine(); |
| 21 | 21 | } |
| 22 | - } |
|
| 23 | - else |
|
| 22 | + } else |
|
| 24 | 23 | { |
| 25 | 24 | $this->token = JTokenizer::getTokenName($this->definition[0]); |
| 26 | 25 | $this->value = $this->definition[1]; |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | if(isset($this->parentToken)) { |
| 18 | 18 | $this->line = $this->parentToken->getLine(); |
| 19 | 19 | } |
| 20 | - } |
|
| 21 | - else |
|
| 20 | + } else |
|
| 22 | 21 | { |
| 23 | 22 | $this->token = token_name($this->definition[0]); |
| 24 | 23 | $this->value = $this->definition[1]; |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | protected function parseDefinition() : void |
| 16 | 16 | { |
| 17 | 17 | // some entries are strings, like parentheses, semicolons and the like. |
| 18 | - if(is_string($this->definition)) |
|
| 18 | + if (is_string($this->definition)) |
|
| 19 | 19 | { |
| 20 | 20 | $this->token = $this->definition; |
| 21 | 21 | $this->value = null; |
| 22 | 22 | |
| 23 | - if(isset($this->parentToken)) { |
|
| 23 | + if (isset($this->parentToken)) { |
|
| 24 | 24 | $this->line = $this->parentToken->getLine(); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | foreach($defaults as $name => $val) { |
| 51 | 51 | $this->setValue($name, $val); |
| 52 | 52 | } |
| 53 | - } |
|
| 54 | - else if($this->request->getBool($this->vars['filter'])) |
|
| 53 | + } else if($this->request->getBool($this->vars['filter'])) |
|
| 55 | 54 | { |
| 56 | 55 | $this->parseSearchTerms($this->request->getParam($this->vars['search'])); |
| 57 | 56 | |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | ->setEnum('', 'client', 'server') |
| 73 | 72 | ->get('') |
| 74 | 73 | ); |
| 75 | - } |
|
| 76 | - else |
|
| 74 | + } else |
|
| 77 | 75 | { |
| 78 | 76 | $this->parseSearchTerms($this->getValue($this->vars['search'])); |
| 79 | 77 | } |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Localization_Editor_Filters |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var Localization_Editor |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Localization_Editor |
|
| 28 | + */ |
|
| 29 | 29 | protected $editor; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var Request |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var Request |
|
| 33 | + */ |
|
| 34 | 34 | |
| 35 | 35 | protected $request; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | 40 | protected $sessionName = 'localize_filters'; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var string[] |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var string[] |
|
| 44 | + */ |
|
| 45 | 45 | protected $vars = array( |
| 46 | 46 | 'resetfilter' => '', |
| 47 | 47 | 'filter' => '', |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | <form class="form-inline"> |
| 205 | 205 | <div class="form-hiddens"> |
| 206 | 206 | <?php |
| 207 | - $params = $this->editor->getRequestParams(); |
|
| 208 | - foreach($params as $name => $value) { |
|
| 209 | - ?> |
|
| 207 | + $params = $this->editor->getRequestParams(); |
|
| 208 | + foreach($params as $name => $value) { |
|
| 209 | + ?> |
|
| 210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
| 211 | 211 | <?php |
| 212 | - } |
|
| 213 | - ?> |
|
| 212 | + } |
|
| 213 | + ?> |
|
| 214 | 214 | </div> |
| 215 | 215 | <div class="form-row"> |
| 216 | 216 | <div class="col-auto"> |
@@ -218,42 +218,42 @@ discard block |
||
| 218 | 218 | </div> |
| 219 | 219 | <div class="col-auto"> |
| 220 | 220 | <?php |
| 221 | - echo $this->renderSelect( |
|
| 222 | - $this->vars['status'], |
|
| 223 | - array( |
|
| 224 | - array( |
|
| 225 | - 'value' => '', |
|
| 226 | - 'label' => t('Status...') |
|
| 227 | - ), |
|
| 228 | - array( |
|
| 229 | - 'value' => 'untranslated', |
|
| 230 | - 'label' => t('Not translated') |
|
| 231 | - ), |
|
| 232 | - array( |
|
| 233 | - 'value' => 'translated', |
|
| 234 | - 'label' => t('Translated') |
|
| 235 | - ) |
|
| 236 | - ) |
|
| 237 | - ); |
|
| 221 | + echo $this->renderSelect( |
|
| 222 | + $this->vars['status'], |
|
| 223 | + array( |
|
| 224 | + array( |
|
| 225 | + 'value' => '', |
|
| 226 | + 'label' => t('Status...') |
|
| 227 | + ), |
|
| 228 | + array( |
|
| 229 | + 'value' => 'untranslated', |
|
| 230 | + 'label' => t('Not translated') |
|
| 231 | + ), |
|
| 232 | + array( |
|
| 233 | + 'value' => 'translated', |
|
| 234 | + 'label' => t('Translated') |
|
| 235 | + ) |
|
| 236 | + ) |
|
| 237 | + ); |
|
| 238 | 238 | |
| 239 | - echo $this->renderSelect( |
|
| 240 | - $this->vars['location'], |
|
| 241 | - array( |
|
| 242 | - array( |
|
| 243 | - 'value' => '', |
|
| 244 | - 'label' => t('Location...') |
|
| 245 | - ), |
|
| 246 | - array( |
|
| 247 | - 'value' => 'client', |
|
| 248 | - 'label' => t('Clientside') |
|
| 249 | - ), |
|
| 250 | - array( |
|
| 251 | - 'value' => 'server', |
|
| 252 | - 'label' => t('Serverside') |
|
| 253 | - ) |
|
| 254 | - ) |
|
| 255 | - ); |
|
| 256 | - ?> |
|
| 239 | + echo $this->renderSelect( |
|
| 240 | + $this->vars['location'], |
|
| 241 | + array( |
|
| 242 | + array( |
|
| 243 | + 'value' => '', |
|
| 244 | + 'label' => t('Location...') |
|
| 245 | + ), |
|
| 246 | + array( |
|
| 247 | + 'value' => 'client', |
|
| 248 | + 'label' => t('Clientside') |
|
| 249 | + ), |
|
| 250 | + array( |
|
| 251 | + 'value' => 'server', |
|
| 252 | + 'label' => t('Serverside') |
|
| 253 | + ) |
|
| 254 | + ) |
|
| 255 | + ); |
|
| 256 | + ?> |
|
| 257 | 257 | </div> |
| 258 | 258 | <div class="col-auto"> |
| 259 | 259 | <button type="submit" name="<?php echo $this->vars['filter'] ?>" value="yes" class="btn btn-primary mb-2" title="<?php pt('Filter the list with the selected criteria.') ?>" data-toggle="tooltip"> |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | </form> |
| 269 | 269 | <p> |
| 270 | 270 | <small class="text-muted"><?php |
| 271 | - pts('Hint:'); |
|
| 272 | - pt('Search works in translated and untranslated text, as well as the file name.') |
|
| 273 | - ?></small> |
|
| 271 | + pts('Hint:'); |
|
| 272 | + pt('Search works in translated and untranslated text, as well as the file name.') |
|
| 273 | + ?></small> |
|
| 274 | 274 | </p> |
| 275 | 275 | <br> |
| 276 | 276 | <?php |
@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | $this->editor = $editor; |
| 56 | 56 | $this->request = $editor->getRequest(); |
| 57 | 57 | |
| 58 | - foreach($this->vars as $var => $name) { |
|
| 58 | + foreach ($this->vars as $var => $name) { |
|
| 59 | 59 | $this->vars[$var] = $this->editor->getVarName($var); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if(!isset($_SESSION[$this->sessionName])) { |
|
| 62 | + if (!isset($_SESSION[$this->sessionName])) { |
|
| 63 | 63 | $_SESSION[$this->sessionName] = array(); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if($this->request->getBool($this->vars['resetfilter'])) |
|
| 66 | + if ($this->request->getBool($this->vars['resetfilter'])) |
|
| 67 | 67 | { |
| 68 | 68 | $defaults = $this->getDefaultValues(); |
| 69 | 69 | |
| 70 | - foreach($defaults as $name => $val) { |
|
| 70 | + foreach ($defaults as $name => $val) { |
|
| 71 | 71 | $this->setValue($name, $val); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | - else if($this->request->getBool($this->vars['filter'])) |
|
| 74 | + else if ($this->request->getBool($this->vars['filter'])) |
|
| 75 | 75 | { |
| 76 | 76 | $this->parseSearchTerms($this->request->getParam($this->vars['search'])); |
| 77 | 77 | |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | protected function getValue(string $filterName) : string |
| 108 | 108 | { |
| 109 | - if(isset($_SESSION[$this->sessionName][$filterName])) { |
|
| 109 | + if (isset($_SESSION[$this->sessionName][$filterName])) { |
|
| 110 | 110 | return $_SESSION[$this->sessionName][$filterName]; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $defaults = $this->getDefaultValues(); |
| 114 | - if(isset($defaults[$filterName])) { |
|
| 114 | + if (isset($defaults[$filterName])) { |
|
| 115 | 115 | return $defaults[$filterName]; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | protected function parseSearchTerms(string $searchString) : void |
| 132 | 132 | { |
| 133 | - if(empty($searchString)) |
|
| 133 | + if (empty($searchString)) |
|
| 134 | 134 | { |
| 135 | 135 | $this->searchTerms = array(); |
| 136 | 136 | $this->searchString = ''; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | $terms = array_map('trim', $terms); |
| 145 | 145 | |
| 146 | 146 | $keep = array(); |
| 147 | - foreach($terms as $term) { |
|
| 148 | - if(!empty($term)) { |
|
| 147 | + foreach ($terms as $term) { |
|
| 148 | + if (!empty($term)) { |
|
| 149 | 149 | $keep[] = $term; |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -156,28 +156,28 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | public function isStringMatch(Localization_Scanner_StringHash $string) : bool |
| 158 | 158 | { |
| 159 | - if(!empty($this->searchTerms)) |
|
| 159 | + if (!empty($this->searchTerms)) |
|
| 160 | 160 | { |
| 161 | 161 | $haystack = $string->getSearchString(); |
| 162 | 162 | |
| 163 | - foreach($this->searchTerms as $term) { |
|
| 164 | - if(!mb_stristr($haystack, $term)) { |
|
| 163 | + foreach ($this->searchTerms as $term) { |
|
| 164 | + if (!mb_stristr($haystack, $term)) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $status = $this->getValue($this->vars['status']); |
| 171 | - if($status === 'untranslated' && $string->isTranslated()) { |
|
| 171 | + if ($status === 'untranslated' && $string->isTranslated()) { |
|
| 172 | 172 | return false; |
| 173 | - } else if($status === 'translated' && !$string->isTranslated()) { |
|
| 173 | + } else if ($status === 'translated' && !$string->isTranslated()) { |
|
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $location = $this->getValue($this->vars['location']); |
| 178 | - if($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
| 178 | + if ($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
| 179 | 179 | return false; |
| 180 | - } else if($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
| 180 | + } else if ($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | <div class="form-hiddens"> |
| 206 | 206 | <?php |
| 207 | 207 | $params = $this->editor->getRequestParams(); |
| 208 | - foreach($params as $name => $value) { |
|
| 208 | + foreach ($params as $name => $value) { |
|
| 209 | 209 | ?> |
| 210 | 210 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
| 211 | 211 | <?php |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | ?> |
| 294 | 294 | <select class="form-control" name="<?php echo $filterName ?>"> |
| 295 | 295 | <?php |
| 296 | - foreach($entries as $entry) |
|
| 296 | + foreach ($entries as $entry) |
|
| 297 | 297 | { |
| 298 | 298 | $selected = ''; |
| 299 | - if($entry['value'] === $value) { |
|
| 299 | + if ($entry['value'] === $value) { |
|
| 300 | 300 | $selected = ' selected'; |
| 301 | 301 | } |
| 302 | 302 | |