本文整理汇总了PHP中PMA_array_read函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_array_read函数的具体用法?PHP PMA_array_read怎么用?PHP PMA_array_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_array_read函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_config_get_validators
/**
* Returns validator list
*
* @return array
*/
function PMA_config_get_validators()
{
static $validators = null;
if ($validators === null) {
$cf = ConfigFile::getInstance();
$validators = $cf->getDbEntry('_validators', array());
if (!defined('PMA_SETUP')) {
// not in setup script: load additional validators for user
// preferences we need original config values not overwritten
// by user preferences, creating a new PMA_Config instance is a
// better idea than hacking into its code
$org_cfg = $cf->getOrgConfigObj();
$uvs = $cf->getDbEntry('_userValidators', array());
foreach ($uvs as $field => $uv_list) {
$uv_list = (array) $uv_list;
foreach ($uv_list as &$uv) {
if (!is_array($uv)) {
continue;
}
for ($i = 1; $i < count($uv); $i++) {
if (substr($uv[$i], 0, 6) == 'value:') {
$uv[$i] = PMA_array_read(substr($uv[$i], 6), $org_cfg->settings);
}
}
}
$validators[$field] = isset($validators[$field]) ? array_merge((array) $validators[$field], $uv_list) : $uv_list;
}
}
}
return $validators;
}
示例2: testPMA_array_read
function testPMA_array_read()
{
$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)));
$this->assertEquals(PMA_array_read('int', $arr), $arr['int']);
$this->assertEquals(PMA_array_read('str', $arr), $arr['str']);
$this->assertEquals(PMA_array_read('arr/0', $arr), $arr['arr'][0]);
$this->assertEquals(PMA_array_read('arr/1', $arr), $arr['arr'][1]);
$this->assertEquals(PMA_array_read('arr/2', $arr), $arr['arr'][2]);
$this->assertEquals(PMA_array_read('sarr/arr1/0', $arr), $arr['sarr']['arr1'][0]);
$this->assertEquals(PMA_array_read('sarr/arr1/1', $arr), $arr['sarr']['arr1'][1]);
$this->assertEquals(PMA_array_read('sarr/arr1/2', $arr), $arr['sarr']['arr1'][2]);
$this->assertEquals(PMA_array_read('sarr/0/0', $arr), $arr['sarr'][0][0]);
$this->assertEquals(PMA_array_read('sarr/0/1', $arr), $arr['sarr'][0][1]);
$this->assertEquals(PMA_array_read('sarr/0/1/2', $arr), $arr['sarr'][0][1][2]);
$this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr), null);
$this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr, 0), 0);
$this->assertEquals(PMA_array_read('sarr/not_exiting/1', $arr, 'defailt_val'), 'defailt_val');
}
示例3: 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);
}
示例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;
}