WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/27/2016 08:33:57 PM (4 years ago)
Author:
ocean90
Message:

Docs: Improve inline docs for WP_Dependencies, WP_Styles, and WP_Scripts.

Also, make them and related files part of WordPress.

See #35964.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-scripts.php

    r36730 r36744  
    11<?php
    22/**
    3  * BackPress Scripts enqueue.
     3 * Dependencies API: WP_Scripts class
    44 *
    5  * These classes were refactored from the WordPress WP_Scripts and WordPress
    6  * script enqueue API.
     5 * @since 2.6.0
    76 *
    8  * @package BackPress
    9  * @since r16
     7 * @package WordPress
     8 * @subpackage Dependencies
    109 */
    1110
    1211/**
    13  * BackPress Scripts enqueue class.
     12 * Core class used to register scripts.
    1413 *
    15  * @package BackPress
     14 * @package WordPress
    1615 * @uses WP_Dependencies
    17  * @since r16
     16 * @since 2.1.0
    1817 */
    1918class WP_Scripts extends WP_Dependencies {
     
    3029
    3130    /**
     31     * URL of the content directory.
    3232     *
    3333     * @since 2.8.0
     
    3838
    3939    /**
     40     * Default version string for stylesheets.
    4041     *
    4142     * @since 2.6.0
     
    4647
    4748    /**
     49     * Holds handles of scripts which are enqueued in footer.
    4850     *
    4951     * @since 2.8.0
     
    5456
    5557    /**
     58     * Holds a list of script handles which will be concatenated.
    5659     *
    5760     * @since 2.8.0
     
    6265
    6366    /**
    64      *
    65      * @since 2.8.0
     67     * Holds a string which contains script handles and their version.
     68     *
     69     * @since 2.8.0
     70     * @deprecated 3.4.0
    6671     * @access public
    6772     * @var string
     
    7075
    7176    /**
     77     * Whether to perform concatenation.
    7278     *
    7379     * @since 2.8.0
     
    7884
    7985    /**
     86     * Holds HTML markup of scripts and additional data if concatenation
     87     * is enabled.
    8088     *
    8189     * @since 2.8.0
     
    94102
    95103    /**
     104     * Holds inline code if concatenation is enabled.
    96105     *
    97106     * @since 2.8.0
     
    102111
    103112    /**
     113     * Holds a list of script handles which are not in the default directory
     114     * if concatenation is enabled.
     115     *
     116     * Unused in core.
    104117     *
    105118     * @since 2.8.0
     
    110123
    111124    /**
     125     * Holds a string which contains handles and versions of scripts which
     126     * are not in the default directory if concatenation is enabled.
     127     *
     128     * Unused in core.
    112129     *
    113130     * @since 2.8.0
     
    118135
    119136    /**
     137     * List of default directories.
    120138     *
    121139     * @since 2.8.0
     
    173191
    174192    /**
     193     * Prints extra scripts of a registered script.
    175194     *
    176195     * @since 2.1.0
     
    181200     * @see print_extra_script()
    182201     *
    183      * @param string $handle
    184      * @param bool   $echo
    185      * @return bool|string|void
     202     * @param string $handle The script's registered handle.
     203     * @param bool   $echo   Optional. Whether to echo the extra script instead of just returning it.
     204     *                       Default true.
     205     * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
    186206     */
    187207    public function print_scripts_l10n( $handle, $echo = true ) {
     
    191211
    192212    /**
     213     * Prints extra scripts of a registered script.
    193214     *
    194215     * @since 3.3.0
    195216     * @access public
    196217     *
    197      * @param string $handle
    198      * @param bool   $echo
    199      * @return bool|string|void
     218     * @param string $handle The script's registered handle.
     219     * @param bool   $echo   Optional. Whether to echo the extra script instead of just returning it.
     220     *                       Default true.
     221     * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
    200222     */
    201223    public function print_extra_script( $handle, $echo = true ) {
     
    216238
    217239    /**
     240     * Processes a script dependency.
    218241     *
    219242     * @since 2.6.0
     
    221244     * @access public
    222245     *
    223      * @param string   $handle Name of the item. Should be unique.
    224      * @param int|bool $group
    225      * @return bool True on success, false if not set.
     246     * @see WP_Dependencies::do_item()
     247     *
     248     * @param string $handle    The script's registered handle.
     249     * @param int|false $group  Optional. Group level: (int) level, (false) no groups. Default false.
     250     * @return bool True on success, false on failure.
    226251     */
    227252    public function do_item( $handle, $group = false ) {
     
    407432
    408433    /**
    409      * Localizes a script, only if the script has already been added
     434     * Localizes a script, only if the script has already been added.
    410435     *
    411436     * @since 2.1.0
     
    447472
    448473    /**
    449      *
    450      * @since 2.8.0
    451      * @access public
    452      *
    453      * @param string $handle    Name of the item. Should be unique.
    454      * @param bool   $recursion Internal flag that calling function was called recursively.
    455      * @param mixed  $group     Group level.
     474     * Sets handle group.
     475     *
     476     * @since 2.8.0
     477     * @access public
     478     *
     479     * @see WP_Dependencies::set_group()
     480     *
     481     * @param string    $handle    Name of the item. Should be unique.
     482     * @param bool      $recursion Internal flag that calling function was called recursively.
     483     * @param int|false $group     Optional. Group level: (int) level, (false) no groups. Default false.
    456484     * @return bool Not already in the group or a lower group
    457485     */
     
    469497
    470498    /**
    471      *
     499     * Determines script dependencies.
     500     *
    472501     * @since 2.1.0
    473502     * @access public
    474503     *
    475      * @param mixed $handles   Item handle and argument (string) or item handles and arguments (array of strings).
    476      * @param bool  $recursion Internal flag that function is calling itself.
    477      * @param mixed $group     Group level: (int) level, (false) no groups.
     504     * @see WP_Dependencies::all_deps()
     505     *
     506     * @param mixed     $handles   Item handle and argument (string) or item handles and arguments (array of strings).
     507     * @param bool      $recursion Internal flag that function is calling itself.
     508     * @param int|false $group     Optional. Group level: (int) level, (false) no groups. Default false.
    478509     * @return bool True on success, false on failure.
    479510     */
     
    494525
    495526    /**
    496      *
    497      * @since 2.8.0
    498      * @access public
    499      *
    500      * @return array
     527     * Processes items and dependencies for the head group.
     528     *
     529     * @since 2.8.0
     530     * @access public
     531     *
     532     * @see WP_Dependencies::do_items()
     533     *
     534     * @return array Handles of items that have been processed.
    501535     */
    502536    public function do_head_items() {
     
    506540
    507541    /**
    508      *
    509      * @since 2.8.0
    510      * @access public
    511      *
    512      * @return array
     542     * Processes items and dependencies for the footer group.
     543     *
     544     * @since 2.8.0
     545     * @access public
     546     *
     547     * @see WP_Dependencies::do_items()
     548     *
     549     * @return array Handles of items that have been processed.
    513550     */
    514551    public function do_footer_items() {
     
    518555
    519556    /**
    520      *
    521      * @since 2.8.0
    522      * @access public
    523      *
    524      * @param string $src
    525      * @return bool
     557     * Whether a handle's source is in a default directory.
     558     *
     559     * @since 2.8.0
     560     * @access public
     561     *
     562     * @param string $src The source of the enqueued script.
     563     * @return bool True if found, false if not.
    526564     */
    527565    public function in_default_dir( $src ) {
     
    543581
    544582    /**
     583     * Resets class properties.
    545584     *
    546585     * @since 2.8.0
Note: See TracChangeset for help on using the changeset viewer.