PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.2
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.2
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / app / Http / Controllers / AddonsController.php

AddonsController.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.2, at app/Http/Controllers/AddonsController.php

151 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Http\Controllers;
4
5 use FluentCart\App\App;
6 use FluentCart\App\Services\PluginInstaller\BackgroundInstaller;
7 use FluentCart\App\Vite;
8 use FluentCart\Framework\Http\Request\Request;
9
10 class AddonsController extends Controller
11 {
12
13 public function getAddons(Request $request)
14 {
15 $addons = [
16 'fluent-crm' => [
17 'installable' => 'fluent-crm',
18 'enabled' => defined('FLUENTCRM'),
19 'title' => __('FluentCRM', 'fluent-cart'),
20 'logo' => Vite::getAssetUrl('images/integrations/fluentcrm.svg'),
21 'categories' => [
22 'crm',
23 'core',
24 'marketing',
25 ],
26 'description' => __('The most powerful and user-friendly email marketing automation plugin for WordPress. Send newsletters, marketing emails, customer onboard emails, Automations with FluentCart + FluentCRM integration.', 'fluent-cart' ),
27 ],
28 'fluent-smtp' => [
29 'installable' => 'fluent-smtp',
30 'logo' => Vite::getAssetUrl('images/integrations/fluent-smtp.svg'),
31 'enabled' => defined('FLUENTMAIL_PLUGIN_FILE'),
32 'title' => __('FluentSMTP', 'fluent-cart'),
33 'categories' => [
34 'core',
35 'marketing',
36 ],
37 'description' => __('A free and open-source WordPress SMTP plugin to send emails via multiple SMTP providers. Ensure email deliverability for your WooCommerce and FluentCart emails with FluentSMTP.', 'fluent-cart'),
38 ],
39 'fluent-community' => [
40 'installable' => 'fluent-community',
41 'logo' => Vite::getAssetUrl('images/integrations/fluent-community.svg'),
42 'enabled' => defined('FLUENT_COMMUNITY_PLUGIN_VERSION'),
43 'title' => __('FluentCommunity', 'fluent-cart'),
44 'categories' => [
45 'core',
46 'community',
47 'lms'
48 ],
49 'description' => __('Build a community, membership site, or online forum with FluentCart + FluentCommunity integration. Engage your customers and users right from your WordPress dashboard.', 'fluent-cart'),
50 ],
51 'fluent-security' => [
52 'installable' => 'fluent-security',
53 'logo' => Vite::getAssetUrl('images/integrations/fluent-auth.svg'),
54 'enabled' => defined('FLUENT_AUTH_VERSION'),
55 'title' => __('FluentAuth', 'fluent-cart'),
56 'categories' => [
57 'core'
58 ],
59 'description' => __('Customize WordPress emails, customized login & signup forms with enhanced security and social logins. Enhance your site security with FluentCart + FluentSecurity integration.', 'fluent-cart'),
60 ],
61 'fluentform' => [
62 'installable' => 'fluentform',
63 'logo' => Vite::getAssetUrl('images/integrations/fluent-form.svg'),
64 'enabled' => defined('FLUENTFORM'),
65 'title' => __('Fluent Forms', 'fluent-cart'),
66 'categories' => [
67 'core',
68 'marketing'
69 ],
70 'description' => __('Create advanced forms and surveys with an easy-to-use drag & drop form builder.', 'fluent-cart'),
71 ],
72 'fluent-support' => [
73 'installable' => 'fluent-support',
74 'logo' => Vite::getAssetUrl('images/integrations/fluent-support.svg'),
75 'enabled' => defined('FLUENT_SUPPORT_VERSION'),
76 'title' => __('FluentSupport', 'fluent-cart'),
77 'categories' => [
78 'core',
79 'marketing'
80 ],
81 'description' => __('A powerful helpdesk and customer support plugin for WordPress. Manage customer support tickets directly from your WordPress dashboard with FluentCart + FluentSupport integration.', 'fluent-cart'),
82 ]
83 ];
84
85 $addons = array_merge($addons, $this->getPremiumIntegrations());
86
87 $addons = apply_filters('fluent_cart/integration/addons', $addons);
88
89 return [
90 'addons' => $addons
91 ];
92 }
93
94 public function getPremiumIntegrations() {
95 return [
96 'webhook' => [
97 'title' => __('Webhook', 'fluent-cart'),
98 'description' => __('Send data anywhere via webhook', 'fluent-cart'),
99 'logo' => Vite::getAssetUrl('images/integrations/webhook.svg'),
100 'enabled' => App::isProActive() ? true : false,
101 'is_pro' => true,
102 'is_pro_active' => App::isProActive(),
103 'categories' => ['core'],
104 ],
105 'wp_user' => [
106 'title' => __('WP User Create/Update', 'fluent-cart'),
107 'description' => __('Create / Update WP User with Custom Roles on order events', 'fluent-cart'),
108 'logo' => Vite::getAssetUrl('images/integrations/wp_user.svg'),
109 'enabled' => App::isProActive() ? true : false,
110 'is_pro_active' => App::isProActive(),
111 'is_pro' => true,
112 'categories' => ['core'],
113 ],
114 ];
115 }
116
117 public function installAndActivate(Request $request)
118 {
119 $addon = $request->getSafe('addon', 'sanitize_text_field');
120
121 $listedPlugins = apply_filters('fluent_cart/installable_repo_plugins', [
122 'fluent-crm',
123 'fluent-smtp',
124 'fluent-community',
125 'fluent-security',
126 'fluentform',
127 'fluent-support'
128 ]);
129
130 if (!$addon || !in_array($addon, $listedPlugins)) {
131 return $this->sendError([
132 'message' => __('This addon cannot be installed at this time', 'fluent-cart')
133 ]);
134 }
135
136 $result = (new BackgroundInstaller())->installPlugin($addon);
137
138 if (is_wp_error($result)) {
139 return $this->sendError([
140 'message' => $result->get_error_message()
141 ]);
142 }
143
144 return $this->sendSuccess([
145 'message' => __('Addon installation started successfully.', 'fluent-cart'),
146 'redirect' => admin_url('admin.php?page=fluent-cart#/integrations')
147 ]);
148 }
149
150 }
151