当前位置: 首页>>代码示例>>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;未经允许,请勿转载。