本文整理汇总了PHP中PMA_array_write函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_array_write函数的具体用法?PHP PMA_array_write怎么用?PHP PMA_array_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_array_write函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPMA_array_write
function testPMA_array_write()
{
$arr = array("int" => 1, "str" => "str_val", "arr" => array('val1', 'val2', 'val3'), "sarr" => array('arr1' => array(1, 2, 3), array(3, array('a', 'b', 'c'), 4)));
PMA_array_write('int', $arr, 5);
$this->assertEquals($arr['int'], 5);
PMA_array_write('str', $arr, '_str');
$this->assertEquals($arr['str'], '_str');
PMA_array_write('arr/0', $arr, 'val_arr_0');
$this->assertEquals($arr['arr'][0], 'val_arr_0');
PMA_array_write('arr/1', $arr, 'val_arr_1');
$this->assertEquals($arr['arr'][1], 'val_arr_1');
PMA_array_write('arr/2', $arr, 'val_arr_2');
$this->assertEquals($arr['arr'][2], 'val_arr_2');
PMA_array_write('sarr/arr1/0', $arr, 'val_sarr_arr_0');
$this->assertEquals($arr['sarr']['arr1'][0], 'val_sarr_arr_0');
PMA_array_write('sarr/arr1/1', $arr, 'val_sarr_arr_1');
$this->assertEquals($arr['sarr']['arr1'][1], 'val_sarr_arr_1');
PMA_array_write('sarr/arr1/2', $arr, 'val_sarr_arr_2');
$this->assertEquals($arr['sarr']['arr1'][2], 'val_sarr_arr_2');
PMA_array_write('sarr/0/0', $arr, 5);
$this->assertEquals($arr['sarr'][0][0], 5);
PMA_array_write('sarr/0/1/0', $arr, 'e');
$this->assertEquals($arr['sarr'][0][1][0], 'e');
PMA_array_write('sarr/not_existing/1', $arr, 'some_val');
$this->assertEquals($arr['sarr']['not_existing'][1], 'some_val');
PMA_array_write('sarr/0/2', $arr, null);
$this->assertNull($arr['sarr'][0][2]);
}
示例2: setUserValue
/**
* Sets config value which is stored in user preferences (if available) or in a cookie.
*
* If user preferences are not yet initialized, option is applied to global config and
* added to a update queue, which is processed by {@link loadUserPreferences()}
*
* @uses $GLOBALS['cfg']
* @uses PMA_array_read()
* @uses PMA_array_write()
* @uses PMA_persist_option()
* @param string $cookie_name can be null
* @param string $cfg_path
* @param mixed $new_cfg_value
* @param mixed $default_value
*/
function setUserValue($cookie_name, $cfg_path, $new_cfg_value, $default_value = null)
{
// use permanent user preferences if possible
$prefs_type = $this->get('user_preferences');
if ($prefs_type) {
require_once './libraries/user_preferences.lib.php';
if ($default_value === null) {
$default_value = PMA_array_read($cfg_path, $this->default);
}
PMA_persist_option($cfg_path, $new_cfg_value, $default_value);
}
if ($prefs_type != 'db' && $cookie_name) {
// fall back to cookies
if ($default_value === null) {
$default_value = PMA_array_read($cfg_path, $this->settings);
}
$this->setCookie($cookie_name, $new_cfg_value, $default_value);
}
PMA_array_write($cfg_path, $GLOBALS['cfg'], $new_cfg_value);
PMA_array_write($cfg_path, $this->settings, $new_cfg_value);
}
示例3: PMA_apply_userprefs
/**
* Returns a user preferences array filtered by $cfg['UserprefsDisallow']
* (blacklist) and keys from user preferences form (whitelist)
*
* @uses PMA_array_write()
* @uses PMA_read_userprefs_fieldnames()
* @param array $config_data path => value pairs
* @return array
*/
function PMA_apply_userprefs(array $config_data)
{
$cfg = array();
$blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']);
if (!$GLOBALS['cfg']['UserprefsDeveloperTab']) {
// disallow everything in the Developers tab
$blacklist['Error_Handler/display'] = true;
$blacklist['Error_Handler/gather'] = true;
$blacklist['DBG/sql'] = true;
}
$whitelist = array_flip(PMA_read_userprefs_fieldnames());
// whitelist some additional fields which are custom handled
$whitelist['ThemeDefault'] = true;
$whitelist['fontsize'] = true;
$whitelist['lang'] = true;
$whitelist['collation_connection'] = true;
$whitelist['Server/hide_db'] = true;
$whitelist['Server/only_db'] = true;
foreach ($config_data as $path => $value) {
if (!isset($whitelist[$path]) || isset($blacklist[$path])) {
continue;
}
PMA_array_write($path, $cfg, $value);
}
return $cfg;
}
示例4: getConfig
/**
* Returns configuration array (full, multidimensional format)
*
* @return array
*/
public function getConfig()
{
$c = $_SESSION[$this->id];
foreach ($this->cfgUpdateReadMapping as $map_to => $map_from) {
PMA_array_write($map_to, $c, PMA_array_read($map_from, $c));
PMA_array_remove($map_from, $c);
}
return $c;
}