- Timestamp:
- 09/19/2022 09:34:52 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r54190 r54218 2246 2246 * 2247 2247 * @since 2.5.0 2248 * 2248 * @since 6.1.0 Added `action` argument. 2249 * 2250 * @param string|int $action Optional. The current nonce action. Default -1. 2249 2251 * @return float Float value rounded up to the next highest integer. 2250 2252 */ 2251 function wp_nonce_tick( ) {2253 function wp_nonce_tick( $action = -1 ) { 2252 2254 /** 2253 2255 * Filters the lifespan of nonces in seconds. 2254 2256 * 2255 2257 * @since 2.5.0 2256 * 2257 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day. 2258 */ 2259 $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS ); 2258 * @since 6.1.0 Added `action` argument to allow for more targeted filters. 2259 * 2260 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day. 2261 * @param string|int $action The current nonce action. 2262 */ 2263 $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS, $action ); 2260 2264 2261 2265 return ceil( time() / ( $nonce_life / 2 ) ); … … 2298 2302 2299 2303 $token = wp_get_session_token(); 2300 $i = wp_nonce_tick( );2304 $i = wp_nonce_tick( $action ); 2301 2305 2302 2306 // Nonce generated 0-12 hours ago. … … 2348 2352 } 2349 2353 2350 $token = wp_get_session_token( );2351 $i = wp_nonce_tick( );2354 $token = wp_get_session_token( $action ); 2355 $i = wp_nonce_tick( $action ); 2352 2356 2353 2357 return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); -
trunk/tests/phpunit/tests/pluggable.php
r53767 r54218 202 202 'notify' => '', 203 203 ), 204 'wp_nonce_tick' => array( ),204 'wp_nonce_tick' => array( 'action' => -1 ), 205 205 'wp_verify_nonce' => array( 206 206 'nonce',
Note: See TracChangeset
for help on using the changeset viewer.