A [NpGOUB *:X UxC TryAUpD jտ+@UhE o/)6"U`F esUXG >Aʑ0"UPH wOSUHI iZRz`"U@J aF"D$U8K QS(%U0L Nwh$U(M CjS0$U8T jNi\U0U !~ҙ5.U(V Q֔/U W 0/UX 0woUY F2֏2UZ gM.U[ Tu H2U2,1,1,@()@%GUP?GU`?U cnU0nUIafUDZU`GtUPt0U<aUpUpp}UPPB`xU<aUU`+4^U>rU@* U E U(E UPt U`t Upt`xU <(SU 0GtU0Pt0U<LXUP>//.-֋U.kU(U'U /p/'OU// PU..0.AU3//^U@5.5. U@zE UPPztĝUPziUP`zGUfU`zHtU``zt Upzt Uzt0Uz< U{E UP{tĝU{iU{GUfUP{HtU`{t U p{t0U{< U|E UP|tĝU|iU|GUfU|HtU`|t Up|t0U|<LXUP~>11xHU1@\U @11xHUHPU311xHUIUP3@ U=/NU0&@U8#@U UUpQUt_U UE UPt`xU`<EoU``p.UcoUp4gUp`+UPrU@*U aUP UE UPtUcnUlUPnUtU`t Upt Ut0U<LXU`>]9^9@/@U@mIUtoken. * * @since 4.0.0 * * @param string $token Session token to update. * @param array $session Session information. */ final public function update( $token, $session ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, $session ); } /** * Destroys the session with the given token. * * @since 4.0.0 * * @param string $token Session token to destroy. */ final public function destroy( $token ) { $verifier = $this->hash_token( $token ); $this->update_session( $verifier, null ); } /** * Destroys all sessions for this user except the one with the given token (presumably the one in use). * * @since 4.0.0 * * @param string $token_to_keep Session token to keep. */ final public function destroy_others( $token_to_keep ) { $verifier = $this->hash_token( $token_to_keep ); $session = $this->get_session( $verifier ); if ( $session ) { $this->destroy_other_sessions( $verifier ); } else { $this->destroy_all_sessions(); } } /** * Determines whether a session is still valid, based on its expiration timestamp. * * @since 4.0.0 * * @param array $session Session to check. * @return bool Whether session is valid. */ final protected function is_still_valid( $session ) { return $session['expiration'] >= time(); } /** * Destroys all sessions for a user. * * @since 4.0.0 */ final public function destroy_all() { $this->destroy_all_sessions(); } /** * Destroys all sessions for all users. * * @since 4.0.0 */ final public static function destroy_all_for_all_users() { /** This filter is documented in wp-includes/class-wp-session-tokens.php */ $manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' ); call_user_func( array( $manager, 'drop_sessions' ) ); } /** * Retrieves all sessions for a user. * * @since 4.0.0 * * @return array Sessions for a user. */ final public function get_all() { return array_values( $this->get_sessions() ); } /** * Retrieves all sessions of the user. * * @since 4.0.0 * * @return array Sessions of the user. */ abstract protected function get_sessions(); /** * Retrieves a session based on its verifier (token hash). * * @since 4.0.0 * * @param string $verifier Verifier for the session to retrieve. * @return array|null The session, or null if it does not exist. */ abstract protected function get_session( $verifier ); /** * Updates a session based on its verifier (token hash). * * Omitting the second argument destroys the session. * * @since 4.0.0 * * @param string $verifier Verifier for the session to update. * @param array $session Optional. Session. Omitting this argument destroys the session. */ abstract protected function update_session( $verifier, $session = null ); /** * Destroys all sessions for this user, except the single session with the given verifier. * * @since 4.0.0 * * @param string $verifier Verifier of the session to keep. */ abstract protected function destroy_other_sessions( $verifier ); /** * Destroys all sessions for the user. * * @since 4.0.0 */ abstract protected function destroy_all_sessions(); /** * Destroys all sessions for all users. * * @since 4.0.0 */ public static function drop_sessions() {} }