business-hours.php
1 year ago
class-wpcom-rest-api-v2-endpoint-admin-color.php
1 year ago
class-wpcom-rest-api-v2-endpoint-admin-menu.php
11 months ago
class-wpcom-rest-api-v2-endpoint-ai.php
1 year ago
class-wpcom-rest-api-v2-endpoint-app-media.php
1 year ago
class-wpcom-rest-api-v2-endpoint-block-editor-assets.php
10 months ago
class-wpcom-rest-api-v2-endpoint-blog-stats.php
1 year 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
1 year ago
class-wpcom-rest-api-v2-endpoint-goodreads.php
1 year ago
class-wpcom-rest-api-v2-endpoint-google-docs.php
1 year ago
class-wpcom-rest-api-v2-endpoint-instagram-gallery.php
1 year ago
class-wpcom-rest-api-v2-endpoint-mailchimp.php
11 months 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
1 year ago
class-wpcom-rest-api-v2-endpoint-profile.php
1 year ago
class-wpcom-rest-api-v2-endpoint-related-posts.php
1 year ago
class-wpcom-rest-api-v2-endpoint-resolve-redirect.php
1 year ago
class-wpcom-rest-api-v2-endpoint-search.php
1 year ago
class-wpcom-rest-api-v2-endpoint-send-email-preview.php
1 year ago
class-wpcom-rest-api-v2-endpoint-template-loader.php
1 year ago
class-wpcom-rest-api-v2-endpoint-top-posts.php
1 year ago
class-wpcom-rest-api-v2-endpoint-transient.php
1 year ago
class-wpcom-rest-api-v3-endpoint-blogging-prompts.php
11 months ago
class-wpcom-rest-api-v3-endpoint-jitm.php
1 year ago
gutenberg-available-extensions.php
1 year ago
hello.php
1 year ago
memberships.php
1 year ago
publicize-connection-test-results.php
1 year ago
service-api-keys.php
1 year ago
sites-posts-featured-media-url.php
1 year ago
subscribers.php
1 year ago
class-wpcom-rest-api-v2-endpoint-search.php
56 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 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit( 0 ); |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Jetpack Search: Makes authenticated requests to the site search API using blog tokens. |
| 16 | * This endpoint will only be used when trying to search private Jetpack and WordPress.com sites. |
| 17 | * |
| 18 | * @since 9.0.0 |
| 19 | */ |
| 20 | class WPCOM_REST_API_V2_Endpoint_Search extends WP_REST_Controller { |
| 21 | /** |
| 22 | * Forward request to controller in Search package. |
| 23 | * |
| 24 | * @var REST_Controller |
| 25 | */ |
| 26 | protected $controller; |
| 27 | |
| 28 | /** |
| 29 | * Constructor. |
| 30 | */ |
| 31 | public function __construct() { |
| 32 | $this->namespace = 'wpcom/v2'; |
| 33 | $this->rest_base = 'search'; |
| 34 | $this->controller = new REST_Controller( defined( 'IS_WPCOM' ) && IS_WPCOM ); |
| 35 | |
| 36 | add_action( 'rest_api_init', array( $this, 'register_routes' ) ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Called automatically on `rest_api_init()`. |
| 41 | */ |
| 42 | public function register_routes() { |
| 43 | register_rest_route( |
| 44 | $this->namespace, |
| 45 | $this->rest_base, |
| 46 | array( |
| 47 | 'methods' => WP_REST_Server::READABLE, |
| 48 | 'callback' => array( $this->controller, 'get_search_results' ), |
| 49 | 'permission_callback' => 'is_user_logged_in', |
| 50 | ) |
| 51 | ); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | wpcom_rest_api_v2_load_plugin( 'WPCOM_REST_API_V2_Endpoint_Search' ); |
| 56 |