Changeset 12536
- Timestamp:
- 12/24/2009 11:06:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r12535 r12536 3009 3009 } 3010 3010 } 3011 /** 3012 * Marks a function argument as deprecated and informs when it has been used. 3013 * 3014 * This function is to be used whenever a deprecated function argument is used. 3015 * Before this function is called, the argument must be checked for whether it was 3016 * used by comparing it to its default value or evaluating whether it is empty. 3017 * For example: 3018 * <code> 3019 * if ( !empty($deprecated) ) 3020 * _deprecated_argument( __FUNCTION__, 'deprecated', '0.0' ); 3021 * </code> 3022 * 3023 * There is a hook deprecated_argument_run that will be called that can be used 3024 * to get the backtrace up to what file and function used the deprecated 3025 * argument. 3026 * 3027 * The current behavior is to trigger an user error if WP_DEBUG is true. 3028 * 3029 * @package WordPress 3030 * @package Debug 3031 * @since 3.0.0 3032 * @access private 3033 * 3034 * @uses do_action() Calls 'deprecated_argument_run' and passes the function and argument names and what to use instead. 3035 * @uses apply_filters() Calls 'deprecated_argument_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 3036 * 3037 * @param string $function The function that was called 3038 * @param string $argument The name of the deprecated argument that was used 3039 * @param string $version The version of WordPress that deprecated the function 3040 * @param string $message Optional. A message regarding the change. 3041 */ 3042 function _deprecated_argument($function, $argument, $version, $message = null) { 3043 3044 do_action('deprecated_argument_run', $function, $argument, $message); 3045 3046 // Allow plugin to filter the output error trigger 3047 if( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { 3048 if( !is_null($replacement) ) 3049 trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s! %4$s'), $function, $argument, $version, $message ) ); 3050 else 3051 trigger_error( sprintf( __('The %1$s argument of %2$s is <strong>deprecated</strong> since version %3$s with no alternative available.'), $function, $argument, $version ) ); 3052 } 3053 } 3011 3054 3012 3055 /**
Note: See TracChangeset
for help on using the changeset viewer.