本文整理汇总了PHP中Zend_Application::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application::setOptions方法的具体用法?PHP Zend_Application::setOptions怎么用?PHP Zend_Application::setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Application
的用法示例。
在下文中一共展示了Zend_Application::setOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: onRequest
public function onRequest(GetResponseEvent $event)
{
if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
// don't do anything if it's not the master request
return;
}
$request = $event->getRequest();
$pos = strpos($request->server->get('REQUEST_URI'), '_profiler');
// don't call Zend Application for profiler.
if (false === $pos) {
// init adodb
require_once __DIR__ . '/../../../../db_connect.php';
// Fill zend application options
$config = $this->container->getParameterBag()->all();
$application = new \Zend_Application(APPLICATION_ENV);
$application->setOptions($config);
$application->bootstrap();
\Zend_Registry::set('zend_application', $application);
}
}
示例3: setOptions
/**
* @see Zend_Application::setOptions()
* @param array $options
* @return Core_Application provides a fluent interface
*/
public function setOptions(array $options)
{
if (!empty($options['config'])) {
$options = $this->_mergeFilesRecursive($options);
unset($options['config']);
}
if (!empty($options['pluginCache'])) {
if (!is_string($options['pluginCache'])) {
throw new Zend_Application_Exception('Plugin cache deve ser string');
}
Zend_Loader_PluginLoader::setIncludeFileCache($options['pluginCache']);
if (file_exists($options['pluginCache'])) {
include_once $options['pluginCache'];
}
}
return parent::setOptions($options);
}
示例4: define
<?php
/* set crossdomain request */
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
header("Access-Control-Allow-Credentials: true");
// Define application environment
if (!isset($_REQUEST['env']) || empty($_REQUEST['env'])) {
die;
} else {
define('APPLICATION_DB', $_REQUEST['env']);
}
// 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') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$config = $application->getOptions();
$config['resources']['db']['params']['dbname'] = APPLICATION_DB;
$application->setOptions($config)->bootstrap()->run();
示例5: setOptions
/**
* Set options for Centurion_Config_Manager
*
* @param array $options Options
* @return $this
*/
public function setOptions(array $options)
{
parent::setOptions($options);
Centurion_Config_Manager::add($options);
return $this;
}
示例6: define
<?php
defined('APPLICATION_ROOT') || define('APPLICATION_ROOT', realpath(__DIR__ . '/../'));
require_once APPLICATION_ROOT . '/app/Init.php';
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV);
$config = (include APPLICATION_PATH . '/configs/' . APPLICATION_ENV . '.php');
$application->setOptions($config);
try {
$application->bootstrap()->run();
} catch (Exception $e) {
Zend_Debug::dump($e->getMessage());
Zend_Debug::dump($e->getTraceAsString());
die;
}