css
4 months ago
img
4 months ago
js
4 months ago
partials
4 months ago
class-adv-order-filter.php
4 months ago
class-analytics.php
4 months ago
class-order-tip-promotion.php
4 months ago
class-pi-dtt-labels.php
4 months ago
class-pi-dtt-order-table.php
4 months ago
conflict-fixer.php
4 months ago
menu.php
4 months ago
options-addons.php
4 months ago
options-date.php
4 months ago
options-limit.php
4 months ago
options-pickup.php
4 months ago
options-time-slot.php
4 months ago
options-time.php
4 months ago
options.php
4 months ago
conflict-fixer.php
58 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 | |
| 4 | class pisol_dtt_pro_conflict_fixer{ |
| 5 | function __construct(){ |
| 6 | add_action( 'admin_enqueue_scripts', array($this,'removeConflictCausingScripts'), 1000 ); |
| 7 | add_action( 'admin_footer', array($this,'removeScriptFromAdminFooter'), 10000000000 ); |
| 8 | add_action( 'wp_enqueue_scripts', array($this,'removeFrontConflict'), 900); |
| 9 | } |
| 10 | |
| 11 | function removeConflictCausingScripts(){ |
| 12 | if(isset($_GET['page']) && $_GET['page'] == 'pisol-dtt'){ |
| 13 | wp_dequeue_script( 'jquery-timepicker' ); |
| 14 | |
| 15 | /* color picker gets disabled because of this script */ |
| 16 | wp_dequeue_script( 'print-invoices-packing-slip-labels-for-woocommerce' ); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | function removeScriptFromAdminFooter(){ |
| 21 | if(isset($_GET['page']) && $_GET['page'] == 'pisol-dtt'){ |
| 22 | /** |
| 23 | * https://wordpress.org/plugins/makecommerce/ |
| 24 | */ |
| 25 | wp_dequeue_script( 'wc_mk_timepicker' ); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | function removeFrontConflict(){ |
| 30 | $this->fixForEverestForms(); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * https://wordpress.org/plugins/everest-forms/ |
| 35 | * it adds its own version of selectWoo that brakes the checkout process |
| 36 | */ |
| 37 | function fixForEverestForms(){ |
| 38 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 39 | if(is_plugin_active( 'everest-forms/everest-forms.php')){ |
| 40 | if(function_exists('is_checkout') && is_checkout()){ |
| 41 | wp_deregister_script( 'selectWoo' ); |
| 42 | wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full.min.js', array( 'jquery' ), '1.0.6' ); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * some theme adds bootstrap-datepicker that replaces our datepicker |
| 48 | * and causes issue |
| 49 | */ |
| 50 | if(function_exists('is_checkout') && is_checkout()){ |
| 51 | wp_dequeue_script( 'bootstrap-datepicker' ); |
| 52 | wp_deregister_script( 'bootstrap-datepicker' ); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | } |
| 57 | |
| 58 | new pisol_dtt_pro_conflict_fixer(); |