wp/wp-includes/functions.wp-styles.php
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
upgrade wordpress + plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * BackPress Styles Procedural API
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @since 2.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * @subpackage BackPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    12
 * Initialize $wp_styles if it has not been set.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    13
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    14
 * @global WP_Styles $wp_styles
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    15
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    16
 * @since 4.2.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    17
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    18
 * @return WP_Styles WP_Styles instance.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    19
 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    20
function wp_styles() {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    21
	global $wp_styles;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    22
	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    23
		$wp_styles = new WP_Styles();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    24
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    25
	return $wp_styles;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    26
}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    27
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    28
/**
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 * Display styles that are in the $handles queue.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
 * Passing an empty array to $handles prints the queue,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
 * passing an array with one string prints that style,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
 * and passing an array of strings prints those styles.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 * @since 2.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    39
 * @param string|bool|array $handles Styles to be printed. Default 'false'.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
function wp_print_styles( $handles = false ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    43
	if ( '' === $handles ) { // for wp_head
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
		$handles = false;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    45
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    46
	/**
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    47
	 * Fires before styles in the $handles queue are printed.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    48
	 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    49
	 * @since 2.6.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    50
	 */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    51
	if ( ! $handles ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    52
		do_action( 'wp_print_styles' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    53
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    55
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
	global $wp_styles;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    58
	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    59
		if ( ! $handles ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
			return array(); // No need to instantiate if nothing is there.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    61
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    64
	return wp_styles()->do_items( $handles );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
 * Add extra CSS styles to a registered stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
 * Styles will only be added if the stylesheet in already in the queue.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
 * Accepts a string $data containing the CSS. If two or more CSS code blocks
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
 * are added to the same stylesheet $handle, they will be printed in the order
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
 * they were added, i.e. the latter added styles can redeclare the previous.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
 * @see WP_Styles::add_inline_style()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
 * @since 3.3.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
 * @param string $handle Name of the stylesheet to add the extra styles to. Must be lowercase.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
 * @param string $data   String containing the CSS styles to be added.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
 * @return bool True on success, false on failure.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
function wp_add_inline_style( $handle, $data ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    84
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
	if ( false !== stripos( $data, '</style>' ) ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    87
		_doing_it_wrong( __FUNCTION__, __( 'Do not pass style tags to wp_add_inline_style().' ), '3.7' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
		$data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    91
	return wp_styles()->add_inline_style( $handle, $data );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
 * Register a CSS stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
 * @see WP_Dependencies::add()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
 * @since 2.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
 * @param string      $handle Name of the stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
 * @param string|bool $src    Path to the stylesheet from the WordPress root directory. Example: '/css/mystyle.css'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
 * @param array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
 * @param string|bool $ver    String specifying the stylesheet version number. Used to ensure that the correct version
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
 *                            is sent to the client regardless of caching. Default 'false'. Accepts 'false', 'null', or 'string'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
 * @param string      $media  Optional. The media for which this stylesheet has been defined.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
 *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
 *                            'screen', 'tty', or 'tv'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   112
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   114
	wp_styles()->add( $handle, $src, $deps, $ver, $media );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
 * Remove a registered stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
 * @see WP_Dependencies::remove()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
 * @param string $handle Name of the stylesheet to be removed.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
function wp_deregister_style( $handle ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   127
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   129
	wp_styles()->remove( $handle );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
 * Enqueue a CSS stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
 * Registers the style if source provided (does NOT overwrite) and enqueues.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
 * @see WP_Dependencies::add(), WP_Dependencies::enqueue()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
 * @since 2.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
 * @param string      $handle Name of the stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
 * @param string|bool $src    Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
 * @param array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
 * @param string|bool $ver    String specifying the stylesheet version number, if it has one. This parameter is used
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
 *                            to ensure that the correct version is sent to the client regardless of caching, and so
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
 *                            should be included if a version number is available and makes sense for the stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
 * @param string      $media  Optional. The media for which this stylesheet has been defined.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
 *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
 *                            'screen', 'tty', or 'tv'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
	global $wp_styles;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   154
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   155
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   156
	$wp_styles = wp_styles();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
	if ( $src ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
		$_handle = explode('?', $handle);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
	$wp_styles->enqueue( $handle );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
 * Remove a previously enqueued CSS stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
 * @see WP_Dependencies::dequeue()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
 * @since 3.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
 * @param string $handle Name of the stylesheet to be removed.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
function wp_dequeue_style( $handle ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   175
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   177
	wp_styles()->dequeue( $handle );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
 * Check whether a CSS stylesheet has been added to the queue.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
 * @since 2.8.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
 * @param string $handle Name of the stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
 * @param string $list   Optional. Status of the stylesheet to check. Default 'enqueued'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
 *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
 * @return bool Whether style is queued.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
function wp_style_is( $handle, $list = 'enqueued' ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   193
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   195
	return (bool) wp_styles()->query( $handle, $list );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
 * Add metadata to a CSS stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
 * Works only if the stylesheet has already been added.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
 * Possible values for $key and $value:
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
 * 'conditional' string      Comments for IE 6, lte IE 7 etc.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
 * 'rtl'         bool|string To declare an RTL stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
 * 'suffix'      string      Optional suffix, used in combination with RTL.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
 * 'alt'         bool        For rel="alternate stylesheet".
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
 * 'title'       string      For preferred/alternate stylesheets.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
 * @see WP_Dependency::add_data()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
 * @since 3.6.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
 * @param string $handle Name of the stylesheet.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
 * @param string $key    Name of data point for which we're storing a value.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
 *                       Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   217
 * @param mixed  $value  String containing the CSS data to be added.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
 * @return bool True on success, false on failure.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
function wp_style_add_data( $handle, $key, $value ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   221
	return wp_styles()->add_data( $handle, $key, $value );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
}