[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-plugins-controller.php (summary)

REST API: WP_REST_Plugins_Controller class

File Size: 992 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

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.

since: 5.5.0

register_routes()   X-Ref
Registers the routes for the plugins controller.

since: 5.5.0

get_items_permissions_check( $request )   X-Ref
Checks if a given request has access to get plugins.

return: true|WP_Error True if the request has read access, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

get_items( $request )   X-Ref
Retrieves a collection of plugins.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to get a specific plugin.

return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

get_item( $request )   X-Ref
Retrieves one plugin from the site.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

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.

return: true|WP_Error True if can read, a WP_Error instance otherwise.
param: string $plugin The plugin file to check.
since: 5.5.0

create_item_permissions_check( $request )   X-Ref
Checks if a given request has access to upload plugins.

return: true|WP_Error True if the request has access to create items, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

create_item( $request )   X-Ref
Uploads a plugin and optionally activates it.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

update_item_permissions_check( $request )   X-Ref
No description

update_item( $request )   X-Ref
Updates one plugin.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

delete_item_permissions_check( $request )   X-Ref
Checks if a given request has access to delete a specific plugin.

return: true|WP_Error True if the request has access to delete the item, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

delete_item( $request )   X-Ref
Deletes one plugin from the site.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.
since: 5.5.0

prepare_item_for_response( $item, $request )   X-Ref
Prepares the plugin for the REST response.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: mixed           $item    Unmarked up and untranslated plugin data from {@see get_plugin_data()}.
param: WP_REST_Request $request Request object.
since: 5.5.0

prepare_links( $item )   X-Ref
Prepares links for the request.

return: array[]
param: array $item The plugin item.
since: 5.5.0

get_plugin_data( $plugin )   X-Ref
Gets the plugin header data for a plugin.

return: array|WP_Error The plugin data, or a WP_Error if the plugin is not installed.
param: string $plugin The plugin file to get data for.
since: 5.5.0

get_plugin_status( $plugin )   X-Ref
Get's the activation status for a plugin.

return: string Either 'network-active', 'active' or 'inactive'.
param: string $plugin The plugin file to check.
since: 5.5.0

plugin_status_permission_check( $plugin, $new_status, $current_status )   X-Ref
Handle updating a plugin's status.

return: true|WP_Error
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.
since: 5.5.0

handle_plugin_status( $plugin, $new_status, $current_status )   X-Ref
Handle updating a plugin's status.

return: true|WP_Error
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.
since: 5.5.0

validate_plugin_param( $file )   X-Ref
Checks that the "plugin" parameter is a valid path.

return: bool
param: string $file The plugin file parameter.
since: 5.5.0

sanitize_plugin_param( $file )   X-Ref
Sanitizes the "plugin" parameter to be a proper plugin file with ".php" appended.

return: string
param: string $file The plugin file parameter.
since: 5.5.0

does_plugin_match_request( $request, $item )   X-Ref
Checks if the plugin matches the requested parameters.

return: bool
param: WP_REST_Request $request The request to require the plugin matches against.
param: array           $item    The plugin item.
since: 5.5.0

is_plugin_installed( $plugin )   X-Ref
Checks if the plugin is installed.

return: bool
param: string $plugin The plugin file.
since: 5.5.0

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.
since: 5.5.0

get_item_schema()   X-Ref
Retrieves the plugin's schema, conforming to JSON Schema.

return: array Item schema data.
since: 5.5.0

get_collection_params()   X-Ref
Retrieves the query params for the collections.

return: array Query parameters for the collection.
since: 5.5.0



Generated: Thu Mar 28 01:00:02 2024 Cross-referenced by PHPXref 0.7.1