public function __construct($templateFile, $smConf = array(), $filter = true) { $this->template = $templateFile; $this->smarty = new Piwik_Smarty(); if (count($smConf) == 0) { $smConf = Zend_Registry::get('config')->smarty; } foreach ($smConf as $key => $value) { $this->smarty->{$key} = $value; } $this->smarty->template_dir = $smConf->template_dir->toArray(); array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH); $this->smarty->plugins_dir = $smConf->plugins_dir->toArray(); array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath"), PIWIK_INCLUDE_PATH); $this->smarty->compile_dir = $smConf->compile_dir; Piwik_View::addPiwikPath($this->smarty->compile_dir, null, PIWIK_USER_PATH); $this->smarty->cache_dir = $smConf->cache_dir; Piwik_View::addPiwikPath($this->smarty->cache_dir, null, PIWIK_USER_PATH); $error_reporting = $smConf->error_reporting; if ($error_reporting != (string) (int) $error_reporting) { $error_reporting = self::bitwise_eval($error_reporting); } $this->smarty->error_reporting = $error_reporting; $this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION); if ($filter) { $this->smarty->load_filter('output', 'cachebuster'); $this->smarty->load_filter('output', 'ajaxcdn'); $this->smarty->load_filter('output', 'trimwhitespace'); } // global value accessible to all templates: the piwik base URL for the current request $this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName(); }
public function __construct($templateFile, $smConf = array()) { require_once "Smarty.php"; $this->template = $templateFile; $this->smarty = new Piwik_Smarty(); if (count($smConf) == 0) { $smConf = Zend_Registry::get('config')->smarty; } foreach ($smConf as $key => $value) { $this->smarty->{$key} = $value; } $this->smarty->template_dir = $smConf->template_dir->toArray(); array_walk($this->smarty->template_dir, array("Piwik_View", "addPiwikPath")); $this->smarty->plugins_dir = $smConf->plugins_dir->toArray(); array_walk($this->smarty->plugins_dir, array("Piwik_View", "addPiwikPath")); $this->smarty->compile_dir = $smConf->compile_dir; Piwik_View::addPiwikPath($this->smarty->compile_dir, null); $this->smarty->cache_dir = $smConf->cache_dir; Piwik_View::addPiwikPath($this->smarty->cache_dir, null); $this->smarty->error_reporting = $smConf->debugging; $this->smarty->error_reporting = $smConf->error_reporting; $this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION); $this->smarty->load_filter('output', 'cachebuster'); $this->smarty->load_filter('output', 'trimwhitespace'); // global value accessible to all templates: the piwik base URL for the current request $this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName(); }