From 02f6d8ba0def18f0487708c946c294dca6c86fb4 Mon Sep 17 00:00:00 2001 From: Dernerd Date: Fri, 7 Jun 2024 00:20:32 +0200 Subject: [PATCH] PhP8.3 /jQuery3 Fixes --- includes/admin/class-mp-products-admin.php | 2 +- includes/admin/class-mp-shortcode-builder.php | 2 +- includes/common/class-mp-cart.php | 2 +- includes/public/class-mp-public.php | 2 +- includes/public/class-mp-short-codes.php | 4 +- ui/js/jquery.colorbox-min.js | 2 +- ui/js/jquery.colorbox.js | 1105 +++++++++++++++++ 7 files changed, 1112 insertions(+), 7 deletions(-) create mode 100644 ui/js/jquery.colorbox.js diff --git a/includes/admin/class-mp-products-admin.php b/includes/admin/class-mp-products-admin.php index 55acbce..ca7ff57 100644 --- a/includes/admin/class-mp-products-admin.php +++ b/includes/admin/class-mp-products-admin.php @@ -131,7 +131,7 @@ public function parse_category_filter_query( $query ) { */ public function enqueue_styles_scripts() { wp_enqueue_style( 'colorbox', mp_plugin_url( 'includes/admin/ui/colorbox/colorbox.css' ), false, '1.5.10' ); - wp_enqueue_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), false, '1.5.10' ); + wp_enqueue_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), false, '1.5.10' ); } /** diff --git a/includes/admin/class-mp-shortcode-builder.php b/includes/admin/class-mp-shortcode-builder.php index 211a3b5..cb347bf 100644 --- a/includes/admin/class-mp-shortcode-builder.php +++ b/includes/admin/class-mp-shortcode-builder.php @@ -1479,7 +1479,7 @@ public function enqueue_styles_scripts() { || ( isset( $screenpage->post_type ) && ( $screenpage->post_type == "product" || $screenpage->post_type == "incsub_event" || $screenpage->post_type == "post" || $screenpage->post_type == "mp_order" || $screenpage->post_type == "mp_coupon" || $screenpage->post_type == "page") ) ) { wp_enqueue_style( 'colorbox', mp_plugin_url( 'includes/admin/ui/colorbox/colorbox.css' ), false, MP_VERSION ); - wp_enqueue_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), false, MP_VERSION ); + wp_enqueue_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), false, MP_VERSION ); wp_enqueue_style( 'mp-select2', mp_plugin_url( 'ui/select2/select2.css' ), false, MP_VERSION ); wp_enqueue_script( 'mp-select2', mp_plugin_url( 'ui/select2/select2.js' ), false, MP_VERSION ); diff --git a/includes/common/class-mp-cart.php b/includes/common/class-mp-cart.php index eeb64d2..9a8701e 100644 --- a/includes/common/class-mp-cart.php +++ b/includes/common/class-mp-cart.php @@ -1228,7 +1228,7 @@ public function enqueue_styles_scripts() { wp_register_script( 'jquery-validate', mp_plugin_url( 'ui/js/jquery.validate.min.js' ), array( 'jquery' ), MP_VERSION, true ); wp_register_script( 'jquery-validate-methods', mp_plugin_url( 'ui/js/jquery.validate.methods.min.js' ), array( 'jquery-validate' ), MP_VERSION, true ); wp_register_script( 'ajaxq', mp_plugin_url( 'ui/js/ajaxq.min.js' ), array( 'jquery' ), MP_VERSION, true ); - wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), array( 'jquery' ), MP_VERSION, true ); + wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), array( 'jquery' ), MP_VERSION, true ); wp_enqueue_script( 'mp-cart', mp_plugin_url( 'ui/js/mp-cart.js' ), array( 'ajaxq', 'colorbox', diff --git a/includes/public/class-mp-public.php b/includes/public/class-mp-public.php index 629847e..fc12220 100644 --- a/includes/public/class-mp-public.php +++ b/includes/public/class-mp-public.php @@ -385,7 +385,7 @@ public function frontend_scripts() { // JS wp_register_script( 'hover-intent', mp_plugin_url( 'ui/js/hoverintent.min.js' ), array( 'jquery' ), MP_VERSION, true ); wp_register_script( 'mp-select2', mp_plugin_url( 'ui/select2/select2.js' ), array( 'jquery' ), MP_VERSION, true ); - wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), array( 'jquery' ), MP_VERSION, true ); + wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), array( 'jquery' ), MP_VERSION, true ); wp_enqueue_script( 'mp-frontend', mp_plugin_url( 'ui/js/frontend.js' ), array( 'jquery-ui-tooltip', 'colorbox', diff --git a/includes/public/class-mp-short-codes.php b/includes/public/class-mp-short-codes.php index 56bd91a..dd4aec2 100644 --- a/includes/public/class-mp-short-codes.php +++ b/includes/public/class-mp-short-codes.php @@ -100,7 +100,7 @@ public function shortcodes_frontend_styles_scripts() { // JS. wp_register_script( 'hover-intent', mp_plugin_url( 'ui/js/hoverintent.min.js' ), array( 'jquery' ), MP_VERSION, true ); wp_register_script( 'mp-select2', mp_plugin_url( 'ui/select2/select2.js' ), array( 'jquery' ), MP_VERSION, true ); - wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), array( 'jquery' ), MP_VERSION, true ); + wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), array( 'jquery' ), MP_VERSION, true ); wp_enqueue_script( 'mp-frontend', mp_plugin_url( 'ui/js/frontend.js' ), array( 'jquery-ui-tooltip', 'colorbox', 'hover-intent', 'mp-select2', 'jquery-validate' ), MP_VERSION, true ); $grid_with_js = apply_filters('mp-do_grid_with_js', true); @@ -150,7 +150,7 @@ public function shortcodes_frontend_styles_scripts() { wp_register_script( 'jquery-validate', mp_plugin_url( 'ui/js/jquery.validate.min.js' ), array( 'jquery' ), MP_VERSION, true ); wp_register_script( 'jquery-validate-methods', mp_plugin_url( 'ui/js/jquery.validate.methods.min.js' ), array( 'jquery-validate' ), MP_VERSION, true ); wp_register_script( 'ajaxq', mp_plugin_url( 'ui/js/ajaxq.min.js' ), array( 'jquery' ), MP_VERSION, true ); - wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox-min.js' ), array( 'jquery' ), MP_VERSION, true ); + wp_register_script( 'colorbox', mp_plugin_url( 'ui/js/jquery.colorbox.js' ), array( 'jquery' ), MP_VERSION, true ); wp_enqueue_script( 'mp-cart', mp_plugin_url( 'ui/js/mp-cart.js' ), array( 'ajaxq', 'colorbox', 'jquery-validate' ), MP_VERSION, true ); // Localize scripts diff --git a/ui/js/jquery.colorbox-min.js b/ui/js/jquery.colorbox-min.js index 1e3af00..b5109a2 100644 --- a/ui/js/jquery.colorbox-min.js +++ b/ui/js/jquery.colorbox-min.js @@ -3,4 +3,4 @@ license: MIT http://www.jacklmoore.com/colorbox */ -(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t('