10 defined(
'JPATH_PLATFORM') or die;
27 protected static $instances = array();
36 public function __construct($options = array())
38 $this->
register($options);
51 public static function getInstance($name =
'none', $options = array())
55 if (empty(self::$instances[$name]))
57 $class =
'JSessionStorage' . ucfirst($name);
59 if (!class_exists($class))
61 $path = __DIR__ .
'/storage/' . $name .
'.php';
63 if (file_exists($path))
70 jexit(
'Unable to load session storage class: ' . $name);
74 self::$instances[$name] =
new $class($options);
77 return self::$instances[$name];
87 public function register()
90 session_set_save_handler(
91 array($this,
'open'), array($this,
'close'), array($this,
'read'), array($this,
'write'),
92 array($this,
'destroy'), array($this,
'gc')
106 public function open($save_path, $session_name)
118 public function close()
133 public function read($id)
148 public function write($id, $session_data)
163 public function destroy($id)
177 public function gc($maxlifetime = null)
189 public static function isSupported()
202 public static function test()
204 JLog::add(
'JSessionStorage::test() is deprecated. Use JSessionStorage::isSupported() instead.',
JLog::WARNING,
'deprecated');
206 return static::isSupported();