本文整理汇总了PHP中ConfigManager::mergeConfigs方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::mergeConfigs方法的具体用法?PHP ConfigManager::mergeConfigs怎么用?PHP ConfigManager::mergeConfigs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::mergeConfigs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadYubikeyUserAuthorization
protected function loadYubikeyUserAuthorization()
{
$usersConfig = ConfigManager::getConfig("Users", "Users");
$resultingConfig = ConfigManager::mergeConfigs($usersConfig->AuxConfig, $this->config->AuxConfig);
$yubikeyUserAuthorization = new YubikeyUserAuthorization(Reg::get($usersConfig->Objects->UserManagement), $resultingConfig);
$this->register($yubikeyUserAuthorization);
}
示例2: 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()));
}
示例3: 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()));
}
示例4: upload
/**
* Upload Image from POST
*
* @param array $file - Part of $_FILES like $_FILES['photo']
* @param string $fileName - Put image with this filename
* @param Config $imageUploaderConfig
* @throws RuntimeException
* @throws InvalidArgumentException
* @throws ImageException
* @throws ImageUploaderException
* @return Image
*/
public static function upload($file, $fileName = null, Config $imageUploaderConfig = null)
{
$imageUploaderConfig = ConfigManager::mergeConfigs($imageUploaderConfig, ConfigManager::getConfig("Image", "ImageUploader")->AuxConfig);
$uploadDir = $imageUploaderConfig->uploadDir;
if (empty($uploadDir)) {
throw new RuntimeException("Unable to get any appropriate uploadDir!");
}
if (!file_exists($uploadDir)) {
throw new InvalidArgumentException("Upload directory {$uploadDir} doesn't exists.");
}
ensurePathLastSlash($uploadDir);
if (!in_array($file["type"], $imageUploaderConfig->acceptedMimeTypes->toArray())) {
throw new ImageException("Unsupported file uploaded!");
}
// Check if we have enough memory to open this file as image
$info = getimagesize($file['tmp_name']);
if ($info != false && !Image::checkMemAvailbleForResize($info[0], $info[1])) {
throw new ImageUploaderException("Not enough memory to open image", static::EXCEPTION_IMAGE_IS_BIG);
}
// Check if we are able to create image resource from this file.
$image = new Image($file['tmp_name']);
$format = null;
if (isset($imageUploaderConfig->saveFormat) and $imageUploaderConfig->saveFormat != null) {
$format = $imageUploaderConfig->saveFormat;
} else {
$format = $image->getType();
}
if ($fileName === null) {
$fileName = static::findNewFileName($uploadDir, $format);
}
$savePath = $uploadDir . $fileName;
if (isset($imageUploaderConfig->minimumSize)) {
$checkResult = $image->isSizeMeetRequirements($imageUploaderConfig->minimumSize->largeSideMinSize, $imageUploaderConfig->minimumSize->smallSideMinSize);
if (!$checkResult) {
throw new ImageUploaderException("Given image is smaller than specified minimum size.", static::EXCEPTION_IMAGE_IS_SMALL);
}
}
switch ($format) {
case Image::IMAGE_TYPE_JPEG:
$image->writeJpeg($savePath);
break;
case Image::IMAGE_TYPE_PNG:
$image->writePng($savePath);
break;
case Image::IMAGE_TYPE_GIF:
$image->writeGif($savePath);
break;
}
return $image;
}
示例5: 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
示例6: getPluginConfig
/**
* Get config for given plugin
*
* @param string $packageName
* @param string $pluginName
*/
public function getPluginConfig($packageName, $pluginName)
{
$pluginConfig = ConfigManager::getConfig($packageName, $pluginName);
if (isset($this->customConfigs->{$packageName}) and isset($this->customConfigs->{$packageName}->{$pluginName})) {
if (isset($this->forceCustomConfigs[$packageName]) and isset($this->forceCustomConfigs[$packageName][$pluginName]) and $this->forceCustomConfigs[$packageName][$pluginName] == true) {
$pluginConfig = $this->customConfigs->{$packageName}->{$pluginName};
} else {
$pluginConfig = ConfigManager::mergeConfigs($this->customConfigs->{$packageName}->{$pluginName}, $pluginConfig);
}
}
return $pluginConfig;
}