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 / app / Modules / PaymentMethods / Core / BaseGatewaySettings.php

BaseGatewaySettings.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.6.4, at app/Modules/PaymentMethods/Core/BaseGatewaySettings.php

53 lines 1.3 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\Modules\PaymentMethods\Core;
4
5 use FluentCart\App\App;
6 use FluentCart\App\Models\Meta;
7 use FluentCart\Framework\Support\Arr;
8
9 abstract class BaseGatewaySettings
10 {
11 public static array $allSettings = [];
12 private static bool $settingsLoaded = false;
13
14 public $settings;
15 public $methodHandler;
16
17 public function __construct()
18 {
19 if (!self::$settingsLoaded) {
20 self::$allSettings = Meta::query()
21 ->whereLike('meta_key', 'fluent_cart_payment_settings\\_%',)
22 ->get()
23 ->pluck('meta_value', 'meta_key')
24 //->keyBy('meta_key')
25 ->toArray();
26
27 self::$settingsLoaded = true;
28 }
29
30 try {
31 $settings = Arr::get(self::$allSettings, $this->methodHandler, []);
32 } catch (\Exception $e) {
33
34 }
35
36 if (!is_array($settings)) {
37 $settings = [];
38 }
39
40 $this->settings = wp_parse_args($settings, static::getDefaults());
41 }
42
43 abstract public function get($key = '');
44 abstract public function getMode();
45 abstract public function isActive();
46
47 public function getCachedSettings()
48 {
49 return Arr::get(self::$allSettings, $this->methodHandler);
50 }
51 }
52
53