Example #1
0
 protected static function _load($option)
 {
     if (isset(self::$components[$option]) and self::$components[$option] !== null) {
         return true;
     }
     mimport('framework.filesystem.folder');
     $folders = MFolder::folders(MPATH_WP_PLG);
     if (empty($folders)) {
         self::$components[$option] = new stdClass();
         return false;
     }
     self::$components = array();
     $n = count($folders);
     for ($i = 0; $i < $n; $i++) {
         $folder = @$folders[$i];
         if (empty($folder)) {
             continue;
         }
         if (substr($folder, 0, 4) != 'miwo') {
             continue;
         }
         $com = new stdClass();
         $com->id = $i;
         $com->option = 'com_' . $folder;
         $com->params = MFactory::getWOption($folder);
         $com->enabled = 1;
         // Convert the params to an object.
         if (is_string($com->params)) {
             $temp = new MRegistry();
             $temp->loadString($com->params);
             $com->params = $temp;
         }
         self::$components[$com->option] = $com;
     }
     return true;
 }