Пример #1
0
 /**
  * Finds a suitable renderer
  *
  * @return  F0FRenderAbstract
  */
 protected function findRenderer()
 {
     $filesystem = F0FPlatform::getInstance()->getIntegrationObject('filesystem');
     // Try loading the stock renderers shipped with F0F
     if (empty(self::$renderers) || !class_exists('F0FRenderJoomla', false)) {
         $path = dirname(__FILE__) . '/../render/';
         $renderFiles = $filesystem->folderFiles($path, '.php');
         if (!empty($renderFiles)) {
             foreach ($renderFiles as $filename) {
                 if ($filename == 'abstract.php') {
                     continue;
                 }
                 @(include_once $path . '/' . $filename);
                 $camel = F0FInflector::camelize($filename);
                 $className = 'F0FRender' . ucfirst(F0FInflector::getPart($camel, 0));
                 $o = new $className();
                 self::registerRenderer($o);
             }
         }
     }
     // Try to detect the most suitable renderer
     $o = null;
     $priority = 0;
     if (!empty(self::$renderers)) {
         foreach (self::$renderers as $r) {
             $info = $r->getInformation();
             if (!$info->enabled) {
                 continue;
             }
             if ($info->priority > $priority) {
                 $priority = $info->priority;
                 $o = $r;
             }
         }
     }
     // Return the current renderer
     return $o;
 }