Example #1
0
 public function dispatch()
 {
     //      if ($this->_view == 'rest') {
     //        return $this->dispatchRest();
     //      }
     try {
         $scheme = $this->_scheme;
         $this->controller = One_Repository::getController($scheme, $this->_options);
         $content = $this->controller->execute($this->_task, $this->_options);
         if (is_null($this->controller->getRedirect())) {
             if ($this->parseContentPlugins && $this->task != 'edit') {
                 // @TODO lookup better way to trigger this today
                 $dummy = new stdClass();
                 $dummy->text = $content;
                 JPluginHelper::importPlugin('content');
                 $dispatcher = JDispatcher::getInstance();
                 $params = JFactory::getApplication()->getParams();
                 $dispatcher->trigger('onContentPrepare', array('com_one.default', &$dummy, &$params, 0));
                 $content = $dummy->text;
             }
             echo $content;
         } else {
             $this->setRedirect($this->controller->getRedirect());
             $this->redirect();
         }
     } catch (Exception $e) {
         if (One_Config::get('debug.exitOnError') === false) {
             echo $e->getMessage();
         } else {
             throw new Exception($e);
         }
     }
 }
Example #2
0
 public function dispatch()
 {
     try {
         $scheme = $this->_scheme;
         $this->controller = One_Repository::getController($scheme, $this->_options);
         $content = $this->controller->execute($this->_task, $this->_options);
         if (is_null($this->controller->getRedirect())) {
             echo $content;
         } else {
             $this->setRedirect($this->controller->getRedirect());
             $this->redirect();
         }
     } catch (Exception $e) {
         if (One_Config::get('debug.exitOnError') === false) {
             echo $e->getMessage();
         } else {
             throw new Exception($e);
         }
     }
 }