Beispiel #1
0
 /**
  * Add new autoloader to the stack.
  *
  * @param string $namespace Namespace.
  * @param string $path      Path.
  * @param string $separator Separator, _ or \\.
  *
  * @return void
  */
 public static function addAutoloader($namespace, $path = '', $separator = '_')
 {
     if (in_array($namespace, self::$autoloaders->getNamespaces())) {
         return;
     }
     if ($separator == '_') {
         return self::$autoloaders->registerPrefix($namespace . '_', $path);
     }
     self::$autoloaders->register($namespace, $path, $separator);
 }
Beispiel #2
0
 /**
  * Constructor
  *
  * @param KernelInterface $kernel
  */
 public function __construct(KernelInterface $kernel)
 {
     // register email address proxy class loader
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces([self::ENTITY_PROXY_NAMESPACE => $kernel->getCacheDir() . DIRECTORY_SEPARATOR . self::CACHED_ENTITIES_DIR_NAME]);
     $loader->register();
 }
Beispiel #3
0
function sf2AutoLoad()
{
    $loader = new UniversalClassLoader();
    $loader->registerNamespaces(array('Sf2Plugins' => __DIR__ . '/src'));
    $loader->registerPrefixes(array('Twig_Extensions_' => __DIR__ . '/lib/Twig-extensions/lib', 'Twig_' => __DIR__ . '/lib/Twig/lib'));
    $loader->register();
}
Beispiel #4
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection($app['routes']);
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () {
         return new ControllerResolver();
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
 }
 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();
 }
Beispiel #6
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());
 }
Beispiel #7
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
Beispiel #8
0
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['basedir'] = __DIR__ . '/../../../..';
     $this->register_twig();
     $this->register_markdown();
 }
 /**
  * Check for composer in Namespace
  * and include via phar if possible
  */
 public static function checkComposer($pathToComposer = null)
 {
     if (!class_exists("Composer\\Factory")) {
         if (false === ($pathToComposer = self::whichComposer($pathToComposer))) {
             throw new \RuntimeException("Could not find composer.phar");
         }
         \Phar::loadPhar($pathToComposer, 'composer.phar');
         $loader = new UniversalClassLoader();
         $namespaces = (include "phar://composer.phar/vendor/composer/autoload_namespaces.php");
         $loader->registerNamespaces(array_merge(array('Composer' => "phar://composer.phar/src/"), $namespaces));
         $loader->register(true);
     }
 }
 /**
  * Initialise.
  *
  * Runs at plugin init time.
  *
  * @return void
  */
 public function initialize(GenericEvent $event)
 {
     // register namespace
     // Because the standard kernel classloader already has Doctrine registered as a namespace
     // we have to add a new loader onto the spl stack.
     $autoloader = new UniversalClassLoader();
     $autoloader->register();
     $autoloader->registerNamespaces(array('DoctrineProxy' => 'ztemp/doctrinemodels'));
     $container = $event->getDispatcher()->getContainer();
     $config = $GLOBALS['ZConfig']['DBInfo']['databases']['default'];
     $dbConfig = array('host' => $config['host'], 'user' => $config['user'], 'password' => $config['password'], 'dbname' => $config['dbname'], 'driver' => 'pdo_' . $config['dbdriver']);
     $r = new \ReflectionClass('Doctrine\\Common\\Cache\\' . $container['dbcache.type'] . 'Cache');
     $dbCache = $r->newInstance();
     $ORMConfig = new \Doctrine\ORM\Configuration();
     $container->set('doctrine.configuration', $ORMConfig);
     $ORMConfig->setMetadataCacheImpl($dbCache);
     // create proxy cache dir
     \CacheUtil::createLocalDir('doctrinemodels');
     // setup annotations base
     include_once \ZLOADER_PATH . '/../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php';
     // setup annotation reader
     $reader = new \Doctrine\Common\Annotations\AnnotationReader();
     $cacheReader = new \Doctrine\Common\Annotations\CachedReader($reader, new \Doctrine\Common\Cache\ArrayCache());
     $container->set('doctrine.annotationreader', $cacheReader);
     // setup annotation driver
     $annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($cacheReader);
     $container->set('doctrine.annotationdriver', $annotationDriver);
     // setup driver chains
     $driverChain = new \Doctrine\ORM\Mapping\Driver\DriverChain();
     $container->set('doctrine.driverchain', $driverChain);
     // configure Doctrine ORM
     $ORMConfig->setMetadataDriverImpl($annotationDriver);
     $ORMConfig->setQueryCacheImpl($dbCache);
     $ORMConfig->setProxyDir(\CacheUtil::getLocalDir('doctrinemodels'));
     $ORMConfig->setProxyNamespace('DoctrineProxy');
     if (isset($container['log.enabled']) && $container['log.enabled']) {
         $ORMConfig->setSQLLogger(new \Zikula\Core\Doctrine\Logger\ZikulaSqlLogger());
     }
     // setup doctrine eventmanager
     $dispatcher = new \Doctrine\Common\EventManager();
     $container->set('doctrine.eventmanager', $dispatcher);
     // setup MySQL specific listener (storage engine and encoding)
     if ($config['dbdriver'] == 'mysql') {
         $mysqlSessionInit = new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit($config['charset']);
         $dispatcher->addEventSubscriber($mysqlSessionInit);
     }
     // setup the doctrine entitymanager
     $entityManager = \Doctrine\ORM\EntityManager::create($dbConfig, $ORMConfig, $dispatcher);
     $container->set('doctrine.entitymanager', $entityManager);
 }
Beispiel #11
0
 /**
  * Initialise.
  *
  * Runs at plugin init time.
  *
  * @return void
  */
 public function initialize()
 {
     $autoloader = new UniversalClassLoader();
     $autoloader->register();
     $autoloader->register('DoctrineExtensions\\StandardFields', __DIR__ . '/lib');
     Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Gedmo', dirname(__DIR__) . '/../vendor/gedmo/doctrine-extensions/lib');
     Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('DoctrineExtensions\\StandardFields', __DIR__ . '/lib');
     include 'ExtensionsManager.php';
     $definition = new Definition('SystemPlugins_DoctrineExtensions_ExtensionsManager', array(new Reference('doctrine.eventmanager'), new Reference('service_container')));
     $this->container->setDefinition('doctrine_extensions', $definition);
     $types = array('Loggable', 'Sluggable', 'Timestampable', 'Translatable', 'Tree', 'Sortable');
     foreach ($types as $type) {
         // The listener for Translatable is incorrectly named TranslationListener
         if ($type != "Translatable") {
             $definition = new Definition("Gedmo\\{$type}\\{$type}Listener");
         } else {
             $definition = new Definition("Gedmo\\Translatable\\TranslationListener");
         }
         $this->container->setDefinition(strtolower("doctrine_extensions.listener.{$type}"), $definition);
     }
     $definition = new Definition("DoctrineExtensions\\StandardFields\\StandardFieldsListener");
     $this->container->setDefinition(strtolower("doctrine_extensions.listener.standardfields"), $definition);
 }
 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();
     }
 }
Beispiel #13
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection();
     });
     $this['exception_handler'] = $this->share(function () {
         return new ExceptionHandler();
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         $urlMatcher = new LazyUrlMatcher(function () use($app) {
             return $app['url_matcher'];
         });
         $dispatcher->addSubscriber(new RouterListener($urlMatcher));
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () use($app) {
         return new ControllerResolver($app);
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request_context'] = $this->share(function () use($app) {
         $context = new RequestContext();
         $context->setHttpPort($app['request.http_port']);
         $context->setHttpsPort($app['request.https_port']);
         return $context;
     });
     $this['url_matcher'] = $this->share(function () use($app) {
         return new RedirectableUrlMatcher($app['routes'], $app['request_context']);
     });
     $this['request.default_locale'] = 'en';
     $this['request'] = function () {
         throw new \RuntimeException('Accessed request service outside of request scope. Try moving that call to a before handler or controller.');
     };
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
Beispiel #14
0
 public function __construct()
 {
     $this->rootDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999);
     if (!is_dir($this->rootDir)) {
         if (false === @mkdir($this->rootDir)) {
             exit(sprintf('Unable to create a temporary directory (%s)', $this->rootDir));
         }
     } elseif (!is_writable($this->rootDir)) {
         exit(sprintf('Unable to write in a temporary directory (%s)', $this->rootDir));
     }
     parent::__construct('env', true);
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces(array('TestBundle' => __DIR__ . '/Fixtures/', 'TestApplication' => __DIR__ . '/Fixtures/'));
     $loader->register();
 }
Beispiel #15
0
 public function __construct()
 {
     $this->tmpDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999);
     if (!is_dir($this->tmpDir)) {
         if (false === @mkdir($this->tmpDir)) {
             die(sprintf('Unable to create a temporary directory (%s)', $this->tmpDir));
         }
     } elseif (!is_writable($this->tmpDir)) {
         die(sprintf('Unable to write in a temporary directory (%s)', $this->tmpDir));
     }
     parent::__construct('env', true);
     require_once __DIR__ . '/FacebookApiException.php';
     $loader = new UniversalClassLoader();
     $loader->loadClass('\\FacebookApiException');
     $loader->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);
 }
Beispiel #17
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection();
     });
     $this['exception_handler'] = $this->share(function () {
         return new ExceptionHandler();
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         if (isset($app['exception_handler'])) {
             $dispatcher->addSubscriber($app['exception_handler']);
         }
         $dispatcher->addSubscriber(new ResponseListener($app['charset']));
         $dispatcher->addSubscriber(new RouterListener($app['url_matcher']));
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () use($app) {
         return new ControllerResolver($app);
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request_context'] = $this->share(function () use($app) {
         $context = new RequestContext();
         $context->setHttpPort($app['request.http_port']);
         $context->setHttpsPort($app['request.https_port']);
         return $context;
     });
     $this['url_matcher'] = $this->share(function () use($app) {
         return new RedirectableUrlMatcher($app['routes'], $app['request_context']);
     });
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
Beispiel #18
0
 /**
  * An array of file paths retrieved from {@see files()}.
  *
  * @param  array  $files A list of file paths.
  * @return array         A list of classes.
  */
 public static function classes(array $files)
 {
     $loader = new UniversalClassLoader();
     // Support PSR-0 autoloading with a composer.json file
     // @todo: Add support for Composer's classmap autoloading.
     if (file_exists(VANITY_PROJECT_WORKING_DIR . '/vendor/composer/autoload_namespaces.php')) {
         // Register namespaces with the class loader
         $loader->registerNamespaces(include VANITY_PROJECT_WORKING_DIR . '/vendor/composer/autoload_namespaces.php');
     } elseif (file_exists(VANITY_PROJECT_WORKING_DIR . '/composer.json')) {
         // Register namespaces with the class loader
         $composer = json_decode(file_get_contents(VANITY_PROJECT_WORKING_DIR . '/composer.json'), true);
         if (isset($composer['autoload']) && isset($composer['autoload']['psr-0'])) {
             $loader->registerNamespaces($composer['autoload']['psr-0']);
         }
     }
     $loader->register();
     $class_list = array();
     // Collect all current classes, interfaces and traits
     if (SystemStore::get('_.php54')) {
         $before = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
     } else {
         $before = array_merge(get_declared_classes(), get_declared_interfaces());
     }
     foreach ($files as $file) {
         include_once $file;
     }
     // Handle traits if this version of PHP supports them.
     if (SystemStore::get('_.php54')) {
         $after = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
     } else {
         $after = array_merge(get_declared_classes(), get_declared_interfaces());
     }
     // We should be able to document ourselves
     if (defined('VANITY_AM_I')) {
         $after = array_filter($after, function ($class) {
             return substr($class, 0, 7) !== 'Vanity\\';
         });
     }
     $class_list = array_values(array_unique(array_diff($after, $before)));
     sort($class_list);
     return $class_list;
 }
Beispiel #19
0
/* load vendors */
require_once $racine . 'vendor/autoload.php';
/**
 * symfony autoloader
 */
//require_once $racine . 'vendor/symfony/class-loader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
//global $loader;
$autoloader = new UniversalClassLoader();
// enregistrez les espaces de noms et préfixes ici (voir ci-dessous)
//$loader->registerNamespace('Grr\Event', $racine . 'src/Grr/Event');
//$loader->registerNamespace('Grr', $racine . 'src/Grr/Event');
$autoloader->registerNamespace('Grr', $racine . 'src');
// vous pouvez rechercher dans l'« include_path » en dernier recours.
//$loader->useIncludePath(true);
$autoloader->register();
/*
 * Twig init
 */
global $twig;
$loader = new Twig_Loader_Filesystem([$racine . 'src/Grr/Resources/Templates/' . $template . '/views/', $racine . 'src/Plugins/']);
/*
 * debug true, and profiler, only for dev env, todo : manage env dev or prod
 */
/*$twig = new Twig_Environment($loader, array(
    'cache' => $racine.'app/cache/',
    'debug' => false,
));*/
$twig = new Twig_Environment($loader, array('cache' => false, 'debug' => true));
$twig->addExtension(new Twig_Extension_Debug());
/*
 /**
  * Registers the extended entity namespace in the autoloader.
  *
  * @param string $cacheDir
  */
 public static function registerClassLoader($cacheDir)
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces(array('Extend\\' => $cacheDir . '/oro_entities'));
     $loader->register();
 }
Beispiel #21
0
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */
// Load configuration and UniversalClassLoader
// Introduces $orchestraConfig into the global namespace
include_once __DIR__ . '/../config.php';
include_once $orchestraConfig['vendorDir'] . '/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
/**
* Create an instance of UniversalClassLoader and register
* all prefixes / namespaces which are part of Orchestra
*/
$orchestraClassLoader = new UniversalClassLoader();
$orchestraClassLoader->registerPrefixes(array('Twig_' => $orchestraConfig['vendorDir'] . '/twig/twig/lib'));
$orchestraClassLoader->registerNamespaces(array('Symfony\\Component\\Yaml' => $orchestraConfig['vendorDir'] . '/symfony/yaml/', 'Symfony\\Component\\Validator' => $orchestraConfig['vendorDir'] . '/symfony/validator/', 'Symfony\\Component\\Translation' => $orchestraConfig['vendorDir'] . '/symfony/translation/', 'Symfony\\Component\\OptionsResolver' => $orchestraConfig['vendorDir'] . '/symfony/options-resolver/', 'Symfony\\Component\\Locale' => $orchestraConfig['vendorDir'] . '/symfony/locale/', 'Symfony\\Component\\HttpKernel' => $orchestraConfig['vendorDir'] . '/symfony/http-kernel/', 'Symfony\\Component\\HttpFoundation' => $orchestraConfig['vendorDir'] . '/symfony/http-foundation/', 'Symfony\\Component\\Form' => $orchestraConfig['vendorDir'] . '/symfony/form/', 'Symfony\\Component\\EventDispatcher' => $orchestraConfig['vendorDir'] . '/symfony/event-dispatcher/', 'Symfony\\Component\\Console' => $orchestraConfig['vendorDir'] . '/symfony/console/', 'Symfony\\Component\\Config' => $orchestraConfig['vendorDir'] . '/symfony/config/', 'Symfony\\Component\\ClassLoader' => $orchestraConfig['vendorDir'] . '/symfony/class-loader/', 'Symfony\\Component\\Filesystem' => $orchestraConfig['vendorDir'] . '/symfony/filesystem/', 'Symfony\\Component\\PropertyAccess' => $orchestraConfig['vendorDir'] . '/symfony/property-access/', 'Symfony\\Bridge\\Twig' => $orchestraConfig['vendorDir'] . '/symfony/twig-bridge/', 'SessionHandlerInterface' => $orchestraConfig['vendorDir'] . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs', 'Doctrine\\ORM' => $orchestraConfig['vendorDir'] . '/doctrine/orm/lib/', 'Doctrine\\DBAL' => $orchestraConfig['vendorDir'] . '/doctrine/dbal/lib/', 'Doctrine\\Common' => $orchestraConfig['vendorDir'] . '/doctrine/common/lib/', 'Orchestra' => __DIR__ . '/../src/'));
$orchestraClassLoader->register();
Beispiel #22
0
    return implode('/', $urlParts) . '/';
}
if (get_magic_quotes_gpc()) {
    throw new Exception("magic_quotes_gpc is not supported");
}
/******************************************************************************
 * Constants
 *****************************************************************************/
define('ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define('ROOT_URL', get_base_url());
ini_set("include_path", ROOT_PATH . 'libs' . DIRECTORY_SEPARATOR);
$loader = (require_once ROOT_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
use Symfony\Component\ClassLoader\UniversalClassLoader;
$universalLoader = new UniversalClassLoader();
$universalLoader->useIncludePath(true);
$universalLoader->register();
require_once 'Zend/Db/Adapter/Mysqli.php';
/******************************************************************************
 * Loading of the options (default & user)
 *****************************************************************************/
if (!file_exists(ROOT_PATH . "options.php")) {
    die("The file options.php should exists, please read the instructions inside of 'options.php-example'.");
}
require_once ROOT_PATH . "options_default.php";
require_once ROOT_PATH . "options.php";
/******************************************************************************
 * Initialize all the global variables
 *****************************************************************************/
require_once ROOT_PATH . '/services.php';
$g_database = new Zend_Db_Adapter_Mysqli($g_options['mysql']);
$g_database->setFetchMode(Zend_Db::FETCH_OBJ);
Beispiel #23
0
 /**
  * 
  */
 public function init()
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('Symfony', APPLICATION_PATH . '/../library');
     $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"));
Beispiel #25
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection();
     });
     $this['exception_handler'] = $this->share(function () {
         return new ExceptionHandler();
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         $urlMatcher = new LazyUrlMatcher(function () use($app) {
             return $app['url_matcher'];
         });
         $dispatcher->addSubscriber(new RouterListener($urlMatcher));
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () use($app) {
         return new ControllerResolver($app);
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request_context'] = $this->share(function () use($app) {
         $context = new RequestContext();
         $context->setHttpPort($app['request.http_port']);
         $context->setHttpsPort($app['request.https_port']);
         return $context;
     });
     $this['url_matcher'] = $this->share(function () use($app) {
         return new RedirectableUrlMatcher($app['routes'], $app['request_context']);
     });
     $this['route_middlewares_trigger'] = $this->protect(function (KernelEvent $event) use($app) {
         foreach ($event->getRequest()->attributes->get('_middlewares', array()) as $callback) {
             $ret = call_user_func($callback, $event->getRequest());
             if ($ret instanceof Response) {
                 $event->setResponse($ret);
                 return;
             } elseif (null !== $ret) {
                 throw new \RuntimeException('Middleware for route "' . $event->getRequest()->attributes->get('_route') . '" returned an invalid response value. Must return null or an instance of Response.');
             }
         }
     });
     $this['request.default_locale'] = 'en';
     $this['request'] = function () {
         throw new \RuntimeException('Accessed request service outside of request scope. Try moving that call to a before handler or controller.');
     };
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
Beispiel #26
0
<?php

use Symfony\Component\ClassLoader\UniversalClassLoader;
require_once __DIR__ . '/../vendor/symfony/lib/Symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('BattleNet' => __DIR__ . '/../lib', 'BattleNet\\Tests' => __DIR__ . '/../tests', 'Doctrine\\Common' => __DIR__ . '/../vendor/doctrine-common/lib'));
$loader->register();
Beispiel #27
0
<?php

require_once __DIR__ . '/../vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__ . '/../vendor/propel/runtime/lib/Propel.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$classLoader = new UniversalClassLoader();
$classLoader->registerNamespaces(array('Pagerfanta\\Tests' => __DIR__, 'Pagerfanta' => __DIR__ . '/../src', 'Mandango' => __DIR__ . '/../vendor/mandango/src', 'Doctrine\\Common' => __DIR__ . '/../vendor/doctrine-common/lib', 'Doctrine\\MongoDB' => __DIR__ . '/../vendor/doctrine-mongodb/lib', 'Doctrine\\ODM\\MongoDB' => __DIR__ . '/../vendor/doctrine-mongodb-odm/lib', 'Doctrine\\DBAL' => __DIR__ . '/../vendor/doctrine-dbal/lib', 'Doctrine\\ORM' => __DIR__ . '/../vendor/doctrine-orm/lib'));
$classLoader->register();