/** * Class construct */ public function __construct($_options) { self::$instance = $this; $this->name = __CLASS__; $this->options($_options); if (isset($this->_options['disableLayout'])) { $this->disableLayout = $this->_options['disableLayout']; } if (isset($this->_options['layout'])) { $this->layout = $this->_options['layout']; } $this->view = new K_View($this->_options); $this->view->controller =& $this; K_Plugins::callHook('controller.viewCreate', array('controller' => &$this, 'view' => &$this->view)); if (!isset($this->_options['module'])) { $this->_options['module'] = 'default'; } $this->MODULE_PATH = APP_PATH . '/' . $this->_options['module']; $this->MODULE_TEMPLATES_PATH = APP_PATH . '/' . $this->_options['module'] . '/templates'; K_ViewHelper::get()->addDirectory(APP_PATH . '/' . $this->_options['module'] . '/helpers'); K_ViewHelper::get()->addDirectory(APP_PATH . '/helpers'); if (is_dir(APP_PATH . '/' . $this->_options['module'] . '/plugins')) { K_Plugins::addDirectory(APP_PATH . '/' . $this->_options['module'] . '/plugins'); } if (count($this->plugins)) { K_Plugins::load($this->plugins); } K_Plugins::callHook('controller.beforeInit', array('controller' => &$this)); if (method_exists($this, 'onInit')) { $this->onInit(); // event } K_Plugins::callHook('controller.afterInit', array('controller' => &$this)); }
public function x_context($view) { if (is_array($this->_options['helpers']) && count($this->_options['helpers'])) { $viewHelper = K_ViewHelper::get(); foreach ($this->_options['helpers'] as $helper) { $viewHelper->loadHelper($this, $helper); } } $this->_options['view'] = $view; $this->context(); }
public function __destruct() { self::$instance = null; }