Version Description
Released on 16 October 2020 =
New: Support for WooCommerce 4.6
Update: plugin framework
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Product Filter |
Version | 3.11.3 |
Comparing to | |
See all releases |
Code changes from version 3.11.2 to 3.11.3
- README.txt +6 -1
- assets/js/yith-wcan-frontend.min.js +1 -1
- includes/class.yith-wcan.php +36 -6
- includes/functions.yith-wcan.php +1 -4
- init.php +3 -3
- plugin-fw/Gruntfile.js +65 -17
- plugin-fw/assets/css/yith-fields.css +138 -64
- plugin-fw/assets/js/yith-fields.js +183 -183
- plugin-fw/assets/js/yith-fields.min.js +1 -1
- plugin-fw/assets/js/yith-gutenberg.js +211 -211
- plugin-fw/assets/js/yith-gutenberg.min.js +6 -1
- plugin-fw/bin/clean-language-files.js +36 -0
- plugin-fw/bin/download-translations-config.json +27 -0
- plugin-fw/bin/download-translations.js +57 -0
- plugin-fw/init.php +1 -1
- plugin-fw/lib/yit-plugin-panel.php +127 -93
- plugin-fw/package.json +7 -1
- plugin-fw/templates/fields/dimensions.php +24 -25
- plugin-fw/templates/sysinfo/system-information-panel.php +10 -2
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 3.11.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -159,6 +159,11 @@ If you want to see a demonstration version of the premium plugin, you can see it
|
|
159 |
|
160 |
== Changelog ==
|
161 |
|
|
|
|
|
|
|
|
|
|
|
162 |
= 3.11.2 - Released on 14 September 2020 =
|
163 |
|
164 |
* New: Support for WooCommerce 4.5
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 3.11.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 3.11.3 - Released on 16 October 2020 =
|
163 |
+
|
164 |
+
* New: Support for WooCommerce 4.6
|
165 |
+
* Update: plugin framework
|
166 |
+
|
167 |
= 3.11.2 - Released on 14 September 2020 =
|
168 |
|
169 |
* New: Support for WooCommerce 4.5
|
assets/js/yith-wcan-frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(w){var y=/(?!(\[))(\.)[^.#[]*/g,u=/(#)[^.#[]*/,
|
1 |
+
jQuery(function(w){var y=/(?!(\[))(\.)[^.#[]*/g,u=/(#)[^.#[]*/,g=/^[\w]+/,f=/^[\w]+$/,l=function(t,a){var e=f.test(t)?[{tag:t}]:function(t){for(var a={sel:[],val:[]},e=[],i=!1,n="",c=[],s=0,r=t.length;s<r;s++){var o=t.charAt(s);i?"\\"===o&&s+1<t.length?c.push(t.charAt(++s)):n===o?(n="",c.push(o)):"'"!==o&&'"'!==o||""!==n?"]"===o&&""===n?(a.val.push(c.join("")),i=!(c=[])):"]"===o&&""===n||(""===n&&","===o?(a.val.push(c.join("")),c=[]):c.push(o)):(n=o,c.push(o)):"\\"===o&&s+1<t.length?i&&c.push(t.charAt(++s)):"["===o&&""===n?i=!0:" "===o||"+"===o?(a.sel=a.sel.join(""),e.push(a),"+"===o&&e.push({sel:"+",val:""}),a={sel:[],val:[]}):" "!==o&&"]"!==o&&a.sel.push(o)}for(0==a.sel.length&&0==a.val.length||(a.sel=a.sel.join(""),e.push(a)),s=0;s<e.length;s++){if("+"===(a=e[s].sel))l.tag=a;else{var l=[];for(l.tag=g.exec(a),l.id=u.exec(a),l.id&&w.isArray(l.id)&&(l.id=l.id[0].substr(1)),l.tag||(l.tag="div"),l.vars=[],t=0;t<e[s].val.length;t++)n=e[s].val[t].indexOf("="),i=e[s].val[t].substr(0,n),n=(n=e[s].val[t].substr(n+1)).replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===i?l.text=n:l.vars.push([i,n]);if(i=[],a=a.match(y)){for(t=0;t<a.length;t++)i.push(a[t].substr(1));l.className=i.join(" ")}}e[s]=l}return e}(t),i=[];void 0===a&&(a=1);for(var n=[],c=[],s=[],r=document.createElement("div"),o=0,l=0;l<e.length;l++){if("+"==e[l].tag)c=s.slice(),--o;else{for(var d=0;d<a;d++)if("input"==e[l].tag){var h=[];if(h.push("<"+e[l].tag),e[l].id&&h.push("id='"+e[l].id+"'"),e[l].className&&(h.push("class='"+e[l].className),l+1===e.length&&h.push(lastClass),h.push("'")),e[l].vars)for(var p=0;p<e[l].vars.length;p++)h.push(e[l].vars[p][0]+"='"+e[l].vars[p][1]+"'");e[l].text&&h.push("value='"+e[l].text+"'"),h.push("/>"),s[d]=c[d],c[d]?(c[d].innerHTML+=h.join(" "),c[d]=c[d].lastChild):(r.innerHTML=h.join(" "),c[d]=r.removeChild(r.firstChild))}else{if(h=document.createElement(e[l].tag),e[l].vars)for(p=0;p<e[l].vars.length;p++)console.log(e[l].tag,e[l].vars[p]),h.setAttribute(e[l].vars[p][0],e[l].vars[p][1]);e[l].id&&(h.id=e[l].id),e[l].className&&(h.className=e[l].className),e[l].text&&h.appendChild(document.createTextNode(e[l].text)),s[d]=c[d],c[d]=c[d]?c[d].appendChild(h):h}o++||Array.prototype.push.apply(n,c)}i=w.merge(i,c)}return w(n)},a=function(t,a,e){for(var i=t.match(/%[^%]*%/g)||[],n=[],c=0;c<a.length;c++){for(var s=t,r=0;r<i.length;r++)var o=i[r].substr(1,i[r].length-2),s=s.replace(i[r],a[c][o]);n=w.merge(n,l(s,e))}return w(n)},o=!(w.jseldom=function(t){return 2==arguments.length&&w.isPlainObject(arguments[1])?a.apply(this,[t,[arguments[1]]]):1==arguments.length||2==arguments.length&&!w.isArray(arguments[1])?l.apply(this,arguments):2==arguments.length?a.apply(this,arguments):void 0}),d=function(){var t=w("#yith-wcan-reset-all-categories").find("a.yith-wcan-reset-categories-link"),a=w("#yith-wcan-reset-all-tags").find("a.yith-wcan-reset-tags-link");t.add(a).on("click",function(t){w(this).yith_wcan_ajax_filters(t,this)})};w.fn.yith_wcan_ajax_filters=function(t,a){t.preventDefault();var e,i,n=a.href,c=w(a),s=c.hasClass("yith-wcan-reset-navigation");void 0===n&&c.parents().hasClass("price_slider_wrapper")&&(c.parents("form"),t=(i=(e=window.location).origin+e.pathname)!=e.href,e.search,a=w(".price_slider_amount #min_price").val(),r=w(".price_slider_amount #max_price").val(),new RegExp("^min_price","i"),new RegExp("^max_price","i"),n=e.href,1==t&&(n=h(n,"min_price"),n=h(n,"max_price")),n=n+(i==n?"?":"&")+w.param({min_price:a,max_price:r})),"select"==c.data("type")&&(c.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),c.parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300)),w(yith_wcan.container).not(".ywcps-products").html("").addClass("yith-wcan-loading"),w(document).trigger("yith-wcan-ajax-loading"),"undefined"!=typeof yith_wcan_frontend&&w(yith_wcan.container).not(".ywcps-products").css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");var r=!1;("both"==yith_wcan.scroll_top_mode||"mobile"==yith_wcan.scroll_top_mode&&1==yith_wcan.is_mobile||"desktop"==yith_wcan.scroll_top_mode&&1!=yith_wcan.is_mobile)&&(r=!0),1==r&&w(window).scrollTop(w(yith_wcan.scroll_top).offset().top),w(yith_wcan.pagination).hide(),w(yith_wcan.result_count).hide(),0!=o&&(o.abort(),o=!1),o=w.ajax({url:n,success:function(e){o=!1,w(yith_wcan.container).not(".ywcps-products").removeClass("yith-wcan-loading"),0<w(e).find(yith_wcan.container).not(".ywcps-products").length?w(".yit-wcan-container").html(w(e).find(yith_wcan.container).not(".ywcps-products")):w(".yit-wcan-container").html(w(e).find(".woocommerce-info")),0<w(e).find(yith_wcan.pagination).length?(0==w(yith_wcan.pagination).length&&w.jseldom(yith_wcan.pagination).insertAfter(w(yith_wcan.container).not(".ywcps-products")),w(yith_wcan.pagination).html(w(e).find(yith_wcan.pagination).html()).show()):w(yith_wcan.pagination).empty(),w("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />'),0<w(e).find(yith_wcan.result_count).length&&w(yith_wcan.result_count).html(w(e).find(yith_wcan.result_count).html()).show();var t,a,i=function(t){var a=t.attr("id"),a=w(e).find("#"+a);0==a.length?t.hide():(t.html(a.html()),t.show())};w(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var t=w(this);i(t)}),1==yith_wcan.yootheme.is_enabled&&w(".widget-yith-woo-ajax-navigation").add(".widget-yith-woo-ajax-navigation-sort-by").add(".widget-yith-woo-ajax-reset-navigation").add(".widget-yith-wcan-stock-on-sale").add(".widget-yith-wcan-list-price-filter").each(function(){var t=w(this);i(t)}),1==yith_wcan.avada.is_enabled&&((a=w(yith_wcan.avada.sort_count)).html(w(e).find(yith_wcan.avada.sort_count).html()),""==c.text()?a.hide():a.show()),1!=yith_wcan.change_browser_url||navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:e.pageTitle},"",n),w(document).trigger("ready"),w(document).trigger("yith-wcan-ajax-filtered",[e]),w(document).trigger("yith_wcwl_reload_fragments"),w(window).trigger("scroll"),s&&("undefined"!=typeof w.fn.slider&&(t=parseInt(w(yith_wcan.wc_price_slider.min_price).data("min")),a=parseInt(w(yith_wcan.wc_price_slider.max_price).data("max")),w(yith_wcan.wc_price_slider.wrapper).slider("values",[t,a]),w(document.body).trigger("price_slider_slide",[t,a])),w(document).trigger("yith-wcan-ajax-reset-filtered")),d()}})},w(yith_wcan.container).not(".ywcps-products").wrap('<div class="yit-wcan-container"></div>'),w(document).on("yith-wcan-wrapped",function(){d()}),w(document).trigger("yith-wcan-wrapped"),w(document).on("click",".yith-wcan a",function(t){w(this).yith_wcan_ajax_filters(t,this)});var e=function(){w("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},0,function(){w(this).css("display","none")}),w("a.yit-wcan-select-open").removeClass("active")};function h(t,a){return t.replace(new RegExp("[?&]"+a+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+a+"=[^&]*&"),"$1")}w(document).on("click","a.yit-wcan-select-open.active",function(t){t.preventDefault(),w(t=this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300,function(){w(this).css("display","none")}),w(t).parent().find("a.yit-wcan-select-open").removeClass("active")}),w(document).on("click","a.yit-wcan-select-open:not(.active)",function(t){t.preventDefault(),w("a.yit-wcan-select-open.active").trigger("click"),w(t=this).parent().find("div.yith-wcan-select-wrapper").css("z-index","1").animate({visibility:"visible",opacity:1},{duration:300,start:function(){w(this).css("display","block")}}),w(t).parent().find("a.yit-wcan-select-open").addClass("active")}),w(document).on("ready yith-wcan-ajax-filtered",function(){w("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen").length;e(),w("div.yith-wcan-select-wrapper").each(function(){var t="";w(this).find("ul.yith-wcan-select li.chosen").each(function(){t+=w(this).text()+", "});""!=(t=t.substring(0,t.length-2))&&w(this).parent().find("a.yit-wcan-select-open").text(t)})}),w(document).on("ready",e),w("body").on("click",function(t){w(t.target).hasClass("yit-wcan-select-open")||e()}),1==yith_wcan.flatsome.is_enabled&&1==yith_wcan.flatsome.lazy_load_enabled&&w(document).on("yith-wcan-ajax-filtered",function(t,a){var e=w(document);jQuery(".lazy-load",e).each(function(t,a){var i=jQuery(a);i.waypoint(function(t){var a,e;i.hasClass("lazy-load-active")||(a=i.data("src"),e=i.data("srcset"),a&&i.attr("src",a),e&&i.attr("srcset",e),i.imagesLoaded(function(){i.addClass("lazy-load-active").removeClass("lazy-load")}))},{offset:"140%"})})}),window.addEventListener("popstate",function(t){window.location.reload(!0)})});
|
includes/class.yith-wcan.php
CHANGED
@@ -78,14 +78,14 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
|
|
78 |
public function __construct() {
|
79 |
|
80 |
$this->version = YITH_WCAN_VERSION;
|
81 |
-
|
82 |
/**
|
83 |
* WooCommerce Version Check
|
84 |
*/
|
85 |
$this->current_wc_version = WC()->version;
|
86 |
$this->is_wc_older_2_1 = version_compare( $this->current_wc_version, '2.1', '<' );
|
87 |
$this->is_wc_older_2_6 = version_compare( $this->current_wc_version, '2.6', '<' );
|
88 |
-
|
89 |
/**
|
90 |
* WordPress Version Check
|
91 |
*/
|
@@ -95,7 +95,7 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
|
|
95 |
if( $this->is_wc_older_2_6 ){
|
96 |
$this->filter_term_field = 'term_id';
|
97 |
}
|
98 |
-
|
99 |
|
100 |
/* Load Plugin Framework */
|
101 |
add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
|
@@ -231,9 +231,9 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
|
|
231 |
|
232 |
/**
|
233 |
* Support to ultimate members functions
|
234 |
-
*
|
235 |
* The method set_predefined_fields call a WP_Query that generate
|
236 |
-
* an issue with shop filtered query. Move this step to init with priority 2
|
237 |
* instead of 1
|
238 |
*
|
239 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
@@ -248,5 +248,35 @@ if ( ! class_exists( 'YITH_WCAN' ) ) {
|
|
248 |
}
|
249 |
}
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
-
}
|
78 |
public function __construct() {
|
79 |
|
80 |
$this->version = YITH_WCAN_VERSION;
|
81 |
+
|
82 |
/**
|
83 |
* WooCommerce Version Check
|
84 |
*/
|
85 |
$this->current_wc_version = WC()->version;
|
86 |
$this->is_wc_older_2_1 = version_compare( $this->current_wc_version, '2.1', '<' );
|
87 |
$this->is_wc_older_2_6 = version_compare( $this->current_wc_version, '2.6', '<' );
|
88 |
+
|
89 |
/**
|
90 |
* WordPress Version Check
|
91 |
*/
|
95 |
if( $this->is_wc_older_2_6 ){
|
96 |
$this->filter_term_field = 'term_id';
|
97 |
}
|
98 |
+
|
99 |
|
100 |
/* Load Plugin Framework */
|
101 |
add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
|
231 |
|
232 |
/**
|
233 |
* Support to ultimate members functions
|
234 |
+
*
|
235 |
* The method set_predefined_fields call a WP_Query that generate
|
236 |
+
* an issue with shop filtered query. Move this step to init with priority 2
|
237 |
* instead of 1
|
238 |
*
|
239 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
248 |
}
|
249 |
}
|
250 |
|
251 |
+
/**
|
252 |
+
* Register plugins for activation tab
|
253 |
+
*
|
254 |
+
* @return void
|
255 |
+
* @since 2.0.0
|
256 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
257 |
+
*/
|
258 |
+
public function register_plugin_for_activation() {
|
259 |
+
if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
260 |
+
require_once YITH_WCAN_DIR . 'plugin-fw/lib/yit-plugin-licence.php';
|
261 |
+
}
|
262 |
+
|
263 |
+
YIT_Plugin_Licence()->register( YITH_WCAN_INIT, YITH_WCAN_SECRET_KEY, YITH_WCAN_SLUG );
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Register plugins for update tab
|
268 |
+
*
|
269 |
+
* @return void
|
270 |
+
* @since 2.0.0
|
271 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
272 |
+
*/
|
273 |
+
public function register_plugin_for_updates() {
|
274 |
+
if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
275 |
+
require_once YITH_WCAN_DIR . 'plugin-fw/lib/yit-upgrade.php';
|
276 |
+
}
|
277 |
+
|
278 |
+
YIT_Upgrade()->register( YITH_WCAN_SLUG, YITH_WCAN_INIT );
|
279 |
+
}
|
280 |
+
|
281 |
}
|
282 |
+
}
|
includes/functions.yith-wcan.php
CHANGED
@@ -77,11 +77,8 @@ function yith_wcan_dropdown_attributes( $selected, $echo = true ) {
|
|
77 |
function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = array(), $echo = true ) {
|
78 |
$return = '';
|
79 |
|
80 |
-
|
81 |
-
return $return;
|
82 |
-
}
|
83 |
|
84 |
-
$terms = get_terms( array( 'taxonomy' => 'pa_' . $attribute, 'hide_empty' => '0' ) );
|
85 |
if ( 'list' == $type ) {
|
86 |
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
|
87 |
}
|
77 |
function yith_wcan_attributes_table( $type, $attribute, $id, $name, $values = array(), $echo = true ) {
|
78 |
$return = '';
|
79 |
|
80 |
+
$terms = get_terms( array( 'taxonomy' => 'pa_' . $attribute, 'hide_empty' => '0' ) );
|
|
|
|
|
81 |
|
|
|
82 |
if ( 'list' == $type ) {
|
83 |
$return = '<input type="hidden" name="' . $name . '[colors]" value="" /><input type="hidden" name="' . $name . '[labels]" value="" />';
|
84 |
}
|
init.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
|
5 |
* Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
-
* Version: 3.11.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-navigation
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* WC requires at least: 4.0
|
13 |
-
* WC tested up to: 4.
|
14 |
*
|
15 |
* @author Your Inspiration Themes
|
16 |
* @package YITH WooCommerce Ajax Navigation
|
@@ -67,7 +67,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
|
|
67 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
68 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
69 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
70 |
-
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.11.
|
71 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
72 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
73 |
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
|
5 |
* Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
+
* Version: 3.11.3
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-navigation
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* WC requires at least: 4.0
|
13 |
+
* WC tested up to: 4.6
|
14 |
*
|
15 |
* @author Your Inspiration Themes
|
16 |
* @package YITH WooCommerce Ajax Navigation
|
67 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
68 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
69 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
70 |
+
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.11.3' );
|
71 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
72 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
73 |
|
plugin-fw/Gruntfile.js
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
-
/**
|
2 |
-
* in vagrant ssh, launch:
|
3 |
-
* - npm install
|
4 |
-
* - grunt (or use npm scripts in package.json)
|
5 |
-
*/
|
6 |
-
|
7 |
const potInfo = {
|
8 |
-
|
9 |
-
|
|
|
10 |
poedit : true, // Includes common Poedit headers.
|
11 |
'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
|
12 |
'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
|
@@ -63,23 +58,81 @@ module.exports = function ( grunt ) {
|
|
63 |
type : 'wp-plugin',
|
64 |
domainPath : 'languages',
|
65 |
domain : 'yith-plugin-fw',
|
66 |
-
potHeaders : potInfo.
|
67 |
-
updatePoFiles:
|
68 |
},
|
69 |
dist : {
|
70 |
options: {
|
71 |
-
potFilename: potInfo.
|
72 |
exclude : [
|
|
|
73 |
'node_modules/.*',
|
74 |
'tests/.*',
|
75 |
-
'tmp/.*'
|
|
|
76 |
]
|
77 |
}
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
} );
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
// Load NPM tasks to be used here.
|
84 |
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
85 |
|
@@ -88,9 +141,4 @@ module.exports = function ( grunt ) {
|
|
88 |
|
89 |
// Register tasks.
|
90 |
grunt.registerTask( 'js', ['uglify'] );
|
91 |
-
grunt.registerTask( 'i18n', ['makepot'] );
|
92 |
-
grunt.registerTask( 'default', [
|
93 |
-
'js',
|
94 |
-
'i18n'
|
95 |
-
] );
|
96 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
const potInfo = {
|
2 |
+
languageFolderPath: './languages/',
|
3 |
+
filename : 'yith-plugin-fw.pot',
|
4 |
+
headers : {
|
5 |
poedit : true, // Includes common Poedit headers.
|
6 |
'x-poedit-keywordslist': true, // Include a list of all possible gettext functions.
|
7 |
'report-msgid-bugs-to' : 'YITH <plugins@yithemes.com>',
|
58 |
type : 'wp-plugin',
|
59 |
domainPath : 'languages',
|
60 |
domain : 'yith-plugin-fw',
|
61 |
+
potHeaders : potInfo.headers,
|
62 |
+
updatePoFiles: false
|
63 |
},
|
64 |
dist : {
|
65 |
options: {
|
66 |
+
potFilename: potInfo.filename,
|
67 |
exclude : [
|
68 |
+
'bin/.*',
|
69 |
'node_modules/.*',
|
70 |
'tests/.*',
|
71 |
+
'tmp/.*',
|
72 |
+
'vendor/.*'
|
73 |
]
|
74 |
}
|
75 |
}
|
76 |
+
},
|
77 |
+
update_po: {
|
78 |
+
options: {
|
79 |
+
template: potInfo.languageFolderPath + potInfo.filename
|
80 |
+
},
|
81 |
+
build : {
|
82 |
+
src: potInfo.languageFolderPath + '*.po'
|
83 |
+
}
|
84 |
}
|
85 |
|
86 |
} );
|
87 |
|
88 |
+
grunt.registerMultiTask( 'update_po', 'This task update .po strings by .pot', function () {
|
89 |
+
grunt.log.writeln( 'Updating .po files.' );
|
90 |
+
|
91 |
+
var done = this.async(),
|
92 |
+
options = this.options(),
|
93 |
+
template = options.template;
|
94 |
+
this.files.forEach( function ( file ) {
|
95 |
+
if ( file.src.length ) {
|
96 |
+
var counter = file.src.length;
|
97 |
+
|
98 |
+
grunt.log.writeln( 'Processing ' + file.src.length + ' files.' );
|
99 |
+
|
100 |
+
file.src.forEach( function ( fileSrc ) {
|
101 |
+
grunt.util.spawn( {
|
102 |
+
cmd : 'msgmerge',
|
103 |
+
args: ['-U', fileSrc, template]
|
104 |
+
}, function ( error, result, code ) {
|
105 |
+
const output = fileSrc.replace( '.po', '.mo' );
|
106 |
+
grunt.log.writeln( 'Updating: ' + fileSrc + ' ...' );
|
107 |
+
|
108 |
+
if ( error ) {
|
109 |
+
grunt.verbose.error();
|
110 |
+
} else {
|
111 |
+
grunt.verbose.ok();
|
112 |
+
}
|
113 |
+
|
114 |
+
// Updating also the .mo files
|
115 |
+
grunt.util.spawn( {
|
116 |
+
cmd : 'msgfmt',
|
117 |
+
args: [fileSrc, '-o', output]
|
118 |
+
}, function ( moError, moResult, moCode ) {
|
119 |
+
grunt.log.writeln( 'Updating MO for: ' + fileSrc + ' ...' );
|
120 |
+
counter--;
|
121 |
+
if ( moError || counter === 0 ) {
|
122 |
+
done( moError );
|
123 |
+
}
|
124 |
+
} );
|
125 |
+
if ( error ) {
|
126 |
+
done( error );
|
127 |
+
}
|
128 |
+
} );
|
129 |
+
} );
|
130 |
+
} else {
|
131 |
+
grunt.log.writeln( 'No file to process.' );
|
132 |
+
}
|
133 |
+
} );
|
134 |
+
} );
|
135 |
+
|
136 |
// Load NPM tasks to be used here.
|
137 |
grunt.loadNpmTasks( 'grunt-wp-i18n' );
|
138 |
|
141 |
|
142 |
// Register tasks.
|
143 |
grunt.registerTask( 'js', ['uglify'] );
|
|
|
|
|
|
|
|
|
|
|
144 |
};
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -23,9 +23,9 @@
|
|
23 |
}
|
24 |
|
25 |
.yith-plugin-fw-field-wrapper .yith-inline-fields > div {
|
26 |
-
display: inline-block;
|
27 |
-
vertical-align: middle;
|
28 |
-
margin-right: 5px;
|
29 |
}
|
30 |
|
31 |
.yith-plugin-fw-field-wrapper span.desc {
|
@@ -286,7 +286,7 @@ ul.yit-icons-manager-list li.active {
|
|
286 |
|
287 |
.yith-plugin-fw-checkbox-array__row {
|
288 |
margin-bottom : 10px;
|
289 |
-
display:flex;
|
290 |
}
|
291 |
|
292 |
.yith-plugin-fw-checkbox-array__row label {
|
@@ -298,10 +298,11 @@ ul.yit-icons-manager-list li.active {
|
|
298 |
font-weight : 400 !important;
|
299 |
}
|
300 |
|
301 |
-
.yith-plugin-fw-checkbox-array__row label small{
|
302 |
-
display:block;
|
303 |
-
line-height: 2em;
|
304 |
}
|
|
|
305 |
/* ------- Sidebar Layout ------- */
|
306 |
.yith-plugin-fw-sidebar-layout input[type="radio"] {
|
307 |
display : none;
|
@@ -735,7 +736,7 @@ YITH UI
|
|
735 |
font-size : 15px;
|
736 |
padding : 7px 20px;
|
737 |
border : 0;
|
738 |
-
transition: background-color 0.3s linear;
|
739 |
}
|
740 |
|
741 |
.yith-plugin-ui .nav-tab:first-child {
|
@@ -745,9 +746,10 @@ YITH UI
|
|
745 |
.yith-plugin-ui .nav-tab.yith-premium {
|
746 |
background-color : #be421c;
|
747 |
}
|
|
|
748 |
.yith-plugin-ui .yith-nav-tab-wrapper .yith-plugin-fw-tab-element:hover > a.nav-tab:not(.nav-tab-active),
|
749 |
-
.yith-plugin-ui .yith-nav-tab-wrapper .nav-tab:not(.nav-tab-active):hover{
|
750 |
-
background-color
|
751 |
}
|
752 |
|
753 |
.yith-plugin-ui .nav-tab-active {
|
@@ -1225,8 +1227,8 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1225 |
font-size : 13px;
|
1226 |
}
|
1227 |
|
1228 |
-
.wc-wp-version-gte-53 .yith-plugin-ui .select2-container .select2-selection--single .select2-selection__arrow{
|
1229 |
-
background-image: none;
|
1230 |
}
|
1231 |
|
1232 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
@@ -1438,7 +1440,7 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1438 |
background-color : #fff;
|
1439 |
width : 58px;
|
1440 |
height : 24px;
|
1441 |
-
line-height :14px;
|
1442 |
}
|
1443 |
|
1444 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
@@ -1475,7 +1477,7 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1475 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1476 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1477 |
background-color : #98aa36;
|
1478 |
-
left: 38px;
|
1479 |
}
|
1480 |
|
1481 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
@@ -2114,6 +2116,7 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2114 |
margin-top : 10px;
|
2115 |
line-height : 20px;
|
2116 |
max-width : 40%;
|
|
|
2117 |
}
|
2118 |
|
2119 |
.yith-plugin-fw-option-with-description {
|
@@ -2174,17 +2177,23 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2174 |
*/
|
2175 |
|
2176 |
.yith-plugin-fw-dimensions {
|
2177 |
-
|
|
|
2178 |
}
|
2179 |
|
2180 |
.yith-plugin-fw-dimensions__units {
|
2181 |
-
|
2182 |
-
|
|
|
|
|
|
|
|
|
|
|
2183 |
}
|
2184 |
|
2185 |
.yith-plugin-fw-dimensions__unit {
|
2186 |
display : inline-block;
|
2187 |
-
padding :
|
2188 |
cursor : pointer;
|
2189 |
font-weight : 700;
|
2190 |
}
|
@@ -2195,38 +2204,60 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2195 |
}
|
2196 |
|
2197 |
.yith-plugin-fw-dimensions__dimensions {
|
2198 |
-
display
|
2199 |
-
margin
|
|
|
|
|
2200 |
}
|
2201 |
|
2202 |
.yith-plugin-fw-dimensions__dimension {
|
2203 |
text-align : center;
|
|
|
2204 |
}
|
2205 |
|
2206 |
-
.yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
border-
|
2212 |
-
|
|
|
|
|
2213 |
text-align : center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2214 |
}
|
2215 |
|
2216 |
-
.yith-plugin-fw-dimensions__dimension:
|
2217 |
-
|
2218 |
-
|
|
|
2219 |
}
|
2220 |
|
2221 |
-
.
|
2222 |
-
|
|
|
|
|
|
|
|
|
|
|
2223 |
}
|
2224 |
|
2225 |
-
.yith-plugin-fw-dimensions__dimension__label
|
|
|
|
|
2226 |
text-transform : uppercase;
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
|
|
2230 |
}
|
2231 |
|
2232 |
.yith-plugin-fw-dimensions__linked {
|
@@ -2264,9 +2295,41 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2264 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2265 |
width : 80%;
|
2266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2267 |
}
|
2268 |
|
2269 |
@media screen and (max-width : 1024px) {
|
|
|
2270 |
.yith-plugin-ui .yith-add-box,
|
2271 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2272 |
width : 90%;
|
@@ -2291,6 +2354,7 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2291 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2292 |
clear : initial;
|
2293 |
}
|
|
|
2294 |
}
|
2295 |
|
2296 |
@media screen and (max-width : 782px) {
|
@@ -2322,76 +2386,86 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
|
|
2322 |
#yith-plugin-fw-panel table.form-table th.titledesc,
|
2323 |
.yith-plugin-ui #plugin-fw-wc table.form-table td,
|
2324 |
#yith-plugin-fw-panel table.form-table td.forminp {
|
2325 |
-
padding: 20px 20px;
|
2326 |
}
|
2327 |
|
2328 |
.yith-plugin-ui #plugin-fw-wc table.form-table th.titledesc,
|
2329 |
#yith-plugin-fw-panel table.form-table th.titledesc {
|
2330 |
-
padding-bottom: 0;
|
2331 |
}
|
2332 |
}
|
2333 |
|
2334 |
-
@media (max-width: 480px) {
|
2335 |
.yith-plugin-ui .nav-tab {
|
2336 |
-
font-size: 12px;
|
2337 |
}
|
|
|
2338 |
.yith-plugin-ui h2 {
|
2339 |
-
padding: 20px 20px;
|
2340 |
}
|
|
|
2341 |
.yith-plugin-ui [type="radio"]:checked + label:before, .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
2342 |
-
width: 14px;
|
2343 |
-
height: 14px;
|
2344 |
}
|
|
|
2345 |
.yith-plugin-ui [type="radio"]:checked + label:after, .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
2346 |
-
width: 10px;
|
2347 |
-
height: 10px;
|
2348 |
-
top: 3px;
|
2349 |
-
left: 3px;
|
2350 |
}
|
|
|
2351 |
.yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
|
2352 |
-
padding-left: 25px;
|
2353 |
}
|
2354 |
|
2355 |
.yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
|
2356 |
-
font-size: 13px;
|
2357 |
}
|
|
|
2358 |
.yith-plugin-ui span.description {
|
2359 |
-
font-size: 12px;
|
2360 |
}
|
|
|
2361 |
.yith-plugin-ui #plugin-fw-wc table.form-table th,
|
2362 |
#yith-plugin-fw-panel table.form-table th.titledesc,
|
2363 |
.yith-plugin-ui #plugin-fw-wc table.form-table td,
|
2364 |
#yith-plugin-fw-panel table.form-table td.forminp {
|
2365 |
-
padding: 15px 20px;
|
2366 |
}
|
2367 |
|
2368 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
2369 |
-
width: 48px;
|
2370 |
-
height: 20px;
|
2371 |
}
|
|
|
2372 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
2373 |
-
top: 3px;
|
2374 |
-
left: 3px;
|
2375 |
}
|
|
|
2376 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
2377 |
-
left: 30px;
|
2378 |
}
|
|
|
2379 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
|
2380 |
-
font-size: 11px;
|
2381 |
-
padding: 0px 6px;
|
2382 |
-
margin-top: 3px;
|
2383 |
}
|
|
|
2384 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
|
2385 |
-
font-size: 11px;
|
2386 |
-
padding-left: 24px;
|
2387 |
-
margin-top: 3px;
|
2388 |
}
|
2389 |
|
2390 |
.yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
|
2391 |
-
font-size: 14px;
|
2392 |
}
|
2393 |
|
2394 |
.yith-plugin-ui input {
|
2395 |
-
font-size: 14px;
|
2396 |
}
|
2397 |
}
|
23 |
}
|
24 |
|
25 |
.yith-plugin-fw-field-wrapper .yith-inline-fields > div {
|
26 |
+
display : inline-block;
|
27 |
+
vertical-align : middle;
|
28 |
+
margin-right : 5px;
|
29 |
}
|
30 |
|
31 |
.yith-plugin-fw-field-wrapper span.desc {
|
286 |
|
287 |
.yith-plugin-fw-checkbox-array__row {
|
288 |
margin-bottom : 10px;
|
289 |
+
display : flex;
|
290 |
}
|
291 |
|
292 |
.yith-plugin-fw-checkbox-array__row label {
|
298 |
font-weight : 400 !important;
|
299 |
}
|
300 |
|
301 |
+
.yith-plugin-fw-checkbox-array__row label small {
|
302 |
+
display : block;
|
303 |
+
line-height : 2em;
|
304 |
}
|
305 |
+
|
306 |
/* ------- Sidebar Layout ------- */
|
307 |
.yith-plugin-fw-sidebar-layout input[type="radio"] {
|
308 |
display : none;
|
736 |
font-size : 15px;
|
737 |
padding : 7px 20px;
|
738 |
border : 0;
|
739 |
+
transition : background-color 0.3s linear;
|
740 |
}
|
741 |
|
742 |
.yith-plugin-ui .nav-tab:first-child {
|
746 |
.yith-plugin-ui .nav-tab.yith-premium {
|
747 |
background-color : #be421c;
|
748 |
}
|
749 |
+
|
750 |
.yith-plugin-ui .yith-nav-tab-wrapper .yith-plugin-fw-tab-element:hover > a.nav-tab:not(.nav-tab-active),
|
751 |
+
.yith-plugin-ui .yith-nav-tab-wrapper .nav-tab:not(.nav-tab-active):hover {
|
752 |
+
background-color : #207a92;
|
753 |
}
|
754 |
|
755 |
.yith-plugin-ui .nav-tab-active {
|
1227 |
font-size : 13px;
|
1228 |
}
|
1229 |
|
1230 |
+
.wc-wp-version-gte-53 .yith-plugin-ui .select2-container .select2-selection--single .select2-selection__arrow {
|
1231 |
+
background-image : none;
|
1232 |
}
|
1233 |
|
1234 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
1440 |
background-color : #fff;
|
1441 |
width : 58px;
|
1442 |
height : 24px;
|
1443 |
+
line-height : 14px;
|
1444 |
}
|
1445 |
|
1446 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1477 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1478 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1479 |
background-color : #98aa36;
|
1480 |
+
left : 38px;
|
1481 |
}
|
1482 |
|
1483 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
2116 |
margin-top : 10px;
|
2117 |
line-height : 20px;
|
2118 |
max-width : 40%;
|
2119 |
+
min-width : min(100%, 360px);
|
2120 |
}
|
2121 |
|
2122 |
.yith-plugin-fw-option-with-description {
|
2177 |
*/
|
2178 |
|
2179 |
.yith-plugin-fw-dimensions {
|
2180 |
+
display : flex;
|
2181 |
+
align-items : flex-end;
|
2182 |
}
|
2183 |
|
2184 |
.yith-plugin-fw-dimensions__units {
|
2185 |
+
flex : 1;
|
2186 |
+
display : flex;
|
2187 |
+
margin-left : 5px;
|
2188 |
+
width : calc(100% - 105px);
|
2189 |
+
flex-wrap : wrap;
|
2190 |
+
min-height : 38px;
|
2191 |
+
margin-bottom : -8px;
|
2192 |
}
|
2193 |
|
2194 |
.yith-plugin-fw-dimensions__unit {
|
2195 |
display : inline-block;
|
2196 |
+
padding : 0 3px;
|
2197 |
cursor : pointer;
|
2198 |
font-weight : 700;
|
2199 |
}
|
2204 |
}
|
2205 |
|
2206 |
.yith-plugin-fw-dimensions__dimensions {
|
2207 |
+
display : flex;
|
2208 |
+
margin : 0;
|
2209 |
+
align-items : flex-end;
|
2210 |
+
max-width : 400px;
|
2211 |
}
|
2212 |
|
2213 |
.yith-plugin-fw-dimensions__dimension {
|
2214 |
text-align : center;
|
2215 |
+
flex : 1;
|
2216 |
}
|
2217 |
|
2218 |
+
.yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2219 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2220 |
+
.yith-plugin-ui .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number {
|
2221 |
+
width : 100%;
|
2222 |
+
min-width : 0;
|
2223 |
+
border-radius : 0;
|
2224 |
+
border : 1px solid #d8d8d8;
|
2225 |
+
border-left : none;
|
2226 |
+
height : 38px;
|
2227 |
text-align : center;
|
2228 |
+
padding-right : 0;
|
2229 |
+
}
|
2230 |
+
|
2231 |
+
.yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2232 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2233 |
+
.yith-plugin-ui .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
|
2234 |
+
border-left : 1px solid #d8d8d8;
|
2235 |
+
border-radius : 6px 0 0 6px;
|
2236 |
}
|
2237 |
|
2238 |
+
.yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2239 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
|
2240 |
+
.yith-plugin-ui .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
|
2241 |
+
border-radius : 0 6px 6px 0;
|
2242 |
}
|
2243 |
|
2244 |
+
.metaboxes-tab .yith-plugin-fw-dimensions__dimension__label,
|
2245 |
+
.yith-plugin-ui.metaboxes-tab label.yith-plugin-fw-dimensions__dimension__label {
|
2246 |
+
float : none;
|
2247 |
+
margin : 0;
|
2248 |
+
width : auto;
|
2249 |
+
font-weight : inherit;
|
2250 |
+
line-height : inherit;
|
2251 |
}
|
2252 |
|
2253 |
+
.yith-plugin-fw-dimensions__dimension__label,
|
2254 |
+
.metaboxes-tab .yith-plugin-fw-dimensions__dimension__label,
|
2255 |
+
.yith-plugin-ui.metaboxes-tab label.yith-plugin-fw-dimensions__dimension__label {
|
2256 |
text-transform : uppercase;
|
2257 |
+
letter-spacing : 2px;
|
2258 |
+
font-size : 11px;
|
2259 |
+
margin-bottom : 5px;
|
2260 |
+
display : inline-block;
|
2261 |
}
|
2262 |
|
2263 |
.yith-plugin-fw-dimensions__linked {
|
2295 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2296 |
width : 80%;
|
2297 |
}
|
2298 |
+
|
2299 |
+
|
2300 |
+
.yith-plugin-ui .yith-add-box-row,
|
2301 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row,
|
2302 |
+
.yith-plugin-ui .yith-add-box-row label {
|
2303 |
+
display : block;
|
2304 |
+
}
|
2305 |
+
|
2306 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label {
|
2307 |
+
display : block;
|
2308 |
+
}
|
2309 |
+
|
2310 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-option-with-description {
|
2311 |
+
width : 100%;
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
.yith-plugin-ui .yith-add-box-row,
|
2315 |
+
.yith-plugin-ui .yith-add-box-row label {
|
2316 |
+
display : block;
|
2317 |
+
}
|
2318 |
+
|
2319 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-plugin-fw-option-with-description,
|
2320 |
+
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description {
|
2321 |
+
display : block;
|
2322 |
+
padding-top : 20px;
|
2323 |
+
}
|
2324 |
+
|
2325 |
+
|
2326 |
+
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description span.description {
|
2327 |
+
max-width : 100%;
|
2328 |
+
}
|
2329 |
}
|
2330 |
|
2331 |
@media screen and (max-width : 1024px) {
|
2332 |
+
|
2333 |
.yith-plugin-ui .yith-add-box,
|
2334 |
.yith-plugin-ui .yith-toggle-row:not(.fixed) {
|
2335 |
width : 90%;
|
2354 |
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2355 |
clear : initial;
|
2356 |
}
|
2357 |
+
|
2358 |
}
|
2359 |
|
2360 |
@media screen and (max-width : 782px) {
|
2386 |
#yith-plugin-fw-panel table.form-table th.titledesc,
|
2387 |
.yith-plugin-ui #plugin-fw-wc table.form-table td,
|
2388 |
#yith-plugin-fw-panel table.form-table td.forminp {
|
2389 |
+
padding : 20px 20px;
|
2390 |
}
|
2391 |
|
2392 |
.yith-plugin-ui #plugin-fw-wc table.form-table th.titledesc,
|
2393 |
#yith-plugin-fw-panel table.form-table th.titledesc {
|
2394 |
+
padding-bottom : 0;
|
2395 |
}
|
2396 |
}
|
2397 |
|
2398 |
+
@media (max-width : 480px) {
|
2399 |
.yith-plugin-ui .nav-tab {
|
2400 |
+
font-size : 12px;
|
2401 |
}
|
2402 |
+
|
2403 |
.yith-plugin-ui h2 {
|
2404 |
+
padding : 20px 20px;
|
2405 |
}
|
2406 |
+
|
2407 |
.yith-plugin-ui [type="radio"]:checked + label:before, .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
2408 |
+
width : 14px;
|
2409 |
+
height : 14px;
|
2410 |
}
|
2411 |
+
|
2412 |
.yith-plugin-ui [type="radio"]:checked + label:after, .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
2413 |
+
width : 10px;
|
2414 |
+
height : 10px;
|
2415 |
+
top : 3px;
|
2416 |
+
left : 3px;
|
2417 |
}
|
2418 |
+
|
2419 |
.yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
|
2420 |
+
padding-left : 25px;
|
2421 |
}
|
2422 |
|
2423 |
.yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
|
2424 |
+
font-size : 13px;
|
2425 |
}
|
2426 |
+
|
2427 |
.yith-plugin-ui span.description {
|
2428 |
+
font-size : 12px;
|
2429 |
}
|
2430 |
+
|
2431 |
.yith-plugin-ui #plugin-fw-wc table.form-table th,
|
2432 |
#yith-plugin-fw-panel table.form-table th.titledesc,
|
2433 |
.yith-plugin-ui #plugin-fw-wc table.form-table td,
|
2434 |
#yith-plugin-fw-panel table.form-table td.forminp {
|
2435 |
+
padding : 15px 20px;
|
2436 |
}
|
2437 |
|
2438 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
2439 |
+
width : 48px;
|
2440 |
+
height : 20px;
|
2441 |
}
|
2442 |
+
|
2443 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
2444 |
+
top : 3px;
|
2445 |
+
left : 3px;
|
2446 |
}
|
2447 |
+
|
2448 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
2449 |
+
left : 30px;
|
2450 |
}
|
2451 |
+
|
2452 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
|
2453 |
+
font-size : 11px;
|
2454 |
+
padding : 0px 6px;
|
2455 |
+
margin-top : 3px;
|
2456 |
}
|
2457 |
+
|
2458 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
|
2459 |
+
font-size : 11px;
|
2460 |
+
padding-left : 24px;
|
2461 |
+
margin-top : 3px;
|
2462 |
}
|
2463 |
|
2464 |
.yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
|
2465 |
+
font-size : 14px;
|
2466 |
}
|
2467 |
|
2468 |
.yith-plugin-ui input {
|
2469 |
+
font-size : 14px;
|
2470 |
}
|
2471 |
}
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -41,15 +41,15 @@
|
|
41 |
|
42 |
/* Colorpicker */
|
43 |
$colorpicker.wpColorPicker( {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
|
55 |
$colorpicker.each( function () {
|
@@ -64,15 +64,15 @@
|
|
64 |
|
65 |
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
66 |
var button = $( '<span/>' ).attr( {
|
67 |
-
|
68 |
-
|
69 |
wrap1.find( '.wp-picker-default' ).wrap( button );
|
70 |
}
|
71 |
|
72 |
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
73 |
var button = $( '<span/>' ).attr( {
|
74 |
-
|
75 |
-
|
76 |
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
}
|
78 |
} );
|
@@ -84,7 +84,7 @@
|
|
84 |
// preview
|
85 |
$upload.imgUrl.change( function () {
|
86 |
var url = $( this ).val(),
|
87 |
-
|
88 |
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
|
90 |
if ( preview.length < 1 ) {
|
@@ -103,7 +103,7 @@
|
|
103 |
|
104 |
var t = $( this ),
|
105 |
custom_uploader,
|
106 |
-
id = t.attr( 'id' ).replace( /-button$/, '' );
|
107 |
|
108 |
//If the uploader object has already been created, reopen the dialog
|
109 |
if ( custom_uploader ) {
|
@@ -114,27 +114,27 @@
|
|
114 |
var custom_uploader_states = [
|
115 |
// Main states.
|
116 |
new wp.media.controller.Library( {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
];
|
124 |
|
125 |
// Create the media frame.
|
126 |
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
|
139 |
//When a file is selected, grab the URL and set it as the text field's value
|
140 |
custom_uploader.on( 'select', function () {
|
@@ -154,8 +154,8 @@
|
|
154 |
|
155 |
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
var t = $( this ),
|
157 |
-
id = t.attr( 'id' ),
|
158 |
-
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
159 |
default_value = $( '#' + id ).data( 'default' );
|
160 |
|
161 |
$( "#" + input_id ).val( default_value );
|
@@ -178,19 +178,19 @@
|
|
178 |
|
179 |
// Create the media frame.
|
180 |
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
|
195 |
// When an image is selected, run a callback.
|
196 |
image_gallery_frame.on( 'select', function () {
|
@@ -215,30 +215,30 @@
|
|
215 |
$imageGallery.sliderWrapper.each( function () {
|
216 |
var $t = $( this );
|
217 |
$t.sortable( {
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
} );
|
243 |
|
244 |
// Remove images
|
@@ -304,23 +304,23 @@
|
|
304 |
labels = $( this ).data( 'labels' );
|
305 |
|
306 |
$( this ).slider( {
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
} );
|
325 |
|
326 |
/* codemirror */
|
@@ -459,29 +459,29 @@
|
|
459 |
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
460 |
metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
|
461 |
url = yith_framework_fw_fields.ajax_url +
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
} else {
|
468 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
}
|
470 |
|
471 |
$.ajax( {
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
};
|
486 |
|
487 |
$.fn.serializeToggleElement = function () {
|
@@ -696,22 +696,22 @@
|
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
|
704 |
-
|
705 |
-
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
|
714 |
-
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
@@ -732,70 +732,70 @@
|
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
|
801 |
} )( jQuery );
|
41 |
|
42 |
/* Colorpicker */
|
43 |
$colorpicker.wpColorPicker( {
|
44 |
+
palettes: false,
|
45 |
+
width : 200,
|
46 |
+
mode : 'hsl',
|
47 |
+
clear : function () {
|
48 |
+
var input = $( this );
|
49 |
+
input.val( input.data( 'default-color' ) );
|
50 |
+
input.change();
|
51 |
+
}
|
52 |
+
} );
|
53 |
|
54 |
|
55 |
$colorpicker.each( function () {
|
64 |
|
65 |
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
66 |
var button = $( '<span/>' ).attr( {
|
67 |
+
class: "wp-picker-default-custom"
|
68 |
+
} );
|
69 |
wrap1.find( '.wp-picker-default' ).wrap( button );
|
70 |
}
|
71 |
|
72 |
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
73 |
var button = $( '<span/>' ).attr( {
|
74 |
+
class: "wp-picker-default-custom"
|
75 |
+
} );
|
76 |
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
}
|
78 |
} );
|
84 |
// preview
|
85 |
$upload.imgUrl.change( function () {
|
86 |
var url = $( this ).val(),
|
87 |
+
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
|
88 |
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
|
90 |
if ( preview.length < 1 ) {
|
103 |
|
104 |
var t = $( this ),
|
105 |
custom_uploader,
|
106 |
+
id = t.attr( 'id' ).replace( /-button$/, '' ).replace(/(\[|\])/g, '\\$1');
|
107 |
|
108 |
//If the uploader object has already been created, reopen the dialog
|
109 |
if ( custom_uploader ) {
|
114 |
var custom_uploader_states = [
|
115 |
// Main states.
|
116 |
new wp.media.controller.Library( {
|
117 |
+
library : wp.media.query(),
|
118 |
+
multiple : false,
|
119 |
+
title : 'Choose Image',
|
120 |
+
priority : 20,
|
121 |
+
filterable: 'uploaded'
|
122 |
+
} )
|
123 |
];
|
124 |
|
125 |
// Create the media frame.
|
126 |
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
+
// Set the title of the modal.
|
128 |
+
title : 'Choose Image',
|
129 |
+
library : {
|
130 |
+
type: ''
|
131 |
+
},
|
132 |
+
button : {
|
133 |
+
text: 'Choose Image'
|
134 |
+
},
|
135 |
+
multiple: false,
|
136 |
+
states : custom_uploader_states
|
137 |
+
} );
|
138 |
|
139 |
//When a file is selected, grab the URL and set it as the text field's value
|
140 |
custom_uploader.on( 'select', function () {
|
154 |
|
155 |
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
var t = $( this ),
|
157 |
+
id = t.attr( 'id' ).replace(/(\[|\])/g, '\\$1'),
|
158 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ).replace(/(\[|\])/g, '\\$1'),
|
159 |
default_value = $( '#' + id ).data( 'default' );
|
160 |
|
161 |
$( "#" + input_id ).val( default_value );
|
178 |
|
179 |
// Create the media frame.
|
180 |
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
+
// Set the title of the modal.
|
182 |
+
title : $t.data( 'choose' ),
|
183 |
+
button: {
|
184 |
+
text: $t.data( 'update' )
|
185 |
+
},
|
186 |
+
states: [
|
187 |
+
new wp.media.controller.Library( {
|
188 |
+
title : $t.data( 'choose' ),
|
189 |
+
filterable: 'all',
|
190 |
+
multiple : true
|
191 |
+
} )
|
192 |
+
]
|
193 |
+
} );
|
194 |
|
195 |
// When an image is selected, run a callback.
|
196 |
image_gallery_frame.on( 'select', function () {
|
215 |
$imageGallery.sliderWrapper.each( function () {
|
216 |
var $t = $( this );
|
217 |
$t.sortable( {
|
218 |
+
items : 'li.image',
|
219 |
+
cursor : 'move',
|
220 |
+
scrollSensitivity : 40,
|
221 |
+
forcePlaceholderSize: true,
|
222 |
+
forceHelperSize : false,
|
223 |
+
helper : 'clone',
|
224 |
+
opacity : 0.65,
|
225 |
+
start : function ( event, ui ) {
|
226 |
+
ui.item.css( 'background-color', '#f6f6f6' );
|
227 |
+
},
|
228 |
+
stop : function ( event, ui ) {
|
229 |
+
ui.item.removeAttr( 'style' );
|
230 |
+
},
|
231 |
+
update : function ( event, ui ) {
|
232 |
+
var attachment_ids = '';
|
233 |
+
|
234 |
+
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
235 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
236 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
237 |
+
} );
|
238 |
+
|
239 |
+
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
240 |
+
}
|
241 |
+
} );
|
242 |
} );
|
243 |
|
244 |
// Remove images
|
304 |
labels = $( this ).data( 'labels' );
|
305 |
|
306 |
$( this ).slider( {
|
307 |
+
value: val,
|
308 |
+
min : minValue,
|
309 |
+
max : maxValue,
|
310 |
+
range: 'min',
|
311 |
+
step : step,
|
312 |
+
|
313 |
+
create: function () {
|
314 |
+
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
315 |
+
},
|
316 |
+
|
317 |
+
|
318 |
+
slide: function ( event, ui ) {
|
319 |
+
$( this ).find( 'input' ).val( ui.value );
|
320 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
321 |
+
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
322 |
+
}
|
323 |
+
} );
|
324 |
} );
|
325 |
|
326 |
/* codemirror */
|
459 |
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
460 |
metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
|
461 |
url = yith_framework_fw_fields.ajax_url +
|
462 |
+
'?action=' + action +
|
463 |
+
"&post_ID=" + post_id +
|
464 |
+
'&yit_metaboxes_nonce=' + yit_metaboxes_nonce +
|
465 |
+
"&toggle_id=" + id +
|
466 |
+
"&metabox_tab=" + metabox_tab;
|
467 |
} else {
|
468 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
}
|
470 |
|
471 |
$.ajax( {
|
472 |
+
type : "POST",
|
473 |
+
url : url,
|
474 |
+
data : formdata,
|
475 |
+
contentType: false,
|
476 |
+
processData: false,
|
477 |
+
success : function ( result ) {
|
478 |
+
if ( spinner ) {
|
479 |
+
spinner.removeClass( 'show' );
|
480 |
+
}
|
481 |
|
482 |
+
$( document ).trigger( 'yith_save_toggle_element_done', [result, toggle] );
|
483 |
+
}
|
484 |
+
} );
|
485 |
};
|
486 |
|
487 |
$.fn.serializeToggleElement = function () {
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
+
// Radio
|
700 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
701 |
+
var _radioContainer = $( this ).closest( '.yith-plugin-fw-radio' ),
|
702 |
+
_value = $( this ).val();
|
703 |
|
704 |
+
_radioContainer.val( _value ).data( 'value', _value ).trigger( 'change' );
|
705 |
+
} );
|
706 |
|
707 |
+
$( document.body ).on( 'yith-plugin-fw-init-radio', function () {
|
708 |
+
$( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
|
709 |
+
$( this ).val( $( this ).data( 'value' ) );
|
710 |
+
$( this ).addClass( 'yith-plugin-fw-radio--initialized' );
|
711 |
+
} );
|
712 |
+
} ).trigger( 'yith-plugin-fw-init-radio' );
|
713 |
|
714 |
+
// Password Eye field
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
+
/**
|
736 |
+
* Dimensions
|
737 |
+
*/
|
738 |
+
var fw_dimensions = {
|
739 |
+
selectors : {
|
740 |
+
wrapper : '.yith-plugin-fw-dimensions',
|
741 |
+
units : {
|
742 |
+
wrapper : '.yith-plugin-fw-dimensions__units',
|
743 |
+
single : '.yith-plugin-fw-dimensions__unit',
|
744 |
+
value : '.yith-plugin-fw-dimensions__unit__value',
|
745 |
+
selectedClass: 'yith-plugin-fw-dimensions__unit--selected'
|
746 |
+
},
|
747 |
+
linked : {
|
748 |
+
button : '.yith-plugin-fw-dimensions__linked',
|
749 |
+
value : '.yith-plugin-fw-dimensions__linked__value',
|
750 |
+
wrapperActiveClass: 'yith-plugin-fw-dimensions--linked-active'
|
751 |
+
},
|
752 |
+
dimensions: {
|
753 |
+
number: '.yith-plugin-fw-dimensions__dimension__number'
|
754 |
+
}
|
755 |
+
},
|
756 |
+
init : function () {
|
757 |
+
var self = fw_dimensions;
|
758 |
+
$( document ).on( 'click', self.selectors.units.single, self.unitChange );
|
759 |
+
$( document ).on( 'click', self.selectors.linked.button, self.linkedChange );
|
760 |
+
$( document ).on( 'change keyup', self.selectors.dimensions.number, self.numberChange );
|
761 |
+
},
|
762 |
+
unitChange : function ( e ) {
|
763 |
+
var unit = $( this ).closest( fw_dimensions.selectors.units.single ),
|
764 |
+
wrapper = unit.closest( fw_dimensions.selectors.units.wrapper ),
|
765 |
+
units = wrapper.find( fw_dimensions.selectors.units.single ),
|
766 |
+
valueField = wrapper.find( fw_dimensions.selectors.units.value ).first(),
|
767 |
+
value = unit.data( 'value' );
|
768 |
+
|
769 |
+
units.removeClass( fw_dimensions.selectors.units.selectedClass );
|
770 |
+
unit.addClass( fw_dimensions.selectors.units.selectedClass );
|
771 |
+
valueField.val( value );
|
772 |
+
},
|
773 |
+
linkedChange: function () {
|
774 |
+
var button = $( this ).closest( fw_dimensions.selectors.linked.button ),
|
775 |
+
mainWrapper = button.closest( fw_dimensions.selectors.wrapper ),
|
776 |
+
valueField = button.find( fw_dimensions.selectors.linked.value ),
|
777 |
+
value = valueField.val();
|
778 |
+
|
779 |
+
if ( 'yes' === value ) {
|
780 |
+
mainWrapper.removeClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
781 |
+
valueField.val( 'no' );
|
782 |
+
} else {
|
783 |
+
mainWrapper.addClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
784 |
+
valueField.val( 'yes' );
|
785 |
+
|
786 |
+
mainWrapper.find( fw_dimensions.selectors.dimensions.number ).first().trigger( 'change' );
|
787 |
+
}
|
788 |
+
},
|
789 |
+
numberChange: function ( e ) {
|
790 |
+
var number = $( this ).closest( fw_dimensions.selectors.dimensions.number ),
|
791 |
+
mainWrapper = number.closest( fw_dimensions.selectors.wrapper );
|
792 |
+
if ( mainWrapper.hasClass( fw_dimensions.selectors.linked.wrapperActiveClass ) ) {
|
793 |
+
var numbers = mainWrapper.find( fw_dimensions.selectors.dimensions.number );
|
794 |
+
|
795 |
+
numbers.val( number.val() );
|
796 |
+
}
|
797 |
+
}
|
798 |
+
};
|
799 |
+
fw_dimensions.init();
|
800 |
|
801 |
} )( jQuery );
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={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:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id"),l=i.attr("id").replace(/-button-reset$/,""),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.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,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.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(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).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,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
1 |
+
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={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:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.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,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.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(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).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,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.js
CHANGED
@@ -1,211 +1,211 @@
|
|
1 |
-
(function ($) {
|
2 |
-
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
-
var __ = wp.i18n.__,
|
4 |
-
el = wp.element.createElement,
|
5 |
-
Fragment = wp.element.Fragment,
|
6 |
-
PanelBody = wp.components.PanelBody,
|
7 |
-
registerBlockType = wp.blocks.registerBlockType,
|
8 |
-
RichText = wp.editor.RichText,
|
9 |
-
BlockControls = wp.editor.BlockControls,
|
10 |
-
InspectorControls = wp.editor.InspectorControls,
|
11 |
-
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
-
Components = wp.components,
|
13 |
-
RawHTML = wp.element.RawHTML,
|
14 |
-
SelectControl = wp.components.SelectControl,
|
15 |
-
ToggleControl = wp.components.ToggleControl,
|
16 |
-
CheckboxControl = wp.components.CheckboxControl,
|
17 |
-
RangeControl = wp.components.RangeControl,
|
18 |
-
ColorPicker = wp.components.ColorPicker,
|
19 |
-
RadioControl = wp.components.RadioControl,
|
20 |
-
TextControl = wp.components.TextControl,
|
21 |
-
TextareaControl = wp.components.TextareaControl;
|
22 |
-
|
23 |
-
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
-
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
-
);
|
26 |
-
|
27 |
-
function create_shortcode(sc_args, props, callback) {
|
28 |
-
var gt_block = '',
|
29 |
-
gutenberg_preview = '';
|
30 |
-
|
31 |
-
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
-
gt_block = $[props.callback](sc_args, props);
|
33 |
-
}
|
34 |
-
|
35 |
-
else {
|
36 |
-
var sc_name = props.shortcode_name,
|
37 |
-
sc = '[' + sc_name,
|
38 |
-
do_shortcode = null;
|
39 |
-
|
40 |
-
|
41 |
-
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
-
if ($v != '
|
43 |
-
sc += ' ' + $v + '=';
|
44 |
-
var arg = props.attributes[$v],
|
45 |
-
remove_quotes = arg.remove_quotes;
|
46 |
-
|
47 |
-
if( remove_quotes == true ){
|
48 |
-
sc += $k;
|
49 |
-
}
|
50 |
-
|
51 |
-
else {
|
52 |
-
sc += '"' + $k + '"';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
});
|
56 |
-
|
57 |
-
sc += ']';
|
58 |
-
|
59 |
-
var block_id = md5(sc);
|
60 |
-
|
61 |
-
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
-
|
63 |
-
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
-
do_shortcode = (function (block_id) {
|
65 |
-
var ajax_call_date = null;
|
66 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
-
$.ajax({
|
68 |
-
async: true,
|
69 |
-
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
-
method: 'post',
|
71 |
-
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
-
success: function (data) {
|
73 |
-
ajax_call_date = data;
|
74 |
-
if (ajax_call_date != '') {
|
75 |
-
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
-
}
|
78 |
-
}
|
79 |
-
});
|
80 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
-
return ajax_call_date;
|
82 |
-
})(block_id);
|
83 |
-
}
|
84 |
-
|
85 |
-
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
-
}
|
87 |
-
|
88 |
-
return gt_block;
|
89 |
-
}
|
90 |
-
|
91 |
-
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
-
var attributes = {};
|
93 |
-
|
94 |
-
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
-
new_value = new_value.hex;
|
96 |
-
}
|
97 |
-
|
98 |
-
attributes[attribute_name] = new_value;
|
99 |
-
args.setAttributes(attributes);
|
100 |
-
return args;
|
101 |
-
}
|
102 |
-
|
103 |
-
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
-
registerBlockType("yith/" + $block, {
|
105 |
-
title: $props.title,
|
106 |
-
description: $props.description,
|
107 |
-
category: $props.category,
|
108 |
-
attributes: $props.attributes,
|
109 |
-
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
-
keywords: $props.keywords,
|
111 |
-
edit: function edit(args) {
|
112 |
-
var elements = new Array();
|
113 |
-
|
114 |
-
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
-
var ComponentControl = null,
|
116 |
-
block_type = $attribute_args.blocktype;
|
117 |
-
if (typeof block_type != 'undefined') {
|
118 |
-
switch (block_type) {
|
119 |
-
case 'select':
|
120 |
-
ComponentControl = SelectControl;
|
121 |
-
break;
|
122 |
-
|
123 |
-
case 'text':
|
124 |
-
ComponentControl = TextControl;
|
125 |
-
break;
|
126 |
-
|
127 |
-
case 'textarea':
|
128 |
-
ComponentControl = TextareaControl;
|
129 |
-
break;
|
130 |
-
|
131 |
-
case 'toggle':
|
132 |
-
ComponentControl = ToggleControl;
|
133 |
-
break;
|
134 |
-
|
135 |
-
case 'checkbox':
|
136 |
-
ComponentControl = CheckboxControl;
|
137 |
-
break;
|
138 |
-
|
139 |
-
case 'number':
|
140 |
-
case 'range':
|
141 |
-
ComponentControl = RangeControl;
|
142 |
-
break;
|
143 |
-
|
144 |
-
case 'color':
|
145 |
-
case 'colorpicker':
|
146 |
-
ComponentControl = ColorPicker;
|
147 |
-
break;
|
148 |
-
|
149 |
-
case 'radio':
|
150 |
-
ComponentControl = RadioControl;
|
151 |
-
break;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (ComponentControl != null) {
|
155 |
-
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
-
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
-
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
-
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
-
}
|
160 |
-
|
161 |
-
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
-
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
-
}
|
164 |
-
|
165 |
-
elements.push(
|
166 |
-
el(
|
167 |
-
ComponentControl,
|
168 |
-
{
|
169 |
-
value: args.attributes[$attribute_name],
|
170 |
-
options: $attribute_args.options,
|
171 |
-
label: $attribute_args.label,
|
172 |
-
checked: args.attributes[$attribute_name],
|
173 |
-
selected: args.attributes[$attribute_name],
|
174 |
-
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
-
disableAlpha: $attribute_args.disableAlpha,
|
176 |
-
min: $attribute_args.min,
|
177 |
-
max: $attribute_args.max,
|
178 |
-
multiple: $attribute_args.multiple,
|
179 |
-
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
-
},
|
182 |
-
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
-
},
|
185 |
-
},
|
186 |
-
)
|
187 |
-
);
|
188 |
-
}
|
189 |
-
}
|
190 |
-
});
|
191 |
-
|
192 |
-
sc = create_shortcode(args, $props, 'edit');
|
193 |
-
|
194 |
-
return [
|
195 |
-
el(
|
196 |
-
Fragment,
|
197 |
-
null,
|
198 |
-
el(
|
199 |
-
InspectorControls,
|
200 |
-
null,
|
201 |
-
elements,
|
202 |
-
),
|
203 |
-
sc,
|
204 |
-
)];
|
205 |
-
},
|
206 |
-
save: function save(args) {
|
207 |
-
return create_shortcode(args, $props, 'save');
|
208 |
-
}
|
209 |
-
});
|
210 |
-
});
|
211 |
-
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
+
var __ = wp.i18n.__,
|
4 |
+
el = wp.element.createElement,
|
5 |
+
Fragment = wp.element.Fragment,
|
6 |
+
PanelBody = wp.components.PanelBody,
|
7 |
+
registerBlockType = wp.blocks.registerBlockType,
|
8 |
+
RichText = wp.editor.RichText,
|
9 |
+
BlockControls = wp.editor.BlockControls,
|
10 |
+
InspectorControls = wp.editor.InspectorControls,
|
11 |
+
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
+
Components = wp.components,
|
13 |
+
RawHTML = wp.element.RawHTML,
|
14 |
+
SelectControl = wp.components.SelectControl,
|
15 |
+
ToggleControl = wp.components.ToggleControl,
|
16 |
+
CheckboxControl = wp.components.CheckboxControl,
|
17 |
+
RangeControl = wp.components.RangeControl,
|
18 |
+
ColorPicker = wp.components.ColorPicker,
|
19 |
+
RadioControl = wp.components.RadioControl,
|
20 |
+
TextControl = wp.components.TextControl,
|
21 |
+
TextareaControl = wp.components.TextareaControl;
|
22 |
+
|
23 |
+
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
+
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
+
);
|
26 |
+
|
27 |
+
function create_shortcode(sc_args, props, callback) {
|
28 |
+
var gt_block = '',
|
29 |
+
gutenberg_preview = '';
|
30 |
+
|
31 |
+
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
+
gt_block = $[props.callback](sc_args, props);
|
33 |
+
}
|
34 |
+
|
35 |
+
else {
|
36 |
+
var sc_name = props.shortcode_name,
|
37 |
+
sc = '[' + sc_name,
|
38 |
+
do_shortcode = null;
|
39 |
+
|
40 |
+
|
41 |
+
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
+
if ( typeof props.attributes != 'undefined' && typeof props.attributes[$v] != 'undefined' ) {
|
43 |
+
sc += ' ' + $v + '=';
|
44 |
+
var arg = props.attributes[$v],
|
45 |
+
remove_quotes = arg.remove_quotes;
|
46 |
+
|
47 |
+
if( remove_quotes == true ){
|
48 |
+
sc += $k;
|
49 |
+
}
|
50 |
+
|
51 |
+
else {
|
52 |
+
sc += '"' + $k + '"';
|
53 |
+
}
|
54 |
+
}
|
55 |
+
});
|
56 |
+
|
57 |
+
sc += ']';
|
58 |
+
|
59 |
+
var block_id = md5(sc);
|
60 |
+
|
61 |
+
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
+
|
63 |
+
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
+
do_shortcode = (function (block_id) {
|
65 |
+
var ajax_call_date = null;
|
66 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
+
$.ajax({
|
68 |
+
async: true,
|
69 |
+
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
+
method: 'post',
|
71 |
+
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
+
success: function (data) {
|
73 |
+
ajax_call_date = data;
|
74 |
+
if (ajax_call_date != '') {
|
75 |
+
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
});
|
80 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
+
return ajax_call_date;
|
82 |
+
})(block_id);
|
83 |
+
}
|
84 |
+
|
85 |
+
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
+
}
|
87 |
+
|
88 |
+
return gt_block;
|
89 |
+
}
|
90 |
+
|
91 |
+
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
+
var attributes = {};
|
93 |
+
|
94 |
+
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
+
new_value = new_value.hex;
|
96 |
+
}
|
97 |
+
|
98 |
+
attributes[attribute_name] = new_value;
|
99 |
+
args.setAttributes(attributes);
|
100 |
+
return args;
|
101 |
+
}
|
102 |
+
|
103 |
+
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
+
registerBlockType("yith/" + $block, {
|
105 |
+
title: $props.title,
|
106 |
+
description: $props.description,
|
107 |
+
category: $props.category,
|
108 |
+
attributes: $props.attributes,
|
109 |
+
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
+
keywords: $props.keywords,
|
111 |
+
edit: function edit(args) {
|
112 |
+
var elements = new Array();
|
113 |
+
|
114 |
+
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
+
var ComponentControl = null,
|
116 |
+
block_type = $attribute_args.blocktype;
|
117 |
+
if (typeof block_type != 'undefined') {
|
118 |
+
switch (block_type) {
|
119 |
+
case 'select':
|
120 |
+
ComponentControl = SelectControl;
|
121 |
+
break;
|
122 |
+
|
123 |
+
case 'text':
|
124 |
+
ComponentControl = TextControl;
|
125 |
+
break;
|
126 |
+
|
127 |
+
case 'textarea':
|
128 |
+
ComponentControl = TextareaControl;
|
129 |
+
break;
|
130 |
+
|
131 |
+
case 'toggle':
|
132 |
+
ComponentControl = ToggleControl;
|
133 |
+
break;
|
134 |
+
|
135 |
+
case 'checkbox':
|
136 |
+
ComponentControl = CheckboxControl;
|
137 |
+
break;
|
138 |
+
|
139 |
+
case 'number':
|
140 |
+
case 'range':
|
141 |
+
ComponentControl = RangeControl;
|
142 |
+
break;
|
143 |
+
|
144 |
+
case 'color':
|
145 |
+
case 'colorpicker':
|
146 |
+
ComponentControl = ColorPicker;
|
147 |
+
break;
|
148 |
+
|
149 |
+
case 'radio':
|
150 |
+
ComponentControl = RadioControl;
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
|
154 |
+
if (ComponentControl != null) {
|
155 |
+
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
+
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
+
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
+
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
+
}
|
160 |
+
|
161 |
+
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
+
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
+
}
|
164 |
+
|
165 |
+
elements.push(
|
166 |
+
el(
|
167 |
+
ComponentControl,
|
168 |
+
{
|
169 |
+
value: args.attributes[$attribute_name],
|
170 |
+
options: $attribute_args.options,
|
171 |
+
label: $attribute_args.label,
|
172 |
+
checked: args.attributes[$attribute_name],
|
173 |
+
selected: args.attributes[$attribute_name],
|
174 |
+
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
+
disableAlpha: $attribute_args.disableAlpha,
|
176 |
+
min: $attribute_args.min,
|
177 |
+
max: $attribute_args.max,
|
178 |
+
multiple: $attribute_args.multiple,
|
179 |
+
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
+
},
|
182 |
+
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
+
},
|
185 |
+
},
|
186 |
+
)
|
187 |
+
);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
});
|
191 |
+
|
192 |
+
sc = create_shortcode(args, $props, 'edit');
|
193 |
+
|
194 |
+
return [
|
195 |
+
el(
|
196 |
+
Fragment,
|
197 |
+
null,
|
198 |
+
el(
|
199 |
+
InspectorControls,
|
200 |
+
null,
|
201 |
+
elements,
|
202 |
+
),
|
203 |
+
sc,
|
204 |
+
)];
|
205 |
+
},
|
206 |
+
save: function save(args) {
|
207 |
+
return create_shortcode(args, $props, 'save');
|
208 |
+
}
|
209 |
+
});
|
210 |
+
});
|
211 |
+
})(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.min.js
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(h){function q(g,b,e){var f="";f="";if("undefined"!=typeof b.callback&&"function"==typeof h[b.callback])f=h[b.callback](g,b);else{var c="["+b.shortcode_name;h.each(g.attributes,function(a,d){"undefined"!=typeof b.attributes&&"undefined"!=typeof b.attributes[a]&&(c+=" "+a+"=",c=1==b.attributes[a].remove_quotes?c+d:c+('"'+d+'"'))});c+="]";g=md5(c);f='<span class="yith_block_'+g+'">'+c+"</span>";"edit"==e&&0!=b.do_shortcode&&function(a){var d=null;h(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",
|
2 |
+
[c,a]);h.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:c},success:function(l){d=l;""!=d&&(h(".yith_block_"+a).html(d),h(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[c,a,d]))}});h(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[c,a,d]);return d}(g);f=m(t,null,f)}return f}function r(g,b,e,f){var c={};if("colorpicker"==f||"color"==f)g=g.hex;c[b]=g;e.setAttributes(c);return e}var m=wp.element.createElement,
|
3 |
+
u=wp.element.Fragment,v=wp.blocks.registerBlockType,w=wp.editor.InspectorControls,t=wp.element.RawHTML,x=wp.components.SelectControl,y=wp.components.ToggleControl,z=wp.components.CheckboxControl,A=wp.components.RangeControl,B=wp.components.ColorPicker,C=wp.components.RadioControl,D=wp.components.TextControl,E=wp.components.TextareaControl,F=m("svg",{width:22,height:22},m("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));
|
4 |
+
h.each(yith_gutenberg,function(g,b){v("yith/"+g,{title:b.title,description:b.description,category:b.category,attributes:b.attributes,icon:"undefined"!=typeof b.icon?b.icon:F,keywords:b.keywords,edit:function(e){var f=[];h.each(b.attributes,function(c,a){var d=null,l=a.blocktype;if("undefined"!=typeof l){switch(l){case "select":d=x;break;case "text":d=D;break;case "textarea":d=E;break;case "toggle":d=y;break;case "checkbox":d=z;break;case "number":case "range":d=A;break;case "color":case "colorpicker":d=
|
5 |
+
B;break;case "radio":d=C}if(null!=d){var n=helpMessageUncheked="";"undefined"!=typeof a.helps&&"undefined"!=typeof a.helps.checked&&"undefined"!=typeof a.helps.unchecked?(n=a.helps.checked,helpMessageUncheked=a.helps.unchecked):"undefined"!=typeof a.help&&(n=helpMessageUncheked=a.help);f.push(m(d,{value:e.attributes[c],options:a.options,label:a.label,checked:e.attributes[c],selected:e.attributes[c],help:e.attributes[c]?n:helpMessageUncheked,disableAlpha:a.disableAlpha,min:a.min,max:a.max,multiple:a.multiple,
|
6 |
+
onChange:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)},onChangeComplete:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)}}))}}});sc=q(e,b,"edit");return[m(u,null,m(w,null,f),sc)]},save:function(e){return q(e,b,"save")}})})})(jQuery);
|
plugin-fw/bin/clean-language-files.js
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jshint ignore: start */
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
7 |
+
*/
|
8 |
+
|
9 |
+
const fs = require( 'fs' );
|
10 |
+
const glob = require( 'glob' );
|
11 |
+
const chalk = require( 'chalk' );
|
12 |
+
|
13 |
+
const DELETED = chalk.reset.inverse.bold.green( ' DELETED ' );
|
14 |
+
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
15 |
+
|
16 |
+
console.log( chalk.green( '\nCleaning language files...' ) );
|
17 |
+
glob( "languages/*.po~", function ( er, files ) {
|
18 |
+
|
19 |
+
if ( files.length ) {
|
20 |
+
console.log( `Processing ${files.length} files:` );
|
21 |
+
|
22 |
+
files.forEach( ( file ) => {
|
23 |
+
fs.unlink( file, ( err ) => {
|
24 |
+
if ( err ) {
|
25 |
+
console.log( chalk.bold( ` - ${file} ` ) + ERROR );
|
26 |
+
console.error( err );
|
27 |
+
return;
|
28 |
+
}
|
29 |
+
console.log( chalk.bold( ` - ${file} ` ) + DELETED );
|
30 |
+
} );
|
31 |
+
} );
|
32 |
+
} else {
|
33 |
+
console.log( `No file to clean.\n` );
|
34 |
+
}
|
35 |
+
|
36 |
+
} );
|
plugin-fw/bin/download-translations-config.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"projectPath": "https://translate.yithemes.com/gp/projects/yith-framework/",
|
3 |
+
"textDomain": "yith-plugin-fw",
|
4 |
+
"destFolder": "languages/",
|
5 |
+
"languages": [
|
6 |
+
{
|
7 |
+
"id": "es",
|
8 |
+
"name": "Spanish",
|
9 |
+
"slug": "es_ES"
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"id": "it",
|
13 |
+
"name": "Italian",
|
14 |
+
"slug": "it_IT"
|
15 |
+
},
|
16 |
+
{
|
17 |
+
"id": "nl",
|
18 |
+
"name": "Dutch",
|
19 |
+
"slug": "nl_NL"
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"id": "el",
|
23 |
+
"name": "Greek",
|
24 |
+
"slug": "el"
|
25 |
+
}
|
26 |
+
]
|
27 |
+
}
|
plugin-fw/bin/download-translations.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jshint ignore: start */
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This script download translations from https://translate.yithemes.com/
|
5 |
+
*
|
6 |
+
* @version 1.1.0
|
7 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
const fs = require( 'fs' );
|
11 |
+
const path = require( 'path' );
|
12 |
+
const axios = require( 'axios' );
|
13 |
+
const chalk = require( 'chalk' );
|
14 |
+
const options = require( './download-translations-config' );
|
15 |
+
|
16 |
+
const SPACE = '\t';
|
17 |
+
const DONE = chalk.reset.inverse.bold.green( ' DONE ' );
|
18 |
+
const ERROR = chalk.reset.inverse.bold.red( ' ERROR ' );
|
19 |
+
|
20 |
+
async function download( url, dest ) {
|
21 |
+
const destPath = path.resolve( dest );
|
22 |
+
const writer = fs.createWriteStream( destPath );
|
23 |
+
|
24 |
+
const response = await axios( {
|
25 |
+
url,
|
26 |
+
method : 'GET',
|
27 |
+
responseType: 'stream'
|
28 |
+
} );
|
29 |
+
|
30 |
+
response.data.pipe( writer );
|
31 |
+
|
32 |
+
return new Promise( ( resolve, reject ) => {
|
33 |
+
writer.on( 'finish', resolve );
|
34 |
+
writer.on( 'error', reject );
|
35 |
+
} )
|
36 |
+
}
|
37 |
+
|
38 |
+
const downloadLanguage = function ( language ) {
|
39 |
+
const languageName = language.name || language.id;
|
40 |
+
const source = options.projectPath + language.id + "/default/export-translations/";
|
41 |
+
const fileName = options.textDomain + '-' + language.slug + '.po';
|
42 |
+
const dest = options.destFolder + fileName;
|
43 |
+
const message = ' - ' + chalk.bold( languageName ) + SPACE;
|
44 |
+
|
45 |
+
download( source, dest ).then( () => {
|
46 |
+
console.log( message + DONE );
|
47 |
+
} ).catch( ( err ) => {
|
48 |
+
console.log( message + ERROR );
|
49 |
+
throw err;
|
50 |
+
} );
|
51 |
+
};
|
52 |
+
|
53 |
+
console.log( chalk.green( '\nDownloading Transations from translate.yithemes.com...' ) );
|
54 |
+
|
55 |
+
options.languages.forEach( ( language ) => {
|
56 |
+
downloadLanguage( language );
|
57 |
+
} );
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.4.
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.4.31
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -67,6 +67,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
67 |
* Constructor
|
68 |
*
|
69 |
* @param array $args
|
|
|
70 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
71 |
* @since 1.0
|
72 |
*/
|
@@ -84,8 +85,9 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
84 |
);
|
85 |
|
86 |
$args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
|
87 |
-
if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] )
|
88 |
$args['parent_page'] = 'yith_plugin_panel';
|
|
|
89 |
|
90 |
$this->settings = $args;
|
91 |
$this->_tabs_path_files = $this->get_tabs_path_files();
|
@@ -113,10 +115,10 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
113 |
|
114 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
/**
|
122 |
* Is this a custom post type page?
|
@@ -130,7 +132,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
130 |
$excluded_post_types = array( 'product', 'page', 'post' );
|
131 |
|
132 |
return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
|
133 |
-
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -145,7 +147,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
145 |
$excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
|
146 |
|
147 |
return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
|
148 |
-
|
149 |
}
|
150 |
|
151 |
/**
|
@@ -168,6 +170,8 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
168 |
$tabs = $this->get_taxonomy_tabs( $taxonomy );
|
169 |
}
|
170 |
|
|
|
|
|
171 |
if ( $tabs ) {
|
172 |
// tabs_in_edit
|
173 |
$current_tab_args = array(
|
@@ -176,14 +180,18 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
176 |
'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
|
177 |
);
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
182 |
|
183 |
if ( ! self::$_panel_tabs_in_wp_pages ) {
|
184 |
self::$_panel_tabs_in_wp_pages = $current_tab_args;
|
185 |
-
|
186 |
-
|
|
|
|
|
187 |
add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
|
188 |
add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
|
189 |
}
|
@@ -250,14 +258,16 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
250 |
* Add yith-plugin-fw-panel in body classes in Panel pages
|
251 |
*
|
252 |
* @param $admin_body_classes
|
|
|
253 |
* @return string
|
254 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
255 |
* @since 3.0.0
|
256 |
*/
|
257 |
public static function add_body_class( $admin_body_classes ) {
|
258 |
global $pagenow;
|
259 |
-
if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) )
|
260 |
$admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
|
|
|
261 |
|
262 |
return $admin_body_classes;
|
263 |
}
|
@@ -355,6 +365,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
355 |
* a callback function called by Register Settings function
|
356 |
*
|
357 |
* @param $input
|
|
|
358 |
* @return array validate input fields
|
359 |
* @since 1.0
|
360 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -463,6 +474,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
463 |
* Print the tabs navigation
|
464 |
*
|
465 |
* @param array $args
|
|
|
466 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
467 |
* @since 3.4.0
|
468 |
*/
|
@@ -524,6 +536,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
524 |
* @param string $tab
|
525 |
* @param string $sub_tab
|
526 |
* @param string $parent_page
|
|
|
527 |
* @return string
|
528 |
*/
|
529 |
public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
|
@@ -548,6 +561,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
548 |
* Print the Sub-tabs navigation if the current tab has sub-tabs
|
549 |
*
|
550 |
* @param array $args
|
|
|
551 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
552 |
* @since 3.4.0
|
553 |
*/
|
@@ -597,6 +611,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
597 |
|
598 |
if ( $custom_tab_action ) {
|
599 |
$this->print_custom_tab( $custom_tab_action );
|
|
|
600 |
return;
|
601 |
}
|
602 |
|
@@ -612,17 +627,17 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
612 |
<p> </p>
|
613 |
<?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
|
614 |
<input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
|
615 |
-
|
616 |
<input type="submit" class="button-primary"
|
617 |
-
|
618 |
-
|
619 |
</form>
|
620 |
<form method="post">
|
621 |
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
|
622 |
<input type="hidden" name="yit-action" value="reset"/>
|
623 |
<input type="submit" name="yit-reset" class="button-secondary"
|
624 |
-
|
625 |
-
|
626 |
</form>
|
627 |
<p> </p>
|
628 |
<?php endif ?>
|
@@ -637,6 +652,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
637 |
*
|
638 |
* @param array $options
|
639 |
* @param string $option_key
|
|
|
640 |
* @return bool
|
641 |
*/
|
642 |
public function is_custom_tab( $options, $option_key ) {
|
@@ -655,6 +671,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
655 |
$first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
|
656 |
$type = isset( $first['type'] ) ? $first['type'] : 'options';
|
657 |
$special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
|
|
|
658 |
return in_array( $type, $special_types ) ? $type : 'options';
|
659 |
}
|
660 |
|
@@ -675,6 +692,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
675 |
* Fire the action to print the custom tab
|
676 |
*
|
677 |
* @param string $action Action to fire
|
|
|
678 |
* @return void
|
679 |
* @since 1.0
|
680 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
@@ -730,11 +748,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
730 |
foreach ( $this->settings['admin-tabs'] as $item => $title ) {
|
731 |
|
732 |
$wp_admin_bar->add_menu( array(
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
}
|
739 |
}
|
740 |
}
|
@@ -848,6 +866,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
848 |
* @param $message
|
849 |
* @param string $type can be 'error' or 'updated'
|
850 |
* @param bool $echo
|
|
|
851 |
* @return string
|
852 |
* @since 1.0
|
853 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -876,7 +895,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
876 |
|
877 |
$tabs = array();
|
878 |
|
879 |
-
foreach ( ( array )glob( $option_files_path . '*.php' ) as $filename ) {
|
880 |
preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
|
881 |
|
882 |
if ( ! isset( $filename_parts[1] ) ) {
|
@@ -915,6 +934,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
915 |
* Return the sub-tabs array of a specific tab
|
916 |
*
|
917 |
* @param array|bool $_tab the tab; if not set it'll be the current tab
|
|
|
918 |
* @since 3.4.0
|
919 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
920 |
* @return array sub-tabs array
|
@@ -937,6 +957,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
937 |
if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
|
938 |
return $_first['sub-tabs'];
|
939 |
}
|
|
|
940 |
return array();
|
941 |
}
|
942 |
|
@@ -1005,6 +1026,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1005 |
}
|
1006 |
}
|
1007 |
}
|
|
|
1008 |
return '';
|
1009 |
}
|
1010 |
|
@@ -1013,6 +1035,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1013 |
* return the title of section
|
1014 |
*
|
1015 |
* @param $section
|
|
|
1016 |
* @return string
|
1017 |
* @since 1.0
|
1018 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1026,6 +1049,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1026 |
return $option['name'];
|
1027 |
}
|
1028 |
}
|
|
|
1029 |
return '';
|
1030 |
}
|
1031 |
|
@@ -1034,6 +1058,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1034 |
* return the description of section if is set
|
1035 |
*
|
1036 |
* @param $section
|
|
|
1037 |
* @return string
|
1038 |
* @since 1.0
|
1039 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1047,6 +1072,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1047 |
return '<p>' . $option['desc'] . '</p>';
|
1048 |
}
|
1049 |
}
|
|
|
1050 |
return '';
|
1051 |
}
|
1052 |
|
@@ -1082,6 +1108,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1082 |
* return a string with the name of the input field
|
1083 |
*
|
1084 |
* @param string $name
|
|
|
1085 |
* @return string
|
1086 |
* @since 1.0
|
1087 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1095,6 +1122,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1095 |
* return a string with the id of the input field
|
1096 |
*
|
1097 |
* @param string $id
|
|
|
1098 |
* @return string
|
1099 |
* @since 1.0
|
1100 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1110,6 +1138,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1110 |
* return a text area
|
1111 |
*
|
1112 |
* @param array $param
|
|
|
1113 |
* @return void
|
1114 |
* @since 1.0
|
1115 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
@@ -1132,11 +1161,13 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1132 |
$std = isset( $option['std'] ) ? $option['std'] : '';
|
1133 |
$db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
|
1134 |
|
1135 |
-
if ( isset( $option['deps'] ) )
|
1136 |
$deps = $option['deps'];
|
|
|
1137 |
|
1138 |
-
if ( 'on-off' === $option['type'] )
|
1139 |
$option['type'] = 'onoff';
|
|
|
1140 |
|
1141 |
if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
|
1142 |
$field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
|
@@ -1169,6 +1200,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1169 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1170 |
*
|
1171 |
* @param array $args
|
|
|
1172 |
* @return void
|
1173 |
* @since 1.0
|
1174 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
@@ -1184,6 +1216,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1184 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1185 |
*
|
1186 |
* @param array $args
|
|
|
1187 |
* @return void
|
1188 |
* @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
|
1189 |
*/
|
@@ -1278,11 +1311,11 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1278 |
</div>
|
1279 |
<div class="yith-plugin-fw-rate">
|
1280 |
<?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
</div>
|
1287 |
<?php else: ?>
|
1288 |
<h1 class="notice-container"></h1>
|
@@ -1368,72 +1401,73 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
1368 |
public function maybe_redirect_to_proper_wp_page() {
|
1369 |
global $pagenow;
|
1370 |
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
|
1371 |
-
|
1372 |
$url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
|
1373 |
if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
|
1374 |
wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
|
1375 |
exit;
|
1376 |
}
|
1377 |
}
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
|
|
1439 |
}
|
67 |
* Constructor
|
68 |
*
|
69 |
* @param array $args
|
70 |
+
*
|
71 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
72 |
* @since 1.0
|
73 |
*/
|
85 |
);
|
86 |
|
87 |
$args = apply_filters( 'yit_plugin_fw_panel_option_args', wp_parse_args( $args, $default_args ) );
|
88 |
+
if ( isset( $args['parent_page'] ) && 'yit_plugin_panel' === $args['parent_page'] ) {
|
89 |
$args['parent_page'] = 'yith_plugin_panel';
|
90 |
+
}
|
91 |
|
92 |
$this->settings = $args;
|
93 |
$this->_tabs_path_files = $this->get_tabs_path_files();
|
115 |
|
116 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
117 |
|
118 |
+
//yith-plugin-ui
|
119 |
+
add_action( 'yith_plugin_fw_before_yith_panel', array( $this, 'add_plugin_banner' ), 10, 1 );
|
120 |
+
add_action( 'wp_ajax_yith_plugin_fw_save_toggle_element', array( $this, 'save_toggle_element_options' ) );
|
121 |
+
}
|
122 |
|
123 |
/**
|
124 |
* Is this a custom post type page?
|
132 |
$excluded_post_types = array( 'product', 'page', 'post' );
|
133 |
|
134 |
return in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) &&
|
135 |
+
! in_array( $post_type, $excluded_post_types, true );
|
136 |
}
|
137 |
|
138 |
/**
|
147 |
$excluded_taxonomies = array( 'category', 'post_tag', 'product_cat', 'product_tag' );
|
148 |
|
149 |
return in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) &&
|
150 |
+
! in_array( $taxonomy, $excluded_taxonomies, true );
|
151 |
}
|
152 |
|
153 |
/**
|
170 |
$tabs = $this->get_taxonomy_tabs( $taxonomy );
|
171 |
}
|
172 |
|
173 |
+
$is_block_editor = function_exists( 'get_current_screen' ) && get_current_screen() && get_current_screen()->is_block_editor();
|
174 |
+
|
175 |
if ( $tabs ) {
|
176 |
// tabs_in_edit
|
177 |
$current_tab_args = array(
|
180 |
'current_sub_tab' => isset( $tabs['sub_tab'] ) ? $tabs['sub_tab'] : '',
|
181 |
);
|
182 |
|
183 |
+
if ( ! $is_block_editor ) {
|
184 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
185 |
+
wp_enqueue_style( 'yith-plugin-fw-fields' );
|
186 |
+
wp_enqueue_script( 'yith-plugin-fw-wp-pages' );
|
187 |
+
}
|
188 |
|
189 |
if ( ! self::$_panel_tabs_in_wp_pages ) {
|
190 |
self::$_panel_tabs_in_wp_pages = $current_tab_args;
|
191 |
+
if ( ! $is_block_editor ) {
|
192 |
+
add_action( 'all_admin_notices', array( $this, 'print_panel_tabs_in_wp_pages' ) );
|
193 |
+
add_action( 'admin_footer', array( $this, 'print_panel_tabs_in_wp_pages_end' ) );
|
194 |
+
}
|
195 |
add_filter( 'parent_file', array( $this, 'set_parent_file_to_handle_menu_for_wp_pages' ) );
|
196 |
add_filter( 'submenu_file', array( $this, 'set_submenu_file_to_handle_menu_for_wp_pages' ), 10, 2 );
|
197 |
}
|
258 |
* Add yith-plugin-fw-panel in body classes in Panel pages
|
259 |
*
|
260 |
* @param $admin_body_classes
|
261 |
+
*
|
262 |
* @return string
|
263 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
264 |
* @since 3.0.0
|
265 |
*/
|
266 |
public static function add_body_class( $admin_body_classes ) {
|
267 |
global $pagenow;
|
268 |
+
if ( ( 'admin.php' == $pagenow && strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false ) ) {
|
269 |
$admin_body_classes = substr_count( $admin_body_classes, ' yith-plugin-fw-panel ' ) == 0 ? $admin_body_classes . ' yith-plugin-fw-panel ' : $admin_body_classes;
|
270 |
+
}
|
271 |
|
272 |
return $admin_body_classes;
|
273 |
}
|
365 |
* a callback function called by Register Settings function
|
366 |
*
|
367 |
* @param $input
|
368 |
+
*
|
369 |
* @return array validate input fields
|
370 |
* @since 1.0
|
371 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
474 |
* Print the tabs navigation
|
475 |
*
|
476 |
* @param array $args
|
477 |
+
*
|
478 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
479 |
* @since 3.4.0
|
480 |
*/
|
536 |
* @param string $tab
|
537 |
* @param string $sub_tab
|
538 |
* @param string $parent_page
|
539 |
+
*
|
540 |
* @return string
|
541 |
*/
|
542 |
public function get_nav_url( $page, $tab, $sub_tab = '', $parent_page = '' ) {
|
561 |
* Print the Sub-tabs navigation if the current tab has sub-tabs
|
562 |
*
|
563 |
* @param array $args
|
564 |
+
*
|
565 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
566 |
* @since 3.4.0
|
567 |
*/
|
611 |
|
612 |
if ( $custom_tab_action ) {
|
613 |
$this->print_custom_tab( $custom_tab_action );
|
614 |
+
|
615 |
return;
|
616 |
}
|
617 |
|
627 |
<p> </p>
|
628 |
<?php settings_fields( 'yit_' . $this->settings['parent'] . '_options' ); ?>
|
629 |
<input type="hidden" name="<?php echo $this->get_name_field( 'option_key' ) ?>"
|
630 |
+
value="<?php echo esc_attr( $option_key ) ?>"/>
|
631 |
<input type="submit" class="button-primary"
|
632 |
+
value="<?php _e( 'Save Changes', 'yith-plugin-fw' ) ?>"
|
633 |
+
style="float:left;margin-right:10px;"/>
|
634 |
</form>
|
635 |
<form method="post">
|
636 |
<?php $warning = __( 'If you continue with this action, you will reset all options in this page.', 'yith-plugin-fw' ) ?>
|
637 |
<input type="hidden" name="yit-action" value="reset"/>
|
638 |
<input type="submit" name="yit-reset" class="button-secondary"
|
639 |
+
value="<?php _e( 'Reset to default', 'yith-plugin-fw' ) ?>"
|
640 |
+
onclick="return confirm('<?php echo $warning . '\n' . __( 'Are you sure?', 'yith-plugin-fw' ) ?>');"/>
|
641 |
</form>
|
642 |
<p> </p>
|
643 |
<?php endif ?>
|
652 |
*
|
653 |
* @param array $options
|
654 |
* @param string $option_key
|
655 |
+
*
|
656 |
* @return bool
|
657 |
*/
|
658 |
public function is_custom_tab( $options, $option_key ) {
|
671 |
$first = ! ! $tab_options && is_array( $tab_options ) ? current( $tab_options ) : array();
|
672 |
$type = isset( $first['type'] ) ? $first['type'] : 'options';
|
673 |
$special_types = array( 'post_type', 'taxonomy', 'custom_tab', 'multi_tab' );
|
674 |
+
|
675 |
return in_array( $type, $special_types ) ? $type : 'options';
|
676 |
}
|
677 |
|
692 |
* Fire the action to print the custom tab
|
693 |
*
|
694 |
* @param string $action Action to fire
|
695 |
+
*
|
696 |
* @return void
|
697 |
* @since 1.0
|
698 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
748 |
foreach ( $this->settings['admin-tabs'] as $item => $title ) {
|
749 |
|
750 |
$wp_admin_bar->add_menu( array(
|
751 |
+
'parent' => $this->settings['parent'],
|
752 |
+
'title' => $title,
|
753 |
+
'id' => $this->settings['parent'] . '-' . $item,
|
754 |
+
'href' => admin_url( 'themes.php' ) . '?page=' . $this->settings['parent_page'] . '&tab=' . $item,
|
755 |
+
) );
|
756 |
}
|
757 |
}
|
758 |
}
|
866 |
* @param $message
|
867 |
* @param string $type can be 'error' or 'updated'
|
868 |
* @param bool $echo
|
869 |
+
*
|
870 |
* @return string
|
871 |
* @since 1.0
|
872 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
895 |
|
896 |
$tabs = array();
|
897 |
|
898 |
+
foreach ( ( array ) glob( $option_files_path . '*.php' ) as $filename ) {
|
899 |
preg_match( '/(.*)-options\.(.*)/', basename( $filename ), $filename_parts );
|
900 |
|
901 |
if ( ! isset( $filename_parts[1] ) ) {
|
934 |
* Return the sub-tabs array of a specific tab
|
935 |
*
|
936 |
* @param array|bool $_tab the tab; if not set it'll be the current tab
|
937 |
+
*
|
938 |
* @since 3.4.0
|
939 |
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
940 |
* @return array sub-tabs array
|
957 |
if ( $_first && is_array( $_first ) && isset( $_first['type'] ) && 'multi_tab' === $_first['type'] && ! empty( $_first['sub-tabs'] ) ) {
|
958 |
return $_first['sub-tabs'];
|
959 |
}
|
960 |
+
|
961 |
return array();
|
962 |
}
|
963 |
|
1026 |
}
|
1027 |
}
|
1028 |
}
|
1029 |
+
|
1030 |
return '';
|
1031 |
}
|
1032 |
|
1035 |
* return the title of section
|
1036 |
*
|
1037 |
* @param $section
|
1038 |
+
*
|
1039 |
* @return string
|
1040 |
* @since 1.0
|
1041 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1049 |
return $option['name'];
|
1050 |
}
|
1051 |
}
|
1052 |
+
|
1053 |
return '';
|
1054 |
}
|
1055 |
|
1058 |
* return the description of section if is set
|
1059 |
*
|
1060 |
* @param $section
|
1061 |
+
*
|
1062 |
* @return string
|
1063 |
* @since 1.0
|
1064 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1072 |
return '<p>' . $option['desc'] . '</p>';
|
1073 |
}
|
1074 |
}
|
1075 |
+
|
1076 |
return '';
|
1077 |
}
|
1078 |
|
1108 |
* return a string with the name of the input field
|
1109 |
*
|
1110 |
* @param string $name
|
1111 |
+
*
|
1112 |
* @return string
|
1113 |
* @since 1.0
|
1114 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1122 |
* return a string with the id of the input field
|
1123 |
*
|
1124 |
* @param string $id
|
1125 |
+
*
|
1126 |
* @return string
|
1127 |
* @since 1.0
|
1128 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1138 |
* return a text area
|
1139 |
*
|
1140 |
* @param array $param
|
1141 |
+
*
|
1142 |
* @return void
|
1143 |
* @since 1.0
|
1144 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.it>
|
1161 |
$std = isset( $option['std'] ) ? $option['std'] : '';
|
1162 |
$db_value = ( isset( $db_options[ $option['id'] ] ) ) ? $db_options[ $option['id'] ] : $std;
|
1163 |
|
1164 |
+
if ( isset( $option['deps'] ) ) {
|
1165 |
$deps = $option['deps'];
|
1166 |
+
}
|
1167 |
|
1168 |
+
if ( 'on-off' === $option['type'] ) {
|
1169 |
$option['type'] = 'onoff';
|
1170 |
+
}
|
1171 |
|
1172 |
if ( $field_template_path = yith_plugin_fw_get_field_template_path( $option ) ) {
|
1173 |
$field_container_path = apply_filters( 'yith_plugin_fw_panel_field_container_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/panel/panel-field-container.php', $option );
|
1200 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1201 |
*
|
1202 |
* @param array $args
|
1203 |
+
*
|
1204 |
* @return void
|
1205 |
* @since 1.0
|
1206 |
* @author Emanuela Castorina <emanuela.castorina@yithemes.com>
|
1216 |
* Show a box panel with specific content in two columns as a new woocommerce type
|
1217 |
*
|
1218 |
* @param array $args
|
1219 |
+
*
|
1220 |
* @return void
|
1221 |
* @deprecated 3.0.12 Do nothing! Method left to prevent Fatal Error if called directly
|
1222 |
*/
|
1311 |
</div>
|
1312 |
<div class="yith-plugin-fw-rate">
|
1313 |
<?php printf( '<strong>%s</strong> %s <a href="%s" target="_blank"><u>%s</u> <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> %s',
|
1314 |
+
__( 'We need your support', 'yith-plugin-fw' ),
|
1315 |
+
__( 'to keep updating and improving the plugin. Please,', 'yith-plugin-fw' ),
|
1316 |
+
$rate_link,
|
1317 |
+
__( 'help us by leaving a five-star rating', 'yith-plugin-fw' ),
|
1318 |
+
__( ':) Thanks!', 'yith-plugin-fw' ) ) ?>
|
1319 |
</div>
|
1320 |
<?php else: ?>
|
1321 |
<h1 class="notice-container"></h1>
|
1401 |
public function maybe_redirect_to_proper_wp_page() {
|
1402 |
global $pagenow;
|
1403 |
if ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && $this->settings['page'] === $_GET['page'] &&
|
1404 |
+
! $this->is_custom_taxonomy_page() && ! $this->is_custom_post_type_page() && ! isset( $_REQUEST['yith-plugin-fw-panel-skip-redirect'] ) ) {
|
1405 |
$url = $this->get_nav_url( $this->settings['page'], $this->get_current_tab(), $this->get_current_sub_tab() );
|
1406 |
if ( strpos( $url, 'edit.php' ) !== false || strpos( $url, 'edit-tags.php' ) !== false ) {
|
1407 |
wp_safe_redirect( add_query_arg( array( 'yith-plugin-fw-panel-skip-redirect' => 1 ), $url ) );
|
1408 |
exit;
|
1409 |
}
|
1410 |
}
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
/**
|
1414 |
+
* Print the Panel tabs and sub-tabs navigation in WP pages
|
1415 |
+
* Important: this opens a wrapper <div> that will be closed through YIT_Plugin_Panel::print_panel_tabs_in_post_edit_page_end()
|
1416 |
+
*
|
1417 |
+
* @since 3.4.0
|
1418 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
1419 |
+
*/
|
1420 |
+
public function print_panel_tabs_in_wp_pages() {
|
1421 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1422 |
+
wp_enqueue_style( 'yit-plugin-style' );
|
1423 |
+
wp_enqueue_script( 'yit-plugin-panel' );
|
1424 |
+
|
1425 |
+
$wrap_class = isset( $this->settings['class'] ) ? $this->settings['class'] : '';
|
1426 |
+
|
1427 |
+
?>
|
1428 |
+
<div class="yith-plugin-fw-wp-page-wrapper">
|
1429 |
+
<?php
|
1430 |
+
echo "<div class='{$wrap_class}'>";
|
1431 |
+
$this->add_plugin_banner( $this->settings['page'] );
|
1432 |
+
$this->print_tabs_nav( self::$_panel_tabs_in_wp_pages );
|
1433 |
+
echo "</div>";
|
1434 |
+
}
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
|
1438 |
+
/**
|
1439 |
+
* Close the wrapper opened in YIT_Plugin_Panel::print_panel_tabs_in_wp_pages()
|
1440 |
+
*
|
1441 |
+
* @since 3.4.0
|
1442 |
+
* @author Leanza Francesco <leanzafrancesco@gmail.com>
|
1443 |
+
*/
|
1444 |
+
public function print_panel_tabs_in_wp_pages_end() {
|
1445 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1446 |
+
echo "</div><!-- /yith-plugin-fw-wp-page-wrapper -->";
|
1447 |
+
}
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
public function set_parent_file_to_handle_menu_for_wp_pages( $parent_file ) {
|
1451 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1452 |
+
return 'yith_plugin_panel';
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
return $parent_file;
|
1456 |
+
}
|
1457 |
+
|
1458 |
+
public function set_submenu_file_to_handle_menu_for_wp_pages( $submenu_file, $parent_file ) {
|
1459 |
+
if ( self::$_panel_tabs_in_wp_pages ) {
|
1460 |
+
return $this->settings['page'];
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
return $submenu_file;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
/**
|
1467 |
+
*
|
1468 |
+
*/
|
1469 |
+
public function save_toggle_element_options() {
|
1470 |
+
return true;
|
1471 |
+
}
|
1472 |
+
}
|
1473 |
}
|
plugin-fw/package.json
CHANGED
@@ -6,12 +6,18 @@
|
|
6 |
"scripts": {
|
7 |
"build": "npm run js && npm run i18n",
|
8 |
"js": "grunt js",
|
9 |
-
"i18n": "
|
|
|
|
|
|
|
|
|
|
|
10 |
},
|
11 |
"author": "YITH",
|
12 |
"license": "GPL-3.0+",
|
13 |
"keywords": [],
|
14 |
"devDependencies": {
|
|
|
15 |
"grunt": "^1.0.3",
|
16 |
"grunt-cli": "^1.3.2",
|
17 |
"grunt-contrib-jshint": "^2.0.0",
|
6 |
"scripts": {
|
7 |
"build": "npm run js && npm run i18n",
|
8 |
"js": "grunt js",
|
9 |
+
"i18n": "npm run -s i18n:build && npm run -s i18n:translations",
|
10 |
+
"i18n:build": "grunt makepot",
|
11 |
+
"i18n:translations": "npm run -s i18n:download-translations && npm run -s i18n:update-po && npm run -s i18n:clean",
|
12 |
+
"i18n:download-translations": "node ./bin/download-translations.js",
|
13 |
+
"i18n:update-po": "grunt update_po",
|
14 |
+
"i18n:clean": "node ./bin/clean-language-files.js"
|
15 |
},
|
16 |
"author": "YITH",
|
17 |
"license": "GPL-3.0+",
|
18 |
"keywords": [],
|
19 |
"devDependencies": {
|
20 |
+
"axios": "^0.19.2",
|
21 |
"grunt": "^1.0.3",
|
22 |
"grunt-cli": "^1.3.2",
|
23 |
"grunt-contrib-jshint": "^2.0.0",
|
plugin-fw/templates/fields/dimensions.php
CHANGED
@@ -57,25 +57,7 @@ if ( $allow_linked && 'yes' === $linked ) {
|
|
57 |
<?php echo $custom_attributes ?>
|
58 |
<?php echo isset( $data ) ? yith_plugin_fw_html_data_to_string( $data ) : ''; ?>
|
59 |
>
|
60 |
-
<div class="yith-plugin-fw-
|
61 |
-
<input class='yith-plugin-fw-dimensions__unit__value' type="hidden" name="<?php echo $name ?>[unit]" value="<?php echo isset( $value['unit'] ) ? $value['unit'] : current( array_keys( $units ) ) ?>">
|
62 |
-
<?php foreach ( $units as $key => $label ) : ?>
|
63 |
-
<?php
|
64 |
-
$key = sanitize_title( $key );
|
65 |
-
$classes = array(
|
66 |
-
'yith-plugin-fw-dimensions__unit',
|
67 |
-
"yith-plugin-fw-dimensions__unit--{$key}-unit",
|
68 |
-
);
|
69 |
-
if ( $unit_value === $key ) {
|
70 |
-
$classes[] = 'yith-plugin-fw-dimensions__unit--selected';
|
71 |
-
}
|
72 |
-
$classes = implode( ' ', $classes );
|
73 |
-
?>
|
74 |
-
<span class="<?php echo $classes; ?>" data-value="<?php echo $key; ?>"><?php echo $label; ?></span>
|
75 |
-
<?php endforeach ?>
|
76 |
-
</div>
|
77 |
-
|
78 |
-
<ul class="yith-plugin-fw-dimensions__dimensions">
|
79 |
<?php foreach ( $dimensions as $key => $dimension ) : ?>
|
80 |
<?php
|
81 |
$d_id = "{$id}-dimension-" . sanitize_title( $key );
|
@@ -104,20 +86,37 @@ if ( $allow_linked && 'yes' === $linked ) {
|
|
104 |
}
|
105 |
|
106 |
?>
|
107 |
-
<
|
|
|
108 |
<input id="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__number"
|
109 |
type="number" name="<?php echo $d_name; ?>" value="<?php echo $d_value; ?>"
|
110 |
<?php echo $d_attributes; ?>
|
111 |
>
|
112 |
-
|
113 |
-
</li>
|
114 |
<?php endforeach ?>
|
115 |
|
116 |
<?php if ( $allow_linked ): ?>
|
117 |
-
<
|
118 |
<input class='yith-plugin-fw-dimensions__linked__value' type="hidden" name="<?php echo $name ?>[linked]" value="<?php echo $linked ?>">
|
119 |
<span class="dashicons dashicons-admin-links"></span>
|
120 |
-
</
|
121 |
<?php endif; ?>
|
122 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
</div>
|
57 |
<?php echo $custom_attributes ?>
|
58 |
<?php echo isset( $data ) ? yith_plugin_fw_html_data_to_string( $data ) : ''; ?>
|
59 |
>
|
60 |
+
<div class="yith-plugin-fw-dimensions__dimensions">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
<?php foreach ( $dimensions as $key => $dimension ) : ?>
|
62 |
<?php
|
63 |
$d_id = "{$id}-dimension-" . sanitize_title( $key );
|
86 |
}
|
87 |
|
88 |
?>
|
89 |
+
<div class="yith-plugin-fw-dimensions__dimension yith-plugin-fw-dimensions__dimension--<?php echo sanitize_title( $key ); ?>">
|
90 |
+
<label for="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__label"><?php echo $d_label; ?></label>
|
91 |
<input id="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__number"
|
92 |
type="number" name="<?php echo $d_name; ?>" value="<?php echo $d_value; ?>"
|
93 |
<?php echo $d_attributes; ?>
|
94 |
>
|
95 |
+
</div>
|
|
|
96 |
<?php endforeach ?>
|
97 |
|
98 |
<?php if ( $allow_linked ): ?>
|
99 |
+
<div class="yith-plugin-fw-dimensions__linked" title="<?php _ex( 'Link values together', 'Tooltip in the "Dimensions" field', 'yith-plugin-fw' ); ?>">
|
100 |
<input class='yith-plugin-fw-dimensions__linked__value' type="hidden" name="<?php echo $name ?>[linked]" value="<?php echo $linked ?>">
|
101 |
<span class="dashicons dashicons-admin-links"></span>
|
102 |
+
</div>
|
103 |
<?php endif; ?>
|
104 |
+
</div>
|
105 |
+
<div class="yith-plugin-fw-dimensions__units">
|
106 |
+
<input class='yith-plugin-fw-dimensions__unit__value' type="hidden" name="<?php echo $name ?>[unit]" value="<?php echo isset( $value['unit'] ) ? $value['unit'] : current( array_keys( $units ) ) ?>">
|
107 |
+
<?php foreach ( $units as $key => $label ) : ?>
|
108 |
+
<?php
|
109 |
+
$key = sanitize_title( $key );
|
110 |
+
$classes = array(
|
111 |
+
'yith-plugin-fw-dimensions__unit',
|
112 |
+
"yith-plugin-fw-dimensions__unit--{$key}-unit",
|
113 |
+
);
|
114 |
+
if ( $unit_value === $key ) {
|
115 |
+
$classes[] = 'yith-plugin-fw-dimensions__unit--selected';
|
116 |
+
}
|
117 |
+
$classes = implode( ' ', $classes );
|
118 |
+
?>
|
119 |
+
<span class="<?php echo $classes; ?>" data-value="<?php echo $key; ?>"><?php echo $label; ?></span>
|
120 |
+
<?php endforeach ?>
|
121 |
+
</div>
|
122 |
</div>
|
plugin-fw/templates/sysinfo/system-information-panel.php
CHANGED
@@ -104,7 +104,7 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
104 |
<?php esc_html_e( 'Site URL', 'yith-plugin-fw' ); ?>
|
105 |
</th>
|
106 |
<td class="requirement-value">
|
107 |
-
<?php echo get_site_url(); ?>
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
@@ -112,7 +112,7 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
112 |
<?php esc_html_e( 'Output IP Address', 'yith-plugin-fw' ); ?>
|
113 |
</th>
|
114 |
<td class="requirement-value">
|
115 |
-
<?php echo $output_ip; ?>
|
116 |
</td>
|
117 |
</tr>
|
118 |
<tr>
|
@@ -123,6 +123,14 @@ if ( 'n/a' === $output_ip && function_exists( 'curl_init' ) && apply_filters( 'y
|
|
123 |
<?php echo( defined( 'WP_CACHE' ) && WP_CACHE ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
124 |
</td>
|
125 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
</table>
|
127 |
|
128 |
<table class="widefat striped">
|
104 |
<?php esc_html_e( 'Site URL', 'yith-plugin-fw' ); ?>
|
105 |
</th>
|
106 |
<td class="requirement-value">
|
107 |
+
<?php echo esc_attr( get_site_url() ); ?>
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
112 |
<?php esc_html_e( 'Output IP Address', 'yith-plugin-fw' ); ?>
|
113 |
</th>
|
114 |
<td class="requirement-value">
|
115 |
+
<?php echo esc_attr( $output_ip ); ?>
|
116 |
</td>
|
117 |
</tr>
|
118 |
<tr>
|
123 |
<?php echo( defined( 'WP_CACHE' ) && WP_CACHE ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
124 |
</td>
|
125 |
</tr>
|
126 |
+
<tr>
|
127 |
+
<th>
|
128 |
+
<?php esc_html_e( 'External object cache', 'yith-plugin-fw' ); ?>
|
129 |
+
</th>
|
130 |
+
<td class="requirement-value">
|
131 |
+
<?php echo( wp_using_ext_object_cache() ? esc_html__( 'Yes', 'yith-plugin-fw' ) : esc_html__( 'No', 'yith-plugin-fw' ) ); ?>
|
132 |
+
</td>
|
133 |
+
</tr>
|
134 |
</table>
|
135 |
|
136 |
<table class="widefat striped">
|