function __construct($module_name) { $module = new ReflectionClass($this); $this->registry = Engine_Registry::getInstance(); $this->module_name = $module_name; $this->short_module_name = mb_strtolower($module_name); $this->module_path = $this->registry["path"]["modules"] . $module_name . "/"; $this->setPath(); $this->getConfig(); if (isset($this->config["path"]["tpl"])) { $loader = new Twig_Loader_Filesystem($this->module_path . $this->config["path"]["tpl"]); if ($this->registry["twig_cache"]) { $twig = array('cache' => $this->registry["cache"], 'autoescape' => FALSE); } else { $twig = array('cache' => FALSE, 'autoescape' => FALSE); } $templates = new Twig_Environment($loader, $twig); $this->registry["twig_" . $this->short_module_name] = $templates; } }
public function setConfig($config) { $this->_config = $config; $this->registry = Engine_Registry::getInstance(); $this->registry->set('siteName', "http://" . $this->_config["url"]); $this->registry->set('controller', $this->_config["path"]["root"] . $this->_config['path']['controller']); $this->registry->set('cache', $this->_config["path"]["root"] . $this->_config['path']['cache']); $this->registry->set('rootPublic', $this->_config["path"]["root"] . "/"); $this->registry->set('rootDir', substr($this->_config["path"]["root"], 0, strpos($this->_config["path"]["root"], "public"))); $action = empty($_GET['main']) ? '' : $_GET['main']; if (empty($action)) { $action = ''; } $this->_config["url"] = "/" . $action; if (!empty($action)) { $this->_config["uri"] = substr($this->_config["uri"], 0, strrpos($this->_config["uri"], $action)); } $this->_config["uripath"] = substr($this->registry["uri"], 0, strlen($this->registry["uri"]) - 1) . $this->registry["url"]; foreach ($this->_config as $key => $val) { $this->registry->set($key, $val); } }
function __construct() { $this->registry = Engine_Registry::getInstance(); }