Make WordPress Core

Changeset 48473


Ignore:
Timestamp:
07/14/2020 11:54:26 AM (3 years ago)
Author:
johnbillion
Message:

Docs: Correct and improve inline docs for parameters that accept a callback function.

See #49572

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r48446 r48473  
    47794779     *         Array of personal data exporters.
    47804780     *
    4781      *         @type string $callback               Callable exporter function that accepts an
    4782      *                                              email address and a page and returns an array
    4783      *                                              of name => value pairs of personal data.
    4784      *         @type string $exporter_friendly_name Translated user facing friendly name for the
    4785      *                                              exporter.
     4781     *         @type callable $callback               Callable exporter function that accepts an
     4782     *                                                email address and a page and returns an array
     4783     *                                                of name => value pairs of personal data.
     4784     *         @type string   $exporter_friendly_name Translated user facing friendly name for the
     4785     *                                                exporter.
    47864786     *     }
    47874787     * }
     
    49694969     *         Array of personal data exporters.
    49704970     *
    4971      *         @type string $callback               Callable eraser that accepts an email address and
    4972      *                                              a page and returns an array with boolean values for
    4973      *                                              whether items were removed or retained and any messages
    4974      *                                              from the eraser, as well as if additional pages are
    4975      *                                              available.
    4976      *         @type string $exporter_friendly_name Translated user facing friendly name for the eraser.
     4971     *         @type callable $callback               Callable eraser that accepts an email address and
     4972     *                                                a page and returns an array with boolean values for
     4973     *                                                whether items were removed or retained and any messages
     4974     *                                                from the eraser, as well as if additional pages are
     4975     *                                                available.
     4976     *         @type string   $exporter_friendly_name Translated user facing friendly name for the eraser.
    49774977     *     }
    49784978     * }
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r48450 r48473  
    621621     *     Array of arguments used to display the help tab.
    622622     *
    623      *     @type string $title    Title for the tab. Default false.
    624      *     @type string $id       Tab ID. Must be HTML-safe and should be unique for this menu.
    625      *                            It is NOT allowed to contain any empty spaces. Default false.
    626      *     @type string $content  Optional. Help tab content in plain text or HTML. Default empty string.
    627      *     @type string $callback Optional. A callback to generate the tab content. Default false.
    628      *     @type int    $priority Optional. The priority of the tab, used for ordering. Default 10.
     623     *     @type string   $title    Title for the tab. Default false.
     624     *     @type string   $id       Tab ID. Must be HTML-safe and should be unique for this menu.
     625     *                              It is NOT allowed to contain any empty spaces. Default false.
     626     *     @type string   $content  Optional. Help tab content in plain text or HTML. Default empty string.
     627     *     @type callable $callback Optional. A callback to generate the tab content. Default false.
     628     *     @type int      $priority Optional. The priority of the tab, used for ordering. Default 10.
    629629     * }
    630630     */
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r48287 r48473  
    148148     * @since 5.4.0
    149149     *
    150      * @param $callback
     150     * @param callable $callback
    151151     * @return mixed|void
    152152     */
  • trunk/src/wp-admin/includes/nav-menu.php

    r48100 r48473  
    333333 *     @type string       $id       Meta box 'id' attribute.
    334334 *     @type string       $title    Meta box title.
    335  *     @type string       $callback Meta box display callback.
     335 *     @type callable     $callback Meta box display callback.
    336336 *     @type WP_Post_Type $args     Extra meta box arguments (the post type object for this meta box).
    337337 * }
     
    685685 *     Taxonomy menu item meta box arguments.
    686686 *
    687  *     @type string $id       Meta box 'id' attribute.
    688  *     @type string $title    Meta box title.
    689  *     @type string $callback Meta box display callback.
    690  *     @type object $args     Extra meta box arguments (the taxonomy object for this meta box).
     687 *     @type string   $id       Meta box 'id' attribute.
     688 *     @type string   $title    Meta box title.
     689 *     @type callable $callback Meta box display callback.
     690 *     @type object   $args     Extra meta box arguments (the taxonomy object for this meta box).
    691691 * }
    692692 */
  • trunk/src/wp-includes/class-wp-customize-control.php

    r47384 r48473  
    205205     *                                                 input types such as 'email', 'url', 'number', 'hidden', and
    206206     *                                                 'date' are supported implicitly. Default 'text'.
    207      *     @type callback             $active_callback Active callback.
     207     *     @type callable             $active_callback Active callback.
    208208     * }
    209209     */
  • trunk/src/wp-includes/class-wp-customize-setting.php

    r48197 r48473  
    9898     *
    9999     * @since 3.4.0
    100      * @var string
     100     * @var callable
    101101     */
    102102    public $sanitize_js_callback = '';
  • trunk/src/wp-includes/comment-template.php

    r48457 r48473  
    20082008 *     Optional. Formatting options.
    20092009 *
    2010  *     @type object $walker            Instance of a Walker class to list comments. Default null.
    2011  *     @type int    $max_depth         The maximum comments depth. Default empty.
    2012  *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
    2013  *     @type string $callback          Callback function to use. Default null.
    2014  *     @type string $end-callback      Callback function to use at the end. Default null.
    2015  *     @type string $type              Type of comments to list.
    2016  *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
    2017  *     @type int    $page              Page ID to list comments for. Default empty.
    2018  *     @type int    $per_page          Number of comments to list per page. Default empty.
    2019  *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
    2020  *     @type bool   $reverse_top_level Ordering of the listed comments. If true, will display newest comments first.
    2021  *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
    2022  *     @type string $format            How to format the comments list.
    2023  *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
    2024  *     @type bool   $short_ping        Whether to output short pings. Default false.
    2025  *     @type bool   $echo              Whether to echo the output or return it. Default true.
     2010 *     @type object   $walker            Instance of a Walker class to list comments. Default null.
     2011 *     @type int      $max_depth         The maximum comments depth. Default empty.
     2012 *     @type string   $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
     2013 *     @type callable $callback          Callback function to use. Default null.
     2014 *     @type callable $end-callback      Callback function to use at the end. Default null.
     2015 *     @type string   $type              Type of comments to list.
     2016 *                                       Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
     2017 *     @type int      $page              Page ID to list comments for. Default empty.
     2018 *     @type int      $per_page          Number of comments to list per page. Default empty.
     2019 *     @type int      $avatar_size       Height and width dimensions of the avatar size. Default 32.
     2020 *     @type bool     $reverse_top_level Ordering of the listed comments. If true, will display newest comments first.
     2021 *     @type bool     $reverse_children  Whether to reverse child comments in the list. Default null.
     2022 *     @type string   $format            How to format the comments list.
     2023 *                                       Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
     2024 *     @type bool     $short_ping        Whether to output short pings. Default false.
     2025 *     @type bool     $echo              Whether to echo the output or return it. Default true.
    20262026 * }
    20272027 * @param WP_Comment[] $comments Optional. Array of WP_Comment objects.
  • trunk/src/wp-includes/functions.php

    r48440 r48473  
    41504150
    41514151/**
    4152  * Checks that a JSONP callback is a valid JavaScript callback.
     4152 * Checks that a JSONP callback is a valid JavaScript callback name.
    41534153 *
    41544154 * Only allows alphanumeric characters and the dot character in callback
     
    41584158 * @since 4.6.0
    41594159 *
    4160  * @param string $callback Supplied JSONP callback function.
    4161  * @return bool True if valid callback, otherwise false.
     4160 * @param string $callback Supplied JSONP callback function name.
     4161 * @return bool Whether the callback function name is valid.
    41624162 */
    41634163function wp_check_jsonp_callback( $callback ) {
  • trunk/src/wp-includes/meta.php

    r48411 r48473  
    12411241 *                                         In other words, when calling get_metadata() with `$single` set to `false`,
    12421242 *                                         the default value given here will be wrapped in an array.
    1243  *     @type string     $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
    1244  *     @type string     $auth_callback     Optional. A function or method to call when performing edit_post_meta,
     1243 *     @type callable   $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
     1244 *     @type callable   $auth_callback     Optional. A function or method to call when performing edit_post_meta,
    12451245 *                                         add_post_meta, and delete_post_meta capability checks.
    12461246 *     @type bool|array $show_in_rest      Whether data associated with this meta key can be considered public and
  • trunk/src/wp-includes/widgets.php

    r48408 r48473  
    788788         *     An associative array of widget arguments.
    789789         *
    790          *     @type string $name                Name of the widget.
    791          *     @type string $id                  Widget ID.
    792          *     @type array|callable $callback    When the hook is fired on the front end, $callback is an array
    793          *                                       containing the widget object. Fired on the back end, $callback
    794          *                                       is 'wp_widget_control', see $_callback.
    795          *     @type array          $params      An associative array of multi-widget arguments.
    796          *     @type string         $classname   CSS class applied to the widget container.
    797          *     @type string         $description The widget description.
    798          *     @type array          $_callback   When the hook is fired on the back end, $_callback is populated
    799          *                                       with an array containing the widget object, see $callback.
     790         *     @type string   $name        Name of the widget.
     791         *     @type string   $id          Widget ID.
     792         *     @type callable $callback    When the hook is fired on the front end, $callback is an array
     793         *                                 containing the widget object. Fired on the back end, $callback
     794         *                                 is 'wp_widget_control', see $_callback.
     795         *     @type array    $params      An associative array of multi-widget arguments.
     796         *     @type string   $classname   CSS class applied to the widget container.
     797         *     @type string   $description The widget description.
     798         *     @type array    $_callback   When the hook is fired on the back end, $_callback is populated
     799         *                                 with an array containing the widget object, see $callback.
    800800         * }
    801801         */
     
    858858 * @global array $wp_registered_widgets
    859859 *
    860  * @param string|false $callback      Optional, Widget callback to check. Default false.
    861  * @param int|false    $widget_id     Optional. Widget ID. Optional, but needed for checking. Default false.
    862  * @param string|false $id_base       Optional. The base ID of a widget created by extending WP_Widget. Default false.
    863  * @param bool         $skip_inactive Optional. Whether to check in 'wp_inactive_widgets'. Default true.
     860 * @param callable|false $callback      Optional, Widget callback to check. Default false.
     861 * @param int|false      $widget_id     Optional. Widget ID. Optional, but needed for checking. Default false.
     862 * @param string|false   $id_base       Optional. The base ID of a widget created by extending WP_Widget. Default false.
     863 * @param bool           $skip_inactive Optional. Whether to check in 'wp_inactive_widgets'. Default true.
    864864 * @return string|false False if widget is not active or id of sidebar in which the widget is active.
    865865 */
Note: See TracChangeset for help on using the changeset viewer.