| @@ -11,34 +11,23 @@ | ||
| 11 | 11 | $app->addCustomAction('handle_exception', 'ExceptionHandler@handle'); |
| 12 | 12 | |
| 13 | 13 | $app->addAction('admin_menu', 'Menu@add'); |
| 14 | 14 | $app->addAction('admin_enqueue_scripts', 'Menu@maybeEnqueueAssets'); |
| 15 | -/* | |
| 16 | - * Admin Bar | |
| 17 | - */ | |
| 18 | 15 | $app->addAction('admin_bar_menu', 'AdminBarHandler@init'); |
| 19 | 16 | $app->addAction('wp_dashboard_setup', 'AdminBarHandler@initAdminWidget'); |
| 20 | 17 | |
| 21 | 18 | $app->addShortcode('fluent_support_portal', 'ShortcodeHandler@fluentSupportPortal'); |
| 22 | 19 | |
| 23 | -// init integrations | |
| 24 | 20 | add_action('init', function () { |
| 25 | 21 | (new \FluentSupport\App\Services\Integrations\IntegrationInit())->init(); |
| 26 | 22 | }); |
| 27 | 23 | |
| 28 | -// Activities | |
| 29 | 24 | (new \FluentSupport\App\Hooks\Handlers\ActivityLogger())->init(); |
| 30 | 25 | |
| 31 | -//AI Activities | |
| 32 | 26 | (new \FluentSupport\App\Hooks\Handlers\AIActivityLogger())->init(); |
| 33 | 27 | |
| 34 | -// Internal notifications | |
| 35 | 28 | (new \FluentSupport\App\Hooks\Handlers\InternalNotificationHandler())->init(); |
| 36 | 29 | |
| 37 | -/* | |
| 38 | - * Email Notification Hooks | |
| 39 | - */ | |
| 40 | - | |
| 41 | 30 | $app->addAction('fluent_support/ticket_created', 'EmailNotificationHandler@ticketCreated', 10, 2); |
| 42 | 31 | $app->addAction('fluent_support/response_added_by_agent', 'EmailNotificationHandler@agentReplied', 10, 3); |
| 43 | 32 | $app->addAction('fluent_support/response_added_by_customer', 'EmailNotificationHandler@customerReplied', 10, 3); |
| 44 | 33 | $app->addAction('fluent_support/ticket_closed_by_agent', 'EmailNotificationHandler@closedByAgent', 10, 2); |
| @@ -47,9 +36,8 @@ | ||
| 47 | 36 | $app->addAction('fluent_support/agent_initiated_ticket_response', 'EmailNotificationHandler@ticketCreatedByAgentOnBehalf', 10, 3); |
| 48 | 37 | |
| 49 | 38 | $app->addAction('fluent_support/async_agent_assigned_to_ticket', 'AsyncActionHandler@resolveAgentAssigned', 10, 4); |
| 50 | 39 | |
| 51 | -// Cleanup | |
| 52 | 40 | $app->addAction('fluent_support_hourly_tasks', 'CleanupHandler@initHourlyTasks'); |
| 53 | 41 | $app->addAction('fluent_support_daily_tasks', 'CleanupHandler@initDailyTasks'); |
| 54 | 42 | $app->addAction('fluent_support_weekly_tasks', 'CleanupHandler@maybeMaintanceTask'); |
| 55 | 43 | |
| @@ -65,9 +53,8 @@ | ||
| 65 | 53 | (new \FluentSupport\App\Hooks\Handlers\ExternalPages())->view_attachment(); |
| 66 | 54 | }); |
| 67 | 55 | } |
| 68 | 56 | |
| 69 | -// require the CLI | |
| 70 | 57 | if ( defined( 'WP_CLI' ) && WP_CLI ) { |
| 71 | 58 | \WP_CLI::add_command( 'fluent_support', '\FluentSupport\App\Hooks\CLI\FluentCli' ); |
| 72 | 59 | } |
| 73 | 60 | |
| @@ -73,20 +60,18 @@ | ||
| 73 | 60 | |
| 74 | 61 | |
| 75 | 62 | (new \FluentSupport\App\Hooks\Handlers\PermissionFilterManager)->init(); |
| 76 | 63 | |
| 77 | -// Register the WordPress personal data exporter and eraser | |
| 78 | 64 | (new \FluentSupport\App\Hooks\Handlers\PrivacyHandler())->init(); |
| 79 | 65 | |
| 80 | -// Action will be triggered when a support customer update their profile in wp | |
| 81 | 66 | $app->addAction('profile_update', '\FluentSupport\App\Services\ProfileInfoService@onWPProfileUpdate', 10, 3); |
| 82 | 67 | |
| 83 | -// Bind unlinked customer rows to a WordPress account at registration time. This | |
| 84 | -// is the only automatic binding left: an email change alone never claims a row. | |
| 68 | +// Registration is the only point that auto-links a customer row to a WP user. | |
| 69 | +// An email change alone never claims a row. | |
| 85 | 70 | $app->addAction('user_register', '\FluentSupport\App\Services\ProfileInfoService@onWPUserRegister', 10, 1); |
| 86 | 71 | $app->addAction('wp_ajax_fs_export_agent_report', 'FluentSupport\App\Hooks\Handlers\DataExporter@exportReport'); |
| 87 | 72 | |
| 88 | -// LiteSpeed Cache ESI mode enabled issue fixed | |
| 73 | +// Disable LiteSpeed ESI on Fluent Support requests. | |
| 89 | 74 | if(defined('LSCWP_V')){ |
| 90 | 75 | add_action('litespeed_init', function (){ |
| 91 | 76 | if(isset($_SERVER['REQUEST_URI']) && strpos(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])), 'fluent-support') !== false){ |
| 92 | 77 | defined( 'LITESPEED_ESI_OFF' ) || define( 'LITESPEED_ESI_OFF', true ); |
| @@ -95,9 +80,8 @@ | ||
| 95 | 80 | } |
| 96 | 81 | |
| 97 | 82 | $app->addAction('init', 'BlockEditorHandler@init'); |
| 98 | 83 | |
| 99 | -// MCP — toolkit discovery runs unconditionally so FluentHub can list Fluent | |
| 100 | -// Support even on WP < 6.9. The Abilities API / server hooks inside init() | |
| 101 | -// fire only when wp_register_ability / mcp_adapter_init are available. | |
| 84 | +// Boot MCP unconditionally so FluentHub can list us on WP < 6.9. The | |
| 85 | +// ability/server hooks only fire when the Abilities API or MCP adapter exists. | |
| 102 | 86 | \FluentSupport\App\Modules\MCP\MCPInit::boot(); |
| 103 | 87 | |