PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / vendor / wordpress / abilities-api / includes / rest-api / class-wp-rest-abilities-init.php

class-wp-rest-abilities-init.php in The Innovative Form Builder – IvyForms 1.5, at backend/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