| 1 |
<?php namespace TierPricingTable\Integrations; |
| 2 |
|
| 3 |
use TierPricingTable\Integrations\Plugins\MixMatch; |
| 4 |
use TierPricingTable\Integrations\Themes\Avada; |
| 5 |
use TierPricingTable\Integrations\Themes\Divi; |
| 6 |
use TierPricingTable\Integrations\Themes\Electro; |
| 7 |
use TierPricingTable\Integrations\Themes\Flatsome; |
| 8 |
use TierPricingTable\Integrations\Themes\Merchandiser; |
| 9 |
use TierPricingTable\Integrations\Themes\Neto; |
| 10 |
use TierPricingTable\Integrations\Themes\OceanWp; |
| 11 |
use TierPricingTable\Integrations\Themes\Shopkeeper; |
| 12 |
use TierPricingTable\Integrations\Themes\TheRetailer; |
| 13 |
|
| 14 |
class Integrations { |
| 15 |
|
| 16 |
private $themes = array(); |
| 17 |
|
| 18 |
private $plugins = array(); |
| 19 |
|
| 20 |
public function __construct() { |
| 21 |
$this->init(); |
| 22 |
add_action( 'init', function () { |
| 23 |
// dd( wp_get_theme()->name ); |
| 24 |
} ); |
| 25 |
} |
| 26 |
|
| 27 |
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, |
| 37 |
) ); |
| 38 |
|
| 39 |
$this->plugins = apply_filters( 'tier_pricing_table/integrations/plugins', array( |
| 40 |
'MixMatch' => MixMatch::class |
| 41 |
) ); |
| 42 |
|
| 43 |
|
| 44 |
foreach ( $this->themes as $themeName => $theme ) { |
| 45 |
if ( wp_get_theme()->name === $themeName ) { |
| 46 |
new $theme(); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
foreach ( $this->plugins as $pluginName => $plugin ) { |
| 51 |
new $plugin(); |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
|