當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。