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


PHP sfSessionStorage::initialize方法代码示例

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


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

示例1: initialize

 public function initialize($options = null)
 {
     if (session_id() != '') {
         self::$sessionStarted = true;
     }
     parent::initialize($options);
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:7,代码来源:dmSessionStorage.class.php

示例2: initialize

  /**
   * Available options:
   *
   *   * db_table:    The database table in which session data will be stored
   *   * database:    The sfDatabase object to use
   *   * db_id_col:   The database column in which the session id will be stored (sess_id by default)
   *   * db_data_col: The database column in which the session data will be stored (sess_data by default)
   *   * db_time_col: The database column in which the session timestamp will be stored (sess_time by default)
   *
   * @param  array $options  An associative array of options
   *
   * @see sfSessionStorage
   */
  public function initialize($options = array())
  {
    $options = array_merge(array(
      'db_id_col'   => 'sess_id',
      'db_data_col' => 'sess_data',
      'db_time_col' => 'sess_time',
    ), $options);

    // disable auto_start
    $options['auto_start'] = false;

    // initialize the parent
    parent::initialize($options);

    if (!isset($this->options['db_table']))
    {
      throw new sfInitializationException('You must provide a "db_table" option to sfDatabaseSessionStorage.');
    }

    if (!isset($this->options['database']))
    {
      throw new sfInitializationException('You must provide a "database" option to sfDatabaseSessionStorage.');
    }

    // use this object as the session handler
    session_set_save_handler(array($this, 'sessionOpen'),
                             array($this, 'sessionClose'),
                             array($this, 'sessionRead'),
                             array($this, 'sessionWrite'),
                             array($this, 'sessionDestroy'),
                             array($this, 'sessionGC'));

    // start our session
    session_start();
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:48,代码来源:sfDatabaseSessionStorage.class.php

示例3: initialize

 /**
  * Available options:
  *
  *  * session_name:            The cookie name (symfony by default)
  *  * session_id:              The session id (null by default)
  *  * auto_start:              Whether to start the session (true by default)
  *  * session_cookie_lifetime: Cookie lifetime
  *  * session_cookie_path:     Cookie path
  *  * session_cookie_domain:   Cookie domain
  *  * session_cookie_secure:   Cookie secure
  *  * session_cookie_httponly: Cookie http only (only for PHP >= 5.2)
  *
  * The default values for all 'session_cookie_*' options are those returned by the session_get_cookie_params() function
  *
  * @param array $options  An associative array of options
  *
  * @see sfStorage
  */
 public function initialize($options = null)
 {
     //@todo: for photo upload make care about secure
     if ($sessionId = $options['session_id']) {
         session_id($sessionId);
     }
     parent::initialize($options);
     //        print_r($_SESSION);
 }
开发者ID:limitium,项目名称:uberlov,代码行数:27,代码来源:sfHtSessionStorage.class.php

示例4: getFavorites

 /**
  * @return ArrayObject
  */
 public static function getFavorites()
 {
     $session = new sfSessionStorage();
     if ($session->read('favorites') === null) {
         $session->initialize(array('session_cookie_lifetime' => 2592000));
         $session->write('favorites', new ArrayObject(array()));
     }
     return $session->read('favorites');
 }
开发者ID:HHirano,项目名称:TEST100,代码行数:12,代码来源:Utils.php

示例5: initialize

 public function initialize($options = null)
 {
     // http://trac.symfony-project.org/ticket/5683
     if (!isset($options['session_cookie_path'])) {
         $options['session_cookie_path'] = sfContext::getInstance()->request->getRelativeUrlRoot();
         if (1 > strlen($options['session_cookie_path'])) {
             $options['session_cookie_path'] = '/';
         }
     }
     parent::initialize($options);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:11,代码来源:QubitSessionStorage.class.php

示例6: initialize

 /**
  * @return null
  */
 public function initialize($options = null)
 {
     if (sfJpMobile::isMobile()) {
         ini_set("session.use_trans_sid", 1);
         ini_set("session.use_cookies", 0);
         ini_set("session.use_only_cookies", 0);
     } else {
         ini_set("session.use_trans_sid", 0);
         ini_set("session.use_cookies", 1);
     }
     parent::initialize($options);
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:15,代码来源:sfJpMobileSessionStorage.class.php

示例7: initialize

 public function initialize($options = null)
 {
     $request = sfContext::getInstance()->getRequest();
     // work-around for uploadify
     if ($request->getParameter('uploadify') == "onUpload") {
         $sessionName = $options["session_name"];
         if ($value = $request->getParameter($sessionName)) {
             session_name($sessionName);
             session_id($value);
         }
     }
     parent::initialize($options);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:13,代码来源:qdPMSessionStorage.php

示例8: initialize

 public function initialize($options = null)
 {
     if ($this->transSidFor(sfContext::getInstance()->getRequest())) {
         $sessionName = isset($options['session_name']) ? $options['session_name'] : 'symfony';
         if ($value = sfContext::getInstance()->getRequest()->getParameter($sessionName)) {
             if (sfConfig::get('sf_logging_enabled')) {
                 sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Changing session name "%s" to "%s"', $sessionName, $value))));
             }
             session_name($sessionName);
             session_id($value);
         }
     }
     parent::initialize($options);
 }
开发者ID:ner0tic,项目名称:ddWidgetFormInputUploadify,代码行数:14,代码来源:ddSessionStorageUploadify.class.php

示例9: initialize

 public function initialize($parameters = null)
 {
     //Shitty work-around for swfuploader
     $context = sfContext::getInstance();
     $request = sfContext::getInstance()->getRequest();
     if ($request->getParameter('action') == "swfupload") {
         $sessionName = $parameters["session_name"];
         if ($value = $context->getRequest()->getParameter($sessionName)) {
             session_name($sessionName);
             session_id($value);
         }
     }
     parent::initialize($parameters);
 }
开发者ID:vcgato29,项目名称:poff,代码行数:14,代码来源:MySessionStorage.php

示例10: initialize

 public function initialize($options = null)
 {
     $context = sfContext::getInstance();
     $sessionName = $options["session_name"];
     if ($value = $context->getRequest()->getParameter($sessionName)) {
         session_name($sessionName);
         session_id($value);
     }
     if (isset($options['session_cookie_domain']) && '.' == $options['session_cookie_domain']) {
         preg_match('/([^.]+\\.[^.]+)$/', $_SERVER['SERVER_NAME'], $matches);
         $options['session_cookie_domain'] = '.' . $matches[1];
     }
     parent::initialize($options);
 }
开发者ID:pycmam,项目名称:myImageUploadPlugin,代码行数:14,代码来源:myImageUploadSessionStorage.class.php

示例11: initialize

 /**
  * Available options:
  *
  * - host:       The default host (default to localhost)
  * - port:       The port for the default server (default to 11211)
  * - persistent: true if the connection must be persistent, false otherwise (true by default)
  *
  * @param  array $options  An associative array of options
  *
  * @see sfSessionStorage
  * @see sfMemcacheCache
  */
 public function initialize($options = array())
 {
     // disable auto_start
     $options['auto_start'] = false;
     // initialize the parent
     parent::initialize($options);
     if (!class_exists('Memcache')) {
         throw new sfInitializationException('You must have memcache installed and enabled to use sfMemcacheCache class.');
     }
     $this->memcache = new Memcache();
     // use this object as the session handler
     session_set_save_handler(array($this, 'sessionOpen'), array($this, 'sessionClose'), array($this, 'sessionRead'), array($this, 'sessionWrite'), array($this, 'sessionDestroy'), array($this, 'sessionGC'));
     // start our session
     session_start();
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:27,代码来源:opMemcacheSessionStorage.class.php

示例12: initialize

 /**
  * Initializes this Storage instance.
  *
  * @param sfContext A sfContext instance
  * @param array     An associative array of initialization parameters
  *
  * @return boolean true, if initialization completes successfully, otherwise false
  *
  * @throws <b>InitializationException</b> If an error occurs while initializing this Storage
  */
 public function initialize($context, $parameters = null)
 {
     // disable auto_start
     $parameters['auto_start'] = false;
     // initialize the parent
     parent::initialize($context, $parameters);
     if (!$this->getParameterHolder()->has('db_table')) {
         // missing required 'db_table' parameter
         $error = 'Factory configuration file is missing required "db_table" parameter for the Storage category';
         throw new sfInitializationException($error);
     }
     // use this object as the session handler
     session_set_save_handler(array($this, 'sessionOpen'), array($this, 'sessionClose'), array($this, 'sessionRead'), array($this, 'sessionWrite'), array($this, 'sessionDestroy'), array($this, 'sessionGC'));
     // start our session
     session_start();
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:26,代码来源:sfPDOSessionStorage.class.php

示例13: initialize

 public function initialize($options = null)
 {
     $auto_start = !is_array($options) || !array_key_exists('auto_start', $options) || $options['auto_start'] != false;
     $session_name = is_array($options) && array_key_exists('session_name', $options) ? $options['session_name'] : 'symfony';
     $delay_auto_start = false;
     if ($auto_start && empty($_COOKIE[$session_name])) {
         if (!is_array($options)) {
             $options = array();
         }
         $options['auto_start'] = false;
         $delay_auto_start = true;
     }
     parent::initialize($options);
     if ($delay_auto_start) {
         $this->options['auto_start'] = true;
     }
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:17,代码来源:policatSessionStorage.class.php

示例14: initialize

 public function initialize($context, $parameters = null)
 {
     parent::initialize($context, $parameters);
     // UserAgent取得
     $agent = new Net_UserAgent_Mobile();
     //$agent = $this->getContext()->getRequest()->getAttribute('userAgent');
     if ($agent->isDoCoMo()) {
         ini_set("session.use_trans_sid", 1);
         ini_set("session.use_cookies", 0);
     } else {
         if ($agent->isSoftBank()) {
             ini_set("session.use_trans_sid", 0);
             ini_set("session.use_cookies", 1);
         } else {
             if ($agent->isEZweb()) {
                 ini_set("session.use_trans_sid", 0);
                 ini_set("session.use_cookies", 1);
             }
         }
     }
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:21,代码来源:mobileSessionStorage.class.php


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