wp/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php	Wed Sep 21 18:19:35 2022 +0200
@@ -209,6 +209,8 @@
 	 * @return true|WP_Error True if can read, a WP_Error instance otherwise.
 	 */
 	protected function check_read_permission( $plugin ) {
+		require_once ABSPATH . 'wp-admin/includes/plugin.php';
+
 		if ( ! $this->is_plugin_installed( $plugin ) ) {
 			return new WP_Error( 'rest_plugin_not_found', __( 'Plugin not found.' ), array( 'status' => 404 ) );
 		}
@@ -584,7 +586,7 @@
 		$response->add_links( $this->prepare_links( $item ) );
 
 		/**
-		 * Filters the plugin data for a response.
+		 * Filters plugin data for a REST API response.
 		 *
 		 * @since 5.5.0
 		 *
@@ -660,7 +662,6 @@
 	 * @param string $plugin         The plugin file to update.
 	 * @param string $new_status     The plugin's new status.
 	 * @param string $current_status The plugin's current status.
-	 *
 	 * @return true|WP_Error
 	 */
 	protected function plugin_status_permission_check( $plugin, $new_status, $current_status ) {
@@ -770,7 +771,6 @@
 	 *
 	 * @param WP_REST_Request $request The request to require the plugin matches against.
 	 * @param array           $item    The plugin item.
-	 *
 	 * @return bool
 	 */
 	protected function does_plugin_match_request( $request, $item ) {