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