1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
<?php
if( ! class_exists( 'bkap_dokan_products_class' ) ) {
class bkap_dokan_products_class {
function __construct() {
$dokan_settings = get_option('dokan_selling');
if ( defined( 'DOKAN_PRO_PLUGIN_VERSION' ) && DOKAN_PRO_PLUGIN_VERSION >= '2.7.3' ) {
add_action( 'dokan_product_edit_after_main', array( &$this, 'bkap_add_booking_meta' ), 10, 1 );
}else {
if ( isset( $dokan_settings['product_style'] ) && $dokan_settings['product_style'] === 'old' ){
add_action( 'dokan_product_tab_content', array( &$this, 'bkap_add_booking_meta' ), 10, 1 );
}elseif ( isset( $dokan_settings['product_style'] ) && $dokan_settings['product_style'] === 'new' ) {
add_action( 'dokan_product_edit_after_main', array( &$this, 'bkap_add_booking_meta' ), 10, 1 );
}
}
add_filter( 'dokan_product_data_tabs', array( &$this, 'bkap_dokan_add_tabs' ) );
}
public function bkap_add_booking_meta( $post ) {
$plugin_version_number = get_option( 'woocommerce_booking_db_version' );
$ajax_url = get_admin_url() . 'admin-ajax.php';
bkap_load_scripts_class::bkap_load_products_css( $plugin_version_number );
bkap_load_scripts_class::bkap_load_zozo_css( $plugin_version_number );
bkap_load_scripts_class::bkap_load_dokan_css( $plugin_version_number );
?>
<div class="dokan-bkap-settings dokan-edit-row" id="product-bkap-bookings">
<div class="dokan-section-heading" data-togglehandler="dokan_bkap_settings">
<h2>
<i class="wp-menu-image dashicons-before dashicons-calendar-alt" aria-hidden="true"></i>
<?php _e( 'Booking', 'woocommerce-booking' ); ?>
</h2>
<p><?php _e( 'Manage Booking Settings for this product.', 'woocommerce-booking' ); ?></p>
<a href="#" class="dokan-section-toggle">
<i class="fa fa-sort-desc fa-flip-vertical" aria-hidden="true"></i>
</a>
<div class="dokan-clearfix"></div>
</div>
<div class="dokan-section-content">
<?php bkap_booking_box_class::bkap_meta_box();?>
</div>
</div>
<?php
bkap_load_scripts_class::bkap_common_admin_scripts_js( $plugin_version_number );
bkap_load_scripts_class::bkap_load_product_scripts_js( $plugin_version_number, $ajax_url );
bkap_load_scripts_class::bkap_load_dokan_product_scripts_js( $plugin_version_number, $ajax_url );
wp_register_script( 'jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip.min.js', array( 'jquery' ), $plugin_version_number, false );
wp_enqueue_script( 'jquery-tiptip' );
}
public function bkap_dokan_add_tabs( $tabs_array ) {
$tabs_array['bkap-bookings'] = array(
'label' => __( 'Booking', 'woocommerce-booking' ),
'target' => 'product-bkap-bookings',
'class' => array(),
);
return $tabs_array;
}
}
}
return new bkap_dokan_products_class();