PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
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 1.2.0 All 47 releases
fluent-cart / boot / app.php

app.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at boot/app.php

86 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2 <?php
3
4 use FluentCart\Database\DBMigrator;
5 use FluentCart\Framework\Foundation\Application;
6 use FluentCart\App\Hooks\Handlers\ActivationHandler;
7 use FluentCart\App\Hooks\Handlers\DeactivationHandler;
8 use FluentCart\App\Services\Permission\PermissionManager;
9
10 return function ($file) {
11
12 // $errorHandler = __DIR__ . "/error_handler.php";
13
14 // if (0 !== error_reporting() && file_exists($errorHandler)) {
15 // require_once $errorHandler;
16 // }
17
18 $app = new Application($file);
19
20 register_activation_hook($file, function ($networkwide = false) use ($app) {
21 ($app->make(ActivationHandler::class))->handle($networkwide);
22 });
23
24 register_deactivation_hook($file, function () use ($app) {
25 ($app->make(DeactivationHandler::class))->handle();
26 });
27
28 require_once(FLUENTCART_PLUGIN_PATH . 'boot/action_scheduler_loader.php');
29
30 add_action('plugins_loaded', function () use ($app) {
31 do_action('fluentcart_loaded', $app);
32
33 (new FluentCart\App\Modules\Data\ProductDataSetup())->boot();
34
35 add_action('init', function () use ($app) {
36
37 // maybe database changes
38 DBMigrator::maybeMigrateDBChanges();
39
40 do_action('fluent_cart/init', $app);
41
42 if (defined('DATABASE_TYPE') && DATABASE_TYPE === 'sqlite') {
43 add_action('admin_notices', function () {
44 ?>
45 <div class="notice notice-warning">
46 <p><?php echo 'FluentCart requires MySQL/MariaDB database Engine. Looks like you are using sqlite database. FluentCart will not work on this site.'; ?></p>
47 </div>
48 <?php
49 });
50 }
51
52
53 });
54
55 if (defined('FLUENTCART_PRO_PLUGIN_VERSION')) {
56 add_filter('fluent_cart/admin_notices', function ($notices) {
57 if (FLUENTCART_MIN_PRO_VERSION !== FLUENTCART_PRO_PLUGIN_VERSION && version_compare(FLUENTCART_MIN_PRO_VERSION, FLUENTCART_PRO_PLUGIN_VERSION, '>')) {
58 if(!PermissionManager::userCan('is_super_admin')) {
59 return $notices;
60 }
61
62 $updateUrl = admin_url('plugins.php?s=fluent-cart&plugin_status=all&fluent-cart-pro-check-update=' . time());
63
64 $notices[] = [
65 'id' => 'update_license',
66 'type' => 'core_update',
67 'html' => '<div>FluentCart Pro Plugin needs to be updated to the latest version. <a href="' . esc_url($updateUrl) . '">Click here to update</a></div>'
68 ];
69 }
70 return $notices;
71 });
72 }
73 });
74
75
76 add_action('wp_insert_site', function ($new_site) use ($app) {
77 if (is_plugin_active_for_network('fluent-cart/fluent-cart.php')) {
78 switch_to_blog($new_site->blog_id);
79 ($app->make(ActivationHandler::class))->handle(false);
80 restore_current_blog();
81 }
82 });
83
84 return $app;
85 };
86