protected function getContent()
 {
     $man_ctr = \OWeb\manage\Controller::getInstance();
     //On va voir quel page on doit charger
     $get = \OWeb\OWeb::getInstance()->get_get();
     if (isset($get['page'])) {
         $ctr = $get['page'];
     } else {
         $ctr = OWEB_DEFAULT_PAGE;
     }
     try {
         $ctr = str_replace("\\\\", "\\", $ctr);
         $ctr = str_replace(".", "\\", $ctr);
         $ctr = $man_ctr->loadController('Page\\' . $ctr);
         $ctr->loadParams();
         $man_ctr->initController();
     } catch (\Exception $ex) {
         $ctr = $man_ctr->loadController('Page\\OWeb\\errors\\http\\NotFound');
     }
     ob_start();
     try {
         $ctr->display();
     } catch (\Exception $e) {
         ob_end_clean();
         ob_start();
         $ctr = $man_ctr->loadException($e);
         $ctr->addParams("exception", $e);
         $man_ctr->display();
     }
     $this->content = ob_get_contents();
     ob_end_clean();
     Events::getInstance()->sendEvent('Didplay_Prepare@OWeb\\manage\\Headers');
     $header = \OWeb\manage\Headers::getInstance()->getAllHeaders();
     return array('headers' => $header, "content" => $this->content);
 }
예제 #2
0
 public function initMode()
 {
     //On va charger le controleur.
     $man_ctr = \OWeb\manage\Controller::getInstance();
     //On va voir quel page on doit charger
     $get = \OWeb\OWeb::getInstance()->get_get();
     if (isset($get['page'])) {
         $ctr = $get['page'];
     } else {
         $ctr = OWEB_DEFAULT_PAGE;
     }
     try {
         $ctr = str_replace("\\\\", "\\", $ctr);
         $ctr = str_replace(".", "\\", $ctr);
         $ctr = $man_ctr->loadController('Page\\' . $ctr);
         $ctr->loadParams();
     } catch (\Exception $ex) {
         $ctr = $man_ctr->loadController('Page\\OWeb\\errors\\http\\NotFound');
         $ctr->loadParams();
     }
 }
예제 #3
0
 /**
  * Will get the output of the current controller to display it later on.
  */
 private function prepareDisplay()
 {
     \OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Start@OWeb\\manage\\Template');
     //We save the content so that if there is an error we don't show half displayed codes
     ob_start();
     try {
         \OWeb\manage\Controller::getInstance()->display();
     } catch (\Exception $e) {
         \OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Fail@OWeb\\manage\\Template');
         ob_end_clean();
         ob_start();
         $ctr = \OWeb\manage\Controller::getInstance()->loadException($e);
         $ctr->addParams("exception", $e);
         \OWeb\manage\Controller::getInstance()->display();
     }
     \OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_Succ@OWeb\\manage\\Template');
     $this->content = ob_get_contents();
     \OWeb\manage\Events::getInstance()->sendEvent('PrepareContent_End@OWeb\\manage\\Template');
     ob_end_clean();
     //$this->content_heads = \OWeb\manage\Headers::getInstance()->toString();
     // \OWeb\manage\Headers::getInstance()->reset();
 }
예제 #4
0
 public function __construct(&$get, &$post, &$files, &$cookies, &$server, $adr)
 {
     $this->get_runTime();
     //Checking if There is an older instance. If yes Exception.
     if (self::$instance != null) {
         throw new Exception("Only 1 instance of OWeb can run.");
     } else {
         self::$instance = $this;
     }
     error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
     //Variables d'environement
     $this->_get = $get;
     $this->_post = $post;
     $this->_files = $files;
     $this->_cookies = $cookies;
     $this->_server = $server;
     $this->_adresse = $adr;
     //Initializing AutoLoader.
     $this->autoLoader = new autoLoader();
     //Initialize Events manager
     $this->manage_events = \OWeb\manage\Events::getInstance();
     //Initialize headers manager
     $this->manage_headers = \OWeb\manage\Headers::getInstance();
     //Initialize Extension manager
     $this->manage_extensions = \OWeb\manage\Extensions::getInstance();
     //Initialize Controller manager
     $this->manage_controllers = \OWeb\manage\Controller::getInstance();
     //Initialize SubView manager
     $this->manage_subViews = \OWeb\manage\SubViews::getInstance();
     //Initialize Setting Manager
     $this->manage_settings = \OWeb\manage\Settings::getInstance();
 }