Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Abstract.php
Go to the documentation of this file.
1 <?php
2 
33 abstract class Zend_Session_Abstract
34 {
40  protected static $_writable = false;
41 
47  protected static $_readable = false;
48 
55  protected static $_expiringData = array();
56 
57 
62  const _THROW_NOT_WRITABLE_MSG = 'Zend_Session is currently marked as read-only.';
63 
64 
69  const _THROW_NOT_READABLE_MSG = 'Zend_Session is not marked as readable.';
70 
71 
79  protected static function _namespaceIsset($namespace, $name = null)
80  {
81  if (self::$_readable === false) {
85  #require_once 'Zend/Session/Exception.php';
86  throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
87  }
88 
89  if ($name === null) {
90  return ( isset($_SESSION[$namespace]) || isset(self::$_expiringData[$namespace]) );
91  } else {
92  return ( isset($_SESSION[$namespace][$name]) || isset(self::$_expiringData[$namespace][$name]) );
93  }
94  }
95 
96 
105  protected static function _namespaceUnset($namespace, $name = null)
106  {
107  if (self::$_writable === false) {
111  #require_once 'Zend/Session/Exception.php';
112  throw new Zend_Session_Exception(self::_THROW_NOT_WRITABLE_MSG);
113  }
114 
115  $name = (string) $name;
116 
117  // check to see if the api wanted to remove a var from a namespace or a namespace
118  if ($name === '') {
119  unset($_SESSION[$namespace]);
120  unset(self::$_expiringData[$namespace]);
121  } else {
122  unset($_SESSION[$namespace][$name]);
123  unset(self::$_expiringData[$namespace][$name]);
124  }
125 
126  // if we remove the last value, remove namespace.
127  if (empty($_SESSION[$namespace])) {
128  unset($_SESSION[$namespace]);
129  }
130  }
131 
132 
140  protected static function & _namespaceGet($namespace, $name = null)
141  {
142  if (self::$_readable === false) {
146  #require_once 'Zend/Session/Exception.php';
147  throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG);
148  }
149 
150  if ($name === null) {
151  if (isset($_SESSION[$namespace])) { // check session first for data requested
152  return $_SESSION[$namespace];
153  } elseif (isset(self::$_expiringData[$namespace])) { // check expiring data for data reqeusted
154  return self::$_expiringData[$namespace];
155  } else {
156  return $_SESSION[$namespace]; // satisfy return by reference
157  }
158  } else {
159  if (isset($_SESSION[$namespace][$name])) { // check session first
160  return $_SESSION[$namespace][$name];
161  } elseif (isset(self::$_expiringData[$namespace][$name])) { // check expiring data
162  return self::$_expiringData[$namespace][$name];
163  } else {
164  return $_SESSION[$namespace][$name]; // satisfy return by reference
165  }
166  }
167  }
168 
169 
177  protected static function _namespaceGetAll($namespace)
178  {
179  $currentData = (isset($_SESSION[$namespace]) && is_array($_SESSION[$namespace])) ?
180  $_SESSION[$namespace] : array();
181  $expiringData = (isset(self::$_expiringData[$namespace]) && is_array(self::$_expiringData[$namespace])) ?
182  self::$_expiringData[$namespace] : array();
183  return array_merge($currentData, $expiringData);
184  }
185 }
const _THROW_NOT_READABLE_MSG
Definition: Abstract.php:69
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
static _namespaceUnset($namespace, $name=null)
Definition: Abstract.php:105
static _namespaceIsset($namespace, $name=null)
Definition: Abstract.php:79
static & _namespaceGet($namespace, $name=null)
Definition: Abstract.php:140
static _namespaceGetAll($namespace)
Definition: Abstract.php:177
const _THROW_NOT_WRITABLE_MSG
Definition: Abstract.php:62
if(!isset($_GET['name'])) $name
Definition: log.php:14