@@ 211-251 (lines=41) @@ | ||
208 | * @since 2.2 |
|
209 | * @deprecated 2.6.0 |
|
210 | */ |
|
211 | private function handle_v1_rest_api_request() { |
|
212 | ||
213 | // Include legacy required files for v1 REST API request. |
|
214 | include_once( 'api/legacy/v1/class-wc-api-server.php' ); |
|
215 | include_once( 'api/legacy/v1/interface-wc-api-handler.php' ); |
|
216 | include_once( 'api/legacy/v1/class-wc-api-json-handler.php' ); |
|
217 | include_once( 'api/legacy/v1/class-wc-api-xml-handler.php' ); |
|
218 | ||
219 | include_once( 'api/legacy/v1/class-wc-api-authentication.php' ); |
|
220 | $this->authentication = new WC_API_Authentication(); |
|
221 | ||
222 | include_once( 'api/legacy/v1/class-wc-api-resource.php' ); |
|
223 | include_once( 'api/legacy/v1/class-wc-api-coupons.php' ); |
|
224 | include_once( 'api/legacy/v1/class-wc-api-customers.php' ); |
|
225 | include_once( 'api/legacy/v1/class-wc-api-orders.php' ); |
|
226 | include_once( 'api/legacy/v1/class-wc-api-products.php' ); |
|
227 | include_once( 'api/legacy/v1/class-wc-api-reports.php' ); |
|
228 | ||
229 | // Allow plugins to load other response handlers or resource classes. |
|
230 | do_action( 'woocommerce_api_loaded' ); |
|
231 | ||
232 | $this->server = new WC_API_Server( $GLOBALS['wp']->query_vars['wc-api-route'] ); |
|
233 | ||
234 | // Register available resources for legacy v1 REST API request. |
|
235 | $api_classes = apply_filters( 'woocommerce_api_classes', |
|
236 | array( |
|
237 | 'WC_API_Customers', |
|
238 | 'WC_API_Orders', |
|
239 | 'WC_API_Products', |
|
240 | 'WC_API_Coupons', |
|
241 | 'WC_API_Reports', |
|
242 | ) |
|
243 | ); |
|
244 | ||
245 | foreach ( $api_classes as $api_class ) { |
|
246 | $this->$api_class = new $api_class( $this->server ); |
|
247 | } |
|
248 | ||
249 | // Fire off the request. |
|
250 | $this->server->serve_request(); |
|
251 | } |
|
252 | ||
253 | /** |
|
254 | * Handle legacy v2 REST API requests. |
|
@@ 259-299 (lines=41) @@ | ||
256 | * @since 2.4 |
|
257 | * @deprecated 2.6.0 |
|
258 | */ |
|
259 | private function handle_v2_rest_api_request() { |
|
260 | include_once( 'api/legacy/v2/class-wc-api-exception.php' ); |
|
261 | include_once( 'api/legacy/v2/class-wc-api-server.php' ); |
|
262 | include_once( 'api/legacy/v2/interface-wc-api-handler.php' ); |
|
263 | include_once( 'api/legacy/v2/class-wc-api-json-handler.php' ); |
|
264 | ||
265 | include_once( 'api/legacy/v2/class-wc-api-authentication.php' ); |
|
266 | $this->authentication = new WC_API_Authentication(); |
|
267 | ||
268 | include_once( 'api/legacy/v2/class-wc-api-resource.php' ); |
|
269 | include_once( 'api/legacy/v2/class-wc-api-coupons.php' ); |
|
270 | include_once( 'api/legacy/v2/class-wc-api-customers.php' ); |
|
271 | include_once( 'api/legacy/v2/class-wc-api-orders.php' ); |
|
272 | include_once( 'api/legacy/v2/class-wc-api-products.php' ); |
|
273 | include_once( 'api/legacy/v2/class-wc-api-reports.php' ); |
|
274 | include_once( 'api/legacy/v2/class-wc-api-webhooks.php' ); |
|
275 | ||
276 | // allow plugins to load other response handlers or resource classes. |
|
277 | do_action( 'woocommerce_api_loaded' ); |
|
278 | ||
279 | $this->server = new WC_API_Server( $GLOBALS['wp']->query_vars['wc-api-route'] ); |
|
280 | ||
281 | // Register available resources for legacy v2 REST API request. |
|
282 | $api_classes = apply_filters( 'woocommerce_api_classes', |
|
283 | array( |
|
284 | 'WC_API_Customers', |
|
285 | 'WC_API_Orders', |
|
286 | 'WC_API_Products', |
|
287 | 'WC_API_Coupons', |
|
288 | 'WC_API_Reports', |
|
289 | 'WC_API_Webhooks', |
|
290 | ) |
|
291 | ); |
|
292 | ||
293 | foreach ( $api_classes as $api_class ) { |
|
294 | $this->$api_class = new $api_class( $this->server ); |
|
295 | } |
|
296 | ||
297 | // Fire off the request. |
|
298 | $this->server->serve_request(); |
|
299 | } |
|
300 | ||
301 | /** |
|
302 | * API request - Trigger any API requests. |