WordPress.org

Make WordPress Core

Changeset 47170


Ignore:
Timestamp:
02/03/2020 12:17:38 AM (10 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for WP_Dependencies, WP_Scripts, and WP_Styles methods.

See #48303.

Location:
trunk/src/wp-includes
Files:
5 edited

Legend:

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

    r46451 r47170  
    124124     * @param string $domain The translation textdomain.
    125125     * @param string $path   Optional. The full file path to the directory containing translation files.
    126      *
    127126     * @return bool False if $domain is not a string, true otherwise.
    128127     */
  • trunk/src/wp-includes/class.wp-dependencies.php

    r47122 r47170  
    8484     * @since 2.8.0 Added the `$group` parameter.
    8585     *
    86      * @param mixed     $handles Optional. Items to be processed: Process queue (false), process item (string), process items (array of strings).
    87      * @param int|false $group   Optional. Group level: level (int), no groups (false).
     86     * @param string|string[]|false $handles Optional. Items to be processed: queue (false),
     87     *                                       single item (string), or multiple items (array of strings).
     88     *                                       Default false.
     89     * @param int|false             $group   Optional. Group level: level (int), no groups (false).
    8890     * @return string[] Array of handles of items that have been processed.
    8991     */
     
    137139     * @since 2.8.0 Added the `$group` parameter.
    138140     *
    139      * @param string|string[] $handles   Item handle and argument (string) or item handles and arguments (array of strings).
    140      * @param bool            $recursion Internal flag that function is calling itself.
    141      * @param int|false       $group     Group level: (int) level, (false) no groups.
     141     * @param string|string[] $handles   Item handle (string) or item handles (array of strings).
     142     * @param bool            $recursion Optional. Internal flag that function is calling itself.
     143     *                                   Default false.
     144     * @param int|false       $group     Optional. Group level: level (int), no groups (false).
     145     *                                   Default false.
    142146     * @return bool True on success, false on failure.
    143147     */
     
    204208     *
    205209     * @param string           $handle Name of the item. Should be unique.
    206      * @param string|bool      $src    Full URL of the item, or path of the item relative to the WordPress root directory.
    207      *                                 If source is set to false, item is an alias of other items it depends on.
    208      * @param string[]         $deps   Optional. An array of registered item handles this item depends on. Default empty array.
    209      * @param string|bool|null $ver    Optional. String specifying item version number, if it has one, which is added to the URL
    210      *                                 as a query string for cache busting purposes. If version is set to false, a version
    211      *                                 number is automatically added equal to current installed WordPress version.
     210     * @param string|bool      $src    Full URL of the item, or path of the item relative
     211     *                                 to the WordPress root directory. If source is set to false,
     212     *                                 item is an alias of other items it depends on.
     213     * @param string[]         $deps   Optional. An array of registered item handles this item depends on.
     214     *                                 Default empty array.
     215     * @param string|bool|null $ver    Optional. String specifying item version number, if it has one,
     216     *                                 which is added to the URL as a query string for cache busting purposes.
     217     *                                 If version is set to false, a version number is automatically added
     218     *                                 equal to current installed WordPress version.
    212219     *                                 If set to null, no version is added.
    213      * @param mixed            $args   Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer.
     220     * @param mixed            $args   Optional. Custom property of the item. NOT the class property $args.
     221     *                                 Examples: $media, $in_footer.
    214222     * @return bool Whether the item has been registered. True on success, false on failure.
    215223     */
     
    231239     * @param string $handle Name of the item. Should be unique.
    232240     * @param string $key    The data key.
    233      * @param mixed $value  The data value.
     241     * @param string $value  The data value.
    234242     * @return bool True on success, false on failure.
    235243     */
     
    251259     * @param string $handle Name of the item. Should be unique.
    252260     * @param string $key    The data key.
    253      * @return mixed Extra item data (string), false otherwise.
     261     * @return string|false Extra item data (string), false otherwise.
    254262     */
    255263    public function get_data( $handle, $key ) {
     
    271279     * @since 2.6.0 Moved from `WP_Scripts`.
    272280     *
    273      * @param string|string[] $handles Item handle and argument (string) or item handles and arguments (array of strings).
    274      * @return void
     281     * @param string|string[] $handles Item handle (string) or item handles (array of strings).
    275282     */
    276283    public function remove( $handles ) {
     
    291298     * @since 2.6.0 Moved from `WP_Scripts`.
    292299     *
    293      * @param string|string[] $handles Item handle and argument (string) or item handles and arguments (array of strings).
     300     * @param string|string[] $handles Item handle (string) or item handles (array of strings).
    294301     */
    295302    public function enqueue( $handles ) {
     
    314321     * @since 2.6.0 Moved from `WP_Scripts`.
    315322     *
    316      * @param string|string[] $handles Item handle and argument (string) or item handles and arguments (array of strings).
     323     * @param string|string[] $handles Item handle (string) or item handles (array of strings).
    317324     */
    318325    public function dequeue( $handles ) {
     
    359366     *
    360367     * @param string $handle Name of the item. Should be unique.
    361      * @param string $list   Property name of list array.
     368     * @param string $list   Optional. Property name of list array. Default 'registered'.
    362369     * @return bool|_WP_Dependency Found, or object Item data.
    363370     */
     
    394401     * @since 2.8.0
    395402     *
    396      * @param string $handle    Name of the item. Should be unique.
    397      * @param bool   $recursion Internal flag that calling function was called recursively.
    398      * @param mixed  $group     Group level.
    399      * @return bool Not already in the group or a lower group
     403     * @param string    $handle    Name of the item. Should be unique.
     404     * @param bool      $recursion Internal flag that calling function was called recursively.
     405     * @param int|false $group     Group level: level (int), no groups (false).
     406     * @return bool Not already in the group or a lower group.
    400407     */
    401408    public function set_group( $handle, $recursion, $group ) {
  • trunk/src/wp-includes/class.wp-scripts.php

    r46661 r47170  
    176176     * @since 2.8.0 Added the `$group` parameter.
    177177     *
    178      * @param mixed     $handles Optional. Scripts to be printed. (void) prints queue, (string) prints
    179      *                           that script, (array of strings) prints those scripts. Default false.
    180      * @param int|false $group   Optional. If scripts were queued in groups prints this group number.
    181      *                           Default false.
     178     * @param string|string[]|false $handles Optional. Scripts to be printed: queue (false),
     179     *                                       single script (string), or multiple scripts (array of strings).
     180     *                                       Default false.
     181     * @param int|false             $group   Optional. Group level: level (int), no groups (false).
     182     *                                       Default false.
    182183     * @return string[] Handles of scripts that have been printed.
    183184     */
     
    196197     *
    197198     * @param string $handle The script's registered handle.
    198      * @param bool   $echo   Optional. Whether to echo the extra script instead of just returning it.
    199      *                       Default true.
    200      * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
     199     * @param bool   $echo   Optional. Whether to echo the extra script
     200     *                       instead of just returning it. Default true.
     201     * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true,
     202     *                          true otherwise.
    201203     */
    202204    public function print_scripts_l10n( $handle, $echo = true ) {
     
    211213     *
    212214     * @param string $handle The script's registered handle.
    213      * @param bool   $echo   Optional. Whether to echo the extra script instead of just returning it.
    214      *                       Default true.
    215      * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
     215     * @param bool   $echo   Optional. Whether to echo the extra script
     216     *                       instead of just returning it. Default true.
     217     * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true,
     218     *                          true otherwise.
    216219     */
    217220    public function print_extra_script( $handle, $echo = true ) {
     
    252255     *
    253256     * @param string    $handle The script's registered handle.
    254      * @param int|false $group  Optional. Group level: (int) level, (false) no groups. Default false.
     257     * @param int|false $group  Optional. Group level: level (int), no groups (false).
     258     *                          Default false.
    255259     * @return bool True on success, false on failure.
    256260     */
     
    410414     * @since 4.5.0
    411415     *
    412      * @param string $handle   Name of the script to add the inline script to. Must be lowercase.
     416     * @param string $handle   Name of the script to add the inline script to.
     417     *                         Must be lowercase.
    413418     * @param string $data     String containing the javascript to be added.
    414      * @param string $position Optional. Whether to add the inline script before the handle
    415      *                         or after. Default 'after'.
     419     * @param string $position Optional. Whether to add the inline script
     420     *                         before the handle or after. Default 'after'.
    416421     * @return bool True on success, false on failure.
    417422     */
     
    436441     * @since 4.5.0
    437442     *
    438      * @param string $handle   Name of the script to add the inline script to. Must be lowercase.
    439      * @param string $position Optional. Whether to add the inline script before the handle
    440      *                         or after. Default 'after'.
    441      * @param bool   $echo     Optional. Whether to echo the script instead of just returning it.
    442      *                         Default true.
     443     * @param string $handle   Name of the script to add the inline script to.
     444     *                         Must be lowercase.
     445     * @param string $position Optional. Whether to add the inline script
     446     *                         before the handle or after. Default 'after'.
     447     * @param bool   $echo     Optional. Whether to echo the script
     448     *                         instead of just returning it. Default true.
    443449     * @return string|false Script on success, false otherwise.
    444450     */
     
    511517     * @param string    $handle    Name of the item. Should be unique.
    512518     * @param bool      $recursion Internal flag that calling function was called recursively.
    513      * @param int|false $group     Optional. Group level: (int) level, (false) no groups. Default false.
    514      * @return bool Not already in the group or a lower group
     519     * @param int|false $group     Optional. Group level: level (int), no groups (false).
     520     *                             Default false.
     521     * @return bool Not already in the group or a lower group.
    515522     */
    516523    public function set_group( $handle, $recursion, $group = false ) {
     
    559566     * @since 5.0.0
    560567     *
    561      * @param string $handle Name of the script to add the inline script to. Must be lowercase.
    562      * @param bool   $echo   Optional. Whether to echo the script instead of just returning it.
    563      *                       Default true.
     568     * @param string $handle Name of the script to add the inline script to.
     569     *                       Must be lowercase.
     570     * @param bool   $echo   Optional. Whether to echo the script
     571     *                       instead of just returning it. Default true.
    564572     * @return string|false Script on success, false otherwise.
    565573     */
     
    601609     * @see WP_Dependencies::all_deps()
    602610     *
    603      * @param mixed     $handles   Item handle and argument (string) or item handles and arguments (array of strings).
    604      * @param bool      $recursion Internal flag that function is calling itself.
    605      * @param int|false $group     Optional. Group level: (int) level, (false) no groups. Default false.
     611     * @param string|string[] $handles   Item handle (string) or item handles (array of strings).
     612     * @param bool            $recursion Optional. Internal flag that function is calling itself.
     613     *                                   Default false.
     614     * @param int|false       $group     Optional. Group level: level (int), no groups (false).
     615     *                                   Default false.
    606616     * @return bool True on success, false on failure.
    607617     */
  • trunk/src/wp-includes/class.wp-styles.php

    r46661 r47170  
    323323     *
    324324     * @param string $handle The style's registered handle.
    325      * @param bool   $echo   Optional. Whether to echo the inline style instead of just returning it.
    326      *                       Default true.
    327      * @return string|bool False if no data exists, inline styles if `$echo` is true, true otherwise.
     325     * @param bool   $echo   Optional. Whether to echo the inline style
     326     *                       instead of just returning it. Default true.
     327     * @return string|bool False if no data exists, inline styles if `$echo` is true,
     328     *                     true otherwise.
    328329     */
    329330    public function print_inline_style( $handle, $echo = true ) {
     
    357358     * @see WP_Dependencies::all_deps()
    358359     *
    359      * @param string|string[] $handles   Item handle and argument (string) or item handles and arguments (array of strings).
    360      * @param bool            $recursion Internal flag that function is calling itself.
    361      * @param int|false       $group     Group level: (int) level, (false) no groups.
     360     * @param string|string[] $handles   Item handle (string) or item handles (array of strings).
     361     * @param bool            $recursion Optional. Internal flag that function is calling itself.
     362     *                                   Default false.
     363     * @param int|false       $group     Optional. Group level: level (int), no groups (false).
     364     *                                   Default false.
    362365     * @return bool True on success, false on failure.
    363366     */
     
    382385     * @since 2.6.0
    383386     *
    384      * @param string $src The source of the enqueued style.
    385      * @param string $ver The version of the enqueued style.
     387     * @param string $src    The source of the enqueued style.
     388     * @param string $ver    The version of the enqueued style.
    386389     * @param string $handle The style's registered handle.
    387390     * @return string Style's fully-qualified URL.
  • trunk/src/wp-includes/l10n.php

    r47060 r47170  
    927927 * @param string $domain Optional. Text domain. Default 'default'.
    928928 * @param string $path   Optional. The full file path to the directory containing translation files.
    929  *
    930929 * @return string|false False if the script textdomain could not be loaded, the translated strings
    931930 *                      in JSON encoding otherwise.
Note: See TracChangeset for help on using the changeset viewer.