@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $app = \OC_App::cleanAppId($app); |
114 | 114 | if ($lang !== null) { |
115 | - $lang = str_replace(array('\0', '/', '\\', '..'), '', (string)$lang); |
|
115 | + $lang = str_replace(array('\0', '/', '\\', '..'), '', (string) $lang); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $forceLang = $this->config->getSystemValue('force_language', false); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @link https://github.com/owncloud/core/issues/21955 |
169 | 169 | */ |
170 | 170 | if ($this->config->getSystemValue('installed', false)) { |
171 | - $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
171 | + $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
172 | 172 | if (!is_null($userId)) { |
173 | 173 | $userLang = $this->config->getUserValue($userId, 'core', 'lang', null); |
174 | 174 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | if ($this->config->getSystemValue('installed', false)) { |
221 | - $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
221 | + $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null; |
|
222 | 222 | $userLocale = null; |
223 | 223 | if (null !== $userId) { |
224 | 224 | $userLocale = $this->config->getUserValue($userId, 'core', 'locale', null); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | // merge with translations from theme |
300 | 300 | $theme = $this->config->getSystemValue('theme'); |
301 | 301 | if (!empty($theme)) { |
302 | - $themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot)); |
|
302 | + $themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot)); |
|
303 | 303 | |
304 | 304 | if (is_dir($themeDir)) { |
305 | 305 | $files = scandir($themeDir); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | return $this->availableLocales; |
326 | 326 | } |
327 | 327 | |
328 | - $localeData = file_get_contents(\OC::$SERVERROOT . '/resources/locales.json'); |
|
328 | + $localeData = file_get_contents(\OC::$SERVERROOT.'/resources/locales.json'); |
|
329 | 329 | $this->availableLocales = \json_decode($localeData, true); |
330 | 330 | |
331 | 331 | return $this->availableLocales; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | public function getLanguageIterator(IUser $user = null): ILanguageIterator { |
349 | 349 | $user = $user ?? $this->userSession->getUser(); |
350 | - if($user === null) { |
|
350 | + if ($user === null) { |
|
351 | 351 | throw new \RuntimeException('Failed to get an IUser instance'); |
352 | 352 | } |
353 | 353 | return new LanguageIterator($user, $this->config); |
@@ -465,12 +465,12 @@ discard block |
||
465 | 465 | $languageFiles = []; |
466 | 466 | |
467 | 467 | $i18nDir = $this->findL10nDir($app); |
468 | - $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; |
|
468 | + $transFile = strip_tags($i18nDir).strip_tags($lang).'.json'; |
|
469 | 469 | |
470 | - if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') |
|
471 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') |
|
472 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/') |
|
473 | - || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') |
|
470 | + if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/') |
|
471 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/') |
|
472 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/') |
|
473 | + || $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/') |
|
474 | 474 | ) |
475 | 475 | && file_exists($transFile)) { |
476 | 476 | // load the translations file |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | // merge with translations from theme |
481 | 481 | $theme = $this->config->getSystemValue('theme'); |
482 | 482 | if (!empty($theme)) { |
483 | - $transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot)); |
|
483 | + $transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot)); |
|
484 | 484 | if (file_exists($transFile)) { |
485 | 485 | $languageFiles[] = $transFile; |
486 | 486 | } |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | */ |
498 | 498 | protected function findL10nDir($app = null) { |
499 | 499 | if (in_array($app, ['core', 'lib', 'settings'])) { |
500 | - if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { |
|
501 | - return $this->serverRoot . '/' . $app . '/l10n/'; |
|
500 | + if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) { |
|
501 | + return $this->serverRoot.'/'.$app.'/l10n/'; |
|
502 | 502 | } |
503 | 503 | } else if ($app && \OC_App::getAppPath($app) !== false) { |
504 | 504 | // Check if the app is in the app folder |
505 | - return \OC_App::getAppPath($app) . '/l10n/'; |
|
505 | + return \OC_App::getAppPath($app).'/l10n/'; |
|
506 | 506 | } |
507 | - return $this->serverRoot . '/core/l10n/'; |
|
507 | + return $this->serverRoot.'/core/l10n/'; |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -521,15 +521,15 @@ discard block |
||
521 | 521 | return $this->pluralFunctions[$string]; |
522 | 522 | } |
523 | 523 | |
524 | - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
524 | + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
525 | 525 | // sanitize |
526 | - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); |
|
527 | - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); |
|
526 | + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); |
|
527 | + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); |
|
528 | 528 | |
529 | 529 | $body = str_replace( |
530 | - array( 'plural', 'n', '$n$plurals', ), |
|
531 | - array( '$plural', '$n', '$nplurals', ), |
|
532 | - 'nplurals='. $nplurals . '; plural=' . $plural |
|
530 | + array('plural', 'n', '$n$plurals',), |
|
531 | + array('$plural', '$n', '$nplurals',), |
|
532 | + 'nplurals='.$nplurals.'; plural='.$plural |
|
533 | 533 | ); |
534 | 534 | |
535 | 535 | // add parents |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | $res = ''; |
539 | 539 | $p = 0; |
540 | 540 | $length = strlen($body); |
541 | - for($i = 0; $i < $length; $i++) { |
|
541 | + for ($i = 0; $i < $length; $i++) { |
|
542 | 542 | $ch = $body[$i]; |
543 | - switch ( $ch ) { |
|
543 | + switch ($ch) { |
|
544 | 544 | case '?': |
545 | 545 | $res .= ' ? ('; |
546 | 546 | $p++; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $res .= ') : ('; |
550 | 550 | break; |
551 | 551 | case ';': |
552 | - $res .= str_repeat( ')', $p ) . ';'; |
|
552 | + $res .= str_repeat(')', $p).';'; |
|
553 | 553 | $p = 0; |
554 | 554 | break; |
555 | 555 | default: |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | - $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
560 | + $body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
561 | 561 | $function = create_function('$n', $body); |
562 | 562 | $this->pluralFunctions[$string] = $function; |
563 | 563 | return $function; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $commonLanguages = []; |
590 | 590 | $languages = []; |
591 | 591 | |
592 | - foreach($languageCodes as $lang) { |
|
592 | + foreach ($languageCodes as $lang) { |
|
593 | 593 | $l = $this->get('lib', $lang); |
594 | 594 | // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version |
595 | 595 | $potentialName = (string) $l->t('__language_name__'); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | ksort($commonLanguages); |
623 | 623 | |
624 | 624 | // sort now by displayed language not the iso-code |
625 | - usort( $languages, function ($a, $b) { |
|
625 | + usort($languages, function($a, $b) { |
|
626 | 626 | if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) { |
627 | 627 | // If a doesn't have a name, but b does, list b before a |
628 | 628 | return 1; |