| @@ -1,54 +1,104 @@ | ||
| 1 | 1 | <?php namespace TierPricingTable\Integrations; |
| 2 | 2 | |
| 3 | +use TierPricingTable\Integrations\Plugins\AddifyRequestAQuote; | |
| 4 | +use TierPricingTable\Integrations\Plugins\AeliaMulticurrency; | |
| 5 | +use TierPricingTable\Integrations\Plugins\Curcy; | |
| 6 | +use TierPricingTable\Integrations\Plugins\DiscountRulesForWooCommerce; | |
| 7 | +use TierPricingTable\Integrations\Plugins\Elementor\ElementorIntegration; | |
| 3 | 8 | use TierPricingTable\Integrations\Plugins\MixMatch; |
| 9 | +use TierPricingTable\Integrations\Plugins\ProductBundles; | |
| 10 | +use TierPricingTable\Integrations\Plugins\RankMath\RankMath; | |
| 11 | +use TierPricingTable\Integrations\Plugins\SEOPress\SEOPress; | |
| 12 | +use TierPricingTable\Integrations\Plugins\U2CodeProductAddons; | |
| 13 | +use TierPricingTable\Integrations\Plugins\U2CodeMulticurrency; | |
| 14 | +use TierPricingTable\Integrations\Plugins\WCCS; | |
| 15 | +use TierPricingTable\Integrations\Plugins\WCPA; | |
| 16 | +use TierPricingTable\Integrations\Plugins\WCPProductBundles; | |
| 17 | +use TierPricingTable\Integrations\Plugins\WooPaymentsMulticurrency; | |
| 18 | +use TierPricingTable\Integrations\Plugins\WombatProductAddons; | |
| 19 | +use TierPricingTable\Integrations\Plugins\WooCommerceDeposits; | |
| 20 | +use TierPricingTable\Integrations\Plugins\WooCommerceProductAddons; | |
| 21 | +use TierPricingTable\Integrations\Plugins\WooCommerceSubscriptions; | |
| 22 | +use TierPricingTable\Integrations\Plugins\WOOCS; | |
| 23 | +use TierPricingTable\Integrations\Plugins\WPAllImport; | |
| 24 | +use TierPricingTable\Integrations\Plugins\WPMLMulticurrency; | |
| 25 | +use TierPricingTable\Integrations\Plugins\WPMLMultilingual; | |
| 26 | +use TierPricingTable\Integrations\Plugins\YithMulticurrency; | |
| 27 | +use TierPricingTable\Integrations\Plugins\YithRequestAQuote; | |
| 28 | +use TierPricingTable\Integrations\Plugins\Yoast\Yoast; | |
| 29 | +use TierPricingTable\Integrations\Themes\Astra; | |
| 4 | 30 | use TierPricingTable\Integrations\Themes\Avada; |
| 5 | 31 | use TierPricingTable\Integrations\Themes\Divi; |
| 6 | -use TierPricingTable\Integrations\Themes\Electro; | |
| 7 | 32 | use TierPricingTable\Integrations\Themes\Flatsome; |
| 8 | 33 | use TierPricingTable\Integrations\Themes\Merchandiser; |
| 9 | -use TierPricingTable\Integrations\Themes\Neto; | |
| 10 | 34 | use TierPricingTable\Integrations\Themes\OceanWp; |
| 11 | 35 | use TierPricingTable\Integrations\Themes\Shopkeeper; |
| 12 | 36 | use TierPricingTable\Integrations\Themes\TheRetailer; |
| 37 | +use TierPricingTable\Integrations\Themes\Zakra; | |
| 13 | 38 | |
| 14 | 39 | class Integrations { |
| 15 | - | |
| 16 | - private $themes = array(); | |
| 17 | - | |
| 18 | - private $plugins = array(); | |
| 19 | - | |
| 40 | + | |
| 20 | 41 | public function __construct() { |
| 21 | 42 | $this->init(); |
| 22 | - add_action( 'init', function () { | |
| 23 | - // dd( wp_get_theme()->name ); | |
| 24 | - } ); | |
| 25 | 43 | } |
| 26 | - | |
| 44 | + | |
| 27 | 45 | public function init() { |
| 28 | - $this->themes = apply_filters( 'tier_pricing_table/integrations/themes', array( | |
| 29 | - 'Avada' => Avada::class, | |
| 30 | - 'Divi' => Divi::class, | |
| 31 | - 'OceanWP' => OceanWp::class, | |
| 32 | - 'Flatsome' => Flatsome::class, | |
| 33 | - 'Shopkeeper' => Shopkeeper::class, | |
| 34 | - 'The Retailer' => TheRetailer::class, | |
| 35 | - 'Merchandiser' => Merchandiser::class, | |
| 36 | - 'Electro' => Electro::class, | |
| 46 | + $themes = apply_filters( 'tiered_pricing_table/integrations/themes', array( | |
| 47 | + 'avada' => Avada::class, | |
| 48 | + 'astra' => Astra::class, | |
| 49 | + 'divi' => Divi::class, | |
| 50 | + 'oceanWP' => OceanWp::class, | |
| 51 | + 'flatsome' => Flatsome::class, | |
| 52 | + 'shopkeeper' => Shopkeeper::class, | |
| 53 | + 'the retailer' => TheRetailer::class, | |
| 54 | + 'merchandiser' => Merchandiser::class, | |
| 55 | + 'zakra' => Zakra::class, | |
| 37 | 56 | ) ); |
| 38 | - | |
| 39 | - $this->plugins = apply_filters( 'tier_pricing_table/integrations/plugins', array( | |
| 40 | - 'MixMatch' => MixMatch::class | |
| 57 | + | |
| 58 | + $plugins = apply_filters( 'tiered_pricing_table/integrations/plugins', array( | |
| 59 | + ElementorIntegration::class, | |
| 60 | + WPAllImport::class, | |
| 61 | + U2CodeProductAddons::class, | |
| 62 | + U2CodeMulticurrency::class, | |
| 63 | + WooCommerceProductAddons::class, | |
| 64 | + WooCommerceSubscriptions::class, | |
| 65 | + ProductBundles::class, | |
| 66 | + WooCommerceDeposits::class, | |
| 67 | + WOOCS::class, | |
| 68 | + WCPA::class, | |
| 69 | + AeliaMulticurrency::class, | |
| 70 | + MixMatch::class, | |
| 71 | + | |
| 72 | + WCCS::class, | |
| 73 | + WPMLMulticurrency::class, | |
| 74 | + WPMLMultilingual::class, | |
| 75 | + WooPaymentsMulticurrency::class, | |
| 76 | + YithMulticurrency::class, | |
| 77 | + YithRequestAQuote::class, | |
| 78 | + AddifyRequestAQuote::class, | |
| 79 | + | |
| 80 | + WombatProductAddons::class, | |
| 81 | + | |
| 82 | + DiscountRulesForWooCommerce::class, | |
| 83 | + Curcy::class, | |
| 84 | + | |
| 85 | + WCPProductBundles::class, | |
| 86 | + | |
| 87 | + Yoast::class, | |
| 88 | + RankMath::class, | |
| 89 | + SEOPress::class, | |
| 41 | 90 | ) ); |
| 42 | - | |
| 43 | - | |
| 44 | - foreach ( $this->themes as $themeName => $theme ) { | |
| 45 | - if ( wp_get_theme()->name === $themeName ) { | |
| 91 | + | |
| 92 | + foreach ( $themes as $themeName => $theme ) { | |
| 93 | + if ( strpos( strtolower( wp_get_theme()->name ), | |
| 94 | + $themeName ) !== false || ( ! empty( wp_get_theme()->template ) && strpos( strtolower( wp_get_theme()->template ), | |
| 95 | + $themeName ) !== false ) ) { | |
| 46 | 96 | new $theme(); |
| 47 | 97 | } |
| 48 | 98 | } |
| 49 | - | |
| 50 | - foreach ( $this->plugins as $pluginName => $plugin ) { | |
| 99 | + | |
| 100 | + foreach ( $plugins as $plugin ) { | |
| 51 | 101 | new $plugin(); |
| 52 | 102 | } |
| 53 | 103 | } |
| 54 | 104 | } |