Changeset 16945
- Timestamp:
- 12/15/2010 12:06:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r16942 r16945 3381 3381 3382 3382 /** 3383 * Marks something as being incorrectly called. 3384 * 3385 * There is a hook doing_it_wrong_run that will be called that can be used 3386 * to get the backtrace up to what file and function called the deprecated 3387 * function. 3388 * 3389 * The current behavior is to trigger an user error if WP_DEBUG is true. 3390 * 3391 * @package WordPress 3392 * @subpackage Debug 3393 * @since 3.1.0 3394 * @access private 3395 * 3396 * @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments. 3397 * @uses apply_filters() Calls 'doing_it_wrong_trigger_error' and expects boolean value of true to do 3398 * trigger or false to not trigger error. 3399 * 3400 * @param string $function The function that was called. 3401 * @param string $message A message explaining what has been done incorrectly. 3402 * @param string $version The version of WordPress where the message was added. 3403 */ 3404 function _doing_it_wrong( $function, $message, $version ) { 3405 3406 do_action( 'doing_it_wrong_run', $function, $message, $version ); 3407 3408 // Allow plugin to filter the output error trigger 3409 if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) { 3410 $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version ); 3411 trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) ); 3412 } 3413 } 3414 3415 /** 3383 3416 * Is the server running earlier than 1.5.0 version of lighttpd 3384 3417 * … … 4454 4487 } 4455 4488 4456 /** 4457 * Marks something as being incorrectly called. 4458 * 4459 * There is a hook doing_it_wrong_run that will be called that can be used 4460 * to get the backtrace up to what file and function called the deprecated 4461 * function. 4462 * 4463 * The current behavior is to trigger an user error if WP_DEBUG is true. 4464 * 4465 * @package WordPress 4466 * @subpackage Debug 4467 * @since 3.1.0 4468 * @access private 4469 * 4470 * @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments. 4471 * @uses apply_filters() Calls 'doing_it_wrong_trigger_error' and expects boolean value of true to do 4472 * trigger or false to not trigger error. 4473 * 4474 * @param string $function The function that was called 4475 * @param string $message Optional. The function that should have been called 4476 * @param string $version Optional. The version of WordPress that deprecated the function 4477 */ 4478 function _doing_it_wrong( $function, $message, $version = null ) { 4479 4480 do_action( 'doing_it_wrong_run', $function, $message, $version ); 4481 4482 // Allow plugin to filter the output error trigger 4483 if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) { 4484 if ( is_null( $version ) ) 4485 trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong> - %2$s'), $function, $message ) ); 4486 else 4487 trigger_error( sprintf( __('%1$s was called in a way which has been <strong>incorrect</strong> since version %2$s - %3$s'), $function, $version, $message ) ); 4488 } 4489 } 4489 ?>
Note: See TracChangeset
for help on using the changeset viewer.