| 1 |
<?php namespace TierPricingTable\Settings\Sections\Multicurrency; |
| 2 |
|
| 3 |
use TierPricingTable\Settings\Sections\PluginPairingSectionAbstract; |
| 4 |
|
| 5 |
/** |
| 6 |
* "Multicurrency" pairing section — see PluginPairingSectionAbstract for the shared behaviour. |
| 7 |
*/ |
| 8 |
class MulticurrencySection extends PluginPairingSectionAbstract { |
| 9 |
|
| 10 |
public function getName(): string { |
| 11 |
return __( 'Multicurrency', 'tier-pricing-table' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function getSlug(): string { |
| 15 |
return 'multicurrency'; |
| 16 |
} |
| 17 |
|
| 18 |
public function getSupportedPlugins(): array { |
| 19 |
return array( |
| 20 |
'woocs' => array( |
| 21 |
'name' => 'FOX — Currency Switcher (WOOCS)', |
| 22 |
'active' => isset( $GLOBALS['WOOCS_STARTER'] ) || class_exists( '\\WOOCS' ), |
| 23 |
), |
| 24 |
'curcy' => array( |
| 25 |
'name' => 'CURCY — Multi Currency for WooCommerce', |
| 26 |
'active' => function_exists( 'wmc_get_price' ), |
| 27 |
), |
| 28 |
'aelia-multicurrency' => array( |
| 29 |
'name' => 'Aelia Currency Switcher', |
| 30 |
'active' => has_action( 'wc_aelia_cs_convert' ) || class_exists( '\\Aelia\\WC\\CurrencySwitcher\\WC_Aelia_CurrencySwitcher' ), |
| 31 |
), |
| 32 |
'wpml_multicurrency' => array( |
| 33 |
'name' => 'WPML Multicurrency (WCML)', |
| 34 |
'active' => isset( $GLOBALS['woocommerce_wpml'] ) && class_exists( '\\WCML_Multi_Currency' ), |
| 35 |
), |
| 36 |
'woopayments-multicurrency' => array( |
| 37 |
'name' => 'WooPayments Multi-Currency', |
| 38 |
'active' => class_exists( '\\WCPay\\MultiCurrency\\MultiCurrency' ), |
| 39 |
), |
| 40 |
'yith-multicurrency' => array( |
| 41 |
'name' => 'YITH Multi Currency Switcher', |
| 42 |
'active' => function_exists( 'yith_wcmcs_convert_price' ), |
| 43 |
), |
| 44 |
'wccs' => array( |
| 45 |
'name' => 'WooCommerce Currency Switcher (WP Experts)', |
| 46 |
'active' => isset( $GLOBALS['WCCS'] ), |
| 47 |
), |
| 48 |
); |
| 49 |
} |
| 50 |
|
| 51 |
public function isOwnPluginActive(): bool { |
| 52 |
return class_exists( '\\U2Code\\Multicurrency\\Plugin' ); |
| 53 |
} |
| 54 |
|
| 55 |
public function getOwnPluginName(): string { |
| 56 |
return 'U2Code Multicurrency'; |
| 57 |
} |
| 58 |
|
| 59 |
public function getOwnPluginIconAsset(): string { |
| 60 |
return 'admin/integrations/u2code-multicurrency-icon.png'; |
| 61 |
} |
| 62 |
|
| 63 |
public function getOwnPluginBannerAsset(): string { |
| 64 |
return 'admin/integrations/u2code-multicurrency-banner.png'; |
| 65 |
} |
| 66 |
|
| 67 |
public function getOwnPluginPills(): array { |
| 68 |
return array( |
| 69 |
__( 'Automatic exchange rates', 'tier-pricing-table' ), |
| 70 |
__( 'Geolocation', 'tier-pricing-table' ), |
| 71 |
__( 'Per-currency price rules', 'tier-pricing-table' ), |
| 72 |
__( 'Multi-currency checkout', 'tier-pricing-table' ), |
| 73 |
); |
| 74 |
} |
| 75 |
|
| 76 |
public function getOwnPluginWporgURL(): string { |
| 77 |
return 'https://wordpress.org/plugins/u2code-product-multicurrency-for-woocommerce/'; |
| 78 |
} |
| 79 |
|
| 80 |
public function getOwnPluginSiteURL(): string { |
| 81 |
return 'https://u2code.com/plugins/multicurrency-for-woocommerce/'; |
| 82 |
} |
| 83 |
|
| 84 |
public function getUtmCampaignBase(): string { |
| 85 |
return 'multicurrency'; |
| 86 |
} |
| 87 |
|
| 88 |
public function getIntroHeading(): string { |
| 89 |
return __( 'Tiered pricing works with multi-currency stores', 'tier-pricing-table' ); |
| 90 |
} |
| 91 |
|
| 92 |
public function getIntroText(): string { |
| 93 |
return __( 'When a currency switcher is active, tiered prices follow it: tier rules, role-based prices, catalog prices and cart discounts are converted to the visitor\'s currency.', 'tier-pricing-table' ); |
| 94 |
} |
| 95 |
|
| 96 |
public function getPromoText(): string { |
| 97 |
return __( 'U2Code Multicurrency is built by the makers of Tiered Pricing Table — a native pairing instead of an adapter: tier and role prices convert natively, per-currency price rules, and one support team for both plugins.', 'tier-pricing-table' ); |
| 98 |
} |
| 99 |
|
| 100 |
public function getPairedBannerText(): string { |
| 101 |
return '<strong>' . esc_html__( 'U2Code Multicurrency is active — the native pairing.', 'tier-pricing-table' ) . '</strong> ' |
| 102 |
. esc_html__( 'Tiered, role-based and catalog prices convert to the visitor\'s currency automatically.', 'tier-pricing-table' ); |
| 103 |
} |
| 104 |
|
| 105 |
public function getIntegrationEnabledText(): string { |
| 106 |
return __( 'The Tiered Pricing integration for it is enabled — tiered prices are converted at the current exchange rate.', 'tier-pricing-table' ); |
| 107 |
} |
| 108 |
|
| 109 |
public function getIntegrationDisabledText(): string { |
| 110 |
return __( 'The Tiered Pricing integration for it is disabled — tiered prices may not convert correctly.', 'tier-pricing-table' ); |
| 111 |
} |
| 112 |
|
| 113 |
public function getConflictText( string $competitorNames ): string { |
| 114 |
return '<strong>' . esc_html__( 'Two currency systems are active.', 'tier-pricing-table' ) . '</strong> ' |
| 115 |
. sprintf( |
| 116 |
/* translators: %s: competitor plugin name(s) */ |
| 117 |
esc_html__( 'U2Code Multicurrency and %s will both try to convert prices. Deactivate one of them — we recommend keeping U2Code Multicurrency for the native pairing with tiered pricing.', 'tier-pricing-table' ), |
| 118 |
esc_html( $competitorNames ) |
| 119 |
); |
| 120 |
} |
| 121 |
} |
| 122 |
|