本文整理汇总了PHP中ConfigManager::getGlobalConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getGlobalConfig方法的具体用法?PHP ConfigManager::getGlobalConfig怎么用?PHP ConfigManager::getGlobalConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getGlobalConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initDBConfig
/**
* Get configs from DB and merge them with global config
*
* @param int $cacheMinutes
*/
public static function initDBConfig($cacheMinutes = null)
{
$sql = MySqlDbManager::getQueryObject();
$sql->exec("SELECT * FROM `" . Tbl::get("TBL_CONFIGS") . "`", $cacheMinutes);
$dbConfig = static::parseDBRowsToConfig($sql->fetchRecords());
ConfigManager::setGlobalConfig(ConfigManager::mergeConfigs($dbConfig, ConfigManager::getGlobalConfig()));
}
示例2: initDBConfig
/**
* Get configs from DB and merge them with global config
*
* @param int $cacheMinutes
*/
public static function initDBConfig(ConfigDBFilter $filter = null, $cacheMinutes = 0)
{
if ($filter == null) {
$filter = new ConfigDBFilter();
$filter->setCommon();
}
$sql = MySqlDbManager::getQueryObject();
$sql->exec($filter->getSQL(), $cacheMinutes);
$dbConfig = static::parseDBRowsToConfig($sql->fetchRecords());
ConfigManager::setGlobalConfig(ConfigManager::mergeConfigs($dbConfig, ConfigManager::getGlobalConfig()));
}
示例3: smarty_modifier_config
/**
* @param string $configPath (delimited with '->')
* @return string
*/
function smarty_modifier_config($configPath)
{
if (empty($configPath)) {
return null;
}
$configparts = explode("->", $configPath);
$currentItem = ConfigManager::getGlobalConfig();
foreach ($configparts as $part) {
if (!empty($part) and isset($currentItem->{$part})) {
$currentItem = $currentItem->{$part};
}
}
return $currentItem;
}
示例4: file_put_contents
if (!empty($file['precompileCode'])) {
$fileContents .= $file['precompileCode'] . "\n\n";
}
$fileContents .= $content . "\n\n";
if (!empty($file['postcompileCode'])) {
$fileContents .= $file['postcompileCode'] . "\n\n";
}
}
file_put_contents($classesCacheFilename, $fileContents);
}
}
}
// Request Parser
HookManager::callHook("BeforeRequestParser");
HookManager::callHook("BeforeRequestParserStep2");
HookManager::callHook("RequestParser");
HookManager::callHook("AfterRequestParser");
HookManager::callHook("BeforeController");
HookManager::callHook("Controller");
HookManager::callHook("AfterController");
//$time = microtime(true);
HookManager::callHook("BeforeOutput");
HookManager::callHook("Output");
HookManager::callHook("AfterOutput");
if (ConfigManager::getGlobalConfig()->Stingle->BootCompiler === true) {
if (!file_exists($configCacheFilename) and !$isGetConfigFromCache) {
file_put_contents($configCacheFilename, serialize(ConfigManager::mergeConfigs(ConfigManager::getGlobalConfig(), ConfigManager::getCache())));
}
}
//echo "out - " . (microtime(true) - $time) . "<br>";
// Finish
示例5: buildAllowanceTables
/**
* Build allowance table for smart loading
*
* @param array $pluginsToLoad
*/
private function buildAllowanceTables($pluginsToLoad)
{
$pluginsToLoadHash = md5(json_encode(array_merge($this->loadedPackages, $pluginsToLoad)));
if (ConfigManager::getGlobalConfig()->Stingle->AllowanceTablesCache === true) {
$cacheFilename = ConfigManager::getGlobalConfig()->Stingle->CoreCachePath . 'allowanceTables-' . $pluginsToLoadHash;
if (file_exists($cacheFilename)) {
try {
$allowanceTables = unserialize(file_get_contents($cacheFilename));
if (is_array($allowanceTables) and isset($allowanceTables['objectAllowanceTable']) and isset($allowanceTables['hookAllowanceTable'])) {
$this->objectAllowanceTable = $allowanceTables['objectAllowanceTable'];
$this->hookAllowanceTable = $allowanceTables['hookAllowanceTable'];
return;
}
} catch (Exception $e) {
}
}
}
if (empty($pluginsToLoad)) {
return;
}
$arrayForBuild = array();
foreach ($pluginsToLoad as $packageName => $plugins) {
foreach ($plugins as $pluginName) {
array_push($arrayForBuild, array($packageName, $pluginName));
}
}
$dependencyArray = $this->getDependencyArray($arrayForBuild);
$this->checkForDependencyLoop($dependencyArray);
$dependencyArray = $this->simplifyDependencyTree($dependencyArray);
$masterPlugins = array();
foreach ($dependencyArray["masters"] as $master) {
if (!in_array($master, $dependencyArray["slaves"])) {
if (!in_array($master, $masterPlugins)) {
array_push($masterPlugins, $master);
}
}
}
$cleanedDependencyArray = array("masters" => array(), "slaves" => array());
foreach ($dependencyArray["slaves"] as $key => $slave) {
if ($slave !== array(null, null)) {
array_push($cleanedDependencyArray["masters"], $dependencyArray["masters"][$key]);
array_push($cleanedDependencyArray["slaves"], $dependencyArray["slaves"][$key]);
}
}
$pluginsByPriorityTmp = $this->getPluginsByPriorityTable($cleanedDependencyArray, $masterPlugins);
$pluginsByPriority = array();
foreach ($pluginsByPriorityTmp as $plugin => $info) {
if (!array_key_exists($info[1], $pluginsByPriority)) {
$pluginsByPriority[$info[1]] = array();
}
array_push($pluginsByPriority[$info[1]], array($info[0], $plugin));
}
ksort($pluginsByPriority, SORT_NUMERIC);
foreach ($pluginsByPriority as $priority => $plugins) {
$thisPriorityObjects = array();
foreach ($plugins as $plugin) {
$pluginConfig = $this->getPluginConfig($plugin[0], $plugin[1]);
if (!isset($pluginConfig->Objects)) {
continue;
}
$pluginObjects = get_object_vars($pluginConfig->Objects);
foreach ($pluginObjects as $Object) {
if (in_array($Object, array_keys($thisPriorityObjects))) {
$conflictingPlugin = $thisPriorityObjects[$Object];
throw new RuntimeException("Object conflict between {$plugin[1]} of package {$plugin[0]} and {$conflictingPlugin[1]} of package {$conflictingPlugin[0]} with Object {$Object}");
}
$this->objectAllowanceTable[$Object] = $plugin;
$thisPriorityObjects[$Object] = $plugin;
}
}
}
foreach ($pluginsByPriority as $priority => $plugins) {
$thisPriorityHooks = array();
foreach ($plugins as $plugin) {
$pluginConfig = $this->getPluginConfig($plugin[0], $plugin[1]);
if (!isset($pluginConfig->Hooks)) {
continue;
}
$pluginHooks = get_object_vars($pluginConfig->Hooks);
foreach ($pluginHooks as $hook) {
if (in_array($hook, array_keys($thisPriorityHooks))) {
$conflictingPlugin = $thisPriorityHooks[$hook];
throw new RuntimeException("Hook registration conflict between {$plugin[1]} of package {$plugin[0]} and {$conflictingPlugin[1]} of package {$conflictingPlugin[0]} with hook {$hook}");
}
$this->hookAllowanceTable[$hook] = $plugin;
$thisPriorityHooks[$hook] = $plugin;
}
}
}
if (ConfigManager::getGlobalConfig()->Stingle->AllowanceTablesCache === true) {
$cacheFilename = ConfigManager::getGlobalConfig()->Stingle->CoreCachePath . 'allowanceTables-' . $pluginsToLoadHash;
$cacheContents = array('objectAllowanceTable' => $this->objectAllowanceTable, 'hookAllowanceTable' => $this->hookAllowanceTable);
file_put_contents($cacheFilename, serialize($cacheContents));
}
}
示例6: stingleInclude
function stingleInclude($file, $precompileCode = null, $postcompileCode = null, $isPathAbsolute = false)
{
$oldDir = null;
if (!$isPathAbsolute) {
$bt = debug_backtrace();
$oldDir = getcwd();
chdir(dirname($bt[0]['file']));
}
require_once $file;
if (ConfigManager::getGlobalConfig()->Stingle->BootCompiler === true) {
if ($isPathAbsolute) {
array_push($GLOBALS['includedClasses'], array('file' => $file, 'precompileCode' => $precompileCode, 'postcompileCode' => $postcompileCode));
} else {
array_push($GLOBALS['includedClasses'], array('file' => dirname($bt[0]['file']) . '/' . $file, 'precompileCode' => $precompileCode, 'postcompileCode' => $postcompileCode));
}
}
if (!$isPathAbsolute and !empty($oldDir)) {
chdir($oldDir);
}
}
示例7: default_error_handler
function default_error_handler($severity, $message, $file, $line)
{
if (!in_array($severity, ConfigManager::getGlobalConfig()->Stingle->disabledErrors->toArray())) {
throw new ErrorException($message, $severity, $severity, $file, $line);
}
}