Code Duplication    Length = 22-24 lines in 2 locations

wp-includes/functions.wp-scripts.php 1 location

@@ 65-86 (lines=22) @@
62
 * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
63
 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
64
 */
65
function wp_print_scripts( $handles = false ) {
66
	/**
67
	 * Fires before scripts in the $handles queue are printed.
68
	 *
69
	 * @since 2.1.0
70
	 */
71
	do_action( 'wp_print_scripts' );
72
	if ( '' === $handles ) { // for wp_head
73
		$handles = false;
74
	}
75
76
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
77
78
	global $wp_scripts;
79
	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
80
		if ( ! $handles ) {
81
			return array(); // No need to instantiate if nothing is there.
82
		}
83
	}
84
85
	return wp_scripts()->do_items( $handles );
86
}
87
88
/**
89
 * Adds extra code to a registered script.

wp-includes/functions.wp-styles.php 1 location

@@ 42-65 (lines=24) @@
39
 * @param string|bool|array $handles Styles to be printed. Default 'false'.
40
 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
41
 */
42
function wp_print_styles( $handles = false ) {
43
	if ( '' === $handles ) { // for wp_head
44
		$handles = false;
45
	}
46
	/**
47
	 * Fires before styles in the $handles queue are printed.
48
	 *
49
	 * @since 2.6.0
50
	 */
51
	if ( ! $handles ) {
52
		do_action( 'wp_print_styles' );
53
	}
54
55
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
56
57
	global $wp_styles;
58
	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
59
		if ( ! $handles ) {
60
			return array(); // No need to instantiate if nothing is there.
61
		}
62
	}
63
64
	return wp_styles()->do_items( $handles );
65
}
66
67
/**
68
 * Add extra CSS styles to a registered stylesheet.