コード例 #1
0
ファイル: Session.php プロジェクト: jorgenils/zend-framework
 /**
  * __construct() - This will create an instance that saves to/gets from an 
  * instantiated core.  An optional namespace allows for saving/getting
  * to isolated sections of the session.
  *
  * @param string $namespace
  */
 public function __construct($namespace = 'Default')
 {
     if (!is_string($namespace)) {
         throw new Zend_Session_Exception("Namespace must be a string.");
     }
     if ($namespace[0] == "_") {
         throw new Zend_Session_Exception("Namespace must not start with an underscore.");
     }
     $this->_namespace = $namespace;
     $this->_session_core = Zend_Session_Core::getInstance();
     $this->_session_core->_startNamespace($namespace);
 }
コード例 #2
0
ファイル: Session.php プロジェクト: jorgenils/zend-framework
 /**
  * __construct() - This will create an instance that saves to/gets from an
  * instantiated core.  An optional namespace allows for saving/getting
  * to isolated sections of the session.  An optional argument $singleInstance
  * will prevent any futured attempts of getting a Zend_Session object in the
  * same namespace that is provided.
  *
  * @param string $namespace       - programmatic name of the requested namespace
  * @param bool $singleInstance    - prevent creation of additional instances for this namespace
  * @param Zend_Session_Core $core - OPTIONAL instance of Zend_Session_Core, used only for testing purposes
  * @return void
  */
 public function __construct($namespace = 'Default', $singleInstance = false, Zend_Session_Core $core = null)
 {
     if ($namespace === '') {
         throw Zend::exception('Zend_Session_Exception', 'Session namespace must be a non-empty string.');
     }
     if ($namespace[0] == "_") {
         throw Zend::exception('Zend_Session_Exception', 'Session namespace must not start with an underscore.');
     }
     if (isset(self::$_singleInstances[$namespace])) {
         throw Zend::exception('Zend_Session_Exception', 'A session namespace "' . $namespace . '" already exists and has been set as the only instance of this namespace.');
     }
     if ($singleInstance === true) {
         self::$_singleInstances[$namespace] = true;
     }
     $this->_namespace = $namespace;
     $this->_sessionCore = $core ? $core : Zend_Session_Core::getInstance();
     $this->_sessionCore->_startNamespace($namespace);
 }