Make WordPress Core

Ticket #25326: 25326.2-styles.diff

File 25326.2-styles.diff, 10.6 KB (added by kpdesign, 12 years ago)

Functional docs changes for functions.wp-styles.php

  • src/wp-includes/functions.wp-styles.php

     
    11<?php
    22/**
    3  * BackPress styles procedural API.
     3 * BackPress Styles Procedural API
    44 *
    5  * @package BackPress
    6  * @since r79
     5 * @since 2.6.0
     6 *
     7 * @package WordPress
     8 * @subpackage BackPress
    79 */
    810
    911/**
    10  * Display styles that are in the queue or part of $handles.
     12 * Display styles that are in the $handles queue.
    1113 *
    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.
    1520 *
    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.
    1926 */
    2027function wp_print_styles( $handles = false ) {
    2128        if ( '' === $handles ) // for wp_head
     
    4047}
    4148
    4249/**
    43  * Adds extra CSS.
     50 * Add extra CSS styles to a registered stylesheet.
    4451 *
    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 are
    47  * added to the same stylesheet $handle, they will be printed in the order
     52 * 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
    4855 * they were added, i.e. the latter added styles can redeclare the previous.
    4956 *
     57 * @see WP_Styles::add_inline_style()
     58 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     59 *
    5060 * @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.
    5265 */
    5366function wp_add_inline_style( $handle, $data ) {
    5467        global $wp_styles;
     
    6376}
    6477
    6578/**
    66  * Register CSS style file.
     79 * Register a CSS stylesheet.
    6780 *
    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()
    7182 * @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.
    7284 *
    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'.
    8095 */
    8196function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
    8297        global $wp_styles;
     
    91106}
    92107
    93108/**
    94  * Remove a registered CSS file.
     109 * Remove a registered CSS stylesheet.
    95110 *
    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.
    99113 *
    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.
    101117 */
    102118function wp_deregister_style( $handle ) {
    103119        global $wp_styles;
     
    112128}
    113129
    114130/**
    115  * Enqueue a CSS style file.
     131 * Enqueue a CSS stylesheet.
    116132 *
    117  * Registers the style if src provided (does NOT overwrite) and enqueues.
     133 * Registers the style if source provided (does NOT overwrite) and enqueues.
    118134 *
    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()
    122136 * @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.
    123138 *
    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'.
    132150 */
    133151function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
    134152        global $wp_styles;
     
    147165}
    148166
    149167/**
    150  * Remove an enqueued style.
     168 * Remove an enqueued CSS stylesheet.
    151169 *
     170 * @see WP_Dependencies::dequeue()
     171 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     172 *
    152173 * @since 3.1.0
    153  * @see WP_Styles::dequeue() For parameter information.
     174 *
     175 * @param string $handle Name of the stylesheet to be removed.
    154176 */
    155177function wp_dequeue_style( $handle ) {
    156178        global $wp_styles;
     
    165187}
    166188
    167189/**
    168  * Check whether style has been added to WordPress Styles.
     190 * Check whether a CSS stylesheet has been added to the queue.
    169191 *
    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.
    173193 *
    174194 * @since 2.8.0
    175  * @global object $wp_styles The WP_Styles object for printing styles.
    176195 *
    177196 * @param string $handle Name of the stylesheet.
    178  * @param string $list Optional. Defaults to 'enqueued'. Values are
    179  *      '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'.
    180199 * @return bool Whether style is in the list.
    181200 */
    182201function wp_style_is( $handle, $list = 'enqueued' ) {
     
    192211}
    193212
    194213/**
    195  * Add metadata to CSS style files.
     214 * Add metadata to CSS stylesheet.
    196215 *
    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:
    199217 *
    200  * conditional string      comments for IE 6, lte IE 7 etc.
    201  * rtl         bool|string to declare an RTL stylesheet
    202  * suffix      string      optional suffix, used in combination with RTL
    203  * alt         bool        for rel="alternate stylesheet"
    204  * title       string      for preferred/alternate stylesheets
     218 * '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
    205223 *
     224 * @see WP_Dependency::add_data()
     225 *
    206226 * @since 3.6.0
    207  * @see WP_Dependencies::add_data()
    208227 *
    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.
    213232 * @return bool True on success, false on failure.
    214233 */
    215234function wp_style_add_data( $handle, $key, $value ) {