Changeset 10741
- Timestamp:
- 03/04/2021 06:12:12 AM (4 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory
- Files:
-
- 7 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/rest-api/class-internal-stats.php
r10740 r10741 1 1 <?php 2 namespace WordPressdotorg\Theme_Directory\Rest_API; 3 use WP_REST_Server; 4 use WP_Error; 5 use WP_Http; 2 6 3 class WPorg_Themes_Rest_API_Internal_Stats {7 class Internal_Stats { 4 8 5 9 function __construct() { 6 register_rest_route( 'themes/v1', ' /update-stats', array(7 'methods' => \WP_REST_Server::CREATABLE,8 'callback' => array( $this, 'bulk_update_stats' ),10 register_rest_route( 'themes/v1', 'update-stats', array( 11 'methods' => \WP_REST_Server::CREATABLE, 12 'callback' => array( $this, 'bulk_update_stats' ), 9 13 'permission_callback' => array( $this, 'permission_check_internal_api_bearer' ), 10 14 ) ); … … 26 30 ! hash_equals( THEME_API_INTERNAL_BEARER_TOKEN, $authorization_header ) 27 31 ) { 28 return new \WP_Error(32 return new WP_Error( 29 33 'not_authorized', 30 34 __( 'Sorry! You cannot do that.', 'wporg-themes' ), … … 114 118 115 119 } 116 new WPorg_Themes_Rest_API_Internal_Stats();120 new Internal_Stats(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r10740 r10741 34 34 // Load the GitHub API client. 35 35 include __DIR__ . '/lib/class-github.php'; 36 37 // Load the Rest API Endpoints. 38 include __DIR__ . '/rest-api.php'; 36 39 37 40 define( 'WPORG_THEMES_DEFAULT_BROWSE', 'popular' ); … … 171 174 } 172 175 add_action( 'init', 'wporg_themes_init' ); 173 174 /**175 * Loads the Rest API Endpoints.176 */177 function wporg_themes_rest_apis() {178 include __DIR__ . '/class-wporg-themes-rest-api-internal-stats.php';179 }180 add_action( 'rest_api_init', 'wporg_themes_rest_apis' );181 176 182 177 /**
Note: See TracChangeset
for help on using the changeset viewer.