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 | * Filter 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 | $expire = time() + $length; |
47 |
|
48 | setcookie( RECOVERY_MODE_COOKIE, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); |
49 |
|
50 | if ( COOKIEPATH !== SITECOOKIEPATH ) { |
51 | setcookie( RECOVERY_MODE_COOKIE, $value, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl(), true ); |
52 | } |
53 | } |
54 |
|
Line | Code |
88 | } |
89 |
|
90 | list( , $created_at, $random, $signature ) = $parts; |
91 |
|
92 | if ( ! ctype_digit( $created_at ) ) { |
93 | return new WP_Error( 'invalid_created_at', __( 'Invalid cookie format.' ) ); |
94 | } |
95 |
|
96 | /** This filter is documented in wp-includes/class-wp-recovery-mode-cookie-service.php */ |
97 | $length = apply_filters( 'recovery_mode_cookie_length', WEEK_IN_SECONDS ); |
98 |
|
99 | if ( time() > $created_at + $length ) { |
100 | return new WP_Error( 'expired', __( 'Cookie expired.' ) ); |
101 | } |
102 |
|
103 | $to_sign = sprintf( 'recovery_mode|%s|%s', $created_at, $random ); |
104 | $hashed = $this->recovery_mode_hash( $to_sign ); |
105 |
|
106 | if ( ! hash_equals( $signature, $hashed ) ) { |