Example #1
0
 public function registerBundles()
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('SomeProject\\', array(__DIR__));
     $loader->registerNamespace('SomeAnotherProject\\', array(__DIR__));
     $loader->register();
     return array(new \SomeProject\Bundle\SomeBundle\SomeBundle(), new \SomeAnotherProject\Bundle\SomeAnotherBundle\SomeAnotherBundle());
 }
 public static function earlyInitialize()
 {
     $classLoader = new UniversalClassLoader();
     $classLoader->registerNamespace('Stagehand\\TestRunner', array(__DIR__ . '/../../..', __DIR__ . '/../../../../src/Stagehand/TestRunner/Resources/examples'));
     $classLoader->registerPrefix('Stagehand_TestRunner_', __DIR__ . '/../../../../src/Stagehand/TestRunner/Resources/examples');
     $classLoader->register();
 }
Example #3
0
 /**
  * @param string $ns Namespace's description
  * @param string $path Namespace's path
  * @throws Exception
  */
 public static function registerNamespace($ns, $path)
 {
     switch (true) {
         case self::$loader instanceof \Composer\Autoload\ClassLoader:
             self::$loader->add($ns, $path);
             break;
         case self::$loader instanceof \Zend\Loader\SplAutoloader:
             self::$loader->registerPrefix($ns, $path . '/' . $ns);
             break;
             // @TODO: This hasn't been tested nor confirmed. Must test & check if OK.
         // @TODO: This hasn't been tested nor confirmed. Must test & check if OK.
         case self::$loader instanceof \Symfony\Component\ClassLoader\UniversalClassLoader:
             self::$loader->registerNamespace($ns, $path);
             break;
         default:
             throw new \Exception('No Loader detected!');
     }
 }
 /**
  * @dataProvider getLoadClassFromFallbackTests
  */
 public function testLoadClassFromFallback($className, $testClassName, $message)
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('Namespaced', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures');
     $loader->registerPrefix('Pearlike_', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures');
     $loader->registerNamespaceFallbacks(array(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures/fallback'));
     $loader->registerPrefixFallbacks(array(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures/fallback'));
     $loader->loadClass($testClassName);
     $this->assertTrue(class_exists($className), $message);
 }
 protected function configureClassLoader()
 {
     if (!class_exists('Stagehand\\TestRunner\\Core\\Environment')) {
         if (!class_exists('Symfony\\Component\\ClassLoader\\UniversalClassLoader', false)) {
             require_once 'Symfony/Component/ClassLoader/UniversalClassLoader.php';
         }
         $includePaths = explode(PATH_SEPARATOR, get_include_path());
         $classLoader = new UniversalClassLoader();
         foreach (self::$namespaces as $namespace) {
             $classLoader->registerNamespace($namespace, $includePaths);
         }
         $classLoader->register();
     }
 }
 public static function earlyInitialize()
 {
     $classLoader = new UniversalClassLoader();
     $classLoader->registerNamespace('Stagehand\\TestRunner', array(__DIR__ . '/../../..', __DIR__ . '/../../../../examples'));
     $classLoader->registerPrefix('Stagehand_TestRunner_', __DIR__ . '/../../../../examples');
     $classLoader->register();
     self::$applicationContext = new TestApplicationContext();
     self::$applicationContext->setComponentFactory(new TestComponentFactory());
     self::$applicationContext->setEnvironment(new self());
     self::$applicationContext->setPlugin(PluginRepository::findByPluginID(PHPUnitPlugin::getPluginID()));
     ApplicationContext::setInstance(self::$applicationContext);
     $container = new Container();
     $transformation = new Transformation($container);
     $transformation->transformToContainerParameters();
     ApplicationContext::getInstance()->getComponentFactory()->setContainer($container);
 }
Example #7
0
<?php

/**
 * This files starts our engine all files are included and autoloaded here
 * 
 * @package = Scrawler
 * @author = Pranjal Pandey
 * 
 */
//we depend on Symfony ClassLoader for loading our classes
require_once __DIR__ . '/../external/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->register();
//loading our classes using PSR-0 rules
$loader->registerNamespace('Scrawler', __DIR__ . '/../');
$loader->registerNamespace('League', __DIR__ . '/../external/');
require __DIR__ . '/../external/Toro.php';
//initialize our main class
$scrawler = new \Scrawler\Core\Scrawler();
Example #8
0
<?php

require_once __DIR__ . '/../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Monolog', __DIR__ . '/../vendor/monolog/src');
$loader->register();
Example #9
0
<?php

use Symfony\Component\ClassLoader\UniversalClassLoader, Symfony\Component\Config, Symfony\Component\Yaml\Yaml;
//Define PATHS
define('ROOT_PATH', __DIR__ . '/../');
define('LIB_PATH', ROOT_PATH . 'library/');
define('TPL_PATH', ROOT_PATH . 'templates/');
define('CFG_PATH', ROOT_PATH . 'config/');
//Load Silex
require LIB_PATH . 'vendor/silex.phar';
set_include_path(get_include_path() . PATH_SEPARATOR . LIB_PATH . 'vendor/');
//Get Namespace Autoloader
$loader = new UniversalClassLoader();
$loader->registerNamespace('App', LIB_PATH);
$loader->registerNamespace('Symfony', LIB_PATH . 'vendor');
$loader->registerNamespace('Extra', LIB_PATH . 'vendor/Extra/Extensions/');
$loader->registerNamespace('Doctrine\\Common', LIB_PATH . 'vendor/Doctrine/doctrine-common/lib');
$loader->registerNamespace('Doctrine\\DBAL', LIB_PATH . 'vendor/Doctrine/doctrine-dbal/lib');
$loader->registerNamespace('Doctrine\\ORM', LIB_PATH . 'vendor/Doctrine/doctrine/lib');
$loader->registerPrefix('Twig_', LIB_PATH . 'vendor/Twig/lib/');
$loader->registerPrefix('Zend_', LIB_PATH . 'vendor/Zend/');
$loader->registerPrefixFallback(explode(PATH_SEPARATOR, get_include_path()));
$loader->register();
Example #10
0
<?php

/*
 * This file is part of the SimHashPhp package.
 *
 * (c) Titouan Galopin <http://titouangalopin.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
include __DIR__ . '/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Leg\SimHash\SimHashFactory;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Leg', __DIR__ . '/../../../..');
$loader->register();
$simHashFactory = new SimHashFactory();
Example #11
0
<?php

$vendorDir = realpath(__DIR__ . '/..') . '/vendor';
if (!is_dir($vendorDir)) {
    fputs(STDERR, basename($vendorDir) . " directory does not exist.\n" . "You must run the following commands:\n" . "curl -s http://getcomposer.org/installer | php\n" . "php composer.phar install --dev\n");
    exit(1);
}
require_once $vendorDir . '/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Socloz\\NsqBundle', realpath(__DIR__ . '/../..'));
$loader->register();
Example #12
0
<?php

/**
 * Class loader
 *
 * @package SVNClient
 * @link    https://github.com/PhenX/svnclient
 * @author  Fabien Ménager <*****@*****.**>
 * @license MIT License (MIT)
 */
require "vendor/autoload.php";
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace("SVNClient", __DIR__ . "/src");
$loader->register();
}
require PMF_CONFIG_DIR . '/constants.php';
/**
 * The include directory
 */
define('PMF_INCLUDE_DIR', __DIR__);
/**
 * The directory where the translations reside
 */
define('PMF_LANGUAGE_DIR', dirname(__DIR__) . '/lang');
//
// Setting up PSR-0 autoloader for Symfony Components
//
require PMF_INCLUDE_DIR . '/libs/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', PMF_INCLUDE_DIR . '/libs');
$loader->registerPrefix('PMF_', PMF_INCLUDE_DIR);
$loader->register();
//
// Set the error handler to our pmf_error_handler() function
//
set_error_handler('pmf_error_handler');
//
// Create a database connection
//
PMF_Db::setTablePrefix($DB['prefix']);
$db = PMF_Db::factory($DB['type']);
$db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']);
//
// Fetch the configuration and add the database connection
//
Example #14
0
<?php

/**
 * This file is part of the Gerrie package.
 *
 * (c) Andreas Grunwald <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
$currentDir = __DIR__ . DIRECTORY_SEPARATOR;
$vendorFilePath = $currentDir . 'vendor/autoload.php';
if (file_exists($vendorFilePath) === false) {
    $vendorFilePath = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoload.php';
}
if (file_exists($vendorFilePath) === false) {
    throw new \Exception('File "autoload.php" can`t be found', 1368817443);
}
require_once $vendorFilePath;
use Symfony\Component\ClassLoader\UniversalClassLoader;
// Setup own error handler, to throw an exception on any kind of error
function GerrieErrrorHandler($code, $message, $file, $line)
{
    $message = $file . ' (Line: ' . $line . '): ' . $message . ' (' . $code . ')';
    throw new \RuntimeException($message, 1364035754);
}
set_error_handler('GerrieErrrorHandler');
$loader = new UniversalClassLoader();
$loader->registerNamespace('Gerrie', ['src', 'tests']);
$loader->register();
<?php

//echo $_SERVER['SYMFONY'];
//echo '--';
//var_dump($_SERVER);
//require_once $_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once '/home/tonioth/htdocs/cynergiae_git/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', "/home/tonioth/htdocs/cynergiae_git/vendor/symfony/src");
//$loader->registerNamespace('Symfony', $_SERVER['SYMFONY']);
$loader->register();
spl_autoload_register(function ($class) {
    if (0 === strpos($class, 'Nutellove\\JavascriptClassBundle\\')) {
        $path = implode('/', array_slice(explode('\\', $class), 2)) . '.php';
        require_once __DIR__ . '/../' . $path;
        return true;
    }
});
Example #16
0
<?php

require_once dirname(dirname(__DIR__)) . '/lib/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Assetic', dirname(dirname(__DIR__)) . '/lib');
$loader->registerNamespace('SubjectsPlus', dirname(dirname(__DIR__)) . '/lib');
$loader->registerNamespace('CSSMin', dirname(dirname(__DIR__)) . '/lib');
$loader->registerNamespace('RichterLibrary', dirname(dirname(__DIR__)) . '/lib');
$loader->registerNamespace('HTMLPurifier', dirname(dirname(__DIR__)) . '/lib');
$loader->register();
Example #17
0
<?php

define('PROJECT_BASE', realpath(__DIR__ . '/../../../../'));
require_once PROJECT_BASE . '/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', PROJECT_BASE);
$loader->register();
spl_autoload_register(function ($class) {
    if (0 === strpos($class, 'RickySu\\TagcacheBundle\\')) {
        $path = implode('/', array_slice(explode('\\', $class), 2)) . '.php';
        require_once __DIR__ . '/../' . $path;
        return true;
    }
});
Example #18
0
<?php

require_once './vendor/symfony/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
// You can search the include_path as a last resort.
$loader->useIncludePath(true);
// ... register namespaces and prefixes here - see below
$loader->registerNamespace('Jpgraph', __DIR__ . '/vendor/jpgraph/jpgraph/lib/JpGraph/src');
$loader->register();
<?php

namespace F2Dev\MiniFlow\Test;

require_once __DIR__ . "/../Vendors/ClassLoader/UniversalClassLoader.php";
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('F2Dev\\MiniFlow', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
$loader->register(true);
use F2Dev\MiniFlow;
use F2Dev\MiniFlow\Test;
$startNode = new Test\HelloNode();
$linkS = new Test\RandomLink($startNode);
$testFlow2 = new MiniFlow\MiniFlow("Test Flow", $startNode);
$testFlow1 = Test\TestFlow::getWorkflow();
$linkS->addChild($testFlow1);
$newLink = new Test\RandomLink($testFlow1);
$newNode = new Test\HelloNode($newLink);
MiniFlow\Bases\BaseFactory::unserializeWorkflow(serialize($testFlow2))->execute(array("Message" => "World"));
<?php

/**
 *--------------------------------------------------------------------------
 * Learnosity SDK - Autoloader
 *--------------------------------------------------------------------------
 *
 * Uses the Symfony autoloader to autoload classes. You only need this
 * if you're not using Composer and/or you don't have your own autoloader.
 *
 * Usage - include this file in any location that you want to use the
 * Learnosity SDK.
 *   Eg https://github.com/Learnosity/learnosity-sdk-php/examples/index.php
 */
require_once __DIR__ . '/Vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->register();
$loader->registerNamespace('LearnositySdk', __DIR__ . '/../');
Example #21
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Todo', __DIR__ . '/../src');
$loader->register();
return $loader;
Example #22
0
 /**
  * 
  */
 public function init()
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('Symfony', APPLICATION_PATH . '/../library');
     $loader->register();
 }
Example #23
0
<?php

/**
 * This file is part of the GlorpenPropelBundle package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license GPLv3
 */
require_once $_SERVER['SYMFONY'] . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', $_SERVER['SYMFONY']);
$loader->register();
Example #24
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->register();
$loader->registerNamespace('CentralApps', array(__DIR__ . '/../src', __DIR__));
Example #25
0
<?php

require_once __DIR__ . '/../silex.phar';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('SilexExtension', __DIR__ . '/../src');
$loader->register();
<?php

// This is for my examples
require '_system/config.php';
// This is how you autoload with Symfony
require '_system/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('PHPGoogleMaps', '../');
$loader->register();
$map_options = array('map_id' => 'map23', 'draggable' => false, 'center' => 'San Diego, CA', 'height' => '600px', 'width' => '600px', 'zoom' => 10, 'bicycle_layer' => true);
$map = new \PHPGoogleMaps\Map($map_options);
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Symfony Class Loader - <?php 
echo PAGE_TITLE;
?>
</title>
	<link rel="stylesheet" type="text/css" href="_css/style.css">
	<?php 
$map->printHeaderJS();
?>
	<?php 
$map->printMapJS();
?>
</head>
<body>
Example #27
0
<?php

require __DIR__.'/vendor/symfony-class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();

$loader->registerNamespace('WMHSim',    __DIR__.'/src');

$loader->register();
Example #28
0
<?php

$file = __DIR__ . '/../vendor/autoload.php';
if (!file_exists($file)) {
    throw new RuntimeException('Install dependencies to run test suite. "php composer.phar install --dev"');
}
$loader = (require $file);
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Component\ClassLoader\UniversalClassLoader;
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
AnnotationRegistry::registerAutoloadNamespace('Test', __DIR__ . '/Fixtures/');
/**
 * AnnotationRegistry need some help finding annotation class.
 */
$loader->addClassMap(array('Tpg\\ExtjsBundle\\Annotation\\Model' => __DIR__ . '/../Annotation/Model.php', 'Tpg\\ExtjsBundle\\Annotation\\Direct' => __DIR__ . '/../Annotation/Direct.php', 'Tpg\\ExtjsBundle\\Annotation\\ModelProxy' => __DIR__ . '/../Annotation/ModelProxy.php'));
$loader = new UniversalClassLoader();
$loader->registerNamespace('Test', __DIR__ . '/Fixtures/');
$loader->register();
Example #29
0
<?php

// register autoloader
// git clone git://github.com/symfony/ClassLoader.git
require_once 'ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->register();
$loader->registerNamespace('BackupTask', '.');
$config = (include '/path/to/config.php');
$backupTask = new BackupTask\BackupTask($config);
$backupTask->run();
Example #30
0
<?php

require_once __DIR__ . '/../vendor/silex.phar';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Eyewitness', __DIR__ . '/../src');
$loader->register();
return $loader;