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


PHP ConfigFile::getDbEntry方法代码示例

本文整理汇总了PHP中ConfigFile::getDbEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFile::getDbEntry方法的具体用法?PHP ConfigFile::getDbEntry怎么用?PHP ConfigFile::getDbEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigFile的用法示例。


在下文中一共展示了ConfigFile::getDbEntry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) {
         $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
             $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), $GLOBALS['PMA_Config']->base_settings);
                         }
                     }
                 }
                 $validators[$field] = isset($validators[$field]) ? array_merge((array) $validators[$field], $uv_list) : $uv_list;
             }
         }
     }
     return $validators;
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:36,代码来源:Validator.class.php

示例2: getOptionValueList

 /**
  * Returns allowed values for select fields
  *
  * @param string $option_path Option path
  *
  * @return array
  */
 public function getOptionValueList($option_path)
 {
     $value = $this->_configFile->getDbEntry($option_path);
     if ($value === null) {
         trigger_error("{$option_path} - select options not defined", E_USER_ERROR);
         return array();
     }
     if (!is_array($value)) {
         trigger_error("{$option_path} - not a static value list", E_USER_ERROR);
         return array();
     }
     // convert array('#', 'a', 'b') to array('a', 'b')
     if (isset($value[0]) && $value[0] === '#') {
         // remove first element ('#')
         array_shift($value);
         // $value has keys and value names, return it
         return $value;
     }
     // convert value list array('a', 'b') to array('a' => 'a', 'b' => 'b')
     $has_string_keys = false;
     $keys = array();
     for ($i = 0, $nb = count($value); $i < $nb; $i++) {
         if (!isset($value[$i])) {
             $has_string_keys = true;
             break;
         }
         $keys[] = is_bool($value[$i]) ? (int) $value[$i] : $value[$i];
     }
     if (!$has_string_keys) {
         $value = array_combine($keys, $value);
     }
     // $value has keys and value names, return it
     return $value;
 }
开发者ID:FilipeRamosFernandes,项目名称:phpmyadmin,代码行数:41,代码来源:Form.class.php

示例3: testGetDbEntry

 /**
  * Test for ConfigFile::getDbEntry
  *
  * @return void
  * @test
  */
 public function testGetDbEntry()
 {
     $cfg_db = array();
     include './libraries/config.values.php';
     // verify that $cfg_db read from config.values.php is valid
     $this->assertGreaterThanOrEqual(20, count($cfg_db));
     $this->assertEquals($cfg_db['Servers'][1]['port'], $this->object->getDbEntry('Servers/1/port'));
     $this->assertNull($this->object->getDbEntry('no such key'));
     $this->assertEquals(array(1), $this->object->getDbEntry('no such key', array(1)));
 }
开发者ID:yonh,项目名称:php-mvc,代码行数:16,代码来源:PMA_ConfigFile_test.php


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