Пример #1
0
 /**
  * Overrides method to first lookup into potential extension for the view.
  * @since	1.5
  */
 protected function createView($name, $prefix = '', $type = '', $config = array())
 {
     $extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p'));
     foreach ($extensions as $e => $extension) {
         $result = null;
         // Clean the view name
         $viewName = preg_replace('/[^A-Z0-9_]/i', '', $name);
         $classPrefix = preg_replace('/[^A-Z0-9_]/i', '', $prefix);
         $viewType = preg_replace('/[^A-Z0-9_]/i', '', $type);
         // Build the view class name
         $viewClassExtension = $classPrefix . $viewName . ucfirst($extension);
         if (!class_exists($viewClassExtension)) {
             jimport('joomla.filesystem.path');
             $path = JPath::find($this->paths['view'], $this->createFileName('view', array('name' => $viewName, 'type' => $viewType)));
             if ($path) {
                 require_once $path;
                 if (class_exists($viewClassExtension)) {
                     $result = new $viewClassExtension($config);
                     return $result;
                 }
             }
         } else {
             $result = new $viewClassExtension($config);
             return $result;
         }
     }
     // Still here ? Then the extension doesn't override this, use regular view
     return parent::createView($name, $prefix, $type, $config);
 }