@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * "admin". |
72 | 72 | * @param bool $registerCall = true |
73 | 73 | */ |
74 | - public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { |
|
74 | + public function __construct($app, $name, $renderAs = "", $registerCall = true) { |
|
75 | 75 | // Read the selected theme from the config file |
76 | 76 | self::initTemplateEngine($renderAs); |
77 | 77 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | * @param string $renderAs |
99 | 99 | */ |
100 | 100 | public static function initTemplateEngine($renderAs) { |
101 | - if (self::$initTemplateEngineFirstRun){ |
|
101 | + if (self::$initTemplateEngineFirstRun) { |
|
102 | 102 | |
103 | 103 | //apps that started before the template initialization can load their own scripts/styles |
104 | 104 | //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true |
105 | 105 | //meaning the last script/style in this list will be loaded first |
106 | - if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { |
|
107 | - if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { |
|
108 | - OC_Util::addScript ( 'backgroundjobs', null, true ); |
|
106 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { |
|
107 | + if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { |
|
108 | + OC_Util::addScript('backgroundjobs', null, true); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function findTemplate($theme, $app, $name) { |
145 | 145 | // Check if it is a app template or not. |
146 | - if( $app !== '' ) { |
|
146 | + if ($app !== '') { |
|
147 | 147 | $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); |
148 | 148 | } else { |
149 | 149 | $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); |
150 | 150 | } |
151 | - $locator = new \OC\Template\TemplateFileLocator( $dirs ); |
|
151 | + $locator = new \OC\Template\TemplateFileLocator($dirs); |
|
152 | 152 | $template = $locator->find($name); |
153 | 153 | $path = $locator->getPath(); |
154 | 154 | return array($path, $template); |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @param string $text the text content for the element. If $text is null then the |
162 | 162 | * element will be written as empty element. So use "" to get a closing tag. |
163 | 163 | */ |
164 | - public function addHeader($tag, $attributes, $text=null) { |
|
165 | - $this->headers[]= array( |
|
164 | + public function addHeader($tag, $attributes, $text = null) { |
|
165 | + $this->headers[] = array( |
|
166 | 166 | 'tag' => $tag, |
167 | 167 | 'attributes' => $attributes, |
168 | 168 | 'text' => $text |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | public function fetchPage($additionalParams = null) { |
180 | 180 | $data = parent::fetchPage($additionalParams); |
181 | 181 | |
182 | - if( $this->renderAs ) { |
|
182 | + if ($this->renderAs) { |
|
183 | 183 | $page = new TemplateLayout($this->renderAs, $this->app); |
184 | 184 | |
185 | - if(is_array($additionalParams)) { |
|
185 | + if (is_array($additionalParams)) { |
|
186 | 186 | foreach ($additionalParams as $key => $value) { |
187 | 187 | $page->assign($key, $value); |
188 | 188 | } |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | |
191 | 191 | // Add custom headers |
192 | 192 | $headers = ''; |
193 | - foreach(OC_Util::$headers as $header) { |
|
193 | + foreach (OC_Util::$headers as $header) { |
|
194 | 194 | $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); |
195 | - if ( strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes']))) ) { |
|
195 | + if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { |
|
196 | 196 | $headers .= ' defer'; |
197 | 197 | } |
198 | - foreach($header['attributes'] as $name=>$value) { |
|
198 | + foreach ($header['attributes'] as $name=>$value) { |
|
199 | 199 | $headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"'; |
200 | 200 | } |
201 | 201 | if ($header['text'] !== null) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * Includes another template. use <?php echo $this->inc('template'); ?> to |
225 | 225 | * do this. |
226 | 226 | */ |
227 | - public function inc( $file, $additionalParams = null ) { |
|
227 | + public function inc($file, $additionalParams = null) { |
|
228 | 228 | return $this->load($this->path.$file.'.php', $additionalParams); |
229 | 229 | } |
230 | 230 | |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | * @param array $parameters Parameters for the template |
236 | 236 | * @return boolean|null |
237 | 237 | */ |
238 | - public static function printUserPage( $application, $name, $parameters = array() ) { |
|
239 | - $content = new OC_Template( $application, $name, "user" ); |
|
240 | - foreach( $parameters as $key => $value ) { |
|
241 | - $content->assign( $key, $value ); |
|
238 | + public static function printUserPage($application, $name, $parameters = array()) { |
|
239 | + $content = new OC_Template($application, $name, "user"); |
|
240 | + foreach ($parameters as $key => $value) { |
|
241 | + $content->assign($key, $value); |
|
242 | 242 | } |
243 | 243 | print $content->printPage(); |
244 | 244 | } |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * @param array $parameters Parameters for the template |
251 | 251 | * @return bool |
252 | 252 | */ |
253 | - public static function printAdminPage( $application, $name, $parameters = array() ) { |
|
254 | - $content = new OC_Template( $application, $name, "admin" ); |
|
255 | - foreach( $parameters as $key => $value ) { |
|
256 | - $content->assign( $key, $value ); |
|
253 | + public static function printAdminPage($application, $name, $parameters = array()) { |
|
254 | + $content = new OC_Template($application, $name, "admin"); |
|
255 | + foreach ($parameters as $key => $value) { |
|
256 | + $content->assign($key, $value); |
|
257 | 257 | } |
258 | 258 | return $content->printPage(); |
259 | 259 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * @param array|string $parameters Parameters for the template |
266 | 266 | * @return bool |
267 | 267 | */ |
268 | - public static function printGuestPage( $application, $name, $parameters = array() ) { |
|
269 | - $content = new OC_Template( $application, $name, "guest" ); |
|
270 | - foreach( $parameters as $key => $value ) { |
|
271 | - $content->assign( $key, $value ); |
|
268 | + public static function printGuestPage($application, $name, $parameters = array()) { |
|
269 | + $content = new OC_Template($application, $name, "guest"); |
|
270 | + foreach ($parameters as $key => $value) { |
|
271 | + $content->assign($key, $value); |
|
272 | 272 | } |
273 | 273 | return $content->printPage(); |
274 | 274 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param int $statusCode |
281 | 281 | * @suppress PhanAccessMethodInternal |
282 | 282 | */ |
283 | - public static function printErrorPage( $error_msg, $hint = '', $statusCode = 500) { |
|
283 | + public static function printErrorPage($error_msg, $hint = '', $statusCode = 500) { |
|
284 | 284 | if (\OC::$server->getAppManager()->isEnabledForUser('theming') && !\OC_App::isAppLoaded('theming')) { |
285 | 285 | \OC_App::loadApp('theming'); |
286 | 286 | } |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | |
294 | 294 | http_response_code($statusCode); |
295 | 295 | try { |
296 | - $content = new \OC_Template( '', 'error', 'error', false ); |
|
296 | + $content = new \OC_Template('', 'error', 'error', false); |
|
297 | 297 | $errors = array(array('error' => $error_msg, 'hint' => $hint)); |
298 | - $content->assign( 'errors', $errors ); |
|
298 | + $content->assign('errors', $errors); |
|
299 | 299 | $content->printPage(); |
300 | 300 | } catch (\Exception $e) { |
301 | 301 | $logger = \OC::$server->getLogger(); |