當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。