@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __construct(string $localeName) |
51 | 51 | { |
52 | - if(!self::isLocaleKnown($localeName)) |
|
52 | + if (!self::isLocaleKnown($localeName)) |
|
53 | 53 | { |
54 | 54 | throw new Localization_Exception( |
55 | 55 | 'Invalid locale', |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getLabel() : string |
146 | 146 | { |
147 | - switch($this->localeName) |
|
147 | + switch ($this->localeName) |
|
148 | 148 | { |
149 | 149 | case 'de_DE': |
150 | 150 | return t('German'); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | throw new Localization_Exception( |
172 | - 'Label is missing for the locale ' . $this->localeName, |
|
172 | + 'Label is missing for the locale '.$this->localeName, |
|
173 | 173 | null, |
174 | 174 | self::ERROR_LOCALE_LABEL_MISSING |
175 | 175 | ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function getCountry() : Localization_Country |
183 | 183 | { |
184 | - if(!isset($this->country)) { |
|
184 | + if (!isset($this->country)) { |
|
185 | 185 | $this->country = Localization::createCountry($this->countryCode); |
186 | 186 | } |
187 | 187 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getID() : string |
78 | 78 | { |
79 | - if(!isset($this->id)) { |
|
79 | + if (!isset($this->id)) { |
|
80 | 80 | $this->id = str_replace('AppLocalize\Localization_Parser_Language_', '', get_class($this)); |
81 | 81 | } |
82 | 82 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function parseFile(string $path) : void |
103 | 103 | { |
104 | - if(!file_exists($path)) |
|
104 | + if (!file_exists($path)) |
|
105 | 105 | { |
106 | 106 | throw new Localization_Exception( |
107 | 107 | sprintf('Source code file [%s] not found', basename($path)), |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->sourceFile = $path; |
117 | 117 | $this->content = file_get_contents($path); |
118 | 118 | |
119 | - if($this->content !== false) { |
|
119 | + if ($this->content !== false) { |
|
120 | 120 | $this->parse(); |
121 | 121 | return; |
122 | 122 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | $this->tokens = $this->getTokens(); |
151 | 151 | $this->totalTokens = count($this->tokens); |
152 | 152 | |
153 | - for($i = 0; $i < $this->totalTokens; $i++) |
|
153 | + for ($i = 0; $i < $this->totalTokens; $i++) |
|
154 | 154 | { |
155 | 155 | $token = $this->createToken($this->tokens[$i]); |
156 | 156 | |
157 | - if($token->isTranslationFunction()) { |
|
158 | - $this->parseToken($i+1, $token); |
|
157 | + if ($token->isTranslationFunction()) { |
|
158 | + $this->parseToken($i + 1, $token); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | return $this->texts; |
166 | 166 | } |
167 | 167 | |
168 | - protected function addResult($text, $line=null) |
|
168 | + protected function addResult($text, $line = null) |
|
169 | 169 | { |
170 | 170 | $this->log(sprintf('Line [%1$s] | Found string [%2$s]', $line, $text)); |
171 | 171 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param Localization_Parser_Token $parentToken |
235 | 235 | * @return Localization_Parser_Token |
236 | 236 | */ |
237 | - protected function createToken($definition, Localization_Parser_Token $parentToken=null) : Localization_Parser_Token |
|
237 | + protected function createToken($definition, Localization_Parser_Token $parentToken = null) : Localization_Parser_Token |
|
238 | 238 | { |
239 | 239 | $class = '\AppLocalize\Localization_Parser_Token_'.$this->getID(); |
240 | 240 | |
@@ -253,43 +253,43 @@ discard block |
||
253 | 253 | $max = $number + 200; |
254 | 254 | $open = false; |
255 | 255 | |
256 | - for($i = $number; $i < $max; $i++) |
|
256 | + for ($i = $number; $i < $max; $i++) |
|
257 | 257 | { |
258 | - if(!isset($this->tokens[$i])) { |
|
258 | + if (!isset($this->tokens[$i])) { |
|
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | 262 | $subToken = $this->createToken($this->tokens[$i], $token); |
263 | 263 | |
264 | - if(!$open && $subToken->isOpeningFuncParams()) |
|
264 | + if (!$open && $subToken->isOpeningFuncParams()) |
|
265 | 265 | { |
266 | 266 | $open = true; |
267 | 267 | continue; |
268 | 268 | } |
269 | 269 | |
270 | - if($open && $subToken->isClosingFuncParams()) { |
|
270 | + if ($open && $subToken->isClosingFuncParams()) { |
|
271 | 271 | break; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // additional parameters in the translation function, we don't want to capture these now. |
275 | - if($open && $subToken->isArgumentSeparator()) { |
|
275 | + if ($open && $subToken->isArgumentSeparator()) { |
|
276 | 276 | break; |
277 | 277 | } |
278 | 278 | |
279 | - if($open && $subToken->isEncapsedString()) |
|
279 | + if ($open && $subToken->isEncapsedString()) |
|
280 | 280 | { |
281 | 281 | $textParts[] = $this->trimText($subToken->getValue()); |
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | |
285 | - if($open && $subToken->isVariableOrFunction()) { |
|
285 | + if ($open && $subToken->isVariableOrFunction()) { |
|
286 | 286 | $textParts = null; |
287 | 287 | $this->addWarning($subToken, t('Variables or functions are not supported in translation functions.')); |
288 | 288 | break; |
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
292 | - if(empty($textParts)) { |
|
292 | + if (empty($textParts)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | protected function debug($text) |
302 | 302 | { |
303 | - if($this->debug) { |
|
303 | + if ($this->debug) { |
|
304 | 304 | echo $text; |
305 | 305 | } |
306 | 306 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | protected $line = 0; |
22 | 22 | |
23 | - public function __construct($definition, Localization_Parser_Token $parentToken=null) |
|
23 | + public function __construct($definition, Localization_Parser_Token $parentToken = null) |
|
24 | 24 | { |
25 | 25 | $this->definition = $definition; |
26 | 26 | $this->parentToken = $parentToken; |
@@ -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 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $ext = \AppUtils\FileHelper::getExtension($path); |
97 | 97 | |
98 | - if($this->isExtensionSupported($ext)) { |
|
98 | + if ($this->isExtensionSupported($ext)) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $values = $this->getLanguageIDs(); |
115 | 115 | |
116 | - if(in_array($languageID, $values)) { |
|
116 | + if (in_array($languageID, $values)) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $this->requireValidLanguageID($languageID); |
157 | 157 | |
158 | - if(!isset($this->languageParsers[$languageID])) |
|
158 | + if (!isset($this->languageParsers[$languageID])) |
|
159 | 159 | { |
160 | 160 | $class = '\AppLocalize\Localization_Parser_Language_'.$languageID; |
161 | 161 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function getPrevious() : ?Localization_Locale |
28 | 28 | { |
29 | 29 | $arg = $this->getArgument(1); |
30 | - if(is_array($arg)) { |
|
30 | + if (is_array($arg)) { |
|
31 | 31 | return $arg['locale']; |
32 | 32 | } |
33 | 33 |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | |
108 | 108 | protected function initSession() |
109 | 109 | { |
110 | - if(session_status() != PHP_SESSION_ACTIVE) { |
|
110 | + if (session_status() != PHP_SESSION_ACTIVE) { |
|
111 | 111 | session_start(); |
112 | 112 | } |
113 | 113 | |
114 | - if(!isset($_SESSION['localization_messages'])) { |
|
114 | + if (!isset($_SESSION['localization_messages'])) { |
|
115 | 115 | $_SESSION['localization_messages'] = array(); |
116 | 116 | } |
117 | 117 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $this->sources = Localization::getSources(); |
127 | 127 | |
128 | - if(empty($this->sources)) |
|
128 | + if (empty($this->sources)) |
|
129 | 129 | { |
130 | 130 | throw new Localization_Exception( |
131 | 131 | 'Cannot start editor: no sources defined.', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $activeID = $this->request->registerParam($this->getVarName('source'))->setEnum(Localization::getSourceIDs())->get(); |
138 | - if(empty($activeID)) { |
|
138 | + if (empty($activeID)) { |
|
139 | 139 | $activeID = $this->getDefaultSourceID(); |
140 | 140 | } |
141 | 141 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | protected function getDefaultSourceID() |
146 | 146 | { |
147 | 147 | $default = $this->getOption('default-source'); |
148 | - if(!empty($default) && Localization::sourceAliasExists($default)) { |
|
148 | + if (!empty($default) && Localization::sourceAliasExists($default)) { |
|
149 | 149 | return Localization::getSourceByAlias($default)->getID(); |
150 | 150 | } |
151 | 151 | |
@@ -157,21 +157,21 @@ discard block |
||
157 | 157 | $names = array(); |
158 | 158 | |
159 | 159 | $locales = Localization::getAppLocales(); |
160 | - foreach($locales as $locale) { |
|
161 | - if(!$locale->isNative()) { |
|
160 | + foreach ($locales as $locale) { |
|
161 | + if (!$locale->isNative()) { |
|
162 | 162 | $this->appLocales[] = $locale; |
163 | 163 | $names[] = $locale->getName(); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | 167 | // use the default locale if no other is available. |
168 | - if(empty($names)) { |
|
168 | + if (empty($names)) { |
|
169 | 169 | $this->activeAppLocale = Localization::getAppLocale(); |
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $activeID = $this->request->registerParam($this->getVarName('locale'))->setEnum($names)->get(); |
174 | - if(empty($activeID)) { |
|
174 | + if (empty($activeID)) { |
|
175 | 175 | $activeID = $this->appLocales[0]->getName(); |
176 | 176 | } |
177 | 177 | |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | |
190 | 190 | $this->filters = new Localization_Editor_Filters($this); |
191 | 191 | |
192 | - if($this->request->getBool($this->getVarName('scan'))) |
|
192 | + if ($this->request->getBool($this->getVarName('scan'))) |
|
193 | 193 | { |
194 | 194 | $this->executeScan(); |
195 | 195 | } |
196 | - else if($this->request->getBool($this->getVarName('save'))) |
|
196 | + else if ($this->request->getBool($this->getVarName('save'))) |
|
197 | 197 | { |
198 | 198 | $this->executeSave(); |
199 | 199 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | <div class="collapse navbar-collapse" id="navbarsExampleDefault"> |
233 | 233 | <?php |
234 | - if(!empty($this->appLocales)) |
|
234 | + if (!empty($this->appLocales)) |
|
235 | 235 | { |
236 | 236 | ?> |
237 | 237 | <ul class="navbar-nav mr-auto"> |
@@ -241,12 +241,12 @@ discard block |
||
241 | 241 | </a> |
242 | 242 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
243 | 243 | <?php |
244 | - foreach($this->sources as $source) |
|
244 | + foreach ($this->sources as $source) |
|
245 | 245 | { |
246 | 246 | ?> |
247 | 247 | <a class="dropdown-item" href="<?php echo $this->getSourceURL($source) ?>"> |
248 | 248 | <?php |
249 | - if($source->getID() === $this->activeSource->getID()) |
|
249 | + if ($source->getID() === $this->activeSource->getID()) |
|
250 | 250 | { |
251 | 251 | ?> |
252 | 252 | <b><?php echo $source->getLabel() ?></b> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ?> |
260 | 260 | <?php |
261 | 261 | $untranslated = $source->countUntranslated($this->scanner); |
262 | - if($untranslated > 0) { |
|
262 | + if ($untranslated > 0) { |
|
263 | 263 | ?> |
264 | 264 | (<span class="text-danger" title="<?php pt('%1$s texts have not been translated in this text source.', $untranslated) ?>"><?php echo $untranslated ?></span>) |
265 | 265 | <?php |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | </a> |
278 | 278 | <div class="dropdown-menu" aria-labelledby="dropdown01"> |
279 | 279 | <?php |
280 | - foreach($this->appLocales as $locale) |
|
280 | + foreach ($this->appLocales as $locale) |
|
281 | 281 | { |
282 | 282 | ?> |
283 | 283 | <a class="dropdown-item" href="<?php echo $this->getLocaleURL($locale) ?>"> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | </a> |
296 | 296 | </li> |
297 | 297 | <?php |
298 | - if($this->scanner->hasWarnings()) { |
|
298 | + if ($this->scanner->hasWarnings()) { |
|
299 | 299 | ?> |
300 | 300 | <li class="nav-item"> |
301 | 301 | <a href="<?php echo $this->getWarningsURL() ?>"> |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | ?> |
315 | 315 | <?php |
316 | 316 | $backURL = $this->getOption('back-url'); |
317 | - if(!empty($backURL)) |
|
317 | + if (!empty($backURL)) |
|
318 | 318 | { |
319 | 319 | ?> |
320 | 320 | <a href="<?php echo $backURL ?>" class="btn btn-light btn-sm"> |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | <main role="main" class="container"> |
330 | 330 | <div> |
331 | 331 | <?php |
332 | - if(empty($this->appLocales)) |
|
332 | + if (empty($this->appLocales)) |
|
333 | 333 | { |
334 | 334 | ?> |
335 | 335 | <div class="alert alert-danger"> |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | </div> |
340 | 340 | <?php |
341 | 341 | } |
342 | - else if($this->request->getBool($this->getVarName('warnings'))) |
|
342 | + else if ($this->request->getBool($this->getVarName('warnings'))) |
|
343 | 343 | { |
344 | 344 | echo $this->renderWarnings(); |
345 | 345 | } |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | ?> |
349 | 349 | <h1><?php echo $this->activeSource->getLabel() ?></h1> |
350 | 350 | <?php |
351 | - if(!empty($_SESSION['localization_messages'])) |
|
351 | + if (!empty($_SESSION['localization_messages'])) |
|
352 | 352 | { |
353 | - foreach($_SESSION['localization_messages'] as $def) |
|
353 | + foreach ($_SESSION['localization_messages'] as $def) |
|
354 | 354 | { |
355 | 355 | ?> |
356 | 356 | <div class="alert alert-<?php echo $def['type'] ?>" role="alert"> |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | </p> |
380 | 380 | <br> |
381 | 381 | <?php |
382 | - if(!$this->scanner->isScanAvailable()) |
|
382 | + if (!$this->scanner->isScanAvailable()) |
|
383 | 383 | { |
384 | 384 | ?> |
385 | 385 | <div class="alert alert-primary" role="alert"> |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | <?php |
427 | 427 | $warnings = $this->scanner->getWarnings(); |
428 | 428 | |
429 | - foreach($warnings as $warning) |
|
429 | + foreach ($warnings as $warning) |
|
430 | 430 | { |
431 | 431 | ?> |
432 | 432 | <dt><?php echo FileHelper::relativizePathByDepth($warning->getFile(), 3) ?>:<?php echo $warning->getLine() ?></dt> |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | |
448 | 448 | $result = array(); |
449 | 449 | |
450 | - foreach($strings as $string) |
|
450 | + foreach ($strings as $string) |
|
451 | 451 | { |
452 | - if($this->filters->isStringMatch($string)) { |
|
452 | + if ($this->filters->isStringMatch($string)) { |
|
453 | 453 | $result[] = $string; |
454 | 454 | } |
455 | 455 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | { |
473 | 473 | $strings = $this->getFilteredStrings(); |
474 | 474 | |
475 | - if(empty($strings)) |
|
475 | + if (empty($strings)) |
|
476 | 476 | { |
477 | 477 | ?> |
478 | 478 | <div class="alert alert-info"> |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | <div class="form-hiddens"> |
495 | 495 | <?php |
496 | 496 | $params = $this->getRequestParams(); |
497 | - foreach($params as $name => $value) { |
|
497 | + foreach ($params as $name => $value) { |
|
498 | 498 | ?> |
499 | 499 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
500 | 500 | <?php |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | </thead> |
513 | 513 | <tbody> |
514 | 514 | <?php |
515 | - foreach($keep as $string) |
|
515 | + foreach ($keep as $string) |
|
516 | 516 | { |
517 | 517 | $this->renderListEntry($string); |
518 | 518 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | </tbody> |
521 | 521 | </table> |
522 | 522 | <?php |
523 | - if($pager->hasPages()) |
|
523 | + if ($pager->hasPages()) |
|
524 | 524 | { |
525 | 525 | $prevUrl = $this->getPaginationURL($pager->getPreviousPage()); |
526 | 526 | $nextUrl = $this->getPaginationURL($pager->getNextPage()); |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | </li> |
536 | 536 | <?php |
537 | 537 | $numbers = $pager->getPageNumbers(); |
538 | - foreach($numbers as $number) |
|
538 | + foreach ($numbers as $number) |
|
539 | 539 | { |
540 | 540 | $url = $this->getPaginationURL($number); |
541 | 541 | |
542 | 542 | ?> |
543 | - <li class="page-item <?php if($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
|
543 | + <li class="page-item <?php if ($pager->isCurrentPage($number)) { echo 'active'; } ?>"> |
|
544 | 544 | <a class="page-link" href="<?php echo $url ?>"> |
545 | 545 | <?php echo $number ?> |
546 | 546 | </a> |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | <?php |
571 | 571 | } |
572 | 572 | |
573 | - protected function getPaginationURL(int $page, $params=array()) |
|
573 | + protected function getPaginationURL(int $page, $params = array()) |
|
574 | 574 | { |
575 | 575 | $params[$this->getVarName('page')] = $page; |
576 | 576 | |
@@ -582,11 +582,11 @@ discard block |
||
582 | 582 | $hash = $string->getHash(); |
583 | 583 | |
584 | 584 | $previewText = $string->getTranslatedText(); |
585 | - if(empty($previewText)) { |
|
585 | + if (empty($previewText)) { |
|
586 | 586 | $previewText = $string->getText(); |
587 | 587 | } |
588 | 588 | |
589 | - $shortText = $this->renderText($previewText, 50); |
|
589 | + $shortText = $this->renderText($previewText, 50); |
|
590 | 590 | |
591 | 591 | $files = $string->getFiles(); |
592 | 592 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | <?php |
618 | 618 | $totalFiles = count($files); |
619 | 619 | |
620 | - if($totalFiles == 1) |
|
620 | + if ($totalFiles == 1) |
|
621 | 621 | { |
622 | 622 | pt('Found in a single file:'); |
623 | 623 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | <?php |
633 | 633 | $locations = $string->getStrings(); |
634 | 634 | |
635 | - foreach($locations as $location) |
|
635 | + foreach ($locations as $location) |
|
636 | 636 | { |
637 | 637 | $file = $location->getSourceFile(); |
638 | 638 | $line = $location->getLine(); |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | |
642 | 642 | $ext = \AppUtils\FileHelper::getExtension($file); |
643 | 643 | |
644 | - if($ext == 'php') { |
|
644 | + if ($ext == 'php') { |
|
645 | 645 | $icon = 'fab fa-php'; |
646 | - } else if($ext == 'js') { |
|
646 | + } else if ($ext == 'js') { |
|
647 | 647 | $icon = 'fab fa-js-square'; |
648 | 648 | } else { |
649 | 649 | $icon = 'fas fa-file-code'; |
@@ -666,13 +666,13 @@ discard block |
||
666 | 666 | |
667 | 667 | } |
668 | 668 | |
669 | - protected function renderText(string $text, int $cutAt=0) : string |
|
669 | + protected function renderText(string $text, int $cutAt = 0) : string |
|
670 | 670 | { |
671 | - if(empty($text)) { |
|
671 | + if (empty($text)) { |
|
672 | 672 | return $text; |
673 | 673 | } |
674 | 674 | |
675 | - if($cutAt > 0) { |
|
675 | + if ($cutAt > 0) { |
|
676 | 676 | $text = \AppUtils\ConvertHelper::text_cut($text, $cutAt); |
677 | 677 | } |
678 | 678 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | |
681 | 681 | $vars = $this->detectVariables($text); |
682 | 682 | |
683 | - foreach($vars as $var) { |
|
683 | + foreach ($vars as $var) { |
|
684 | 684 | $text = str_replace($var, '<span class="placeholder">'.$var.'</span>', $text); |
685 | 685 | } |
686 | 686 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | $result = array(); |
693 | 693 | preg_match_all('/%[0-9]+d|%s|%[0-9]+\$s/i', $string, $result, PREG_PATTERN_ORDER); |
694 | 694 | |
695 | - if(isset($result[0]) && !empty($result[0])) { |
|
695 | + if (isset($result[0]) && !empty($result[0])) { |
|
696 | 696 | return $result[0]; |
697 | 697 | } |
698 | 698 | |
@@ -708,10 +708,10 @@ discard block |
||
708 | 708 | |
709 | 709 | // add a counter of the additional files if the total |
710 | 710 | // is higher than the maximum to show |
711 | - if($total > $max) |
|
711 | + if ($total > $max) |
|
712 | 712 | { |
713 | 713 | $length = $max; |
714 | - if($length > $keepTotal) { |
|
714 | + if ($length > $keepTotal) { |
|
715 | 715 | $length = $keepTotal; |
716 | 716 | } |
717 | 717 | |
@@ -739,14 +739,14 @@ discard block |
||
739 | 739 | return file_get_contents($this->installPath.'/css/editor.css'); |
740 | 740 | } |
741 | 741 | |
742 | - public function getSourceURL(Localization_Source $source, array $params=array()) |
|
742 | + public function getSourceURL(Localization_Source $source, array $params = array()) |
|
743 | 743 | { |
744 | 744 | $params[$this->getVarName('source')] = $source->getID(); |
745 | 745 | |
746 | 746 | return $this->getURL($params); |
747 | 747 | } |
748 | 748 | |
749 | - public function getLocaleURL(Localization_Locale $locale, array $params=array()) |
|
749 | + public function getLocaleURL(Localization_Locale $locale, array $params = array()) |
|
750 | 750 | { |
751 | 751 | $params[$this->getVarName('locale')] = $locale->getName(); |
752 | 752 | |
@@ -763,12 +763,12 @@ discard block |
||
763 | 763 | return $this->getSourceURL($this->activeSource, array($this->getVarName('warnings') => 'yes')); |
764 | 764 | } |
765 | 765 | |
766 | - public function getURL(array $params=array()) |
|
766 | + public function getURL(array $params = array()) |
|
767 | 767 | { |
768 | 768 | $persist = $this->getRequestParams(); |
769 | 769 | |
770 | - foreach($persist as $name => $value) { |
|
771 | - if(!isset($params[$name])) { |
|
770 | + foreach ($persist as $name => $value) { |
|
771 | + if (!isset($params[$name])) { |
|
772 | 772 | $params[$name] = $value; |
773 | 773 | } |
774 | 774 | } |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | $translator = Localization::getTranslator($this->activeAppLocale); |
802 | 802 | |
803 | 803 | $strings = $data[$this->getVarName('strings')]; |
804 | - foreach($strings as $hash => $text) |
|
804 | + foreach ($strings as $hash => $text) |
|
805 | 805 | { |
806 | 806 | $text = trim($text); |
807 | 807 | |
808 | - if(empty($text)) { |
|
808 | + if (empty($text)) { |
|
809 | 809 | continue; |
810 | 810 | } |
811 | 811 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | |
828 | 828 | protected function renderStatus(Localization_Scanner_StringHash $hash) |
829 | 829 | { |
830 | - if($hash->isTranslated()) { |
|
830 | + if ($hash->isTranslated()) { |
|
831 | 831 | return '<i class="fa fa-check text-success"></i>'; |
832 | 832 | } |
833 | 833 | |
@@ -838,18 +838,18 @@ discard block |
||
838 | 838 | { |
839 | 839 | $types = array(); |
840 | 840 | |
841 | - if($hash->hasLanguageType('PHP')) { |
|
841 | + if ($hash->hasLanguageType('PHP')) { |
|
842 | 842 | $types[] = t('Server'); |
843 | 843 | } |
844 | 844 | |
845 | - if($hash->hasLanguageType('Javascript')) { |
|
845 | + if ($hash->hasLanguageType('Javascript')) { |
|
846 | 846 | $types[] = t('Client'); |
847 | 847 | } |
848 | 848 | |
849 | 849 | return implode(', ', $types); |
850 | 850 | } |
851 | 851 | |
852 | - protected function addMessage($message, $type=self::MESSAGE_INFO) |
|
852 | + protected function addMessage($message, $type = self::MESSAGE_INFO) |
|
853 | 853 | { |
854 | 854 | $_SESSION['localization_messages'][] = array( |
855 | 855 | 'text' => $message, |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | public function getAppName() : string |
884 | 884 | { |
885 | 885 | $name = $this->getOption('appname'); |
886 | - if(!empty($name)) { |
|
886 | + if (!empty($name)) { |
|
887 | 887 | return $name; |
888 | 888 | } |
889 | 889 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | protected $details; |
8 | 8 | |
9 | - public function __construct($message, $details=null, $code=null, $previous=null) |
|
9 | + public function __construct($message, $details = null, $code = null, $previous = null) |
|
10 | 10 | { |
11 | 11 | parent::__construct($message, $code, $previous); |
12 | 12 | $this->details = $details; |
@@ -35,23 +35,23 @@ discard block |
||
35 | 35 | $this->editor = $editor; |
36 | 36 | $this->request = $editor->getRequest(); |
37 | 37 | |
38 | - foreach($this->vars as $var => $name) { |
|
38 | + foreach ($this->vars as $var => $name) { |
|
39 | 39 | $this->vars[$var] = $this->editor->getVarName($var); |
40 | 40 | } |
41 | 41 | |
42 | - if(!isset($_SESSION[$this->sessionName])) { |
|
42 | + if (!isset($_SESSION[$this->sessionName])) { |
|
43 | 43 | $_SESSION[$this->sessionName] = array(); |
44 | 44 | } |
45 | 45 | |
46 | - if($this->request->getBool($this->vars['resetfilter'])) |
|
46 | + if ($this->request->getBool($this->vars['resetfilter'])) |
|
47 | 47 | { |
48 | 48 | $defaults = $this->getDefaultValues(); |
49 | 49 | |
50 | - foreach($defaults as $name => $val) { |
|
50 | + foreach ($defaults as $name => $val) { |
|
51 | 51 | $this->setValue($name, $val); |
52 | 52 | } |
53 | 53 | } |
54 | - else if($this->request->getBool($this->vars['filter'])) |
|
54 | + else if ($this->request->getBool($this->vars['filter'])) |
|
55 | 55 | { |
56 | 56 | $this->parseSearchTerms($this->request->getParam($this->vars['search'])); |
57 | 57 | |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | |
87 | 87 | protected function getValue(string $filterName) : string |
88 | 88 | { |
89 | - if(isset($_SESSION[$this->sessionName][$filterName])) { |
|
89 | + if (isset($_SESSION[$this->sessionName][$filterName])) { |
|
90 | 90 | return $_SESSION[$this->sessionName][$filterName]; |
91 | 91 | } |
92 | 92 | |
93 | 93 | $defaults = $this->getDefaultValues(); |
94 | - if(isset($defaults[$filterName])) { |
|
94 | + if (isset($defaults[$filterName])) { |
|
95 | 95 | return $defaults[$filterName]; |
96 | 96 | } |
97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | protected function parseSearchTerms(string $searchString) |
105 | 105 | { |
106 | - if(empty($searchString)) |
|
106 | + if (empty($searchString)) |
|
107 | 107 | { |
108 | 108 | $this->searchTerms = array(); |
109 | 109 | $this->searchString = ''; |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $terms = array_map('trim', $terms); |
118 | 118 | |
119 | 119 | $keep = array(); |
120 | - foreach($terms as $term) { |
|
121 | - if(!empty($term)) { |
|
120 | + foreach ($terms as $term) { |
|
121 | + if (!empty($term)) { |
|
122 | 122 | $keep[] = $term; |
123 | 123 | } |
124 | 124 | } |
@@ -129,28 +129,28 @@ discard block |
||
129 | 129 | |
130 | 130 | public function isStringMatch(Localization_Scanner_StringHash $string) |
131 | 131 | { |
132 | - if(!empty($this->searchTerms)) |
|
132 | + if (!empty($this->searchTerms)) |
|
133 | 133 | { |
134 | 134 | $haystack = $string->getSearchString(); |
135 | 135 | |
136 | - foreach($this->searchTerms as $term) { |
|
137 | - if(!mb_stristr($haystack, $term)) { |
|
136 | + foreach ($this->searchTerms as $term) { |
|
137 | + if (!mb_stristr($haystack, $term)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | $status = $this->getValue($this->vars['status']); |
144 | - if($status === 'untranslated' && $string->isTranslated()) { |
|
144 | + if ($status === 'untranslated' && $string->isTranslated()) { |
|
145 | 145 | return false; |
146 | - } else if($status === 'translated' && !$string->isTranslated()) { |
|
146 | + } else if ($status === 'translated' && !$string->isTranslated()) { |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $location = $this->getValue($this->vars['location']); |
151 | - if($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
151 | + if ($location === 'client' && !$string->hasLanguageType('Javascript')) { |
|
152 | 152 | return false; |
153 | - } else if($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
153 | + } else if ($location === 'server' && !$string->hasLanguageType('PHP')) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | <div class="form-hiddens"> |
176 | 176 | <?php |
177 | 177 | $params = $this->editor->getRequestParams(); |
178 | - foreach($params as $name => $value) { |
|
178 | + foreach ($params as $name => $value) { |
|
179 | 179 | ?> |
180 | 180 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>"> |
181 | 181 | <?php |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | ?> |
252 | 252 | <select class="form-control" name="<?php echo $filterName ?>"> |
253 | 253 | <?php |
254 | - foreach($entries as $entry) |
|
254 | + foreach ($entries as $entry) |
|
255 | 255 | { |
256 | 256 | $selected = ''; |
257 | - if($entry['value'] === $value) { |
|
257 | + if ($entry['value'] === $value) { |
|
258 | 258 | $selected = ' selected'; |
259 | 259 | } |
260 | 260 |