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() { |
||
41 | |||
42 | /** |
||
43 | * Checks if a given request has access to get galleries. |
||
44 | * |
||
45 | * @access public |
||
46 | * |
||
47 | * @param WP_REST_Request $request Request. |
||
48 | * |
||
49 | * @return true|WP_Error True if the request has read access, WP_Error object otherwise. |
||
50 | */ |
||
51 | public function get_galleries_permissions_check( $request ) { |
||
64 | |||
65 | /** |
||
66 | * Returns a list of all galleries. |
||
67 | * |
||
68 | * @since 2.8.0 |
||
69 | * @access public |
||
70 | * |
||
71 | * @param WP_REST_Request $request Full details about the request. |
||
72 | * |
||
73 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
||
74 | */ |
||
75 | public function get_galleries( $request ) { |
||
98 | |||
99 | /** |
||
100 | * Retrieves block's output schema, conforming to JSON Schema. |
||
101 | * |
||
102 | * @since 2.8.0 |
||
103 | * @access public |
||
104 | * |
||
105 | * @return array Item schema data. |
||
106 | */ |
||
107 | public function get_item_schema() { |
||
128 | } |
||
129 | } |
||
130 |
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.