Code Duplication    Length = 34-34 lines in 2 locations

src/wp-includes/functions.php 2 locations

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