diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php --- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php Wed Sep 21 18:19:35 2022 +0200 @@ -49,8 +49,7 @@ * @since 5.5.0 * * @param WP_REST_Request $request Full details about the request. - * - * @return WP_Error|bool True if the request has permission, WP_Error object otherwise. + * @return true|WP_Error True if the request has permission, WP_Error object otherwise. */ public function get_items_permissions_check( $request ) { if ( ! current_user_can( 'install_plugins' ) || ! current_user_can( 'activate_plugins' ) ) { @@ -70,8 +69,7 @@ * @since 5.5.0 * * @param WP_REST_Request $request Full details about the request. - * - * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_items( $request ) { require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; @@ -114,8 +112,7 @@ * * @param array $plugin The plugin metadata. * @param WP_REST_Request $request Request object. - * - * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. + * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $plugin, $request ) { // There might be multiple blocks in a plugin. Only the first block is mapped. @@ -125,13 +122,13 @@ $block = array( 'name' => $block_data['name'], 'title' => ( $block_data['title'] ? $block_data['title'] : $plugin['name'] ), - 'description' => wp_trim_words( $plugin['description'], 30, '...' ), + 'description' => wp_trim_words( $plugin['short_description'], 30, '...' ), 'id' => $plugin['slug'], 'rating' => $plugin['rating'] / 20, - 'rating_count' => intval( $plugin['num_ratings'] ), - 'active_installs' => intval( $plugin['active_installs'] ), + 'rating_count' => (int) $plugin['num_ratings'], + 'active_installs' => (int) $plugin['active_installs'], 'author_block_rating' => $plugin['author_block_rating'] / 20, - 'author_block_count' => intval( $plugin['author_block_count'] ), + 'author_block_count' => (int) $plugin['author_block_count'], 'author' => wp_strip_all_tags( $plugin['author'] ), 'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ), 'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ), @@ -156,7 +153,6 @@ * @since 5.5.0 * * @param array $plugin The plugin data from WordPress.org. - * * @return array */ protected function prepare_links( $plugin ) { @@ -184,7 +180,6 @@ * @since 5.5.0 * * @param string $slug The WordPress.org directory slug for a plugin. - * * @return string The plugin file found matching it. */ protected function find_plugin_for_slug( $slug ) { @@ -313,7 +308,7 @@ unset( $query_params['search'] ); /** - * Filter collection parameters for the block directory controller. + * Filters REST API collection parameters for the block directory controller. * * @since 5.5.0 *