@@ -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 |
@@ -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])) { |
@@ -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) { |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | protected $country; |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | 39 | protected $countryCode; |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @var string |
|
| 43 | - */ |
|
| 41 | + /** |
|
| 42 | + * @var string |
|
| 43 | + */ |
|
| 44 | 44 | protected $languageCode; |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | $this->languageCode = $tokens[0]; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Retrieves the two-letter language code of the locale. |
|
| 74 | - * |
|
| 75 | - * @return string Language code, e.g. "en", "de" |
|
| 76 | - */ |
|
| 72 | + /** |
|
| 73 | + * Retrieves the two-letter language code of the locale. |
|
| 74 | + * |
|
| 75 | + * @return string Language code, e.g. "en", "de" |
|
| 76 | + */ |
|
| 77 | 77 | public function getLanguageCode() : string |
| 78 | 78 | { |
| 79 | 79 | return $this->languageCode; |
@@ -100,25 +100,25 @@ discard block |
||
| 100 | 100 | return $this->localeName; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Retrieves the shortened version of the locale name, |
|
| 105 | - * e.g. "en" or "de". |
|
| 106 | - * |
|
| 107 | - * @return string |
|
| 108 | - * @deprecated |
|
| 109 | - * @see Localization_Locale::getLanguageCode() |
|
| 110 | - */ |
|
| 103 | + /** |
|
| 104 | + * Retrieves the shortened version of the locale name, |
|
| 105 | + * e.g. "en" or "de". |
|
| 106 | + * |
|
| 107 | + * @return string |
|
| 108 | + * @deprecated |
|
| 109 | + * @see Localization_Locale::getLanguageCode() |
|
| 110 | + */ |
|
| 111 | 111 | public function getShortName() : string |
| 112 | 112 | { |
| 113 | 113 | return $this->getLanguageCode(); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Retrieves the two-letter country code of |
|
| 118 | - * the locale. |
|
| 119 | - * |
|
| 120 | - * @return string Lowercase code, e.g. "uk" |
|
| 121 | - */ |
|
| 116 | + /** |
|
| 117 | + * Retrieves the two-letter country code of |
|
| 118 | + * the locale. |
|
| 119 | + * |
|
| 120 | + * @return string Lowercase code, e.g. "uk" |
|
| 121 | + */ |
|
| 122 | 122 | public function getCountryCode() : string |
| 123 | 123 | { |
| 124 | 124 | return $this->countryCode; |
@@ -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]; |
@@ -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 |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Localization_Scanner_StringsCollection_Warning |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var array |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var array |
|
| 11 | + */ |
|
| 12 | 12 | protected $data; |
| 13 | 13 | |
| 14 | 14 | public function __construct(array $data) |
@@ -121,8 +121,7 @@ |
||
| 121 | 121 | $lines[] = '; '; |
| 122 | 122 | $lines[] = '; 1) Do not to modify the keys (left hand side of the = sign)'; |
| 123 | 123 | $lines[] = '; 2) Save the file as UTF-8 without BOM'; |
| 124 | - } |
|
| 125 | - else |
|
| 124 | + } else |
|
| 126 | 125 | { |
| 127 | 126 | $lines[] = '; Do NOT edit this file directly! It depends on the main translation file'; |
| 128 | 127 | $lines[] = '; and any changes will be lost. Edit the main file instead.'; |
@@ -20,29 +20,29 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class Localization_Writer |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var boolean |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var boolean |
|
| 25 | + */ |
|
| 26 | 26 | private $editable = false; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var array<string,string> |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var array<string,string> |
|
| 30 | + */ |
|
| 31 | 31 | private $hashes = array(); |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var Localization_Locale |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var Localization_Locale |
|
| 35 | + */ |
|
| 36 | 36 | private $locale; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 38 | + /** |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | 41 | private $fileType; |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | 46 | private $filePath; |
| 47 | 47 | |
| 48 | 48 | public function __construct(Localization_Locale $locale, string $fileType, string $filePath) |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | return $hashes; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Sort the strings to ensure they always appear in the same order: |
|
| 155 | - * first by text, and same strings by their hashes. This is important |
|
| 156 | - * for strings that have the same translation to avoid them changing |
|
| 157 | - * order between sorts. |
|
| 158 | - * |
|
| 159 | - * @param array $a |
|
| 160 | - * @param array $b |
|
| 161 | - * @return int |
|
| 162 | - */ |
|
| 153 | + /** |
|
| 154 | + * Sort the strings to ensure they always appear in the same order: |
|
| 155 | + * first by text, and same strings by their hashes. This is important |
|
| 156 | + * for strings that have the same translation to avoid them changing |
|
| 157 | + * order between sorts. |
|
| 158 | + * |
|
| 159 | + * @param array $a |
|
| 160 | + * @param array $b |
|
| 161 | + * @return int |
|
| 162 | + */ |
|
| 163 | 163 | public function callback_sortStrings(array $a, array $b) : int |
| 164 | 164 | { |
| 165 | 165 | $result = strnatcasecmp($a['text'], $b['text']); |
@@ -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]; |