本文整理汇总了PHP中AkConfig::setOption方法的典型用法代码示例。如果您正苦于以下问题:PHP AkConfig::setOption方法的具体用法?PHP AkConfig::setOption怎么用?PHP AkConfig::setOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AkConfig
的用法示例。
在下文中一共展示了AkConfig::setOption方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatchAppServer
public function dispatchAppServer($context)
{
$_ENV = $_SERVER = $context['env'];
@parse_str($_ENV['QUERY_STRING'], $_GET);
$_GET['ak'] = $_ENV['PATH_INFO'];
Ak::unsetStaticVar('AkRequestSingleton');
Ak::unsetStaticVar('AkRouterSingleton');
Ak::unsetStaticVar('AkUrlWriterSingleton');
AkConfig::setOption('Request.remote_ip', '127.0.0.1');
try {
$time_start = microtime(true);
AK_ENABLE_PROFILER && AkDebug::profile(__CLASS__ . '::' . __FUNCTION__ . '() call');
$this->Request = AkRequest::getInstance();
$this->Response = new AkResponse();
$path = ltrim(str_replace('..', '.', $context['env']['REQUEST_URI']), '/. ');
if (empty($path) && file_exists(AK_PUBLIC_DIR . DS . 'index.html')) {
$Controller = new AkActionController();
$Controller->Response = $this->Response;
$Controller->renderText(file_get_contents(AK_PUBLIC_DIR . DS . 'index.html'));
return $Controller->Response;
} elseif (!empty($path) && file_exists(AK_PUBLIC_DIR . DS . $path)) {
$Controller = new AkActionController();
$Controller->Response = $this->Response;
$Controller->sendFile(AK_PUBLIC_DIR . DS . $path, array('stream' => false));
return $Controller->Response;
} else {
if ($this->Controller = $this->Request->recognize()) {
$this->Controller->ak_time_start = $time_start;
AK_ENABLE_PROFILER && AkDebug::profile('Request::recognize() completed');
$this->Controller->process($this->Request, $this->Response);
}
return $this->Response;
}
} catch (Exception $e) {
if (isset($this->Controller) && method_exists($this->Controller, 'render_error')) {
$this->Controller->render_error($e);
} else {
$ExceptionDispatcher = new AkExceptionDispatcher();
$ExceptionDispatcher->renderException($e);
}
}
}
示例2: defined
/**
* This file is will include Akelos autoload.php where the framework makes most of Akelos
* environment guessing. You can override most Akelos constants by declaring them in
* this file.
*
* You can retrieve a list of current settings by running AkDebug::get_constants();
*
* If you're running a high load site you might want to fine tune this options
* according to your environment. If you set the options implicitly you might
* gain in performance but loose in flexibility when moving to a different
* environment.
*
* If you need to customize the framework default settings or specify
* internationalization options, edit the files at config/environments/*
*/
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
defined('AK_BASE_DIR') || define('AK_BASE_DIR', str_replace(DS . 'config' . DS . 'environment.php', '', __FILE__));
defined('AK_FRAMEWORK_DIR') || define('AK_FRAMEWORK_DIR', AK_BASE_DIR . DS . 'vendor' . DS . 'akelos');
defined('AK_TESTING_NAMESPACE') || define('AK_TESTING_NAMESPACE', 'akelos');
include AK_FRAMEWORK_DIR . DS . 'autoload.php';
/**
* After including autoload.php, you can override configuration options by calling:
*
* AkConfig::setOption('option_name', 'value');
*/
// Akelos only shows debug messages if accessed from the localhost IP, you can manually tell
// Akelos which IP's you consider to be local.
// AkConfig::setOption('local_ips', array('127.0.0.1', '192.168.1.69'));
AkConfig::setOption('action_controller.session', array("key" => "_data", "secret" => "[SECRET]"));
示例3: _rebaseApplicationIfRequired
private function _rebaseApplicationIfRequired()
{
if (isset($this->requirements['rebase'])) {
AkConfig::setOption('rebase_path', (AK_WIN ? '' : DS) . $this->requirements['rebase']);
unset($this->requirements['rebase']);
}
}
示例4: dirname
<?php
require_once dirname(__FILE__) . '/../config.php';
class ActiveDocumentUnitTest extends AkUnitTest
{
public function __construct()
{
AkConfig::setDir('suite', dirname(__FILE__));
$this->rebaseAppPaths();
$this->db = new AkOdbAdapter();
$this->db->connect(array('type' => 'mongo_db', 'database' => 'akelos_testing'));
defined('AK_TESTING_MONGO_DB_IS_CONNECTED') || define('AK_TESTING_MONGO_DB_IS_CONNECTED', $this->db->isConnected());
}
public function __destruct()
{
parent::__destruct();
}
public function skip()
{
$this->skipIf(!AK_TESTING_MONGO_DB_IS_CONNECTED, '[' . get_class($this) . '] ' . 'Can\'t connect to MongoDB');
}
}
AkConfig::setOption('document_connections', array(array('type' => 'mongo_db')));
示例5: unregister
static function unregister($content_type)
{
$mime_types = AkMimeType::getRegistered();
unset($mime_types[$content_type]);
AkConfig::setOption('_core_mime_types', $mime_types);
}
示例6: defined
defined('AK_BASE_DIR') || define('AK_BASE_DIR', str_replace(DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php', '', substr(AK_TEST_DIR, 0, -5)));
defined('AK_LOG_EVENTS') || define('AK_LOG_EVENTS', true);
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
defined('AK_FRAMEWORK_DIR') || define('AK_FRAMEWORK_DIR', AK_BASE_DIR);
defined('AK_TESTING_NAMESPACE') || define('AK_TESTING_NAMESPACE', 'akelos');
defined('AK_TESTING_URL') || define('AK_TESTING_URL', 'http://akelos.tests');
include_once AK_FRAMEWORK_DIR . DS . 'autoload.php';
if (AK_CLI && !AK_WIN) {
// will try to set the right mode for tmp folders, git does not kee trac of this for us
foreach ((array) glob(AK_BASE_DIR . DS . 'tmp' . DS . '*' . DS . '*/') as $__folder) {
`chmod 777 {$__folder}`;
}
unset($__folder);
}
if (!AkConfig::getOption('testing_url', false)) {
AkConfig::setOption('testing_url', AK_TESTING_URL);
}
AkUnitTestSuite::checkIfTestingWebserverIsAccesible(array('base_path' => AK_TEST_DIR . DS . AK_TESTING_NAMESPACE));
AkUnitTestSuite::createTestingDatabaseIfNotAvailable();
AkUnitTestSuite::ensureTmpDirPermissions();
try {
ob_start();
if (!class_exists('BaseActionController')) {
class BaseActionController extends AkActionController
{
}
}
if (!class_exists('ApplicationController')) {
class ApplicationController extends BaseActionController
{
public $layout = false;
示例7: test_member_when_changed_default_restful_actions_and_path_names_not_specified
public function test_member_when_changed_default_restful_actions_and_path_names_not_specified()
{
$controller = 'messages';
$default_path_names = AkConfig::getOption('resources_path_names', array('add' => 'add', 'edit' => 'edit'));
AkConfig::setOption('resources_path_names', array('add' => 'nuevo', 'edit' => 'editar'));
$add_options = array('action' => 'add', 'controller' => $controller);
$add_path = '/' . $controller . '/nuevo';
$edit_options = array('action' => 'edit', 'id' => 1, 'controller' => $controller);
$edit_path = '/' . $controller . '/1/editar';
$this->useRestfulRoutingMapper($controller);
$this->assertRestfulRoutesFor($controller, array('path' => $add_path, 'method' => 'get'));
$this->assertRestfulRoutesFor($controller, array('path' => $edit_path, 'method' => 'get'));
AkConfig::setOption('resources_path_names', $default_path_names);
}
示例8: logError
public function logError($Exception)
{
if (!($Logger = Ak::getLogger())) {
return;
}
$message = $Exception->getMessage() . "\n" . $Exception->getTraceAsString();
$original_faltal_setting = AkConfig::getOption('logger.exit_on_fatal', true);
$original_display_setting = AkConfig::getOption('logger.display_message', true);
$original_mail_setting = AkConfig::getOption('logger.send_mails', true);
AkConfig::setOption('logger.exit_on_fatal', false);
AkConfig::setOption('logger.display_message', false);
AkConfig::setOption('logger.send_mails', false);
$Logger->fatal("\n" . get_class($Exception) . (empty($message) ? '' : ': (' . $message . ")") . "\n ");
AkConfig::setOption('logger.exit_on_fatal', $original_faltal_setting);
AkConfig::setOption('logger.display_message', $original_display_setting);
AkConfig::setOption('logger.send_mails', $original_mail_setting);
}
示例9: checkIfTestingWebserverIsAccesible
static function checkIfTestingWebserverIsAccesible($options = array())
{
if (AkConfig::getOption('webserver_enabled', false)) {
return;
}
if (!AK_WEB_REQUEST && file_exists($options['base_path'] . DS . 'ping.php')) {
$uuid = Ak::uuid();
file_put_contents($options['base_path'] . DS . 'akelos_test_ping_uuid.txt', $uuid);
AkConfig::setOption('webserver_enabled', @file_get_contents(AkConfig::getOption('testing_url') . '/' . basename($options['base_path']) . '/ping.php') == $uuid);
unlink($options['base_path'] . DS . 'akelos_test_ping_uuid.txt');
} else {
AkConfig::setOption('webserver_enabled', false);
}
}
示例10: test_should_get_not_get_default_option_if_already_set
public function test_should_get_not_get_default_option_if_already_set()
{
AkConfig::setOption('valid', 'yes');
$this->assertEqual(AkConfig::getOption('valid', 'default'), 'yes');
}
示例11: __destruct
public function __destruct()
{
unlink(AkConfig::getDir('config') . DS . 'admin_testing.yml');
AkConfig::setOption('test_mode_settings_namespace', null);
parent::__destruct();
}
示例12: define
<?php
if (!defined('AK_BASE_DIR') && !defined('AK_FRAMEWORK_DIR')) {
define('AK_FRAMEWORK_DIR', realpath(dirname(__FILE__) . '/../../'));
if (is_dir(AK_FRAMEWORK_DIR . DIRECTORY_SEPARATOR . 'app_layout')) {
define('AK_BASE_DIR', AK_FRAMEWORK_DIR . DIRECTORY_SEPARATOR . 'app_layout');
}
}
require_once dirname(__FILE__) . '/../shared/config/config.php';
AkConfig::setOption('testing_url', 'http://akelos.tests/akelos');
AkConfig::setOption('action_controller.session', array("key" => "_myapp_session", "secret" => "c1ef4792-42c5-b484-819e-16750c71cddb"));
AkUnitTestSuite::checkIfTestingWebserverIsAccesible(array('base_path' => dirname(__FILE__)));
AkConfig::setOption('memcached_enabled', AkMemcache::isServerUp());
if (AK_WEB_REQUEST && !(AK_REMOTE_IP == '127.0.0.1' || AK_REMOTE_IP == '::1')) {
die('Web tests can only be called from localhost(127.0.0.1), you can change this beahviour in ' . __FILE__);
}