Ticket #40702: 40702.6.diff
File 40702.6.diff, 26.2 KB (added by , 7 years ago) |
---|
-
src/wp-admin/admin-ajax.php
64 64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 'press-this-save-post', 65 65 'press-this-add-category', 'crop-image', 'generate-password', 'save-wporg-username', 'delete-plugin', 66 66 'search-plugins', 'search-install-plugins', 'activate-plugin', 'update-theme', 'delete-theme', 67 'install-theme', 'get-post-thumbnail-html', 'get-community-events',67 'install-theme', 'get-post-thumbnail-html', 68 68 ); 69 69 70 70 // Deprecated -
src/wp-admin/includes/ajax-actions.php
297 297 } 298 298 299 299 /** 300 * Handles AJAX requests for community events301 *302 * @since 4.8.0303 */304 function wp_ajax_get_community_events() {305 require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' );306 307 check_ajax_referer( 'community_events' );308 309 $search = isset( $_POST['location'] ) ? wp_unslash( $_POST['location'] ) : '';310 $timezone = isset( $_POST['timezone'] ) ? wp_unslash( $_POST['timezone'] ) : '';311 $user_id = get_current_user_id();312 $saved_location = get_user_option( 'community-events-location', $user_id );313 $events_client = new WP_Community_Events( $user_id, $saved_location );314 $events = $events_client->get_events( $search, $timezone );315 316 if ( is_wp_error( $events ) ) {317 wp_send_json_error( array(318 'error' => $events->get_error_message(),319 ) );320 } else {321 if ( isset( $events['location'] ) ) {322 // Send only the data that the client will use.323 $events['location'] = $events['location']['description'];324 325 // Store the location network-wide, so the user doesn't have to set it on each site.326 update_user_option( $user_id, 'community-events-location', $events['location'], true );327 }328 329 wp_send_json_success( $events );330 }331 }332 333 /**334 300 * Ajax handler for dashboard widgets. 335 301 * 336 302 * @since 3.4.0 -
src/wp-admin/includes/dashboard.php
144 144 $events_client = new WP_Community_Events( $user_id, $user_location ); 145 145 146 146 $script_data = array( 147 'nonce' => wp_create_nonce( 'community_events' ), 147 'rest_url' => rest_url( '/' ), 148 'rest_nonce' => wp_create_nonce( 'wp_rest' ), 148 149 'cache' => $events_client->get_cached_events(), 149 150 150 151 'l10n' => array( … … 1225 1226 <?php printf( 1226 1227 /* translators: %s is a placeholder for the name of a city. */ 1227 1228 __( 'Attend an upcoming event near %s.' ), 1228 '<strong>{{ data.location }}</strong>'1229 '<strong>{{ data.location.description }}</strong>' 1229 1230 ); ?> 1230 1231 </script> 1231 1232 … … 1247 1248 </div> 1248 1249 </div> 1249 1250 1250 <div class="event-date-time"> 1251 <span class="event-date">{{ event.formatted_date }}</span> 1252 <# if ( 'meetup' === event.type ) { #> 1253 <span class="event-time">{{ event.formatted_time }}</span> 1254 <# } #> 1255 </div> 1251 <# if ( event.date && event.date.formatted ) { #> 1252 <div class="event-date-time"> 1253 <span class="event-date">{{ event.date.formatted.date }}</span> 1254 <# if ( 'meetup' === event.type ) { #> 1255 <span class="event-time">{{ event.date.formatted.time }}</span> 1256 <# } #> 1257 </div> 1258 <# } #> 1256 1259 </li> 1257 1260 <# } ) #> 1258 1261 </script> … … 1262 1265 <?php printf( 1263 1266 /* translators: 1: the city the user searched for, 2: meetup organization documentation URL */ 1264 1267 __( 'There aren’t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize one</a>?' ), 1265 '{{data.location }}',1268 '{{data.location.description}}', 1266 1269 __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) 1267 1270 ); ?> 1268 1271 </li> -
src/wp-admin/js/dashboard.js
191 191 192 192 jQuery( function( $ ) { 193 193 'use strict'; 194 194 195 195 var communityEventsData = window.communityEventsData || {}; 196 196 197 197 var app = window.wp.communityEvents = { … … 291 291 $spinner = $( '.community-events-form' ).children( '.spinner' ); 292 292 293 293 requestParams = requestParams || {}; 294 requestParams._wpnonce = communityEventsData.nonce;295 294 requestParams.timezone = window.Intl ? window.Intl.DateTimeFormat().resolvedOptions().timeZone : ''; 296 295 297 296 initiatedBy = requestParams.location ? 'user' : 'app'; 298 297 299 298 $spinner.addClass( 'is-active' ); 300 299 301 wp.ajax.post( 'get-community-events', requestParams ) 302 .always( function() { 303 $spinner.removeClass( 'is-active' ); 304 }) 305 306 .done( function( response ) { 307 if ( 'no_location_available' === response.error ) { 308 if ( requestParams.location ) { 309 response.unknownCity = requestParams.location; 310 } else { 311 /* 312 * No location was passed, which means that this was an automatic query 313 * based on IP, locale, and timezone. Since the user didn't initiate it, 314 * it should fail silently. Otherwise, the error could confuse and/or 315 * annoy them. 316 */ 317 318 delete response.error; 319 } 320 } 321 app.renderEventsTemplate( response, initiatedBy ); 322 }) 300 requestParams._embed = 1; 323 301 324 .fail( function() { 302 $.ajax( communityEventsData.rest_url + 'wp/dashboard/v1/community-events/location/me', { 303 method: 'GET', 304 data: requestParams, 305 dataType: 'json', 306 headers: { 307 'X-WP-Nonce': communityEventsData.rest_nonce 308 }, 309 success: function( response ) { 310 var events = response._embedded ? response._embedded.events[0] : []; 311 var location = response; 312 313 delete location._embedded; 314 delete location._links; 315 316 app.renderEventsTemplate({ 317 location: location, 318 events: events 319 }, initiatedBy ); 320 }, 321 error: function() { 325 322 app.renderEventsTemplate( { 326 323 'location' : false, 327 324 'error' : true 328 325 }, initiatedBy ); 329 }); 326 }, 327 complete: function() { 328 $spinner.removeClass( 'is-active' ); 329 } 330 }); 330 331 }, 331 332 332 333 /** -
src/wp-includes/rest-api/endpoints/dashboard/class-wp-rest-community-events-events-controller.php
1 <?php 2 /** 3 * REST API: WP_REST_Community_Events_Events_Controller class 4 * 5 * @package WordPress 6 * @subpackage REST_API 7 * @since 4.8.0 8 */ 9 10 /** 11 * Core class to access community events via the REST API. 12 * 13 * @since 4.8.0 14 * 15 * @see WP_REST_Controller 16 */ 17 class WP_REST_Community_Events_Events_Controller extends WP_REST_Controller { 18 19 /** 20 * Constructor. 21 * 22 * @since 4.8.0 23 * @access public 24 */ 25 public function __construct() { 26 $this->namespace = 'wp/dashboard/v1'; 27 $this->rest_base = 'community-events/events'; 28 } 29 30 /** 31 * Registers the routes for the objects of the controller. 32 * 33 * @since 4.8.0 34 * @access public 35 * 36 * @see register_rest_route() 37 */ 38 public function register_routes() { 39 40 register_rest_route( $this->namespace, '/' . $this->rest_base, array( 41 array( 42 'methods' => WP_REST_Server::READABLE, 43 'callback' => array( $this, 'get_items' ), 44 'permission_callback' => array( $this, 'get_items_permissions_check' ), 45 'args' => $this->get_collection_params(), 46 ), 47 'schema' => array( $this, 'get_public_item_schema' ), 48 ) ); 49 } 50 51 /** 52 * Checks whether a given request has permission to read community events. 53 * 54 * @since 4.8.0 55 * @access public 56 * 57 * @param WP_REST_Request $request Full details about the request. 58 * @return WP_Error|true True if the request has read access, WP_Error object otherwise. 59 */ 60 public function get_items_permissions_check( $request ) { 61 if ( ! is_user_logged_in() ) { 62 return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) ); 63 } 64 65 if ( ! empty( $request['user_id'] ) && $request['user_id'] !== get_current_user_id() ) { 66 $user = get_userdata( $request['user_id'] ); 67 if ( empty( $user ) || ! $user->exists() ) { 68 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 400 ) ); 69 } 70 71 if ( ! current_user_can( 'edit_user', $request['user_id'] ) ) { 72 return new WP_Error( 'rest_cannot_access_user_community_events', __( 'Sorry, you are not allowed to access community events for that user.' ), array( 'status' => 403 ) ); 73 } 74 } 75 76 if ( ! current_user_can( 'read' ) ) { 77 return new WP_Error( 'rest_cannot_access_user_community_events', __( 'Sorry, you are not allowed to access community events for that user.' ), array( 'status' => 403 ) ); 78 } 79 80 return true; 81 } 82 83 /** 84 * Retrieves community events. 85 * 86 * @since 4.8.0 87 * @access public 88 * 89 * @param WP_REST_Request $request Full details about the request. 90 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 91 */ 92 public function get_items( $request ) { 93 require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' ); 94 95 $user_id = ! empty( $request['user_id'] ) ? $request['user_id'] : get_current_user_id(); 96 97 $saved_location = get_user_option( 'community-events-location', $user_id ); 98 $events_client = new WP_Community_Events( $user_id, $saved_location ); 99 $events = $events_client->get_events(); 100 101 $data = array(); 102 103 // Store the location network-wide, so the user doesn't have to set it on each site. 104 if ( ! is_wp_error( $events ) ) { 105 if ( isset( $events['location'] ) ) { 106 update_user_option( $user_id, 'community-events-location', $events['location'], true ); 107 } 108 109 if ( isset( $events['events'] ) ) { 110 foreach ( $events['events'] as $event ) { 111 $data[] = $this->prepare_item_for_response( $event, $request ); 112 } 113 } 114 } 115 116 return rest_ensure_response( $data ); 117 } 118 119 /** 120 * Prepares a single event output for response. 121 * 122 * @since 4.8.0 123 * @access public 124 * 125 * @param array $event Event data array from the API. 126 * @param WP_REST_Request $request Request object. 127 * @return WP_REST_Response Response object. 128 */ 129 public function prepare_item_for_response( $event, $request ) { 130 $data = array(); 131 132 $keys_to_copy = array( 'type', 'title', 'url', 'meetup', 'meetup_url' ); 133 foreach ( $keys_to_copy as $key ) { 134 if ( isset( $event[ $key ] ) ) { 135 $data[ $key ] = $event[ $key ]; 136 } else { 137 $data[ $key ] = null; 138 } 139 } 140 141 $data['date'] = array( 142 'raw' => isset( $event['date'] ) ? $event['date'] : null, 143 'formatted' => array( 144 'date' => isset( $event['formatted_date'] ) ? $event['formatted_date'] : null, 145 'time' => isset( $event['formatted_time'] ) ? $event['formatted_time'] : null, 146 ), 147 ); 148 149 $data['location'] = isset( $event['location'] ) ? $event['location'] : null; 150 151 return $data; 152 } 153 154 /** 155 * Retrieves a community event's schema, conforming to JSON Schema. 156 * 157 * @since 4.8.0 158 * @access public 159 * 160 * @return array Item schema data. 161 */ 162 public function get_item_schema() { 163 return array( 164 '$schema' => 'http://json-schema.org/schema#', 165 'title' => 'community_event', 166 'type' => 'object', 167 'properties' => array( 168 'type' => array( 169 'description' => __( 'Type for the event.' ), 170 'type' => 'string', 171 'enum' => array( 'meetup', 'wordcamp' ), 172 'context' => array( 'view', 'edit', 'embed' ), 173 'readonly' => true, 174 ), 175 'title' => array( 176 'description' => __( 'Title for the event.' ), 177 'type' => 'string', 178 'context' => array( 'view', 'edit', 'embed' ), 179 'readonly' => true, 180 ), 181 'url' => array( 182 'description' => __( 'Website URL for the event.' ), 183 'type' => 'string', 184 'context' => array( 'view', 'edit', 'embed' ), 185 'readonly' => true, 186 ), 187 'meetup' => array( 188 'description' => __( 'Name of the meetup, if the event is a meetup.' ), 189 'type' => 'string', 190 'context' => array( 'view', 'edit', 'embed' ), 191 'readonly' => true, 192 ), 193 'meetup_url' => array( 194 'description' => __( 'URL for the meetup on meetup.com, if the event is a meetup.' ), 195 'type' => 'string', 196 'context' => array( 'view', 'edit', 'embed' ), 197 'readonly' => true, 198 ), 199 'date' => array( 200 'description' => __( 'Date and time information for the event.' ), 201 'type' => 'object', 202 'context' => array( 'view', 'edit', 'embed' ), 203 'readonly' => true, 204 'properties' => array( 205 'raw' => array( 206 'description' => __( 'Unformatted date and time string.' ), 207 'type' => 'string', 208 'format' => 'date-time', 209 'context' => array( 'view', 'edit', 'embed' ), 210 'readonly' => true, 211 ), 212 'formatted' => array( 213 'description' => __( 'Formatted date and time information for the event.' ), 214 'type' => 'object', 215 'context' => array( 'view', 'edit', 'embed' ), 216 'readonly' => true, 217 'properties' => array( 218 'date' => array( 219 'description' => __( 'Formatted event date.' ), 220 'type' => 'string', 221 'context' => array( 'view', 'edit', 'embed' ), 222 'readonly' => true, 223 ), 224 'time' => array( 225 'description' => __( 'Formatted event time.' ), 226 'type' => 'string', 227 'context' => array( 'view', 'edit', 'embed' ), 228 'readonly' => true, 229 ), 230 ), 231 ), 232 ), 233 ), 234 'location' => array( 235 'description' => __( 'Location information for the event.' ), 236 'type' => 'object', 237 'context' => array( 'view', 'edit', 'embed' ), 238 'readonly' => true, 239 'properties' => array( 240 'location' => array( 241 'description' => __( 'Location name for the event.' ), 242 'type' => 'string', 243 'context' => array( 'view', 'edit', 'embed' ), 244 'readonly' => true, 245 ), 246 'country' => array( 247 'description' => __( 'Two-letter country code for the event.' ), 248 'type' => 'string', 249 'context' => array( 'view', 'edit', 'embed' ), 250 'readonly' => true, 251 ), 252 'latitude' => array( 253 'description' => __( 'Latitude for the event.' ), 254 'type' => 'number', 255 'context' => array( 'view', 'edit', 'embed' ), 256 'readonly' => true, 257 ), 258 'longitude' => array( 259 'description' => __( 'Longitude for the event.' ), 260 'type' => 'number', 261 'context' => array( 'view', 'edit', 'embed' ), 262 'readonly' => true, 263 ), 264 ), 265 ), 266 ), 267 ); 268 } 269 270 /** 271 * Retrieves the query params for collections. 272 * 273 * @since 4.8.0 274 * @access public 275 * 276 * @return array Collection parameters. 277 */ 278 public function get_collection_params() { 279 return array( 280 'context' => $this->get_context_param( array( 'default' => 'view' ) ), 281 'user_id' => array( 282 'description' => __( 'Limit result set to community events for a specific user. Default is the current user.' ), 283 'type' => 'integer', 284 ), 285 ); 286 } 287 } -
src/wp-includes/rest-api/endpoints/dashboard/class-wp-rest-community-events-location-controller.php
1 <?php 2 /** 3 * REST API: WP_REST_Community_Events_Location_Controller class 4 * 5 * @package WordPress 6 * @subpackage REST_API 7 * @since 4.8.0 8 */ 9 10 /** 11 * Core class to access community events user locations via the REST API. 12 * 13 * @since 4.8.0 14 * 15 * @see WP_REST_Controller 16 */ 17 class WP_REST_Community_Events_Location_Controller extends WP_REST_Controller { 18 19 /** 20 * Constructor. 21 * 22 * @since 4.8.0 23 * @access public 24 */ 25 public function __construct() { 26 $this->namespace = 'wp/dashboard/v1'; 27 $this->rest_base = 'community-events/location'; 28 } 29 30 /** 31 * Registers the routes for the objects of the controller. 32 * 33 * @since 4.8.0 34 * @access public 35 * 36 * @see register_rest_route() 37 */ 38 public function register_routes() { 39 40 register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\d]+)', array( 41 array( 42 'methods' => WP_REST_Server::READABLE, 43 'callback' => array( $this, 'get_item' ), 44 'permission_callback' => array( $this, 'get_item_permissions_check' ), 45 'args' => $this->get_item_params(), 46 ), 47 'schema' => array( $this, 'get_public_item_schema' ), 48 ) ); 49 50 register_rest_route( $this->namespace, '/' . $this->rest_base . '/me', array( 51 array( 52 'methods' => WP_REST_Server::READABLE, 53 'callback' => array( $this, 'get_current_item' ), 54 'permission_callback' => array( $this, 'get_current_item_permissions_check' ), 55 'args' => $this->get_item_params(), 56 ), 57 'schema' => array( $this, 'get_public_item_schema' ), 58 ) ); 59 } 60 61 /** 62 * Checks whether a given request has permission to read a community events location. 63 * 64 * @since 4.8.0 65 * @access public 66 * 67 * @param WP_REST_Request $request Full details about the request. 68 * @return WP_Error|true True if the request has read access, WP_Error object otherwise. 69 */ 70 public function get_item_permissions_check( $request ) { 71 if ( ! is_user_logged_in() ) { 72 return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) ); 73 } 74 75 if ( $request['id'] !== get_current_user_id() ) { 76 $user = get_userdata( $request['id'] ); 77 if ( empty( $user ) || ! $user->exists() ) { 78 return new WP_Error( 'rest_user_invalid_id', __( 'Invalid user ID.' ), array( 'status' => 400 ) ); 79 } 80 81 if ( ! current_user_can( 'edit_user', $request['id'] ) ) { 82 return new WP_Error( 'rest_cannot_access_user_community_events_location', __( 'Sorry, you are not allowed to access the community events location for that user.' ), array( 'status' => 403 ) ); 83 } 84 } 85 86 if ( ! current_user_can( 'read' ) ) { 87 return new WP_Error( 'rest_cannot_access_user_community_events_location', __( 'Sorry, you are not allowed to access the community events location for that user.' ), array( 'status' => 403 ) ); 88 } 89 90 return true; 91 } 92 93 /** 94 * Retrieves the community events location for a user. 95 * 96 * @since 4.8.0 97 * @access public 98 * 99 * @param WP_REST_Request $request Full details about the request. 100 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 101 */ 102 public function get_item( $request ) { 103 return $this->get_item_for_user_id( $request['id'], $request ); 104 } 105 106 /** 107 * Checks whether a given request has permission to read the current user's community events location. 108 * 109 * @since 4.8.0 110 * @access public 111 * 112 * @param WP_REST_Request $request Full details about the request. 113 * @return WP_Error|true True if the request has read access, WP_Error object otherwise. 114 */ 115 public function get_current_item_permissions_check( $request ) { 116 if ( ! is_user_logged_in() ) { 117 return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) ); 118 } 119 120 return true; 121 } 122 123 /** 124 * Retrieves the community events location for the current user. 125 * 126 * @since 4.8.0 127 * @access public 128 * 129 * @param WP_REST_Request $request Full details about the request. 130 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 131 */ 132 public function get_current_item( $request ) { 133 return $this->get_item_for_user_id( get_current_user_id(), $request ); 134 } 135 136 /** 137 * Retrieves the community events location for a specific user. 138 * 139 * @since 4.8.0 140 * @access private 141 * 142 * @param int $user_id User ID. 143 * @param WP_REST_Request $request Request object. 144 * @return WP_Error|WP_REST_Response Response object on success, or WP_Error object on failure. 145 */ 146 private function get_item_for_user_id( $user_id, $request ) { 147 require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' ); 148 149 $location = $request->get_param( 'location' ); 150 $timezone = $request->get_param( 'timezone' ); 151 152 $saved_location = get_user_option( 'community-events-location', $user_id ); 153 $events_client = new WP_Community_Events( $user_id, $saved_location ); 154 $events = $events_client->get_events( $location, $timezone ); 155 156 $data = array(); 157 158 // Store the location network-wide, so the user doesn't have to set it on each site. 159 if ( ! is_wp_error( $events ) ) { 160 if ( isset( $events['location'] ) ) { 161 update_user_option( $user_id, 'community-events-location', $events['location'], true ); 162 163 $data = $this->prepare_item_for_response( $events['location'], $request ); 164 165 return rest_ensure_response( $data ); 166 } 167 } 168 169 return new WP_Error( 'rest_cannot_retrieve_user_location', __( 'The user location could not be retrieved.' ), array( 'status' => 503 ) ); 170 } 171 172 /** 173 * Prepares a single location output for response. 174 * 175 * @since 4.8.0 176 * @access public 177 * 178 * @param array $location Location data array from the API. 179 * @param WP_REST_Request $request Request object. 180 * @return WP_REST_Response Response object. 181 */ 182 public function prepare_item_for_response( $location, $request ) { 183 $data = array( 184 'description' => isset( $location['description'] ) ? $location['description'] : null, 185 'country' => isset( $location['country'] ) ? $location['country'] : null, 186 'latitude' => isset( $location['latitude'] ) ? (float) $location['latitude'] : null, 187 'longitude' => isset( $location['longitude'] ) ? (float) $location['longitude'] : null, 188 ); 189 190 $response = rest_ensure_response( $data ); 191 192 $user_id = $request['id']; 193 if ( empty( $user_id ) ) { 194 $user_id = get_current_user_id(); 195 } 196 197 $response->add_links( array( 198 'events' => array( 199 'href' => rest_url( 'wp/dashboard/v1/community-events/events?user_id=' . $user_id ), 200 'embeddable' => true, 201 ), 202 ) ); 203 204 return $response; 205 } 206 207 /** 208 * Retrieves a community events location schema, conforming to JSON Schema. 209 * 210 * @since 4.8.0 211 * @access public 212 * 213 * @return array Item schema data. 214 */ 215 public function get_item_schema() { 216 return array( 217 '$schema' => 'http://json-schema.org/schema#', 218 'title' => 'community_events_location', 219 'type' => 'object', 220 'properties' => array( 221 'description' => array( 222 'description' => __( 'Location description.' ), 223 'type' => 'string', 224 'context' => array( 'view', 'edit', 'embed' ), 225 'readonly' => true, 226 ), 227 'country' => array( 228 'description' => __( 'Two-letter country code.' ), 229 'type' => 'string', 230 'context' => array( 'view', 'edit', 'embed' ), 231 'readonly' => true, 232 ), 233 'latitude' => array( 234 'description' => __( 'Latitude.' ), 235 'type' => 'number', 236 'context' => array( 'view', 'edit', 'embed' ), 237 'readonly' => true, 238 ), 239 'longitude' => array( 240 'description' => __( 'Longitude.' ), 241 'type' => 'number', 242 'context' => array( 'view', 'edit', 'embed' ), 243 'readonly' => true, 244 ), 245 ), 246 ); 247 } 248 249 /** 250 * Retrieves the params for a single item. 251 * 252 * @since 4.8.0 253 * @access public 254 * 255 * @return array Item parameters. 256 */ 257 public function get_item_params() { 258 return array( 259 'context' => $this->get_context_param( array( 'default' => 'view' ) ), 260 'location' => array( 261 'description' => __( 'Optional city name to help determine the location.' ), 262 'type' => 'string', 263 'default' => '', 264 ), 265 'timezone' => array( 266 'description' => __( 'Optional timezone to help determine the location.' ), 267 'type' => 'string', 268 'default' => '', 269 ), 270 ); 271 } 272 } -
src/wp-includes/rest-api.php
237 237 // Settings. 238 238 $controller = new WP_REST_Settings_Controller; 239 239 $controller->register_routes(); 240 241 // Community events. 242 $controller = new WP_REST_Community_Events_Events_Controller; 243 $controller->register_routes(); 244 245 // Community events location. 246 $controller = new WP_REST_Community_Events_Location_Controller; 247 $controller->register_routes(); 240 248 } 241 249 242 250 /** -
src/wp-settings.php
234 234 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php' ); 235 235 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' ); 236 236 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' ); 237 require( ABSPATH . WPINC . '/rest-api/endpoints/dashboard/class-wp-rest-community-events-events-controller.php' ); 238 require( ABSPATH . WPINC . '/rest-api/endpoints/dashboard/class-wp-rest-community-events-location-controller.php' ); 237 239 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php' ); 238 240 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php' ); 239 241 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php' );