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


PHP Zend_Application类代码示例

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


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

示例1: 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

示例2: 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

示例3: setUpBeforeClass

 /**
  * Prepares the environment before running ALL tests.
  */
 public static function setUpBeforeClass()
 {
     // Inicializa o ZF
     $inifile = getenv('TRAVIS') !== false ? 'application.travis.ini' : 'application.ini';
     $bootstrap = new Zend_Application('testing', TEST_ROOT . '/assets/application/configs/' . $inifile);
     $bootstrap->bootstrap();
 }
开发者ID:realejo,项目名称:library-zf1,代码行数:10,代码来源:BaseTestCase.php

示例4: setUp

 public function setUp()
 {
     $application = new Zend_Application('testing', APPLICATION_PATH . '/configs/application.ini');
     $bootstrap = $application->bootstrap()->getBootstrap();
     $this->em = $bootstrap->getResource('entityManager');
     parent::setUp();
 }
开发者ID:JernejKorosec,项目名称:z2d2,代码行数:7,代码来源:ModelTestCase.php

示例5: testBootstrap

 public function testBootstrap()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application.ini');
     $rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
     $this->assertType('Rediska', $rediska);
     $this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
 }
开发者ID:grenzr,项目名称:sfRediskaPlugin,代码行数:7,代码来源:Resource.php

示例6: testBootstrap

 public function testBootstrap()
 {
     $application = new Zend_Application('tests', REDISKA_TESTS_PATH . '/Test/Zend/Application/application.ini');
     $rediska = $application->bootstrap()->getBootstrap()->getResource('rediska');
     $this->assertType('Rediska', $rediska);
     $this->assertEquals('Rediska_Test_', $rediska->getOption('namespace'));
 }
开发者ID:utachkin,项目名称:Rediska,代码行数:7,代码来源:Resource.php

示例7: getApplication

 /**
  * 
  * @return Zend_Application
  */
 public static function getApplication()
 {
     $application = new Zend_Application(APPLICATION_ENV);
     $applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
     $options = $applicationini->toArray();
     foreach (self::$_ini as $value) {
         $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
         if (is_readable($iniFile)) {
             $config = new Zend_Config_Ini($iniFile);
             $options = $application->mergeOptions($options, $config->toArray());
         } else {
             throw new Zend_Exception('error en la configuracion de los .ini');
         }
     }
     //        foreach (self::$_ini as $value) {
     //            $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
     //
     //            if (is_readable($iniFile)) {
     //                $config = new Zend_Config_Ini($iniFile);
     //                $options = $application->mergeOptions($options,
     //                    $config->toArray());
     //            } else {
     //            throw new Zend_Exception('error en la configuracion de los .ini');
     //            }
     //        }
     Zend_Registry::set('config', $options);
     $a = $application->setOptions($options);
     return $application;
 }
开发者ID:josmel,项目名称:HosPot,代码行数:33,代码来源:index.php

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: testNewInstance

 public function testNewInstance()
 {
     $application = new Zend_Application('tests', dirname(__FILE__) . '/application4.ini');
     $application->bootstrap()->getBootstrap()->getResource('session');
     $rediska = Zend_Session::getSaveHandler()->getRediska();
     $this->assertEquals('default', $rediska->getOption('name'));
     $this->assertEquals(array(), Rediska_Manager::getAll());
 }
开发者ID:r-kovalenko,项目名称:Rediska,代码行数:8,代码来源:ResourceTest.php

示例14: setUp

 /**
  * Overwrite standard setUp method, no database connection needed.  Will
  * create a file listing of class files instead.
  *
  * @return void
  */
 public function setUp()
 {
     require_once 'Zend/Application.php';
     set_include_path('../modules' . PATH_SEPARATOR . get_include_path());
     // Do test environment initializiation.
     $application = new Zend_Application(APPLICATION_ENV, array("config" => array(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_PATH . '/tests/config.ini')));
     $application->bootstrap();
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:14,代码来源:RequireTest.php

示例15: __construct

 /**
  * Constructor
  *
  * Invoke setContainerFactory, set _coantainerFactory if factory is configurated
  * Ensure FrontController resource is registered
  *
  * @param  Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application
  * @return void
  */
 public function __construct($application)
 {
     $this->setContainerFactory($application->getOptions());
     parent::__construct($application);
     if (!$this->hasPluginResource('FrontController')) {
         $this->registerPluginResource('FrontController');
     }
 }
开发者ID:joericochuyt,项目名称:zf-with-doctrine,代码行数:17,代码来源:Bootstrap.php


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