diff options
Diffstat (limited to 'lib/private/legacy/OC_Template.php')
-rw-r--r-- | lib/private/legacy/OC_Template.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php index 279ceb8de0f..08f23b55a0f 100644 --- a/lib/private/legacy/OC_Template.php +++ b/lib/private/legacy/OC_Template.php @@ -72,7 +72,7 @@ class OC_Template extends \OC\Template\Base { * "admin". * @param bool $registerCall = true */ - public function __construct( $app, $name, $renderAs = "", $registerCall = true ) { + public function __construct($app, $name, $renderAs = "", $registerCall = true) { // Read the selected theme from the config file self::initTemplateEngine($renderAs); @@ -104,16 +104,16 @@ class OC_Template extends \OC\Template\Base { //apps that started before the template initialization can load their own scripts/styles //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true //meaning the last script/style in this list will be loaded first - if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { - if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') { - OC_Util::addScript ( 'backgroundjobs', null, true ); + if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) { + if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') { + OC_Util::addScript('backgroundjobs', null, true); } } OC_Util::addStyle('css-variables', null, true); OC_Util::addStyle('server', null, true); OC_Util::addTranslations('core', null, true); - if (\OC::$server->getSystemConfig()->getValue ('installed', false)) { + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { OC_Util::addStyle('search', 'results'); OC_Util::addScript('search', 'search', true); OC_Util::addScript('search', 'searchprovider'); @@ -146,12 +146,12 @@ class OC_Template extends \OC\Template\Base { */ protected function findTemplate($theme, $app, $name) { // Check if it is a app template or not. - if( $app !== '' ) { + if($app !== '') { $dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app)); } else { $dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT); } - $locator = new \OC\Template\TemplateFileLocator( $dirs ); + $locator = new \OC\Template\TemplateFileLocator($dirs); $template = $locator->find($name); $path = $locator->getPath(); return [$path, $template]; @@ -182,7 +182,7 @@ class OC_Template extends \OC\Template\Base { public function fetchPage($additionalParams = null) { $data = parent::fetchPage($additionalParams); - if( $this->renderAs ) { + if($this->renderAs) { $page = new TemplateLayout($this->renderAs, $this->app); if(is_array($additionalParams)) { @@ -195,7 +195,7 @@ class OC_Template extends \OC\Template\Base { $headers = ''; foreach(OC_Util::$headers as $header) { $headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']); - if ( strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes']))) ) { + if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) { $headers .= ' defer'; } foreach($header['attributes'] as $name=>$value) { @@ -227,7 +227,7 @@ class OC_Template extends \OC\Template\Base { * Includes another template. use <?php echo $this->inc('template'); ?> to * do this. */ - public function inc( $file, $additionalParams = null ) { + public function inc($file, $additionalParams = null) { return $this->load($this->path.$file.'.php', $additionalParams); } @@ -238,10 +238,10 @@ class OC_Template extends \OC\Template\Base { * @param array $parameters Parameters for the template * @return boolean|null */ - public static function printUserPage( $application, $name, $parameters = [] ) { - $content = new OC_Template( $application, $name, "user" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + public static function printUserPage($application, $name, $parameters = []) { + $content = new OC_Template($application, $name, "user"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } print $content->printPage(); } @@ -253,10 +253,10 @@ class OC_Template extends \OC\Template\Base { * @param array $parameters Parameters for the template * @return bool */ - public static function printAdminPage( $application, $name, $parameters = [] ) { - $content = new OC_Template( $application, $name, "admin" ); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + public static function printAdminPage($application, $name, $parameters = []) { + $content = new OC_Template($application, $name, "admin"); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -268,10 +268,10 @@ class OC_Template extends \OC\Template\Base { * @param array|string $parameters Parameters for the template * @return bool */ - public static function printGuestPage( $application, $name, $parameters = [] ) { + public static function printGuestPage($application, $name, $parameters = []) { $content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest'); - foreach( $parameters as $key => $value ) { - $content->assign( $key, $value ); + foreach($parameters as $key => $value) { + $content->assign($key, $value); } return $content->printPage(); } @@ -283,7 +283,7 @@ class OC_Template extends \OC\Template\Base { * @param int $statusCode * @suppress PhanAccessMethodInternal */ - public static function printErrorPage( $error_msg, $hint = '', $statusCode = 500) { + public static function printErrorPage($error_msg, $hint = '', $statusCode = 500) { if (\OC::$server->getAppManager()->isEnabledForUser('theming') && !\OC_App::isAppLoaded('theming')) { \OC_App::loadApp('theming'); } @@ -296,9 +296,9 @@ class OC_Template extends \OC\Template\Base { http_response_code($statusCode); try { - $content = new \OC_Template( '', 'error', 'error', false ); + $content = new \OC_Template('', 'error', 'error', false); $errors = [['error' => $error_msg, 'hint' => $hint]]; - $content->assign( 'errors', $errors ); + $content->assign('errors', $errors); $content->printPage(); } catch (\Exception $e) { $logger = \OC::$server->getLogger(); |