1 | <?php |
||
9 | class FooGallery_Rest_Routes { |
||
|
|||
10 | /** |
||
11 | * Constructs the class. |
||
12 | * |
||
13 | * @access public |
||
14 | */ |
||
15 | public function __construct() { |
||
18 | |||
19 | /** |
||
20 | * Registers the necessary REST API routes for FooGallery |
||
21 | * |
||
22 | * @access public |
||
23 | */ |
||
24 | public function register_routes() { |
||
40 | |||
41 | /** |
||
42 | * Checks if a given request has access to get galleries. |
||
43 | * |
||
44 | * @access public |
||
45 | * |
||
46 | * @param WP_REST_Request $request Request. |
||
47 | * |
||
48 | * @return true|WP_Error True if the request has read access, WP_Error object otherwise. |
||
49 | */ |
||
50 | public function get_galleries_permissions_check( $request ) { |
||
63 | |||
64 | /** |
||
65 | * Returns a list of all galleries. |
||
66 | * |
||
67 | * @since 2.8.0 |
||
68 | * @access public |
||
69 | * |
||
70 | * @param WP_REST_Request $request Full details about the request. |
||
71 | * |
||
72 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
||
73 | */ |
||
74 | public function get_galleries( $request ) { |
||
106 | |||
107 | /** |
||
108 | * Retrieves block's output schema, conforming to JSON Schema. |
||
109 | * |
||
110 | * @since 2.8.0 |
||
111 | * @access public |
||
112 | * |
||
113 | * @return array Item schema data. |
||
114 | */ |
||
115 | public function get_item_schema() { |
||
142 | } |
||
143 | } |
||
144 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.