diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
commit | 30883c26bdceb9eaf32c8d4a1b0c1bce223b5226 (patch) | |
tree | 39a02e2aeb21ab5b7923c6f5757d66d55b708912 /wp-includes/rest-api/search | |
parent | Adding upstream version 6.4.3+dfsg1. (diff) | |
download | wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.tar.xz wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.zip |
Adding upstream version 6.5+dfsg1.upstream/6.5+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/rest-api/search')
3 files changed, 50 insertions, 23 deletions
diff --git a/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php b/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php index b219281..8d815b1 100644 --- a/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php +++ b/wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php @@ -26,14 +26,17 @@ class WP_REST_Post_Format_Search_Handler extends WP_REST_Search_Handler { } /** - * Searches the object type content for a given search request. + * Searches the post formats for a given search request. * * @since 5.6.0 * * @param WP_REST_Request $request Full REST request. - * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing - * an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the - * total count for the matching search results. + * @return array { + * Associative array containing found IDs and total count for the matching search results. + * + * @type string[] $ids Array containing slugs for the matching post formats. + * @type int $total Total count for the matching search results. + * } */ public function search_items( WP_REST_Request $request ) { $format_strings = get_post_format_strings(); @@ -46,7 +49,7 @@ class WP_REST_Post_Format_Search_Handler extends WP_REST_Search_Handler { } /** - * Filters the query arguments for a REST API search request. + * Filters the query arguments for a REST API post format search request. * * Enables adding extra arguments or setting defaults for a post format search request. * @@ -84,13 +87,20 @@ class WP_REST_Post_Format_Search_Handler extends WP_REST_Search_Handler { } /** - * Prepares the search result for a given ID. + * Prepares the search result for a given post format. * * @since 5.6.0 * * @param string $id Item ID, the post format slug. * @param array $fields Fields to include for the item. - * @return array Associative array containing all fields for the item. + * @return array { + * Associative array containing fields for the post format based on the `$fields` parameter. + * + * @type string $id Optional. Post format slug. + * @type string $title Optional. Post format name. + * @type string $url Optional. Post format permalink URL. + * @type string $type Optional. String 'post-format'. + *} */ public function prepare_item( $id, array $fields ) { $data = array(); diff --git a/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php b/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php index fb85fce..1d47723 100644 --- a/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php +++ b/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php @@ -40,14 +40,17 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler { } /** - * Searches the object type content for a given search request. + * Searches posts for a given search request. * * @since 5.0.0 * * @param WP_REST_Request $request Full REST request. - * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing - * an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the - * total count for the matching search results. + * @return array { + * Associative array containing found IDs and total count for the matching search results. + * + * @type int[] $ids Array containing the matching post IDs. + * @type int $total Total count for the matching search results. + * } */ public function search_items( WP_REST_Request $request ) { @@ -78,7 +81,7 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler { } /** - * Filters the query arguments for a REST API search request. + * Filters the query arguments for a REST API post search request. * * Enables adding extra arguments or setting defaults for a post search request. * @@ -102,13 +105,20 @@ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler { } /** - * Prepares the search result for a given ID. + * Prepares the search result for a given post ID. * * @since 5.0.0 * - * @param int $id Item ID. - * @param array $fields Fields to include for the item. - * @return array Associative array containing all fields for the item. + * @param int $id Post ID. + * @param array $fields Fields to include for the post. + * @return array { + * Associative array containing fields for the post based on the `$fields` parameter. + * + * @type int $id Optional. Post ID. + * @type string $title Optional. Post title. + * @type string $url Optional. Post permalink URL. + * @type string $type Optional. Post type. + * } */ public function prepare_item( $id, array $fields ) { $post = get_post( $id ); diff --git a/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php b/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php index eed35e7..6527697 100644 --- a/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php +++ b/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php @@ -36,7 +36,7 @@ class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler { } /** - * Searches the object type content for a given search request. + * Searches terms for a given search request. * * @since 5.6.0 * @@ -44,7 +44,7 @@ class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler { * @return array { * Associative array containing found IDs and total count for the matching search results. * - * @type int[] $ids Found IDs. + * @type int[] $ids Found term IDs. * @type string|int|WP_Error $total Numeric string containing the number of terms in that * taxonomy, 0 if there are no results, or WP_Error if * the requested taxonomy does not exist. @@ -79,7 +79,7 @@ class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler { } /** - * Filters the query arguments for a REST API search request. + * Filters the query arguments for a REST API term search request. * * Enables adding extra arguments or setting defaults for a term search request. * @@ -110,13 +110,20 @@ class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler { } /** - * Prepares the search result for a given ID. + * Prepares the search result for a given term ID. * * @since 5.6.0 * - * @param int $id Item ID. - * @param array $fields Fields to include for the item. - * @return array Associative array containing all fields for the item. + * @param int $id Term ID. + * @param array $fields Fields to include for the term. + * @return array { + * Associative array containing fields for the term based on the `$fields` parameter. + * + * @type int $id Optional. Term ID. + * @type string $title Optional. Term name. + * @type string $url Optional. Term permalink URL. + * @type string $type Optional. Term taxonomy name. + * } */ public function prepare_item( $id, array $fields ) { $term = get_term( $id ); |