PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.19
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.19
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 / App.php

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

103 lines 2.7 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;
4
5 use FluentCart\Api\StoreSettings;
6 use FluentCart\Framework\Support\Once;
7 use FluentCart\Framework\Foundation\App as AppFacade;
8
9 /**
10 * Class App
11 *
12 * @method static \FluentCart\Framework\Http\Request\Request request() Get the current request instance.
13 * @method static \FluentCart\Framework\Database\DBManager db()
14 * @method static \FluentCart\Framework\Http\Response\Response response()
15 * @method static \FluentCart\Framework\View\View view()
16 * @method static \FluentCart\Framework\Foundation\Config config()
17 */
18
19
20 /**
21 * @method static \FluentCart\Framework\Database\Query\WPDBConnection db()
22 */
23
24 class App extends AppFacade
25 {
26 public static function slug()
27 {
28 return static::config()->get('app.slug');
29 }
30
31 public static function route()
32 {
33 return static::request()->route();
34 }
35
36 public static function call($action, array $parameters = [])
37 {
38 return static::getInstance()->call(
39 $action,
40 $parameters
41 );
42 }
43
44 public static function storeSettings()
45 {
46 return Once::call(function () {
47 return new StoreSettings();
48 });
49 }
50
51 /**
52 * Get the payment gateway manager or a specific gateway
53 *
54 * @param string|null $gatewayName Optional gateway name to retrieve directly
55 * @return \FluentCart\App\Modules\PaymentMethods\Core\GatewayManager|\FluentCart\App\Modules\PaymentMethods\Core\PaymentGatewayInterface|null
56 */
57 public static function gateway(?string $gatewayName = null)
58 {
59 $gatewayManager = static::getInstance('gateway');
60
61 // If gateway name is provided, return the specific gateway
62 if ($gatewayName !== null) {
63 return $gatewayManager->get($gatewayName);
64 }
65
66 // Otherwise return the manager instance
67 return $gatewayManager;
68 }
69
70 public static function isProActive()
71 {
72 return defined('FLUENTCART_PRO_PLUGIN_VERSION');
73 }
74
75 public static function doingRestRequest()
76 {
77 if (defined('REST_REQUEST') && REST_REQUEST) {
78 return true;
79 }
80
81 // Fallback: check URL for /wp-json/
82 $rest_prefix = trailingslashit(rest_get_url_prefix());
83 if (isset($_SERVER['REQUEST_URI'])) {
84 $request_uri = sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI']));
85 if (strpos($request_uri, $rest_prefix) !== false) {
86 return true;
87 }
88 }
89
90 return false;
91 }
92
93 public static function isDevMode()
94 {
95 return static::config()->get('env') === 'dev';
96 }
97
98 public static function localization()
99 {
100 return static::getInstance('localization');
101 }
102 }
103