WordPress.org

Make WordPress Core

Changeset 25594


Ignore:
Timestamp:
09/24/2013 02:23:09 AM (8 years ago)
Author:
DrewAPicture
Message:

Improve inline documentation for wp-includes/functions.wp-styles.php.

Props kpdesign.
Fixes #25401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.wp-styles.php

    r25449 r25594  
    11<?php
    22/**
    3  * BackPress styles procedural API.
    4  *
    5  * @package BackPress
    6  * @since r79
    7  */
    8 
    9 /**
    10  * Display styles that are in the queue or part of $handles.
    11  *
    12  * @since r79
    13  * @uses do_action() Calls 'wp_print_styles' hook.
    14  * @global object $wp_styles The WP_Styles object for printing styles.
    15  *
    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.
     3 * BackPress Styles Procedural API
     4 *
     5 * @since 2.6.0
     6 *
     7 * @package WordPress
     8 * @subpackage BackPress
     9 */
     10
     11/**
     12 * Display styles that are in the $handles queue.
     13 *
     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.
     20 *
     21 * @since 2.6.0
     22 *
     23 * @param array|bool $handles Styles to be printed. Default 'false'.
     24 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
    1925 */
    2026function wp_print_styles( $handles = false ) {
     
    4147
    4248/**
    43  * Adds extra CSS.
    44  *
    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
     49 * Add extra CSS styles to a registered stylesheet.
     50 *
     51 * Styles will only be added if the stylesheet in already in the queue.
     52 * Accepts a string $data containing the CSS. If two or more CSS code blocks
     53 * are added to the same stylesheet $handle, they will be printed in the order
    4854 * they were added, i.e. the latter added styles can redeclare the previous.
    4955 *
     56 * @see WP_Styles::add_inline_style()
     57 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     58 *
    5059 * @since 3.3.0
    51  * @see WP_Scripts::add_inline_style()
     60 *
     61 * @param string $handle Name of the stylesheet to add the extra styles to. Must be lowercase.
     62 * @param string $data   String containing the CSS styles to be added.
     63 * @return bool True on success, false on failure.
    5264 */
    5365function wp_add_inline_style( $handle, $data ) {
     
    6476
    6577/**
    66  * Register CSS style file.
    67  *
    68  * @since r79
    69  * @see WP_Styles::add() For additional information.
    70  * @global object $wp_styles The WP_Styles object for printing styles.
     78 * Register a CSS stylesheet.
     79 *
     80 * @see WP_Dependencies::add()
    7181 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
    72  *
    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.
     82 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     83 *
     84 * @since 2.6.0
     85 *
     86 * @param string      $handle Name of the stylesheet.
     87 * @param string|bool $src    Path to the stylesheet from the WordPress root directory. Example: '/css/mystyle.css'.
     88 * @param array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
     89 * @param string|bool $ver    String specifying the stylesheet version number. Used to ensure that the correct version
     90 *                            is sent to the client regardless of caching. Default 'false'. Accepts 'false', 'null', or 'string'.
     91 * @param string      $media  Optional. The media for which this stylesheet has been defined.
     92 *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
     93 *                            'screen', 'tty', or 'tv'.
    8094 */
    8195function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
     
    92106
    93107/**
    94  * Remove a registered CSS file.
    95  *
    96  * @since r79
    97  * @see WP_Styles::remove() For additional information.
    98  * @global object $wp_styles The WP_Styles object for printing styles.
    99  *
    100  * @param string $handle Name of the stylesheet.
     108 * Remove a registered stylesheet.
     109 *
     110 * @see WP_Dependencies::remove()
     111 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     112 *
     113 * @since 2.1.0
     114 *
     115 * @param string $handle Name of the stylesheet to be removed.
    101116 */
    102117function wp_deregister_style( $handle ) {
     
    113128
    114129/**
    115  * Enqueue a CSS style file.
    116  *
    117  * Registers the style if src provided (does NOT overwrite) and enqueues.
    118  *
    119  * @since r79
    120  * @see WP_Styles::add(), WP_Styles::enqueue()
    121  * @global object $wp_styles The WP_Styles object for printing styles.
     130 * Enqueue a CSS stylesheet.
     131 *
     132 * Registers the style if source provided (does NOT overwrite) and enqueues.
     133 *
     134 * @see WP_Dependencies::add(), WP_Dependencies::enqueue()
    122135 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
    123  *
    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.
     136 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
     137 *
     138 * @since 2.6.0
     139 *
     140 * @param string      $handle Name of the stylesheet.
     141 * @param string|bool $src    Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
     142 * @param array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
     143 * @param string|bool $ver    String specifying the stylesheet version number, if it has one. This parameter is used
     144 *                            to ensure that the correct version is sent to the client regardless of caching, and so
     145 *                            should be included if a version number is available and makes sense for the stylesheet.
     146 * @param string      $media  Optional. The media for which this stylesheet has been defined.
     147 *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
     148 *                            'screen', 'tty', or 'tv'.
    132149 */
    133150function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
     
    148165
    149166/**
    150  * Remove an enqueued style.
     167 * Remove a previously enqueued CSS stylesheet.
     168 *
     169 * @see WP_Dependencies::dequeue()
     170 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
    151171 *
    152172 * @since 3.1.0
    153  * @see WP_Styles::dequeue() For parameter information.
     173 *
     174 * @param string $handle Name of the stylesheet to be removed.
    154175 */
    155176function wp_dequeue_style( $handle ) {
     
    166187
    167188/**
    168  * Check whether style has been added to WordPress Styles.
    169  *
    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'.
     189 * Check whether a CSS stylesheet has been added to the queue.
     190 *
     191 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
    173192 *
    174193 * @since 2.8.0
    175  * @global object $wp_styles The WP_Styles object for printing styles.
    176194 *
    177195 * @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'.
    180  * @return bool Whether style is in the list.
     196 * @param string $list   Optional. Status of the stylesheet to check. Default 'enqueued'.
     197 *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
     198 * @return bool Whether style is queued.
    181199 */
    182200function wp_style_is( $handle, $list = 'enqueued' ) {
     
    193211
    194212/**
    195  * Add metadata to CSS style files.
     213 * Add metadata to a CSS stylesheet.
    196214 *
    197215 * Works only if the stylesheet has already been added.
     216 *
    198217 * Possible values for $key and $value:
    199  *
    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.
     223 *
     224 * @see WP_Dependency::add_data()
    205225 *
    206226 * @since 3.6.0
    207  * @see WP_Dependencies::add_data()
    208  *
    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
     227 *
     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 */
Note: See TracChangeset for help on using the changeset viewer.