本文整理匯總了PHP中mergecnf函數的典型用法代碼示例。如果您正苦於以下問題:PHP mergecnf函數的具體用法?PHP mergecnf怎麽用?PHP mergecnf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mergecnf函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mergecnf
/**
* Merge config function
* @author f0o <f0o@devilcode.org>
* @copyright 2015 f0o, LibreNMS
* @license GPL
* @package LibreNMS
* @subpackage Config
*/
function mergecnf($obj)
{
$pointer = array();
$val = $obj['config_value'];
$obj = $obj['config_name'];
$obj = explode('.', $obj, 2);
if (!isset($obj[1])) {
if (filter_var($val, FILTER_VALIDATE_INT)) {
$val = (int) $val;
} else {
if (filter_var($val, FILTER_VALIDATE_FLOAT)) {
$val = (double) $val;
} else {
if (filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null) {
$val = filter_var($val, FILTER_VALIDATE_BOOLEAN);
}
}
}
if (!empty($obj[0])) {
return array($obj[0] => $val);
} else {
return array($val);
}
} else {
$pointer[$obj[0]] = mergecnf(array('config_name' => $obj[1], 'config_value' => $val));
}
return $pointer;
}
示例2: mysql_pconnect
<?php
// Observium Includes
require_once $config['install_dir'] . '/includes/dbFacile.php';
require_once $config['install_dir'] . '/includes/mergecnf.inc.php';
// Connect to database
$database_link = mysql_pconnect($config['db_host'], $config['db_user'], $config['db_pass']);
if (!$database_link) {
echo '<h2>MySQL Error</h2>';
echo mysql_error();
die;
}
$database_db = mysql_select_db($config['db_name'], $database_link);
$clone = $config;
foreach (dbFetchRows('select config_name,config_value from config') as $obj) {
$clone = array_replace_recursive($clone, mergecnf($obj));
}
$config = array_replace_recursive($clone, $config);
//
// NO CHANGES TO THIS FILE, IT IS NOT USER-EDITABLE #
//
// YES, THAT MEANS YOU #
//
umask(02);
$config['os']['default']['over'][0]['graph'] = 'device_processor';
$config['os']['default']['over'][0]['text'] = 'Processor Usage';
$config['os']['default']['over'][1]['graph'] = 'device_mempool';
$config['os']['default']['over'][1]['text'] = 'Memory Usage';
$os_group = 'unix';
$config['os_group'][$os_group]['type'] = 'server';
$config['os_group'][$os_group]['processor_stacked'] = 1;