diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2014-07-03 11:58:10 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2014-07-03 11:58:10 +0200 |
| commit | 9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1 (patch) | |
| tree | 9f19db50a271171758c4cc9588a7d0495be4c56b /phpBB/includes/functions.php | |
| parent | db31866cbba9f6572938a1a567e6f22bb3cc5a05 (diff) | |
| parent | 380e9c2ef448e478acddd1d8c70affe8356e4465 (diff) | |
| download | forums-9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1.tar forums-9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1.tar.gz forums-9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1.tar.bz2 forums-9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1.tar.xz forums-9cf90d1a84288a240d0dd29d10f2636a4b7fa3a1.zip | |
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus:
[ticket/12784] Shearch the "vendor" folders and then the autoload.php files
[ticket/12784] Allow the extensions to add a custom auto loader
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 32acb0c9ff..0838f2008e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -21,6 +21,37 @@ 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(2); + + foreach ($iterator as $file_info) + { + if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) + { + $filename = $file_info->getRealPath() . '/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } + } + } +} + +/** * Casts a variable to the given type. * * @deprecated |
