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


PHP Configure::config方法代码示例

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


在下文中一共展示了Configure::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _configTestFile

 protected function _configTestFile($path = null, $baseKey = null)
 {
     if ($path === null) {
         $path = CakePlugin::path('YamlReader') . 'Test' . DS . 'files' . DS;
     }
     Configure::config('YamlTestConfig', new YamlReader($path, $baseKey));
 }
开发者ID:hiromi2424,项目名称:yaml_reader,代码行数:7,代码来源:YamlReaderTest.php

示例2: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     Configure::config('configini', new IniReader());
     Configure::load('config.ini', 'configini');
     /*
      * "Auth" logic
      * Generate and test the security key
      */
     $api = json_decode($this->Setting->getOption('api'));
     if (empty($api) || empty($api->enabled) || !$api->enabled) {
         return $this->api401(__('API is disabled'));
     }
     // No key, refuse connexion
     if (empty($this->request->params['named']) || empty($this->request->params['named']['key'])) {
         return $this->api401(__('Security key is missing'));
     }
     // Get the key and remote it from the params
     $theirSecurityKey = $this->request->params['named']['key'];
     unset($this->request->params['named']['key']);
     // generate the security key
     $paramsUrl = '/' . $this->request->params['controller'] . '/' . $this->request->params['action'];
     $paramsUrl .= $this->Tools->paramsToUrl($this->request->params['named']);
     $securityKey = hash_hmac('sha1', $paramsUrl, $api->privateKey);
     if ($theirSecurityKey != $securityKey) {
         return $this->api401(__('Wrong security key'));
     }
 }
开发者ID:Chaoslan,项目名称:mushraider,代码行数:28,代码来源:ApiAppController.php

示例3: _configTestFile

 protected function _configTestFile($domain = null, $path = null, $baseKey = null)
 {
     if ($path === null) {
         $path = App::pluginPath('YamlReader') . 'Test' . DS . 'files' . DS;
     }
     Configure::config('I18nYamlTestConfig', new I18nYamlReader($domain, $path, $baseKey));
 }
开发者ID:hiromi2424,项目名称:yaml_reader,代码行数:7,代码来源:I18nYamlReaderTest.php

示例4: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     App::uses('CloggyModuleConfigReader', 'CustomConfigure');
     Configure::config('cloggy', new CloggyModuleConfigReader('CloggySearch'));
     //disable auto render
     $this->autoRender = false;
 }
开发者ID:simaostephanie,项目名称:Cloggy,代码行数:8,代码来源:CloggySearchInstallController.php

示例5: setupSettings

 public function setupSettings($appDir)
 {
     if (!$this->setupSettings) {
         return;
     }
     $Setting = ClassRegistry::init('Settings.Setting');
     $Setting->settingsPath = $appDir . 'Config' . DS . 'settings.json';
     Configure::drop('settings');
     Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS));
     $Setting->writeConfiguration();
 }
开发者ID:saydulk,项目名称:croogo,代码行数:11,代码来源:CroogoTestCase.php

示例6: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND);
     CakePlugin::unload('Install');
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $Setting = ClassRegistry::init('Settings.Setting');
     $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json';
     Configure::drop('settings');
     Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS));
     $Setting->writeConfiguration();
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:18,代码来源:CroogoTestCase.php

示例7: __construct

 function __construct()
 {
     Configure::config('configini', new IniReader());
     Configure::load('config.ini', 'configini');
     if ($databaseConf = Configure::read('Database')) {
         $this->default['datasource'] = $databaseConf['datasource'];
         $this->default['host'] = $databaseConf['host'];
         $this->default['login'] = $databaseConf['login'];
         $this->default['password'] = $databaseConf['password'];
         $this->default['database'] = $databaseConf['database'];
         $this->default['prefix'] = $databaseConf['prefix'];
         $this->default['port'] = $databaseConf['port'];
     }
 }
开发者ID:Chaoslan,项目名称:mushraider,代码行数:14,代码来源:database.php

示例8: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     // Check conf file
     if (!file_exists('../Config/config.ini')) {
         file_put_contents('../Config/config.ini', '');
     }
     Configure::config('configini', new IniReader());
     Configure::load('config.ini', 'configini');
     // If config isn't set, redirect to install process to create one
     if (!Configure::read('Settings.installed') && strtolower($this->plugin) != 'install') {
         $this->Session->setFlash(__('MushRaider is ready for install, what about you ?'), 'flash_info');
         $this->redirect('/install/step/1');
     }
     // Language
     $language = Configure::read('Settings.language');
     $language = $this->Cookie->check('Lang') ? $this->Cookie->read('Lang') : $language;
     $language = !empty($language) ? $language : 'eng';
     Configure::write('Config.language', $language);
     // Some usefull infos
     Configure::write('Config.maxFileSize', ini_get('upload_max_filesize'));
     Configure::write('Config.maxPostSize', ini_get('post_max_size'));
     Configure::write('Config.appUrl', rtrim('http://' . $_SERVER['HTTP_HOST'] . $this->webroot, '/'));
     // Timezone
     date_default_timezone_set($this->Setting->getOption('timezone'));
     // Log in user
     if ($this->Session->check('User.id')) {
         $userID = $this->Session->read('User.id');
         if (!empty($userID)) {
             $params = array();
             $params['recursive'] = 1;
             $params['contain']['Role'] = array();
             $params['contain']['Character'] = array();
             $params['conditions']['User.id'] = $userID;
             if ($this->user = $this->User->find('first', $params)) {
                 $this->user['User']['can'] = $this->Role->getPermissions($this->user['User']['role_id']);
             }
         } else {
             $this->Session->delete('User.id');
         }
     }
     // Is a patch needed ?
     if (strtolower($this->name) != 'patcher' && strtolower($this->name) != 'auth') {
         $this->Patcher->patchNeeded();
     }
     $this->pageTitle = $this->Setting->getOption('title');
     Configure::write('Config.email', json_decode($this->Setting->getOption('email')));
     Configure::write('Config.notifications', json_decode($this->Setting->getOption('notifications')));
 }
开发者ID:Chaoslan,项目名称:mushraider,代码行数:49,代码来源:AppController.php

示例9: __construct

 /**
  * Constructor
  *
  * @param mixed $id The id to start the model on.
  * @param string $table The table to use for this model.
  * @param string $ds The connection name this model is connected to.
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     Configure::config('default', new PhpReader(ROOT . '/plugins/Tools/Config/'));
     Configure::load('google', 'default');
     set_include_path(ROOT . '/plugins/Tools/Lib/' . PATH_SEPARATOR . get_include_path());
     require_once 'Google/Client.php';
     require_once 'Google/Service/Calendar.php';
     $this->__client = new Google_Client();
     $this->__client->setClientId(Configure::read('google_client_id'));
     $this->__client->setClientSecret(Configure::read('google_client_secret'));
     $this->__client->setRedirectUri(Configure::read('google_redirect_url'));
     $this->__client->setAccessType('offline');
     $this->__client->addScope("https://www.googleapis.com/auth/calendar");
     $this->__service = new Google_Service_Calendar($this->__client);
 }
开发者ID:JodiWarren,项目名称:hms,代码行数:23,代码来源:ToolsGoogle.php

示例10: __construct

 /**
  * Constructor
  *
  * @param mixed $id The id to start the model on.
  * @param string $table The table to use for this model.
  * @param string $ds The connection name this model is connected to.
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     Configure::config('default', new PhpReader());
     Configure::load('mailchimp', 'default');
     // Set-up mailchimp
     $this->apikey = Configure::read('mailchimp_apiKey');
     $this->__api = new MCAPI($this->apikey, true);
     // Bit hacky, we need to tell the MCAPI class
     // which dbConfig to use, but we can't add a method on
     // to the production MCAPI class, so we have to check if
     // it exists first.
     if (method_exists($this->__api, 'setConfig')) {
         $this->__api->setConfig($this->useDbConfig);
     }
 }
开发者ID:JodiWarren,项目名称:hms,代码行数:23,代码来源:MailingList.php

示例11: __construct

 /**
  * __construct
  * @param array $config
  * @param string $path
  */
 public function __construct($config = array(), $path = null)
 {
     if (!$path) {
         $path = APP . 'Config' . DS;
     }
     Configure::delete('Oven');
     if (empty($config)) {
         $try = array($path . 'oven.json', $path . 'oven.php');
         foreach ($try as $cfg) {
             if (file_exists($cfg)) {
                 $this->path = $cfg;
                 $ext = strrchr($cfg, '.');
                 switch ($ext) {
                     case '.json':
                         App::uses('File', 'Utility');
                         $cfg = new File($cfg);
                         $this->config = json_decode($cfg->read(), true);
                         break;
                     case '.yaml':
                         App::import('Vendor', 'Oven.spyc/spyc');
                         $this->config = Spyc::YAMLLoad($cfg);
                         break;
                     default:
                         App::uses('PhpReader', 'Configure');
                         Configure::config('oven', new PhpReader(dirname($cfg) . DS));
                         Configure::load('oven', 'oven');
                         $this->config = Configure::read('Oven');
                         break;
                 }
                 break;
             }
         }
         // IF NO CONFIG COPY OVER SAMPLE
         if (empty($this->config)) {
             if (copy(CakePlugin::path('Oven') . 'Config' . DS . 'config.json', $path . 'oven.json')) {
                 $this->__construct();
             }
         }
     } else {
         $this->config = $config;
     }
     $this->config = $this->_default($this->config);
     Configure::write('Oven', $this->config);
 }
开发者ID:shama,项目名称:oven,代码行数:49,代码来源:OvenConfig.php

示例12: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     if (!file_exists('../Config/config.ini')) {
         file_put_contents('../Config/config.ini', '');
     }
     Configure::config('configini', new IniReader());
     Configure::load('config.ini', 'configini');
     // If config already set, redirect to root
     if (file_exists('../Config/config.ini')) {
         if (Configure::read('Settings.installed')) {
             $this->Session->setFlash(__('MushRaider can see the database config, why do you want to install ?'), 'flash_warning');
             $this->redirect('/');
         }
     }
     $this->set('title_for_layout', __('MushRaider Installer'));
     $languages = array('eng' => 'English', 'fra' => 'Français', 'deu' => 'Deutsch');
     $this->set('languages', $languages);
 }
开发者ID:Chaoslan,项目名称:mushraider,代码行数:19,代码来源:InstallAppController.php

示例13: setUp

 /**
  * setUp
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     App::build(array('Plugin' => array(TESTS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(TESTS . 'test_app' . DS . 'View' . DS)), App::PREPEND);
     if (!isset($_SERVER['REMOTE_ADDR'])) {
         $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     }
     CakePlugin::unload('Install');
     CakePlugin::load(array('Users'), array('bootstrap' => true));
     CakePlugin::load('Example');
     Configure::write('Acl.database', 'test');
     $Setting = ClassRegistry::init('Settings.Setting');
     $Setting->settingsPath = TESTS . 'test_app' . DS . 'Config' . DS . 'settings.json';
     Configure::drop('settings');
     Configure::config('settings', new CroogoJsonReader(dirname($Setting->settingsPath) . DS));
     CakeLog::drop('stdout');
     CakeLog::drop('stderr');
     $Setting->writeConfiguration();
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:24,代码来源:CroogoControllerTestCase.php

示例14: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     Configure::config('default', new PhpReader());
     Configure::load('automation', 'default');
     //Configure::load('routes', 'default');
     $phpSelf = $_SERVER['PHP_SELF'];
     $selfParts = explode('/', $phpSelf);
     $this->__rootUrl = '';
     $partIndex = 0;
     $firstPart = true;
     $numParts = count($selfParts);
     while ($selfParts[$partIndex] != 'app' && $partIndex < $numParts) {
         if ($selfParts[$partIndex] != '') {
             if (!$firstPart) {
                 $this->__rootUrl .= '/';
             }
             $firstPart = false;
             $this->__rootUrl .= $selfParts[$partIndex];
         }
         $partIndex++;
     }
     $this->__webDriver = new PHPWebDriver_WebDriver(Configure::read('automation_driver_selenium_url'));
     new CakeRequest();
 }
开发者ID:JodiWarren,项目名称:hms,代码行数:27,代码来源:AutomationDriver.php

示例15: testReaderExceptionOnIncorrectClass

 /**
  * test reader() throwing exceptions on missing interface.
  *
  * @expectedException PHPUnit_Framework_Error
  * @return void
  */
 public function testReaderExceptionOnIncorrectClass()
 {
     $reader = new StdClass();
     Configure::config('test', $reader);
 }
开发者ID:Juan09130424,项目名称:CakePHP---Bootstrap-template,代码行数:11,代码来源:ConfigureTest.php


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