当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_array_write函数代码示例

本文整理汇总了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]);
 }
开发者ID:bugyak,项目名称:phporadmin,代码行数:28,代码来源:PMA_array_test.php

示例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);
 }
开发者ID:ducthang128,项目名称:VPS_v2,代码行数:36,代码来源:Config.class.php

示例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;
}
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:35,代码来源:user_preferences.lib.php

示例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;
 }
开发者ID:AmberWish,项目名称:laba_web,代码行数:14,代码来源:ConfigFile.class.php


注:本文中的PMA_array_write函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。