business-hours.php
4 years ago
class-wpcom-rest-api-v2-endpoint-admin-color.php
2 years ago
class-wpcom-rest-api-v2-endpoint-admin-menu.php
1 year ago
class-wpcom-rest-api-v2-endpoint-ai.php
2 years ago
class-wpcom-rest-api-v2-endpoint-app-media.php
2 years ago
class-wpcom-rest-api-v2-endpoint-blog-stats.php
2 years ago
class-wpcom-rest-api-v2-endpoint-email-preview.php
1 year ago
class-wpcom-rest-api-v2-endpoint-external-media.php
1 year ago
class-wpcom-rest-api-v2-endpoint-following.php
2 years ago
class-wpcom-rest-api-v2-endpoint-goodreads.php
2 years ago
class-wpcom-rest-api-v2-endpoint-google-docs.php
4 years ago
class-wpcom-rest-api-v2-endpoint-instagram-gallery.php
3 years ago
class-wpcom-rest-api-v2-endpoint-mailchimp.php
2 years ago
class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php
1 year ago
class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php
1 year ago
class-wpcom-rest-api-v2-endpoint-podcast-player.php
2 years ago
class-wpcom-rest-api-v2-endpoint-profile.php
2 years ago
class-wpcom-rest-api-v2-endpoint-publicize-share-post.php
1 year ago
class-wpcom-rest-api-v2-endpoint-publicize-share-status.php
1 year ago
class-wpcom-rest-api-v2-endpoint-related-posts.php
2 years ago
class-wpcom-rest-api-v2-endpoint-resolve-redirect.php
2 years ago
class-wpcom-rest-api-v2-endpoint-search.php
4 years ago
class-wpcom-rest-api-v2-endpoint-send-email-preview.php
1 year ago
class-wpcom-rest-api-v2-endpoint-template-loader.php
3 years ago
class-wpcom-rest-api-v2-endpoint-top-posts.php
2 years ago
class-wpcom-rest-api-v2-endpoint-transient.php
5 years ago
class-wpcom-rest-api-v3-endpoint-blogging-prompts.php
1 year ago
gutenberg-available-extensions.php
2 years ago
hello.php
4 years ago
memberships.php
1 year ago
publicize-connection-test-results.php
3 years ago
publicize-connections.php
1 year ago
publicize-services.php
3 years ago
service-api-keys.php
2 years ago
sites-posts-featured-media-url.php
2 years ago
subscribers.php
1 year ago
class-wpcom-rest-api-v2-endpoint-search.php
52 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Proxy endpoint for Jetpack Search |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | use Automattic\Jetpack\Search\REST_Controller; |
| 9 | |
| 10 | /** |
| 11 | * Jetpack Search: Makes authenticated requests to the site search API using blog tokens. |
| 12 | * This endpoint will only be used when trying to search private Jetpack and WordPress.com sites. |
| 13 | * |
| 14 | * @since 9.0.0 |
| 15 | */ |
| 16 | class WPCOM_REST_API_V2_Endpoint_Search extends WP_REST_Controller { |
| 17 | /** |
| 18 | * Forward request to controller in Search package. |
| 19 | * |
| 20 | * @var REST_Controller |
| 21 | */ |
| 22 | protected $controller; |
| 23 | |
| 24 | /** |
| 25 | * Constructor. |
| 26 | */ |
| 27 | public function __construct() { |
| 28 | $this->namespace = 'wpcom/v2'; |
| 29 | $this->rest_base = 'search'; |
| 30 | $this->controller = new REST_Controller( defined( 'IS_WPCOM' ) && IS_WPCOM ); |
| 31 | |
| 32 | add_action( 'rest_api_init', array( $this, 'register_routes' ) ); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Called automatically on `rest_api_init()`. |
| 37 | */ |
| 38 | public function register_routes() { |
| 39 | register_rest_route( |
| 40 | $this->namespace, |
| 41 | $this->rest_base, |
| 42 | array( |
| 43 | 'methods' => WP_REST_Server::READABLE, |
| 44 | 'callback' => array( $this->controller, 'get_search_results' ), |
| 45 | 'permission_callback' => 'is_user_logged_in', |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_Search' ); |
| 52 |