本文整理汇总了PHP中Zend_Application::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Application::getOption方法的具体用法?PHP Zend_Application::getOption怎么用?PHP Zend_Application::getOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Application
的用法示例。
在下文中一共展示了Zend_Application::getOption方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOption
public static function getOption($key)
{
$front = Zend_Controller_Front::getInstance();
$boot = $front->getParam('bootstrap');
if (empty($boot)) {
$application = new Zend_Application(APPLICATION_ENV, CONFIG_PATH . '/' . APPLICATION_CONFIG_FILENAME);
return $application->getOption($key);
} else {
return $front->getParam('bootstrap')->getOption($key);
}
}
示例2: defined
}
if (isset($opts->app_env)) {
defined('APPLICATION_ENV') || define('APPLICATION_ENV', $opts->app_env);
} else {
echo "\n\nParametr app_env jest wymagany!";
echo "\n\n" . $opts->getUsageMessage() . "\n\n";
exit;
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true;
$application->bootstrap();
Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap());
$user = $application->getOption('bin');
if ($user['user'] === null || $user['branch'] === null) {
throw new Exception('Brak ustawień w application.ini bin.user lub bin.branch');
}
$u = new User();
$u_data = $u->fetchRow("login = '" . $user['user'] . "'", "id DESC");
if (null == $u_data) {
throw new Exception('Brak użytkownika o podanym loginie ' . $user['user']);
}
$u_data->toArray();
$storageRow = new stdClass();
foreach ($u_data as $key => $value) {
$storageRow->{$key} = $value;
}
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
示例3: define
<?php
/*
* Copyright 2013 pingworks - Alexander Birk und Christoph Lukas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__)));
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/library'), get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Zend_Registry::set("datadir", $bootstrap->getOption('datadir'));
require_once 'PHPUnit/Extensions/SeleniumTestSuite.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
require_once 'PHPUnit/Util/Test.php';
示例4: testOptionsCanHandleMuiltipleConigFiles
public function testOptionsCanHandleMuiltipleConigFiles()
{
$application = new Zend_Application('testing', array('config' => array(dirname(__FILE__) . '/_files/Zf-6719-1.ini', dirname(__FILE__) . '/_files/Zf-6719-2.ini')));
$this->assertEquals('baz', $application->getOption('foo'));
}
示例5: define
<?php
error_reporting(E_ALL | E_STRICT);
// 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') : 'testing');
// 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';
require_once 'Zend/Config.php';
require_once 'Zend/Config/Ini.php';
require_once 'ControllerTestCase.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->getBootstrap()->bootstrap("doctrine");
$cli = new Doctrine_Cli($application->getOption('doctrine'));
@$cli->run(array("doctrine", "drop-db", "force"));
@$cli->run(array("doctrine", "generate-models-yaml", "force"));
@$cli->run(array("doctrine", "create-db", "force"));
@$cli->run(array("doctrine", "create-tables", "force"));
$cli->run(array("doctrine", "load-data", "force"));
示例6: define
<?php
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..'));
if (isset($_SERVER['argv'][2]) && $_SERVER['argv'][2] != '') {
switch ($_SERVER['argv'][2]) {
case "test":
define('APPLICATION_ENV', 'testing');
break;
case "dev":
define('APPLICATION_ENV', 'development');
break;
case "prod":
define('APPLICATION_ENV', 'production');
break;
}
}
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'doctrineCLI');
// 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');
$application->getBootstrap()->bootstrap('doctrine');
$config = $application->getOption('doctrine');
$cli = new Doctrine_Cli($config);
$cli->run($_SERVER['argv']);
示例7: dirname
* http://www.gnu.org/licenses/gpl-2.0.html
*/
$SRCDIR_LOG = "/srv/mrtg";
$DESTDIR_LOG = "/srv/mrtg";
mb_internal_encoding('UTF-8');
mb_language('uni');
setlocale(LC_ALL, "en_IE.utf8");
require_once dirname(__FILE__) . '/../../../bin/utils.inc';
define('APPLICATION_ENV', scriptutils_get_application_env());
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->getBootstrap()->bootstrap('OSSAutoLoader');
$config = $application->getOption('resources');
$plugin = new OSS_Resource_Doctrine2($config['doctrine2']);
$application->getBootstrap()->registerPluginResource($plugin);
$em = $plugin->getDoctrine2('default');
foreach ($em->getRepository('\\Entities\\Customer')->findAll() as $cust) {
$logs = [];
foreach ($cust->getVirtualInterfaces() as $viInt) {
foreach ($viInt->getPhysicalInterfaces() as $pInt) {
$mrtg = sprintf("%s/members/%s/%s-%d-bits.log", $SRCDIR_LOG, $cust->getShortname(), $cust->getShortname(), $pInt->getMonitorindex());
if (!file_exists($mrtg) || !($src = fopen($mrtg, 'r'))) {
echo "ERROR: Missing / cannot access source file for customer {$cust->getShortname()} for mointor index {$pInt->getMonitorindex()}.\n";
continue;
}
while (($buffer = fgets($src, 4096)) !== false) {
$row = explode(' ', $buffer);
if (count($row) == 3) {
示例8: define
<?php
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__))));
// 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(dirname(APPLICATION_PATH) . '/library'), get_include_path())));
require 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
require '../../library/ZFcodo/Codegen/Manager.php';
$qzfConfig = $application->getOption('zq');
$manager = new ZFcodo_Manager($qzfConfig);
$manager->loadOrm();
//run the codegen
$manager->runCodegen();
示例9: catch
// Get all available options and does some validity checking
try {
$opts->parse();
} catch (Exception $e) {
Ot_Cli_Output::error($opts->getUsageMessage());
}
if (!isset($opts->environment) || !in_array($opts->environment, $possibleEnvironments)) {
Ot_Cli_Output::error('Environment not sepecified or not available' . "\n\n" . $opts->getUsageMessage());
}
if (!isset($opts->cmd) || !in_array($opts->cmd, $possibleCommands)) {
Ot_Cli_Output::error('Command not sepecified or not available' . "\n\n" . $opts->getUsageMessage());
}
// Define application environment
defined('APPLICATION_ENV') || define('APPLICATION_ENV', $opts->environment);
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap('db');
// Get the database configs
$tablePrefix = $application->getOption('tablePrefix');
$dbAdapter = $application->getBootstrap()->getPluginResource('db')->getDbAdapter();
// Run the migrator
try {
$migration = new Ot_Migrate($dbAdapter, $pathToMigrateFiles, $tablePrefix);
$result = $migration->migrate($opts->cmd, $opts->version);
} catch (Exception $e) {
Ot_Cli_Output::error($e->getMessage());
}
// Display the results
Ot_Cli_Output::success($result);
// Exit without any errors
exit;
示例10: define
<?php
/*
* Copyright 2013 pingworks - Alexander Birk und Christoph Lukas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 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') : 'testing');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../tests/library'), get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Zend_Registry::set("repodir", $bootstrap->getOption('repodir'));
Zend_Registry::set("datadir", $bootstrap->getOption('datadir'));
Zend_Registry::set("defaultbranch", $bootstrap->getOption('defaultbranch'));
Zend_Registry::set("pipelinestages", $bootstrap->getOption('pipelinestages'));
示例11: define
<?php
// 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');
if ($application->getOption('debug')) {
TRF_Debug::setEnabled(true);
TRF_Debug::getGenerateTime('Begin');
}
Zend_Layout::startMvc();
$application->bootstrap()->run();
if ($application->getOption('debug')) {
TRF_Debug::getGenerateTime('End');
}