newsletter
3 months ago
contact-forms.php
3 months ago
fluent-booking.php
3 months ago
iconvert-email-marketer.php
6 days ago
index.php
6 days ago
siteleads.php
3 months ago
fluent-booking.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | use Kubio\Flags; |
| 4 | |
| 5 | add_action( |
| 6 | 'rest_api_init', |
| 7 | function () { |
| 8 | $namespace = 'kubio/v1'; |
| 9 | |
| 10 | register_rest_route( |
| 11 | $namespace, |
| 12 | '/prepare_fluent_booking_plugin', |
| 13 | array( |
| 14 | 'methods' => 'POST', |
| 15 | 'callback' => 'kubio_api_prepare_fluent_booking_plugin', |
| 16 | 'permission_callback' => function () { |
| 17 | return current_user_can( 'edit_posts' ); |
| 18 | }, |
| 19 | |
| 20 | ) |
| 21 | ); |
| 22 | |
| 23 | register_rest_route( |
| 24 | $namespace, |
| 25 | '/get_fluent_events', |
| 26 | array( |
| 27 | 'methods' => 'GET', |
| 28 | 'callback' => 'kubio_api_get_fluent_events', |
| 29 | 'permission_callback' => function () { |
| 30 | return current_user_can( 'edit_posts' ); |
| 31 | }, |
| 32 | |
| 33 | ) |
| 34 | ); |
| 35 | } |
| 36 | ); |
| 37 | |
| 38 | |
| 39 | |
| 40 | function kubio_api_prepare_fluent_booking_plugin( WP_REST_Request $request ) { |
| 41 | $already_setup = Flags::getSetting( 'fluentBookingInstalled', null ); |
| 42 | if ( empty( $already_setup ) ) { |
| 43 | Flags::setSetting( 'fluentBookingInstalled', true ); |
| 44 | } |
| 45 | wp_send_json_success(); |
| 46 | } |
| 47 | |
| 48 | function kubio_api_get_fluent_events( WP_REST_Request $request ) { |
| 49 | |
| 50 | wp_send_json_success( kubio_get_fluent_booking_events() ); |
| 51 | } |
| 52 |