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


PHP sfStorage::read方法代码示例

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


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

示例1: initialize

 /**
  * Initializes this sfUser.
  *
  * Available options:
  *
  *  * auto_shutdown:   Whether to automatically save the changes to the session (true by default)
  *  * culture:         The user culture
  *  * default_culture: The default user culture (en by default)
  *  * use_flash:       Whether to enable flash usage (false by default)
  *  * logging:         Whether to enable logging (false by default)
  *
  * @param sfEventDispatcher $dispatcher  An sfEventDispatcher instance.
  * @param sfStorage         $storage     An sfStorage instance.
  * @param array             $options     An associative array of options.
  *
  * @return Boolean          true, if initialization completes successfully, otherwise false.
  */
 public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
 {
     $this->dispatcher = $dispatcher;
     $this->storage = $storage;
     $this->options = array_merge(array('auto_shutdown' => true, 'culture' => null, 'default_culture' => 'en', 'use_flash' => false, 'logging' => false), $options);
     $this->attributeHolder = new sfNamespacedParameterHolder(self::ATTRIBUTE_NAMESPACE);
     // read attributes from storage
     $attributes = $storage->read(self::ATTRIBUTE_NAMESPACE);
     if (is_array($attributes)) {
         foreach ($attributes as $namespace => $values) {
             $this->attributeHolder->add($values, $namespace);
         }
     }
     // set the user culture to sf_culture parameter if present in the request
     // otherwise
     //  - use the culture defined in the user session
     //  - use the default culture set in settings.yml
     $currentCulture = $storage->read(self::CULTURE_NAMESPACE);
     $this->setCulture(null !== $this->options['culture'] ? $this->options['culture'] : (null !== $currentCulture ? $currentCulture : $this->options['default_culture']));
     // flag current flash to be removed at shutdown
     if ($this->options['use_flash'] && ($names = $this->attributeHolder->getNames('symfony/user/sfUser/flash'))) {
         if ($this->options['logging']) {
             $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Flag old flash messages ("%s")', implode('", "', $names)))));
         }
         foreach ($names as $name) {
             $this->attributeHolder->set($name, true, 'symfony/user/sfUser/flash/remove');
         }
     }
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:46,代码来源:sfUser.class.php

示例2: initialize

 public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
 {
     $this->dispatcher = $dispatcher;
     $this->storage = $storage;
     $this->options = array_merge(array('auto_shutdown' => true, 'culture' => null, 'default_culture' => 'en', 'use_flash' => false, 'logging' => false), $options);
     $this->attributeHolder = new sfNamespacedParameterHolder(self::ATTRIBUTE_NAMESPACE);
     $attributes = $storage->read(self::ATTRIBUTE_NAMESPACE);
     if (is_array($attributes)) {
         foreach ($attributes as $namespace => $values) {
             $this->attributeHolder->add($values, $namespace);
         }
     }
     $currentCulture = $storage->read(self::CULTURE_NAMESPACE);
     $this->setCulture(!is_null($this->options['culture']) ? $this->options['culture'] : (!is_null($currentCulture) ? $currentCulture : $this->options['default_culture']));
     if ($this->options['use_flash'] && ($names = $this->attributeHolder->getNames('symfony/user/sfUser/flash'))) {
         if ($this->options['logging']) {
             $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Flag old flash messages ("%s")', implode('", "', $names)))));
         }
         foreach ($names as $name) {
             $this->attributeHolder->set($name, true, 'symfony/user/sfUser/flash/remove');
         }
     }
 }
开发者ID:BGCX261,项目名称:zoorestaurant-svn-to-git,代码行数:23,代码来源:config_core_compile.yml.php


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