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


PHP Configure类代码示例

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


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

示例1: check_login

 /**
  * check_login方法,获取操作员名称.
  *
  * @return bool 返回成功失败
  */
 public function check_login()
 {
     $conf = new Configure();
     $cookie = new CookieComponent();
     $cookie->key = $conf->read('Security.salt');
     $cookie_session = $cookie->read('session');
     $session = isset($cookie_session) && $cookie_session != '' ? $cookie_session : session_id();
     $operator = $this->findBySession($session);
     if (isset($operator['Operator']['id'])) {
         return $operator['Operator'];
     } else {
         return false;
     }
 }
开发者ID:hobbysh,项目名称:seevia-frameworks,代码行数:19,代码来源:operator.php

示例2: admin_index

 function admin_index()
 {
     $this->Ticket->recursive = 0;
     $filters = $this->AlaxosFilter->get_filter();
     $data_ticket = array();
     if (empty($this->params['named']['export_excel'])) {
         $this->set('tickets', $this->paginate($this->Ticket, $filters));
     } else {
         Configure::write('debug', 0);
         $options = array();
         $this->set('export_to_excel', 1);
         $i = 0;
         $tickets = $this->Ticket->find('all', array_merge_recursive($options, array('conditions' => $filters)));
         foreach ($tickets as $ticket) {
             foreach ($ticket as $indx => $module) {
                 foreach ($module as $k => $v) {
                     $arr_fields_in_xls = array();
                     if (!empty($arr_fields_in_xls) && in_array($k, $arr_fields_in_xls[$indx])) {
                         $data_ticket[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     } else {
                         $data_ticket[$i][__($indx, true) . ' ' . __($k, true)] = $module[$k];
                     }
                 }
             }
             $i++;
         }
         $this->set('tickets', $data_ticket);
     }
 }
开发者ID:sanily2j,项目名称:abc,代码行数:29,代码来源:tickets_controller.php

示例3: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     //debug($path);
     $count = count($path);
     //debug($count);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     //debug(Inflector::humanize($path[$count - 1]));
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     //debug($this->render(implode('/', $path)));
     //debug($page);
     //debug($subpage);
     //debug($title_for_layout);
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
开发者ID:pavsnellski,项目名称:SMC,代码行数:42,代码来源:PagesController.php

示例4: __construct

 public function __construct($id = false, $table = null, $ds = null)
 {
     if (!Configure::read('Backend.Acl.enabled')) {
         unset($this->actsAs['Acl']);
     }
     parent::__construct($id, $table, $ds);
 }
开发者ID:fm-labs,项目名称:cakephp-backend,代码行数:7,代码来源:BackendUser.php

示例5: beforeFilter

 public function beforeFilter()
 {
     $this->loadModel('User');
     parent::beforeFilter();
     // Disable content cache for Chrome
     $this->response->disableCache();
     // Delete the default auth message.  Just show them the login page
     //  people will get the idea pretty quickly.
     $this->Session->delete('Message.auth');
     /*if ($this->RequestHandler->isMobile()) {
           $this->layout = 'mobile';
           $this->isMobile = true;
       } else {
           $this->layout = 'mobile';
           $this->isMobile = true;
       }*/
     if ($this->request->is('ajax')) {
         $this->layout = 'ajax';
     }
     $this->Auth->allow('index', 'view', 'display');
     // Let everyone know about the user
     $this->set('loggedIn', $this->Auth->loggedIn());
     $user = $this->Auth->user();
     $this->isAdmin = $this->User->isAdmin($user);
     $this->isEditor = $this->User->isEditor($user);
     $this->set('loggedInuserId', $this->Auth->user('id'));
     $this->set('isAdmin', $this->isAdmin);
     $this->set('isEditor', $this->isEditor);
     $this->set('allowAccountCreation', Configure::read('App.allowPublicAccountCreation'));
 }
开发者ID:admorgan,项目名称:PHPRecipebook,代码行数:30,代码来源:AppController.php

示例6: login

 function login()
 {
     Configure::write('debug', 0);
     if ($this->Auth->isAuthorized()) {
         $this->redirect('/fams/index');
     }
 }
开发者ID:kind-technologies,项目名称:FAMS,代码行数:7,代码来源:users_controller.php

示例7: __construct

 /**
  * Setup the config based on either the Configure::read() values
  * or the PaypalIpnConfig in config/paypal_ipn_config.php
  *
  * Will attempt to read configuration in the following order:
  *   Configure::read('PaypalIpn')
  *   App::import() of config/paypal_ipn_config.php
  *   App::import() of plugin's config/paypal_ipn_config.php
  */
 function __construct()
 {
     $this->config = Configure::read('PaypalIpn');
     if (empty($this->config)) {
         $importConfig = array('type' => 'File', 'name' => 'PaypalIpn.PaypalIpnConfig', 'file' => CONFIGS . 'paypal_ipn_config.php');
         if (!class_exists('PaypalIpnConfig')) {
             App::import($importConfig);
         }
         if (!class_exists('PaypalIpnConfig')) {
             // Import from paypal plugin configuration
             $importConfig['file'] = 'config' . DS . 'paypal_ipn_config.php';
             App::import($importConfig);
         }
         if (!class_exists('PaypalIpnConfig')) {
             trigger_error(__d('paypal_ipn', 'PaypalIpnConfig: The configuration could not be loaded.', true), E_USER_ERROR);
         }
         if (!PHP5) {
             $config =& new PaypalIpnConfig();
         } else {
             $config = new PaypalIpnConfig();
         }
         $vars = get_object_vars($config);
         foreach ($vars as $property => $configuration) {
             if (strpos($property, 'encryption_') === 0) {
                 $name = substr($property, 11);
                 $this->encryption[$name] = $configuration;
             } else {
                 $this->config[$property] = $configuration;
             }
         }
     }
     parent::__construct();
 }
开发者ID:ranium,项目名称:CakePHP-Paypal-IPN-Plugin,代码行数:42,代码来源:paypal.php

示例8: startup

 /**
  * Override startup of the Shell
  *
  * @return void
  */
 public function startup()
 {
     parent::startup();
     if (isset($this->params['connection'])) {
         $this->connection = $this->params['connection'];
     }
     $class = Configure::read('Acl.classname');
     list($plugin, $class) = pluginSplit($class, true);
     App::uses($class, $plugin . 'Controller/Component/Acl');
     if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
         $out = "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
         $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
         $out .= "--------------------------------------------------\n";
         $out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         $this->_stop();
     }
     if ($this->command) {
         if (!config('database')) {
             $this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.'), true);
             $this->args = null;
             return $this->DbConfig->execute();
         }
         require_once APP . 'Config' . DS . 'database.php';
         if (!in_array($this->command, array('initdb'))) {
             $collection = new ComponentCollection();
             $this->Acl = new AclComponent($collection);
             $controller = new Controller();
             $this->Acl->startup($controller);
         }
     }
 }
开发者ID:rednazj,项目名称:Inventory,代码行数:39,代码来源:AclShell.php

示例9: end

 function end()
 {
     $this->Transition->checkPrev(array('index', 'confirm'), '不正なページ遷移です。', array('action' => 'index'));
     $data = $this->Transition->data('index');
     $c =& $this->Contact;
     // $c->requireCaptcha(!$this->Ktai->is_ktai());
     $c->answerCaptcha = $this->Session->read('captcha');
     $c->set($data);
     if (!$c->validates()) {
         $this->Session->setFlash('送信内容に不備があります。');
         $this->redirect(array('action' => 'index'));
     }
     extract($data['Contact']);
     $this->toAddr = Configure::read('Site.contact_mail');
     $this->fromAddr = $email;
     if (!empty($company_name)) {
         $company_name .= ' : ';
     }
     if (DS != "\\") {
         if (!$this->_send($company_name . $name, 'contact_collect', compact('name', 'email', 'company_name', 'statement'))) {
             $this->Session->setFlash('送信に失敗しました。お手数ですが、時間を空けてから再度入力してください。');
             $this->redirect(array('action' => 'index'));
         } else {
             // 送信完了のメール?
         }
     }
     $this->Transition->clearData();
     $this->pageTitle = '送信完了';
 }
开发者ID:konnoyosuke,项目名称:CaptchaContact,代码行数:29,代码来源:contact_controller.php

示例10: initialize

 /**
  * initialize method
  *
  * Merge settings and set Config.language to a valid locale
  *
  * @return void
  * @access public
  */
 function initialize(&$Controller, $config = array())
 {
     App::import('Vendor', 'Mi.MiCache');
     $lang = MiCache::setting('Site.lang');
     if (!$lang) {
         if (!defined('DEFAULT_LANGUAGE')) {
             return;
         }
         $lang = DEFAULT_LANGUAGE;
     } elseif (!defined('DEFAULT_LANGUAGE')) {
         define('DEFAULT_LANGUAGE', $lang);
     }
     Configure::write('Config.language', $lang);
     App::import('Core', 'I18n');
     $I18n =& I18n::getInstance();
     $I18n->domain = 'default_' . $lang;
     $I18n->__lang = $lang;
     $I18n->l10n->get($lang);
     if (!empty($Controller->plugin)) {
         $config['plugins'][] = Inflector::underscore($Controller->plugin);
     }
     if (!empty($config['plugins'])) {
         $plugins = array_intersect(MiCache::mi('plugins'), $config['plugins']);
         $Inst = App::getInstance();
         foreach ($plugins as $path => $name) {
             $Inst->locales[] = $path . DS . 'locale' . DS;
         }
     }
 }
开发者ID:hiromi2424,项目名称:mi,代码行数:37,代码来源:language.php

示例11: instance

 public static function instance()
 {
     if (is_null(self::$instance)) {
         App::import('Vendor', 'Smarty', array('file' => 'autoload.php'));
         $smarty = new Smarty();
         $smarty->template_dir = APP . 'View' . DS;
         //plugins dir(s) must be set by array
         $smarty->plugins_dir = array(APP . 'View' . DS . 'SmartyPlugins', VENDORS . 'smarty' . DS . 'smarty' . DS . 'distribution' . DS . 'libs' . DS . 'plugins');
         $smarty->config_dir = APP . 'View' . DS . 'SmartyConfigs' . DS;
         $smarty->compile_dir = TMP . 'smarty' . DS . 'compile' . DS;
         $smarty->cache_dir = TMP . 'smarty' . DS . 'cache' . DS;
         $smarty->error_reporting = 'E_ALL & ~E_NOTICE';
         $smarty->default_modifiers = array('escape:"html"');
         $smarty->caching = true;
         $smarty->compile_check = true;
         $smarty->cache_lifetime = 3600;
         $smarty->cache_modified_check = false;
         $smarty->force_compile = Configure::read('debug') > 0 ? true : false;
         /*
          $smarty->autoload_filters = array(
          'pre' => array('hoge'),
          'output' => array('escape')
          );
          $smarty->left_delimiter = '{';
          $smarty->right_delimiter = '}';
          //for development
          $smarty->debugging = (Configure::read('debug') == 0) ? false : true;
         */
         self::$instance = $smarty;
     }
     return self::$instance;
 }
开发者ID:haitt55,项目名称:nihon,代码行数:32,代码来源:SmartyView.php

示例12: testImages

 /**
  * @access public
  * @return void
  * 2009-07-30 ms
  */
 function testImages()
 {
     $is = $this->Gravatar->image(GARBIGE_TEST_EMAIL);
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(Configure::read('Config.admin_email'));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL);
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL, array('size' => '200'));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL, array('size' => '20'));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL, array('rating' => 'X'));
     # note the capit. x
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL, array('ext' => true));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(VALID_TEST_EMAIL, array('default' => 'none'));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(GARBIGE_TEST_EMAIL, array('default' => 'none'));
     echo $is;
     $this->assertTrue(!empty($is));
     $is = $this->Gravatar->image(GARBIGE_TEST_EMAIL, array('default' => 'http://2.gravatar.com/avatar/8379aabc84ecee06f48d8ca48e09eef4?d=identicon'));
     echo $is;
     $this->assertTrue(!empty($is));
 }
开发者ID:robksawyer,项目名称:tools,代码行数:39,代码来源:gravatar.test.php

示例13: startup

 /**
  * Override startup of the Shell
  *
  * @access public
  */
 function startup()
 {
     $this->dataSource = 'default';
     if (isset($this->params['datasource'])) {
         $this->dataSource = $this->params['datasource'];
     }
     if (Configure::read('Acl.classname') != 'DB_ACL') {
         $out = "--------------------------------------------------\n";
         $out .= __("Error: Your current Cake configuration is set to", true) . "\n";
         $out .= __("an ACL implementation other than DB. Please change", true) . "\n";
         $out .= __("your core config to reflect your decision to use", true) . "\n";
         $out .= __("DB_ACL before attempting to use this script", true) . ".\n";
         $out .= "--------------------------------------------------\n";
         $out .= sprintf(__("Current ACL Classname: %s", true), Configure::read('Acl.classname')) . "\n";
         $out .= "--------------------------------------------------\n";
         $this->err($out);
         exit;
     }
     if ($this->command && !in_array($this->command, array('help'))) {
         if (!config('database')) {
             $this->out(__("Your database configuration was not found. Take a moment to create one.", true), true);
             $this->args = null;
             return $this->DbConfig->execute();
         }
         require_once CONFIGS . 'database.php';
         if (!in_array($this->command, array('initdb'))) {
             $this->Acl = new AclComponent();
             $controller = null;
             $this->Acl->startup($controller);
         }
     }
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:37,代码来源:acl.php

示例14: initialize

 /**
  * Configuration method.
  *
  * In addition to configuring the settings (see $__defaults above for settings explanation),
  * this function also loops through the installed plugins and 'registers' those that have a
  * PluginNameCallback class.
  *
  * @param object $controller    Controller object
  * @param array $settings       Component settings
  * @access public
  * @return void
  */
 public function initialize(&$controller, $settings = array())
 {
     $this->__controller =& $controller;
     $this->settings = array_merge($this->__defaults, $settings);
     if (empty($this->settings['priority'])) {
         $this->settings['priority'] = Configure::listobjects('plugin');
     } else {
         foreach (Configure::listobjects('plugin') as $plugin) {
             if (!in_array($plugin, $this->settings['priority'])) {
                 array_push($this->settings['priority'], $plugin);
             }
         }
     }
     foreach ($this->settings['priority'] as $plugin) {
         $file = Inflector::underscore($plugin) . '_callback';
         $className = $plugin . 'Callback';
         if (App::import('File', $className, true, array(APP . 'plugins' . DS . Inflector::underscore($plugin)), $file . '.php')) {
             if (class_exists($className)) {
                 $class = new $className();
                 ClassRegistry::addObject($className, $class);
                 $this->__registered[] = $className;
             }
         }
     }
     /**
      * Called before the controller's beforeFilter method.
      */
     $this->executeCallbacks('initialize');
 }
开发者ID:jamienay,项目名称:register_callbacks_component,代码行数:41,代码来源:register_callbacks.php

示例15: beforeRender

 public function beforeRender()
 {
     $this->_setDate();
     $this->set('bodyClass', sprintf('%s %s', strtolower($this->name), strtolower($this->name) . '-' . strtolower($this->action)));
     $this->set(array('isAdmin' => $this->isPrefix('admin'), 'title_for_layout' => $this->titleForLayout, 'currentUser' => $this->currentUser, 'estadosBrasil' => Configure::read('estadosBrasil')));
     return parent::beforeRender();
 }
开发者ID:lucassmacedo,项目名称:Controle-Caixa-CakePHP,代码行数:7,代码来源:AppController.php


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