/**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->container->hasParameter('es.proxy_paths')) {
         $loader = new MapClassLoader($this->container->getParameter('es.proxy_paths'));
         $loader->register();
     }
 }
 /**
  * Register Class Loader
  *
  * @param string $cacheDir
  */
 public static function registerClassLoader($cacheDir)
 {
     $path = sprintf('%s/%s/classes.map', $cacheDir, ThriftCompileCacheWarmer::CACHE_SUFFIX);
     $classMap = (require $path);
     $l = new MapClassLoader($classMap);
     $l->register();
 }
 protected function compile()
 {
     //Build cache
     $this->compiler = new ThriftCompiler();
     $this->compiler->setModelPath($this->modelPath);
     $this->compiler->compile($this->definitionPath, true);
     // Init Loader
     $l = new MapClassLoader(ClassMapGenerator::createMap($this->modelPath));
     $l->register();
 }
 /**
  * The Symfony ClassLoader does not support class maps.
  */
 public function addClassMap(array $classMap)
 {
     if ($this->classMap) {
         $this->classMap = array_merge($this->classMap, $classMap);
     } else {
         $this->classMap = $classMap;
     }
     // Set the parent's $map variable.
     parent::__construct($this->classMap);
 }
 /**
  * Listener disables the Drupal registry and replaces it with
  * a set of class maps.
  */
 public function onBootstrapDatabase()
 {
     spl_autoload_unregister('drupal_autoload_class');
     spl_autoload_unregister('drupal_autoload_interface');
     global $install_state;
     if (isset($install_state['parameters']['profile'])) {
         $profile = $install_state['parameters']['profile'];
     } else {
         $profile = variable_get('install_profile', 'standard');
     }
     $searchdirs = array();
     $searchdirs[] = DRUPAL_ROOT;
     $searchdirs[] = DRUPAL_ROOT . '/profiles/' . $profile;
     $searchdirs[] = DRUPAL_ROOT . '/sites/all';
     $searchdirs[] = DRUPAL_ROOT . '/' . conf_path();
     foreach ($searchdirs as $dir) {
         $filename = $dir . '/classmap.php';
         if (file_exists($filename)) {
             $loader = new MapClassLoader(require $filename);
             $loader->register(true);
         }
     }
 }
Exemple #6
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php';
require_once __DIR__ . '/../vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__ . '/../vendor/symfony/class-loader/Symfony/Component/ClassLoader/MapClassLoader.php';
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Symfony\Component\ClassLoader\MapClassLoader;
$namespaces = (include __DIR__ . '/../vendor/composer/autoload_namespaces.php');
$loader = new UniversalClassLoader();
$loader->registerNamespaces($namespaces);
$loader = new ApcClassLoader('open_dradio_rest_api.', $loader);
$loader->register(true);
$mapping = (include __DIR__ . '/../vendor/composer/autoload_classmap.php');
if (!empty($mapping)) {
    $loader = new MapClassLoader($mapping);
    $loader->register();
}
Exemple #7
0
 /**
  * Maps a package controller's class name to the file
  * @param string $pkgHandle Handle of package
  */
 public function registerPackageController($pkgHandle)
 {
     $symfonyLoader = new SymfonyMapClassloader(array(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Controller' => DIR_PACKAGES . '/' . $pkgHandle . '/' . FILENAME_PACKAGE_CONTROLLER));
     $symfonyLoader->register();
 }
 protected function setupMapClassAutoloader()
 {
     $mapping = array('Loader' => DIR_BASE_CORE . '/' . DIRNAME_CLASSES . '/Legacy/Loader.php', 'TaskPermission' => DIR_BASE_CORE . '/' . DIRNAME_CLASSES . '/Legacy/TaskPermission.php', 'FilePermissions' => DIR_BASE_CORE . '/' . DIRNAME_CLASSES . '/Legacy/FilePermissions.php');
     $loader = new SymfonyMapClassloader($mapping);
     $loader->register();
 }
namespace {
    require_once __DIR__ . '/vendor/autoload.php';
    use Dima\Legacy\TestClass as TestLoadedByMap;
    use Dima\Test as TestPsr0;
    use Symfony\Component\ClassLoader\ClassLoader;
    use Symfony\Component\ClassLoader\ClassMapGenerator;
    use Symfony\Component\ClassLoader\MapClassLoader;
    use Symfony\Component\ClassLoader\Psr4ClassLoader;
    use Symfony\Component\ClassLoader\XcacheClassLoader;
    use DG\SymfonyCert\Controller\HomeController;
    $psr0Loader = new ClassLoader();
    $psr0Loader->addPrefix('Dima', __DIR__ . '/srcPsr0');
    $cachedLoader = new XcacheClassLoader(sha1(__FILE__), $psr0Loader);
    $cachedLoader->register();
    $psr0Loader->unregister();
    $psr4Loader = new Psr4ClassLoader();
    $psr4Loader->addPrefix('DG\\SymfonyCert\\', __DIR__ . '/src');
    $psr4Loader->register();
    $mapLoader = new MapClassLoader(['Dima\\Legacy\\TestClass' => __DIR__ . '/srcPsr0/TestClass.php']);
    $mapLoader->register();
    ClassMapGenerator::dump(__DIR__ . '/srcThirdParty', __DIR__ . '/class_map.php');
    $classMap = (include __DIR__ . '/class_map.php');
    $mapLoader2 = new MapClassLoader($classMap);
    $mapLoader2->register();
    //Psr0 loader + XCache
    TestPsr0::output("Hello from Psr0 loaded class!");
    //Map loader
    TestLoadedByMap::test();
    $homeController = new HomeController();
    echo $homeController->indexAction()->getContent(), "\n";
}
<?php

/**
 * Copyright (C) 2015 OpenMediaVault Plugin Developers
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
require_once "Symfony/Component/ClassLoader/ClassLoader.php";
require_once "Symfony/Component/ClassLoader/MapClassLoader.php";
use Symfony\Component\ClassLoader\ClassLoader;
use Symfony\Component\ClassLoader\MapClassLoader;
$loader = new ClassLoader();
$loader->setUseIncludePath(true);
$loader->register();
$mapLoader = new MapClassLoader(["OMVRpc" => "/usr/share/php/openmediavault/rpc.inc", "OMVWebDAV\\Auth\\Openmediavault" => __DIR__ . "/../app/Auth/Openmediavault.php"]);
$mapLoader->register();
 public function registerOverrides()
 {
     // Core overrides
     $dir = DIR_PACKAGES . '/' . $this->pkgHandle;
     $loader = new MapClassLoader(array('Concrete\\Core\\Asset\\CssAsset' => $dir . '/src/Core/Override/Asset/CssAsset.php', 'Concrete\\Core\\Asset\\JavascriptAsset' => $dir . '/src/Core/Override/Asset/JavascriptAsset.php', 'Concrete\\Core\\Page\\Theme\\Theme' => $dir . '/src/Core/Override/Page/Theme/Theme.php', 'Concrete\\Core\\StyleCustomizer\\Preset' => $dir . '/src/Core/Override/StyleCustomizer/Preset.php', 'Concrete\\Core\\StyleCustomizer\\Stylesheet' => $dir . '/src/Core/Override/StyleCustomizer/Stylesheet.php', 'Concrete\\Core\\StyleCustomizer\\Style\\ColorStyle' => $dir . '/src/Core/Override/StyleCustomizer/Style/ColorStyle.php', 'Concrete\\Core\\StyleCustomizer\\Style\\ImageStyle' => $dir . '/src/Core/Override/StyleCustomizer/Style/ImageStyle.php', 'Concrete\\Core\\StyleCustomizer\\Style\\SizeStyle' => $dir . '/src/Core/Override/StyleCustomizer/Style/SizeStyle.php', 'Concrete\\Core\\StyleCustomizer\\Style\\TypeStyle' => $dir . '/src/Core/Override/StyleCustomizer/Style/TypeStyle.php', 'Concrete\\Core\\StyleCustomizer\\Style\\ValueList' => $dir . '/src/Core/Override/StyleCustomizer/Style/ValueList.php'));
     $loader->register(true);
     // For some reason this has to be called MANUALLY (and not through the
     // c5 ClassAliasList) after the loader has been registered because
     // otherwise calling the alias directly will cause the original core
     // class to be loaded for some reason.
     class_alias('Concrete\\Core\\Page\\Theme\\Theme', 'PageTheme');
 }