Helper.php in Session Proxy 7
File
lib/SessionProxy/Helper.php
View source
<?php
class SessionProxy_Helper {
private static $instance;
public static function getInstance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
public static function deleteSessionCookie($name, $force_insecure = FALSE) {
if (isset($_COOKIE[$name])) {
$params = session_get_cookie_params();
setcookie($name, '', REQUEST_TIME - 3600, $params['path'], $params['domain'], !$force_insecure && $params['secure'], $params['httponly']);
unset($_COOKIE[$name]);
}
}
protected $backend;
public function hasBackend() {
return isset($this->backend);
}
public function setBackend(SessionProxy_Backend_Interface $backend) {
if (isset($this->backend) && $this->backend
->isStarted()) {
throw new Exception("Cannot replace session backend at runtime.");
}
$this->backend = $backend;
}
public function getBackend() {
if (!isset($this->backend)) {
throw new Exception("No default implementation exists.");
}
return $this->backend;
}
}