4 * @package ezcomponents
6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 if (!defined('IN_PHPBB'))
20 * eZ components class loader
21 * Replaces the autoload mechanism eZ Components normally use
22 * @package ezcomponents
24 class phpbb_ezcomponents_loader
29 * Constructor which makes sure the PHP version requirement is met.
31 function phpbb_ezcomponents_loader()
33 $this->loaded
= array();
34 if (version_compare(PHP_VERSION
, '5.2.1', '<'))
36 trigger_error('PHP >= 5.2.1 required', E_USER_ERROR
);
41 * Loads all classes of a particular component.
42 * The base component is always loaded first.
44 * @param $component string Lower case component name
46 function load_component($component)
48 global $phpbb_root_path;
50 // don't allow loading the same component twice
51 if (isset($this->loaded
[$component]) && $this->loaded
[$component])
56 // make sure base is always loaded first
57 if ($component != 'base' && !isset($this->loaded
['base']))
59 $this->load_component('base');
62 $ezc_path = $phpbb_root_path . 'includes/ezcomponents/';
64 // retrieve the autoload list
65 $classes = include($ezc_path . ucfirst($component) . '/' . $component . '_autoload.php');
67 // include all files related to this component
68 foreach ($classes as $class => $path)
70 include($ezc_path . $path);