Changeset 43643 for trunk/src/wp-includes/class-wp-session-tokens.php
- Timestamp:
- 09/14/2018 01:44:50 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-session-tokens.php
r42746 r43643 24 24 25 25 /** 26 * Protected constructor. 26 * Protected constructor. Use the `get_instance()` method to get the instance. 27 27 * 28 28 * @since 4.0.0 … … 35 35 36 36 /** 37 * Retrieves a session tokenmanager instance for a user.37 * Retrieves a session manager instance for a user. 38 38 * 39 39 * This method contains a {@see 'session_token_manager'} filter, allowing a plugin to swap out … … 43 43 * 44 44 * @param int $user_id User whose session to manage. 45 * @return WP_User_Meta_Session_Tokens WP_User_Meta_Session_Tokens class instance by default. 45 * @return WP_Session_Tokens The session object, which is by default an instance of 46 * the `WP_User_Meta_Session_Tokens` class. 46 47 */ 47 48 final public static function get_instance( $user_id ) { 48 49 /** 49 * Filters the session token manager used.50 * Filters the class name for the session token manager. 50 51 * 51 52 * @since 4.0.0 … … 59 60 60 61 /** 61 * Hashes asession token for storage.62 * Hashes the given session token for storage. 62 63 * 63 64 * @since 4.0.0 … … 76 77 77 78 /** 78 * Get a user's session.79 * 80 * @since 4.0.0 81 * 82 * @param string $token Session token 83 * @return array User session79 * Retrieves a user's session for the given token. 80 * 81 * @since 4.0.0 82 * 83 * @param string $token Session token. 84 * @return array|null The session, or null if it does not exist. 84 85 */ 85 86 final public function get( $token ) { … … 89 90 90 91 /** 91 * Validate a user's session token as authentic.92 * Validates the given session token for authenticity and validity. 92 93 * 93 94 * Checks that the given token is present and hasn't expired. … … 104 105 105 106 /** 106 * Generate a session token and attachsession information to it.107 * Generates a session token and attaches session information to it. 107 108 * 108 109 * A session token is a long, random string. It is used in a cookie 109 * link that cookie to an expiration time and to ensure the cookie110 * becomes invalidated upon logout.110 * to link that cookie to an expiration time and to ensure the cookie 111 * becomes invalidated when the user logs out. 111 112 * 112 113 * This function generates a token and stores it with the associated … … 123 124 * Filters the information attached to the newly created session. 124 125 * 125 * Could be used in the future to attach information such as 126 * IP address or user agent to a session. 126 * Can be used to attach further information to a session. 127 127 * 128 128 * @since 4.0.0 … … 155 155 156 156 /** 157 * Update a session token.157 * Updates the data for the session with the given token. 158 158 * 159 159 * @since 4.0.0 … … 168 168 169 169 /** 170 * Destroy a session token.170 * Destroys the session with the given token. 171 171 * 172 172 * @since 4.0.0 … … 180 180 181 181 /** 182 * Destroy all session tokens for this user, 183 * except a single token, presumably the one in use. 182 * Destroys all sessions for this user except the one with the given token (presumably the one in use). 184 183 * 185 184 * @since 4.0.0 … … 198 197 199 198 /** 200 * Determine whether a session token is still valid, 201 * based on expiration. 199 * Determines whether a session is still valid, based on its expiration timestamp. 202 200 * 203 201 * @since 4.0.0 … … 211 209 212 210 /** 213 * Destroy all session tokens for a user.211 * Destroys all sessions for a user. 214 212 * 215 213 * @since 4.0.0 … … 220 218 221 219 /** 222 * Destroy all session tokens for all users.220 * Destroys all sessions for all users. 223 221 * 224 222 * @since 4.0.0 … … 231 229 232 230 /** 233 * Retrieve all sessions ofa user.234 * 235 * @since 4.0.0 236 * 237 * @return array Sessions ofa user.231 * Retrieves all sessions for a user. 232 * 233 * @since 4.0.0 234 * 235 * @return array Sessions for a user. 238 236 */ 239 237 final public function get_all() { … … 242 240 243 241 /** 244 * This method should retrieve all sessions of a user, keyed by verifier.245 * 246 * @since 4.0.0 247 * 248 * @return array Sessions of a user, keyed by verifier.242 * Retrieves all sessions of the user. 243 * 244 * @since 4.0.0 245 * 246 * @return array Sessions of the user. 249 247 */ 250 248 abstract protected function get_sessions(); 251 249 252 250 /** 253 * This method should look up a session byits verifier (token hash).254 * 255 * @since 4.0.0 256 * 257 * @param string $verifier Verifier ofthe session to retrieve.251 * Retrieves a session based on its verifier (token hash). 252 * 253 * @since 4.0.0 254 * 255 * @param string $verifier Verifier for the session to retrieve. 258 256 * @return array|null The session, or null if it does not exist. 259 257 */ … … 261 259 262 260 /** 263 * This method should update a session by its verifier.264 * 265 * Omitting the second argument should destroythe session.266 * 267 * @since 4.0.0 268 * 269 * @param string $verifier Verifier ofthe session to update.261 * Updates a session based on its verifier (token hash). 262 * 263 * Omitting the second argument destroys the session. 264 * 265 * @since 4.0.0 266 * 267 * @param string $verifier Verifier for the session to update. 270 268 * @param array $session Optional. Session. Omitting this argument destroys the session. 271 269 */ … … 273 271 274 272 /** 275 * This method should destroy all session tokens for this user, 276 * except a single session passed. 273 * Destroys all sessions for this user, except the single session with the given verifier. 277 274 * 278 275 * @since 4.0.0 … … 283 280 284 281 /** 285 * This method should destroy all sessions for auser.282 * Destroys all sessions for the user. 286 283 * 287 284 * @since 4.0.0 … … 290 287 291 288 /** 292 * This static method should destroy all session tokens for all users.289 * Destroys all sessions for all users. 293 290 * 294 291 * @since 4.0.0
Note: See TracChangeset
for help on using the changeset viewer.