diff options
author | Nils Adermann <naderman@naderman.de> | 2011-06-09 05:13:26 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-09-29 15:42:33 +0200 |
commit | 14f1e581faa3b66e7689c55c1e9c0485c0872b1e (patch) | |
tree | 437880dd3c80e47a6205beadb005c7ce27a1a960 /phpBB/includes/class_loader.php | |
parent | 8377418466f861f6b3291ae92a71821f0a0be2d6 (diff) | |
download | forums-14f1e581faa3b66e7689c55c1e9c0485c0872b1e.tar forums-14f1e581faa3b66e7689c55c1e9c0485c0872b1e.tar.gz forums-14f1e581faa3b66e7689c55c1e9c0485c0872b1e.tar.bz2 forums-14f1e581faa3b66e7689c55c1e9c0485c0872b1e.tar.xz forums-14f1e581faa3b66e7689c55c1e9c0485c0872b1e.zip |
[feature/extension-manager] Extension Manager & Finder
Extensions RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=84&t=41499
Ticket: http://tracker.phpbb.com/browse/PHPBB3-10323
PHPBB3-10323
Diffstat (limited to 'phpBB/includes/class_loader.php')
-rw-r--r-- | phpBB/includes/class_loader.php | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/phpBB/includes/class_loader.php b/phpBB/includes/class_loader.php index a28d745983..bcf1ba1650 100644 --- a/phpBB/includes/class_loader.php +++ b/phpBB/includes/class_loader.php @@ -31,22 +31,25 @@ if (!defined('IN_PHPBB')) */ class phpbb_class_loader { - private $phpbb_root_path; + private $core_path; + private $ext_path; private $php_ext; private $cache; private $cached_paths = array(); /** * Creates a new phpbb_class_loader, which loads files with the given - * file extension from the given phpbb root path. + * file extension from the given core or extension path. * - * @param string $phpbb_root_path phpBB's root directory containing includes/ - * @param string $php_ext The file extension for PHP files + * @param string $core_path phpBB's include directory for core files + * @param string $ext_path phpBB's extension directory + * @param string $php_ext The file extension for PHP files * @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface. */ - public function __construct($phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) + public function __construct($core_path, $ext_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null) { - $this->phpbb_root_path = $phpbb_root_path; + $this->core_path = $core_path; + $this->ext_path = $ext_path; $this->php_ext = $php_ext; $this->set_cache($cache); @@ -100,7 +103,16 @@ class phpbb_class_loader */ public function resolve_path($class) { - $path_prefix = $this->phpbb_root_path . 'includes/'; + if (substr($class, 6, 4) === 'ext_') + { + $path_prefix = $this->ext_path; + $prefix_length = 10; + } + else + { + $path_prefix = $this->core_path; + $prefix_length = 6; + } if (isset($this->cached_paths[$class])) { @@ -112,7 +124,7 @@ class phpbb_class_loader return false; } - $parts = explode('_', substr($class, 6)); + $parts = explode('_', substr($class, $prefix_length)); $dirs = ''; |