protected function setDefaultAssign() { $this->showSetMessages(); if (!$this->app->configIsEmpty('localTest')) { $this->app->getTemplateEngine()->assign(array('localTest' => $this->app->config('localTest'))); } $this->app->getTemplateEngine()->assign(array('isLogin' => false, 'baseUrl' => $this->app->config('baseUrl'), 'themeUrl' => $this->app->getTheme()->getPublicBaseUrl(), 'xmlLang' => $this->app->getXmlLang(), 'language' => $this->app->getLanguage(), 'clientConfig' => $this->app->clientConfig(), 'isAjax' => $this->app->isAjax(), 'params' => $this->params, '_path' => array('route' => $this->getControllerPath(), 'action' => $this->getCurrentAction()))); $this->setAdditionalAssign(); }
/** * @param string $basePath Application's base path ending with DIRECTORY_SEPARATOR * @param string $theme * @param \Skully\Application $app * @param array $additionalPluginsDir * @param int $caching */ public function __construct($basePath, $theme = 'default', $app = null, $additionalPluginsDir = array(), $caching = 1) { $appName = $app->getAppName(); $this->app = $app; $this->smarty = new \Smarty(); $this->smarty->caching = $caching; $this->caching = $caching; $this->smarty->setCompileDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'templates_c')) . DIRECTORY_SEPARATOR); $this->smarty->setConfigDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'configs')) . DIRECTORY_SEPARATOR); $this->smarty->setCacheDir($basePath . implode(DIRECTORY_SEPARATOR, array($appName, 'smarty', 'cache'))); $dirs = $this->app->getTheme()->getDirs(); foreach ($dirs as $key => $dir) { if ($key == 'main' || $key == 'default') { $this->addTemplateDir($dir . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR . 'views', $key); } else { $this->addTemplateDir($dir . DIRECTORY_SEPARATOR . 'views', $key); } } $plugins = array_merge($additionalPluginsDir, array($this->app->getRealpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'App' . DIRECTORY_SEPARATOR . 'smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR, $this->app->getRealpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'Library' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'libs' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR)); $this->setPluginsDir($plugins); }
/** * @return \Skully\Core\Theme\ThemeInterface * @throw \Skully\Exceptions\InvalidConfigException */ public function getTheme() { /** @var \SkullyAwsS3\S3ConfigTrait $config */ $config = $this->getConfigObject(); if ($config->isAmazonS3Enabled()) { if (empty($this->theme)) { /** @var \SkullyAwsS3\S3ApplicationTrait $this */ $this->prepareS3Theme(); } return $this->theme; } else { return parent::getTheme(); } }