Example #1
0
 /**
  * Create document, view and layout
  */
 public function init()
 {
     parent::init();
     $this->document = $this->createDocument();
     $this->layout = $this->createLayout();
     $this->view = $this->createView();
     // register urlFor callback to view, layout and document
     $this->getDocument()->setCallback('urlFor', array($this, 'urlFor'));
     $this->getDocument()->setCallback('urlForDefault', array($this, 'urlForDefault'));
     $this->getLayout()->setCallback('urlFor', array($this, 'urlFor'));
     $this->getLayout()->setCallback('urlForDefault', array($this, 'urlForDefault'));
     $this->getView()->setCallback('urlFor', array($this, 'urlFor'));
     $this->getView()->setCallback('urlForDefault', array($this, 'urlForDefault'));
 }
Example #2
0
 protected function __construct()
 {
     $this->inflector = Inflector::get();
     if (!class_exists('\\Controller')) {
         throw new ControllerException("No Controller class found in " . LEAN_APP_ROOT);
     }
     $this->controller = \Controller::instance();
     $this->request = $_SERVER['REQUEST_METHOD'];
     if (isset($_SERVER['PATH_INFO'])) {
         $this->path = $_SERVER['PATH_INFO'];
     } else {
         if (isset($_GET['path'])) {
             $this->path = $_GET['path'];
         }
     }
     $this->init();
     $this->route();
     $this->controller->respond();
 }