WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
36 | $value = $this->generate_cookie(); |
37 |
|
38 | /** |
39 | * Filters the length of time a Recovery Mode cookie is valid for. |
40 | * |
41 | * @since 5.2.0 |
42 | * |
43 | * @param int $length Length in seconds. |
44 | */ |
45 | $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); |
46 |
|
47 | $expire = time() + $length; |
48 |
|
49 | setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); |
50 |
|
51 | if ( COOKIEPATH !== SITECOOKIEPATH ) { |
52 | setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); |
53 | } |
54 | } |
Line | Code |
89 | } |
90 |
|
91 | list( , $created_at, $random, $signature ) = $parts; |
92 |
|
93 | if ( ! ctype_digit( $created_at ) ) { |
94 | return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) ); |
95 | } |
96 |
|
97 | /** This filter is documented in wp-includes/class-wp-recovery-mode-cookie-service.php */ |
98 | $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); |
99 |
|
100 | if ( time() > $created_at + $length ) { |
101 | return new WP_Error( 'expired', __( 'Cookie expired.' ) ); |
102 | } |
103 |
|
104 | $to_sign = sprintf( 'recovery_mode|%s|%s', $created_at, $random ); |
105 | $hashed = $this->recovery_mode_hash( $to_sign ); |
106 |
|
107 | if ( ! hash_equals( $signature, $hashed ) ) { |