Definition at line 44 of file Namespace.php.
◆ __construct()
__construct |
( |
|
$namespace = 'Default' , |
|
|
|
$singleInstance = false |
|
) |
| |
__construct() - Returns an instance object bound to a particular, isolated section of the session, identified by $namespace name (defaulting to 'Default'). The optional argument $singleInstance will prevent construction of additional instance objects acting as accessors to this $namespace.
- Parameters
-
string | $namespace | - programmatic name of the requested namespace |
bool | $singleInstance | - prevent creation of additional accessor instance objects for this namespace |
- Returns
- void
- See also
- Zend_Session_Exception
-
Zend_Session_Exception
-
Zend_Session_Exception
-
Zend_Session_Exception
-
Zend_Session_Exception
Definition at line 102 of file Namespace.php.
104 if ($namespace ===
'') {
108 #require_once 'Zend/Session/Exception.php'; 112 if ($namespace[0] ==
"_") {
116 #require_once 'Zend/Session/Exception.php'; 120 if (preg_match(
'#(^[0-9])#i', $namespace[0])) {
124 #require_once 'Zend/Session/Exception.php'; 128 if (isset(self::$_singleInstances[$namespace])) {
132 #require_once 'Zend/Session/Exception.php'; 133 throw new Zend_Session_Exception(
"A session namespace object already exists for this namespace ('$namespace'), and no additional accessors (session namespace objects) for this namespace are permitted.");
136 if ($singleInstance ===
true) {
137 self::$_singleInstances[$namespace] =
true;
140 $this->_namespace = $namespace;
145 if (self::$_readable ===
false) {
149 #require_once 'Zend/Session/Exception.php'; 153 if (!isset($_SESSION[
'__ZF'])) {
158 if (parent::$_writable ===
true) {
159 if (isset($_SESSION[
'__ZF'][$namespace])) {
162 if (isset($_SESSION[
'__ZF'][$namespace][
'ENNH'])) {
163 $_SESSION[
'__ZF'][$namespace][
'ENNH']--;
165 if ($_SESSION[
'__ZF'][$namespace][
'ENNH'] === 0) {
166 if (isset($_SESSION[$namespace])) {
167 self::$_expiringData[$namespace] = $_SESSION[$namespace];
168 unset($_SESSION[$namespace]);
170 unset($_SESSION[
'__ZF'][$namespace]);
175 if (isset($_SESSION[
'__ZF'][$namespace][
'ENVNH'])) {
176 foreach ($_SESSION[
'__ZF'][$namespace][
'ENVNH'] as
$variable => $hops) {
177 $_SESSION[
'__ZF'][$namespace][
'ENVNH'][
$variable]--;
179 if ($_SESSION[
'__ZF'][$namespace][
'ENVNH'][
$variable] === 0) {
180 if (isset($_SESSION[$namespace][
$variable])) {
184 unset($_SESSION[
'__ZF'][$namespace][
'ENVNH'][
$variable]);
187 if(empty($_SESSION[
'__ZF'][$namespace][
'ENVNH'])) {
188 unset($_SESSION[
'__ZF'][$namespace][
'ENVNH']);
193 if (empty($_SESSION[
'__ZF'][$namespace])) {
194 unset($_SESSION[
'__ZF'][$namespace]);
197 if (empty($_SESSION[
'__ZF'])) {
198 unset($_SESSION[
'__ZF']);
static start($options=false)
◆ __get()
__get() - method to get a variable in this object's current namespace
- Parameters
-
string | $name | - programmatic name of a key, in a <key,value> pair in the current namespace |
- Returns
- mixed
- See also
- Zend_Session_Exception
Definition at line 277 of file Namespace.php.
283 #require_once 'Zend/Session/Exception.php'; 287 return parent::_namespaceGet($this->_namespace,
$name);
if(!isset($_GET['name'])) $name
◆ __isset()
__isset() - determine if a variable in this object's namespace is set
- Parameters
-
string | $name | - programmatic name of a key, in a <key,value> pair in the current namespace |
- Returns
- bool
- See also
- Zend_Session_Exception
Definition at line 384 of file Namespace.php.
390 #require_once 'Zend/Session/Exception.php'; 394 return parent::_namespaceIsset($this->_namespace,
$name);
if(!isset($_GET['name'])) $name
◆ __set()
__set() - method to set a variable/value in this object's namespace
- Parameters
-
string | $name | - programmatic name of a key, in a <key,value> pair in the current namespace |
mixed | $value | - value in the <key,value> pair to assign to the $name key |
- Exceptions
-
- Returns
- true
- See also
- Zend_Session_Exception
-
Zend_Session_Exception
-
Zend_Session_Exception
Definition at line 299 of file Namespace.php.
301 if (isset(self::$_namespaceLocks[$this->_namespace])) {
305 #require_once 'Zend/Session/Exception.php'; 313 #require_once 'Zend/Session/Exception.php'; 317 if (parent::$_writable ===
false) {
321 #require_once 'Zend/Session/Exception.php';
if(!isset($_GET['name'])) $name
◆ __unset()
__unset() - unset a variable in this object's namespace.
- Parameters
-
string | $name | - programmatic name of a key, in a <key,value> pair in the current namespace |
- Returns
- true
- See also
- Zend_Session_Exception
Definition at line 404 of file Namespace.php.
410 #require_once 'Zend/Session/Exception.php'; 414 return parent::_namespaceUnset($this->_namespace,
$name);
if(!isset($_GET['name'])) $name
◆ apply()
apply() - enables applying user-selected function, such as array_merge() to the namespace Parameters following the $callback argument are passed to the callback function. Caveat: ignores members expiring now.
Example: $namespace->apply('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose')); $namespace->apply('count');
- Parameters
-
string | array | $callback | - callback function |
Definition at line 342 of file Namespace.php.
344 $arg_list = func_get_args();
346 return call_user_func_array($callback, $arg_list);
◆ applySet()
applySet() - enables applying user-selected function, and sets entire namespace to the result Result of $callback must be an array. Parameters following the $callback argument are passed to the callback function. Caveat: ignores members expiring now.
Example: $namespace->applySet('array_merge', array('tree' => 'apple', 'fruit' => 'peach'), array('flower' => 'rose'));
- Parameters
-
string | array | $callback | - callback function |
- See also
- Zend_Session_Exception
Definition at line 361 of file Namespace.php.
363 $arg_list = func_get_args();
365 $result = call_user_func_array($callback, $arg_list);
370 #require_once 'Zend/Session/Exception.php';
◆ getIterator()
getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
- Returns
- ArrayObject - iteratable container of the namespace contents
Definition at line 210 of file Namespace.php.
212 return new ArrayObject(parent::_namespaceGetAll($this->_namespace));
◆ getNamespace()
Returns the namespace name
- Returns
- string
Definition at line 525 of file Namespace.php.
◆ isLocked()
isLocked() - return lock status, true if, and only if, read-only
- Returns
- bool
Definition at line 254 of file Namespace.php.
256 return isset(self::$_namespaceLocks[$this->_namespace]);
◆ lock()
◆ resetSingleInstance()
static resetSingleInstance |
( |
|
$namespaceName = null | ) |
|
|
static |
resetSingleInstance()
- Parameters
-
- Returns
- null
Definition at line 79 of file Namespace.php.
81 if ($namespaceName !=
null) {
82 if (array_key_exists($namespaceName, self::$_singleInstances)) {
83 unset(self::$_singleInstances[$namespaceName]);
88 self::$_singleInstances = array();
◆ setExpirationHops()
setExpirationHops |
( |
|
$hops, |
|
|
|
$variables = null , |
|
|
|
$hopCountOnUsageOnly = false |
|
) |
| |
setExpirationHops() - expire the namespace, or specific variables after a specified number of page hops
- Parameters
-
int | $hops | - how many "hops" (number of subsequent requests) before expiring |
mixed | $variables | - OPTIONAL list of variables to expire (defaults to all) |
boolean | $hopCountOnUsageOnly | - OPTIONAL if set, only count a hop/request if this namespace is used |
- Exceptions
-
- Returns
- void
- See also
- Zend_Session_Exception
-
Zend_Session_Exception
Definition at line 475 of file Namespace.php.
477 if (parent::$_writable ===
false) {
481 #require_once 'Zend/Session/Exception.php'; 489 #require_once 'Zend/Session/Exception.php'; 493 if ($variables ===
null) {
496 if ($hopCountOnUsageOnly ===
false) {
504 if (is_string($variables)) {
505 $variables = array($variables);
510 if ($hopCountOnUsageOnly ===
false) {
◆ setExpirationSeconds()
setExpirationSeconds |
( |
|
$seconds, |
|
|
|
$variables = null |
|
) |
| |
setExpirationSeconds() - expire the namespace, or specific variables after a specified number of seconds
- Parameters
-
int | $seconds | - expires in this many seconds |
mixed | $variables | - OPTIONAL list of variables to expire (defaults to all) |
- Exceptions
-
- Returns
- void
- See also
- Zend_Session_Exception
-
Zend_Session_Exception
Definition at line 427 of file Namespace.php.
429 if (parent::$_writable ===
false) {
433 #require_once 'Zend/Session/Exception.php'; 441 #require_once 'Zend/Session/Exception.php'; 445 if ($variables ===
null) {
452 if (is_string($variables)) {
453 $variables = array($variables);
◆ unlock()
unlock() - unmark a session/namespace to enable read & write
- Returns
- void
Definition at line 232 of file Namespace.php.
234 unset(self::$_namespaceLocks[$this->_namespace]);
◆ unlockAll()
unlockAll() - unmark all session/namespaces to enable read & write
- Returns
- void
Definition at line 243 of file Namespace.php.
245 self::$_namespaceLocks = array();
◆ unsetAll()
unsetAll() - unset all variables in this namespace
- Returns
- true
Definition at line 265 of file Namespace.php.
267 return parent::_namespaceUnset($this->_namespace);
◆ $_namespace
◆ $_namespaceLocks
$_namespaceLocks = array() |
|
staticprotected |
◆ $_singleInstances
$_singleInstances = array() |
|
staticprotected |
◆ SINGLE_INSTANCE
const SINGLE_INSTANCE = true |
used as option to constructor to prevent additional instances to the same namespace
Definition at line 50 of file Namespace.php.
The documentation for this class was generated from the following file: