X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/80b7979fccf09a75af3f4c111fa27060ae6dbf85..11be15bd505d66a91e2c80062190b13e315a04a9:/wp-includes/functions.wp-styles.php
diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php
index 88966154..617fd824 100644
--- a/wp-includes/functions.wp-styles.php
+++ b/wp-includes/functions.wp-styles.php
@@ -28,7 +28,7 @@ function wp_print_styles( $handles = false ) {
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
if ( !$handles )
return array(); // No need to instantiate if nothing is there.
@@ -55,7 +55,7 @@ function wp_add_inline_style( $handle, $data ) {
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
@@ -83,7 +83,7 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
@@ -104,7 +104,7 @@ function wp_deregister_style( $handle ) {
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
@@ -135,7 +135,7 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false,
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
@@ -157,7 +157,7 @@ function wp_dequeue_style( $handle ) {
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
@@ -167,28 +167,52 @@ function wp_dequeue_style( $handle ) {
/**
* Check whether style has been added to WordPress Styles.
*
- * The values for list defaults to 'queue', which is the same as wp_enqueue_style().
+ * By default, checks if the style has been enqueued. You can also
+ * pass 'registered' to $list, to see if the style is registered,
+ * and you can check processing statuses with 'to_do' and 'done'.
*
* @since WP unknown; BP unknown
* @global object $wp_styles The WP_Styles object for printing styles.
*
* @param string $handle Name of the stylesheet.
- * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'.
- * @return bool True on success, false on failure.
+ * @param string $list Optional. Defaults to 'enqueued'. Values are
+ * 'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.
+ * @return bool Whether style is in the list.
*/
-function wp_style_is( $handle, $list = 'queue' ) {
+function wp_style_is( $handle, $list = 'enqueued' ) {
global $wp_styles;
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
if ( ! did_action( 'init' ) )
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
- 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'init
' ), '3.3' );
+ 'wp_enqueue_scripts
', 'admin_enqueue_scripts
', 'login_enqueue_scripts
' ), '3.3' );
$wp_styles = new WP_Styles();
}
- $query = $wp_styles->query( $handle, $list );
-
- if ( is_object( $query ) )
- return true;
+ return (bool) $wp_styles->query( $handle, $list );
+}
- return $query;
+/**
+ * Add metadata to CSS style files.
+ *
+ * Works only if the stylesheet has already been added.
+ * Possible values for $key and $value:
+ *
+ * conditional string comments for IE 6, lte IE 7 etc.
+ * rtl bool|string to declare an RTL stylesheet
+ * suffix string optional suffix, used in combination with RTL
+ * alt bool for rel="alternate stylesheet"
+ * title string for preferred/alternate stylesheets
+ *
+ * @since 3.6.0
+ * @see WP_Dependencies::add_data()
+ *
+ * @param string $handle Script name.
+ * @param string $key Name of data point for which we're storing a value.
+ * Values are 'conditional', 'rtl', and 'suffix', and 'alt', 'title'.
+ * @param mixed $data
+ * @return bool True on success, false on failure.
+ */
+function wp_style_add_data( $handle, $key, $value ) {
+ global $wp_styles;
+ return $wp_styles->add_data( $handle, $key, $value );
}