@@ -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); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * the comments database scheme |
| 52 | 52 | */ |
| 53 | 53 | public function __construct(array $data = null) { |
| 54 | - if(is_array($data)) { |
|
| 54 | + if (is_array($data)) { |
|
| 55 | 55 | $this->fromArray($data); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | * @since 9.0.0 |
| 85 | 85 | */ |
| 86 | 86 | public function setId($id) { |
| 87 | - if(!is_string($id)) { |
|
| 87 | + if (!is_string($id)) { |
|
| 88 | 88 | throw new \InvalidArgumentException('String expected.'); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $id = trim($id); |
| 92 | - if($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) { |
|
| 92 | + if ($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) { |
|
| 93 | 93 | $this->data['id'] = $id; |
| 94 | 94 | return $this; |
| 95 | 95 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 9.0.0 |
| 116 | 116 | */ |
| 117 | 117 | public function setParentId($parentId) { |
| 118 | - if(!is_string($parentId)) { |
|
| 118 | + if (!is_string($parentId)) { |
|
| 119 | 119 | throw new \InvalidArgumentException('String expected.'); |
| 120 | 120 | } |
| 121 | 121 | $this->data['parentId'] = trim($parentId); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @since 9.0.0 |
| 142 | 142 | */ |
| 143 | 143 | public function setTopmostParentId($id) { |
| 144 | - if(!is_string($id)) { |
|
| 144 | + if (!is_string($id)) { |
|
| 145 | 145 | throw new \InvalidArgumentException('String expected.'); |
| 146 | 146 | } |
| 147 | 147 | $this->data['topmostParentId'] = trim($id); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @since 9.0.0 |
| 167 | 167 | */ |
| 168 | 168 | public function setChildrenCount($count) { |
| 169 | - if(!is_int($count)) { |
|
| 169 | + if (!is_int($count)) { |
|
| 170 | 170 | throw new \InvalidArgumentException('Integer expected.'); |
| 171 | 171 | } |
| 172 | 172 | $this->data['childrenCount'] = $count; |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | * @since 9.0.0 |
| 193 | 193 | */ |
| 194 | 194 | public function setMessage($message) { |
| 195 | - if(!is_string($message)) { |
|
| 195 | + if (!is_string($message)) { |
|
| 196 | 196 | throw new \InvalidArgumentException('String expected.'); |
| 197 | 197 | } |
| 198 | 198 | $message = trim($message); |
| 199 | - if(mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) { |
|
| 200 | - throw new MessageTooLongException('Comment message must not exceed ' . IComment::MAX_MESSAGE_LENGTH . ' characters'); |
|
| 199 | + if (mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) { |
|
| 200 | + throw new MessageTooLongException('Comment message must not exceed '.IComment::MAX_MESSAGE_LENGTH.' characters'); |
|
| 201 | 201 | } |
| 202 | 202 | $this->data['message'] = $message; |
| 203 | 203 | return $this; |
@@ -225,14 +225,14 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function getMentions() { |
| 227 | 227 | $ok = preg_match_all('/\B@[a-z0-9_\-@\.\']+/i', $this->getMessage(), $mentions); |
| 228 | - if(!$ok || !isset($mentions[0]) || !is_array($mentions[0])) { |
|
| 228 | + if (!$ok || !isset($mentions[0]) || !is_array($mentions[0])) { |
|
| 229 | 229 | return []; |
| 230 | 230 | } |
| 231 | 231 | $uids = array_unique($mentions[0]); |
| 232 | 232 | $result = []; |
| 233 | 233 | foreach ($uids as $uid) { |
| 234 | 234 | // exclude author, no self-mentioning |
| 235 | - if($uid === '@' . $this->getActorId()) { |
|
| 235 | + if ($uid === '@'.$this->getActorId()) { |
|
| 236 | 236 | continue; |
| 237 | 237 | } |
| 238 | 238 | $result[] = ['type' => 'user', 'id' => substr($uid, 1)]; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @since 9.0.0 |
| 259 | 259 | */ |
| 260 | 260 | public function setVerb($verb) { |
| 261 | - if(!is_string($verb) || !trim($verb)) { |
|
| 261 | + if (!is_string($verb) || !trim($verb)) { |
|
| 262 | 262 | throw new \InvalidArgumentException('Non-empty String expected.'); |
| 263 | 263 | } |
| 264 | 264 | $this->data['verb'] = trim($verb); |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | * @since 9.0.0 |
| 295 | 295 | */ |
| 296 | 296 | public function setActor($actorType, $actorId) { |
| 297 | - if( |
|
| 297 | + if ( |
|
| 298 | 298 | !is_string($actorType) || !trim($actorType) |
| 299 | - || !is_string($actorId) || !trim($actorId) |
|
| 299 | + || !is_string($actorId) || !trim($actorId) |
|
| 300 | 300 | ) { |
| 301 | 301 | throw new \InvalidArgumentException('String expected.'); |
| 302 | 302 | } |
@@ -380,9 +380,9 @@ discard block |
||
| 380 | 380 | * @since 9.0.0 |
| 381 | 381 | */ |
| 382 | 382 | public function setObject($objectType, $objectId) { |
| 383 | - if( |
|
| 383 | + if ( |
|
| 384 | 384 | !is_string($objectType) || !trim($objectType) |
| 385 | - || !is_string($objectId) || !trim($objectId) |
|
| 385 | + || !is_string($objectId) || !trim($objectId) |
|
| 386 | 386 | ) { |
| 387 | 387 | throw new \InvalidArgumentException('String expected.'); |
| 388 | 388 | } |
@@ -399,20 +399,20 @@ discard block |
||
| 399 | 399 | * @return IComment |
| 400 | 400 | */ |
| 401 | 401 | protected function fromArray($data) { |
| 402 | - foreach(array_keys($data) as $key) { |
|
| 402 | + foreach (array_keys($data) as $key) { |
|
| 403 | 403 | // translate DB keys to internal setter names |
| 404 | - $setter = 'set' . implode('', array_map('ucfirst', explode('_', $key))); |
|
| 404 | + $setter = 'set'.implode('', array_map('ucfirst', explode('_', $key))); |
|
| 405 | 405 | $setter = str_replace('Timestamp', 'DateTime', $setter); |
| 406 | 406 | |
| 407 | - if(method_exists($this, $setter)) { |
|
| 407 | + if (method_exists($this, $setter)) { |
|
| 408 | 408 | $this->$setter($data[$key]); |
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - foreach(['actor', 'object'] as $role) { |
|
| 413 | - if(isset($data[$role . '_type']) && isset($data[$role . '_id'])) { |
|
| 414 | - $setter = 'set' . ucfirst($role); |
|
| 415 | - $this->$setter($data[$role . '_type'], $data[$role . '_id']); |
|
| 412 | + foreach (['actor', 'object'] as $role) { |
|
| 413 | + if (isset($data[$role.'_type']) && isset($data[$role.'_id'])) { |
|
| 414 | + $setter = 'set'.ucfirst($role); |
|
| 415 | + $this->$setter($data[$role.'_type'], $data[$role.'_id']); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -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 | |