diff options
| author | Tristan Darricau <github@nicofuma.fr> | 2014-07-01 20:53:10 +0200 |
|---|---|---|
| committer | Tristan Darricau <github@nicofuma.fr> | 2014-07-01 22:55:06 +0200 |
| commit | fbc15407a215d82263cc37c3a3f897547945e4e5 (patch) | |
| tree | 43b6e6d423c83f8b643f5d711b63d8fee0fc478b /phpBB/includes/functions.php | |
| parent | 404c2f11448f53e55eca4cfdf082671230711241 (diff) | |
| download | forums-fbc15407a215d82263cc37c3a3f897547945e4e5.tar forums-fbc15407a215d82263cc37c3a3f897547945e4e5.tar.gz forums-fbc15407a215d82263cc37c3a3f897547945e4e5.tar.bz2 forums-fbc15407a215d82263cc37c3a3f897547945e4e5.tar.xz forums-fbc15407a215d82263cc37c3a3f897547945e4e5.zip | |
[ticket/12784] Allow the extensions to add a custom auto loader
PHPBB3-12784
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 32acb0c9ff..f820679144 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -21,6 +21,33 @@ if (!defined('IN_PHPBB')) // Common global functions /** +* Load the autoloaders added by the extensions. +* +* @param string $phpbb_root_path Path to the phpbb root directory. +*/ +function phpbb_load_extensions_autoloaders($phpbb_root_path) +{ + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'ext/', + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(3); + + foreach ($iterator as $file_info) + { + if ($file_info->getFilename() === 'autoload.php' && $file_info->getPathInfo()->getFilename() === 'vendor') + { + require $file_info->getRealPath(); + } + } +} + +/** * Casts a variable to the given type. * * @deprecated |
