/** * Private constructor class to prevent outside instantiation. * * @return void */ private function __construct() { // Add in the core component for the first element. $this->_componentCache['core'] = ComponentHandler::_Factory(ROOT_PDIR . 'core/component.xml'); // Run through the libraries directory and look for, well... components. // First, build my cache of components, regardless if the component is installed or not. $dh = opendir(ROOT_PDIR . 'components'); if (!$dh) return; while ($file = readdir($dh)) { // skip hidden directories. if ($file{0} == '.') continue; // skip non-directories if (!is_dir(ROOT_PDIR . 'components/' . $file)) continue; // Skip directories that do not have a readable component.xml file. if (!is_readable(ROOT_PDIR . 'components/' . $file . '/component.xml')) continue; $c = ComponentHandler::_Factory(ROOT_PDIR . 'components/' . $file . '/component.xml'); // All further operations are case insensitive. // The original call to Component needs to be case sensitive because it sets the filename to pull. $file = strtolower($file); // If the component was flagged as invalid.. just skip to the next one. if (!$c->isValid()) { if (DEVELOPMENT_MODE) { CAEUtils::AddMessage('Component ' . $c->getName() . ' appears to be invalid.'); } continue; } $this->_componentCache[$file] = $c; unset($c); } closedir($dh); }