--- a/wp/wp-includes/functions.wp-styles.php Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/functions.wp-styles.php Tue Dec 15 13:49:49 2020 +0100
@@ -19,9 +19,11 @@
*/
function wp_styles() {
global $wp_styles;
+
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
$wp_styles = new WP_Styles();
}
+
return $wp_styles;
}
@@ -37,24 +39,26 @@
* @since 2.6.0
*
* @param string|bool|array $handles Styles to be printed. Default 'false'.
- * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
+ * @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
*/
function wp_print_styles( $handles = false ) {
- if ( '' === $handles ) { // for wp_head
+ global $wp_styles;
+
+ if ( '' === $handles ) { // For 'wp_head'.
$handles = false;
}
- /**
- * Fires before styles in the $handles queue are printed.
- *
- * @since 2.6.0
- */
+
if ( ! $handles ) {
+ /**
+ * Fires before styles in the $handles queue are printed.
+ *
+ * @since 2.6.0
+ */
do_action( 'wp_print_styles' );
}
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
- global $wp_styles;
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
if ( ! $handles ) {
return array(); // No need to instantiate if nothing is there.
@@ -81,7 +85,7 @@
* @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__, $handle );
if ( false !== stripos( $data, '</style>' ) ) {
_doing_it_wrong(
@@ -112,7 +116,7 @@
* @param string $handle Name of the stylesheet. Should be unique.
* @param string|bool $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* If source is set to false, stylesheet is an alias of other stylesheets it depends on.
- * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
+ * @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
* as a query string for cache busting purposes. If version is set to false, a version
* number is automatically added equal to current installed WordPress version.
@@ -123,7 +127,7 @@
* @return bool Whether the style has been registered. True on success, false on failure.
*/
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__, $handle );
return wp_styles()->add( $handle, $src, $deps, $ver, $media );
}
@@ -138,7 +142,7 @@
* @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__, $handle );
wp_styles()->remove( $handle );
}
@@ -157,7 +161,7 @@
* @param string $handle Name of the stylesheet. Should be unique.
* @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
* Default empty.
- * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
+ * @param string[] $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
* @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
* as a query string for cache busting purposes. If version is set to false, a version
* number is automatically added equal to current installed WordPress version.
@@ -167,7 +171,7 @@
* '(orientation: portrait)' and '(max-width: 640px)'.
*/
function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
- _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
$wp_styles = wp_styles();
@@ -175,6 +179,7 @@
$_handle = explode( '?', $handle );
$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
}
+
$wp_styles->enqueue( $handle );
}
@@ -188,7 +193,7 @@
* @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__, $handle );
wp_styles()->dequeue( $handle );
}
@@ -204,7 +209,7 @@
* @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__, $handle );
return (bool) wp_styles()->query( $handle, $list );
}
@@ -221,7 +226,7 @@
* 'alt' bool For rel="alternate stylesheet".
* 'title' string For preferred/alternate stylesheets.
*
- * @see WP_Dependency::add_data()
+ * @see WP_Dependencies::add_data()
*
* @since 3.6.0
*