本文整理汇总了PHP中Kwf_Config::getValueArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Config::getValueArray方法的具体用法?PHP Kwf_Config::getValueArray怎么用?PHP Kwf_Config::getValueArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwf_Config
的用法示例。
在下文中一共展示了Kwf_Config::getValueArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$ok = false;
foreach (Kwf_Config::getValueArray('debug.benchmarkCounterAccessIp') as $i) {
if (substr($i, -1) == '*') {
$i = substr($i, 0, -1);
if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($i)) == $i) {
$ok = true;
}
} else {
if ($_SERVER['REMOTE_ADDR'] == $i) {
$ok = true;
}
}
}
if (!$ok) {
throw new Kwf_Exception_AccessDenied();
}
$names = array('content-requests', 'asset-requests', 'media-requests', 'admin-requests', 'fullpage-hit', 'fullpage-miss', 'dbqueries', 'render-hit', 'render-miss', 'render-noviewcache', 'viewcache-mem', 'viewcache-db', 'viewcache-miss', 'viewcache-delete-page', 'viewcache-delete-component', 'viewcache-delete-master', 'viewcache-delete-partial', 'viewcache-delete-componentLink', 'viewcache-delete-fullPage');
$out = array();
$load = @file_get_contents('/proc/loadavg');
$load = explode(' ', $load);
$out['load'] = (double) $load[0];
foreach ($names as $name) {
$out[$name] = Kwf_Benchmark_Counter::getInstance()->getValue($name);
}
echo json_encode($out);
exit;
}
示例2: __construct
public function __construct(array $config = null)
{
if (is_null($config)) {
$config = Kwf_Config::getValueArray('database');
}
$this->_config = $config;
}
示例3: getContent
public function getContent($includeMaster)
{
if ($this->_data->getBaseProperty('preLogin')) {
$ignore = false;
foreach (Kwf_Config::getValueArray('preLoginIgnoreIp') as $i) {
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip == $i) {
$ignore = true;
}
if (!$ignore && substr($i, -1) == '*') {
$i = substr($i, 0, -1);
if (substr($ip, 0, strlen($i)) == $i) {
$ignore = true;
}
}
if (!$ignore && substr($i, 0, 1) == '*') {
$i = substr($i, 1);
if (substr($ip, -strlen($i)) == $i) {
$ignore = true;
}
}
}
Kwf_Setup::checkPreLogin($this->_data->getBaseProperty('preLoginUser'), $this->_data->getBaseProperty('preLoginPassword'));
}
$benchmarkEnabled = Kwf_Benchmark::isEnabled();
if ($benchmarkEnabled) {
$startTime = microtime(true);
}
$process = $this->_getProcessInputComponents($includeMaster);
if ($benchmarkEnabled) {
Kwf_Benchmark::subCheckpoint('getProcessInputComponents', microtime(true) - $startTime);
}
self::_callProcessInput($process);
if ($benchmarkEnabled) {
Kwf_Benchmark::checkpoint('processInput');
}
$ret = array();
$hasDynamicParts = false;
$ret['content'] = $this->_render($includeMaster, $hasDynamicParts);
if ($benchmarkEnabled) {
Kwf_Benchmark::checkpoint('render');
}
$ret['mimeType'] = 'text/html; charset=utf-8';
if (!$includeMaster) {
$assetsBox = $this->_data->getChildComponent('-assets');
if ($assetsBox) {
$ret['assets'] = $assetsBox->render(null, false, $hasDynamicParts);
} else {
$ret['assets'] = '';
}
}
if (!$hasDynamicParts) {
$ret['lifetime'] = 60 * 60;
}
self::_callPostProcessInput($process);
if ($benchmarkEnabled) {
Kwf_Benchmark::checkpoint('postProcessInput');
}
return $ret;
}
示例4: createPackages
public static function createPackages()
{
$packages = array(self::getInstance('Frontend'), self::getInstance('Admin'));
foreach (Kwf_Config::getValueArray('assets.packages') as $i) {
$packages[] = self::getInstance($i);
}
return $packages;
}
示例5: __construct
public function __construct($config = array())
{
if (isset($config['pageCategories'])) {
$this->_pageCategories = $config['pageCategories'];
} else {
$this->_pageCategories = Kwf_Config::getValueArray('kwc.pageCategories');
}
parent::__construct($config);
}
示例6: getMetaTagsForData
public static function getMetaTagsForData($data)
{
$ret = array();
if (Kwf_Config::getValue('application.kwf.name') == 'Koala Framework') {
$ret['generator'] = 'Koala Web Framework CMS';
}
if ($data->getPage()) {
if (Kwc_Abstract::getFlag($data->getPage()->componentClass, 'metaTags')) {
foreach ($data->getPage()->getComponent()->getMetaTags() as $name => $content) {
if (!isset($ret[$name])) {
$ret[$name] = '';
}
//TODO: for eg noindex,nofollow other separator
$ret[$name] .= ' ' . $content;
}
}
if (Kwc_Abstract::getFlag($data->getPage()->componentClass, 'noIndex')) {
if (isset($ret['robots'])) {
$ret['robots'] .= ',';
} else {
$ret['robots'] = '';
}
$ret['robots'] .= 'noindex';
}
}
foreach ($ret as &$i) {
$i = trim($i);
}
unset($i);
// verify-v1
if (isset($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST'];
} else {
$host = Kwf_Config::getValue('server.domain');
}
$hostParts = explode('.', $host);
if (count($hostParts) < 2) {
$configDomain = $host;
} else {
$shortParts = array('com', 'co', 'gv', 'or');
if (count($hostParts) > 2 & in_array($hostParts[count($hostParts) - 2], $shortParts)) {
$hostParts[count($hostParts) - 2] = $hostParts[count($hostParts) - 3] . $hostParts[count($hostParts) - 2];
}
$configDomain = $hostParts[count($hostParts) - 2] . $hostParts[count($hostParts) - 1];
// zB 'com'
}
$configVerify = Kwf_Config::getValueArray('verifyV1');
if ($configVerify && isset($configVerify[$configDomain])) {
$ret['verify-v1'] = $configVerify[$configDomain];
}
$configVerify = Kwf_Config::getValueArray('googleSiteVerification');
if ($configVerify && isset($configVerify[$configDomain])) {
$ret['google-site-verification'] = $configVerify[$configDomain];
}
return $ret;
}
示例7: domainSupportsHttps
/**
* Returns if the current request would support https and ensureHttps() would redirect to https
*/
public static function domainSupportsHttps($domain)
{
if (Kwf_Config::getValue('server.https')) {
if ($domains = Kwf_Config::getValueArray('server.httpsDomains')) {
if ($domains && !in_array($domain, $domains)) {
return false;
//current host is not in server.httpsDomains, don't use https
}
}
return true;
}
return false;
}
示例8: getGroups
public static function getGroups()
{
$groups = Kwf_Config::getValueArray('server.gearmanGroup');
$ret = array_keys($groups);
$noGroup = Kwf_Config::getValueArray('server.gearman');
if ($noGroup && $noGroup['jobServers']) {
$servers = array_values($noGroup['jobServers']);
if ($servers[0]) {
$ret[] = null;
//no group
}
}
return $ret;
}
示例9: _getAllPackages
private function _getAllPackages()
{
$packages = array();
foreach (Kwf_Config::getValueArray('assets.packageFactories') as $i) {
if (!$i) {
continue;
}
if (!is_instance_of($i, 'Kwf_Assets_Package_FactoryInterface')) {
throw new Kwf_Exception("'{$i}' doesn't implement Kwf_Assets_Package_FactoryInterface");
}
$packages = array_merge($packages, call_user_func(array($i, 'createPackages')));
}
return $packages;
}
示例10: getAvailableLanguages
public static function getAvailableLanguages($componentClass)
{
$ret = array();
foreach (Kwf_Config::getValueArray('kwc.domains') as $d) {
if (isset($d['language'])) {
if (is_array($d['language'])) {
$ret = array_merge($ret, $d['language']);
} else {
$ret[] = $d['language'];
}
}
}
$ret = array_unique($ret);
return $ret;
}
示例11: getAssetVariables
public static function getAssetVariables($section = 'web')
{
static $assetVariables = array();
if (!isset($assetVariables[$section])) {
$assetVariables[$section] = Kwf_Config::getValueArray('assetVariables');
if (file_exists('assetVariables.ini')) {
$cfg = new Zend_Config_Ini('assetVariables.ini', $section);
$assetVariables[$section] = array_merge($assetVariables[$section], $cfg->toArray());
}
foreach ($assetVariables[$section] as $k => $i) {
//also support lowercase variables
if (strtolower($k) != $k) {
$assetVariables[$section][strtolower($k)] = $i;
}
}
}
return $assetVariables[$section];
}
示例12: allowSourceAccess
public static function allowSourceAccess()
{
$ok = false;
foreach (Kwf_Config::getValueArray('debug.assets.sourceAccessIp') as $i) {
if (!$i) {
continue;
}
if (substr($i, -1) == '*') {
$i = substr($i, 0, -1);
if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($i)) == $i) {
$ok = true;
}
} else {
if ($_SERVER['REMOTE_ADDR'] == $i) {
$ok = true;
}
}
}
return $ok;
}
示例13: domainSupportsHttps
/**
* Returns if the current request would support https and ensureHttps() would redirect to https
*/
public static function domainSupportsHttps($domain)
{
if (Kwf_Config::getValue('server.https') === true) {
if ($domains = Kwf_Config::getValueArray('server.httpsDomains')) {
if ($domains && !in_array($domain, $domains)) {
foreach ($domains as $d) {
if (substr($d, 0, 2) == '*.') {
if (substr($d, 1) == substr($domain, strpos($domain, '.'))) {
return true;
}
}
}
return false;
//current host is not in server.httpsDomains, don't use https
}
}
return true;
}
return false;
}
示例14: getSubroots
public function getSubroots()
{
$ret = Kwf_Config::getValueArray('fulltext.solr.subroots');
if ($ret) {
return $ret;
}
$ret = array();
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (Kwc_Abstract::getFlag($c, 'subroot')) {
foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByClass($c) as $sr) {
$ret[] = $sr->componentId;
}
}
}
if (!$ret) {
$ret = array('');
}
//no subroots exist
return $ret;
}
示例15: getContentsPacked
public function getContentsPacked()
{
if (!Kwf_Config::getValue('googleMapsApiKey') && !Kwf_Config::getValueArray('googleMapsApiKeys')) {
throw new Kwf_Exception('googleMapsApiKey is required in config.ini');
}
if (Kwf_Config::getValue('googleMapsApiKey')) {
$json = Kwf_Config::getValue('googleMapsApiKey');
if (Kwf_Config::getValueArray('googleMapsApiKeys')) {
throw new Kwf_Exception('Don\'t use googleMapsApiKeys and googleMapsApiKey together, remove googleMapsApiKeys');
}
} else {
//legacy
$json = Kwf_Config::getValueArray('googleMapsApiKeys');
}
$json = json_encode($json);
$ret = "module.exports = {$json};";
$ret = Kwf_SourceMaps_SourceMap::createEmptyMap($ret);
$data = $ret->getMapContentsData();
$data->{'_x_org_koala-framework_masterFiles'} = array('config.ini');
return $ret;
}