| 1 |
<?php |
| 2 |
/** |
| 3 |
* AstraPro Compatibility |
| 4 |
* |
| 5 |
* @package WPFunnels\Compatibility\Plugin |
| 6 |
*/ |
| 7 |
namespace WPFunnels\Compatibility\Plugin; |
| 8 |
|
| 9 |
use WPFunnels\Wpfnl_functions; |
| 10 |
use WPFunnels\Traits\SingletonTrait; |
| 11 |
|
| 12 |
/** |
| 13 |
* Astra Pro Compatibility |
| 14 |
* |
| 15 |
* @package WPFunnels\Compatibility\AstraPro |
| 16 |
*/ |
| 17 |
class AstraPro extends PluginCompatibility{ |
| 18 |
use SingletonTrait; |
| 19 |
|
| 20 |
/** |
| 21 |
* Filters/Hook from Astra Pro |
| 22 |
* to initiate the necessary updates. |
| 23 |
* |
| 24 |
* @since 3.4.8 |
| 25 |
*/ |
| 26 |
public function init() { |
| 27 |
|
| 28 |
add_action( 'wp', array( $this, 'remove_astra_modern_checkout_for_wpfnl_step'), 5 ); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
/** |
| 33 |
* Remove astra pro mordern checkout for WPFunnels steps |
| 34 |
* |
| 35 |
* @since 3.4.8 |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
public function remove_astra_modern_checkout_for_wpfnl_step() { |
| 39 |
$theme = wp_get_theme(); |
| 40 |
$parent_theme = $theme->parent(); |
| 41 |
$isAstra = 'Astra' === $theme->name; |
| 42 |
if ($parent_theme && 'Astra' === $parent_theme->get('Name')) { |
| 43 |
$isAstra = true; |
| 44 |
} |
| 45 |
|
| 46 |
if( Wpfnl_functions::is_funnel_step_page() && $isAstra && defined('ASTRA_EXT_DIR') ){ |
| 47 |
require_once ASTRA_EXT_DIR . '/addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php'; |
| 48 |
if( class_exists('ASTRA_Ext_WooCommerce_Markup')){ |
| 49 |
|
| 50 |
if( !class_exists( 'Astra_Woocommerce' ) ){ |
| 51 |
require_once get_template_directory() . '/inc/compatibility/woocommerce/class-astra-woocommerce.php'; |
| 52 |
} |
| 53 |
|
| 54 |
$astra_woo_markup = \ASTRA_Ext_WooCommerce_Markup::get_instance(); |
| 55 |
// Remove the 'modern_checkout' action hook |
| 56 |
remove_action( 'wp', array( $astra_woo_markup, 'modern_checkout' ) ); |
| 57 |
remove_action( 'astra_addon_get_css_files', array( $astra_woo_markup, 'add_styles' ) ); |
| 58 |
remove_action( 'astra_addon_get_js_files', array( $astra_woo_markup, 'add_scripts' ) ); |
| 59 |
remove_action( 'wp', array( $astra_woo_markup, 'multistep_checkout' ) ); |
| 60 |
remove_action( 'body_class', array( $astra_woo_markup, 'body_class' ) ); |
| 61 |
remove_action( 'astra_addon_js_localize', array( $astra_woo_markup, 'checkout_js_localize' ) ); |
| 62 |
remove_action( 'wp_enqueue_scripts', array( $astra_woo_markup, 'enqueue_frontend_scripts' ) ); |
| 63 |
remove_action( 'woocommerce_get_country_locale_default', array( $astra_woo_markup, 'default_fields_customization' ) ); |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* Check if Astra Pro is activated |
| 71 |
* |
| 72 |
* @return bool |
| 73 |
* @since 3.4.8 |
| 74 |
*/ |
| 75 |
public function maybe_activate() |
| 76 |
{ |
| 77 |
return defined('ASTRA_EXT_DIR'); |
| 78 |
} |
| 79 |
} |
| 80 |
|