Пример #1
0
 /**
  * @dataProvider prefixCollisionClassProvider
  */
 public function testLoadClassPrefixCollision($prefixes, $className, $message)
 {
     $loader = new UniversalClassLoader();
     $loader->registerPrefixes($prefixes);
     $loader->loadClass($className);
     $this->assertTrue(class_exists($className), $message);
 }
Пример #2
0
 /**
  * @covers Symfony\Component\HttpFoundation\UniversalClassLoader::loadClass
  * @dataProvider testClassProvider
  */
 public function testLoadClass($className, $testClassName, $message)
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('Namespaced', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures');
     $loader->registerPrefix('Pearlike_', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures');
     $loader->loadClass($testClassName);
     $this->assertTrue(class_exists($className), $message);
 }
Пример #3
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);
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces(array('TestBundle' => __DIR__ . '/Fixtures/', 'TestApplication' => __DIR__ . '/Fixtures/'));
     $loader->register();
 }
Пример #4
0
<?php

namespace phpOpenNOS;

require_once __DIR__ . '/../vendor/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('phpOpenNOS' => dirname(__FILE__) . '/..'));
$loader->register();
use phpOpenNOS\Model\Article;
use phpOpenNOS\Model\Video;
use phpOpenNOS\Model\Audio;
use phpOpenNOS\Model\Dayguide;
class OpenNOS
{
    const NEWS = 'nieuws';
    const SPORT = 'sport';
    const SORT_SCORE = 'score';
    const SORT_DATE = 'date';
    protected $apikey;
    protected $typeMapping = array('artikel' => 'phpOpenNOS\\Model\\Article', 'video' => 'phpOpenNOS\\Model\\Video', 'audio' => 'phpOpenNOS\\Model\\Audio');
    public function __construct($apikey)
    {
        $this->apikey = $apikey;
    }
    /**
     * Get the latest articles for the specified category
     *
     * @param string $category
     * @return array
     */
Пример #5
0
 * You should have received a copy of the GNU General Public License
 * and the Lesser GNU General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */
use Symfony\Component\HttpFoundation\UniversalClassLoader, Symfony\Component\Yaml\Yaml, Doctrine\Common\ClassLoader, Flextrine\Config;
// Define a constant pointing to the root of the application
define('ROOT_PATH', dirname(dirname(__FILE__)));
// And anoher pointing to the web-accessible directory
define('WEB_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . "web");
// Set the include path to the lib folder included in the framework
set_include_path(get_include_path() . PATH_SEPARATOR . ROOT_PATH . "/lib");
// Include and configure the classloader - use Symfony's UniversalClassLoader as it supports both
// PHP 5.3 and PEAR style namespaces
require_once "Symfony/Component/HttpFoundation/UniversalClassLoader.php";
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Flextrine' => __DIR__ . "/../lib", 'Doctrine' => __DIR__ . '/../lib', 'Symfony' => __DIR__ . '/../lib/Doctrine'));
$loader->registerPrefixes(array('Zend_' => __DIR__ . "/../lib", 'Flextrine_' => __DIR__ . "/../lib"));
$loader->register();
// Set the session id if it is in the GET parameters
if (isset($_GET["PHPSESSID"])) {
    session_id($_GET["PHPSESSID"]);
}
// Load the main configuration file
$mainConfig = Yaml::load(ROOT_PATH . "/config/config.yml");
Zend_Registry::set("mainConfig", $mainConfig);
// Now we need to decide which application we are supposed to be running.  The logic goes like this:
//  - If there is a GET parameter called 'app' this takes precedence (e.g. gateway.php?app=myflextrineproject)
//  - Otherwise use default_app in the main config.yml
//  - Otherwise throw an error
if (isset($_GET['app'])) {
Пример #6
0
<?php

require_once __DIR__ . '/vendor/symfony/src/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony\\Bootstrapper' => __DIR__, 'Symfony' => __DIR__ . '/vendor/symfony/src/'));
$loader->register();
Пример #7
0
<?php

$vendorDir = __DIR__.'/vendor';

require_once $vendorDir.'/symfony/src/Symfony/Component/HttpFoundation/UniversalClassLoader.php';

use Symfony\Component\HttpFoundation\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony'                        => $vendorDir.'/symfony/src',
    'Application'                    => __DIR__,
    'Bundle'                         => __DIR__,
    'Doctrine\\Common\\DataFixtures' => $vendorDir.'/doctrine-data-fixtures/lib',
    'Doctrine\\Common'               => $vendorDir.'/doctrine-common/lib',
    'Doctrine\\DBAL\\Migrations'     => $vendorDir.'/doctrine-migrations/lib',
    'Doctrine\\ODM\\MongoDB'         => $vendorDir.'/doctrine-mongodb/lib',
    'Doctrine\\DBAL'                 => $vendorDir.'/doctrine-dbal/lib',
    'Doctrine'                       => $vendorDir.'/doctrine/lib',
    'Zend'                           => $vendorDir.'/zend/library',
));
$loader->registerPrefixes(array(
    'Swift_' => $vendorDir.'/swiftmailer/lib/classes',
    'Twig_'  => $vendorDir.'/twig/lib',
));
$loader->register();
Пример #8
0
<?php

require_once $_SERVER['SYMFONY'] . '/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', $_SERVER['SYMFONY']);
$loader->register();
spl_autoload_register(function ($class) {
    if (0 === strpos($class, 'Bundle\\Kris\\FacebookBundle\\')) {
        $path = implode('/', array_slice(explode('\\', $class), 3)) . '.php';
        require_once __DIR__ . '/../' . $path;
        return true;
    }
});
Пример #9
0
<?php

$vendorDir = __DIR__.'/vendor';

require_once $vendorDir.'/symfony/src/Symfony/Component/HttpFoundation/UniversalClassLoader.php';

use Symfony\Component\HttpFoundation\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony'                        => $vendorDir.'/symfony/src',
    'Application'                    => __DIR__,
    'Bundle'                         => __DIR__,
    'Doctrine\\Common\\DataFixtures' => $vendorDir.'/doctrine-data-fixtures/lib',
    'Doctrine\\Common'               => $vendorDir.'/doctrine-common/lib',
    'Doctrine\\DBAL\\Migrations'     => $vendorDir.'/doctrine-migrations/lib',
    'Doctrine\\MongoDB'              => $vendorDir.'/doctrine-mongodb/lib',
    'Doctrine\\ODM\\MongoDB'         => $vendorDir.'/doctrine-mongodb-odm/lib',
    'Doctrine\\DBAL'                 => $vendorDir.'/doctrine-dbal/lib',
    'Doctrine'                       => $vendorDir.'/doctrine/lib',
    'Ariadne'                        => $vendorDir.'/ariadne/lib',
    'Ariadne\\Tests'                 => $vendorDir.'/ariadne/tests',
    'Everzet\\Behat'                 => $vendorDir . '/behat/src',
	'Everzet\\Gherkin'               => $vendorDir . '/behat/src',
    'Zend'                           => $vendorDir.'/zend/library',
));
$loader->registerPrefixes(array(
    'Swift_'           => $vendorDir.'/swiftmailer/lib/classes',
    'Twig_Extensions_' => $vendorDir.'/twig-extensions/lib',
    'Twig_'            => $vendorDir.'/twig/lib',
));
Пример #10
0
<?php

require_once __DIR__ . '/../../../HttpFoundation/UniversalClassLoader.php';
/*
 * This file is part of the Symfony framework.
 *
 * (c) Fabien Potencier <*****@*****.**>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */
use Symfony\Component\HttpFoundation\UniversalClassLoader;
use Symfony\Component\HttpKernel\ClassCollectionLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => __DIR__ . '/../../../../..'));
$loader->register();
if (file_exists(__DIR__ . '/../../bootstrap.php')) {
    unlink(__DIR__ . '/../../bootstrap.php');
}
ClassCollectionLoader::load(array('Symfony\\Component\\HttpKernel\\Bundle\\Bundle', 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface', 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler', 'Symfony\\Component\\HttpKernel\\ClassCollectionLoader'), __DIR__ . '/../..', 'bootstrap', false);
Пример #11
0
<?php

// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
/**
 * Autoloaders
 */
// This line is needed for Zend Framework to work correctly, and for Symfony Universal Class Loader to be found correctly
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
use Symfony\Component\HttpFoundation\UniversalClassLoader;
// http://docs.symfony-reloaded.org/guides/tools/autoloader.html
require_once 'Symfony/Component/HttpFoundation/UniversalClassLoader.php';
$uLoader = new UniversalClassLoader();
$uLoader->registerNamespaces(array('Symfony' => '../library/', 'Doctrine' => '../library/', 'DoctrineExtensions' => '../library/Doctrine/Extensions/', 'App' => '../library/'));
$uLoader->registerPrefix('Zend_', '../library/');
$uLoader->register();
/**
 * Zend_Application
 */
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, realpath(APPLICATION_PATH . '/../config') . '/application.ini');
$application->bootstrap()->run();
Пример #12
0
<?php

/**
 * This file is part of the ImageTransform package.
 * (c) Christian Schaefer <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/vendor/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
/**
 * This file provides automatic class loading.
 *
 * To use it you have to require it once in your code.
 * Afterwards you can simply use all classes in the namespace \ImageTransform.
 * Of course you can use your own auto loading.
 */
$loader = new UniversalClassLoader();
$loader->registerNamespace('ImageTransform', __DIR__ . '/../src');
$loader->register();
Пример #13
0
<?php

use Symfony\Component\HttpFoundation\UniversalClassLoader;
$symfonyDir = $GLOBALS['SYMFONY_PATH'];
$loader = $symfonyDir . 'src/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
require_once $loader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => $symfonyDir . '/src', 'Zend' => $symfonyDir . '/vendor/zend/library'));
$loader->registerPrefixes(array('Twig' => $symfonyDir . '/vendor/twig/lib'));
$loader->register();
require_once __DIR__ . "/../Navigation.php";
require_once __DIR__ . "/../Page/AbstractPage.php";
require_once __DIR__ . "/../Page/RouterPage.php";
require_once __DIR__ . "/../Page/UriPage.php";
require_once __DIR__ . "/../Twig/NavigationExtension.php";
require_once __DIR__ . "/../View/Sitemap.php";
Пример #14
0
<?php

require_once __DIR__ . '/vendor/symfony/src/Symfony/Component/HttpFoundation/UniversalClassLoader.php';
use Symfony\Component\HttpFoundation\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => __DIR__ . '/vendor/symfony/src', 'Silex' => __DIR__));
$loader->register();
Пример #15
0
<?php

use Symfony\Component\HttpFoundation\UniversalClassLoader, Doctrine\DBAL\Migrations\Tools\Console as MigrationsConsole;
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
/**
 * Autoloaders
 */
// This line is needed for Zend Framework to work correctly, and for Symfony Universal Class Loader to be found correctly
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
// http://docs.symfony-reloaded.org/guides/tools/autoloader.html
require_once 'Symfony/Component/HttpFoundation/UniversalClassLoader.php';
$uLoader = new UniversalClassLoader();
$uLoader->registerNamespaces(array('Symfony' => realpath(APPLICATION_PATH . '/../library'), 'Doctrine' => realpath(APPLICATION_PATH . '/../library')));
$uLoader->register();
$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\ORM\Version::VERSION);