@@ 3809-3842 (lines=34) @@ | ||
3806 | * @param string $version The version of WordPress that deprecated the function. |
|
3807 | * @param string $replacement Optional. The function that should have been called. Default null. |
|
3808 | */ |
|
3809 | function _deprecated_function( $function, $version, $replacement = null ) { |
|
3810 | ||
3811 | /** |
|
3812 | * Fires when a deprecated function is called. |
|
3813 | * |
|
3814 | * @since 2.5.0 |
|
3815 | * |
|
3816 | * @param string $function The function that was called. |
|
3817 | * @param string $replacement The function that should have been called. |
|
3818 | * @param string $version The version of WordPress that deprecated the function. |
|
3819 | */ |
|
3820 | do_action( 'deprecated_function_run', $function, $replacement, $version ); |
|
3821 | ||
3822 | /** |
|
3823 | * Filters whether to trigger an error for deprecated functions. |
|
3824 | * |
|
3825 | * @since 2.5.0 |
|
3826 | * |
|
3827 | * @param bool $trigger Whether to trigger the error for deprecated functions. Default true. |
|
3828 | */ |
|
3829 | if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) { |
|
3830 | if ( function_exists( '__' ) ) { |
|
3831 | if ( ! is_null( $replacement ) ) { |
|
3832 | /* translators: 1: PHP function name, 2: version number, 3: alternative function name */ |
|
3833 | trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) ); |
|
3834 | } else { |
|
3835 | /* translators: 1: PHP function name, 2: version number */ |
|
3836 | trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) ); |
|
3837 | } |
|
3838 | } else { |
|
3839 | if ( ! is_null( $replacement ) ) { |
|
3840 | trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) ); |
|
3841 | } else { |
|
3842 | trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) ); |
|
3843 | } |
|
3844 | } |
|
3845 | } |
|
@@ 4001-4034 (lines=34) @@ | ||
3998 | * @param string $version The version of WordPress that deprecated the argument used. |
|
3999 | * @param string $message Optional. A message regarding the change. Default null. |
|
4000 | */ |
|
4001 | function _deprecated_argument( $function, $version, $message = null ) { |
|
4002 | ||
4003 | /** |
|
4004 | * Fires when a deprecated argument is called. |
|
4005 | * |
|
4006 | * @since 3.0.0 |
|
4007 | * |
|
4008 | * @param string $function The function that was called. |
|
4009 | * @param string $message A message regarding the change. |
|
4010 | * @param string $version The version of WordPress that deprecated the argument used. |
|
4011 | */ |
|
4012 | do_action( 'deprecated_argument_run', $function, $message, $version ); |
|
4013 | ||
4014 | /** |
|
4015 | * Filters whether to trigger an error for deprecated arguments. |
|
4016 | * |
|
4017 | * @since 3.0.0 |
|
4018 | * |
|
4019 | * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true. |
|
4020 | */ |
|
4021 | if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { |
|
4022 | if ( function_exists( '__' ) ) { |
|
4023 | if ( ! is_null( $message ) ) { |
|
4024 | /* translators: 1: PHP function name, 2: version number, 3: optional message regarding the change */ |
|
4025 | trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) ); |
|
4026 | } else { |
|
4027 | /* translators: 1: PHP function name, 2: version number */ |
|
4028 | trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) ); |
|
4029 | } |
|
4030 | } else { |
|
4031 | if ( ! is_null( $message ) ) { |
|
4032 | trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) ); |
|
4033 | } else { |
|
4034 | trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) ); |
|
4035 | } |
|
4036 | } |
|
4037 | } |