PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.14
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.14
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / boot / app.php

app.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.14, at boot/app.php

128 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') or die;
4
5 use FluentForm\Framework\Foundation\Application;
6 use FluentForm\App\Hooks\Handlers\ActivationHandler;
7 use FluentForm\App\Hooks\Handlers\DeactivationHandler;
8 use FluentForm\App\Services\Migrator\Bootstrap as FormsMigrator;
9 use FluentForm\App\Services\FluentConversational\Classes\Form as FluentConversational;
10 use FluentForm\Database\Migrations\LegacyManagerScopes;
11 use FluentForm\App\Helpers\Helper;
12
13 return function ($file) {
14 add_action('plugins_loaded', function () {
15 $isNotCompatible = defined('FLUENTFORMPRO')
16 && version_compare(FLUENTFORMPRO_VERSION, '6.2.0', '<');
17 if ($isNotCompatible) {
18 add_action('admin_init', function () {
19 $message = '<b>' . __('Action Required: ', 'fluentform') . '</b>'
20 . __('Fluent Forms Pro is not compatible with this version of Fluent Forms. Please update Fluent Forms Pro to version ', 'fluentform')
21 . '6.2.0' . __(' or later.', 'fluentform')
22 . ' <a href="' . admin_url('plugins.php?s=fluentformpro&plugin_status=all&force-check=1') . '">'
23 . __('Update Now', 'fluentform') . '</a>';
24 $renderNotice = function () use ($message) {
25 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Admin notice with HTML links
26 printf('<div class="fluentform-admin-notice notice notice-error"><div style="padding: 15px 10px;">%1$s</div></div>', $message);
27 };
28 add_action('fluentform/global_menu', $renderNotice);
29 add_action('fluentform/after_form_menu', $renderNotice);
30 });
31 }
32
33 fluentform_maybe_disable_contaminated_pro();
34 });
35
36 $app = new Application($file);
37
38 // Boot the MCP server (Abilities API tools + endpoint). Self-guards: ships
39 // off, and its Abilities/adapter hooks fire only when those systems exist.
40 \FluentForm\App\Modules\MCP\MCPInit::boot();
41
42 register_activation_hook($file, function ($network_wide) use ($app) {
43 ($app->make(ActivationHandler::class))->handle($network_wide);
44 });
45
46 $initializeNewSite = function ($blogId) use ($app) {
47 if (!is_plugin_active_for_network('fluentform/fluentform.php')) {
48 return;
49 }
50
51 switch_to_blog($blogId);
52 ($app->make(ActivationHandler::class))->handle(false);
53 restore_current_blog();
54 };
55
56 if (function_exists('wp_initialize_site')) {
57 add_action('wp_initialize_site', function ($newSite) use ($initializeNewSite) {
58 $initializeNewSite($newSite->id);
59 }, 20, 1);
60 } else {
61 add_action('wpmu_new_blog', function ($blogId) use ($initializeNewSite) {
62 $initializeNewSite($blogId);
63 }, 10, 1);
64 }
65
66 register_deactivation_hook($file, function () use ($app) {
67 ($app->make(DeactivationHandler::class))->handle();
68 });
69
70 add_action('admin_init', function () {
71 if (!wp_doing_ajax()) {
72 LegacyManagerScopes::migrate();
73 }
74 });
75
76 add_action('plugins_loaded', function () use ($app) {
77 do_action_deprecated(
78 'fluentform_loaded',
79 [
80 $app
81 ],
82 FLUENTFORM_FRAMEWORK_UPGRADE,
83 'fluentform/loaded',
84 'Use fluentform/loaded instead of fluentform_loaded.'
85 );
86
87 do_action_deprecated(
88 'fluentform-loaded',
89 [
90 $app
91 ],
92 FLUENTFORM_FRAMEWORK_UPGRADE,
93 'fluentform/loaded',
94 'Use fluentform/loaded instead of fluentform-loaded.'
95 );
96 do_action('fluentform/loaded', $app);
97
98 });
99
100 fluentformLoadFile('Services/FluentConversational/plugin.php');
101 fluentformLoadFile('Services/Libraries/action-scheduler/action-scheduler.php');
102
103 (new FluentConversational)->boot();
104 (new FormsMigrator())->boot();
105
106 /* Plugin Meta Links — registered on init to avoid early textdomain loading (WP 6.7+) */
107
108 add_action('init', function () {
109 add_filter('plugin_row_meta', 'fluentform_plugin_row_meta', 10, 2);
110 });
111
112 function fluentform_plugin_row_meta($links, $file)
113 {
114 if ('fluentform/fluentform.php' == $file) {
115 $row_meta = [
116 'docs' => '<a rel="noopener" href="https://fluentforms.com/docs" style="color: #197efb;font-weight: 600;" aria-label="' . esc_attr__('View FluentForms Documentation', 'fluentform') . '" target="_blank">' . esc_html__('Docs', 'fluentform') . '</a>',
117 'support' => '<a rel="noopener" href="https://wpmanageninja.com/support-tickets/#/" style="color: #197efb;font-weight: 600;" aria-label="' . esc_attr__('Get Support', 'fluentform') . '" target="_blank">' . esc_html__('Support', 'fluentform') . '</a>',
118 'developer_docs' => '<a rel="noopener" href="https://developers.fluentforms.com" style="color: #197efb;font-weight: 600;" aria-label="' . esc_attr__('Developer Docs', 'fluentform') . '" target="_blank">' . esc_html__('Developer Docs', 'fluentform') . '</a>',
119 ];
120 if (!defined('FLUENTFORMPRO')) {
121 $row_meta['pro'] = '<a rel="noopener" href="' . esc_url(fluentform_upgrade_url('plugin_row_meta')) . '" style="color: #7742e6;font-weight: bold;" aria-label="' . esc_attr__('Upgrade to Pro', 'fluentform') . '" target="_blank">' . esc_html__('Upgrade to Pro', 'fluentform') . '</a>';
122 }
123 return array_merge($links, $row_meta);
124 }
125 return (array)$links;
126 }
127 };
128