Version Description
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Zoom Magnifier |
Version | 1.3.12 |
Comparing to | |
See all releases |
Code changes from version 1.3.11 to 1.3.12
- README.txt +5 -1
- init.php +2 -2
- plugin-fw/assets/css/yith-fields.css +39 -4
- plugin-fw/assets/js/yit-cpt-unlimited.js +3 -2
- plugin-fw/assets/js/yit-cpt-unlimited.min.js +2 -2
- plugin-fw/assets/js/yith-colorpicker.min.js +11 -0
- plugin-fw/assets/js/yith-fields.js +4 -1
- plugin-fw/assets/js/yith-fields.min.js +25 -1
- plugin-fw/init.php +3 -3
- plugin-fw/lib/promo/yith-promo.php +2 -2
- plugin-fw/lib/yit-assets.php +5 -2
- plugin-fw/lib/yit-cpt-unlimited.php +8 -2
- plugin-fw/lib/yit-plugin-panel-wc.php +8 -1
- plugin-fw/lib/yith-system-status.php +34 -15
- plugin-fw/templates/fields/colorpicker.php +2 -2
- plugin-fw/templates/fields/toggle-element.php +2 -1
- plugin-fw/templates/sysinfo/system-information-panel.php +40 -12
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
|
@@ -52,6 +52,10 @@ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "Y
|
|
52 |
|
53 |
== Changelog ==
|
54 |
|
|
|
|
|
|
|
|
|
55 |
= Version 1.3.11 - Released: Aug 07, 2019 =
|
56 |
|
57 |
* New: Support to WooCommerce 3.7.0
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 1.3.12
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= Version 1.3.12 - Released: Oct 30, 2019 =
|
56 |
+
|
57 |
+
* Update: plugin framework
|
58 |
+
|
59 |
= Version 1.3.11 - Released: Aug 07, 2019 =
|
60 |
|
61 |
* New: Support to WooCommerce 3.7.0
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-zoom-magnifier
|
@@ -78,7 +78,7 @@ register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
|
|
78 |
|
79 |
defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
|
80 |
defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
|
81 |
-
defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.
|
82 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
83 |
defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
|
84 |
defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 1.3.12
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-zoom-magnifier
|
78 |
|
79 |
defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
|
80 |
defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
|
81 |
+
defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.12' );
|
82 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
83 |
defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
|
84 |
defined ( 'YITH_YWZM_URL' ) || define ( 'YITH_YWZM_URL', plugins_url ( '/', __FILE__ ) );
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -35,6 +35,12 @@
|
|
35 |
float: left;
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
.yith-plugin-fw input[type=email],
|
39 |
.yith-plugin-fw input[type=number],
|
40 |
.yith-plugin-fw input[type=text]:not(.select2-search__field),
|
@@ -48,6 +54,7 @@
|
|
48 |
max-width: 100%;
|
49 |
height: 30px;
|
50 |
padding: 5px;
|
|
|
51 |
}
|
52 |
|
53 |
.woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
|
@@ -60,6 +67,10 @@
|
|
60 |
padding: 3px 5px;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
63 |
.woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
|
64 |
.yith-plugin-fw input[type=text].colorpick {
|
65 |
width: 6em;
|
@@ -408,6 +419,18 @@ ul.yit-icons-manager-list li.active {
|
|
408 |
margin: 0 auto;
|
409 |
}
|
410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
/****************
|
412 |
YITH UI
|
413 |
****************/
|
@@ -819,7 +842,9 @@ YITH UI
|
|
819 |
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
|
820 |
border: 0;
|
821 |
height: 30px;
|
822 |
-
max-width:
|
|
|
|
|
823 |
|
824 |
}
|
825 |
|
@@ -1583,8 +1608,10 @@ DATEPICKER
|
|
1583 |
display: none !important;
|
1584 |
}
|
1585 |
|
1586 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap
|
1587 |
-
|
|
|
|
|
1588 |
}
|
1589 |
|
1590 |
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
|
@@ -1607,6 +1634,14 @@ DATEPICKER
|
|
1607 |
display: none;
|
1608 |
}
|
1609 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1610 |
.yith-plugin-ui .wp-picker-container .wp-color-result.button {
|
1611 |
width: 30px;
|
1612 |
height: 30px;
|
@@ -2119,4 +2154,4 @@ DATEPICKER
|
|
2119 |
clear: initial;
|
2120 |
}
|
2121 |
|
2122 |
-
}
|
35 |
float: left;
|
36 |
}
|
37 |
|
38 |
+
.yith-plugin-fw span.color-alpha {
|
39 |
+
height: 23px!important;
|
40 |
+
}
|
41 |
+
.yith-plugin-fw .wp-color-result-text{
|
42 |
+
height: 100%;
|
43 |
+
}
|
44 |
.yith-plugin-fw input[type=email],
|
45 |
.yith-plugin-fw input[type=number],
|
46 |
.yith-plugin-fw input[type=text]:not(.select2-search__field),
|
54 |
max-width: 100%;
|
55 |
height: 30px;
|
56 |
padding: 5px;
|
57 |
+
line-height: 1;
|
58 |
}
|
59 |
|
60 |
.woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
|
67 |
padding: 3px 5px;
|
68 |
}
|
69 |
|
70 |
+
.wp-core-ui .yith-plugin-fw-colorpicker-field-wrapper button{
|
71 |
+
border-color: #7e8993;
|
72 |
+
}
|
73 |
+
|
74 |
.woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
|
75 |
.yith-plugin-fw input[type=text].colorpick {
|
76 |
width: 6em;
|
419 |
margin: 0 auto;
|
420 |
}
|
421 |
|
422 |
+
/****************
|
423 |
+
WordPress 5.3 with old panel fixes
|
424 |
+
****************/
|
425 |
+
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single {
|
426 |
+
height: auto;
|
427 |
+
line-height: 1;
|
428 |
+
}
|
429 |
+
|
430 |
+
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single .select2-selection__arrow{
|
431 |
+
height: 100%;
|
432 |
+
}
|
433 |
+
|
434 |
/****************
|
435 |
YITH UI
|
436 |
****************/
|
842 |
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
|
843 |
border: 0;
|
844 |
height: 30px;
|
845 |
+
max-width: 121px;
|
846 |
+
font-size: 11px;
|
847 |
+
padding: 0;
|
848 |
|
849 |
}
|
850 |
|
1608 |
display: none !important;
|
1609 |
}
|
1610 |
|
1611 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap,
|
1612 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap > * {
|
1613 |
+
display: inline-block !important;
|
1614 |
+
vertical-align: middle;
|
1615 |
}
|
1616 |
|
1617 |
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
|
1634 |
display: none;
|
1635 |
}
|
1636 |
|
1637 |
+
.yith-plugin-ui .wp-picker-container .wp-color-result.button{
|
1638 |
+
height: 30px!important;
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
.yith-plugin-ui .wp-picker-container .color-alpha {
|
1642 |
+
height: 28px!important;
|
1643 |
+
}
|
1644 |
+
|
1645 |
.yith-plugin-ui .wp-picker-container .wp-color-result.button {
|
1646 |
width: 30px;
|
1647 |
height: 30px;
|
2154 |
clear: initial;
|
2155 |
}
|
2156 |
|
2157 |
+
}
|
plugin-fw/assets/js/yit-cpt-unlimited.js
CHANGED
@@ -51,12 +51,13 @@
|
|
51 |
// Do something with attachment.id and/or attachment.url here
|
52 |
images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
|
53 |
});
|
54 |
-
|
55 |
// make AJAX request
|
56 |
$.post( ajaxurl, {
|
57 |
images: images,
|
58 |
post_type: typenow,
|
59 |
-
action: 'yit_cptu_multiuploader'
|
|
|
60 |
}, function( data ){
|
61 |
location.reload();
|
62 |
});
|
51 |
// Do something with attachment.id and/or attachment.url here
|
52 |
images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
|
53 |
});
|
54 |
+
console.log( button.data('nonce') );
|
55 |
// make AJAX request
|
56 |
$.post( ajaxurl, {
|
57 |
images: images,
|
58 |
post_type: typenow,
|
59 |
+
action: 'yit_cptu_multiuploader',
|
60 |
+
_ajax_nonce: button.data('nonce')
|
61 |
}, function( data ){
|
62 |
location.reload();
|
63 |
});
|
plugin-fw/assets/js/yit-cpt-unlimited.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(function(
|
2 |
-
action:"yit_cptu_multiuploader"},function(a){location.reload()});
|
1 |
+
(function(c){c(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a=c(this),d=!1;a.next("span.spinner").css("display","inline-block");if(!b){var b=wp.media.frames.file_frame=wp.media({title:a.data("uploader_title"),button:{text:a.data("uploader_button_text")},library:{type:"image"},multiple:!0});b.on("select",function(){var e=[];b.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,
|
2 |
+
action:"yit_cptu_multiuploader",_ajax_nonce:a.data("nonce")},function(a){location.reload()});a.next("span.spinner").css("display","inline-block");d=!0});b.on("close",function(){d||a.next("span.spinner").hide()})}b.open()})})(jQuery);
|
plugin-fw/assets/js/yith-colorpicker.min.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**!
|
2 |
+
* wp-color-picker-alpha
|
3 |
+
*
|
4 |
+
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
+
* Only run in input and is defined data alpha in true
|
6 |
+
*
|
7 |
+
* Version: 2.1.3
|
8 |
+
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
+
* Licensed under the GPLv2 license or later.
|
10 |
+
*/
|
11 |
+
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -434,9 +434,12 @@ jQuery( function ( $ ) {
|
|
434 |
var toggle = $( this ),
|
435 |
action = 'yith_plugin_fw_save_toggle_element',
|
436 |
formdata = toggle.serializeToggleElement(),
|
437 |
-
|
|
|
438 |
current_tab = $.urlParam( 'tab' );
|
439 |
|
|
|
|
|
440 |
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
441 |
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
442 |
}
|
434 |
var toggle = $( this ),
|
435 |
action = 'yith_plugin_fw_save_toggle_element',
|
436 |
formdata = toggle.serializeToggleElement(),
|
437 |
+
wrapper = toggle.find( '.yith-toggle_wrapper' ),
|
438 |
+
id = wrapper.attr( 'id' ),
|
439 |
current_tab = $.urlParam( 'tab' );
|
440 |
|
441 |
+
formdata.append( 'security', wrapper.data('nonce') );
|
442 |
+
|
443 |
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
444 |
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
445 |
}
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1,25 @@
|
|
1 |
-
jQuery(function(g){function h(){var e=g(".yith-plugin-fw-datepicker"),t=g(".yith-plugin-fw-colorpicker"),n={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:g(".yith-plugin-fw-upload-img-url")},i=g(".add_media"),a={sliderWrapper:g(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},l=g(".yith-plugin-fw-sidebar-layout"),o=g(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=g(".codemirror"),d=g(".yit-icons-manager-wrapper");if(g(".yith-plugin-ui td.forminp-checkbox"),e.each(function(){var e=g(this).data();g(this).datepicker(e)}),t.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var e=g(this);e.val(e.data("default-color")),e.change()}}),t.each(function(){var e=g(this).data("variations-label"),t=g(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),i=g(this).closest(".yith-single-colorpicker"),a=t.find(".wp-picker-input-wrap"),l=i.find(".wp-picker-input-wrap");if(a.length&&t.find("a.wp-color-result").attr("title",e),i.length&&i.find("a.wp-color-result").attr("title",e),!a.find(".wp-picker-clear-custom").length){var n=g("<span/>").attr({class:"wp-picker-default-custom"});a.find(".wp-picker-default").wrap(n)}if(!l.find(".wp-picker-clear-custom").length){n=g("<span/>").attr({class:"wp-picker-default-custom"});l.find(".wp-picker-default").wrap(n)}}),"undefined"!=typeof wp&&void 0!==wp.media){n.imgUrl.change(function(){var e=g(this).val(),t=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)"),i=g(this).parent().find(n.imgPreviewHandler).first();i.length<1&&(i=g(this).parent().parent().find(n.imgPreviewHandler).first()),t.test(e)?i.html('<img src="'+e+'" style="max-width:100px; max-height:100px;" />'):i.html("")}).trigger("change"),g(document).on("click",n.uploadButtonHandler,function(e){e.preventDefault();var t,i=g(this).attr("id").replace(/-button$/,"");if(t)t.open();else{var a=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(t=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:a})).on("select",function(){var e=t.state().get("selection").first().toJSON();g("#"+i).val(e.url),g("#"+i+"-yith-attachment-id")&&g("#"+i+"-yith-attachment-id").val(e.id),n.imgUrl.trigger("change")}),t.open()}}),g(document).on("click",n.resetButtonHandler,function(e){var t=g(this),i=t.attr("id"),a=t.attr("id").replace(/-button-reset$/,""),l=g("#"+i).data("default");g("#"+a).val(l),n.imgUrl.trigger("change")})}i.on("click",function(){!1}),"undefined"!=typeof wp&&void 0!==wp.media&&(g(document).on("click",a.buttonHandler,function(e){var t=g(this),i=t.closest(".image-gallery"),a=i.find(".image_gallery_ids"),l=a.val(),n=i.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:t.data("choose"),button:{text:t.data("update")},states:[new wp.media.controller.Library({title:t.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,n.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+t.data("delete")+'">x</a></li></ul></li>'))}),a.val(l)}),o.open()}),a.sliderWrapper.each(function(){var a=g(this);a.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(e,t){var i="";a.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");i=i+e+","}),a.closest(".image-gallery").find(".image_gallery_ids").val(i)}})}),a.sliderWrapper.on("click","a.delete",function(){var e=g(this).closest(".image-gallery"),t=g(this).closest(".image-gallery ul.slides-wrapper"),i=e.find(".image_gallery_ids"),a="";g(this).closest("li.image").remove(),t.find("li.image").css("cursor","default").each(function(){var e=g(this).attr("data-attachment_id");a=a+e+","}),i.val(a)})),l.each(function(){g(this).find("img").on("click",function(){var e=g(this).closest(".yith-plugin-fw-sidebar-layout"),t=e.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),i=e.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),a=g(this).data("type");if(g(this).parent().children(":radio").attr("checked",!1),g(this).prev(":radio").attr("checked",!0),void 0!==a)switch(a){case"left":t.show(),i.hide();break;case"right":i.show(),t.hide();break;case"double":t.show(),i.show();break;default:t.hide(),i.hide()}})}),o.each(function(){var e=g(this).data("val"),t=g(this).data("min"),i=g(this).data("max"),a=g(this).data("step"),l=g(this).data("labels");g(this).slider({value:e,min:t,max:i,range:"min",step:a,create:function(){g(this).find(".ui-slider-handle").text(g(this).slider("value"))},slide:function(e,t){g(this).find("input").val(t.value),g(this).find(".ui-slider-handle").text(t.value),g(this).siblings(".feedback").find("strong").text(t.value+l)}})}),r.each(function(e,t){var i=CodeMirror.fromTextArea(t,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});g(t).data("codemirrorInstance",i)}),g(document).on("click",".yith-plugin-fw-select-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),g(document).on("click",".yith-plugin-fw-deselect-all",function(){g("#"+g(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var o=g(this),r=o.find(".yit-icons-manager-icon-preview").first(),d=o.find(".yit-icons-manager-icon-text");o.on("click",".yit-icons-manager-list li",function(e){var t=g(e.target).closest("li"),i=t.data("font"),a=t.data("icon"),l=t.data("key"),n=t.data("name");r.attr("data-font",i),r.attr("data-icon",a),r.attr("data-key",l),r.attr("data-name",n),d.val(i+":"+n),o.find(".yit-icons-manager-list li").removeClass("active"),t.addClass("active")}),o.on("click",".yit-icons-manager-action-set-default",function(){o.find(".yit-icons-manager-list li.default").trigger("click")})}),g(document).on("click",".yith-plugin-fw-select-images__item",function(){var e=g(this),t=e.data("key"),i=e.closest(".yith-plugin-fw-select-images__wrapper"),a=i.find(".yith-plugin-fw-select-images__item"),l=i.find("select").first();l.length&&(l.val(t),a.removeClass("yith-plugin-fw-select-images__item--selected"),e.addClass("yith-plugin-fw-select-images__item--selected"))}),g(document.body).trigger("wc-enhanced-select-init"),g(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(e,t){var i=jQuery(".ui-sortable-handle"),a=0,l=new Array;for(a=0;a<i.length;a++)l[a]=g(i[a]).data("item_key");0<l.length&&g(this).closest(".toggle-element").saveToggleElement(null,l)}}),g(document.body).trigger("yith-framework-enhanced-select-init")}h(),g(document).on("click",".yith-plugin-fw-onoff-container span",function(){var e=g(this).prev("input");e.prop("checked")?e.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):e.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),e.change()}),g.fn.saveToggleElement=function(t,e){var i=g(this),a="yith_plugin_fw_save_toggle_element",l=i.serializeToggleElement(),n=i.find(".yith-toggle_wrapper").attr("id"),o=g.urlParam("tab");void 0!==e&&0<e.length&&l.append("yith_toggle_elements_order_keys",e),i.closest(".metaboxes-tab.yith-plugin-ui").length?(a="yith_plugin_fw_save_toggle_element_metabox",post_id=g(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=g(this).closest("form#post").find("#yit_metaboxes_nonce").val(),url=yith_framework_fw_fields.ajax_url+"?action="+a+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+n):url=yith_framework_fw_fields.admin_url+"?action="+a+"&tab="+o+"&toggle_id="+n,g.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(e){t&&t.removeClass("show"),g(document).trigger("yith_save_toggle_element_done",[e,i])}})},g.fn.serializeToggleElement=function(){var e=g(this),i=new FormData,t=g(e).find(":input").serializeArray();return g.each(t,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},g.fn.formatToggleTitle=function(){var e=g(this),t=e.find(":input"),i=e.find("span.title").data("title_format"),a=e.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==i)var n=i.match(l);if(void 0!==a)var o=a.match(l);g.each(t,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=g(t).val(),null!=n&&void 0!==n&&-1!==n.indexOf($field_id)&&(i=i.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)))}),""!==i&&e.find("span.title").html(i),""!==a&&e.find(".subtitle").html(a),g(document).trigger("yith-toggle-element-item-title",[e])},g.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},g(document).on("click",".yith-toggle-title",function(e){var t=g(e.target),i=t.closest(".yith-toggle-row"),a=i.find(".yith-toggle-content");if(t.hasClass("yith-plugin-fw-onoff")||t.hasClass("yith-icon-drag"))return!1;i.is(".yith-toggle-row-opened")?a.slideUp(400):a.slideDown(400),i.toggleClass("yith-toggle-row-opened")}),g(document).on("click",".yith-add-box-button",function(e){e.preventDefault();var t=g(this),i=t.data("box_id"),a=t.data("closed_label"),l=t.data("opened_label"),n=t.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+n),""!==i&&(g("#"+i).html(template({index:"box_id"})).slideToggle(),""!==a&&(t.html()===a?t.html(l).removeClass("closed"):t.html(a).addClass("closed")),h(),g(document).trigger("yith-add-box-button-toggle",[t]))}),g(document).on("click",".yith-add-box-buttons .yith-save-button",function(e){e.preventDefault();var t=g(this).parents(".yith-add-box"),i=g(this).closest(".yith-toggle_wrapper").attr("id"),a=t.find(".spinner"),l=g(this).parents(".toggle-element"),n=t.find(":input"),o=l.find(".yith-toggle-row").length,r=g('<input type="hidden">');r.val(o),g(document).trigger("yith-toggle-change-counter",[r,t]),o=r.val();var d=wp.template("yith-toggle-element-item-"+i),s=g(d({index:o}));a.addClass("show"),g.each(n,function(e,t){void 0!==g(t).attr("id")&&($field_id=g(t).attr("id"),$field_val=g(t).val(),"radio"==g(t).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,g(t).is(":checked")&&g(s).find("#"+$field_id).prop("checked",!0),(g(t).hasClass("yith-post-search")||g(t).hasClass("yith-term-search"))&&g(s).find("#"+$field_id).html(g("#"+g(t).attr("id")).html()),g(s).find("#"+$field_id).val($field_val))}),g(s).formatToggleTitle();var c=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-add",[t,s,c]);setTimeout(function(){if("yes"===c.val()){g(l).find(".yith-toggle-elements").append(s),g(t).find(".yith-plugin-fw-datepicker").datepicker("destroy"),g(t).html(""),g(t).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){g(l).find(".highlight").removeClass("highlight")},2e3),h()}},1e3)}),g(document).on("click",".yith-toggle-row .yith-save-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element"),i=g(this).closest(".yith-toggle-row"),a=i.find(".spinner");i.formatToggleTitle();var l=g('<input type="hidden">').val("yes");g(document).trigger("yith-toggle-element-item-before-update",[t,i,l]),"yes"===l.val()&&(a.addClass("show"),t.saveToggleElement(a))}),g(document).on("click",".yith-toggle-row .yith-delete-button",function(e){e.preventDefault();var t=g(this).closest(".toggle-element");g(this).closest(".yith-toggle-row").remove(),t.saveToggleElement()}),g(document).on("click",".yith-toggle-onoff",function(e){e.preventDefault(),g(this).closest(".toggle-element").saveToggleElement()}),g(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){g(this).closest(".yith-plugin-fw-radio").val(g(this).val()).trigger("change")}),g(document).on("click",".yith-password-eye",function(){var e=g(this),t=g(this).closest(".yith-password-wrapper").find("input");"password"===t.attr("type")?(t.attr("type","text"),e.addClass("yith-password-eye-closed")):(t.attr("type","password"),e.removeClass("yith-password-eye-closed"))}),g(".yith-plugin-fw-radio").each(function(){g(this).val(g(this).attr("value"))})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function(a){var r=function(){var b=a(".yith-plugin-fw-datepicker"),c=a(".yith-plugin-fw-colorpicker"),d=a(".yith-plugin-fw-upload-img-url"),f=a(".add_media"),h=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),g=a(".yith-plugin-fw-sidebar-layout"),l=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),m=a(".codemirror"),n=a(".yit-icons-manager-wrapper");a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();a(this).datepicker(b)});c.wpColorPicker({palettes:!1,
|
2 |
+
width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});c.each(function(){var b=a(this).data("variations-label"),e=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),p=a(this).closest(".yith-single-colorpicker"),q=e.find(".wp-picker-input-wrap"),c=p.find(".wp-picker-input-wrap");q.length&&e.find("a.wp-color-result").attr("title",b);p.length&&p.find("a.wp-color-result").attr("title",b);q.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),
|
3 |
+
q.find(".wp-picker-default").wrap(b));c.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),c.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(d.change(function(){var b=a(this).val(),e=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>e.length&&(e=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?
|
4 |
+
e.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):e.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var e=a(this).attr("id").replace(/-button$/,"");if(!k){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var k=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,
|
5 |
+
states:b});k.on("select",function(){var b=k.state().get("selection").first().toJSON();a("#"+e).val(b.url);a("#"+e+"-yith-attachment-id")&&a("#"+e+"-yith-attachment-id").val(b.id);d.trigger("change")})}k.open()}),a(document).on("click",".yith-plugin-fw-upload-button-reset",function(b){var e=a(this);b=e.attr("id");e=e.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+e).val(b);d.trigger("change")}));f.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&
|
6 |
+
(a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var e=a(this);b=e.closest(".image-gallery");var c=b.find(".image_gallery_ids"),k=c.val(),d=b.find("ul.slides-wrapper"),f=wp.media.frames.image_gallery=wp.media({title:e.data("choose"),button:{text:e.data("update")},states:[new wp.media.controller.Library({title:e.data("choose"),filterable:"all",multiple:!0})]});f.on("select",function(){f.state().get("selection").map(function(a){a=a.toJSON();a.id&&(k=k?k+","+a.id:a.id,d.append('<li class="image" data-attachment_id="'+
|
7 |
+
a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+e.data("delete")+'">x</a></li></ul></li>'))});c.val(k)});f.open()}),h.each(function(){var b=a(this);b.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(e,c){var k="";b.find("li.image").css("cursor",
|
8 |
+
"default").each(function(){var b=a(this).attr("data-attachment_id");k=k+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(k)}})}),h.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),e=a(this).closest(".image-gallery ul.slides-wrapper");b=b.find(".image_gallery_ids");var c="";a(this).closest("li.image").remove();e.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");c=c+b+","});b.val(c)}));g.each(function(){a(this).find("img").on("click",
|
9 |
+
function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),e=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var c=a(this).data("type");a(this).parent().children(":radio").attr("checked",!1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof c)switch(c){case "left":e.show();b.hide();break;case "right":b.show();e.hide();break;case "double":e.show();b.show();break;default:e.hide(),b.hide()}})});
|
10 |
+
l.each(function(){var b=a(this).data("val"),e=a(this).data("min"),c=a(this).data("max"),d=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:e,max:c,range:"min",step:d,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,e){a(this).find("input").val(e.value);a(this).find(".ui-slider-handle").text(e.value);a(this).siblings(".feedback").find("strong").text(e.value+f)}})});m.each(function(b,e){var c=CodeMirror.fromTextArea(e,{lineNumbers:1,
|
11 |
+
mode:"javascript",showCursorWhenSelecting:!0});a(e).data("codemirrorInstance",c)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});n.each(function(){var b=a(this),e=b.find(".yit-icons-manager-icon-preview").first(),c=b.find(".yit-icons-manager-icon-text");
|
12 |
+
b.on("click",".yit-icons-manager-list li",function(d){d=a(d.target).closest("li");var f=d.data("font"),k=d.data("icon"),h=d.data("key"),g=d.data("name");e.attr("data-font",f);e.attr("data-icon",k);e.attr("data-key",h);e.attr("data-name",g);c.val(f+":"+g);b.find(".yit-icons-manager-list li").removeClass("active");d.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",
|
13 |
+
function(){var b=a(this),e=b.data("key"),c=b.closest(".yith-plugin-fw-select-images__wrapper"),d=c.find(".yith-plugin-fw-select-images__item");c=c.find("select").first();c.length&&(c.val(e),d.removeClass("yith-plugin-fw-select-images__item--selected"),b.addClass("yith-plugin-fw-select-images__item--selected"))});a(document.body).trigger("wc-enhanced-select-init");a(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",
|
14 |
+
stop:function(b,c){var e=jQuery(".ui-sortable-handle"),d,f=[];for(d=0;d<e.length;d++)f[d]=a(e[d]).data("item_key");0<f.length&&a(this).closest(".toggle-element").saveToggleElement(null,f)}});a(document.body).trigger("yith-framework-enhanced-select-init")};r();a(document).on("click",".yith-plugin-fw-onoff-container span",function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");
|
15 |
+
b.change()});a.fn.saveToggleElement=function(b,c){var d=a(this),f="yith_plugin_fw_save_toggle_element",h=d.serializeToggleElement(),g=d.find(".yith-toggle_wrapper"),l=g.attr("id"),m=a.urlParam("tab");h.append("security",g.data("nonce"));"undefined"!=typeof c&&0<c.length&&h.append("yith_toggle_elements_order_keys",c);d.closest(".metaboxes-tab.yith-plugin-ui").length?(f="yith_plugin_fw_save_toggle_element_metabox",post_id=a(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=a(this).closest("form#post").find("#yit_metaboxes_nonce").val(),
|
16 |
+
url=yith_framework_fw_fields.ajax_url+"?action="+f+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+l):url=yith_framework_fw_fields.admin_url+"?action="+f+"&tab="+m+"&toggle_id="+l;a.ajax({type:"POST",url:url,data:h,contentType:!1,processData:!1,success:function(c){b&&b.removeClass("show");a(document).trigger("yith_save_toggle_element_done",[c,d])}})};a.fn.serializeToggleElement=function(){var b=a(this),c=new FormData;b=a(b).find(":input").serializeArray();a.each(b,function(a,
|
17 |
+
b){el_name=b.name;c.append(b.name,b.value)});return c};a.fn.formatToggleTitle=function(){var b=a(this),c=b.find(":input"),d=b.find("span.title").data("title_format"),f=b.find(".subtitle").data("subtitle_format"),h=RegExp("[^%%]+(?=[%%])","g");if("undefined"!=typeof d)var g=d.match(h);if("undefined"!=typeof f)var l=f.match(h);a.each(c,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=
|
18 |
+
a(c).val(),null!=g&&"undefined"!=typeof g&&-1!==g.indexOf($field_id)&&(d=d.replace("%%"+$field_id+"%%",$field_val)),null!=l&&"undefined"!=typeof l&&-1!==l.indexOf($field_id)&&(f=f.replace("%%"+$field_id+"%%",$field_val)))});""!==d&&b.find("span.title").html(d);""!==f&&b.find(".subtitle").html(f);a(document).trigger("yith-toggle-element-item-title",[b])};a.urlParam=function(a){a=(new RegExp("[?&]"+a+"=([^&#]*)")).exec(window.location.search);return null!==a?a[1]||0:!1};a(document).on("click",".yith-toggle-title",
|
19 |
+
function(b){b=a(b.target);var c=b.closest(".yith-toggle-row"),d=c.find(".yith-toggle-content");if(b.hasClass("yith-plugin-fw-onoff")||b.hasClass("yith-icon-drag"))return!1;c.is(".yith-toggle-row-opened")?d.slideUp(400):d.slideDown(400);c.toggleClass("yith-toggle-row-opened")});a(document).on("click",".yith-add-box-button",function(b){b.preventDefault();b=a(this);var c=b.data("box_id"),d=b.data("closed_label"),f=b.data("opened_label"),h=b.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+
|
20 |
+
h);""!==c&&(a("#"+c).html(template({index:"box_id"})).slideToggle(),""!==d&&(b.html()===d?b.html(f).removeClass("closed"):b.html(d).addClass("closed")),r(),a(document).trigger("yith-add-box-button-toggle",[b]))});a(document).on("click",".yith-add-box-buttons .yith-save-button",function(b){b.preventDefault();var c=a(this).parents(".yith-add-box"),d=a(this).closest(".yith-toggle_wrapper").attr("id");b=c.find(".spinner");var f=a(this).parents(".toggle-element"),h=c.find(":input"),g=f.find(".yith-toggle-row").length,
|
21 |
+
l=a('<input type="hidden">');l.val(g);a(document).trigger("yith-toggle-change-counter",[l,c]);g=l.val();d=wp.template("yith-toggle-element-item-"+d);var m=a(d({index:g}));b.addClass("show");a.each(h,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_val=a(c).val(),"radio"==a(c).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+
|
22 |
+
g,a(c).is(":checked")&&a(m).find("#"+$field_id).prop("checked",!0),(a(c).hasClass("yith-post-search")||a(c).hasClass("yith-term-search"))&&a(m).find("#"+$field_id).html(a("#"+a(c).attr("id")).html()),a(m).find("#"+$field_id).val($field_val))});a(m).formatToggleTitle();var n=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-add",[c,m,n]);setTimeout(function(){"yes"===n.val()&&(a(f).find(".yith-toggle-elements").append(m),a(c).find(".yith-plugin-fw-datepicker").datepicker("destroy"),
|
23 |
+
a(c).html(""),a(c).prev(".yith-add-box-button").trigger("click"),f.saveToggleElement(),setTimeout(function(){a(f).find(".highlight").removeClass("highlight")},2E3),r())},1E3)});a(document).on("click",".yith-toggle-row .yith-save-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");var c=a(this).closest(".yith-toggle-row"),d=c.find(".spinner");c.formatToggleTitle();var f=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-update",[b,c,f]);
|
24 |
+
"yes"===f.val()&&(d.addClass("show"),b.saveToggleElement(d))});a(document).on("click",".yith-toggle-row .yith-delete-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");a(this).closest(".yith-toggle-row").remove();b.saveToggleElement()});a(document).on("click",".yith-toggle-onoff",function(b){b.preventDefault();a(this).closest(".toggle-element").saveToggleElement()});a(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){a(this).closest(".yith-plugin-fw-radio").val(a(this).val()).trigger("change")});
|
25 |
+
a(document).on("click",".yith-password-eye",function(){var b=a(this),c=a(this).closest(".yith-password-wrapper").find("input");"password"===c.attr("type")?(c.attr("type","text"),b.addClass("yith-password-eye-closed")):(c.attr("type","password"),b.removeClass("yith-password-eye-closed"))});a(".yith-plugin-fw-radio").each(function(){a(this).val(a(this).attr("value"))})});
|
plugin-fw/init.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.3.
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
-
* @version 3.3.
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
@@ -123,4 +123,4 @@ if( ! function_exists( 'yit_get_upgrade_files' ) ){
|
|
123 |
|
124 |
return $to_include;
|
125 |
}
|
126 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.3.13
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
+
* @version 3.3.11
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
123 |
|
124 |
return $to_include;
|
125 |
}
|
126 |
+
}
|
plugin-fw/lib/promo/yith-promo.php
CHANGED
@@ -21,8 +21,8 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
|
21 |
return false;
|
22 |
}
|
23 |
|
24 |
-
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url',
|
25 |
-
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url',
|
26 |
$transient = "yith_promo_message";
|
27 |
$remote_data = get_site_transient( $transient );
|
28 |
$regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
|
21 |
return false;
|
22 |
}
|
23 |
|
24 |
+
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url', YIT_CORE_PLUGIN_URL . '/lib/promo/' );
|
25 |
+
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', YIT_CORE_PLUGIN_PATH . '/lib/promo/yith-promo.xml' );
|
26 |
$transient = "yith_promo_message";
|
27 |
$remote_data = get_site_transient( $transient );
|
28 |
$regenerate_promo_transient = isset( $_GET['yith_regenerate_promo_transient'] ) && 'yes' == $_GET['yith_regenerate_promo_transient'] ? $_GET['yith_regenerate_promo_transient'] : '';
|
plugin-fw/lib/yit-assets.php
CHANGED
@@ -50,8 +50,11 @@ if ( !class_exists( 'YIT_Assets' ) ) {
|
|
50 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
51 |
|
52 |
//scripts
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'yith-plugin-fw-fields' ), $this->version, true );
|
56 |
wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
|
57 |
wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
|
50 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
51 |
|
52 |
//scripts
|
53 |
+
wp_register_script( 'yith-colorpicker', YIT_CORE_PLUGIN_URL . '/assets/js/yith-colorpicker.min.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
54 |
+
|
55 |
+
wp_register_script( 'yith-plugin-fw-fields', YIT_CORE_PLUGIN_URL . '/assets/js/yith-fields' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'yith-colorpicker', 'codemirror', 'codemirror-javascript', 'jquery-ui-slider', 'jquery-ui-sortable' ), $this->version, true );
|
56 |
+
|
57 |
+
wp_register_script( 'yit-metabox', YIT_CORE_PLUGIN_URL . '/assets/js/metabox' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'yith-plugin-fw-fields' ), $this->version, true );
|
58 |
wp_register_script( 'yit-plugin-panel', YIT_CORE_PLUGIN_URL . '/assets/js/yit-plugin-panel' . $suffix . '.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'yith-plugin-fw-fields' ), $this->version, true );
|
59 |
wp_register_script( 'codemirror', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/codemirror.js', array( 'jquery' ), $this->version, true );
|
60 |
wp_register_script( 'codemirror-javascript', YIT_CORE_PLUGIN_URL . '/assets/js/codemirror/javascript.js', array( 'jquery', 'codemirror' ), $this->version, true );
|
plugin-fw/lib/yit-cpt-unlimited.php
CHANGED
@@ -1590,8 +1590,9 @@ class YIT_CPT_Unlimited {
|
|
1590 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
1591 |
*/
|
1592 |
public function admin_assets() {
|
|
|
1593 |
wp_enqueue_media();
|
1594 |
-
wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited.js', array('jquery'), '', true );
|
1595 |
}
|
1596 |
|
1597 |
/**
|
@@ -1619,6 +1620,7 @@ class YIT_CPT_Unlimited {
|
|
1619 |
if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
|
1620 |
return;
|
1621 |
}
|
|
|
1622 |
?>
|
1623 |
<script>
|
1624 |
(function($) {
|
@@ -1629,7 +1631,8 @@ class YIT_CPT_Unlimited {
|
|
1629 |
href: '#',
|
1630 |
class: 'multi-uploader add-new-h2',
|
1631 |
'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
|
1632 |
-
'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>'
|
|
|
1633 |
}).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
|
1634 |
|
1635 |
var spinner = $('<span />', {
|
@@ -1652,6 +1655,9 @@ class YIT_CPT_Unlimited {
|
|
1652 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
1653 |
*/
|
1654 |
public function post_multiuploader() {
|
|
|
|
|
|
|
1655 |
if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
|
1656 |
return;
|
1657 |
}
|
1590 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
1591 |
*/
|
1592 |
public function admin_assets() {
|
1593 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
1594 |
wp_enqueue_media();
|
1595 |
+
wp_enqueue_script( 'yit-cptu', YIT_CORE_PLUGIN_URL . '/assets/js/yit-cpt-unlimited' . $suffix . 'js', array('jquery'), '', true );
|
1596 |
}
|
1597 |
|
1598 |
/**
|
1620 |
if ( $cptu != $this->_name || ! $this->_is_valid( $post_type ) ) {
|
1621 |
return;
|
1622 |
}
|
1623 |
+
|
1624 |
?>
|
1625 |
<script>
|
1626 |
(function($) {
|
1631 |
href: '#',
|
1632 |
class: 'multi-uploader add-new-h2',
|
1633 |
'data-uploader_title': '<?php printf( __( 'Add %s from images', 'yith-plugin-fw' ), $label_plural ) ?>',
|
1634 |
+
'data-uploader_button_text': '<?php printf( __( 'Add %s', 'yith-plugin-fw' ), $label_plural ) ?>',
|
1635 |
+
'data-nonce': '<?php echo wp_create_nonce( 'cpt-unlimited-multiuploader' ); ?>'
|
1636 |
}).text('<?php _e( 'Upload multiple files', 'yith-plugin-fw' ) ?>');
|
1637 |
|
1638 |
var spinner = $('<span />', {
|
1655 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
1656 |
*/
|
1657 |
public function post_multiuploader() {
|
1658 |
+
|
1659 |
+
check_ajax_referer( 'cpt-unlimited-multiuploader' );
|
1660 |
+
|
1661 |
if ( ! isset( $_REQUEST['images'] ) || ! isset( $_REQUEST['post_type'] ) && $this->_is_valid( $_REQUEST['post_type'] ) ) {
|
1662 |
return;
|
1663 |
}
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -608,6 +608,13 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
608 |
* @author Emanuela Castorina
|
609 |
*/
|
610 |
public function save_toggle_element_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
$posted = $_POST;
|
612 |
$tabs = $this->get_available_tabs();
|
613 |
$yit_options = $this->get_main_array_options();
|
@@ -615,7 +622,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
615 |
$option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
|
616 |
$updated = false;
|
617 |
|
618 |
-
if ( !empty( $yit_options[ $current_tab ] ) && !empty( $option_id ) ) {
|
619 |
|
620 |
$tab_options = $yit_options[ $current_tab ];
|
621 |
foreach ( $tab_options as $key => $item ) {
|
608 |
* @author Emanuela Castorina
|
609 |
*/
|
610 |
public function save_toggle_element_options() {
|
611 |
+
|
612 |
+
check_ajax_referer( 'save-toggle-element', 'security' );
|
613 |
+
|
614 |
+
if( ! current_user_can( $this->settings['capability'] ) ){
|
615 |
+
wp_die( -1 );
|
616 |
+
}
|
617 |
+
|
618 |
$posted = $_POST;
|
619 |
$tabs = $this->get_available_tabs();
|
620 |
$yit_options = $this->get_main_array_options();
|
622 |
$option_id = isset( $_REQUEST[ 'toggle_id' ] ) ? $_REQUEST[ 'toggle_id' ] : '';
|
623 |
$updated = false;
|
624 |
|
625 |
+
if ( ! empty( $yit_options[ $current_tab ] ) && ! empty( $option_id ) ) {
|
626 |
|
627 |
$tab_options = $yit_options[ $current_tab ];
|
628 |
foreach ( $tab_options as $key => $item ) {
|
plugin-fw/lib/yith-system-status.php
CHANGED
@@ -81,6 +81,14 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
81 |
return;
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
$system_info = get_option( 'yith_system_info' );
|
85 |
$error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
|
86 |
|
@@ -159,6 +167,7 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
159 |
*/
|
160 |
public function check_system_status() {
|
161 |
|
|
|
162 |
if ( '' == get_option( 'yith_system_info' ) || ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) ) {
|
163 |
|
164 |
$this->add_requirements( __( 'YITH Plugins', 'yith-plugin-fw' ), array( 'min_wp_version' => '4.9', 'min_wc_version' => '3.4', 'min_php_version' => '5.6.20' ) );
|
@@ -200,7 +209,7 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
200 |
break;
|
201 |
|
202 |
default:
|
203 |
-
if ( ! version_compare( $value, $required_value, '>=' ) ) {
|
204 |
$check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
|
205 |
$errors = true;
|
206 |
}
|
@@ -297,13 +306,20 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
297 |
*/
|
298 |
public function get_system_info() {
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
|
308 |
//Get PHP version
|
309 |
preg_match( "#^\d+(\.\d+)*#", PHP_VERSION, $match );
|
@@ -315,15 +331,14 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
315 |
$wp_memory_limit = max( $wp_memory_limit, $this->memory_size_to_num( @ini_get( 'memory_limit' ) ) );
|
316 |
}
|
317 |
|
318 |
-
|
319 |
-
if ( class_exists( 'Imagick' ) ) {
|
320 |
preg_match( "/([0-9]+\.[0-9]+\.[0-9]+)/", Imagick::getVersion()['versionString'], $imatch );
|
321 |
$imagick_version = $imatch[0];
|
322 |
}
|
323 |
|
324 |
return apply_filters( 'yith_system_additional_check', array(
|
325 |
'min_wp_version' => get_bloginfo( 'version' ),
|
326 |
-
'min_wc_version' => function_exists( 'WC' ) ? WC()->version :
|
327 |
'wp_memory_limit' => $wp_memory_limit,
|
328 |
'min_php_version' => $php_version,
|
329 |
'min_tls_version' => $tls,
|
@@ -350,8 +365,9 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
350 |
* @author Alberto Ruggiero
|
351 |
*/
|
352 |
public function memory_size_to_num( $memory_size ) {
|
353 |
-
$unit
|
354 |
-
$size
|
|
|
355 |
$multiplier = array(
|
356 |
'P' => 5,
|
357 |
'T' => 4,
|
@@ -359,8 +375,11 @@ if ( ! class_exists( 'YITH_System_Status' ) ) {
|
|
359 |
'M' => 2,
|
360 |
'K' => 1,
|
361 |
);
|
362 |
-
|
363 |
-
|
|
|
|
|
|
|
364 |
}
|
365 |
|
366 |
return $size;
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Add to prevent trigger admin_init called directly
|
86 |
+
* wp-admin/admin-post.php?page=yith_system_info
|
87 |
+
*/
|
88 |
+
if ( ! is_user_logged_in() ) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
$system_info = get_option( 'yith_system_info' );
|
93 |
$error_notice = ( $system_info['errors'] === true ? ' <span class="yith-system-info-menu update-plugins">!</span>' : '' );
|
94 |
|
167 |
*/
|
168 |
public function check_system_status() {
|
169 |
|
170 |
+
|
171 |
if ( '' == get_option( 'yith_system_info' ) || ( isset( $_GET['page'] ) && $_GET['page'] == $this->_page ) ) {
|
172 |
|
173 |
$this->add_requirements( __( 'YITH Plugins', 'yith-plugin-fw' ), array( 'min_wp_version' => '4.9', 'min_wc_version' => '3.4', 'min_php_version' => '5.6.20' ) );
|
209 |
break;
|
210 |
|
211 |
default:
|
212 |
+
if ( ! version_compare( $value, $required_value, '>=' ) && $value != 'n/a' ) {
|
213 |
$check_results[ $key ]['errors'][ $plugin_name ] = $required_value;
|
214 |
$errors = true;
|
215 |
}
|
306 |
*/
|
307 |
public function get_system_info() {
|
308 |
|
309 |
+
$tls = $imagick_version = 'n/a';
|
310 |
+
|
311 |
+
if ( function_exists( 'curl_init' ) && apply_filters( 'yith_system_status_check_ssl', true ) ) {
|
312 |
+
//Get TLS version
|
313 |
+
$ch = curl_init();
|
314 |
+
curl_setopt( $ch, CURLOPT_URL, 'https://www.howsmyssl.com/a/check' );
|
315 |
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
|
316 |
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
|
317 |
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
|
318 |
+
$data = curl_exec( $ch );
|
319 |
+
curl_close( $ch );
|
320 |
+
$json = json_decode( $data );
|
321 |
+
$tls = $json != null ? str_replace( 'TLS ', '', $json->tls_version ) : '';
|
322 |
+
}
|
323 |
|
324 |
//Get PHP version
|
325 |
preg_match( "#^\d+(\.\d+)*#", PHP_VERSION, $match );
|
331 |
$wp_memory_limit = max( $wp_memory_limit, $this->memory_size_to_num( @ini_get( 'memory_limit' ) ) );
|
332 |
}
|
333 |
|
334 |
+
if ( class_exists( 'Imagick' ) && is_callable( array( 'Imagick', 'getVersion' ) ) ) {
|
|
|
335 |
preg_match( "/([0-9]+\.[0-9]+\.[0-9]+)/", Imagick::getVersion()['versionString'], $imatch );
|
336 |
$imagick_version = $imatch[0];
|
337 |
}
|
338 |
|
339 |
return apply_filters( 'yith_system_additional_check', array(
|
340 |
'min_wp_version' => get_bloginfo( 'version' ),
|
341 |
+
'min_wc_version' => function_exists( 'WC' ) ? WC()->version : 'n/a',
|
342 |
'wp_memory_limit' => $wp_memory_limit,
|
343 |
'min_php_version' => $php_version,
|
344 |
'min_tls_version' => $tls,
|
365 |
* @author Alberto Ruggiero
|
366 |
*/
|
367 |
public function memory_size_to_num( $memory_size ) {
|
368 |
+
$unit = strtoupper( substr( $memory_size, - 1 ) );
|
369 |
+
$size = substr( $memory_size, 0, - 1 );
|
370 |
+
|
371 |
$multiplier = array(
|
372 |
'P' => 5,
|
373 |
'T' => 4,
|
375 |
'M' => 2,
|
376 |
'K' => 1,
|
377 |
);
|
378 |
+
|
379 |
+
if ( isset( $multiplier[ $unit ] ) ) {
|
380 |
+
for ( $i = 1; $i <= $multiplier[ $unit ]; $i ++ ) {
|
381 |
+
$size *= 1024;
|
382 |
+
}
|
383 |
}
|
384 |
|
385 |
return $size;
|
plugin-fw/templates/fields/colorpicker.php
CHANGED
@@ -16,7 +16,7 @@ wp_enqueue_style( 'wp-color-picker' );
|
|
16 |
|
17 |
extract( $field );
|
18 |
|
19 |
-
$class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker';
|
20 |
$default = isset( $default ) ? $default : '';
|
21 |
if( isset($std) && !empty( $std) && empty($default) ){
|
22 |
$default = $std;
|
@@ -26,7 +26,7 @@ if( isset($std) && !empty( $std) && empty($default) ){
|
|
26 |
<input type="text" name="<?php echo $name ?>"
|
27 |
id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
|
28 |
<?php if ( isset( $default ) ) : ?> data-default-color="<?php echo $default ?>"<?php endif ?>
|
29 |
-
class="<?php echo $class ?>"
|
30 |
<?php echo $custom_attributes ?>
|
31 |
<?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
|
32 |
|
16 |
|
17 |
extract( $field );
|
18 |
|
19 |
+
$class = !empty( $class ) ? $class : 'yith-plugin-fw-colorpicker color-picker';
|
20 |
$default = isset( $default ) ? $default : '';
|
21 |
if( isset($std) && !empty( $std) && empty($default) ){
|
22 |
$default = $std;
|
26 |
<input type="text" name="<?php echo $name ?>"
|
27 |
id="<?php echo $id ?>" value="<?php echo esc_attr( $value ) ?>"
|
28 |
<?php if ( isset( $default ) ) : ?> data-default-color="<?php echo $default ?>"<?php endif ?>
|
29 |
+
class="<?php echo $class ?>" data-alpha="true"
|
30 |
<?php echo $custom_attributes ?>
|
31 |
<?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?>/>
|
32 |
|
plugin-fw/templates/fields/toggle-element.php
CHANGED
@@ -31,6 +31,7 @@ $values = maybe_unserialize( $values );
|
|
31 |
$sortable = isset( $sortable ) ? $sortable : false;
|
32 |
$class_wrapper = $sortable ? 'ui-sortable' : '';
|
33 |
$onoff_id = isset( $onoff_field['id'] ) ? $onoff_field['id'] : '';
|
|
|
34 |
|
35 |
if ( empty( $values ) && ! $show_add_button && $elements ) {
|
36 |
$values = array();
|
@@ -41,7 +42,7 @@ if ( empty( $values ) && ! $show_add_button && $elements ) {
|
|
41 |
}
|
42 |
|
43 |
?>
|
44 |
-
<div class="yith-toggle_wrapper <?php echo $class_wrapper ?>" id="<?php echo $id ?>">
|
45 |
<?php
|
46 |
|
47 |
if ( $show_add_button ):
|
31 |
$sortable = isset( $sortable ) ? $sortable : false;
|
32 |
$class_wrapper = $sortable ? 'ui-sortable' : '';
|
33 |
$onoff_id = isset( $onoff_field['id'] ) ? $onoff_field['id'] : '';
|
34 |
+
$ajax_nonce = wp_create_nonce( 'save-toggle-element' );
|
35 |
|
36 |
if ( empty( $values ) && ! $show_add_button && $elements ) {
|
37 |
$values = array();
|
42 |
}
|
43 |
|
44 |
?>
|
45 |
+
<div class="yith-toggle_wrapper <?php echo $class_wrapper ?>" id="<?php echo $id ?>" data-nonce="<?php echo $ajax_nonce; ?>">
|
46 |
<?php
|
47 |
|
48 |
if ( $show_add_button ):
|
plugin-fw/templates/sysinfo/system-information-panel.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
*/
|
10 |
|
11 |
$system_info = get_option( 'yith_system_info' );
|
12 |
-
$recommended_memory =
|
13 |
|
14 |
?>
|
15 |
<div id="yith-sysinfo" class="wrap yith-system-info">
|
@@ -28,6 +28,8 @@ $recommended_memory = '128M';
|
|
28 |
|
29 |
if ( $key == 'wp_memory_limit' && ! $has_errors ) {
|
30 |
$has_warnings = $item['value'] < $recommended_memory;
|
|
|
|
|
31 |
}
|
32 |
|
33 |
?>
|
@@ -43,7 +45,13 @@ $recommended_memory = '128M';
|
|
43 |
} elseif ( $key == 'wp_memory_limit' ) {
|
44 |
echo esc_html( size_format( $item['value'] ) );
|
45 |
} else {
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
} ?>
|
48 |
|
49 |
</td>
|
@@ -57,10 +65,14 @@ $recommended_memory = '128M';
|
|
57 |
} elseif ( $key == 'wp_memory_limit' ) {
|
58 |
echo sprintf( __( '%s needs at least %s of available memory', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $requirement ) ) ) . '</span>' );
|
59 |
echo '<br/>';
|
60 |
-
echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format(
|
|
|
|
|
61 |
|
62 |
} else {
|
63 |
echo sprintf( __( '%s needs at least %s version', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . $requirement . '</span>' );
|
|
|
|
|
64 |
} ?>
|
65 |
</li>
|
66 |
<?php endforeach; ?>
|
@@ -74,7 +86,9 @@ $recommended_memory = '128M';
|
|
74 |
case 'min_php_version':
|
75 |
case 'min_tls_version':
|
76 |
case 'imagick_version':
|
77 |
-
|
|
|
|
|
78 |
break;
|
79 |
case 'wp_cron_enabled':
|
80 |
echo sprintf( __( 'Remove %s from %s file', 'yith-plugin-fw' ), '<code>define( \'DISABLE_WP_CRON\', true );</code>', '<b>wp-config.php</b>' );
|
@@ -96,14 +110,28 @@ $recommended_memory = '128M';
|
|
96 |
} ?>
|
97 |
<?php endif; ?>
|
98 |
|
99 |
-
<?php if ( $has_warnings )
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
</td>
|
108 |
</tr>
|
109 |
<?php endforeach; ?>
|
9 |
*/
|
10 |
|
11 |
$system_info = get_option( 'yith_system_info' );
|
12 |
+
$recommended_memory = 134217728;
|
13 |
|
14 |
?>
|
15 |
<div id="yith-sysinfo" class="wrap yith-system-info">
|
28 |
|
29 |
if ( $key == 'wp_memory_limit' && ! $has_errors ) {
|
30 |
$has_warnings = $item['value'] < $recommended_memory;
|
31 |
+
} elseif ( ( $key == 'min_tls_version' || $key == 'imagick_version' ) && ! $has_errors ) {
|
32 |
+
$has_warnings = $item['value'] == 'n/a';
|
33 |
}
|
34 |
|
35 |
?>
|
45 |
} elseif ( $key == 'wp_memory_limit' ) {
|
46 |
echo esc_html( size_format( $item['value'] ) );
|
47 |
} else {
|
48 |
+
|
49 |
+
if ( $item['value'] == 'n/a' ) {
|
50 |
+
echo __( 'N/A', 'yith-plugin-fw' );
|
51 |
+
} else {
|
52 |
+
echo $item['value'];
|
53 |
+
}
|
54 |
+
|
55 |
} ?>
|
56 |
|
57 |
</td>
|
65 |
} elseif ( $key == 'wp_memory_limit' ) {
|
66 |
echo sprintf( __( '%s needs at least %s of available memory', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . esc_html( size_format( YITH_System_Status()->memory_size_to_num( $requirement ) ) ) . '</span>' );
|
67 |
echo '<br/>';
|
68 |
+
echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( $recommended_memory ) ) . '</span>' );
|
69 |
+
echo '<br/>';
|
70 |
+
echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' );
|
71 |
|
72 |
} else {
|
73 |
echo sprintf( __( '%s needs at least %s version', 'yith-plugin-fw' ), '<b>' . $plugin . '</b>', '<span class="error">' . $requirement . '</span>' );
|
74 |
+
|
75 |
+
|
76 |
} ?>
|
77 |
</li>
|
78 |
<?php endforeach; ?>
|
86 |
case 'min_php_version':
|
87 |
case 'min_tls_version':
|
88 |
case 'imagick_version':
|
89 |
+
if ( $item['value'] != 'n/a' ) {
|
90 |
+
echo __( 'Contact your hosting company in order to update it.', 'yith-plugin-fw' );
|
91 |
+
}
|
92 |
break;
|
93 |
case 'wp_cron_enabled':
|
94 |
echo sprintf( __( 'Remove %s from %s file', 'yith-plugin-fw' ), '<code>define( \'DISABLE_WP_CRON\', true );</code>', '<b>wp-config.php</b>' );
|
110 |
} ?>
|
111 |
<?php endif; ?>
|
112 |
|
113 |
+
<?php if ( $has_warnings ) {
|
114 |
+
|
115 |
+
if ( $item['value'] != 'n/a' ) {
|
116 |
+
|
117 |
+
echo sprintf( __( 'For optimal functioning of our plugins, we suggest setting at least %s of available memory', 'yith-plugin-fw' ), '<span class="error">' . esc_html( size_format( $recommended_memory ) ) . '</span>' );
|
118 |
+
echo '<br/>';
|
119 |
+
echo sprintf( __( 'Read more %s here%s or contact your hosting company in order to increase it.', 'yith-plugin-fw' ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">', '</a>' );
|
120 |
+
|
121 |
+
} else {
|
122 |
+
|
123 |
+
switch ( $key ) {
|
124 |
+
case 'min_tls_version':
|
125 |
+
echo __( 'We cannot determine which <b>TLS</b> version is installed because <b>cURL</b> module is disabled. Ask your hosting company to enable it.', 'yith-plugin-fw' );
|
126 |
+
break;
|
127 |
+
case 'imagick_version':
|
128 |
+
echo __( '<b>ImageMagick</b> module is not installed. Ask your hosting company to install it.', 'yith-plugin-fw' );
|
129 |
+
break;
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
} ?>
|
135 |
</td>
|
136 |
</tr>
|
137 |
<?php endforeach; ?>
|