mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[ticket/12784] Allow the extensions to add a custom auto loader
PHPBB3-12784
This commit is contained in:
@@ -20,6 +20,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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user