Server IP : 14.241.111.210 / Your IP : 13.58.156.237 Web Server : Apache System : Linux localhost.localdomain 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 User : www ( 1001) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/ohapaint.vn/wp-content/plugins/nextend-facebook-connect/NSL/Persistent/ |
Upload File : |
<?php namespace NSL\Persistent; use NSL\Persistent\Storage\Session; use NSL\Persistent\Storage\StorageAbstract; use NSL\Persistent\Storage\Transient; use WP_User; require_once dirname(__FILE__) . '/Storage/Abstract.php'; require_once dirname(__FILE__) . '/Storage/Session.php'; require_once dirname(__FILE__) . '/Storage/Transient.php'; class Persistent { private static $instance; /** @var StorageAbstract */ private $storage; public function __construct() { self::$instance = $this; add_action('init', array( $this, 'init' ), 0); add_action('wp_login', array( $this, 'transferSessionToUser' ), 10, 2); } public function init() { if ($this->storage === NULL) { if (is_user_logged_in()) { $this->storage = new Transient(); } else { $this->storage = new Session(); } } } public static function set($key, $value) { if (self::$instance->storage) { self::$instance->storage->set($key, $value); } } public static function get($key) { if (self::$instance->storage) { return self::$instance->storage->get($key); } return false; } public static function delete($key) { if (self::$instance->storage) { self::$instance->storage->delete($key); } } /** * @param $user_login * @param WP_User $user */ public function transferSessionToUser($user_login, $user = null) { if (!$user) { // For do_action( 'wp_login' ) calls that lacked passing the 2nd arg. $user = get_user_by('login', $user_login); } $newStorage = new Transient($user->ID); /** * $this->storage might be NULL if init action not called yet */ if ($this->storage !== NULL) { $newStorage->transferData($this->storage); } $this->storage = $newStorage; } public static function clear() { if (self::$instance->storage) { self::$instance->storage->clear(); } } } new Persistent();