本文整理汇总了PHP中Ak::getSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::getSettings方法的具体用法?PHP Ak::getSettings怎么用?PHP Ak::getSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::getSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$cache_settings = Ak::getSettings('caching', false);
$cache_settings['handler']['type'] = 3;
$this->memcache = AkCache::lookupStore($cache_settings);
$this->assertIsA($this->memcache, 'AkCache');
}
示例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: _flushCache
public function _flushCache($host)
{
$settings = Ak::getSettings('caching',false);
$fileCache=AkCache::lookupStore($settings);
if ($fileCache!==false) {
$fileCache->clean($host);
}
}
示例4: _perform_logout
function _perform_logout($redirect = true)
{
$this->Sentinel->init($this);
$this->Sentinel->unsetCurrentUser();
if ($redirect) {
$settings = Ak::getSettings('admin');
$this->redirectTo(empty($settings['sign_in_url']) ? array('action' => 'sign_in') : $settings['sign_in_url']);
}
}
示例5: setDefaultRole
function setDefaultRole()
{
$settings = Ak::getSettings('admin');
if (!empty($settings['account_settings']['default_role'])) {
$this->role->load();
$Role = new Role();
if ($DefaultRole = $Role->findFirstBy('name', $settings['account_settings']['default_role'])) {
$this->role->set($DefaultRole);
}
}
}
示例6: _getDefaultOptions
public function _getDefaultOptions($type = 'admin')
{
if (!empty($this->_controller->{"default_{$type}_menu_options"})) {
return $this->_controller->{"default_{$type}_menu_options"};
} elseif (!empty($this->_controller->{"_{$type}_menu_options"})) {
return $this->_controller->{"_{$type}_menu_options"};
} elseif (($options = Ak::getSettings($this->_controller->getModuleName() . "_{$type}_menu", false)) && !empty($options)) {
return $options;
} else {
return $this->_getMenuOptionsForControllersInModule($type);
}
}
示例7: _getSettings
private function _getSettings($settings = null)
{
if (is_string($settings)) {
$this->_useCustomNamespace($settings);
}
$settings = !is_array($settings) ? Ak::getSettings($this->settings_namespace, false) : $settings;
if (empty($settings)) {
trigger_error(Ak::t('You must provide a connection settings array or create a config/%namespace.yml based on config/sample/object_database.yml', array('%namespace' => $this->settings_namespace)), E_USER_WARNING);
return false;
}
return $settings;
}
示例8: loadConfig
static function loadConfig($dictionary)
{
static $_loaded = array();
if (!($return = Ak::getStaticVar('AkInflectorConfig::' . $dictionary))) {
$return = Ak::getSettings($dictionary, false);
if ($return !== false) {
Ak::setStaticVar('AkInflectorConfig::' . $dictionary, $return);
$_loaded[$dictionary] = true;
} else {
trigger_error(Ak::t('Could not load inflector rules file: %file', array('%file' => 'config' . DS . $dictionary . '.yml')), E_USER_ERROR);
}
}
return $return;
}
示例9: is_string
/**
* @static
* @param array $database_settings
* @return AkDbAdapter
*/
static function &getInstance($database_specifications = AK_DEFAULT_DATABASE_PROFILE, $auto_connect = true, $namespace = null)
{
$settings_hash = is_string($database_specifications) ? $database_specifications : AkDbAdapter::hash($database_specifications);
$static_var_name = 'AkDbAdapter_getInstance_' . $settings_hash;
if (!($Connection = Ak::getStaticVar($static_var_name))) {
defined('AK_DATABASE_SETTINGS_NAMESPACE') || define('AK_DATABASE_SETTINGS_NAMESPACE', 'database');
$namespace = empty($namespace) ? AK_DATABASE_SETTINGS_NAMESPACE : $namespace;
if (empty($database_specifications)) {
$database_specifications = Ak::getSettings($namespace, false, $settings_hash);
} elseif (is_string($database_specifications)) {
$environment_settings = Ak::getSettings($namespace, false, $database_specifications);
if (!empty($environment_settings)) {
$database_specifications = $environment_settings;
} elseif (strstr($database_specifications, '://')) {
$database_specifications = AkDbAdapter::getDbSettingsFromDsn($database_specifications);
$settings_hash = AK_ENVIRONMENT;
} else {
global $database_settings;
if (isset($database_settings) && !file_exists(AkConfig::getDir('config') . DS . $namespace . '.yml')) {
trigger_error(Ak::t("You are still using the old config/config.php database configuration. Please upgrade to use the config/database.yml configuration."), E_USER_NOTICE);
}
if (!file_exists(AkConfig::getDir('config') . DS . $namespace . '.yml')) {
trigger_error(Ak::t("Could not find the database configuration file in %dbconfig.", array('%dbconfig' => AkConfig::getDir('config') . DS . $namespace . '.yml')), E_USER_ERROR);
} else {
trigger_error(Ak::t("Could not find the database profile '%profile_name' in config/%dbfile.yml.", array('%profile_name' => $database_specifications, '%dbfile' => $namespace)), E_USER_ERROR);
}
$return = false;
return $return;
}
} elseif (!empty($database_settings[$settings_hash])) {
$database_specifications = $database_settings[$settings_hash];
}
if (empty($database_specifications)) {
trigger_error(Ak::t('Could not find database settings for %namespace.yml/%settings_hash', array('%namespace' => $namespace, '%settings_hash' => $settings_hash)), E_USER_ERROR);
}
// Compatibility with RoR database.yml format
$database_specifications['user'] = isset($database_specifications['user']) ? $database_specifications['user'] : (isset($database_specifications['username']) ? $database_specifications['username'] : '');
$database_specifications['type'] = isset($database_specifications['type']) ? $database_specifications['type'] : $database_specifications['adapter'];
$database_specifications['database_name'] = isset($database_specifications['database_name']) ? $database_specifications['database_name'] : (isset($database_specifications['database']) ? $database_specifications['database'] : '');
$class_name = 'Ak' . AkInflector::camelize($database_specifications['type']) . 'DbAdapter';
$adapter_class_file = AK_ACTIVE_RECORD_DIR . DS . 'adapters' . DS . AkInflector::underscore($database_specifications['type']) . '.php';
if (!@(include_once $adapter_class_file)) {
trigger_error(Ak::t('Could not find database adapter file on %path', array('%path' => $adapter_class_file)), E_USER_ERROR);
}
$Connection = new $class_name($database_specifications, $auto_connect);
Ak::setStaticVar($static_var_name, $Connection);
}
return $Connection;
}
示例10: is_string
/**
* @static
* @param array $database_settings
* @return AkDbAdapter
*/
public static function &getInstance($database_specifications = AK_DEFAULT_DATABASE_PROFILE, $auto_connect = true)
{
static $connections;
$settings_hash = is_string($database_specifications) ? $database_specifications : AkDbAdapter::_hash($database_specifications);
if (empty($connections[$settings_hash])) {
if (empty($database_specifications)) {
$settings_hash = AK_ENVIRONMENT;
$database_specifications = Ak::getSettings('database', false, $settings_hash);
} else {
if (is_string($database_specifications)) {
$environment_settings = Ak::getSettings('database', false, $database_specifications);
if (!empty($environment_settings)) {
$database_specifications = $environment_settings;
} elseif (strstr($database_specifications, '://')) {
$database_specifications = AkDbAdapter::_getDbSettingsFromDsn($database_specifications);
$settings_hash = AK_ENVIRONMENT;
} else {
global $database_settings;
if (isset($database_settings) && !file_exists(AK_CONFIG_DIR . DS . 'database.yml')) {
trigger_error(Ak::t("You are still using the old config/config.php database configuration. Please upgrade to use the config/database.yml configuration."), E_USER_NOTICE);
}
if (!file_exists(AK_CONFIG_DIR . DS . 'database.yml')) {
trigger_error(Ak::t("Could not find the database configuration file in %dbconfig.", array('%dbconfig' => AK_CONFIG_DIR . DS . 'database.yml')), E_USER_ERROR);
} else {
trigger_error(Ak::t("Could not find the database profile '%profile_name' in config/database.yml.", array('%profile_name' => $database_specifications)), E_USER_ERROR);
}
$return = false;
return $return;
}
} elseif (!empty($database_settings[$settings_hash])) {
$database_specifications = $database_settings[$settings_hash];
}
}
$available_adapters = Ak::toArray(AK_AVAILABLE_DATABASES);
$class_name = 'AkDbAdapter';
$designated_database = strtolower($database_specifications['type']);
if (in_array($designated_database, $available_adapters)) {
$class_name = 'Ak' . ucfirst($designated_database) . 'DbAdapter';
require_once AK_LIB_DIR . DS . 'AkActiveRecord' . DS . 'AkDbAdapters' . DS . $class_name . '.php';
}
$connections[$settings_hash] = new $class_name($database_specifications, $auto_connect);
}
return $connections[$settings_hash];
}
示例11: dispatchCached
public function dispatchCached()
{
$cache_settings = Ak::getSettings('caching', false);
if ($cache_settings['enabled']) {
$null = null;
$pageCache = new AkCacheHandler();
$pageCache->init($null, $cache_settings);
if (isset($_GET['allow_get'])) {
$options['include_get_parameters'] = explode(',', $_GET['allow_get']);
}
if (isset($_GET['use_if_modified_since'])) {
$options['use_if_modified_since'] = true;
}
if (($cachedPage = $pageCache->getCachedPage()) !== false) {
return $cachedPage->render();
}
}
return false;
}
示例12: init
public function init($options){
# Ak::getLogger('sessions')->info(__METHOD__);
if($settings=Ak::getSettings('session',false)) {
$this->options = array_merge($this->default_options, !empty($settings['options'])?$settings['options']:array());
} else {
$this->options = $this->default_options;
}
$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;
}
示例13: _initCacheHandler
function _initCacheHandler()
{
// TODOARNO
$cache_settings = Ak::getSettings('caching', false);
if ($cache_settings['enabled']) {
$null = null;
require_once(AK_LIB_DIR . DS . 'AkActionController' . DS . 'AkCacheHandler.php');
$this->_CacheHandler =& Ak::singleton('AkCacheHandler', $null);
$this->_CacheHandler->init(&$this);
}
}
示例14: _loadAdminSettings
/**
* Filters. Public methods but underscored to they cant be triggered directly via URL calls
*/
public function _loadAdminSettings()
{
$this->admin_settings = Ak::getSettings('admin');
return true;
}
示例15: shouldDefaultToPostAuthentication
function shouldDefaultToPostAuthentication()
{
$settings = Ak::getSettings('admin');
if (!empty($settings['default_authentication_method']) && $settings['default_authentication_method'] == 'post') {
return $this->isWebBrowser();
}
}