@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30) { |
60 | 60 | $this->initProviders(); |
61 | 61 | $results = array(); |
62 | - foreach($this->providers as $provider) { |
|
62 | + foreach ($this->providers as $provider) { |
|
63 | 63 | /** @var $provider Provider */ |
64 | - if ( ! $provider->providesResultsFor($inApps) ) { |
|
64 | + if (!$provider->providesResultsFor($inApps)) { |
|
65 | 65 | continue; |
66 | 66 | } |
67 | 67 | if ($provider instanceof PagedProvider) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function removeProvider($provider) { |
97 | 97 | $this->registeredProviders = array_filter( |
98 | 98 | $this->registeredProviders, |
99 | - function ($element) use ($provider) { |
|
99 | + function($element) use ($provider) { |
|
100 | 100 | return ($element['class'] != $provider); |
101 | 101 | } |
102 | 102 | ); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * Create instances of all the registered search providers |
118 | 118 | */ |
119 | 119 | private function initProviders() { |
120 | - if( ! empty($this->providers) ) { |
|
120 | + if (!empty($this->providers)) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | - foreach($this->registeredProviders as $provider) { |
|
123 | + foreach ($this->registeredProviders as $provider) { |
|
124 | 124 | $class = $provider['class']; |
125 | 125 | $options = $provider['options']; |
126 | 126 | $this->providers[] = new $class($options); |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @link https://github.com/owncloud/core/issues/21955 |
133 | 133 | */ |
134 | - if($this->config->getSystemValue('installed', false)) { |
|
135 | - $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
136 | - if(!is_null($userId)) { |
|
134 | + if ($this->config->getSystemValue('installed', false)) { |
|
135 | + $userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null; |
|
136 | + if (!is_null($userId)) { |
|
137 | 137 | $userLang = $this->config->getUserValue($userId, 'core', 'lang', null); |
138 | 138 | } else { |
139 | 139 | $userLang = null; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // merge with translations from theme |
203 | 203 | $theme = $this->config->getSystemValue('theme'); |
204 | 204 | if (!empty($theme)) { |
205 | - $themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot)); |
|
205 | + $themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot)); |
|
206 | 206 | |
207 | 207 | if (is_dir($themeDir)) { |
208 | 208 | $files = scandir($themeDir); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | private function isSubDirectory($sub, $parent) { |
299 | 299 | // Check whether $sub contains no ".." |
300 | - if(strpos($sub, '..') !== false) { |
|
300 | + if (strpos($sub, '..') !== false) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | $languageFiles = []; |
323 | 323 | |
324 | 324 | $i18nDir = $this->findL10nDir($app); |
325 | - $transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json'; |
|
325 | + $transFile = strip_tags($i18nDir).strip_tags($lang).'.json'; |
|
326 | 326 | |
327 | - if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/') |
|
328 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/') |
|
329 | - || $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/') |
|
330 | - || $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/') |
|
327 | + if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/') |
|
328 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/') |
|
329 | + || $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/') |
|
330 | + || $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/') |
|
331 | 331 | ) |
332 | 332 | && file_exists($transFile)) { |
333 | 333 | // load the translations file |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | // merge with translations from theme |
338 | 338 | $theme = $this->config->getSystemValue('theme'); |
339 | 339 | if (!empty($theme)) { |
340 | - $transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot)); |
|
340 | + $transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot)); |
|
341 | 341 | if (file_exists($transFile)) { |
342 | 342 | $languageFiles[] = $transFile; |
343 | 343 | } |
@@ -354,14 +354,14 @@ discard block |
||
354 | 354 | */ |
355 | 355 | protected function findL10nDir($app = null) { |
356 | 356 | if (in_array($app, ['core', 'lib', 'settings'])) { |
357 | - if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { |
|
358 | - return $this->serverRoot . '/' . $app . '/l10n/'; |
|
357 | + if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) { |
|
358 | + return $this->serverRoot.'/'.$app.'/l10n/'; |
|
359 | 359 | } |
360 | 360 | } else if ($app && \OC_App::getAppPath($app) !== false) { |
361 | 361 | // Check if the app is in the app folder |
362 | - return \OC_App::getAppPath($app) . '/l10n/'; |
|
362 | + return \OC_App::getAppPath($app).'/l10n/'; |
|
363 | 363 | } |
364 | - return $this->serverRoot . '/core/l10n/'; |
|
364 | + return $this->serverRoot.'/core/l10n/'; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -378,15 +378,15 @@ discard block |
||
378 | 378 | return $this->pluralFunctions[$string]; |
379 | 379 | } |
380 | 380 | |
381 | - if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
381 | + if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) { |
|
382 | 382 | // sanitize |
383 | - $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] ); |
|
384 | - $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] ); |
|
383 | + $nplurals = preg_replace('/[^0-9]/', '', $matches[1]); |
|
384 | + $plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]); |
|
385 | 385 | |
386 | 386 | $body = str_replace( |
387 | - array( 'plural', 'n', '$n$plurals', ), |
|
388 | - array( '$plural', '$n', '$nplurals', ), |
|
389 | - 'nplurals='. $nplurals . '; plural=' . $plural |
|
387 | + array('plural', 'n', '$n$plurals',), |
|
388 | + array('$plural', '$n', '$nplurals',), |
|
389 | + 'nplurals='.$nplurals.'; plural='.$plural |
|
390 | 390 | ); |
391 | 391 | |
392 | 392 | // add parents |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | $body .= ';'; |
395 | 395 | $res = ''; |
396 | 396 | $p = 0; |
397 | - for($i = 0; $i < strlen($body); $i++) { |
|
397 | + for ($i = 0; $i < strlen($body); $i++) { |
|
398 | 398 | $ch = $body[$i]; |
399 | - switch ( $ch ) { |
|
399 | + switch ($ch) { |
|
400 | 400 | case '?': |
401 | 401 | $res .= ' ? ('; |
402 | 402 | $p++; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $res .= ') : ('; |
406 | 406 | break; |
407 | 407 | case ';': |
408 | - $res .= str_repeat( ')', $p ) . ';'; |
|
408 | + $res .= str_repeat(')', $p).';'; |
|
409 | 409 | $p = 0; |
410 | 410 | break; |
411 | 411 | default: |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
416 | - $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
416 | + $body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);'; |
|
417 | 417 | $function = create_function('$n', $body); |
418 | 418 | $this->pluralFunctions[$string] = $function; |
419 | 419 | return $function; |
@@ -54,8 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | public function getBody() { |
56 | 56 | return $this->stream ? |
57 | - $this->response->getBody()->detach(): |
|
58 | - $this->response->getBody()->getContents(); |
|
57 | + $this->response->getBody()->detach() : $this->response->getBody()->getContents(); |
|
59 | 58 | } |
60 | 59 | |
61 | 60 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($this->config->getSystemValue('installed', false)) { |
74 | 74 | $this->client->setDefaultOption('verify', $this->certificateManager->getAbsoluteBundlePath(null)); |
75 | 75 | } else { |
76 | - $this->client->setDefaultOption('verify', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'); |
|
76 | + $this->client->setDefaultOption('verify', \OC::$SERVERROOT.'/resources/config/ca-bundle.crt'); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $proxyUri = ''; |
96 | 96 | |
97 | 97 | if ($proxyUserPwd !== null) { |
98 | - $proxyUri .= $proxyUserPwd . '@'; |
|
98 | + $proxyUri .= $proxyUserPwd.'@'; |
|
99 | 99 | } |
100 | 100 | if ($proxyHost !== null) { |
101 | 101 | $proxyUri .= $proxyHost; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | // FIXME: Required for CI |
82 | 82 | if (!defined('PHPUNIT_RUN')) { |
83 | 83 | $webRoot = \OC::$WEBROOT; |
84 | - if($webRoot === '') { |
|
84 | + if ($webRoot === '') { |
|
85 | 85 | $webRoot = '/'; |
86 | 86 | } |
87 | 87 | setcookie(self::COOKIE_NAME, $this->passphrase, 0, $webRoot, '', $secureCookie, true); |
@@ -146,7 +146,7 @@ |
||
146 | 146 | throw new \InvalidArgumentException('The given notifier information is invalid'); |
147 | 147 | } |
148 | 148 | if (isset($this->notifiersInfo[$notifier['id']])) { |
149 | - throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use'); |
|
149 | + throw new \InvalidArgumentException('The given notifier ID '.$notifier['id'].' is already in use'); |
|
150 | 150 | } |
151 | 151 | $this->notifiersInfo[$notifier['id']] = $notifier['name']; |
152 | 152 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @return bool |
49 | 49 | */ |
50 | 50 | public function accept() { |
51 | - if($this->isDir()) { |
|
51 | + if ($this->isDir()) { |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 |
@@ -30,25 +30,25 @@ |
||
30 | 30 | parent::__construct($iterator); |
31 | 31 | |
32 | 32 | $appFolders = \OC::$APPSROOTS; |
33 | - foreach($appFolders as $key => $appFolder) { |
|
33 | + foreach ($appFolders as $key => $appFolder) { |
|
34 | 34 | $appFolders[$key] = rtrim($appFolder['path'], '/'); |
35 | 35 | } |
36 | 36 | |
37 | 37 | $excludedFolders = [ |
38 | - rtrim($root . '/data', '/'), |
|
39 | - rtrim($root . '/themes', '/'), |
|
40 | - rtrim($root . '/config', '/'), |
|
41 | - rtrim($root . '/apps', '/'), |
|
42 | - rtrim($root . '/assets', '/'), |
|
43 | - rtrim($root . '/lost+found', '/'), |
|
38 | + rtrim($root.'/data', '/'), |
|
39 | + rtrim($root.'/themes', '/'), |
|
40 | + rtrim($root.'/config', '/'), |
|
41 | + rtrim($root.'/apps', '/'), |
|
42 | + rtrim($root.'/assets', '/'), |
|
43 | + rtrim($root.'/lost+found', '/'), |
|
44 | 44 | // Ignore folders generated by updater since the updater is replaced |
45 | 45 | // after the integrity check is run. |
46 | 46 | // See https://github.com/owncloud/updater/issues/318#issuecomment-212497846 |
47 | - rtrim($root . '/updater', '/'), |
|
48 | - rtrim($root . '/_oc_upgrade', '/'), |
|
47 | + rtrim($root.'/updater', '/'), |
|
48 | + rtrim($root.'/_oc_upgrade', '/'), |
|
49 | 49 | ]; |
50 | 50 | $customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', ''); |
51 | - if($customDataDir !== '') { |
|
51 | + if ($customDataDir !== '') { |
|
52 | 52 | $excludedFolders[] = rtrim($customDataDir, '/'); |
53 | 53 | } |
54 | 54 |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function file_put_contents($filename, $data) { |
61 | 61 | $bytesWritten = @file_put_contents($filename, $data); |
62 | - if ($bytesWritten === false || $bytesWritten !== strlen($data)){ |
|
63 | - throw new \Exception('Failed to write into ' . $filename); |
|
62 | + if ($bytesWritten === false || $bytesWritten !== strlen($data)) { |
|
63 | + throw new \Exception('Failed to write into '.$filename); |
|
64 | 64 | } |
65 | 65 | return $bytesWritten; |
66 | 66 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function assertDirectoryExists($path) { |
81 | 81 | if (!is_dir($path)) { |
82 | - throw new \Exception('Directory ' . $path . ' does not exist.'); |
|
82 | + throw new \Exception('Directory '.$path.' does not exist.'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |