Пример #1
0
 public static function dispatch()
 {
     // Fetch URL-variables
     $jinput = JFactory::getApplication()->input;
     $option = $jinput->getCmd('option');
     $view = $jinput->getCmd('view');
     // Construct the controller-prefix
     $prefix = ucfirst(preg_replace('/^com_/', '', $option));
     // Check for a corresponding view-controller
     if (!empty($view)) {
         $controllerFile = JPATH_COMPONENT . '/controllers/' . $view . '.php';
         if (file_exists($controllerFile)) {
             require_once $controllerFile;
             $controllerClass = $prefix . 'Controller' . ucfirst($view);
             if (class_exists($controllerClass)) {
                 $controller = new $controllerClass();
             }
         }
     }
     // Return to the default component-controller
     if (empty($controller)) {
         $controllerFile = JPATH_COMPONENT . '/controller.php';
         if (file_exists($controllerFile)) {
             require_once $controllerFile;
             $controllerClass = $prefix . 'Controller';
             if (class_exists($controllerClass)) {
                 $controller = new $controllerClass();
             }
         }
     }
     // Default to YireoController
     if (empty($controller)) {
         $controller = new YireoController();
     }
     // Perform the Request task
     $controller->execute($jinput->getCmd('task'));
     $controller->redirect();
 }
Пример #2
0
 /**
  * Method to display the views layout
  *
  * @param null
  *
  * @return null
  */
 public function display($cachable = false, $urlparams = false)
 {
     // If the caching view is called, perform the cache-task instead
     if ($this->_app->input->getCmd('view') == 'cache') {
         return $this->cache();
     }
     // Redirect to the Magento Admin Panel
     if ($this->_app->input->getCmd('view') == 'magento') {
         $link = MagebridgeModelConfig::load('url') . 'index.php/' . MagebridgeModelConfig::load('backend');
         return $this->setRedirect($link);
     }
     // Redirect to the Yireo Forum
     if ($this->_app->input->getCmd('view') == 'forum') {
         return $this->setRedirect('http://www.yireo.com/forum/');
     }
     // Redirect to the Yireo Tutorials
     if ($this->_app->input->getCmd('view') == 'tutorials') {
         return $this->setRedirect('http://www.yireo.com/tutorials/magebridge/');
     }
     parent::display();
 }
Пример #3
0
 /**
  * Constructor
  * @access public
  * @package SimpleLists
  */
 public function __construct()
 {
     $this->_default_view = 'items';
     parent::__construct();
 }