PluginProbe
X-Currency – The Ultimate WooCommerce currency switcher for a smoother shopping experience / 2.3.1
X-Currency – The Ultimate WooCommerce currency switcher for a smoother shopping experience v2.3.1
1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 All 53 releases
x-currency / x-currency.php

x-currency.php in X-Currency – The Ultimate WooCommerce currency switcher for a smoother shopping experience 2.3.1, at x-currency.php

101 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 use XCurrency\App\Repositories\CurrencyRepository;
6 use XCurrency\App\Repositories\SettingRepository;
7 use XCurrency\WpMVC\App;
8 use XCurrency\App\Providers\ProVersionUpdateServiceProvider;
9
10 /**
11 * Plugin Name: X-Currency
12 * Description: Currency Switcher for WooCommerce custom currency, exchange rates, currency by country, pay in selected currency
13 * Version: 2.3.1
14 * Requires at least: 6.5
15 * Requires PHP: 8.1
16 * Tested up to: 6.9
17 * Author: Crafium
18 * Author URI: https://crafium.com/
19 * License: GPL v3 or later
20 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
21 * Text Domain: x-currency
22 * Domain Path: /languages
23 * Requires Plugins: woocommerce
24 */
25
26 require_once __DIR__ . '/vendor/vendor-src/autoload.php';
27 require_once __DIR__ . '/app/Helpers/helper.php';
28
29 final class XCurrency {
30 public static XCurrency $instance;
31
32 public static function instance() {
33 if ( empty( static::$instance ) ) {
34 static::$instance = new self();
35 }
36 return static::$instance;
37 }
38
39 public function boot() {
40 $application = App::instance();
41
42 $application->boot( __FILE__, __DIR__ );
43
44 x_currency_singleton( ProVersionUpdateServiceProvider::class )->boot();
45
46 register_activation_hook(
47 __FILE__, function() {
48 ( new XCurrency\Database\Migrations\Currency( x_currency_singleton( SettingRepository::class ), x_currency_singleton( CurrencyRepository::class ) ) )->execute();
49 }
50 );
51
52 $client = new \XCurrency\Appsero\Client( '5b5a97ed-213e-4a32-baef-a62e9ec0c2f5', 'X-Currency', __FILE__ );
53 $client->insights()->init();
54
55 /**
56 * Fires once activated plugins have loaded.
57 *
58 */
59 add_action(
60 'plugins_loaded', function () use ( $application ): void {
61
62 $stop = apply_filters( 'stop_load_x_currency', false );
63
64 if ( $stop ) {
65 add_filter( 'stop_load_x_currency_pro', '__return_true' );
66 return;
67 }
68
69 do_action( 'before_load_x_currency' );
70
71 $application->load();
72
73 do_action( 'after_load_x_currency' );
74 }, 11
75 );
76
77 add_action( 'plugins_loaded', [ $this, 'stop_load_pro' ], 5 );
78 }
79
80 public function stop_load_pro() : void {
81 add_filter(
82 'stop_load_x_currency_pro', function() {
83 if ( function_exists( 'x_currency_pro_config' ) ) {
84 $current_version = x_currency_pro_config()->get( 'app.version' );
85 } else {
86 $plugin_data = get_plugin_data( ABSPATH . DIRECTORY_SEPARATOR . PLUGINDIR . DIRECTORY_SEPARATOR . 'x-currency-pro/x-currency-pro.php' );
87 $current_version = $plugin_data['Version'];
88 }
89
90 $required_pro_version = '2.3.0';
91
92 if ( -1 === version_compare( $current_version, $required_pro_version ) ) {
93 return true;
94 }
95 return false;
96 }
97 );
98 }
99 }
100
101 XCurrency::instance()->boot();