Ticket #25326: 25326.2-styles.diff
| File 25326.2-styles.diff, 10.6 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/functions.wp-styles.php
1 1 <?php 2 2 /** 3 * BackPress styles procedural API.3 * BackPress Styles Procedural API 4 4 * 5 * @package BackPress 6 * @since r79 5 * @since 2.6.0 6 * 7 * @package WordPress 8 * @subpackage BackPress 7 9 */ 8 10 9 11 /** 10 * Display styles that are in the queue or part of $handles.12 * Display styles that are in the $handles queue. 11 13 * 12 * @since r79 13 * @uses do_action() Calls 'wp_print_styles' hook. 14 * @global object $wp_styles The WP_Styles object for printing styles. 14 * Passing an empty array to $handles prints the queue, 15 * passing an array with one string prints that style, 16 * and passing an array of strings prints those styles. 17 * 18 * @see do_action() Calls 'wp_print_styles' hook. 19 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 15 20 * 16 * @param array|bool $handles Styles to be printed. An empty array prints the queue, 17 * an array with one string prints that style, and an array of strings prints those styles. 18 * @return bool True on success, false on failure. 21 * @since 2.6.0 22 * 23 * @param array|bool $handles Styles to be printed. 24 * Default 'false'. 25 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array. 19 26 */ 20 27 function wp_print_styles( $handles = false ) { 21 28 if ( '' === $handles ) // for wp_head … … 40 47 } 41 48 42 49 /** 43 * Add s extra CSS.50 * Add extra CSS styles to a registered stylesheet. 44 51 * 45 * Works only if the stylesheet has already been added.46 * Accepts a string $data containing the CSS. If two or more CSS code blocks are47 * a dded to the same stylesheet $handle, they will be printed in the order52 * Styles will only be added if the stylesheet in already in the queue. 53 * Accepts a string $data containing the CSS. If two or more CSS code blocks 54 * are added to the same stylesheet $handle, they will be printed in the order 48 55 * they were added, i.e. the latter added styles can redeclare the previous. 49 56 * 57 * @see WP_Styles::add_inline_style() 58 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 59 * 50 60 * @since 3.3.0 51 * @see WP_Scripts::add_inline_style() 61 * 62 * @param string $handle Name of the stylesheet to add the extra styles to. Must be lowercase. 63 * @param string $data String containing the CSS styles to be added. 64 * @return bool True on success, false on failure. 52 65 */ 53 66 function wp_add_inline_style( $handle, $data ) { 54 67 global $wp_styles; … … 63 76 } 64 77 65 78 /** 66 * Register CSS style file.79 * Register a CSS stylesheet. 67 80 * 68 * @since r79 69 * @see WP_Styles::add() For additional information. 70 * @global object $wp_styles The WP_Styles object for printing styles. 81 * @see WP_Dependencies::add() 71 82 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. 83 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 72 84 * 73 * @param string $handle Name of the stylesheet. 74 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. 75 * @param array $deps Array of handles of any stylesheet that this stylesheet depends on. 76 * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. 77 * @param string|bool $ver String specifying the stylesheet version number. Set to null to disable. 78 * Used to ensure that the correct version is sent to the client regardless of caching. 79 * @param string $media The media for which this stylesheet has been defined. 85 * @since 2.6.0 86 * 87 * @param string $handle Name of the stylesheet. 88 * @param string|bool $src Path to the stylesheet from the WordPress root directory. Example: '/css/mystyle.css'. 89 * @param array $deps An array of registered style handles this stylesheet depends on. 90 * Default empty array. 91 * @param string|bool $ver String specifying the stylesheet version number. Used to ensure that the correct version is sent to the client regardless of caching. 92 * Default 'false'. Accepts 'false', 'null', or 'string'. 93 * @param string $media Optional. The media for which this stylesheet has been defined. 94 * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print', 'screen', 'tty', or 'tv'. 80 95 */ 81 96 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { 82 97 global $wp_styles; … … 91 106 } 92 107 93 108 /** 94 * Remove a registered CSS file.109 * Remove a registered CSS stylesheet. 95 110 * 96 * @since r79 97 * @see WP_Styles::remove() For additional information. 98 * @global object $wp_styles The WP_Styles object for printing styles. 111 * @see WP_Dependencies::remove() 112 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 99 113 * 100 * @param string $handle Name of the stylesheet. 114 * @since 2.1.0 115 * 116 * @param string $handle Name of the stylesheet to be removed. 101 117 */ 102 118 function wp_deregister_style( $handle ) { 103 119 global $wp_styles; … … 112 128 } 113 129 114 130 /** 115 * Enqueue a CSS style file.131 * Enqueue a CSS stylesheet. 116 132 * 117 * Registers the style if s rcprovided (does NOT overwrite) and enqueues.133 * Registers the style if source provided (does NOT overwrite) and enqueues. 118 134 * 119 * @since r79 120 * @see WP_Styles::add(), WP_Styles::enqueue() 121 * @global object $wp_styles The WP_Styles object for printing styles. 135 * @see WP_Dependencies::add(), WP_Dependencies::enqueue() 122 136 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. 137 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 123 138 * 124 * @param string $handle Name of the stylesheet. 125 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. 126 * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on. 127 * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. 128 * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter 129 * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included 130 * if a version number is available and makes sense for the stylesheet. 131 * @param string $media The media for which this stylesheet has been defined. 139 * @since 2.6.0 140 * 141 * @param string $handle Name of the stylesheet. 142 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'. 143 * @param array $deps An array of registered style handles this stylesheet depends on. 144 * Default empty array. 145 * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter is used to ensure 146 * that the correct version is sent to the client regardless of caching, and so should be included if 147 * a version number is available and makes sense for the stylesheet. 148 * @param string $media Optional. The media for which this stylesheet has been defined. 149 * Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print', 'screen', 'tty', or 'tv'. 132 150 */ 133 151 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) { 134 152 global $wp_styles; … … 147 165 } 148 166 149 167 /** 150 * Remove an enqueued style.168 * Remove an enqueued CSS stylesheet. 151 169 * 170 * @see WP_Dependencies::dequeue() 171 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 172 * 152 173 * @since 3.1.0 153 * @see WP_Styles::dequeue() For parameter information. 174 * 175 * @param string $handle Name of the stylesheet to be removed. 154 176 */ 155 177 function wp_dequeue_style( $handle ) { 156 178 global $wp_styles; … … 165 187 } 166 188 167 189 /** 168 * Check whether style has been added to WordPress Styles.190 * Check whether a CSS stylesheet has been added to the queue. 169 191 * 170 * By default, checks if the style has been enqueued. You can also 171 * pass 'registered' to $list, to see if the style is registered, 172 * and you can check processing statuses with 'to_do' and 'done'. 192 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 173 193 * 174 194 * @since 2.8.0 175 * @global object $wp_styles The WP_Styles object for printing styles.176 195 * 177 196 * @param string $handle Name of the stylesheet. 178 * @param string $list Optional. Defaults to 'enqueued'. Values are179 * 'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.197 * @param string $list Optional. Status of the stylesheet to check. 198 * Default 'enqueued'. Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. 180 199 * @return bool Whether style is in the list. 181 200 */ 182 201 function wp_style_is( $handle, $list = 'enqueued' ) { … … 192 211 } 193 212 194 213 /** 195 * Add metadata to CSS style files.214 * Add metadata to CSS stylesheet. 196 215 * 197 * Works only if the stylesheet has already been added. 198 * Possible values for $key and $value: 216 * Works only if the stylesheet has already been added. Possible values for $key and $value: 199 217 * 200 * conditional stringcomments for IE 6, lte IE 7 etc.201 * rtl bool|stringto declare an RTL stylesheet202 * suffix stringoptional suffix, used in combination with RTL203 * alt boolfor rel="alternate stylesheet"204 * title stringfor preferred/alternate stylesheets218 * 'conditional' string comments for IE 6, lte IE 7 etc. 219 * 'rtl' bool|string to declare an RTL stylesheet 220 * 'suffix' string optional suffix, used in combination with RTL 221 * 'alt' bool for rel="alternate stylesheet" 222 * 'title' string for preferred/alternate stylesheets 205 223 * 224 * @see WP_Dependency::add_data() 225 * 206 226 * @since 3.6.0 207 * @see WP_Dependencies::add_data()208 227 * 209 * @param string $handle Script name.210 * @param string $key Name of data point for which we're storing a value.211 * Values are 'conditional', 'rtl', and 'suffix', and 'alt','title'.212 * @param mixed $data 228 * @param string $handle Name of the stylesheet. 229 * @param string $key Name of data point for which we're storing a value. 230 * Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'. 231 * @param mixed $data String containing the CSS data to be added. 213 232 * @return bool True on success, false on failure. 214 233 */ 215 234 function wp_style_add_data( $handle, $key, $value ) {