Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/smart-sl.../Nextend/Framewor.../Session
File: AbstractStorage.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Nextend\Framework\Session;
[2] Fix | Delete
[3] Fix | Delete
use Nextend\Framework\Plugin;
[4] Fix | Delete
use Nextend\Framework\Request\Request;
[5] Fix | Delete
[6] Fix | Delete
abstract class AbstractStorage {
[7] Fix | Delete
[8] Fix | Delete
protected static $expire = 86400; // 1 day
[9] Fix | Delete
[10] Fix | Delete
protected static $salt = 'nextendSalt';
[11] Fix | Delete
[12] Fix | Delete
protected $hash;
[13] Fix | Delete
[14] Fix | Delete
protected $storage = array();
[15] Fix | Delete
[16] Fix | Delete
public $storageChanged = false;
[17] Fix | Delete
[18] Fix | Delete
public function __construct($userIdentifier) {
[19] Fix | Delete
[20] Fix | Delete
$this->register();
[21] Fix | Delete
$cookie = Request::$COOKIE->getCmd('nextendsession');
[22] Fix | Delete
if ($cookie === '' || substr($cookie, 0, 2) != 'n2' || !preg_match('/^[a-f0-9]{32}$/', substr($cookie, 2))) {
[23] Fix | Delete
$this->hash = 'n2' . md5(self::$salt . $userIdentifier);
[24] Fix | Delete
setcookie('nextendsession', $this->hash, time() + self::$expire, Request::$SERVER->getVar('HTTP_HOST'));
[25] Fix | Delete
Request::$COOKIE->set('nextendsession', $this->hash);
[26] Fix | Delete
} else {
[27] Fix | Delete
$this->hash = $cookie;
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
$this->load();
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Load the whole session
[35] Fix | Delete
* $this->storage = json_decode(result for $this->hash);
[36] Fix | Delete
*/
[37] Fix | Delete
protected abstract function load();
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Store the whole session
[41] Fix | Delete
* $this->hash json_encode($this->storage);
[42] Fix | Delete
*/
[43] Fix | Delete
protected abstract function store();
[44] Fix | Delete
[45] Fix | Delete
public function get($key, $default = '') {
[46] Fix | Delete
return isset($this->storage[$key]) ? $this->storage[$key] : $default;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
public function set($key, $value) {
[50] Fix | Delete
$this->storageChanged = true;
[51] Fix | Delete
[52] Fix | Delete
$this->storage[$key] = $value;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
public function delete($key) {
[56] Fix | Delete
$this->storageChanged = true;
[57] Fix | Delete
unset($this->storage[$key]);
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Register our method for PHP shut down
[62] Fix | Delete
*/
[63] Fix | Delete
protected function register() {
[64] Fix | Delete
Plugin::addAction('exit', array(
[65] Fix | Delete
$this,
[66] Fix | Delete
'shutdown'
[67] Fix | Delete
));
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* When PHP shuts down, we have to save our session's data if the data changed
[72] Fix | Delete
*/
[73] Fix | Delete
public function shutdown() {
[74] Fix | Delete
Plugin::doAction('beforeSessionSave');
[75] Fix | Delete
if ($this->storageChanged) {
[76] Fix | Delete
$this->store();
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function