当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Application::getBootstrap方法代码示例

本文整理汇总了PHP中Zend_Application::getBootstrap方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application::getBootstrap方法的具体用法?PHP Zend_Application::getBootstrap怎么用?PHP Zend_Application::getBootstrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Application的用法示例。


在下文中一共展示了Zend_Application::getBootstrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: qsBootstrap

 public function qsBootstrap()
 {
     $this->application->bootstrap();
     $bootstrap = $this->application->getBootstrap();
     $frontController = $bootstrap->getResource('FrontController');
     $frontController->setParam('bootstrap', $bootstrap);
     $configApplication = $this->application->bootstrap('config');
     $requestConfig = $configApplication->getOption('request');
     $this->requestParameterName = $requestConfig['parameter'];
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:10,代码来源:ControllerTestCase.php

示例2: bootstrap

 public static function bootstrap()
 {
     //
     // set the include_path
     set_include_path(implode(PATH_SEPARATOR, array('/usr/share/php/libzend-framework-php', realpath(APPLICATION_PATH . '/../glo-framework/library'), realpath(APPLICATION_PATH . '/../glo-generated'), realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH . '/../vendor'), get_include_path())));
     //
     // set up the autoloader
     require_once 'Zend/Loader/Autoloader.php';
     require_once 'Glo/Loader.php';
     $autoLoader = Zend_Loader_Autoloader::getInstance();
     $autoLoader->pushAutoloader(array('Glo_Loader', 'loadClass'));
     $autoLoader->setFallbackAutoloader(true);
     //
     // register the config
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', Glo_Environment::get(), array('allowModifications' => TRUE));
     $registry = Zend_Registry::getInstance();
     $registry->set('config', $config);
     //
     // initialize the Zend Application
     require_once 'Zend/Application.php';
     $application = new Zend_Application(Glo_Environment::get(), APPLICATION_PATH . '/configs/application.ini');
     //
     // register the database configuration
     $bootstrap = $application->getBootstrap();
     $bootstrap->bootstrap('multidb');
     $resource = $bootstrap->getResource('multidb');
     Zend_Registry::set("conn_read", $resource->getDb('read'));
     Zend_Registry::set("conn_read_volatile", $resource->getDb('read_volatile'));
     Zend_Registry::set("conn_write", $resource->getDb('write'));
     return $application;
 }
开发者ID:highhair20,项目名称:glo,代码行数:31,代码来源:Bootstrap.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $application->getBootstrap()->bootstrap();
     $this->_form = new Student_Form_CreateStudentProfile();
 }
开发者ID:NgoDucHai,项目名称:Student,代码行数:7,代码来源:CreateProfileTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     $app->getBootstrap()->bootstrap();
     $this->_form = new Student_Form_UpdateProfile();
 }
开发者ID:NgoDucHai,项目名称:Student,代码行数:7,代码来源:UpdateProfile.php

示例5: getInternalDomains

 protected function getInternalDomains()
 {
     $router = $this->bootstrap->getBootstrap()->getResource('frontcontroller')->getRouter();
     $this->domainCollector = [];
     $this->addInternalDomainsFromRoutes($router->getRoutes());
     return array_unique($this->domainCollector);
 }
开发者ID:janhenkgerritsen,项目名称:Codeception,代码行数:7,代码来源:ZF1.php

示例6: restoreDBFromBackup

function restoreDBFromBackup()
{
    makeRed("Restore Database? WARNING: This will drop all tables and restore data to last backup!");
    echo "(Y/N): ";
    $data = FOPEN("php://stdin", "rb");
    $input = '';
    while (1 == 1) {
        $chunk = FREAD($data, 1);
        if ($chunk == "\n" || $chunk == "\r") {
            break;
        }
        $input .= $chunk;
    }
    FCLOSE($data);
    if (strtolower(@$input) == 'y') {
        echo "Getting Credentials from application.ini...\n";
        $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $bootstrap = $application->getBootstrap();
        $options = $bootstrap->getOptions();
        $db = $options['resources']['db']['params'];
        echo "Database Restoring. Please be patient, this could take a while...";
        sleep(1);
        echo ".";
        sleep(1);
        echo ".";
        sleep(1);
        echo ".";
        echo "\n";
        exec("mysql -u " . $db['username'] . " -p" . $db['password'] . " " . $db['dbname'] . " < " . APPLICATION_PATH . "/../data/dbbackup.sql", $output);
        makeGreen("DONE!");
        echo "\n\n";
    } else {
        echo "Operation Cancelled.\n";
    }
}
开发者ID:tolya199178,项目名称:swift,代码行数:35,代码来源:restoreDBFromBackup.php

示例7: init

 public function init()
 {
     // Define some CLI options
     $getopt = new Zend_Console_Getopt(array('withdata|w' => 'Load database with sample data', 'env|e-s' => 'Application environment for which to create database (defaults to development)', 'help|h' => 'Help -- usage message'));
     try {
         $getopt->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         // Bad options passed: report usage
         echo $e->getUsageMessage();
         return false;
     }
     // Initialize Zend_Application
     $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
     // Initialize and retrieve DB resource
     $bootstrap = $application->getBootstrap();
     $bootstrap->bootstrap('db');
     $dbAdapter = $bootstrap->getResource('db');
     // let the user know whats going on (we are actually creating a
     // database here)
     if ('testing' != APPLICATION_ENV) {
         echo 'Writing Database Guestbook in (control-c to cancel): ' . PHP_EOL;
         for ($x = 5; $x > 0; $x--) {
             echo $x . "\r";
             sleep(1);
         }
     }
     vd(1);
 }
开发者ID:kotmonstr,项目名称:zend,代码行数:28,代码来源:PatchController.php

示例8: setUp

    public function setUp()
    {
        include APPLICATION_PATH . '/../scripts/load.sqlite.php';

        $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $this->bootstrap = array($application->getBootstrap(), 'bootstrap');
        return parent::setUp();
    }
开发者ID:nestorfabian,项目名称:REST-Example-App-for-Zend-Framework,代码行数:8,代码来源:GuestbookControllerTest.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     $app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . "/configs/application.ini");
     $app->bootstrap('translate');
     $this->translate = $app->getBootstrap()->getResource('translate');
     $this->translate->setLocale(new Zend_Locale('vi_VN'));
 }
开发者ID:hungtrinh,项目名称:ProfileManager,代码行数:8,代码来源:VietnameseTest.php

示例10: bootstrap

 public static function bootstrap($resource = null)
 {
     include_once 'Zend/Loader/Autoloader.php';
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->registerNamespace('Saffron_');
     $application = new Zend_Application(self::_getEnv(), self::_getConfig());
     return $application->getBootstrap()->bootstrap($resource);
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:8,代码来源:init.php

示例11: setUp

    public function setUp()
    {
        include APPLICATION_PATH . '/../scripts/load.sqlite.php';
        $application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $bootstrap   = $application->getBootstrap();
        $bootstrap->bootstrap('autoload');
        $bootstrap->bootstrap('db');

        $this->guestbook = new Model_Guestbook();
    }
开发者ID:nestorfabian,项目名称:REST-Example-App-for-Zend-Framework,代码行数:10,代码来源:GuestbookTest.php

示例12: __construct

 public function __construct(\Zend_Application $application)
 {
     parent::__construct();
     $this->_application = $application;
     $this->_bootstrap = $application->getBootstrap();
     $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel');
     $this->_container = $this->_bootstrap->getResource('serviceContainer');
     $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager');
     $this->_logger = $this->_bootstrap->getResource('logger');
 }
开发者ID:ud223,项目名称:yj,代码行数:10,代码来源:AngelCommand.php

示例13: getResource

 public static function getResource($resourceName, $moduleName = '')
 {
     $front = Zend_Controller_Front::getInstance();
     $boot = $front->getParam('bootstrap');
     if (empty($boot)) {
         $application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . '/' . APPLICATION_CONFIG_FILENAME);
         if (empty($moduleName)) {
             $application->getBootstrap()->bootstrap($resourceName);
             return $application->getBootstrap()->getResource($resourceName);
         } else {
             $application->getBootstrap()->bootstrap('modules');
             return $application->getBootstrap()->getResource('modules')->offsetGet($moduleName)->getResource($resourceName);
         }
     } else {
         if (empty($moduleName)) {
             return $front->getParam('bootstrap')->getResource($resourceName);
         } else {
             return $front->getParam('bootstrap')->getResource('modules')->offsetGet($moduleName)->getResource($resourceName);
         }
     }
 }
开发者ID:hukumonline,项目名称:pmg,代码行数:21,代码来源:Application.php

示例14: doRequest

 public function doRequest($request)
 {
     // redirector should not exit
     $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $redirector->setExit(false);
     // json helper should not exit
     $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $zendRequest = new \Zend_Controller_Request_HttpTestCase();
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setCookies($request->getCookies());
     //$zendRequest->setParams($request->getParameters());
     if (strtoupper($request->getMethod()) == 'GET') {
         $_GET = $this->remapRequestParameters($request->getParameters());
     }
     if (strtoupper($request->getMethod()) == 'POST') {
         $_POST = $this->remapRequestParameters($request->getParameters());
     }
     $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri()));
     $zendRequest->setHeaders($request->getServer());
     $_FILES = $this->remapFiles($request->getFiles());
     // это нужно для нормальной работы SE
     $_SERVER['HTTP_HOST'] = str_replace('http://', '', $this->host);
     if (isset($_SERVER['HTTP_REFERER'])) {
         $_SERVER['HTTP_REFERER'] = str_replace('http://localhost', '', $_SERVER['HTTP_REFERER']);
     }
     //$_SERVER['SERVER_SOFTWARE'] = '';
     $_SERVER['REQUEST_METHOD'] = strtoupper($request->getMethod());
     $_SERVER['REQUEST_URI'] = str_replace('http://localhost', '', $request->getUri());
     $zendResponse = new \Zend_Controller_Response_Http();
     $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->setRequest($zendRequest)->setResponse($zendResponse);
     ob_start();
     $this->bootstrap->run();
     ob_end_clean();
     $this->zendRequest = $zendRequest;
     $headers['Content-type'] = "text/html; charset=UTF-8";
     $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $headers);
     return $response;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:39,代码来源:SocialEngine.php

示例15: _after

 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $this->front = $this->bootstrap->getBootstrap()->getContainer()->frontcontroller->resetInstance();
     \Zend_Layout::resetMvcInstance();
     \Zend_Controller_Action_HelperBroker::resetHelpers();
     \Zend_Session::$_unitTestEnabled = true;
     $this->queries = 0;
     $this->time = 0;
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:13,代码来源:SocialEngine.php


注:本文中的Zend_Application::getBootstrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。