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


PHP CakeSession::check方法代码示例

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


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

示例1: flash

 public function flash($key = 'flash', $attrs = array())
 {
     $out = false;
     if (CakeSession::check('Message.' . $key)) {
         $flash = CakeSession::read('Message.' . $key);
         $message = $flash['message'];
         unset($flash['message']);
         if (!empty($attrs)) {
             $flash = array_merge($flash, $attrs);
         }
         if ($flash['element'] === 'default') {
             $class = 'success';
             if (!empty($flash['params']['class'])) {
                 $class = $flash['params']['class'];
             }
             $out = '<div id="' . $key . 'Message" class="alert alert-' . $class . '"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $message . '</div>';
         } elseif (!$flash['element']) {
             $out = $message;
         } else {
             $options = array();
             if (isset($flash['params']['plugin'])) {
                 $options['plugin'] = $flash['params']['plugin'];
             }
             $tmpVars = $flash['params'];
             $tmpVars['message'] = $message;
             $out = $this->_View->element($flash['element'], $tmpVars, $options);
         }
         CakeSession::delete('Message.' . $key);
     }
     return $out;
 }
开发者ID:shahariaazam,项目名称:cakephp-quick-start,代码行数:31,代码来源:SessionHelper.php

示例2: _getSite

 protected function _getSite($siteId = null)
 {
     $Site = ClassRegistry::init('Sites.Site');
     $SiteDomain = $Site->SiteDomain;
     $SiteMeta = $Site->SiteMeta;
     $siteDomainTable = $SiteDomain->getDataSource()->fullTableName($SiteDomain, true, true);
     $siteMetaTable = $Site->SiteMeta->getDataSource()->fullTableName($SiteMeta, true, true);
     $options = array('recursive' => false, 'fields' => array('Site.id', 'Site.title', 'Site.tagline', 'Site.theme', 'Site.timezone', 'Site.locale', 'Site.status', 'SiteMeta.robots', 'SiteMeta.keywords', 'SiteMeta.description'), 'joins' => array(array('table' => $siteDomainTable, 'alias' => 'SiteDomain', 'conditions' => array('SiteDomain.site_id = Site.id'))), array('table' => $siteMetaTable, 'alias' => 'SiteMeta', 'conditions' => array('SiteMeta.site_id = Site.id')));
     $host = env('HTTP_HOST');
     if (empty($siteId)) {
         $options['joins'][0]['conditions']['SiteDomain.domain LIKE'] = '%' . $host;
         $options['cache'] = array('name' => 'sites_' . $host, 'config' => 'sites');
     } else {
         $options['conditions'] = array('Site.id' => $siteId);
         $options['cache'] = array('name' => 'sites_' . $siteId, 'config' => 'sites');
     }
     $site = $Site->find('first', $options);
     if (empty($site)) {
         $site = $Site->find('first', array('recursive' => false, 'fields' => array('id', 'title', 'tagline', 'theme', 'timezone', 'locale', 'status'), 'joins' => array(array('table' => $siteDomainTable, 'alias' => 'SiteDomain', 'conditions' => array('SiteDomain.site_id = Site.id'))), array('table' => $siteMetaTable, 'alias' => 'SiteMeta', 'conditions' => array('SiteMeta.site_id = Site.id')), 'conditions' => array('Site.default' => 1)));
     }
     if ($siteId === null && CakeSession::check(self::$_sessionKey) && ($active = CakeSession::read(self::$_sessionKey))) {
         $found = $SiteDomain->find('count', array('cache' => array('name' => 'sites_count_' . $host, 'config' => 'sites'), 'conditions' => array('SiteDomain.domain' => $host)));
         if ($found == 0) {
             $site = $active;
         }
     }
     return $site;
 }
开发者ID:daniel-neumann,项目名称:sites,代码行数:28,代码来源:Sites.php

示例3: setup

 /**
  * Check Auth is user is admin
  */
 public function setup(Model $model, $settings = array())
 {
     parent::setup($model, $settings);
     if (CakeSession::check('Auth')) {
         $this->_isAdmin = CakeSession::read('Auth.User.is_admin') ? true : false;
     }
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:10,代码来源:CakePackagesTaggableBehavior.php

示例4: __construct

 /**
  * Checks to see if there is already a logged in session
  */
 public function __construct()
 {
     if (CakeSession::check('auth') && CakeSession::read('auth') == TRUE) {
         $this->status = TRUE;
         $this->admin_user = CakeSession::read('admin_user');
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:10,代码来源:PermissionComponent.php

示例5: flash

 public function flash($key = 'flash', $attrs = array())
 {
     $out = false;
     if (CakeSession::check('Message.' . $key)) {
         $flash = CakeSession::read('Message.' . $key);
         if (is_array($flash)) {
             foreach ($flash as $fkey => $msg) {
                 $message = $msg['message'];
                 //                    unset($flash[$fkey]['message']);
                 if (!empty($attrs)) {
                     $msg = array_merge($msg, $attrs);
                 }
                 if ($msg['element'] === 'default') {
                     $class = 'message';
                     if (!empty($msg['params']['class'])) {
                         $class = $msg['params']['class'];
                     }
                     $out .= '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>';
                 } elseif (!$msg['element']) {
                     $out .= $message;
                 } else {
                     $options = array();
                     if (isset($msg['params']['plugin'])) {
                         $options['plugin'] = $msg['params']['plugin'];
                     }
                     $tmpVars = $msg['params'];
                     $tmpVars['message'] = $message;
                     $out .= $this->_View->element($msg['element'], $tmpVars, $options);
                 }
                 CakeSession::delete('Message.' . $key . '.' . $fkey);
             }
         } else {
             $message = $flash['message'];
             unset($flash['message']);
             if (!empty($attrs)) {
                 $flash = array_merge($flash, $attrs);
             }
             if ($flash['element'] === 'default') {
                 $class = 'message';
                 if (!empty($flash['params']['class'])) {
                     $class = $flash['params']['class'];
                 }
                 $out = '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>';
             } elseif (!$flash['element']) {
                 $out = $message;
             } else {
                 $options = array();
                 if (isset($flash['params']['plugin'])) {
                     $options['plugin'] = $flash['params']['plugin'];
                 }
                 $tmpVars = $flash['params'];
                 $tmpVars['message'] = $message;
                 $out = $this->_View->element($flash['element'], $tmpVars, $options);
             }
             CakeSession::delete('Message.' . $key);
         }
     }
     return $out;
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:59,代码来源:MySessionHelper.php

示例6: initialize

 public function initialize(Controller $controller)
 {
     if (CakeSession::check('Config.language')) {
         Configure::write('Config.language', CakeSession::read('Config.language'));
     }
     if (CakeSession::check('Config.language')) {
         Configure::write('Config.language', CakeSession::read('Config.language'));
     }
 }
开发者ID:pdkhuong,项目名称:BBG,代码行数:9,代码来源:MultiLanguageComponent.php

示例7: beforeRender

 public function beforeRender()
 {
     parent::beforeRender();
     $this->set("title_for_layout", "サマリー");
     if (CakeSession::check('errMsg')) {
         $this->set("errMsg", CakeSession::read('errMsg'));
         CakeSession::delete('errMsg');
     }
 }
开发者ID:tatakauashi,项目名称:meiteampower,代码行数:9,代码来源:SummaryController.php

示例8: __construct

 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     if (!CakeSession::check($this->_strategy)) {
         $config = ClassRegistry::init('Opauth.OpauthSetting')->findByName($this->_strategy);
         if (!empty($config['OpauthSetting'])) {
             CakeSession::write($this->_strategy, $config['OpauthSetting']);
         }
     }
     $this->_config = CakeSession::read($this->_strategy);
 }
开发者ID:00f100,项目名称:opauth-facebook-model,代码行数:11,代码来源:FacebookApiAppModel.php

示例9: index

 public function index()
 {
     $loginId = $this->_checkLogin();
     if (!empty($loginId)) {
         $this->redirect('../summary/');
     }
     if (CakeSession::check('errMsg')) {
         $this->set("errMsg", CakeSession::read('errMsg'));
         CakeSession::delete('errMsg');
     }
 }
开发者ID:tatakauashi,项目名称:meiteampower,代码行数:11,代码来源:LoginController.php

示例10: currentBasketId

 public function currentBasketId()
 {
     if (!CakeSession::check('WebshopShoppingBasket.current_basket_id')) {
         $basketId = $this->createBasket();
         if (!$basketId) {
             return false;
         }
         CakeSession::write('WebshopShoppingBasket.current_basket_id', $basketId);
     }
     return CakeSession::read('WebshopShoppingBasket.current_basket_id');
 }
开发者ID:cvo-technologies,项目名称:croogo-webshop-shopping-cart-plugin,代码行数:11,代码来源:ShoppingBasket.php

示例11: render

 /**
  * Used to render the message set in FlashComponent::set()
  *
  * In your view: $this->Flash->render('somekey');
  * Will default to flash if no param is passed
  *
  * You can pass additional information into the flash message generation. This allows you
  * to consolidate all the parameters for a given type of flash message into the view.
  *
  * ```
  * echo $this->Flash->render('flash', array('params' => array('name' => $user['User']['name'])));
  * ```
  *
  * This would pass the current user's name into the flash message, so you could create personalized
  * messages without the controller needing access to that data.
  *
  * Lastly you can choose the element that is used for rendering the flash message. Using
  * custom elements allows you to fully customize how flash messages are generated.
  *
  * ```
  * echo $this->Flash->render('flash', array('element' => 'my_custom_element'));
  * ```
  *
  * If you want to use an element from a plugin for rendering your flash message
  * you can use the dot notation for the plugin's element name:
  *
  * ```
  * echo $this->Flash->render('flash', array(
  *   'element' => 'MyPlugin.my_custom_element',
  * ));
  * ```
  *
  * @param string $key The [Message.]key you are rendering in the view.
  * @param array $options Additional options to use for the creation of this flash message.
  *    Supports the 'params', and 'element' keys that are used in the helper.
  * @return string|null Rendered flash message or null if flash key does not exist
  *   in session.
  * @throws UnexpectedValueException If value for flash settings key is not an array.
  */
 public function render($key = 'flash', $options = array())
 {
     if (!CakeSession::check("Message.{$key}")) {
         return;
     }
     $flash = CakeSession::read("Message.{$key}");
     if (!is_array($flash)) {
         throw new UnexpectedValueException(sprintf('Value for flash setting key "%s" must be an array.', $key));
     }
     $flash = $options + $flash;
     CakeSession::delete("Message.{$key}");
     return $this->_View->element($flash['element'], $flash);
 }
开发者ID:hacksInc,项目名称:vw,代码行数:52,代码来源:FlashHelper.php

示例12: getSelectedRate

 public function getSelectedRate()
 {
     if (CakeSession::check('DrexCartOrder')) {
         $order = CakeSession::read('DrexCartOrder');
         if (isset($order['shipping_option'])) {
             foreach ($this->rates as $rate) {
                 if ($rate['code'] == $order['shipping_option']) {
                     return $rate;
                 }
             }
         }
     }
     return false;
 }
开发者ID:ashmilwaqas,项目名称:DrexCart,代码行数:14,代码来源:FlatRateModule.php

示例13: captcha

 public function captcha(Model $Model, $check)
 {
     $value = array_values($check);
     $value = $value[0];
     $field = key($check);
     if (CakeSession::check('captcha')) {
         $builder = new CaptchaBuilder();
         $builder->setPhrase(CakeSession::read('captcha'));
         if ($builder->testPhrase($value)) {
             return true;
         }
     }
     return false;
 }
开发者ID:rgnevashev,项目名称:captcha,代码行数:14,代码来源:CaptchaBehavior.php

示例14: processAction

 public function processAction(Model $model, $controller)
 {
     if (CakeSession::check('Auth.User') == false) {
         $controller->redirect($controller->Auth->loginAction);
     }
     $model->controller = $controller;
     $controller->autoRender = false;
     $params = $controller->request->params;
     $action = 'index';
     $plugin = $params['plugin'];
     if (!empty($params['pass'])) {
         $action = array_shift($params['pass']);
     }
     $model->action = $action;
     $controller->set('action', $action);
     $module = $controller->action;
     $model->beforeAction();
     $result = call_user_func_array(array($model, $action), $params['pass']);
     $model->afterAction();
     if (!is_null($plugin)) {
         //$name = $plugin . '/' . $name;
     }
     if ($model->render === 'auto') {
         if ($action == 'add' || $action == 'edit') {
             $controller->render('../Elements/templates/edit');
         } else {
             if ($action == 'view') {
                 $controller->render('../Elements/templates/view');
             }
         }
     } else {
         if ($model->render === true) {
             $controller->render($module . '/' . $action);
         } else {
             if ($model->render === 'override') {
                 $controller->render($model->render_override);
             } else {
                 if ($model->render !== false) {
                     $controller->render($module . '/' . $model->render);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:45,代码来源:ControllerActionBehavior.php

示例15: flash

 public function flash($key = 'flash', $attrs = array())
 {
     $out = false;
     if (CakeSession::check('Message.' . $key)) {
         $flash = CakeSession::read('Message.' . $key);
         $message = $flash['message'];
         unset($flash['message']);
         if (!empty($attrs)) {
             $flash = array_merge($flash, $attrs);
         }
         $tmpVars = $flash['params'];
         $tmpVars['message'] = $message;
         $tmpOptions = array('plugin' => 'TwitterBootstrap');
         $out = $this->_View->element('alert', $tmpVars, $tmpOptions);
         CakeSession::delete('Message.' . $key);
     }
     return $out;
 }
开发者ID:nojimage,项目名称:TwitterBootstrap,代码行数:18,代码来源:BootstrapSessionHelper.php


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