Exemplo n.º 1
0
 public static function getComponent($id = null, $option = 'com_jce')
 {
     if (!isset(self::$component)) {
         self::$component = array();
     }
     $options = array($option);
     if (isset($id)) {
         $options[] = $id;
     }
     $signature = serialize($options);
     if (!isset(self::$component[$signature])) {
         if (defined('JPATH_PLATFORM')) {
             // get component table
             $component = JTable::getInstance('extension');
             if (!$id) {
                 $id = $component->find(array('type' => 'component', 'element' => $option));
             }
             $component->load($id);
         } else {
             // get component table
             $component = JTable::getInstance('component');
             if ($id) {
                 $component->load($id);
             } else {
                 $component->loadByOption($option);
             }
         }
         self::$component[$signature] = $component;
     }
     return self::$component[$signature];
 }