Gets the session identifier from the cookie.
Description
The cookie should be validated before calling this API.
Parameters
$cookie
stringoptional- Optionally specify the cookie string.
If omitted, it will be retrieved from the super global.Default:
''
Source
public function get_session_id_from_cookie( $cookie = '' ) {
if ( ! $cookie ) {
if ( empty( $_COOKIE[ RECOVERY_MODE_COOKIE ] ) ) {
return new WP_Error( 'no_cookie', __( 'No cookie present.' ) );
}
$cookie = $_COOKIE[ RECOVERY_MODE_COOKIE ];
}
$parts = $this->parse_cookie( $cookie );
if ( is_wp_error( $parts ) ) {
return $parts;
}
list( , , $random ) = $parts;
return sha1( $random );
}
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.