3 * @file include/autoloader.php
\r
7 * @brief composer-derived autoloader init
\r
9 class FriendicaAutoloaderInit
\r
11 private static $loader;
\r
13 public static function loadClassLoader($class)
\r
15 if ('Composer\Autoload\ClassLoader' === $class) {
\r
16 require __DIR__ . '/autoloader/ClassLoader.php';
\r
20 public static function getLoader()
\r
22 if (null !== self::$loader) {
\r
23 return self::$loader;
\r
26 spl_autoload_register(array('FriendicaAutoloaderInit', 'loadClassLoader'), true, true);
\r
27 self::$loader = $loader = new \Composer\Autoload\ClassLoader();
\r
28 spl_autoload_unregister(array('FriendicaAutoloaderInit', 'loadClassLoader'));
\r
31 $map = require __DIR__ . '/autoloader/autoload_namespaces.php';
\r
32 foreach ($map as $namespace => $path) {
\r
33 $loader->set($namespace, $path);
\r
36 $map = require __DIR__ . '/autoloader/autoload_psr4.php';
\r
37 foreach ($map as $namespace => $path) {
\r
38 $loader->setPsr4($namespace, $path);
\r
41 $classMap = require __DIR__ . '/autoloader/autoload_classmap.php';
\r
43 $loader->addClassMap($classMap);
\r
46 $loader->register(true);
\r
48 $includeFiles = require __DIR__ . '/autoloader/autoload_files.php';
\r
49 foreach ($includeFiles as $fileIdentifier => $file) {
\r
50 friendicaRequire($fileIdentifier, $file);
\r
58 function friendicaRequire($fileIdentifier, $file)
\r
60 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
\r
63 $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
\r
69 return FriendicaAutoloaderInit::getLoader();
\r