Config.php
56 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Container; |
| 4 | |
| 5 | class Config { |
| 6 | |
| 7 | public static function getSharedInstances() { |
| 8 | global $woocommerce_wpml; |
| 9 | |
| 10 | return [ |
| 11 | $woocommerce_wpml, |
| 12 | ]; |
| 13 | } |
| 14 | |
| 15 | public static function getSharedClasses() { |
| 16 | return [ |
| 17 | \WCML_Currencies_Payment_Gateways::class, |
| 18 | \WCML_Dependencies::class, |
| 19 | \WCML_Exchange_Rates::class, |
| 20 | \WCML_Multi_Currency::class, |
| 21 | ]; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * When WPML and WCML are active, but WC is not: |
| 26 | * - WCML needs very basic classes to function properly (e.g., checking requirements to display a message about the lack, or too old version of WC) |
| 27 | */ |
| 28 | public static function getSharedClassesWhenWooCommerceIsInactive(): array { |
| 29 | return [ |
| 30 | \WCML_Dependencies::class, |
| 31 | ]; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Replaces global $sitepress with null object. |
| 36 | * |
| 37 | * @return array |
| 38 | */ |
| 39 | public static function getAliases() { |
| 40 | return [ |
| 41 | \WPML\Core\ISitePress::class => \WCML\functions\isStandAlone() |
| 42 | ? \WCML\StandAlone\NullSitePress::class |
| 43 | : \SitePress::class, |
| 44 | ]; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @return array |
| 49 | */ |
| 50 | public static function getDelegated() { |
| 51 | return [ |
| 52 | \WCML_Exchange_Rates::class => [ \WCML_Exchange_Rates::class, 'create' ], |
| 53 | ]; |
| 54 | } |
| 55 | } |
| 56 |