本文整理汇总了PHP中PMA_arrayWrite函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_arrayWrite函数的具体用法?PHP PMA_arrayWrite怎么用?PHP PMA_arrayWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_arrayWrite函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWrite
/**
* Test for PMA_arrayWrite
*
* @return void
*/
function testWrite()
{
$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_arrayWrite('int', $arr, 5);
$this->assertEquals($arr['int'], 5);
PMA_arrayWrite('str', $arr, '_str');
$this->assertEquals($arr['str'], '_str');
PMA_arrayWrite('arr/0', $arr, 'val_arr_0');
$this->assertEquals($arr['arr'][0], 'val_arr_0');
PMA_arrayWrite('arr/1', $arr, 'val_arr_1');
$this->assertEquals($arr['arr'][1], 'val_arr_1');
PMA_arrayWrite('arr/2', $arr, 'val_arr_2');
$this->assertEquals($arr['arr'][2], 'val_arr_2');
PMA_arrayWrite('sarr/arr1/0', $arr, 'val_sarr_arr_0');
$this->assertEquals($arr['sarr']['arr1'][0], 'val_sarr_arr_0');
PMA_arrayWrite('sarr/arr1/1', $arr, 'val_sarr_arr_1');
$this->assertEquals($arr['sarr']['arr1'][1], 'val_sarr_arr_1');
PMA_arrayWrite('sarr/arr1/2', $arr, 'val_sarr_arr_2');
$this->assertEquals($arr['sarr']['arr1'][2], 'val_sarr_arr_2');
PMA_arrayWrite('sarr/0/0', $arr, 5);
$this->assertEquals($arr['sarr'][0][0], 5);
PMA_arrayWrite('sarr/0/1/0', $arr, 'e');
$this->assertEquals($arr['sarr'][0][1][0], 'e');
PMA_arrayWrite('sarr/not_existing/1', $arr, 'some_val');
$this->assertEquals($arr['sarr']['not_existing'][1], 'some_val');
PMA_arrayWrite('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()}
*
* @param string $cookie_name can be null
* @param string $cfg_path configuration path
* @param mixed $new_cfg_value new value
* @param mixed $default_value default value
*
* @return void
*/
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) {
include_once './libraries/user_preferences.lib.php';
if ($default_value === null) {
$default_value = PMA_arrayRead($cfg_path, $this->default);
}
PMA_persistOption($cfg_path, $new_cfg_value, $default_value);
}
if ($prefs_type != 'db' && $cookie_name) {
// fall back to cookies
if ($default_value === null) {
$default_value = PMA_arrayRead($cfg_path, $this->settings);
}
$this->setCookie($cookie_name, $new_cfg_value, $default_value);
}
PMA_arrayWrite($cfg_path, $GLOBALS['cfg'], $new_cfg_value);
PMA_arrayWrite($cfg_path, $this->settings, $new_cfg_value);
}
示例3: PMA_applyUserprefs
/**
* Returns a user preferences array filtered by $cfg['UserprefsDisallow']
* (blacklist) and keys from user preferences form (whitelist)
*
* @param array $config_data path => value pairs
*
* @return array
*/
function PMA_applyUserprefs(array $config_data)
{
$cfg = array();
$blacklist = array_flip($GLOBALS['cfg']['UserprefsDisallow']);
if (!$GLOBALS['cfg']['UserprefsDeveloperTab']) {
// disallow everything in the Developers tab
$blacklist['DBG/sql'] = true;
}
$whitelist = array_flip(PMA_readUserprefsFieldNames());
// 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_arrayWrite($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_arrayWrite($map_to, $c, PMA_arrayRead($map_from, $c));
PMA_arrayRemove($map_from, $c);
}
return $c;
}
示例5: getConfig
/**
* Returns configuration array (full, multidimensional format)
*
* @return array
*/
public function getConfig()
{
$c = $_SESSION[$this->_id];
foreach ($this->_cfgUpdateReadMapping as $map_to => $map_from) {
// if the key $c exists in $map_to
if (PMA_arrayRead($map_to, $c) !== null) {
PMA_arrayWrite($map_to, $c, PMA_arrayRead($map_from, $c));
PMA_arrayRemove($map_from, $c);
}
}
return $c;
}