PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.2.2
Jetpack – WP Security, Backup, Speed, & Growth v7.2.2
16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 All 503 releases
jetpack / _inc / lib / core-api / load-wpcom-endpoints.php

load-wpcom-endpoints.php in Jetpack – WP Security, Backup, Speed, & Growth 7.2.2, at _inc/lib/core-api/load-wpcom-endpoints.php

41 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Loader for WP REST API endpoints that are synced with WP.com.
5 *
6 * On WP.com see:
7 * - wp-content/mu-plugins/rest-api.php
8 * - wp-content/rest-api-plugins/jetpack-endpoints/
9 */
10
11 function wpcom_rest_api_v2_load_plugin_files( $file_pattern ) {
12 $plugins = glob( dirname( __FILE__ ) . '/' . $file_pattern );
13
14 if ( ! is_array( $plugins ) ) {
15 return;
16 }
17
18 foreach ( array_filter( $plugins, 'is_file' ) as $plugin ) {
19 require_once $plugin;
20 }
21 }
22
23 // API v2 plugins: define a class, then call this function.
24 function wpcom_rest_api_v2_load_plugin( $class_name ) {
25 global $wpcom_rest_api_v2_plugins;
26
27 if ( ! isset( $wpcom_rest_api_v2_plugins ) ) {
28 $_GLOBALS['wpcom_rest_api_v2_plugins'] = $wpcom_rest_api_v2_plugins = array();
29 }
30
31 if ( ! isset( $wpcom_rest_api_v2_plugins[ $class_name ] ) ) {
32 $wpcom_rest_api_v2_plugins[ $class_name ] = new $class_name;
33 }
34 }
35
36 require dirname( __FILE__ ) . '/class-wpcom-rest-field-controller.php';
37
38 // Now load the endpoint files.
39 wpcom_rest_api_v2_load_plugin_files( 'wpcom-endpoints/*.php' );
40 wpcom_rest_api_v2_load_plugin_files( 'wpcom-fields/*.php' );
41