本文整理汇总了PHP中AkConfig::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP AkConfig::getOption方法的具体用法?PHP AkConfig::getOption怎么用?PHP AkConfig::getOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AkConfig
的用法示例。
在下文中一共展示了AkConfig::getOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_should_show_public_dot_404_dot_php
public function test_should_show_public_dot_404_dot_php()
{
$this->setMaximumRedirects(0);
$this->get(AkConfig::getOption('testing_url') . '/action_pack/public/index.php?ak=invalid');
$this->assertResponse(404);
$this->assertText("Exception in InvalidController#index");
}
示例2: index
public function index()
{
$this->base_dir = AK_BASE_DIR;
$this->akelos_dir = AK_FRAMEWORK_DIR;
$this->tasks_dir = AK_TASKS_DIR;
$this->has_configuration = file_exists(AkConfig::getDir('config') . DS . 'config.php');
$this->has_routes = file_exists(AkConfig::getDir('config') . DS . 'routes.php');
$this->has_database = file_exists(AkConfig::getDir('config') . DS . 'database.yml');
$this->using_root_path = $this->Request->getPath() == '/';
$this->new_install = !$this->has_configuration || !$this->has_routes || $this->using_root_path;
$this->environment = AK_ENVIRONMENT;
$this->memcached_on = AkMemcache::isServerUp();
$this->constants = AkDebug::get_constants();
$this->langs = Ak::langs();
$this->database_settings = Ak::getSettings('database', false);
$this->server_user = trim(AK_WIN ? `ECHO %USERNAME%` : `whoami`);
$this->local_ips = AkConfig::getOption('local_ips', array('localhost', '127.0.0.1', '::1'));
$paths = array(AK_APP_DIR . DS . 'locales');
$this->invalid_permissions = array();
foreach ($paths as $path) {
if (is_dir($path) && !@file_put_contents($path . DS . '__test_file')) {
$this->invalid_permissions[] = $path;
} else {
@unlink($path . DS . '__test_file');
}
}
}
示例3: __construct
function __construct()
{
if (!($this->webserver_enabled = AkConfig::getOption('webserver_enabled', false))) {
return;
}
$this->url = AkConfig::getOption('testing_url') . '/active_resource/public/index.php?ak=http_requests';
parent::__construct();
}
示例4: getRegistered
static function getRegistered()
{
// we register a dictionary: mime_type => our_type
// this is an ordered list, the first entry has top priority
// say a client accepts different mime_types with the same 'q'uality-factor
// we then won't just pop his first one, but our best match within this group
// http://www.iana.org/assignments/media-types/
$mime_types = AkConfig::getOption('mime_types', array('text/html' => 'html', 'application/xhtml+xml' => 'html', 'application/xml' => 'xml', 'text/xml' => 'xml', 'text/plain' => 'txt', 'text/css' => 'css', 'text/calendar' => 'ics', 'text/csv' => 'csv', 'text/javascript' => 'js', 'application/javascript' => 'js', 'application/x-javascript' => 'js', 'application/json' => 'json', 'text/x-json' => 'json', 'application/jsonrequest' => 'json', 'application/rss+xml' => 'rss', 'application/atom+xml' => 'atom', 'application/x-yaml' => 'yaml', 'text/yaml' => 'yaml', '*/*' => 'html', 'application/x-www-form-urlencoded' => 'html', 'multipart/form-data' => 'html', 'default' => 'html'));
return $mime_types;
}
示例5: test_all_session_handlers
public function test_all_session_handlers()
{
$cacheHandlers = array('cache_lite' => 1);
if (!Ak::db() instanceof AkSqliteDbAdapter) {
$cacheHandlers['akadodbcache'] = 2;
}
if (AkConfig::getOption('memcached_enabled', false)) {
$cacheHandlers['akmemcache'] = 3;
}
$unitTests = array('_Test_open', '_Test_read_write', '_Test_destroy', '_Test_gc');
foreach ($cacheHandlers as $class => $type) {
foreach ($unitTests as $test) {
$this->{$test}($type, $class);
}
}
}
示例6: test_all_caches
public function test_all_caches()
{
$cacheHandlers = array('cache_lite' => 1, 'akadodbcache' => 2);
$memcacheEnabled = AkConfig::getOption('memcached_enabled', false);
AkUnitTestSuite::createTestingDatabaseIfNotAvailable();
if ($memcacheEnabled) {
$cacheHandlers['akmemcache'] = 3;
}
$unitTests = array('_testInit', '_getAndSaveTests', '_removeTests', '_cleanTests');
foreach ($cacheHandlers as $class => $type) {
foreach ($unitTests as $test) {
unset($this->Cache);
$this->Cache = new AkCache();
$this->{$test}($type, $class);
}
$this->Cache->clean($this->group);
}
}
示例7: init
public function init($options)
{
// Ak::getLogger('sessions')->info(__METHOD__);
$this->default_options['secure'] = AK_PROTOCOL == 'https://';
// 'session.cookie_domain' should be set to empty string for all local domain names,
// not only for 'localhost' (but should not be empty for local IP addresses)
if (strstr(AK_HOST, '.') === false) {
$this->default_options['domain'] = '';
}
$this->options = array_merge($this->default_options, AkConfig::getOption('action_controller.session', array()));
$this->options = array_merge($this->options, $options);
$this->options['expire_after'] = time() + $this->options['expire_after'];
$this->ensureSessionKey();
$this->ensureSecretSecure();
ini_set('session.use_cookies', '0');
session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc'));
session_start();
return true;
}
示例8: test_all_caches
public function test_all_caches()
{
$cacheHandlers = array('cache_lite' => 1, 'akadodbcache' => 2);
$memcacheEnabled = AkConfig::getOption('memcached_enabled', AkMemcache::isServerUp());
if ($memcacheEnabled) {
$cacheHandlers['akmemcache'] = 3;
}
$unitTests = array('_test_cache_with_string_key', '_test_cache_with_string_key_cached');
if ($this->controller->_CacheHandler instanceof AkCacheHandler) {
foreach ($cacheHandlers as $class => $type) {
$this->controller->_CacheHandler->setCacheStore($type);
$this->_test_init();
foreach ($unitTests as $test) {
$this->{$test}($class);
}
}
} else {
$this->fail('CacheHandler is not initialized. Please enable the caching system for the unit-test');
}
}
示例9: 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);
}
示例10: 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);
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->doc = new DOMDocument();
$this->doc->loadXML('<testsuite/>');
$this->root = $this->doc->documentElement;
$base_path = defined('MAKELOS_BASE_DIR') ? MAKELOS_BASE_DIR : AK_BASE_DIR;
$file_path = AkConfig::getOption('report_path', $base_path . DS . 'reports' . DS . 'units.xml');
AkFileSystem::file_put_contents($file_path, "<?xml version=\"1.0\"?>\n", array('base_path' => $base_path));
$this->_fp = @fopen($file_path, 'a');
}
示例12:
private function &_getControllerInstance()
{
$params = $this->getParams();
if ($rebase_path = AkConfig::getOption('rebase_path', false)) {
AkConfig::rebaseApp($rebase_path);
}
$module_details = $this->_getModuleDetailsFromParams($params);
$controller_details = $this->_getControllerDetailsFromParamsAndModuleDetails($params, $module_details);
$this->_includeModuleSharedController($module_details);
$this->_includeController($controller_details);
$this->_ensureControllerClassExists($controller_details);
$Controller = new $controller_details['class_name'](array('controller' => true));
$Controller->setModulePath($module_details['path']);
$this->_linkSessionToController($Controller);
return $Controller;
}
示例13: 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');
}
示例14: getActionSeparator
public function getActionSeparator()
{
return isset($this->action_separator) ? $this->action_separator : AkConfig::getOption('resource_action_separator', '/');
}
示例15: __construct
public function __construct()
{
parent::__construct();
$this->webserver_enabled = AkConfig::getOption('webserver_enabled', false);
}