@@ -55,7 +55,7 @@ |
||
55 | 55 | if ($command instanceof ICommand) { |
56 | 56 | // ensure the command can be serialized |
57 | 57 | $serialized = serialize($command); |
58 | - if(strlen($serialized) > 4000) { |
|
58 | + if (strlen($serialized) > 4000) { |
|
59 | 59 | throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)'); |
60 | 60 | } |
61 | 61 | $unserialized = unserialize($serialized); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | use OCP\IUser; |
26 | 26 | |
27 | 27 | trait FileAccess { |
28 | - protected function setupFS(IUser $user){ |
|
28 | + protected function setupFS(IUser $user) { |
|
29 | 29 | \OC_Util::setupFS($user->getUID()); |
30 | 30 | } |
31 | 31 |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | ) { |
60 | 60 | return; |
61 | 61 | } |
62 | - $style = substr($style, strpos($style, '/')+1); |
|
62 | + $style = substr($style, strpos($style, '/') + 1); |
|
63 | 63 | $app_path = \OC_App::getAppPath($app); |
64 | 64 | $app_url = \OC_App::getAppWebPath($app); |
65 | - if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) { |
|
65 | + if (!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) { |
|
66 | 66 | $this->append($app_path, $style.'.css', $app_url); |
67 | 67 | } |
68 | 68 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function cacheAndAppendScssIfExist($root, $file, $app = 'core') { |
88 | 88 | if (is_file($root.'/'.$file)) { |
89 | - if($this->scssCacher !== null) { |
|
90 | - if($this->scssCacher->process($root, $file, $app)) { |
|
89 | + if ($this->scssCacher !== null) { |
|
90 | + if ($this->scssCacher->process($root, $file, $app)) { |
|
91 | 91 | $this->append($root, $this->scssCacher->getCachedSCSS($app, $file), false); |
92 | 92 | return true; |
93 | 93 | } else { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
109 | 109 | } |
110 | 110 | |
111 | - foreach($apps as $app) { |
|
111 | + foreach ($apps as $app) { |
|
112 | 112 | $apps_paths[$app] = \OC_App::getAppWebPath($app); |
113 | 113 | } |
114 | 114 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
122 | 122 | |
123 | 123 | $countOfDataLocation = 0; |
124 | - $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
125 | - if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
124 | + $dataLocation = str_replace(\OC::$SERVERROOT.'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
125 | + if ($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
126 | 126 | $dataLocation = false; |
127 | 127 | } |
128 | 128 | |
@@ -144,61 +144,61 @@ discard block |
||
144 | 144 | "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
145 | 145 | 'nc_lastLogin' => $lastConfirmTimestamp, |
146 | 146 | "dayNames" => json_encode([ |
147 | - (string)$this->l->t('Sunday'), |
|
148 | - (string)$this->l->t('Monday'), |
|
149 | - (string)$this->l->t('Tuesday'), |
|
150 | - (string)$this->l->t('Wednesday'), |
|
151 | - (string)$this->l->t('Thursday'), |
|
152 | - (string)$this->l->t('Friday'), |
|
153 | - (string)$this->l->t('Saturday') |
|
147 | + (string) $this->l->t('Sunday'), |
|
148 | + (string) $this->l->t('Monday'), |
|
149 | + (string) $this->l->t('Tuesday'), |
|
150 | + (string) $this->l->t('Wednesday'), |
|
151 | + (string) $this->l->t('Thursday'), |
|
152 | + (string) $this->l->t('Friday'), |
|
153 | + (string) $this->l->t('Saturday') |
|
154 | 154 | ]), |
155 | 155 | "dayNamesShort" => json_encode([ |
156 | - (string)$this->l->t('Sun.'), |
|
157 | - (string)$this->l->t('Mon.'), |
|
158 | - (string)$this->l->t('Tue.'), |
|
159 | - (string)$this->l->t('Wed.'), |
|
160 | - (string)$this->l->t('Thu.'), |
|
161 | - (string)$this->l->t('Fri.'), |
|
162 | - (string)$this->l->t('Sat.') |
|
156 | + (string) $this->l->t('Sun.'), |
|
157 | + (string) $this->l->t('Mon.'), |
|
158 | + (string) $this->l->t('Tue.'), |
|
159 | + (string) $this->l->t('Wed.'), |
|
160 | + (string) $this->l->t('Thu.'), |
|
161 | + (string) $this->l->t('Fri.'), |
|
162 | + (string) $this->l->t('Sat.') |
|
163 | 163 | ]), |
164 | 164 | "dayNamesMin" => json_encode([ |
165 | - (string)$this->l->t('Su'), |
|
166 | - (string)$this->l->t('Mo'), |
|
167 | - (string)$this->l->t('Tu'), |
|
168 | - (string)$this->l->t('We'), |
|
169 | - (string)$this->l->t('Th'), |
|
170 | - (string)$this->l->t('Fr'), |
|
171 | - (string)$this->l->t('Sa') |
|
165 | + (string) $this->l->t('Su'), |
|
166 | + (string) $this->l->t('Mo'), |
|
167 | + (string) $this->l->t('Tu'), |
|
168 | + (string) $this->l->t('We'), |
|
169 | + (string) $this->l->t('Th'), |
|
170 | + (string) $this->l->t('Fr'), |
|
171 | + (string) $this->l->t('Sa') |
|
172 | 172 | ]), |
173 | 173 | "monthNames" => json_encode([ |
174 | - (string)$this->l->t('January'), |
|
175 | - (string)$this->l->t('February'), |
|
176 | - (string)$this->l->t('March'), |
|
177 | - (string)$this->l->t('April'), |
|
178 | - (string)$this->l->t('May'), |
|
179 | - (string)$this->l->t('June'), |
|
180 | - (string)$this->l->t('July'), |
|
181 | - (string)$this->l->t('August'), |
|
182 | - (string)$this->l->t('September'), |
|
183 | - (string)$this->l->t('October'), |
|
184 | - (string)$this->l->t('November'), |
|
185 | - (string)$this->l->t('December') |
|
174 | + (string) $this->l->t('January'), |
|
175 | + (string) $this->l->t('February'), |
|
176 | + (string) $this->l->t('March'), |
|
177 | + (string) $this->l->t('April'), |
|
178 | + (string) $this->l->t('May'), |
|
179 | + (string) $this->l->t('June'), |
|
180 | + (string) $this->l->t('July'), |
|
181 | + (string) $this->l->t('August'), |
|
182 | + (string) $this->l->t('September'), |
|
183 | + (string) $this->l->t('October'), |
|
184 | + (string) $this->l->t('November'), |
|
185 | + (string) $this->l->t('December') |
|
186 | 186 | ]), |
187 | 187 | "monthNamesShort" => json_encode([ |
188 | - (string)$this->l->t('Jan.'), |
|
189 | - (string)$this->l->t('Feb.'), |
|
190 | - (string)$this->l->t('Mar.'), |
|
191 | - (string)$this->l->t('Apr.'), |
|
192 | - (string)$this->l->t('May.'), |
|
193 | - (string)$this->l->t('Jun.'), |
|
194 | - (string)$this->l->t('Jul.'), |
|
195 | - (string)$this->l->t('Aug.'), |
|
196 | - (string)$this->l->t('Sep.'), |
|
197 | - (string)$this->l->t('Oct.'), |
|
198 | - (string)$this->l->t('Nov.'), |
|
199 | - (string)$this->l->t('Dec.') |
|
188 | + (string) $this->l->t('Jan.'), |
|
189 | + (string) $this->l->t('Feb.'), |
|
190 | + (string) $this->l->t('Mar.'), |
|
191 | + (string) $this->l->t('Apr.'), |
|
192 | + (string) $this->l->t('May.'), |
|
193 | + (string) $this->l->t('Jun.'), |
|
194 | + (string) $this->l->t('Jul.'), |
|
195 | + (string) $this->l->t('Aug.'), |
|
196 | + (string) $this->l->t('Sep.'), |
|
197 | + (string) $this->l->t('Oct.'), |
|
198 | + (string) $this->l->t('Nov.'), |
|
199 | + (string) $this->l->t('Dec.') |
|
200 | 200 | ]), |
201 | - "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
201 | + "firstDay" => json_encode($this->l->l('firstday', null)), |
|
202 | 202 | "oc_config" => json_encode([ |
203 | 203 | 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
204 | 204 | 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | if ($this->currentUser !== null) { |
241 | 241 | $array['oc_userconfig'] = json_encode([ |
242 | 242 | 'avatar' => [ |
243 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
243 | + 'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
244 | 244 | ] |
245 | 245 | ]); |
246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | // Echo it |
254 | 254 | foreach ($array as $setting => $value) { |
255 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
255 | + $result .= 'var '.$setting.'='.$value.';'.PHP_EOL; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $result; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param \OCP\IL10N $l10n |
45 | 45 | * @param \OC_Defaults $theme |
46 | 46 | */ |
47 | - public function __construct($template, $requestToken, $l10n, $theme ) { |
|
47 | + public function __construct($template, $requestToken, $l10n, $theme) { |
|
48 | 48 | $this->vars = array(); |
49 | 49 | $this->vars['requesttoken'] = $requestToken; |
50 | 50 | $this->l10n = $l10n; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getAppTemplateDirs($theme, $app, $serverRoot, $app_dir) { |
63 | 63 | // Check if the app is in the app folder or in the root |
64 | - if( file_exists($app_dir.'/templates/' )) { |
|
64 | + if (file_exists($app_dir.'/templates/')) { |
|
65 | 65 | return [ |
66 | 66 | $serverRoot.'/themes/'.$theme.'/apps/'.$app.'/templates/', |
67 | 67 | $app_dir.'/templates/', |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * If the key existed before, it will be overwritten |
98 | 98 | */ |
99 | - public function assign( $key, $value) { |
|
99 | + public function assign($key, $value) { |
|
100 | 100 | $this->vars[$key] = $value; |
101 | 101 | return true; |
102 | 102 | } |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * exists, the value will be appended. It can be accessed via |
112 | 112 | * $_[$key][$position] in the template. |
113 | 113 | */ |
114 | - public function append( $key, $value ) { |
|
115 | - if( array_key_exists( $key, $this->vars )) { |
|
114 | + public function append($key, $value) { |
|
115 | + if (array_key_exists($key, $this->vars)) { |
|
116 | 116 | $this->vars[$key][] = $value; |
117 | 117 | } |
118 | - else{ |
|
119 | - $this->vars[$key] = array( $value ); |
|
118 | + else { |
|
119 | + $this->vars[$key] = array($value); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function printPage() { |
130 | 130 | $data = $this->fetchPage(); |
131 | - if( $data === false ) { |
|
131 | + if ($data === false) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | - else{ |
|
134 | + else { |
|
135 | 135 | print $data; |
136 | 136 | return true; |
137 | 137 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | $l = $this->l10n; |
165 | 165 | $theme = $this->theme; |
166 | 166 | |
167 | - if( !is_null($additionalParams)) { |
|
168 | - $_ = array_merge( $additionalParams, $this->vars ); |
|
167 | + if (!is_null($additionalParams)) { |
|
168 | + $_ = array_merge($additionalParams, $this->vars); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // Include |
@@ -41,6 +41,6 @@ |
||
41 | 41 | * @return string |
42 | 42 | */ |
43 | 43 | public function getResourcePath() { |
44 | - return $this->webPath . '/' . $this->resource; |
|
44 | + return $this->webPath.'/'.$this->resource; |
|
45 | 45 | } |
46 | 46 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->doFind($resource); |
76 | 76 | } catch (ResourceNotFoundException $e) { |
77 | 77 | $resourceApp = substr($resource, 0, strpos($resource, '/')); |
78 | - $this->logger->debug('Could not find resource file "' . $e->getResourcePath() . '"', ['app' => $resourceApp]); |
|
78 | + $this->logger->debug('Could not find resource file "'.$e->getResourcePath().'"', ['app' => $resourceApp]); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | if (!empty($this->theme)) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->doFindTheme($resource); |
85 | 85 | } catch (ResourceNotFoundException $e) { |
86 | 86 | $resourceApp = substr($resource, 0, strpos($resource, '/')); |
87 | - $this->logger->debug('Could not find resource file "' . $e->getResourcePath() . '"', ['app' => $resourceApp]); |
|
87 | + $this->logger->debug('Could not find resource file "'.$e->getResourcePath().'"', ['app' => $resourceApp]); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | $this->resources[] = array($root, $webRoot, $file); |
123 | 123 | |
124 | - if ($throw && !is_file($root . '/' . $file)) { |
|
124 | + if ($throw && !is_file($root.'/'.$file)) { |
|
125 | 125 | throw new ResourceNotFoundException($file, $webRoot); |
126 | 126 | } |
127 | 127 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @param string[] $dirs |
34 | 34 | */ |
35 | - public function __construct( $dirs ) { |
|
35 | + public function __construct($dirs) { |
|
36 | 36 | $this->dirs = $dirs; |
37 | 37 | } |
38 | 38 | |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | * @return string |
42 | 42 | * @throws \Exception |
43 | 43 | */ |
44 | - public function find( $template ) { |
|
44 | + public function find($template) { |
|
45 | 45 | if ($template === '') { |
46 | 46 | throw new \InvalidArgumentException('Empty template name'); |
47 | 47 | } |
48 | 48 | |
49 | - foreach($this->dirs as $dir) { |
|
49 | + foreach ($this->dirs as $dir) { |
|
50 | 50 | $file = $dir.$template.'.php'; |
51 | 51 | if (is_file($file)) { |
52 | 52 | $this->path = $dir; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return boolean |
68 | 68 | */ |
69 | 69 | public function process($root, $file, $app) { |
70 | - $path = explode('/', $root . '/' . $file); |
|
70 | + $path = explode('/', $root.'/'.$file); |
|
71 | 71 | |
72 | 72 | $fileNameSCSS = array_pop($path); |
73 | 73 | $fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | |
81 | 81 | try { |
82 | 82 | $folder = $this->appData->getFolder($app); |
83 | - } catch(NotFoundException $e) { |
|
83 | + } catch (NotFoundException $e) { |
|
84 | 84 | // creating css appdata folder |
85 | 85 | $folder = $this->appData->newFolder($app); |
86 | 86 | } |
87 | 87 | |
88 | - if($this->isCached($fileNameCSS, $fileNameSCSS, $folder, $path)) { |
|
88 | + if ($this->isCached($fileNameCSS, $fileNameSCSS, $folder, $path)) { |
|
89 | 89 | return true; |
90 | 90 | } else { |
91 | 91 | return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @return boolean |
102 | 102 | */ |
103 | 103 | private function isCached($fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $path) { |
104 | - try{ |
|
104 | + try { |
|
105 | 105 | $cachedFile = $folder->getFile($fileNameCSS); |
106 | - if( $cachedFile->getMTime() > filemtime($path.'/'.$fileNameSCSS) |
|
107 | - && $cachedFile->getSize() > 0 ) { |
|
106 | + if ($cachedFile->getMTime() > filemtime($path.'/'.$fileNameSCSS) |
|
107 | + && $cachedFile->getSize() > 0) { |
|
108 | 108 | return true; |
109 | 109 | } |
110 | - } catch(NotFoundException $e) { |
|
110 | + } catch (NotFoundException $e) { |
|
111 | 111 | return false; |
112 | 112 | } |
113 | 113 | return false; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | private function cache($path, $fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $webDir) { |
126 | 126 | $scss = new Compiler(); |
127 | 127 | $scss->setImportPaths($path); |
128 | - if($this->systemConfig->getValue('debug')) { |
|
128 | + if ($this->systemConfig->getValue('debug')) { |
|
129 | 129 | // Debug mode |
130 | 130 | $scss->setFormatter(Expanded::class); |
131 | 131 | $scss->setLineNumberStyle(Compiler::LINE_COMMENTS); |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | |
137 | 137 | try { |
138 | 138 | $cachedfile = $folder->getFile($fileNameCSS); |
139 | - } catch(NotFoundException $e) { |
|
139 | + } catch (NotFoundException $e) { |
|
140 | 140 | $cachedfile = $folder->newFile($fileNameCSS); |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Compile |
144 | 144 | try { |
145 | 145 | $compiledScss = $scss->compile('@import "'.$fileNameSCSS.'";'); |
146 | - } catch(ParserException $e) { |
|
146 | + } catch (ParserException $e) { |
|
147 | 147 | $this->logger->error($e, ['app' => 'core']); |
148 | 148 | return false; |
149 | 149 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $cachedfile->putContent($this->rebaseUrls($compiledScss, $webDir)); |
153 | 153 | $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); |
154 | 154 | return true; |
155 | - } catch(NotFoundException $e) { |
|
155 | + } catch (NotFoundException $e) { |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | private function rebaseUrls($css, $webDir) { |
167 | 167 | $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x'; |
168 | 168 | // OC\Route\Router:75 |
169 | - if(($this->systemConfig->getValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
169 | + if (($this->systemConfig->getValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
170 | 170 | $subst = 'url(\'../../'.$webDir.'/$1\')'; |
171 | 171 | } else { |
172 | 172 | $subst = 'url(\'../../../'.$webDir.'/$1\')'; |