Example #1
0
 /**
  * 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));
 }
Example #2
0
 public function initPlugins()
 {
     K_Plugins::addDirectory(APP_PATH . '/plugins');
 }