@@ 3686-3719 (lines=34) @@ | ||
3683 | * @param string $version The version of WordPress that deprecated the function. |
|
3684 | * @param string $replacement Optional. The function that should have been called. Default null. |
|
3685 | */ |
|
3686 | function _deprecated_function( $function, $version, $replacement = null ) { |
|
3687 | ||
3688 | /** |
|
3689 | * Fires when a deprecated function is called. |
|
3690 | * |
|
3691 | * @since 2.5.0 |
|
3692 | * |
|
3693 | * @param string $function The function that was called. |
|
3694 | * @param string $replacement The function that should have been called. |
|
3695 | * @param string $version The version of WordPress that deprecated the function. |
|
3696 | */ |
|
3697 | do_action( 'deprecated_function_run', $function, $replacement, $version ); |
|
3698 | ||
3699 | /** |
|
3700 | * Filters whether to trigger an error for deprecated functions. |
|
3701 | * |
|
3702 | * @since 2.5.0 |
|
3703 | * |
|
3704 | * @param bool $trigger Whether to trigger the error for deprecated functions. Default true. |
|
3705 | */ |
|
3706 | if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) { |
|
3707 | if ( function_exists( '__' ) ) { |
|
3708 | if ( ! is_null( $replacement ) ) |
|
3709 | trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) ); |
|
3710 | else |
|
3711 | trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) ); |
|
3712 | } else { |
|
3713 | if ( ! is_null( $replacement ) ) |
|
3714 | trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) ); |
|
3715 | else |
|
3716 | trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) ); |
|
3717 | } |
|
3718 | } |
|
3719 | } |
|
3720 | ||
3721 | /** |
|
3722 | * Marks a constructor as deprecated and informs when it has been used. |
|
@@ 3870-3903 (lines=34) @@ | ||
3867 | * @param string $version The version of WordPress that deprecated the argument used. |
|
3868 | * @param string $message Optional. A message regarding the change. Default null. |
|
3869 | */ |
|
3870 | function _deprecated_argument( $function, $version, $message = null ) { |
|
3871 | ||
3872 | /** |
|
3873 | * Fires when a deprecated argument is called. |
|
3874 | * |
|
3875 | * @since 3.0.0 |
|
3876 | * |
|
3877 | * @param string $function The function that was called. |
|
3878 | * @param string $message A message regarding the change. |
|
3879 | * @param string $version The version of WordPress that deprecated the argument used. |
|
3880 | */ |
|
3881 | do_action( 'deprecated_argument_run', $function, $message, $version ); |
|
3882 | ||
3883 | /** |
|
3884 | * Filters whether to trigger an error for deprecated arguments. |
|
3885 | * |
|
3886 | * @since 3.0.0 |
|
3887 | * |
|
3888 | * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true. |
|
3889 | */ |
|
3890 | if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { |
|
3891 | if ( function_exists( '__' ) ) { |
|
3892 | if ( ! is_null( $message ) ) |
|
3893 | trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) ); |
|
3894 | else |
|
3895 | 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 ) ); |
|
3896 | } else { |
|
3897 | if ( ! is_null( $message ) ) |
|
3898 | trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) ); |
|
3899 | else |
|
3900 | 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 ) ); |
|
3901 | } |
|
3902 | } |
|
3903 | } |
|
3904 | ||
3905 | /** |
|
3906 | * Marks a deprecated action or filter hook as deprecated and throws a notice. |