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(); }
<?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 // 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();
<?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'));
#!/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 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();
if (is_writable(dirname(__DIR__)) && ($installer = @file_get_contents('http://getcomposer.org/installer'))) { echo 'You must set up the project dependencies.' . $nl; $installerPath = dirname(__DIR__) . '/install-composer.php'; file_put_contents($installerPath, $installer); echo 'The composer installer has been downloaded in ' . $installerPath . $nl; die('Run the following commands in ' . dirname(__DIR__) . ':' . $nl . $nl . 'php install-composer.php' . $nl . 'php composer.phar install' . $nl); } die('You must set up the project dependencies.' . $nl . 'Run the following commands in ' . dirname(__DIR__) . ':' . $nl . $nl . 'curl -s http://getcomposer.org/installer | php' . $nl . 'php composer.phar install' . $nl); } use Doctrine\Common\Annotations\AnnotationRegistry; // intl if (!function_exists('intl_get_error_code')) { require_once __DIR__ . '/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; $loader->add('', __DIR__ . '/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); } AnnotationRegistry::registerLoader(array($loader, 'loadClass')); // Swiftmailer needs a special autoloader to allow // the lazy loading of the init file (which is expensive) //require_once __DIR__.'/../vendor/swiftmailer/swiftmailer/lib/classes/Swift.php'; //Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/swiftmailer/lib/swift_init.php'); require_once __DIR__ . '/../vendor/hard/Smarty/Smarty.class.php'; require_once __DIR__ . '/../src/i18n/ZGettextFunctions.php'; $autoloader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $autoloader->register(); $autoloader->registerNamespace('Zikula', __DIR__ . '/../src'); $autoloader->registerPrefix('Zikula_', __DIR__ . '/../src/legacy'); $autoloader->registerPrefix('Categories_', __DIR__ . '/../web/system/Categories/lib'); $autoloader->registerPrefix('Zend_', __DIR__ . '/../vendor/hard'); if (file_exists(__DIR__ . 'bootstrap.php.cache')) { include __DIR__ . 'bootstrap.php.cache'; }
<?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 // 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))));
#! /usr/bin/env php <?php require_once __DIR__ . '/../../../../cssparser/lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('ju1ius', array(__DIR__ . '/../../../lib')); $loader->registerNamespace('Zend', __DIR__ . '/../../../../html-email-preflight/lib/vendor'); $loader->register(); $fmt = new ju1ius\Html\Formatter\PlainText(); $fmt->loadHtmlFile('/home/ju1ius/src/php/html-email-preflight/test/xsl/premailer.html'); //$fmt->loadHtmlFile('http://www.jean-luc-melenchon.fr/2012/02/18/sarkozy-veut-un-regime-plebiscitaire/'); //$fmt->loadHtmlFile('https://www.google.com/search?q=php+count+number+of+chars+end+of+string&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:unofficial&client=iceweasel-a'); echo $fmt->format(); die; // $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; $dom->loadXml(<<<EOS <txt> \t<txt lines="1"> \t\t<txt lines="nope"></txt> \t</txt> \t<txt lines="0"> \t\t<txt lines="12"></txt> \t <txt lines="3"> \t <txt lines-after="2"></txt> \t <txt></txt> \t </txt> \t\t<txt lines-before="2"></txt> \t</txt> </txt> EOS
<?php require_once $_SERVER['SYMFONY'] . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Knp\\Bundle\\MarkupValidatorBundle', __DIR__ . '/../../../..'); $loader->register();
<?php require_once $_SERVER['SYMFONY_SRC'] . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Symfony', $_SERVER['SYMFONY_SRC']); $loader->registerNamespace('Zend', $_SERVER['ZEND_LIB']); $loader->register(); spl_autoload_register(function ($class) { if (0 === strpos($class, 'OpenSky\\Bundle\\LdapBundle\\')) { $path = implode('/', array_slice(explode('\\', $class), 3)) . '.php'; require_once __DIR__ . '/../' . $path; return true; } });
<?php namespace WordCounter; require __DIR__ . '/../../vendor/autoload.php'; $classLoader = new \Symfony\Component\ClassLoader\UniversalClassLoader(); $classLoader->registerNamespace('Phadoop', __DIR__ . '/../..'); $classLoader->registerNamespace('WordCounter', __DIR__ . '/..'); $classLoader->register(); //define('PHADOOP_MAPREDUCE_DEBUG', true); $mr = new \Phadoop\MapReduce('/usr/local/Cellar/hadoop'); $job = $mr->createJob('WordCounter', 'Temp')->setMapper(new Mapper())->setReducer(new Reducer())->clearData()->addTask('Hello World')->addTask('Hello Hadoop')->putResultsTo('Temp/Results.txt')->run(); echo $job->getLastResults();
<?php if (is_readable(__DIR__ . '/../vendor/.composer/autoload.php')) { //composer $loader = (require_once __DIR__ . '/../vendor/.composer/autoload.php'); $loader->add('JsonSchema\\Tests', __DIR__); $loader->register(); } elseif (is_readable(__DIR__ . '/../vendor/symfony/Component/ClassLoader/UniversalClassLoader.php')) { //submodule require_once __DIR__ . '/../vendor/symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('JsonSchema', __DIR__ . '/../src'); $loader->registerNamespace('JsonSchema\\Tests', __DIR__); $loader->register(); }
<?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 require_once __DIR__ . '/../lib/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('ju1ius', array(__DIR__ . '/../lib')); $loader->register();
<?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 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();
// 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']); $host = str_replace('www.', '', $host); define('KNOWN_MULTITENANT_HOST', $host); // idno plugins are located in /IdnoPlugins and must have their own namespace $known_loader->registerNamespace('IdnoPlugins', array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/hosts/' . $host)); // idno themes are located in /Themes and must have their own namespace $known_loader->registerNamespace('Themes', array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/hosts/' . $host)); } // Shims include 'shims.php'; // Register our external namespaces (PSR-0 compliant modules that we love, trust and need) // Bonita is being used for templating $known_loader->registerNamespace('Bonita', dirname(dirname(__FILE__)) . '/external/bonita/includes');
<?php require_once $_SERVER['SYMFONY'] . '/Symfony/Component/ClassLoader/UniversalClassLoader.php'; $loader = new Symfony\Component\ClassLoader\UniversalClassLoader(); $loader->registerNamespace('Symfony\\Tests', $_SERVER['SYMFONY_TESTS']); $loader->registerNamespace('Symfony', $_SERVER['SYMFONY']); $loader->registerNamespace('Doctrine\\ODM\\MongoDB', $_SERVER['DOCTRINE_MONGODB_ODM']); $loader->registerNamespace('Doctrine\\MongoDB', $_SERVER['DOCTRINE_MONGODB']); $loader->registerNamespace('Doctrine\\Common', $_SERVER['DOCTRINE_COMMON']); $loader->register(); spl_autoload_register(function ($class) { if (0 === strpos($class, 'Symfony\\Bundle\\DoctrineMongoDBBundle\\') && file_exists($file = __DIR__ . '/../' . implode('/', array_slice(explode('\\', $class), 3)) . '.php')) { require_once $file; } });