PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.83
WindPress – Tailwind CSS integration for WordPress v3.2.83
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
windpress / vendor / wordpress / abilities-api / includes / rest-api / class-wp-rest-abilities-init.php

class-wp-rest-abilities-init.php in WindPress – Tailwind CSS integration for WordPress 3.2.83, at vendor/wordpress/abilities-api/includes/rest-api/class-wp-rest-abilities-init.php

61 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * REST API initialization for Abilities API.
4 *
5 * @package WordPress
6 * @subpackage Abilities_API
7 * @since 0.1.0
8 */
9
10 declare( strict_types = 1 );
11
12 /**
13 * Handles initialization of Abilities REST API endpoints.
14 *
15 * @since 0.1.0
16 */
17 class WP_REST_Abilities_Init {
18
19 /**
20 * Registers the REST API routes for abilities.
21 *
22 * @since 0.1.0
23 *
24 * @param WP_REST_Server|null $rest_server Optional. The REST server to register routes with. Default null, which
25 * will use the main REST server instance.
26 */
27 public static function register_routes( $rest_server = null ): void {
28 if ( ! $rest_server instanceof WP_REST_Server ) {
29 $rest_server = rest_get_server();
30 }
31
32 $routes = $rest_server->get_routes();
33
34 if ( ! isset( $routes['/wp-abilities/v1/categories'] ) ) {
35 if ( ! class_exists( 'WP_REST_Abilities_V1_Categories_Controller' ) ) {
36 require_once __DIR__ . '/endpoints/class-wp-rest-abilities-v1-categories-controller.php';
37 }
38 $categories_controller = new WP_REST_Abilities_V1_Categories_Controller();
39 $categories_controller->register_routes();
40 }
41
42 if ( ! isset( $routes['/wp-abilities/v1/abilities/(?P<name>[a-zA-Z0-9\\-\\/]+?)/run'] ) ) {
43 if ( ! class_exists( 'WP_REST_Abilities_V1_Run_Controller' ) ) {
44 require_once __DIR__ . '/endpoints/class-wp-rest-abilities-v1-run-controller.php';
45 }
46 $run_controller = new WP_REST_Abilities_V1_Run_Controller();
47 $run_controller->register_routes();
48 }
49
50 if ( isset( $routes['/wp-abilities/v1/abilities'] ) ) {
51 return;
52 }
53
54 if ( ! class_exists( 'WP_REST_Abilities_V1_List_Controller' ) ) {
55 require_once __DIR__ . '/endpoints/class-wp-rest-abilities-v1-list-controller.php';
56 }
57 $list_controller = new WP_REST_Abilities_V1_List_Controller();
58 $list_controller->register_routes();
59 }
60 }
61