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

See #49572

git-svn-id: https://develop.svn.wordpress.org/trunk@48473 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2020-07-14 11:54:26 +00:00
parent 585f623b4d
commit fa9e258750
10 changed files with 60 additions and 60 deletions

View File

@@ -204,7 +204,7 @@ class WP_Customize_Control {
* 'textarea', 'radio', 'select', and 'dropdown-pages'. Additional
* input types such as 'email', 'url', 'number', 'hidden', and
* 'date' are supported implicitly. Default 'text'.
* @type callback $active_callback Active callback.
* @type callable $active_callback Active callback.
* }
*/
public function __construct( $manager, $id, $args = array() ) {

View File

@@ -97,7 +97,7 @@ class WP_Customize_Setting {
* Callback to convert a Customize PHP setting value to a value that is JSON serializable.
*
* @since 3.4.0
* @var string
* @var callable
*/
public $sanitize_js_callback = '';

View File

@@ -2007,22 +2007,22 @@ function comment_form_title( $noreplytext = false, $replytext = false, $linktopa
* @param string|array $args {
* Optional. Formatting options.
*
* @type object $walker Instance of a Walker class to list comments. Default null.
* @type int $max_depth The maximum comments depth. Default empty.
* @type string $style The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
* @type string $callback Callback function to use. Default null.
* @type string $end-callback Callback function to use at the end. Default null.
* @type string $type Type of comments to list.
* Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
* @type int $page Page ID to list comments for. Default empty.
* @type int $per_page Number of comments to list per page. Default empty.
* @type int $avatar_size Height and width dimensions of the avatar size. Default 32.
* @type bool $reverse_top_level Ordering of the listed comments. If true, will display newest comments first.
* @type bool $reverse_children Whether to reverse child comments in the list. Default null.
* @type string $format How to format the comments list.
* Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
* @type bool $short_ping Whether to output short pings. Default false.
* @type bool $echo Whether to echo the output or return it. Default true.
* @type object $walker Instance of a Walker class to list comments. Default null.
* @type int $max_depth The maximum comments depth. Default empty.
* @type string $style The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
* @type callable $callback Callback function to use. Default null.
* @type callable $end-callback Callback function to use at the end. Default null.
* @type string $type Type of comments to list.
* Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
* @type int $page Page ID to list comments for. Default empty.
* @type int $per_page Number of comments to list per page. Default empty.
* @type int $avatar_size Height and width dimensions of the avatar size. Default 32.
* @type bool $reverse_top_level Ordering of the listed comments. If true, will display newest comments first.
* @type bool $reverse_children Whether to reverse child comments in the list. Default null.
* @type string $format How to format the comments list.
* Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
* @type bool $short_ping Whether to output short pings. Default false.
* @type bool $echo Whether to echo the output or return it. Default true.
* }
* @param WP_Comment[] $comments Optional. Array of WP_Comment objects.
* @return void|string Void if 'echo' argument is true, or no comments to list.

View File

@@ -4149,7 +4149,7 @@ function wp_send_json_error( $data = null, $status_code = null ) {
}
/**
* Checks that a JSONP callback is a valid JavaScript callback.
* Checks that a JSONP callback is a valid JavaScript callback name.
*
* Only allows alphanumeric characters and the dot character in callback
* function names. This helps to mitigate XSS attacks caused by directly
@@ -4157,8 +4157,8 @@ function wp_send_json_error( $data = null, $status_code = null ) {
*
* @since 4.6.0
*
* @param string $callback Supplied JSONP callback function.
* @return bool True if valid callback, otherwise false.
* @param string $callback Supplied JSONP callback function name.
* @return bool Whether the callback function name is valid.
*/
function wp_check_jsonp_callback( $callback ) {
if ( ! is_string( $callback ) ) {

View File

@@ -1240,8 +1240,8 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
* When using a non-single meta key, the default value is for the first entry.
* In other words, when calling get_metadata() with `$single` set to `false`,
* the default value given here will be wrapped in an array.
* @type string $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
* @type string $auth_callback Optional. A function or method to call when performing edit_post_meta,
* @type callable $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
* @type callable $auth_callback Optional. A function or method to call when performing edit_post_meta,
* add_post_meta, and delete_post_meta capability checks.
* @type bool|array $show_in_rest Whether data associated with this meta key can be considered public and
* should be accessible via the REST API. A custom post type must also declare

View File

@@ -787,16 +787,16 @@ function dynamic_sidebar( $index = 1 ) {
* @param array $widget_id {
* An associative array of widget arguments.
*
* @type string $name Name of the widget.
* @type string $id Widget ID.
* @type array|callable $callback When the hook is fired on the front end, $callback is an array
* containing the widget object. Fired on the back end, $callback
* is 'wp_widget_control', see $_callback.
* @type array $params An associative array of multi-widget arguments.
* @type string $classname CSS class applied to the widget container.
* @type string $description The widget description.
* @type array $_callback When the hook is fired on the back end, $_callback is populated
* with an array containing the widget object, see $callback.
* @type string $name Name of the widget.
* @type string $id Widget ID.
* @type callable $callback When the hook is fired on the front end, $callback is an array
* containing the widget object. Fired on the back end, $callback
* is 'wp_widget_control', see $_callback.
* @type array $params An associative array of multi-widget arguments.
* @type string $classname CSS class applied to the widget container.
* @type string $description The widget description.
* @type array $_callback When the hook is fired on the back end, $_callback is populated
* with an array containing the widget object, see $callback.
* }
*/
do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] );
@@ -857,10 +857,10 @@ function dynamic_sidebar( $index = 1 ) {
*
* @global array $wp_registered_widgets
*
* @param string|false $callback Optional, Widget callback to check. Default false.
* @param int|false $widget_id Optional. Widget ID. Optional, but needed for checking. Default false.
* @param string|false $id_base Optional. The base ID of a widget created by extending WP_Widget. Default false.
* @param bool $skip_inactive Optional. Whether to check in 'wp_inactive_widgets'. Default true.
* @param callable|false $callback Optional, Widget callback to check. Default false.
* @param int|false $widget_id Optional. Widget ID. Optional, but needed for checking. Default false.
* @param string|false $id_base Optional. The base ID of a widget created by extending WP_Widget. Default false.
* @param bool $skip_inactive Optional. Whether to check in 'wp_inactive_widgets'. Default true.
* @return string|false False if widget is not active or id of sidebar in which the widget is active.
*/
function is_active_widget( $callback = false, $widget_id = false, $id_base = false, $skip_inactive = true ) {