Ticket #12913: 12913_wp_deprecated_filter_check.diff
| File 12913_wp_deprecated_filter_check.diff, 4.2 KB (added by , 16 years ago) |
|---|
-
wp-login.php
165 165 $user_login = $user_data->user_login; 166 166 $user_email = $user_data->user_email; 167 167 168 do_action('retreive_password', $user_login ); // Misspelled and deprecated168 do_action('retreive_password', $user_login, array( '0.0', 'retrieve_password') ); // Misspelled and deprecated 169 169 do_action('retrieve_password', $user_login); 170 170 171 171 $allow = apply_filters('allow_password_reset', true, $user_data->ID); -
wp-includes/plugin.php
346 346 * @global array $wp_actions Increments the amount of times action was triggered. 347 347 * 348 348 * @param string $tag The name of the action to be executed. 349 * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. 349 * @param mixed $arg,... Optional additional arguments which are passed on to the 350 * functions hooked to the action. 351 * @param array $deprecated Optional: If the tag is deprecated, this should be an 352 * array containing ($since_version, $replacement) 350 353 * @return null Will return null if $tag does not exist in $wp_filter array 351 354 */ 352 function do_action($tag, $arg = '' ) {355 function do_action($tag, $arg = '', $deprecated = false) { 353 356 global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; 354 357 355 358 if ( ! isset($wp_actions) ) … … 390 393 reset( $wp_filter[ $tag ] ); 391 394 392 395 do { 393 foreach ( (array) current($wp_filter[$tag]) as $the_ ) 396 foreach ( (array) current($wp_filter[$tag]) as $the_ ) { 397 // If $tag is deprecated, report its use 398 if( $deprecated && is_array( $deprecated ) ) { 399 _deprecated_action( $tag, $deprecated[0], $deprecated[1] ); 400 } 401 394 402 if ( !is_null($the_['function']) ) 395 403 call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); 404 } 396 405 397 406 } while ( next($wp_filter[$tag]) !== false ); 398 407 … … 433 442 * 434 443 * @param string $tag The name of the action to be executed. 435 444 * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt> 445 * @param array $deprecated Optional: If the tag is deprecated, this should be an 446 * array containing ($since_version, $replacement) 436 447 * @return null Will return null if $tag does not exist in $wp_filter array 437 448 */ 438 function do_action_ref_array($tag, $args ) {449 function do_action_ref_array($tag, $args, $deprecated = false) { 439 450 global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; 440 451 441 452 if ( ! isset($wp_actions) ) … … 469 480 470 481 do { 471 482 foreach( (array) current($wp_filter[$tag]) as $the_ ) 483 // If $tag is deprecated, report its use 484 if( $deprecated && is_array( $deprecated ) ) { 485 _deprecated_action( $tag, $deprecated[0], $deprecated[1] ); 486 } 472 487 if ( !is_null($the_['function']) ) 473 488 call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); 474 489 -
wp-includes/functions.php
3210 3210 } 3211 3211 } 3212 3212 3213 function _deprecated_action( $tag, $version, $replacement ) { 3214 _deprecated_filter( $tag, $version, $replacement, 'action '); 3215 } 3216 3217 function _deprecated_filter( $tag, $version, $replacement, $type='filter' ) { 3218 error_log('deprecated filter called!'); 3219 do_action( 'deprecated_filter_run', $tag, $replacement, $version, $type ); 3220 3221 // Allow plugin to filter the output error trigger 3222 if ( WP_DEBUG && apply_filters( 'deprecated_filter_trigger_error', true ) ) { 3223 if ( ! is_null( $replacement ) ) 3224 trigger_error( sprintf( __( 'The %1$s "%2$s" is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ), $type, $tag, $version, $replacement ) ); 3225 else 3226 trigger_error( sprintf( __( 'The %1$s "%2$s" is <strong>deprecated</strong> since version %3$s with no alternative available.' ), $type, $tag, $version ) ); 3227 } 3228 } 3229 3230 3213 3231 /** 3214 3232 * Is the server running earlier than 1.5.0 version of lighttpd 3215 3233 *