From e760ecfb137f70c629ce61a3237d4723472d08c1 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 16 Jan 2015 02:42:22 +0000 Subject: [PATCH] Make `_wp_scripts_maybe_doing_it_wrong( $function )` "private". Props obenland for the thought leadership. See #20513. Built from https://develop.svn.wordpress.org/trunk@31196 git-svn-id: http://core.svn.wordpress.org/trunk@31177 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.wp-scripts.php | 17 +++++++++-------- wp-includes/functions.wp-styles.php | 14 +++++++------- wp-includes/version.php | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index bf4ff40866..3a67f1cf7f 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -29,10 +29,11 @@ function wp_scripts() { * Helper function to output a _doing_it_wrong message when applicable * * @since 4.2.0 + * @access private * * @param string $function */ -function wp_scripts_maybe_doing_it_wrong( $function ) { +function _wp_scripts_maybe_doing_it_wrong( $function ) { if ( did_action( 'init' ) ) { return; } @@ -72,7 +73,7 @@ function wp_print_scripts( $handles = false ) { $handles = false; } - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { @@ -107,7 +108,7 @@ function wp_print_scripts( $handles = false ) { */ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { $wp_scripts = wp_scripts(); - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); $wp_scripts->add( $handle, $src, $deps, $ver ); if ( $in_footer ) { @@ -147,7 +148,7 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_f function wp_localize_script( $handle, $object_name, $l10n ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); return false; } @@ -168,7 +169,7 @@ function wp_localize_script( $handle, $object_name, $l10n ) { * @param string $handle Name of the script to be removed. */ function wp_deregister_script( $handle ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); /** * Do not allow accidental or negligent de-registering of critical scripts in the admin. @@ -220,7 +221,7 @@ function wp_deregister_script( $handle ) { function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) { $wp_scripts = wp_scripts(); - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); $_handle = explode( '?', $handle ); @@ -246,7 +247,7 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false * @param string $handle Name of the script to be removed. */ function wp_dequeue_script( $handle ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); wp_scripts()->dequeue( $handle ); } @@ -265,7 +266,7 @@ function wp_dequeue_script( $handle ) { * @return bool Whether the script script is queued. */ function wp_script_is( $handle, $list = 'enqueued' ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); return (bool) wp_scripts()->query( $handle, $list ); } diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php index f926f2a780..3f28d38961 100644 --- a/wp-includes/functions.wp-styles.php +++ b/wp-includes/functions.wp-styles.php @@ -52,7 +52,7 @@ function wp_print_styles( $handles = false ) { do_action( 'wp_print_styles' ); } - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); global $wp_styles; if ( ! ( $wp_styles instanceof WP_Styles ) ) { @@ -81,7 +81,7 @@ function wp_print_styles( $handles = false ) { * @return bool True on success, false on failure. */ function wp_add_inline_style( $handle, $data ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); if ( false !== stripos( $data, '' ) ) { _doing_it_wrong( __FUNCTION__, __( 'Do not pass style tags to wp_add_inline_style().' ), '3.7' ); @@ -109,7 +109,7 @@ function wp_add_inline_style( $handle, $data ) { * 'screen', 'tty', or 'tv'. */ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); wp_styles()->add( $handle, $src, $deps, $ver, $media ); } @@ -124,7 +124,7 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media * @param string $handle Name of the stylesheet to be removed. */ function wp_deregister_style( $handle ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); wp_styles()->remove( $handle ); } @@ -151,7 +151,7 @@ function wp_deregister_style( $handle ) { */ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) { global $wp_styles; - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); $wp_styles = wp_styles(); @@ -172,7 +172,7 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, * @param string $handle Name of the stylesheet to be removed. */ function wp_dequeue_style( $handle ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); wp_styles()->dequeue( $handle ); } @@ -190,7 +190,7 @@ function wp_dequeue_style( $handle ) { * @return bool Whether style is queued. */ function wp_style_is( $handle, $list = 'enqueued' ) { - wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); + _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); return (bool) wp_styles()->query( $handle, $list ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 1022c0b36d..9ac52af661 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31195'; +$wp_version = '4.2-alpha-31196'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.