/** * Register application namespaces * @return void */ public static function registerNamespaces() { $classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespaces(array('Gedmo' => ROOT_PATH . '/vendor/doctrine-extension/lib', 'Symfony' => ROOT_PATH . '/vendor/symfony/src', 'Statme' => ROOT_PATH . '/src', 'Doctrine\\Common' => ROOT_PATH . '/vendor/doctrine-common/lib', 'Doctrine\\DBAL' => ROOT_PATH . '/vendor/doctrine-dbal/lib', 'Doctrine' => ROOT_PATH . '/vendor/doctrine-orm/lib')); $classLoader->register(); return; }
private function autoloadTestsAndApplication() { // Use Symfony component to sort out PSR-0 compatible autoloading $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Awin', __DIR__ . '/../../src'); $loader->registerNamespace('AwinTest', __DIR__); $loader->register(); }
/** * @see sfPluginConfiguration */ public function initialize() { // Include the Altumo loader. //require_once( dirname(__FILE__) . '/../lib/vendor/altumo/source/php/loader.php' ); //set default timezone date_default_timezone_set('America/Los_Angeles'); //symfony 2 autoloader (for classes with namespaces only) $altumo_php_source_path = __DIR__ . '/../lib/vendor/altumo/source/php'; require_once $altumo_php_source_path . '/Utils/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('sfAltumoPlugin' => __DIR__ . '/../lib', 'Altumo' => $altumo_php_source_path)); $loader->register(); // Add altumo paths to sfConfig sfConfig::set('altumo_plugin_dir', realpath(dirname(__FILE__) . '/../')); sfConfig::set('altumo_javascript_lib_dir', sfConfig::get('altumo_plugin_dir') . '/lib/vendor/altumo/lib/javascript'); sfConfig::set('altumo_javascript_src_dir', sfConfig::get('altumo_plugin_dir') . '/lib/vendor/altumo/source/javascript'); /** * If the AWS module is enabled, set credentials for sdk * * To enable, add a section to settings.yml, like so: * sfAltumoPlugin: * aws: * enable: true * key: "MY_AWS_KE_HERE" * secret: "MY_AWS_SECRET_HERE" */ $aws_configuration = sfConfig::get('sf_sfAltumoPlugin_aws', array('enable' => false)); if ($aws_configuration['enable']) { CFCredentials::set(array('default' => array('key' => $aws_configuration['key'], 'secret' => $aws_configuration['secret'], 'default_cache_config' => '', 'certificate_authority' => false), '@default' => 'default')); } // Add altumo Api Settings (Add this in your api app's config) //sfConfig::set( 'altumo_api_session_cookie_name', 'api_session' ); /** * Execute any commands that the plugin needs when the framework loads, but * before an action is executed. * * Note: this is here because it was used before to load JS and CSS, but * that was relocated to Frontend\Controller */ /* $this->dispatcher->connect( 'context.load_factories', function(){ // this code gets execute when the framework loads. } ); */ }
$subdir = substr($subdir, 1); } $subdir = str_replace(DIRECTORY_SEPARATOR, '/', $subdir); define('KNOWN_SUBDIRECTORY', $subdir); } } } } // Set time limit if we're using less if (ini_get('max_execution_time') < 120) { set_time_limit(120); } // We're making heavy use of the Symfony ClassLoader to load our classes require_once dirname(dirname(__FILE__)) . '/external/Symfony/Component/ClassLoader/UniversalClassLoader.php'; global $known_loader; $known_loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); /** * Retrieve the loader * @return \Symfony\Component\ClassLoader\UniversalClassLoader */ function &loader() { global $known_loader; return $known_loader; } // Register our main namespaces (all idno classes adhere to the PSR-0 standard) // idno trunk classes (i.e., the main framework) are in /idno $known_loader->registerNamespace('Idno', dirname(dirname(__FILE__))); // Host for the purposes of extra paths if (!empty($_SERVER['HTTP_HOST'])) { $host = strtolower($_SERVER['HTTP_HOST']);
<?php require_once $_SERVER['SYMFONY'] . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Symfony', $_SERVER['SYMFONY']); $loader->registerNamespace('Assetic', $_SERVER['ASSETIC']); $loader->registerPrefix('Twig_', $_SERVER['TWIG']); $loader->register(); spl_autoload_register(function ($class) { if (0 === strpos($class, 'Symfony\\Bundle\\AsseticBundle\\') && file_exists($file = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 3)) . '.php')) { require_once $file; } });
<?php namespace WordHistogram; require __DIR__ . '/../../vendor/autoload.php'; $classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespace('Phadoop', __DIR__ . '/../..'); $classLoader->registerNamespace('WordHistogram', __DIR__ . '/..'); $classLoader->register(); //define('PHADOOP_MAPREDUCE_DEBUG', true); $mr = new \Phadoop\MapReduce('/usr/local/Cellar/hadoop'); $job = $mr->createJob('WordHistogram', 'Temp')->setMapper(new Mapper())->setReducer(new Reducer())->clearData()->addTask('Hello World')->addTask('Hello Hadoop')->putResultsTo('Temp/Results.txt')->run(); echo $job->getLastResults();
<?php /** * This is bootstrap for phpUnit unit tests, * use README.md for more details * * @author Gediminas Morkevicius <*****@*****.**> * @package Gedmo.Tests * @link http://www.gediminasm.org * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ if (!class_exists('PHPUnit_Framework_TestCase') || version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0) { die('PHPUnit framework is required, at least 3.5 version'); } if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) { die('PHPUnit MockObject plugin is required, at least 1.0.8 version'); } define('TESTS_PATH', __DIR__); define('TESTS_TEMP_DIR', __DIR__ . '/temp'); define('VENDOR_PATH', realpath(__DIR__ . '/../vendor')); $classLoaderFile = VENDOR_PATH . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; if (!file_exists($classLoaderFile)) { die('cannot find vendor, run: php bin/vendors.php'); } require_once $classLoaderFile; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Symfony' => VENDOR_PATH, 'Doctrine\\MongoDB' => VENDOR_PATH . '/doctrine-mongodb/lib', 'Doctrine\\ODM\\MongoDB' => VENDOR_PATH . '/doctrine-mongodb-odm/lib', 'Doctrine\\Common' => VENDOR_PATH . '/doctrine-common/lib', 'Doctrine\\DBAL' => VENDOR_PATH . '/doctrine-dbal/lib', 'Doctrine\\ORM' => VENDOR_PATH . '/doctrine-orm/lib', 'Gedmo\\Mapping\\Mock' => __DIR__, 'Gedmo' => __DIR__ . '/../lib', 'Tool' => __DIR__ . '/Gedmo', 'Translator\\Fixture' => __DIR__ . '/Gedmo', 'Translatable\\Fixture' => __DIR__ . '/Gedmo', 'Timestampable\\Fixture' => __DIR__ . '/Gedmo', 'Tree\\Fixture' => __DIR__ . '/Gedmo', 'Sluggable\\Fixture' => __DIR__ . '/Gedmo', 'Sortable\\Fixture' => __DIR__ . '/Gedmo', 'Mapping\\Fixture' => __DIR__ . '/Gedmo', 'Loggable\\Fixture' => __DIR__ . '/Gedmo', 'Wrapper\\Fixture' => __DIR__ . '/Gedmo')); $loader->register(); Gedmo\Version::checkODMMongoDBDependencies(); Gedmo\Version::checkORMDependencies();
<?php //set up constants foreach ( array( 'LIBRARY_PATH' => realpath(dirname(__FILE__) . '/src'), 'AUTOLOADER_PATH' => realpath(dirname(__FILE__) . '/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'), 'APPLICATION_ENV' => getenv('APPLICATION_ENV') ?: 'production', 'APPLICATION_PATH' => realpath(dirname(__FILE__)) ) as $key => $val) { defined($key) || define($key, $val); } //create the include path set_include_path(implode(PATH_SEPARATOR, array(LIBRARY_PATH, APPLICATION_PATH))); //load autoloader require_once AUTOLOADER_PATH; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array( 'Compredux' => LIBRARY_PATH, 'Zend' => LIBRARY_PATH, )); $loader->register();
<?php // Register class loader require_once __DIR__ . '/lib/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Symfony', __DIR__ . '/lib/symfony/src'); $loader->register(); // Read build file $build = Symfony\Component\Yaml\Yaml::parse(__DIR__ . '/build.yml'); // Build components mkdir(__DIR__ . "/../build/components", 0777, true); foreach ($build['components'] as $componentName) { // Compute component source path $componentSourcePath = __DIR__ . "/../src/{$componentName}.js"; // Build raw file_put_contents(__DIR__ . "/../build/components/{$componentName}.js", render(__DIR__ . '/copyright.php', array('content' => file_get_contents($componentSourcePath)))); // Build minified file_put_contents(__DIR__ . "/../build/components/{$componentName}-min.js", render(__DIR__ . '/copyright.php', array('content' => compress(file_get_contents($componentSourcePath))))); } // Build rollups mkdir(__DIR__ . '/../build/rollups', 0777, true); foreach ($build['rollups'] as $rollupName => $components) { // Compute component source paths $componentSourcePaths = array_map(function ($componentName) { return __DIR__ . "/../src/{$componentName}.js"; }, $components); // Get component source contents $componentSourceContents = implode('', array_map('file_get_contents', $componentSourcePaths)); // Build rollup file_put_contents(__DIR__ . "/../build/rollups/{$rollupName}.js", render(__DIR__ . '/copyright.php', array('content' => compress($componentSourceContents)))); }
<?php if ($_ENV["SYMFONY_PATH"]) { $symfonyPath = $_ENV["SYMFONY_PATH"]; } else { $symfonyPath = __DIR__ . '/../lib'; } require_once $symfonyPath . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Symfony' => $symfonyPath, 'Goetas\\DoctrineToXsd' => __DIR__ . '/../lib')); $loader->register(); \Goetas\DoctrineToXsd\Console\ConsoleRunner::run();
$paths[] = $fileName; } define('PEAR_ROOT_PATH', $root); $composerLoaderWhenInstalled = __DIR__ . '/../../../autoload.php'; $composerLoaderWhenCloned = __DIR__ . '/../vendor/autoload.php'; if (file_exists($composerLoaderWhenInstalled)) { $loader = (require_once $composerLoaderWhenInstalled); } else { if (file_exists($composerLoaderWhenCloned)) { $loader = (require_once $composerLoaderWhenCloned); } else { $classLoader = $root . '/symfony-class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php'; //fallback mode, if no composer installed, try to use symfony components in src if (file_exists($classLoader)) { require_once $classLoader; $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Symfony' => array($root . '/symfony-class-loader', $root . '/symfony-finder'))); $loader->register(); } else { echo "Can't find ComposerLoader.\n"; echo "try:\n"; echo "\tphp composer.phar update"; exit; } } } if ($loader) { $prefixes = $loader->getPrefixes(); // some old components do not use autoloader and includes symfony components directly - add them to include path foreach (array('Symfony', 'Symfony\\Component\\Finder') as $key) { if (isset($prefixes[$key])) {
<?php include_once __DIR__ . '/lib/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespace('Doctrine', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('Symfony', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('Zend', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('Base', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('Annovent', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('phmLabs', __DIR__ . DIRECTORY_SEPARATOR . 'lib'); $classLoader->registerNamespace('LiveTest', __DIR__); $classLoader->register();
<?php error_reporting(E_ALL | E_STRICT); ini_set("display_errors", 1); $classLoaderFile = __DIR__ . '/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; if (!file_exists($classLoaderFile)) { throw new \LogicException("You need to install vendors for tests to work\nPlease run ./install_vendors.sh\n"); } require_once $classLoaderFile; $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Symfony' => __DIR__ . '/vendor/symfony/src/', 'Sensio\\Bundle\\FrameworkExtraBundle' => __DIR__ . '/vendor/sensio-extra-bundle/', 'Doctrine\\Common' => __DIR__ . '/vendor/doctrine-common/lib/', 'Monolog' => __DIR__ . '/vendor/monolog/src/', 'Grace\\Cache' => __DIR__ . '/vendor/grace-cache/lib', 'Grace\\Tests\\Cache' => __DIR__ . '/vendor/grace-cache/lib', 'Grace\\Tests\\SQLBuilder' => __DIR__ . '/vendor/grace-dbal/lib', 'Grace\\SQLBuilder' => __DIR__ . '/vendor/grace-dbal/lib', 'Grace\\Tests\\DBAL' => __DIR__ . '/vendor/grace-dbal/lib', 'Grace\\DBAL' => __DIR__ . '/vendor/grace-dbal/lib', 'Grace\\Bundle' => __DIR__ . '/symfony-bundle/', 'Grace' => __DIR__ . '/core/')); $loader->register(); if (file_exists(__DIR__ . '/config.php')) { /** @noinspection PhpIncludeInspection */ require_once __DIR__ . '/config.php'; } else { require_once __DIR__ . '/config.php.dist'; }
/** * This file is part of the Altumo library. * * (c) Steve Sperandeo <*****@*****.**> * (c) Juan Jaramillo <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * This file is designed to be the one and only required include to use Altumo * for php sources. * * If you'd like to not use it because of the hard-coded timezone, you can * simply copy the autoloader lines into your own application. * * There's no requirement to use this specific file to autoload the class paths. * * Also, you can register your own namespaces by adding a second value to the * registerNamespaces array argument. See the comments within the * UniversalClassLoader for addition sample usages. * * @author Steve Sperandeo <*****@*****.**> */ //set default timezone date_default_timezone_set('America/Los_Angeles'); //symfony 2 autoloader (for classes within namespaces) require_once __DIR__ . '/Utils/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Altumo' => __DIR__)); $loader->register();
<?php // Register class loader require_once __DIR__ . '/../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->register(); // Register Symfony $loader->registerNamespace('Symfony', __DIR__ . '/../vendor/symfony/src'); // Read build config $build = Symfony\Component\Yaml\Yaml::parse(__DIR__ . '/../resources/config/builder.yml'); // Build components mkdir(__DIR__ . "/../build/components", 0777, true); foreach ($build['components'] as $componentName) { // Compute component source path $componentSourcePath = __DIR__ . "/../src/{$componentName}.js"; // Build raw file_put_contents(__DIR__ . "/../build/components/{$componentName}.js", render(__DIR__ . '/../resources/templates/copyright.php', array('content' => file_get_contents($componentSourcePath)))); // Build minified file_put_contents(__DIR__ . "/../build/components/{$componentName}-min.js", render(__DIR__ . '/../resources/templates/copyright.php', array('content' => compress(file_get_contents($componentSourcePath))))); } // Build rollups mkdir(__DIR__ . '/../build/rollups', 0777, true); foreach ($build['rollups'] as $rollupName => $components) { // Compute component source paths $componentSourcePaths = array_map(function ($componentName) { return __DIR__ . "/../src/{$componentName}.js"; }, $components); // Get component source contents $componentSourceContents = implode('', array_map('file_get_contents', $componentSourcePaths)); // Build rollup file_put_contents(__DIR__ . "/../build/rollups/{$rollupName}.js", render(__DIR__ . '/../resources/templates/copyright.php', array('content' => compress($componentSourceContents))));
<?php /* * @package klout-sdk-php * @author Mike Tougeron <*****@*****.**> * @copyright Copyright (c) 2013 Mike Tougeron <*****@*****.**> * @license http://opensource.org/licenses/MIT * @link https://github.com/mtougeron/klout-sdk-php */ require_once __DIR__ . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; if (!defined('KLOUT_FILE_PREFIX')) { define('KLOUT_FILE_PREFIX', __DIR__); } $classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespaces(array('Klout' => KLOUT_FILE_PREFIX, 'Guzzle' => KLOUT_FILE_PREFIX, 'Symfony' => KLOUT_FILE_PREFIX, 'Zend' => KLOUT_FILE_PREFIX)); $classLoader->register(); return $classLoader;
<?php /** * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ require_once __DIR__ . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; if (!defined('AWS_FILE_PREFIX')) { define('AWS_FILE_PREFIX', __DIR__); } $classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespaces(array('Aws' => AWS_FILE_PREFIX, 'Guzzle' => AWS_FILE_PREFIX, 'Symfony' => AWS_FILE_PREFIX, 'Doctrine' => AWS_FILE_PREFIX, 'Psr' => AWS_FILE_PREFIX, 'Monolog' => AWS_FILE_PREFIX)); $classLoader->register(); return $classLoader;
is loaded in the bootstrap. Therefore, I find it is better to load only the Universal Classloader thereby only loading the exact files which are required. And to be honest I may as well be loading the individual components with require rather than this messyness with the autoloader, however i want to make sure that if symfony component dependencies change, then I will be saved by the namespaces rather than loading explicit class files */ //bootstrap application //include ($_SERVER['KERNEL_DIR'].'/bootstrap.php.cache'); //load autoloader require_once $_SERVER['KERNEL_DIR'].'/../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array( 'Symfony' => array($_SERVER['KERNEL_DIR'].'/../vendor/symfony/src'), )); $loader->register(); use Symfony\Component\Finder\Finder; $posters = array(); $location = __DIR__.'/error'; if (isset($_GET['code']) && is_dir(__DIR__.'/'.$_GET['code'])) { $location = __DIR__.'/'.$_GET['code']; }
<?php require_once __DIR__ . '/../lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('ju1ius', __DIR__ . '/../lib'); $loader->register(); //$css = 'p{ //background: url(foo) 40% 25% / 10em 1em round, red 10% 2px / contain round; //}'; $css = 'p{ background-image: url(flower.png), url(ball.png), url(grass.png); background-position: center center, 20% 80%, top left, bottom right; background-origin: border-box, content-box; background-repeat: no-repeat; }'; //$css = 'p{ //margin-top: 1em; //margin-right: 1em; //margin-bottom: 1em; //margin-left: 1em; //}'; //var_dump(substr($css, 419, 100)); $parser = new ju1ius\Css\Parser(array()); $styleSheet = $parser->parseStyleSheet($css); $rule = $styleSheet->getFirstRule(); $styleDeclaration = $rule->getStyleDeclaration(); $styleDeclaration->createBackgroundShorthand(); var_dump($styleSheet->getCssText(array('indent_level' => 0, 'indent_char' => ' ', 'color_mode' => 'rgb'))); //var_dump($result->getRuleList()->getAllValues()); //var_dump($styleDeclaration);
<?php /* * This file is part of the Doctrine Extensions Taggable package. * (c) 2011 Fabien Pennequin <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ if (!class_exists('Symfony\\Component\\ClassLoader\\UniversalClassLoader')) { require __DIR__ . '/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; } $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Doctrine\\Common' => __DIR__ . '/vendor/doctrine/common/lib', 'Doctrine\\DBAL' => __DIR__ . '/vendor/doctrine/dbal/lib', 'Doctrine\\ORM' => __DIR__ . '/vendor/doctrine/orm/lib', 'DoctrineExtensions\\Taggable' => __DIR__ . '/lib')); $loader->register();
<?php /* * Copyright MADE/YOUR/DAY <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require __DIR__ . '/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Symfony\\Component\\ClassLoader' => __DIR__ . '/vendor/symfony/class-loader', 'Symfony\\Component\\Console' => __DIR__ . '/vendor/symfony/console', 'MadeYourDay' => __DIR__ . '/src')); $loader->register(); $cli = new MadeYourDay\SVG\IconFontGeneratorCLI(); $cli->run();
<?php if (version_compare(PHP_VERSION, '5.4', '>=') && gc_enabled()) { // Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+ // https://bugs.php.net/bug.php?id=53976 gc_disable(); } $loader = (require_once __DIR__ . '/vendor/autoload.php'); //use Doctrine\Common\Annotations\AnnotationRegistry; //AnnotationRegistry::registerLoader(array($loader, 'loadClass')); $classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespace('PHPCommerce', array(__DIR__ . '/src')); $classLoader->register();
<?php /* * Create a console application with the Mongrate commands. */ if (!extension_loaded('mongo')) { // Instead of throwing a \RuntimeException, which isn't friendly when running the .phar file // for the first time when trying to get set up, exit with an error message instead. echo "The MongoDB extension must be installed.\n"; echo "See https://secure.php.net/manual/en/mongo.installation.php\n"; exit(1); } require_once 'vendor/autoload.php'; $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespaces(array('Mongrate' => 'src')); $loader->register(); $app = new \Symfony\Component\Console\Application(); try { $app->add(new \Mongrate\Command\ToggleMigrationCommand()); $app->add(new \Mongrate\Command\UpCommand()); $app->add(new \Mongrate\Command\DownCommand()); $app->add(new \Mongrate\Command\GenerateMigrationCommand()); $app->add(new \Mongrate\Command\ListCommand()); $app->add(new \Mongrate\Command\TestMigrationCommand()); $app->add(new \Mongrate\Command\TestAllCommand()); $app->add(new \Mongrate\Command\UpAllCommand()); } catch (\MongoConnectionException $e) { fwrite(STDERR, "MongoDB connection failed.\n" . $e->getMessage() . "\n"); exit(1); } $app->add(new \Mongrate\Command\SelfUpdateCommand());
#!/usr/bin/php -q <?php // Load Symfony require_once dirname(__FILE__) . '/external/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $known_loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $known_loader->registerNamespace('Symfony\\Component', dirname(__FILE__) . '/external'); $known_loader->register(); // Register console namespace use Symfony\Component\Console\Application; // Create new console application $console = new Application(); // Load any plugin functions $directory = dirname(__FILE__) . '/ConsolePlugins/'; if ($scanned_directory = array_diff(scandir($directory), array('..', '.'))) { foreach ($scanned_directory as $file) { if (is_dir($file)) { if (file_exists($directory . $file . '/Main.php')) { @(include $directory . $file . '/Main.php'); } } } } $console->register('makeconfig')->setDescription('Attempts to write configuration variables to a Known config.ini file')->setDefinition([new \Symfony\Component\Console\Input\InputArgument('dbuser', \Symfony\Component\Console\Input\InputArgument::REQUIRED, 'Database username'), new \Symfony\Component\Console\Input\InputArgument('dbpass', \Symfony\Component\Console\Input\InputArgument::REQUIRED, 'Database password'), new \Symfony\Component\Console\Input\InputArgument('dbname', \Symfony\Component\Console\Input\InputArgument::REQUIRED, 'Database name'), new \Symfony\Component\Console\Input\InputArgument('database', \Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Database type', 'mysql'), new \Symfony\Component\Console\Input\InputArgument('dbhost', \Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Database hostname', 'localhost'), new \Symfony\Component\Console\Input\InputArgument('filename', \Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Configuration filename', 'config.ini')])->setCode(function (\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) { if ($fp = fopen($input->getArgument('filename'), 'w')) { fwrite($fp, "[Database configuration]\n"); fwrite($fp, "database=" . $input->getArgument('database') . "\n"); fwrite($fp, "dbhost=" . $input->getArgument('dbhost') . "\n"); fwrite($fp, "dbname=" . $input->getArgument('dbname') . "\n"); fwrite($fp, "dbuser="******"\n"); fwrite($fp, "dbpass="******"\n");
<?php /** * Copyright Zikula Foundation 2009 - Zikula Application Framework * * This work is contributed to the Zikula Foundation under one or more * Contributor Agreements and licensed to You under the following license: * * @license GNU/LGPLv3 (or at your option, any later version). * @package Zikula * * Please see the NOTICE file distributed with this source code for further * information regarding copyright and licensing. */ if (!defined('HTMLPURIFIER_PREFIX')) { define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/vendor/htmlpurifier')); } if (!defined('PHPIDS_PATH_PREFIX')) { define('PHPIDS_PATH_PREFIX', realpath(dirname(__FILE__) . '/vendor/IDS')); } // include the PHPIDS and get access to the result object set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/vendor')); $autoloader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $autoloader->register(); $autoloader->registerPrefixes(array('HTMLPurifier' => realpath(dirname(__FILE__) . '/vendor/htmlpurifier'), 'IDS' => realpath(dirname(__FILE__) . '/vendor'))); // register event handlers EventUtil::attachEventHandler('SecurityCenterModule\\Listener\\FilterListener');
<?php $namespaces = array('CentralApps\\Base' => __DIR__ . '/'); $loader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->register(); $loader->registerNamespaces($namespaces);
<?php /** * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ Phar::mapPhar('aws.phar'); define('AWS_PHAR', true); require_once 'phar://aws.phar/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespaces(array('Aws' => 'phar://aws.phar/src', 'Guzzle' => 'phar://aws.phar/vendor/guzzle/guzzle/src', 'Symfony\\Component\\EventDispatcher' => 'phar://aws.phar/vendor/symfony/event-dispatcher', 'Doctrine' => 'phar://aws.phar/vendor/doctrine/common/lib', 'Monolog' => 'phar://aws.phar/vendor/monolog/monolog/src')); $classLoader->register(); return $classLoader; __halt_compiler();
<?php /** * Configura o autoloader das bibliotecas usadas no projeto * */ require_once __DIR__ . '/vendor/symfony-loader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace(array('Phpmg' => __DIR__ . '/src', 'Respect\\Rest' => __DIR__ . '/vendor/respect-rest/library', 'Respect\\Config' => __DIR__ . '/vendor/respect-config/library'));
<?php require_once 'vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php'; if (!defined('MOJIO_FILE_PREFIX')) { define('MOJIO_FILE_PREFIX', 'phar://mojio.phar'); } Phar::mapPhar('mojio.phar'); $classLoader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespaces(array('Mojio' => MOJIO_FILE_PREFIX . '/src', 'Guzzle' => MOJIO_FILE_PREFIX . '/vendor/guzzle/guzzle/src', 'Symfony\\Component\\EventDispatcher' => MOJIO_FILE_PREFIX . '/vendor/symfony/event-dispatcher', 'Doctrine' => MOJIO_FILE_PREFIX . '/vendor/doctrine/common/lib', 'Monolog' => MOJIO_FILE_PREFIX . '/vendor/monolog/monolog/src')); $classLoader->register(); __halt_compiler();
<?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'); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path()))); require 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); $system_application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); $system_application->bootstrap(); $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Symfony', APPLICATION_PATH . '/../library'); $loader->registerNamespace('Angel', APPLICATION_PATH . '/../library'); $loader->register(); $application = new Symfony\Component\Console\Application(); $application->addCommands(array(new Angel\Command\LoadCity($system_application))); $application->run();