| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly |
| 4 |
if( ! defined( 'ABSPATH' ) ) exit(); |
| 5 |
|
| 6 |
if ( ! function_exists('is_plugin_active')) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } |
| 7 |
|
| 8 |
if ( !class_exists( 'WPBForWPbakery_Addons_Init' ) ) { |
| 9 |
|
| 10 |
class WPBForWPbakery_Addons_Init{ |
| 11 |
|
| 12 |
private static $_instance = null; |
| 13 |
public static function instance() { |
| 14 |
if ( is_null( self::$_instance ) ) { |
| 15 |
self::$_instance = new self(); |
| 16 |
} |
| 17 |
return self::$_instance; |
| 18 |
} |
| 19 |
|
| 20 |
public function __construct(){ |
| 21 |
|
| 22 |
if ( class_exists( 'WooCommerce' ) ) { |
| 23 |
add_action( 'after_setup_theme', array( $this, 'wpbforwpbakery_woocommerce_setup' ) ); |
| 24 |
// add_action( 'init', array( $this, 'wpbforwpbakery_plugins_loaded' ) ); |
| 25 |
$this->wpbforwpbakery_plugins_loaded(); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
// Support WooCommerce |
| 30 |
public function wpbforwpbakery_woocommerce_setup() { |
| 31 |
add_theme_support( 'woocommerce' ); |
| 32 |
} |
| 33 |
|
| 34 |
public function wpbforwpbakery_plugins_loaded(){ |
| 35 |
$this->wpbforwpbakery_file_includes(); |
| 36 |
$this->wpbforwpbakery_includes_widgets(); |
| 37 |
} |
| 38 |
|
| 39 |
// Include Widgets File |
| 40 |
public function wpbforwpbakery_includes_widgets(){ |
| 41 |
|
| 42 |
// load addons |
| 43 |
$wpbforwpbakery_addons = array( |
| 44 |
'archive_product', |
| 45 |
'product_title', |
| 46 |
'product_description', |
| 47 |
'product_short_description', |
| 48 |
'product_image', |
| 49 |
'product_price', |
| 50 |
'product_add_to_cart', |
| 51 |
'product_meta', |
| 52 |
'product_stock', |
| 53 |
'product_rating', |
| 54 |
'product_data_tab', |
| 55 |
'product_related', |
| 56 |
'product_reviews', |
| 57 |
'product_upsell', |
| 58 |
'product_additional_information', |
| 59 |
); |
| 60 |
|
| 61 |
foreach ( $wpbforwpbakery_addons as $addon ){ |
| 62 |
if ( ( wpbforwpbakery_get_option( 'wpb_'. $addon, 'wpbforwpbakery_elements_tabs', 'on' ) === 'on' ) && file_exists( WPBFORWPBAKERY_ADDONS_PL_PATH.'/includes/addons/'.$addon.'.php' ) ){ |
| 63 |
require_once ( WPBFORWPBAKERY_ADDONS_PL_PATH.'/includes/addons/'.$addon.'.php' ); |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
// Include File |
| 70 |
Public function wpbforwpbakery_file_includes(){ |
| 71 |
if( wpbforwpbakery_get_option( 'enablecustomlayout', 'wpbforwpbakery_woo_template_tabs', 'on' ) == 'on' ){ |
| 72 |
include_once ( WPBFORWPBAKERY_ADDONS_PL_PATH.'includes/woo_shop.php' ); |
| 73 |
include_once ( WPBFORWPBAKERY_ADDONS_PL_PATH.'includes/archive-product-render.php' ); |
| 74 |
|
| 75 |
// rename label |
| 76 |
if( !is_admin() && !is_plugin_active('wc-builder-pro/wc-builder-pro.php') && wpbforwpbakery_get_option( 'enablerenamelabel', 'wpbforwpbakery_rename_label_tabs', 'off' ) == 'on' ){ |
| 77 |
require( WPBFORWPBAKERY_ADDONS_PL_PATH.'includes/rename_label.php' ); |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
WPBForWPbakery_Addons_Init::instance(); |
| 84 |
|
| 85 |
} |