public function __construct($application) { $this->application = $application; $sm = $this->application->getServiceManager(); $em = $this->application->getEventManager(); $this->view = $sm->get('ViewRenderer'); $this->view->doctype('HTML5'); $em->trigger('boostrap', $this->application, array(), array($this, 'onDispatch')); return $this; }
/** * @return \Zend\Mvc\Application */ public function bootstrap() { chdir(dirname(dirname(dirname(dirname(__DIR__))))); define('DEBUG', true); // Setup autoloading require 'init_autoloader.php'; require 'debug.functions.php'; // Run the application! return Zend\Mvc\Application::init(\Zend\Stdlib\ArrayUtils::merge(include 'config/application.config.global.php', include 'config/application.config.local.php')); }
public static function go() { chdir(dirname(__DIR__)); $basePath = realpath(__DIR__ . '/../../../'); include $basePath . '/init_autoloader.php'; self::$config = (include $basePath . '/config/application.config.php'); Zend\Mvc\Application::init(self::$config); self::$sm = self::getServiceManager(self::$config); self::$em = self::getEntityManager(self::$sm); }
static function go() { /** Everything is relative to the application root now. */ chdir(__DIR__); /** Setup autoloading */ require 'init_autoloader.php'; /** bootstrap ZF2 */ $config = (require 'config/application.config.php'); Zend\Mvc\Application::init($config); $serviceManager = new ServiceManager(new ServiceManagerConfig()); $serviceManager->setService('ApplicationConfig', $config); $serviceManager->get('ModuleManager')->loadModules(); self::$serviceManager = $serviceManager; /** Reset the DB */ `mysql --user=root -e "drop database IF EXISTS metator_tests"`; `mysql --user=root -e "create database metator_tests"`; `mysql --user=root metator_tests < install.sql`; }
/** * @param string $route * @return string */ function runRoute($route, $overrideConfig = array()) { if ($route[0] !== '/') { $route = '/' . $route; } $_SERVER_OLD = $_SERVER; $_SERVER = (require __DIR__ . '/$_SERVER.php'); $_SERVER['REQUEST_URI'] = $route; $_SERVER['PATH_INFO'] = $route; $_SERVER['PHP_SELF'] = '/index.php' . $route; \Application\Module::$config = $overrideConfig; Zend\Console\Console::overrideIsConsole(false); $app = Zend\Mvc\Application::init(require __DIR__ . '/app/application.config.php'); ob_start(); $app->run(); $result = ob_get_clean(); $_SERVER = $_SERVER_OLD; return $result; }
<?php chdir(dirname(__DIR__)); include __DIR__ . '/../init_autoloader.php'; Zend\Mvc\Application::init(include 'config/application.config.php');
<?php chdir(__DIR__); // Define application environment (production|staging|testing|development) defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APP_ENV') ? getenv('APP_ENV') : 'development'); // Init the application. return Zend\Mvc\Application::init(require 'config/application.config.php');
<?php $loaderPath = 'vendor/zoopcommerce/slipstream/autoload.php'; // Root if testing independently $applicationRoot = __DIR__ . '/../../'; if (!file_exists($applicationRoot . $loaderPath)) { // Root if testing as part of a larger app $applicationRoot = __DIR__ . '/../../../../../'; } chdir($applicationRoot); $loader = (require_once $loaderPath); $loader->add('Zoop\\ShardModule\\Test', __DIR__ . '/../'); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET') { //use juggernaut cache for GET requests $pageTtl = 1; //1 seconds, very low cache time, but helps page speed massively with concurrent requests $cacheDirectory = __DIR__ . '/cache/fullpage'; $adapter = new Zoop\Juggernaut\Adapter\FileSystem($cacheDirectory); $pageCache = new Zoop\Juggernaut\Helper\FullPage($adapter, $pageTtl, true, false); $pageCache->start(); } // Run the application! Zend\Mvc\Application::init(require __DIR__ . '/performance.application.config.php')->run();
<?php //默认为test测试环境, product为正式产品环境,除了test测试环境报错以外,其他都不报错test // $env = getenv('APP_ENV') ? getenv('APP_ENV') : 'test'; define('BaseRootPath', __DIR__); chdir(dirname(__DIR__)); if (!defined('ROOT')) { define('ROOT', getcwd()); } define('ZF2', ROOT . "/zf2"); define('LIB', ROOT . '/library'); if ($env == "test") { putenv('APP_ENV=test'); error_reporting(E_ALL ^ E_NOTICE); } elseif ($env == "product") { error_reporting(0); } elseif ($env == "staging") { error_reporting(0); } else { error_reporting(0); } require 'init_autoload.php'; Zend\Mvc\Application::init(require ROOT . "/configs/main.config.php")->run();
<?php use Doctrine\ORM\Tools\Console\ConsoleRunner; // replace with file to your own project bootstrap require_once '../init_autoloader.php'; $app = Zend\Mvc\Application::init(require 'application.config.php'); // replace with mechanism to retrieve EntityManager in your app $entityManager = $app->getServiceManager()->get('doctrine.entitymanager.orm_default'); return ConsoleRunner::createHelperSet($entityManager);
<?php // Composer autoloading if (file_exists('./vendor/autoload.php')) { $loader = (include './vendor/autoload.php'); } $loader->add('ZfcUserTest', "./tests/ZfcUserLdapTest/src/ZfcUserLdapTest"); Zend\Mvc\Application::init(require './tests/config/application.config.php');
public static function init() { static::initAutoloader(); static::$app = Zend\Mvc\Application::init(static::$app_config); static::$app->getServiceManager()->get('config'); }
if (substr(strtolower($_SERVER['HTTP_HOST']), 0, 4) === 'www.') { $host = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; $host .= substr($_SERVER['HTTP_HOST'], 4); if ($_SERVER["SERVER_PORT"] != '80') { $host .= ':' . $_SERVER['SERVER_PORT']; } header('Location: ' . $host . $_SERVER['REQUEST_URI']); exit; } // force https //if(getenv('APPLICATION_ENV') == 'production' && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off')) { // header('Location: http://mentor.funix.edu.vn'. $_SERVER['REQUEST_URI']); // exit; //} defined('DS') || define('DS', DIRECTORY_SEPARATOR); defined('BASE_PATH') || define('BASE_PATH', dirname(dirname(__FILE__))); defined('LIB_PATH') || define('LIB_PATH', getenv("LIB_PATH")); defined('VENDOR_PATH') || define('VENDOR_PATH', realpath(BASE_PATH . '/vendor')); defined('TEMPLATES_PATH') || define('TEMPLATES_PATH', realpath(BASE_PATH . '/public/tp')); defined('MEDIA_PATH') || define('MEDIA_PATH', realpath(BASE_PATH . '/public/media')); set_include_path(implode(PATH_SEPARATOR, array(LIB_PATH, VENDOR_PATH, get_include_path()))); $zendPath = VENDOR_PATH; /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); include 'Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('namespaces' => array('Zend' => VENDOR_PATH . '/Zend', 'ZendX' => VENDOR_PATH . '/ZendX', 'ZendService' => VENDOR_PATH . '/ZendService')))); Zend\Mvc\Application::init(require BASE_PATH . '/config/application.config.php')->run();
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); define('REQUEST_MICROTIME', microtime(true)); // Setup autoloading include 'init_autoloader.php'; // Run the application! $app = Zend\Mvc\Application::init(include 'config/minimal.config.php'); $app->run();
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } require 'vendor/autoload.php'; // Run the application! Zend\Mvc\Application::init(\Zend\Stdlib\ArrayUtils::merge(require 'config/application.config.php', require 'config/environment.config.php'))->run();
<?php // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'); // Ensure ZF is on the include path set_include_path(implode(PATH_SEPARATOR, array(realpath(__DIR__ . '/../library'), realpath(__DIR__ . '/../library/ZendFramework/library'), get_include_path()))); require_once 'Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array())); $appConfig = new Zend\Config\Config(include __DIR__ . '/../configs/application.config.php'); $moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']); $moduleLoader->register(); $moduleManager = new Zend\Module\Manager($appConfig['modules'], new Zend\Module\ManagerOptions($appConfig['module_manager_options'])); // Create application, bootstrap, and run $bootstrap = new Zend\Mvc\Bootstrap($moduleManager); $application = new Zend\Mvc\Application(); // this step is not generally needed as default request is good enough for most setups // however since we want to accept different HTTP methods (such as PATCH) we need // to redefine the request class used $request = new Application\Http\PhpEnvironment\Request(); $application->setRequest($request); $bootstrap->bootstrap($application); $response = $application->run(); if ($response instanceof \Zend\Http\PhpEnvironment\Response) { $response->send(); } else { echo $response->getBody(); }
* @copyright Ralf Eggert <*****@*****.**> * @link http://www.ralfeggert.de/ */ /** * Application setup * * @package Application */ // define request microtime define('REQUEST_MICROTIME', microtime(true)); // define application environment define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'); // define application path define('APPLICATION_ROOT', realpath(__DIR__ . '/..')); // setup autoloading require_once '../vendor/autoload.php'; // change dir chdir(dirname(__DIR__)); // get configuration file switch (APPLICATION_ENV) { case 'production': $configFile = APPLICATION_ROOT . '/config/production.config.php'; break; case 'development': default: $configFile = APPLICATION_ROOT . '/config/development.config.php'; break; } // Run the application! Zend\Mvc\Application::init(include $configFile)->run();
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Run the application! Zend\Mvc\Application::init(require 'config/application.config.php')->bootstrap();
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require __DIR__ . '/../init_autoloader.php'; Zend\Mvc\Application::init(require __DIR__ . '/../config/application.config.php')->run();
<?php //ad562ed675cf746e886308b57144220f8e include 'define.php'; include LIBRARY_PATH . '/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array('ZendVN' => LIBRARY_PATH . '/ZendVN', 'ZendGData' => LIBRARY_PATH . '/ZendGData', 'Block' => APPLICATION_PATH . '/ad562ed675cf746e886308b57144220f8e_block', 'Sidebar' => APPLICATION_PATH . '/ad562ed675cf746e886308b57144220f8e_sidebar'), 'prefixes' => array('HTMLPurifier' => LIBRARY_PATH . '/HTMLPurifier')))); if (!class_exists('Zend\\Loader\\AutoloaderFactory')) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } // Run the application! Zend\Mvc\Application::init(require 'ad562ed675cf746e886308b57144220f8e_config/application.config.php')->run();
<h3>No Exception available</h3> <?php endif ?> <?php endif ?> ERRORINDEX; stream_wrapper_register("var", "VariableStream"); } namespace Application { class Module { public function getConfig() { return array('router' => array('routes' => array('home' => array('type' => 'Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'Application\\Controller\\IndexController', 'action' => 'index'))))), 'controllers' => array('invokables' => array('Application\\Controller\\IndexController' => 'Application\\Controller\\IndexController')), 'view_manager' => array('display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array('layout/layout' => 'var://layout_layout', 'application/index/index' => 'var://application_index_index', 'error/404' => 'var://error_404', 'error/index' => 'var://error_index'))); } } } namespace Application\Controller { use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class IndexController extends AbstractActionController { public function indexAction() { return new ViewModel(); } } } namespace { Zend\Mvc\Application::init(array('modules' => array('Application'), 'module_listener_options' => array('module_paths' => array('./module', './vendor'), 'config_glob_paths' => array('config/autoload/{,*.}{global,local}.php'), 'check_dependencies' => true)))->run(); }
<?php error_reporting(E_ALL); ini_set("display_errors", 1); /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Run the application! Zend\Mvc\Application::init(require 'config/application.config.php')->run();
} require EVA_LIB_PATH . '/Zend/library/Zend/Loader/AutoloaderFactory.php'; use Zend\Loader\AutoloaderFactory; AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true))); $loader = AutoloaderFactory::getRegisteredAutoloaders(); $loader = $loader[AutoloaderFactory::STANDARD_AUTOLOADER]; $loader->registerNamespace('Eva\\', EVA_LIB_PATH . '/Eva/'); $loader->registerNamespace('Assetic\\', EVA_LIB_PATH . '/Assetic/src/Assetic/'); $loader->registerNamespace('Symfony\\', EVA_LIB_PATH . '/Symfony/'); $appGlobelConfig = (include EVA_CONFIG_PATH . DIRECTORY_SEPARATOR . 'application.config.php'); $appLocalConfig = EVA_CONFIG_PATH . DIRECTORY_SEPARATOR . 'application.local.config.php'; if (file_exists($appLocalConfig)) { $appLocalConfig = (include $appLocalConfig); $appGlobelConfig = array_merge($appGlobelConfig, $appLocalConfig); } Zend\Mvc\Application::init($appGlobelConfig); use Assetic\AssetManager; use Assetic\Asset\FileAsset; use Assetic\Asset\GlobAsset; use Assetic\Asset\AssetCollection; use Assetic\Asset\AssetReference; use Assetic\FilterManager; use Assetic\Filter\Sass\SassFilter; use Assetic\Filter\LessphpFilter; use Assetic\Filter\LessFilter; use Assetic\Filter\Yui; use Assetic\Factory\AssetFactory; use Assetic\Filter\GoogleClosure\CompilerApiFilter; use Assetic\AssetWriter; use Assetic\Factory\Worker\CacheBustingWorker; class EvaAssets
<?php define("BASE_PATH", getcwd()); require_once __DIR__ . '/vendor/autoload.php'; $baseConfig = array('modules' => array('Application', 'DoctrineModule', 'DoctrineORMModule'), 'module_listener_options' => array('module_paths' => array('./module', './vendor'), 'config_glob_paths' => array('config/{,*.}{global,local}.php'))); Zend\Mvc\Application::init($baseConfig)->run();
<?php chdir(dirname(__DIR__ . '/../../../../')); require 'init_autoloader.php'; //BOOTSTRAP // bootstrap the application. // this has to be done to get all configs $sm = Zend\Mvc\Application::init(require 'config/application.config.php')->bootstrap()->getServiceManager(); $pdo = $sm->get('PDO'); $index = $sm->get('Search\\Index\\Search'); //Event // index event entries. // $counter = 0; $eventService = new Stjornvisi\Service\Event($pdo); $events = $eventService->fetchAll(); $adapter = new Zend\Progressbar\Adapter\Console(); echo "\nIndexing Event entries\n"; $progressBar = new Zend\ProgressBar\ProgressBar($adapter, $counter, count($events)); $i = new Stjornvisi\Search\Index\Event(); foreach ($events as $item) { $i->index($item, $index); $progressBar->update(++$counter); } $index->commit(); $progressBar->finish(); //NEWS // index news entries. // $counter = 0; $newsService = new Stjornvisi\Service\News($pdo);
<?php use Zend\Loader\StandardAutoloader; chdir(dirname(dirname(__DIR__))); $loader = null; if (file_exists('vendor/autoload.php')) { $loader = (include 'vendor/autoload.php'); } else { throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); } // Config $appConfig = (include __DIR__ . '/config/test.config.php'); // Init the framework Zend\Mvc\Application::init($appConfig); $loader = new StandardAutoloader(); $loader->registerNamespace('DmMailerTest', __DIR__ . '/../library/DmMailerTest'); $loader->registerNamespace('TestUtil', __DIR__ . '/TestUtil'); $loader->registerNamespace('TestFixture', __DIR__ . '/TestFixture'); $loader->register(); TestUtil\ServiceManagerFactory::setApplicationConfig($appConfig);
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Setup autoloading include 'vendor/autoload.php'; // Run the application Zend\Mvc\Application::init(include 'config/application.php')->run();
<?php chdir(dirname(__DIR__)); require_once 'vendor/autoload.php'; $application = Zend\Mvc\Application::init(include __DIR__ . '/../config/application.config.php'); $viewHelperManager = $application->getServiceManager()->get('viewhelpermanager'); if ($viewHelperManager) { $navigation = $viewHelperManager->get('navigation'); $sitemap = $navigation('navigation')->sitemap(); $sitemap->setServerUrl('http://framework.zend.com/')->setFormatOutput(true); // the sitemap helper assumes the view instance will be phpRenderer // so we supply one to avoid plugin errors $phpRenderer = new \Zend\View\Renderer\PhpRenderer(); //$phpRenderer = $application->getServiceManager()->get('ViewRenderer'); $sitemap->setView($phpRenderer); $xml = $sitemap->__toString(); if ($xml) { file_put_contents('public/sitemap.xml', $xml); } }
<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Setup autoloading include 'init_autoloader.php'; $config = (include 'config/application.config.php'); $host = $_SERVER['HTTP_HOST']; $file = 'config/' . $host . '.modules.php'; if (file_exists($file)) { $config = \Zend\Stdlib\ArrayUtils::merge($config, include $file); } // Run the application! Zend\Mvc\Application::init($config)->run();
<?php require __DIR__ . '/../vendor/autoload.php'; chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Define file upload properties ini_set('post_max_size', '1536M'); ini_set('upload_max_filesize', '1536M'); ini_set('memory_limit', '1536M'); // Run the application! $app = Zend\Mvc\Application::init(['modules' => ['Acelaya'], 'module_listener_options' => []]); $app->run();