PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.6
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.6
1.6.6 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 All 49 releases
← All changes | app/Hooks/Handlers/GlobalStorageHandler.php +47 -1 1.3.20 → 1.6.6 View file →
@@ -1,10 +1,13 @@
1 1 <?php
2 2
3 3 namespace FluentCart\App\Hooks\Handlers;
4 4
5 +use FluentCart\App\App;
6 +use FluentCart\App\Helpers\Helper;
5 7 use FluentCart\App\Modules\StorageDrivers\Local\Local;
6 8 use FluentCart\App\Modules\StorageDrivers\S3\S3;
9 +use FluentCart\App\Vite;
7 10 use FluentCart\Api\StorageDrivers;
8 11
9 12 class GlobalStorageHandler
10 13 {
@@ -17,8 +20,13 @@
17 20 {
18 21 add_action('init', function () {
19 22 (new Local())->init();
20 23 (new S3())->init();
24 +
25 + if (!App::isProActive()) {
26 + add_filter('fluent_cart/storage/get_global_storage_drivers', [$this, 'registerPromoR2Driver'], 20, 2);
27 + }
28 +
21 29 //This hook will allow others to register their storage driver with ours
22 30 do_action('fluent_cart/register_storage_drivers');
23 31 },9);
24 32
@@ -47,6 +55,44 @@
47 55 {
48 56 $storageDrivers = new StorageDrivers();
49 57 return $storageDrivers->getActive();
50 58 }
51 -
59 +
60 + public function registerPromoR2Driver($drivers, $args)
61 + {
62 + if (isset($drivers['r2'])) {
63 + return $drivers;
64 + }
65 +
66 + $drivers['r2'] = [
67 + 'title' => __('Cloudflare R2', 'fluent-cart'),
68 + 'route' => '',
69 + 'description' => __('Store downloadable product files in Cloudflare R2. Available in FluentCart Pro.', 'fluent-cart'),
70 + 'logo' => $this->getPromoR2Logo(),
71 + 'dark_logo' => $this->getPromoR2DarkLogo(),
72 + 'status' => false,
73 + 'brand_color' => '#f38020',
74 + 'has_bucket' => true,
75 + 'requires_pro' => true,
76 + 'upgrade_url' => Helper::getUpgradeUrl('feature_lock_storage_r2'),
77 + 'instance' => new class {
78 + public function isEnabled()
79 + {
80 + return false;
81 + }
82 + }
83 + ];
84 +
85 + return $drivers;
86 + }
87 +
88 + public function getPromoR2Logo()
89 + {
90 + return Vite::getAssetUrl('images/storage-drivers/r2.svg');
91 + }
92 +
93 + public function getPromoR2DarkLogo()
94 + {
95 + return Vite::getAssetUrl('images/storage-drivers/r2.svg');
96 + }
97 +
52 98 }