當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigFile類代碼示例

本文整理匯總了PHP中ConfigFile的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigFile類的具體用法?PHP ConfigFile怎麽用?PHP ConfigFile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ConfigFile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: main_default

function main_default($eventData)
{
    global $gEnv, $gLocale, $gPage_content;
    $jp_cfg = new ConfigFile(CONFIG_PATH . 'jpcache.cfg', true);
    $xml_def = '<vertgroup><name>prefs</name><children>
  <form><name>prefs</name><args><method>post</method><action type="encoded">' . urlencode(build_events_call_string('', array(array('main', 'default', ''), array('action', 'setprefs', '')))) . '</action></args><children>
    <grid><name>prefs</name><children>
      <label row="0" col="0"><name>cachetime</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cachetime.label')) . '</label></args></label>
      <string row="0" col="1"><name>cachetime</name><args><disp>action</disp><size>5</size><value>' . $jp_cfg->Value('CACHE_TIME') . '</value></args></string>
      <label row="1" col="0"><name>cacheon</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cacheon.label')) . '</label></args></label>
      <checkbox row="1" col="1"><name>cacheon</name><args><disp>action</disp><checked>' . ($jp_cfg->Value('CACHE_ON') == '1' ? 'true' : 'false') . '</checked></args></checkbox>
      <label row="2" col="0"><name>usegzip</name><args><label type="encoded">' . urlencode($gLocale->GetStr('usegzip.label')) . '</label></args></label>
      <checkbox row="2" col="1"><name>usegzip</name><args><disp>action</disp><checked>' . ($jp_cfg->Value('USE_GZIP') == '1' ? 'true' : 'false') . '</checked></args></checkbox>
      <label row="3" col="0"><name>cachepost</name><args><label type="encoded">' . urlencode($gLocale->GetStr('cachepost.label')) . '</label></args></label>
      <checkbox row="3" col="1"><name>cachepost</name><args><disp>action</disp><checked>' . ($jp_cfg->Value('CACHE_POST') == '1' ? 'true' : 'false') . '</checked></args></checkbox>
    </children></grid>
  </children></form>
  <horizbar><name>hb</name></horizbar>
  <button><name>submit</name>
    <args>
      <label type="encoded">' . urlencode($gLocale->GetStr('setprefs.submit')) . '</label>
      <themeimage>button_ok</themeimage>
      <horiz>true</horiz>
      <frame>true</frame>
      <formsubmit>prefs</formsubmit>
      <action type="encoded">' . urlencode(build_events_call_string('', array(array('main', 'default', ''), array('action', 'setprefs', '')))) . '</action>
    </args>
  </button>
</children></vertgroup>';
    $gPage_content = new HuiXml('page', array('definition' => $xml_def));
}
開發者ID:alexpagnoni,項目名稱:jpcache,代碼行數:31,代碼來源:jpcache.php

示例2: fillDbLayers

 public function fillDbLayers()
 {
     global $dbtypes;
     $dbtypes = array();
     $dbcfgfile = new ConfigFile(CONFIG_PATH . 'dblayers.cfg', TRUE);
     $dbtypes = (array) $dbcfgfile->ValuesArray();
 }
開發者ID:alexpagnoni,項目名稱:ampoliros,代碼行數:7,代碼來源:DBLayerFactory.php

示例3: 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

示例4: PMA_userprefsPageInit

/**
 * Common initialization for user preferences modification pages
 *
 * @param ConfigFile $cf Config file instance
 *
 * @return void
 */
function PMA_userprefsPageInit(ConfigFile $cf)
{
    $forms_all_keys = PMA_readUserprefsFieldNames($GLOBALS['forms']);
    $cf->resetConfigData();
    // start with a clean instance
    $cf->setAllowedKeys($forms_all_keys);
    $cf->setCfgUpdateReadMapping(array('Server/hide_db' => 'Servers/1/hide_db', 'Server/only_db' => 'Servers/1/only_db'));
    $cf->updateWithGlobalConfig($GLOBALS['cfg']);
}
開發者ID:pmagent2013,項目名稱:LonelyDadMeetup,代碼行數:16,代碼來源:user_preferences.lib.php

示例5: factory

 public static function factory($file, $type='file', $options=0) {
   $config = new ConfigFile();
   
   if (!$result = $config->loadFileType($file, $type, $options)) {
      die("FATAL ERROR: cannot load $type configuration file: " . self::getfileByType($file, $type));
   }
   
   return $config;
 }
開發者ID:JimiSlew,項目名稱:kurogo-old,代碼行數:9,代碼來源:ConfigFile.php

示例6: getConfigVars

 protected function getConfigVars()
 {
     require_once 'ConfigFile.class.php';
     // Load the config
     $configFilePath = $this->argv[1];
     global $configFile;
     $configFile = new ConfigFile($configFilePath);
     $configFile->load();
     $vars = $configFile->getVars();
     return $vars;
 }
開發者ID:jibinam,項目名稱:budabot2,代碼行數:11,代碼來源:BotRunner.php

示例7: factory

 public static function factory($file, $type='file', $options=0) {
   $config = new ConfigFile();
   
   if (!$result = $config->loadFileType($file, $type, $options)) {
       if ($options & ConfigFile::OPTION_DIE_ON_FAILURE) {
         die("FATAL ERROR: cannot load $type configuration file: $file");
       }
   }
   
   return $config;
 }
開發者ID:rezalutions,項目名稱:Kurogo-Mobile-Web,代碼行數:11,代碼來源:ConfigFile.php

示例8: connect

 /**
  * Connects to the DB using the _POST array
  * Also writes a config file upon a successful connect
  */
 function connect()
 {
     $this->connector = new Connector($_POST[FORM_SERVER], $_POST[FORM_USER], $_POST[FORM_PASSWORD], $_POST[FORM_DATABASE]);
     $this->connector->connectDatabase();
     if ($this->connector->success()) {
         $cfg = new ConfigFile(CONFIG_FILE_NAME);
         $cfg->generate();
         return true;
     }
     echo "Couldn't connect to DB";
     return false;
 }
開發者ID:GianlucaScarciolla,項目名稱:Duolex,代碼行數:16,代碼來源:installer.php

示例9: factory

 public static function factory($file, $type='file', $options=0) {
   $config = new ConfigFile();
   if (!($options & self::OPTION_DO_NOT_CREATE)) {
       $options = $options | self::OPTION_CREATE_WITH_DEFAULT;
   }
   
   if (!$result = $config->loadFileType($file, $type, $options)) {
       if ($options & self::OPTION_DO_NOT_CREATE) {
           return false;
       }
      throw new Exception("FATAL ERROR: cannot load $type configuration file: " . self::getfileByType($file, $type));
   }
   
   return $config;
 }
開發者ID:neoroman,項目名稱:Kurogo-Mobile-Web,代碼行數:15,代碼來源:ConfigFile.php

示例10: factory

 public static function factory($file, $type = 'file', $options = 0)
 {
     Kurogo::log(LOG_DEBUG, "Loading config file {$file} of type {$type} with options {$options}", 'config');
     $config = new ConfigFile();
     if (!($options & self::OPTION_DO_NOT_CREATE)) {
         $options = $options | self::OPTION_CREATE_WITH_DEFAULT;
     }
     if (!($result = $config->loadFileType($file, $type, $options))) {
         if ($options & self::OPTION_DO_NOT_CREATE) {
             return false;
         }
         throw new KurogoConfigurationException("FATAL ERROR: cannot load {$type} configuration file: " . self::getfileByType($file, $type));
     }
     return $config;
 }
開發者ID:narenv,項目名稱:Kurogo-Mobile-Web,代碼行數:15,代碼來源:ConfigFile.php

示例11: getInstance

 /**
  * Returns class instance
  *
  * @return ConfigFile
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new ConfigFile();
     }
     return self::$_instance;
 }
開發者ID:shishenkov,項目名稱:zpanel,代碼行數:12,代碼來源:ConfigFile.class.php

示例12: testGetConfigArray

 /**
  * Test for ConfigFile::getConfigArray
  *
  * @return void
  * @test
  */
 public function testGetConfigArray()
 {
     $this->object->setPersistKeys(array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE));
     $this->object->set('Array/test', array('x', 'y'));
     $default_value = $this->object->getDefault(self::SIMPLE_KEY_WITH_DEFAULT_VALUE);
     $this->assertEquals(array(self::SIMPLE_KEY_WITH_DEFAULT_VALUE => $default_value, 'Array/test' => array('x', 'y')), $this->object->getConfigArray());
 }
開發者ID:yonh,項目名稱:php-mvc,代碼行數:13,代碼來源:PMA_ConfigFile_test.php

示例13: testGetConfigFile

 /**
  * Test for ConfigGenerator::getConfigFile
  *
  * @return void
  * @group medium
  */
 public function testGetConfigFile()
 {
     $GLOBALS['cfg']['AvailableCharsets'] = array();
     unset($_SESSION['eol']);
     $GLOBALS['PMA_Config'] = new PMA_Config();
     $GLOBALS['server'] = 0;
     $cf = new ConfigFile();
     $_SESSION['ConfigFile0'] = array('a', 'b', 'c');
     $_SESSION['ConfigFile0']['Servers'] = array(array(1, 2, 3));
     $cf->setPersistKeys(array("1/", 2));
     $date = date(DATE_RFC1123);
     $result = ConfigGenerator::getConfigFile($cf);
     $this->assertContains("<?php\n" . "/*\n" . " * Generated configuration file\n" . " * Generated by: phpMyAdmin " . $GLOBALS['PMA_Config']->get('PMA_VERSION') . " setup script\n" . " * Date: " . $date . "\n" . " */\n\n", $result);
     $this->assertContains("/* Servers configuration */\n" . '$i = 0;' . "\n\n" . "/* Server: localhost [0] */\n" . '$i++;' . "\n" . '$cfg[\'Servers\'][$i][\'0\'] = 1;' . "\n" . '$cfg[\'Servers\'][$i][\'1\'] = 2;' . "\n" . '$cfg[\'Servers\'][$i][\'2\'] = 3;' . "\n\n" . "/* End of servers configuration */\n\n", $result);
     $this->assertContains('?>', $result);
 }
開發者ID:kfjihailong,項目名稱:phpMyAdmin,代碼行數:22,代碼來源:PMA_ConfigGenerator_test.php

示例14: init

 /**
  * Initializes the application.
  *
  * Sets the application's root directory, loads the configuration file
  * and initializes the authorization.
  *
  * @param string $rootDir Root directory of this application
  */
 public static function init($rootDir)
 {
     self::$rootDir = $rootDir;
     if (ConfigFile::load()) {
         Security\Authorization::init();
     }
 }
開發者ID:tniessen,項目名稱:tinyIt,代碼行數:15,代碼來源:Application.php

示例15: loadModel

 public function loadModel($id)
 {
     $model = ConfigFile::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('mc', 'The requested page does not exist.'));
     }
     return $model;
 }
開發者ID:Jmainguy,項目名稱:multicraft_install,代碼行數:8,代碼來源:ConfigFileController.php


注:本文中的ConfigFile類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。