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