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


PHP Configure::load方法代码示例

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


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

示例1: _setLanguage

 private function _setLanguage()
 {
     $session_lang = $this->Session->read('lang') ? $this->Session->read('lang') : null;
     if ($session_lang == null) {
         $session_lang = Configure::read('DEF_LANG');
         Configure::load('rus_config');
     } else {
         if (!in_array($session_lang, Configure::read('VALID_LANGS'))) {
             $session_lang = Configure::read('DEF_LANG');
             Configure::load('rus_config');
         }
     }
     $this->Session->write('lang', $session_lang);
     $c = 0;
     foreach (Configure::read('VALID_LANGS') as $lang) {
         if ($lang == $session_lang) {
             $key = $c;
         }
         $c++;
     }
     $locale = Configure::read('VALID_LANG_LOCALES')[$key];
     //запись в конфиг локали
     Configure::write('Config.language', $locale);
     Configure::load($locale . '_config');
     $this->Session->write('lang_locale', $locale);
     $lang_prefix = 'name_' . lang_prefix();
     $this->set('lang_prefix', $lang_prefix);
 }
开发者ID:homoastricus,项目名称:master_project,代码行数:28,代码来源:AppController.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: initialize

 /**
  * Overwrite shell initialize to dynamically load all Queue Related Tasks.
  *
  * @return void
  */
 public function initialize()
 {
     $this->_loadModels();
     $x = App::objects('Queue.Task');
     //'Console/Command/Task'
     //$x = App::path('Task', 'Queue');
     $paths = App::path('Console/Command/Task');
     foreach ($paths as $path) {
         $Folder = new Folder($path);
         $this->tasks = array_merge($this->tasks, $Folder->find('Queue.*\\.php'));
     }
     $plugins = App::objects('plugin');
     foreach ($plugins as $plugin) {
         $pluginPaths = App::path('Console/Command/Task', $plugin);
         foreach ($pluginPaths as $pluginPath) {
             $Folder = new Folder($pluginPath);
             $res = $Folder->find('Queue.*Task\\.php');
             foreach ($res as &$r) {
                 $r = $plugin . '.' . basename($r, 'Task.php');
             }
             $this->tasks = array_merge($this->tasks, $res);
         }
     }
     //Config can be overwritten via local app config.
     Configure::load('Queue.queue');
     $conf = (array) Configure::read('Queue');
     //merge with default configuration vars.
     Configure::write('Queue', array_merge(['maxruntime' => DAY, 'cleanuptimeout' => MONTH], $conf));
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:34,代码来源:CronShell.php

示例4: HfacebookHelper

 function HfacebookHelper()
 {
     Configure::load('facebook');
     $this->appId = Configure::read('facebook.appId');
     $this->apiKey = Configure::read('facebook.apiKey');
     $this->apiSecret = Configure::read('facebook.apiSecret');
 }
开发者ID:ralaxraja,项目名称:phlypheonix,代码行数:7,代码来源:hfacebook.php

示例5: subjects

 function subjects()
 {
     $user = $this->Session->read("Auth.User");
     Configure::load('feedback');
     //load the max_sub_num variable
     //$subjects=$this->Subject->query("SELECT * FROM subjects WHERE class = '".$user['class']."'  AND id NOT IN ( SELECT subject_id FROM subject_memberships WHERE student_id = ".$user['id']." AND form_a_submitted = ".Configure::read('max_sub_num').")");//To get the subject names correctly
     $teacher1 = null;
     //set to stop errors
     $teacher2 = null;
     $subjects = $this->Subject->query("SELECT * FROM subjects where id IN ( SELECT subject_id FROM subject_memberships WHERE student_id =" . $user['id'] . ")");
     $submitted = $this->Subject->query("SELECT max(`submission_number`) as subnum FROM form_a_records WHERE student=" . $user['id']);
     //$teacher2 = null;no more teacher2
     //to get teacher names
     if (empty($subjects)) {
         $this->Session->setFlash("You don't need to submit any feedback right now", 'default', array('class' => 'message info'));
     }
     //             if(empty($allSubjects)){
     //             	$this->Session->setFlash("don't need to submit any feedback right now", 'default',array('class'=>'message info'));
     //             }
     for ($i = 0; $i < count($subjects); $i++) {
         $t1 = $subjects[$i]["subjects"]["teacher1"];
         $teacher1[$i] = $this->Subject->query("SELECT name from users where id= {$t1}");
         /*$t2=$subjects[$i]["subjects"]["teacher2"];
           $teacher2[$i]=($t2==NULL)?NULL:$this->Subject->query("SELECT name from users where id= $t2");no more teacher2*/
     }
     $this->set('submitted', $submitted);
     // $this->set('allSubjects',$allSubjects);
     $this->set('subjects', $subjects);
     $this->set('teacher1', $teacher1);
     $this->set('max_sub_num', Configure::read('max_sub_num'));
     // $this->set('teacher2',$teacher2);
     //$this->set('teacher2',$teacher2);no more teacher2
 }
开发者ID:raveebhat,项目名称:app,代码行数:33,代码来源:subjects_controller.php

示例6: loadTwitter

 protected function loadTwitter()
 {
     if (isset($this->Twitter)) {
         if ($this->Twitter) {
             return $this->Twitter;
         }
     }
     if (!class_exists('Endroid\\Twitter\\Twitter')) {
         App::uses('endroid/twitter/src/endroid/twitter', 'Vendor');
     }
     if (!class_exists('Endroid\\Twitter\\Twitter')) {
         return false;
     }
     if (!is_file(APP . DS . 'Config' . DS . 'twitter.php')) {
         return false;
     }
     if (!Configure::load('twitter')) {
         return false;
     }
     if (!Configure::check('Twitter')) {
         return false;
     }
     $settings = Configure::read('Twitter');
     if (empty($settings)) {
         return false;
     }
     extract($settings);
     $this->controller->Twitter = new Endroid\Twitter\Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret);
     return $this->controller->Twitter ?: !$this->log(array("InitializeComponent->twitter" => array('request->here' => $this->controller->request->here, 'request->params' => $this->controller->request->params) + compact('settings')), 'debug');
 }
开发者ID:JacopKane,项目名称:Cake-Nod,代码行数:30,代码来源:InitializeComponent.php

示例7: beforeFilter

 public function beforeFilter()
 {
     $this->Cookie->httpOnly = true;
     /*Configure Path*/
     App::build(array('Model' => array(CAKE_CORE_INCLUDE_PATH . '/Model/Base/', CAKE_CORE_INCLUDE_PATH . '/Model/', APP_DIR . '/Model/', CAKE_CORE_INCLUDE_PATH . '/Model/Form/'), 'Lib' => array(CAKE_CORE_INCLUDE_PATH . '/Lib/'), 'Vendor' => array(CAKE_CORE_INCLUDE_PATH . '/Vendor/')));
     /*Autoload Model*/
     App::import('Model', array('CommonTable'));
     /*Autoload Lib*/
     App::uses('myTools', 'Lib');
     App::uses('myMailer', 'Lib');
     App::uses('myError', 'Lib');
     /*Autoload table class*/
     spl_autoload_register(function ($class) {
         $classFile1 = CAKE_CORE_INCLUDE_PATH . '/Model/' . $class . '.php';
         $classFile2 = CAKE_CORE_INCLUDE_PATH . '/Model/Form/' . $class . '.php';
         if (is_file($classFile1)) {
             require_once $classFile1;
         }
         if (is_file($classFile2)) {
             require_once $classFile2;
         }
     });
     /*Autoload Lib*/
     Configure::load('my');
     Configure::load('const');
 }
开发者ID:belamide09,项目名称:mysite,代码行数:26,代码来源:AppController.php

示例8: __construct

 /**
  * Controller construct (loads config file)
  * 
  * @return null
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     Configure::load('Twitter.twitter', 'default', false);
     $this->consumerKey = Configure::read('Twitter.consumerKey');
     $this->consumerSecret = Configure::read('Twitter.consumerSecret');
 }
开发者ID:priyankasingh,项目名称:Genie,代码行数:12,代码来源:TwitterController.php

示例9: beforeFilter

 function beforeFilter()
 {
     Configure::load('vars');
     /*
     
      if ( !isset($this->params['lang']) && !$this->Session->check('langSes') ) {
     
      $this->params['lang'] = $defaultLang;
      $this->Session->write('langSes',$defaultLang);
     
      } elseif ( !isset($this->params['lang']) && $this->Session->check('langSes') ) {
      $this->params['lang'] = $this->Session->read('langSes');
      }
     
      Configure::write('Config.language', $this->params['lang']);
      $this->Session->write('langSes',$this->params['lang']);
     */
     if (isset($this->Auth)) {
         if ($this->viewPath == 'pages' && $this->params['action'] != 'admin_index') {
             $this->Auth->allow('*');
         } else {
             $this->Auth->authorize = 'controller';
             if (in_array(low($this->params['controller']), $this->publicControllers)) {
                 //$this->Auth->allow('*');
                 $this->Auth->deny('pages/admin_index');
             }
         }
         //$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
     }
 }
开发者ID:kondrat,项目名称:wr,代码行数:30,代码来源:app_controller.php

示例10: initialize

 public function initialize(&$controller, $settings = array())
 {
     $this->controller = $controller;
     //do not care pre defined ajax action
     if (0 === strpos($controller->params['action'], 'ajax_')) {
         return;
     }
     Configure::load('redirectacl');
     $acl = Configure::read('redirectacl');
     //spider
     if (!$this->controller->UaAcl->check($acl['spider'])) {
         $this->controller->spider = true;
         //this is a cheat for spider to access default page when spider visit '/'
         if ('forum' === $controller->params['controller'] && 'front' === $controller->params['action']) {
             $controller->params['action'] = 'index';
         }
         return;
     }
     //normal
     $r = $this->isRedirect();
     $ajax = $controller->RequestHandler->isAjax();
     //should redirect but no ajax,go front
     if ($r && !$ajax) {
         $this->front();
     }
     //should not redirect but stop,
     if (!$r && $ajax) {
         $controller->_stop();
     }
 }
开发者ID:tilitala,项目名称:nForum,代码行数:30,代码来源:redirect_acl.php

示例11: allclients

 function allclients()
 {
     if (!empty($this->data)) {
         if ($this->Mail->save($this->data)) {
             $this->loadModel('Client');
             $emailsofclients = $this->Client->find('list', array('fields' => array('email'), 'conditions' => array('Client.visible >' => 0)));
             $nbr_sent = $nbr_unsent = $nbr_client = 0;
             foreach ($emailsofclients as $emailofclient) {
                 if (!empty($emailofclient)) {
                     Configure::load('email');
                     $this->Email->from = Configure::read('Email.senderName') . ' <' . Configure::read('Email.senderEmail') . '>';
                     $this->Email->to = $emailofclient;
                     $this->Email->subject = $this->data['Mail']['subject'];
                     $this->Email->send($this->data['Mail']['textarea']);
                     $nbr_sent++;
                     $this->Email->reset();
                 } else {
                     $nbr_unsent++;
                 }
                 $nbr_client++;
             }
             $this->flash($nbr_sent . ' emails ont &eacute;t&eacute; envoy&eacute;s (soit ' . $nbr_sent . '/' . $nbr_client . ' clients)', $this->Session->read('App.redirect_to'));
         }
     }
 }
开发者ID:hellagency,项目名称:HellCRM,代码行数:25,代码来源:mails_controller.php

示例12: __construct

 /**
  * Loads HttpSocket class
  *
  * @param array $config
  * @param HttpSocket $Http
  */
 public function __construct($config, $Http = null)
 {
     if (!isset($this->config['database'])) {
         $this->config['database'] = '';
     }
     // Store the API configuration map
     $name = pluginSplit($config['datasource']);
     if (!($this->map = Configure::read('Apis.' . $name[1]))) {
         Configure::load($name[0] . '.' . $name[1]);
         $this->map = Configure::read('Apis.' . $name[1]);
     }
     // Store the HttpSocket reference
     if (!$Http) {
         if (!empty($this->map['oauth']['version'])) {
             if ($this->map['oauth']['version'][0] == 2) {
                 $config['method'] = 'OAuthV2';
             } else {
                 $config['method'] = 'OAuth';
             }
             App::uses('HttpSocketOauth', 'HttpSocketOauth.Lib');
             $Http = new HttpSocketOauth();
         } else {
             App::uses('HttpSocket', 'Network/Http');
             $Http = new HttpSocket();
         }
     }
     $this->Http = $Http;
     parent::__construct($config);
 }
开发者ID:PastorMickael,项目名称:CakePHP-Api-Datasources,代码行数:35,代码来源:ApisSource.php

示例13: initialize

 function initialize(&$controller)
 {
     $this->__controller =& $controller;
     $this->settingsFile = ROOT . DS . APP_DIR . DS . 'config' . DS . 'settings.php';
     Configure::load($this->_settingsName);
     $this->_settings = Configure::read($this->_settingsName);
 }
开发者ID:analogrithems,项目名称:idbroker,代码行数:7,代码来源:settings_handler.php

示例14: _load_app_config

 protected function _load_app_config()
 {
     /* Carga project/Config/Sistema/config.php */
     Configure::load('App/config');
     $this->config = Configure::read('app');
     $this->set('config', $this->config);
 }
开发者ID:eduardoromero,项目名称:cakephp-phpjalisco,代码行数:7,代码来源:AppController.php

示例15: show

 public function show($theme = null, $errors = true, $ssl = true)
 {
     if (!in_array($theme, array('red', 'white', 'blackglass', 'clean'))) {
         $theme = $this->defaultTheme;
     }
     if ($this->secure === true) {
         $server = self::API_SECURE_SERVER;
     } else {
         $server = self::API_SERVER;
     }
     Configure::load('Recaptcha.key');
     $publicKey = Configure::read('Recaptcha.Public');
     if (empty($publicKey) && !is_int($publicKey)) {
         throw new InvalidArgumentException('To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create');
     }
     $publicKey = rawurlencode($publicKey);
     $html = $this->Html->scriptBlock(sprintf('var RecaptchaOptions = {theme:"%s"};', $theme));
     $scriptUrl = sprintf('%s/challenge?k=%s', $server, $publicKey);
     $noScriptUrl = sprintf('%s/noscript?k=%s', $server, $publicKey);
     $html .= $this->Html->script($scriptUrl);
     $html .= $this->Html->tag('noscript', $this->Html->tag('iframe', null, array('src' => $noScriptUrl)) . $this->Html->tag('br') . $this->Form->textarea('recaptcha_challenge_field') . $this->Form->hidden('recaptcha_response_field', array('value' => 'manual_challenge')));
     if ($errors == true) {
         $html .= $this->error();
     }
     return $html;
 }
开发者ID:rintaun,项目名称:Recaptcha,代码行数:26,代码来源:RecaptchaHelper.php


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