| 1 |
<?php |
| 2 |
|
| 3 |
defined('ABSPATH') || exit; |
| 4 |
|
| 5 |
/** |
| 6 |
* All registered action's handlers should be in app\Hooks\Handlers, |
| 7 |
* addAction is similar to add_action and addCustomAction is just a |
| 8 |
* wrapper over add_action which will add a prefix to the hook name |
| 9 |
* using the plugin slug to make it unique in all wordpress plugins, |
| 10 |
* ex: $app->addCustomAction('foo', ['FooHandler', 'handleFoo']) is |
| 11 |
* equivalent to add_action('slug-foo', ['FooHandler', 'handleFoo']). |
| 12 |
*/ |
| 13 |
|
| 14 |
/** |
| 15 |
* @var $app FluentBooking\Framework\Foundation\Application |
| 16 |
*/ |
| 17 |
|
| 18 |
/* |
| 19 |
* Register all the grouped action handlers |
| 20 |
*/ |
| 21 |
|
| 22 |
(new \FluentBooking\App\Hooks\Handlers\FrontEndHandler())->register(); |
| 23 |
(new \FluentBooking\App\Hooks\Handlers\CleanupHandlers\CleanupHandler())->register(); |
| 24 |
(new \FluentBooking\App\Hooks\Handlers\NotificationHandler())->register(); |
| 25 |
(new \FluentBooking\App\Hooks\Handlers\LogHandler())->register(); |
| 26 |
(new \FluentBooking\App\Hooks\Handlers\AdminMenuHandler())->register(); |
| 27 |
(new \FluentBooking\App\Hooks\Scheduler\FiveMinuteScheduler())->register(); |
| 28 |
(new \FluentBooking\App\Hooks\Scheduler\DailyScheduler())->register(); |
| 29 |
(new \FluentBooking\App\Services\LandingPage\LandingPageHandler())->boot(); |
| 30 |
|
| 31 |
/* |
| 32 |
* MCP (Model Context Protocol) server for AI agents. |
| 33 |
* Ships off — boot() only registers the Toolkit discovery filters until an |
| 34 |
* operator enables it in Settings. See docs/mcp-server-spec.md. |
| 35 |
*/ |
| 36 |
\FluentBooking\App\Modules\MCP\MCPInit::boot(); |
| 37 |
|
| 38 |
|
| 39 |
/* |
| 40 |
* Register all the single action handlers |
| 41 |
*/ |
| 42 |
$app->addAction('init', 'BlockEditorHandler@init'); |
| 43 |
|
| 44 |
$app->addAction('wp_ajax_fluent_booking_export_calendar', 'DataExporter@exportCalendar'); |
| 45 |
$app->addAction('wp_ajax_fluent_booking_export_hosts', 'DataExporter@exportBookingHosts'); |
| 46 |
$app->addAction('wp_ajax_fluent_booking_import_calendar', 'DataImporter@importCalendar'); |
| 47 |
|
| 48 |
$app->addAction('fluent_booking/after_calendar_event_landing_page', function () { |
| 49 |
echo wp_kses_post(\FluentBooking\App\Services\LandingPage\LandingPageHelper::getPoweredByHtml()); |
| 50 |
}, 10); |
| 51 |
|
| 52 |
add_action('init', function () { |
| 53 |
if (!isset($_REQUEST['gcal'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 54 |
return; |
| 55 |
} |
| 56 |
}); |
| 57 |
|