← All changes
|
json-endpoints/jetpack/class.jetpack-json-api-plugins-get-endpoint.php
+49
-0
16.2-beta
→
16.3
View file →
| @@ -1,0 +1,49 @@ | ||
| 1 | +<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName | |
| 2 | + | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit( 0 ); | |
| 5 | +} | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * JSON API plugins get endpoint. | |
| 9 | + */ | |
| 10 | +new Jetpack_JSON_API_Plugins_Get_Endpoint( | |
| 11 | + array( | |
| 12 | + 'description' => 'Get the Plugin data.', | |
| 13 | + 'method' => 'GET', | |
| 14 | + 'path' => '/sites/%s/plugins/%s/', | |
| 15 | + 'min_version' => '1', | |
| 16 | + 'max_version' => '1.1', | |
| 17 | + 'stat' => 'plugins:1', | |
| 18 | + 'path_labels' => array( | |
| 19 | + '$site' => '(int|string) The site ID, The site domain', | |
| 20 | + '$plugin' => '(string) The plugin ID', | |
| 21 | + ), | |
| 22 | + 'allow_jetpack_site_auth' => true, | |
| 23 | + 'response_format' => Jetpack_JSON_API_Plugins_Endpoint::$_response_format, | |
| 24 | + 'example_request_data' => array( | |
| 25 | + 'headers' => array( | |
| 26 | + 'authorization' => 'Bearer YOUR_API_TOKEN', | |
| 27 | + ), | |
| 28 | + ), | |
| 29 | + 'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/example.wordpress.org/plugins/hello-dolly%20hello', | |
| 30 | + ) | |
| 31 | +); | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * Plugins get endpoint class. | |
| 35 | + * | |
| 36 | + * GET /sites/%s/plugins/%s | |
| 37 | + * | |
| 38 | + * No v1.2 version since it is .com only | |
| 39 | + * | |
| 40 | + * @phan-constructor-used-for-side-effects | |
| 41 | + */ | |
| 42 | +class Jetpack_JSON_API_Plugins_Get_Endpoint extends Jetpack_JSON_API_Plugins_Endpoint { | |
| 43 | + /** | |
| 44 | + * Needed capabilities. | |
| 45 | + * | |
| 46 | + * @var string | |
| 47 | + */ | |
| 48 | + protected $needed_capabilities = 'activate_plugins'; | |
| 49 | +} | |