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
This commit is contained in:
Scott Taylor 2015-01-16 02:42:22 +00:00
parent b74f13511a
commit e760ecfb13
3 changed files with 17 additions and 16 deletions

View File

@ -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 );
}

View File

@ -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, '</style>' ) ) {
_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 );
}

View File

@ -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.