i am not sure if this even works with externals. :o
[phpbb.git] / phpBB / includes / libraries / ezcomponents / loader.php
blob62aaa7667dfc4c1e0bc8cbdb6fe1ac860c53382a
1 <?php
2 /**
4 * @package ezcomponents
5 * @version $Id$
6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 */
11 /**
12 * @ignore
14 if (!defined('IN_PHPBB'))
16 exit;
19 /**
20 * eZ components class loader
21 * Replaces the autoload mechanism eZ Components normally use
22 * @package ezcomponents
24 class phpbb_ezcomponents_loader
26 var $loaded;
28 /**
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);
40 /**
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])
53 return;
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);