Changeset 9243

Show
Ignore:
Timestamp:
08/13/08 22:27:02 (4 months ago)
Author:
afz
Message:

- compatible Jaws_Registry with Jaws_Component
- update all registry method with new changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jaws/html/include/Jaws/Registry.php

    r9235 r9243  
    1010 * @license    http://www.gnu.org/copyleft/lesser.html 
    1111 */ 
    12 define('JAWS_REGISTRY_CORE',   0); 
    13 define('JAWS_REGISTRY_GADGET', 1); 
    14 define('JAWS_REGISTRY_PLUGIN', 2); 
    15  
    1612class Jaws_Registry 
    1713{ 
     
    3531 
    3632    /** 
    37      * Array that has a *registry* of files that have been called 
     33     * Array that has a registry keys of loaded components 
    3834     * 
    3935     * @var    array 
    4036     * @access private 
    4137     */ 
    42     var $_LoadedFiles = array(); 
     38    var $_LoadedComponents = array(); 
    4339 
    4440    /** 
     
    5046    { 
    5147        $params = array(); 
    52         $params['enabled'] = 'version'; 
     48        $params['enabled'] = 'enabled'; 
    5349        $params['version'] = 'version'; 
    5450 
     
    5652        $sql = " 
    5753            SELECT 
    58                 [comp_name], [comp_type], [key_name], [key_value] 
    59             FROM [[registry]] 
     54                [[components]].[comp_name], [key_name], [key_value] 
     55            FROM [[registry]] INNER JOIN [[components]] 
     56              ON [[registry]].[comp_id] = [[components]].[id] 
    6057            WHERE 
    6158                [key_name] = {enabled} 
     
    6966        } 
    7067        $this->_Registry = $result; 
    71         $this->LoadFile('core'); 
     68        $this->LoadComponentKeys('', JAWS_COMPONENT_CORE); 
    7269    } 
    7370 
     
    7875     * @param   string  $comp Component's name 
    7976     * @param   string  $name The key 
    80      * @param   string  $type The type of the component, (core, plugin or a gadget) 
    8177     * @return  string  The value of the key 
    8278     */ 
    83     function GetFromTable($comp, $name, $type = JAWS_REGISTRY_CORE
     79    function GetFromTable($comp, $name
    8480    { 
    8581        $params = array(); 
    8682        $params['comp_name'] = $comp; 
    87         $params['comp_type'] = $type; 
    8883        $params['key_name']  = $name; 
    8984 
     
    9186            SELECT 
    9287                [key_value] 
    93             FROM [[registry]] 
     88            FROM [[registry]] INNER JOIN [[components]] 
     89              ON [[registry]].[comp_id] = [[components]].[id] 
    9490            WHERE 
    95                 [comp_name] = {comp_name} 
    96               AND 
    97                 [comp_type] = {comp_type} 
     91                [[components]].[comp_name] = {comp_name} 
    9892              AND 
    9993                [key_name]  = {key_name}"; 
     
    10498        } 
    10599 
     100        //FIXME: maybe value really is empty 
    106101        if (!empty($value)) { 
    107102            // lets update the internal array just in case 
    108             $this->_Registry[$type][$comp][$name] = $value; 
     103            $this->_Registry[$comp][$name] = $value; 
    109104            return $value; 
    110105        } 
     
    119114     * @param   string  $name The key 
    120115     * @param   string  $comp Component's name 
    121      * @param   string  $type The type of the component, (core, plugin or a gadget) 
    122116     * @return  bool    true when the key was found, else false 
    123117     */ 
    124     function KeyExists($name, $comp = 'Jaws', $type = JAWS_REGISTRY_CORE
    125     { 
    126         return array_key_exists($name, $this->_Registry[$type][$comp]); 
     118    function KeyExists($name, $comp = 'Jaws'
     119    { 
     120        return array_key_exists($name, $this->_Registry[$comp]); 
    127121    } 
    128122 
     
    133127     * @param   string  $name The key 
    134128     * @param   string  $comp Component's name 
    135      * @param   string  $type The type of the component, (core, plugin or a gadget) 
    136129     * @return  string  The value of the key 
    137130     */ 
    138     function Get($name, $comp = 'Jaws', $type = JAWS_REGISTRY_CORE
    139     { 
    140         return $this->KeyExists($name, $comp, $type) ? $this->_Registry[$type][$comp][$name] : null; 
     131    function Get($name, $comp = 'Jaws'
     132    { 
     133        return $this->KeyExists($name, $comp) ? $this->_Registry[$comp][$name] : null; 
    141134    } 
    142135 
     
    159152        MDB2::loadFile('Date'); 
    160153        $params = array(); 
    161         $params['comp_name'] = 'Registry'; 
    162         $params['comp_type'] = JAWS_REGISTRY_CORE; 
    163         $params['key_name']  = 'last_update'; 
    164         $params['now']       = MDB2_Date::mdbNow(); 
     154        $params['comp_id']  = $this->_LoadedComponents['Registry']; 
     155        $params['key_name'] = 'last_update'; 
     156        $params['now']      = MDB2_Date::mdbNow(); 
    165157 
    166158        $sql = " 
     
    168160                [key_value] = {now} 
    169161            WHERE 
    170                 [comp_name] = {comp_name
     162                [comp_id] = {comp_id
    171163              AND 
    172                 [comp_type] = {comp_type} 
    173               AND 
    174                 [key_name]  = {key_name}"; 
     164                [[registry]].[key_name]  = {key_name}"; 
    175165 
    176166        $result = $GLOBALS['db']->query($sql, $params); 
     
    179169        } 
    180170 
    181         $this->_LastUpdate = $this->_Registry[JAWS_REGISTRY_CORE]['Registry']['last_updated'] = $params['now']; 
     171        $this->_LastUpdate = $this->_Registry['Registry']['last_updated'] = $params['now']; 
    182172        return true; 
    183173    } 
     
    190180     * @param   string  $value The value 
    191181     * @param   string  $comp  Component's name 
    192      * @param   string  $type  The type of the component, (core, plugin or a gadget) 
    193      */ 
    194     function Set($name, $value, $comp = 'Jaws', $type = JAWS_REGISTRY_CORE) 
    195     { 
    196         if (!$this->KeyExists($name, $comp, $type)) { 
     182     */ 
     183    function Set($name, $value, $comp = 'Jaws') 
     184    { 
     185        if (!array_key_exists($comp, $this->_LoadedComponents) || !$this->KeyExists($name, $comp)) { 
    197186            return false; 
    198187        } 
     
    200189        $xss    = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS'); 
    201190        $params = array(); 
    202         $params['comp_name'] = $comp; 
    203         $params['comp_type'] = $type; 
     191        $params['comp_id']   = $this->_LoadedComponents[$comp]; 
    204192        $params['key_name']  = $name; 
    205193        $params['key_value'] = $xss->parse($value); 
     
    209197                [key_value] = {key_value} 
    210198            WHERE 
    211                 [comp_name] = {comp_name
     199                [comp_id] = {comp_id
    212200              AND 
    213                 [comp_type] = {comp_type} 
    214               AND 
    215                 [key_name]  = {key_name}"; 
     201                [[registry]].[key_name]  = {key_name}"; 
    216202 
    217203        $result = $GLOBALS['db']->query($sql, $params); 
     
    220206        } 
    221207 
    222         $this->_Registry[$type][$comp][$name] = $params['value']; 
     208        $this->_Registry[$comp][$name] = $params['value']; 
    223209        return $this->UpdateLastUpdate(); 
    224210    } 
     
    231217     * @param   string  $value The value 
    232218     * @param   string  $comp  Component's name 
    233      * @param   string  $type  The type of the component, (core, plugin or a gadget) 
    234      */ 
    235     function NewKey($name, $value, $comp = 'Jaws', $type = JAWS_REGISTRY_CORE) 
    236     { 
    237         if (!$this->KeyExists($name, $comp, $type)) { 
    238             return false; //already exists 
     219     */ 
     220    function NewKey($name, $value, $comp = 'Jaws') 
     221    { 
     222        if (!array_key_exists($comp, $this->_LoadedComponents) || !$this->KeyExists($name, $comp)) { 
     223            return false; 
    239224        } 
    240225 
     
    243228 
    244229        $params = array(); 
    245         $params['comp_name'] = $comp; 
    246         $params['comp_type'] = $type; 
     230        $params['comp_id']   = $this->_LoadedComponents[$comp]; 
    247231        $params['key_name']  = $name; 
    248232        $params['key_value'] = $xss->parse($value); 
     
    251235        $sql = " 
    252236            INSERT INTO [[registry]] 
    253                 ([comp_name], [comp_type], [key_name], [key_value], [updatetime]) 
     237                ([comp_id], [key_name], [key_value], [updatetime]) 
    254238            VALUES 
    255                 ({comp_name}, {comp_type}, {key_name}, {key_value}, {now})"; 
     239                ({comp_id}, {key_name}, {key_value}, {now})"; 
    256240 
    257241        $result = $GLOBALS['db']->query($sql, $params); 
     
    260244        } 
    261245 
    262         $this->_Registry[$type][$comp][$name] = $params['value']; 
     246        $this->_Registry[$comp][$name] = $params['value']; 
    263247        return $this->UpdateLastUpdate(); 
    264248    } 
     
    284268        $xss = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS'); 
    285269        foreach ($reg_keys as $idx => $reg_key) { 
    286             if ($this->KeyExists($reg_key[0], $reg_key[2], $reg_key[3])) { 
     270            if (!array_key_exists($reg_key[2], $this->_LoadedComponents) || $this->KeyExists($reg_key[0], $reg_key[2])) { 
    287271                unset($reg_keys[$idx]); 
    288272            } else { 
    289                 $params["comp_$idx"]  = $reg_key[2]; 
     273                $params["comp_$idx"]  = $this->_LoadedComponents[$reg_key[2]]; 
    290274                $params["name_$idx"]  = $reg_key[0]; 
    291275                $params["value_$idx"] = $xss->parse($reg_key[1]); 
    292                 $params["type_$idx"]  = $reg_key[3]; 
    293276                // Ugly hack to support all databases 
    294277                switch ($GLOBALS['db']->_dsn['phptype']) { 
    295278                    case 'oci8': 
    296279                        $sqls .= (empty($sqls)? '' : "\n UNION ALL"). 
    297                                   "\n SELECT {comp_$idx}, {type_$idx}, {name_$idx}, {value_$idx}, {now} FROM DUAL"; 
     280                                  "\n SELECT {comp_$idx}, {name_$idx}, {value_$idx}, {now} FROM DUAL"; 
    298281                        break; 
    299282                    case 'ibase': 
    300                         $sqls[] = " VALUES ({comp_$idx}, {type_$idx}, {name_$idx}, {value_$idx}, {now})"; 
     283                        $sqls[] = " VALUES ({comp_$idx}, {name_$idx}, {value_$idx}, {now})"; 
    301284                        break; 
    302285                    case 'pgsql': 
    303286                        $sqls .= (empty($sqls)? "\n VALUES" : ","). 
    304                                   "\n ({comp_$idx}, {type_$idx}, {name_$idx}, {value_$idx}, {now})"; 
     287                                  "\n ({comp_$idx}, {name_$idx}, {value_$idx}, {now})"; 
    305288                        break; 
    306289                    default: 
    307290                        $sqls .= (empty($sqls)? '' : "\n UNION ALL"). 
    308                                   "\n SELECT {comp_$idx}, {type_$idx}, {name_$idx}, {value_$idx}, {now}"; 
     291                                  "\n SELECT {comp_$idx}, {name_$idx}, {value_$idx}, {now}"; 
    309292                        break; 
    310293                } 
     
    321304        if (is_array($sqls)) { 
    322305            foreach ($sqls as $sql) { 
    323                 $qsql = " INSERT INTO [[registry]]([comp_name], [comp_type], [key_name], [key_value], [updatetime])" . $sql; 
     306                $qsql = " INSERT INTO [[registry]]([comp_id], [key_name], [key_value], [updatetime])" . $sql; 
    324307                $result = $GLOBALS['db']->query($qsql, $params); 
    325308                if (Jaws_Error::IsError($result)) { 
     
    328311            } 
    329312        } else { 
    330             $qsql = " INSERT INTO [[registry]]([comp_name], [comp_type], [key_name], [key_value], [updatetime])" . $sqls; 
     313            $qsql = " INSERT INTO [[registry]]([comp_id], [key_name], [key_value], [updatetime])" . $sqls; 
    331314            $result = $GLOBALS['db']->query($qsql, $params); 
    332315            if (Jaws_Error::IsError($result)) { 
     
    337320        foreach ($reg_keys as $idx => $reg_key) { 
    338321            if (empty($reg_keys[$idx])) continue; 
    339             $this->_Registry[$reg_key[3]][$reg_key[0]][$reg_key[1]] = $reg_key[2]; 
     322            $this->_Registry[$reg_key[0]][$reg_key[1]] = $reg_key[2]; 
    340323        } 
    341324 
     
    349332     * @param   string  $name The key 
    350333     * @param   string  $comp Component's name 
    351      * @param   string  $type The type of the component, (core, plugin or a gadget) 
    352      */ 
    353     function DeleteKey($name, $comp, $type = JAWS_REGISTRY_CORE) 
    354     { 
    355         if ($this->KeyExists($name, $comp, $type)) { 
    356             unset($this->_Registry[$type][$comp][$name]); 
    357         } 
    358  
     334     */ 
     335    function DeleteKey($name, $comp) 
     336    { 
     337        if (!array_key_exists($comp, $this->_LoadedComponents) || !$this->KeyExists($name, $comp)) { 
     338            unset($this->_Registry[$comp][$name]); 
     339        } 
     340 
     341        $params = array(); 
     342        $params['comp_id']  = $this->_LoadedComponents[$comp]; 
     343        $params['key_name'] = $name; 
     344 
     345        $sql = " 
     346            DELETE FROM [[registry]] 
     347            WHERE 
     348                [comp_id] = {comp_id} 
     349              AND 
     350                [key_name]  = {key_name}"; 
     351 
     352        $result = $GLOBALS['db']->query($sql, $params); 
     353        if (Jaws_Error::IsError($result)) { 
     354            return false; 
     355        } 
     356 
     357        $this->UpdateLastUpdate(); 
     358    } 
     359 
     360    /** 
     361     * Get the simple array 
     362     * 
     363     * @access  public 
     364     * @return  array   Returns the SimpleArray 
     365     */ 
     366    function GetSimpleArray() 
     367    { 
     368        return $this->_Registry; 
     369    } 
     370 
     371    /** 
     372     * Saves the key array file in JAWS_DATA . '/cache/registry/(gadgets|plugins)' . $component 
     373     * 
     374     * @access  public 
     375     * @param   string  $comp    Component's name 
     376     * @param   string  $regexp  Regexp used when we check 'core' 
     377     */ 
     378    function Commit($comp) 
     379    { 
     380        return true; 
     381    } 
     382 
     383    /** 
     384     * Loads the keys of a component 
     385     * 
     386     * @access  public 
     387     * @param   string  $comp Component's name 
     388     * @param   string  $type The type of the component, (core, gadget, plugin or any components) 
     389     */ 
     390    function LoadComponentKeys($comp = '', $type = JAWS_COMPONENT_ANY) 
     391    { 
    359392        $params = array(); 
    360393        $params['comp_name'] = $comp; 
    361394        $params['comp_type'] = $type; 
    362         $params['key_name']  = $name; 
    363  
    364         $sql = " 
    365             DELETE FROM [[registry]] 
    366             WHERE 
    367                 [comp_name] = {comp_name} 
    368               AND 
    369                 [comp_type] = {comp_type} 
    370               AND 
    371                 [key_name]  = {key_name}"; 
    372  
    373         $result = $GLOBALS['db']->query($sql, $params); 
    374         if (Jaws_Error::IsError($result)) { 
    375             return false; 
    376         } 
    377  
    378         $this->UpdateLastUpdate(); 
    379     } 
    380  
    381     /** 
    382      * Get the simple array 
    383      * 
    384      * @access  public 
    385      * @return  array   Returns the SimpleArray 
    386      */ 
    387     function GetSimpleArray() 
    388     { 
    389         return $this->_Registry; 
    390     } 
    391  
    392     /** 
    393      * Saves the key array file in JAWS_DATA . '/cache/registry/(gadgets|plugins)' . $component 
    394      * 
    395      * @access  public 
    396      * @param   string  $comp    Component's name 
    397      * @param   string  $type    The type of the component, (plugin or a gadget) only 
    398      *                           if the component name is not empty 
    399      * @param   string  $regexp  Regexp used when we check 'core' 
    400      */ 
    401     function Commit($comp, $type = JAWS_REGISTRY_CORE) 
    402     { 
    403         $dirs = array(); 
    404         $dirs['cache']    = JAWS_DATA. 'cache'; 
    405         $dirs['registry'] = $dirs['cache']. DIRECTORY_SEPARATOR. 'registry'; 
    406  
    407         $result = "\$registry = array();\n"; 
    408         if ($type == JAWS_REGISTRY_CORE) { 
    409             // Reorder the array so that the output will be easier to read 
    410             ksort($this->_Registry[$type]); 
    411             foreach ($this->_Registry[$type] as $core_comp => $comp_items) { 
    412                 foreach ($comp_items as $key => $value) { 
    413                     $result .= "\$registry['".$core_comp."']['".$key."'] = '".addslashes($value)."';\n"; 
    414                 } 
    415             } 
    416             $comp_file = $dirs['registry']. DIRECTORY_SEPARATOR. 'core.php'; 
    417         } else { 
    418             // Reorder the array so that the output will be easier to read 
    419             ksort($this->_Registry[$type][$comp]); 
    420             foreach ($this->_Registry[$type][$comp] as $key => $value) { 
    421                 if ($key != 'enabled' || $key != 'version') { 
    422                     $result .= "\$registry['".$key."'] = '".addslashes($value)."';\n"; 
    423                 } 
    424             } 
    425  
    426             switch ($type) { 
    427                 case JAWS_REGISTRY_GADGET: 
    428                     $dirs['gadgets'] = $dirs['registry']. DIRECTORY_SEPARATOR. 'gadgets'; 
    429                     $comp_file = $dirs['gadgets']. DIRECTORY_SEPARATOR. "$comp.php"; 
    430                     break; 
    431                 case JAWS_REGISTRY_PLUGIN: 
    432                     $dirs['plugins'] = $dirs['registry']. DIRECTORY_SEPARATOR. 'plugins'; 
    433                     $comp_file = $dirs['plugins']. DIRECTORY_SEPARATOR. "$comp.php"; 
    434                     break; 
    435             } 
    436         } 
    437  
    438         $result = "<?php\n" . $result; 
    439         foreach ($dirs as $dir) { 
    440             if (!Jaws_Utils::mkdir($dir)) { 
    441                 return new Jaws_Error(_t('GLOBAL_ERROR_REGISTRY_CACHEDIR_NOT_WRITABLE', $dir), 'Jaws_Registry'); 
    442             } 
    443         } 
    444  
    445         if (false == file_put_contents($comp_file, $result)) { 
    446             return new Jaws_Error(_t('GLOBAL_ERROR_REGISTRY_CACHEDIR_NOT_WRITABLE', $comp_file), 'Jaws_Registry'); 
    447         } 
    448  
    449         Jaws_Utils::chmod($comp_file); 
     395 
     396        $sql = " 
     397            SELECT 
     398                [[components]].[comp_name], [key_name], [key_value] 
     399            FROM [[registry]] INNER JOIN [[components]] 
     400              ON [[registry]].[comp_id] = [[components]].[id]"; 
     401 
     402        if (!empty($comp)) { 
     403            $sql .= " WHERE [[components]].[comp_name] = {comp_name}"; 
     404        } elseif (!empty($type)) { 
     405            $sql .= " WHERE [[components]].[comp_type] = {comp_type}"; 
     406        } 
     407 
     408        $regKeys = $GLOBALS['db']->queryAll($sql, $params, null, null, true); 
     409        if (Jaws_Error::isError($regKeys)) { 
     410            return false; 
     411        } 
     412 
     413        $sql = " 
     414            SELECT 
     415                [comp_name], [id] 
     416            FROM [[components]]" 
     417 
     418        if (!empty($comp)) { 
     419            $sql .= " WHERE [comp_name] = {comp_name}"; 
     420        } elseif (!empty($type)) { 
     421            $sql .= " WHERE [comp_type] = {comp_type}"; 
     422        } 
     423        $components = $GLOBALS['db']->queryAll($sql, $params, null, null, true); 
     424        if (Jaws_Error::isError($components)) { 
     425            return false; 
     426        } 
     427 
     428        $this->_Registry = $regKeys + $this->_Registry; 
     429        $this->_LoadedComponents = components + $this->_LoadedComponents; 
     430 
    450431        return true; 
    451432    } 
    452433 
    453434    /** 
    454      * Loads the keys of a component and optionally it returns the keys found in the file 
    455      * 
    456      * @access  public 
    457      * @param   string  $component Component's name 
    458      */ 
    459     function LoadFile($component, $type = 'gadgets', $return = false) 
    460     { 
    461         $type = strtolower($type); 
    462         unset($this->_LoadedFiles['core']); 
    463         if ($component === '' || !in_array($type, array('gadgets', 'plugins')) || in_array($component, $this->_LoadedFiles)) { 
    464             return; 
    465         } 
    466         $add = $component !== 'core' ? $type . '/' : ''; 
    467         $file = JAWS_DATA . 'cache/registry/' . $add . $component . '.php'; 
    468         $exists = file_exists($file); 
    469         if ($exists) { 
    470             require $file; 
    471             $this->_LoadedFiles[$component] = $component; 
    472             // $registry comes from the file loaded 
    473             if (isset($registry) && is_array($registry)) { 
    474                 foreach ($registry as $key => $value) { 
    475                     if (!$this->KeyExists($key)) { 
    476                         $this->_Registry[$key] = stripslashes($value); 
    477                     } 
    478                 } 
    479  
    480                 if ($return) { 
    481                     return $registry; 
    482                 } 
    483             } 
    484  
    485             return true; 
    486         } else { 
    487             // Cache file doesn't exist, lets generate it 
    488             $res = $this->_regenerateInternalRegistry($component, $type); 
    489             if (!$res) { 
    490                 return; 
    491             } 
    492             $this->commit($component, $type); 
    493             return $this->loadFile($component, $type, $return); 
    494         } 
    495     } 
    496  
    497     /** 
    498      * Regenerates/updates the internal registry array ($this->_Registry) 
    499      * 
    500      * @access  protected 
    501      * @param   string     $component  Component name 
    502      * @param   string     $type       Type of component (gadget or plugin) 
    503      * @return  boolean    Success/Failure 
    504      */ 
    505     function _regenerateInternalRegistry($component, $type = 'gadgets') 
    506     { 
    507         $type = strtolower($type); 
    508         if (!in_array($type, array('gadgets', 'plugins'))) { 
    509             return false; 
    510         } 
    511  
    512         if ($component == 'core') { 
    513             // Big ass query since the core isn't under one namespace 
    514             $sql = " 
    515                 SELECT [component], [key_name], [key_value] 
    516                 FROM [[registry]] 
    517                 WHERE 
    518                     [key_name] LIKE '/config/%' 
    519                    OR 
    520                     [key_name] LIKE '/map/%' 
    521                    OR 
    522                     [key_name] LIKE '/network/%' 
    523                    OR 
    524                     [key_name] LIKE '/policy/%' 
    525                    OR 
    526                     [key_name] LIKE '/crypt/%' 
    527                    OR 
    528                     [key_name] IN('/version', '/last_updated', '/plugins/parse_text/enabled_items', 
    529                                   '/gadgets/enabled_items', '/gadgets/allowurl_items', 
    530                                   '/gadgets/autoload_items', '/gadgets/core_items') 
    531                 "; 
    532         } else { 
    533             if ($type == 'gadgets') { 
    534                 $sql = "SELECT [component], [key_name], [key_value] FROM [[registry]] WHERE [key_name] LIKE '/gadgets/".$component."/%'"; 
    535             } else { 
    536                 $sql = " 
    537                     SELECT [component], [key_name], [key_value] FROM [[registry]] 
    538                     WHERE [key_name] LIKE '/plugins/".$component."/%' OR [key_name] LIKE '/plugins/parse_text/".$component."/%'"; 
    539             } 
    540         } 
    541  
    542         $result = $GLOBALS['db']->queryAll($sql, array(), null, null, true); 
    543         if (Jaws_Error::isError($result)) { 
    544             return false; 
    545         } 
    546  
    547         $this->_Registry = $result + $this->_Registry; 
    548         return true; 
    549     } 
    550  
    551     /** 
    552      * Loads all the component files 
    553      * 
    554      * @access  public 
    555      */ 
    556     function LoadAllFiles() 
    557     { 
    558         ///FIXME check for errors 
    559         $gs = explode(',', $this->get('/gadgets/enabled_items')); 
    560         $ci = explode(',', $this->get('/gadgets/core_items')); 
    561         $ps = explode(',', $this->get('/plugins/parse_text/enabled_items')); 
    562  
    563         $ci = str_replace(' ', '', $ci); 
    564         $ps = str_replace(' ', '', $ps); 
    565  
    566         // load the core 
    567         $this->LoadFile('core'); 
    568  
    569         foreach ($gs as $gadget) { 
    570             $this->LoadFile($gadget); 
    571         } 
    572  
    573         foreach ($ci as $gadget) { 
    574             $this->LoadFile($gadget); 
    575         } 
    576  
    577         foreach ($ps as $plugin) { 
    578             $this->LoadFile($plugin, 'plugins'); 
    579         } 
    580     } 
    581  
    582     /** 
    583      * Deletes the cache file of a certain component 
    584      * 
    585      * @acess   public 
    586      * @access  protected 
    587      * @param   string     $name       Component name 
    588      * @param   string     $type       Type of component (gadget or plugin) 
    589      * @return  boolean    Success/Failure 
    590      */ 
    591     function deleteCacheFile($name, $type = 'gadgets') 
    592     { 
    593         $type = strtolower($type); 
    594         if (empty($name) || !in_array($type, array('gadgets', 'plugins'))) { 
    595             return false; 
    596         } 
    597  
    598         $add = $name !== 'core' ? $type . '/' : ''; 
    599  
    600         $file = JAWS_DATA . 'cache/registry/' . $add . $name . '.php'; 
    601         if (file_exists($file)) { 
    602             unlink($file); 
    603             return true; 
    604         } 
    605         return false; 
    606     } 
    607  
    608     /** 
    609435     * Resets/Cleans the registry 
    610436     * 
     
    614440    { 
    615441        $this->_Registry    = array(); 
    616         $this->_LoadedFiles = array(); 
     442        $this->_LoadedComponents = array(); 
    617443    } 
    618444