| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Plugins_Controller class
| File Size: | 1004 lines (29 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 4 files wp-admin/includes/class-wp-upgrader.php wp-admin/includes/plugin-install.php wp-admin/includes/file.php wp-admin/includes/plugin.php |
WP_REST_Plugins_Controller:: (26 methods):
__construct()
register_routes()
get_items_permissions_check()
get_items()
get_item_permissions_check()
get_item()
check_read_permission()
create_item_permissions_check()
create_item()
update_item_permissions_check()
update_item()
delete_item_permissions_check()
delete_item()
prepare_item_for_response()
prepare_links()
get_plugin_data()
get_plugin_status()
plugin_status_permission_check()
handle_plugin_status()
validate_plugin_param()
sanitize_plugin_param()
does_plugin_match_request()
is_plugin_installed()
is_filesystem_available()
get_item_schema()
get_collection_params()
Class: WP_REST_Plugins_Controller - X-Ref
Core class to access plugins via the REST API.| __construct() X-Ref |
| Plugins controller constructor. |
| register_routes() X-Ref |
| Registers the routes for the plugins controller. |
| get_items_permissions_check( $request ) X-Ref |
| Checks if a given request has access to get plugins. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has read access, WP_Error object otherwise. |
| get_items( $request ) X-Ref |
| Retrieves a collection of plugins. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| get_item_permissions_check( $request ) X-Ref |
| Checks if a given request has access to get a specific plugin. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise. |
| get_item( $request ) X-Ref |
| Retrieves one plugin from the site. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| check_read_permission( $plugin ) X-Ref |
| Checks if the given plugin can be viewed by the current user. On multisite, this hides non-active network only plugins if the user does not have permission to manage network plugins. param: string $plugin The plugin file to check. return: true|WP_Error True if can read, a WP_Error instance otherwise. |
| create_item_permissions_check( $request ) X-Ref |
| Checks if a given request has access to upload plugins. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has access to create items, WP_Error object otherwise. |
| create_item( $request ) X-Ref |
| Uploads a plugin and optionally activates it. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| update_item_permissions_check( $request ) X-Ref |
| No description |
| update_item( $request ) X-Ref |
| Updates one plugin. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| delete_item_permissions_check( $request ) X-Ref |
| Checks if a given request has access to delete a specific plugin. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has access to delete the item, WP_Error object otherwise. |
| delete_item( $request ) X-Ref |
| Deletes one plugin from the site. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| prepare_item_for_response( $item, $request ) X-Ref |
| Prepares the plugin for the REST response. param: array $item Unmarked up and untranslated plugin data from {@see get_plugin_data()}. param: WP_REST_Request $request Request object. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| prepare_links( $item ) X-Ref |
| Prepares links for the request. param: array $item The plugin item. return: array[] |
| get_plugin_data( $plugin ) X-Ref |
| Gets the plugin header data for a plugin. param: string $plugin The plugin file to get data for. return: array|WP_Error The plugin data, or a WP_Error if the plugin is not installed. |
| get_plugin_status( $plugin ) X-Ref |
| Get's the activation status for a plugin. param: string $plugin The plugin file to check. return: string Either 'network-active', 'active' or 'inactive'. |
| plugin_status_permission_check( $plugin, $new_status, $current_status ) X-Ref |
| Handle updating a plugin's status. 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 |
| handle_plugin_status( $plugin, $new_status, $current_status ) X-Ref |
| Handle updating a plugin's status. 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 |
| validate_plugin_param( $file ) X-Ref |
| Checks that the "plugin" parameter is a valid path. param: string $file The plugin file parameter. return: bool |
| sanitize_plugin_param( $file ) X-Ref |
| Sanitizes the "plugin" parameter to be a proper plugin file with ".php" appended. param: string $file The plugin file parameter. return: string |
| does_plugin_match_request( $request, $item ) X-Ref |
| Checks if the plugin matches the requested parameters. param: WP_REST_Request $request The request to require the plugin matches against. param: array $item The plugin item. return: bool |
| is_plugin_installed( $plugin ) X-Ref |
| Checks if the plugin is installed. param: string $plugin The plugin file. return: bool |
| is_filesystem_available() X-Ref |
| Determine if the endpoints are available. Only the 'Direct' filesystem transport, and SSH/FTP when credentials are stored are supported at present. return: true|WP_Error True if filesystem is available, WP_Error otherwise. |
| get_item_schema() X-Ref |
| Retrieves the plugin's schema, conforming to JSON Schema. return: array Item schema data. |
| get_collection_params() X-Ref |
| Retrieves the query params for the collections. return: array Query parameters for the collection. |
| Generated : Sat Apr 25 08:20:11 2026 | Cross-referenced by PHPXref |