Version Description
- Released: Jan 28, 2019 = Update: Plugin Core 3.1.15
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Search |
Version | 1.6.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.6.3
- README.txt +4 -1
- init.php +2 -2
- plugin-fw/assets/js/multisite-updater.js +6 -2
- plugin-fw/assets/js/multisite-updater.min.js +4 -7
- plugin-fw/assets/js/yith-gutenberg.js +3 -1
- plugin-fw/assets/js/yith-gutenberg.min.js +6 -6
- plugin-fw/init.php +2 -2
- plugin-fw/lib/promo/yith-promo.php +25 -4
- plugin-fw/lib/yit-icons.php +4 -2
- plugin-fw/lib/yit-plugin-panel.php +6 -9
- plugin-fw/lib/yit-upgrade.php +67 -42
- plugin-fw/lib/yith-dashboard.php +74 -0
- plugin-fw/lib/yith-gutenberg.php +332 -320
- plugin-fw/licence/assets/css/yit-licence.css +22 -2
- plugin-fw/licence/lib/yit-licence.php +6 -12
- plugin-fw/licence/lib/yit-plugin-licence.php +1 -6
- plugin-fw/licence/templates/panel/activation/activation-panel.php +9 -4
- plugin-fw/templates/metaboxes/tab.php +7 -7
- plugin-fw/templates/panel/woocommerce/woocommerce-option-row.php +4 -1
- plugin-fw/yit-functions.php +18 -6
- plugin-fw/yit-plugin.php +1 -0
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -138,6 +138,9 @@ If you have created your own language pack for YITH WooCommerce Ajax Search, or
|
|
138 |
2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
|
139 |
|
140 |
== Changelog ==
|
|
|
|
|
|
|
141 |
= 1.6.2 - Released: Dec 05, 2018 =
|
142 |
New: Support to WordPress 5.0
|
143 |
Update: Language files
|
4 |
Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
|
5 |
Requires at least: 4.0.0
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 1.6.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
138 |
2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
|
139 |
|
140 |
== Changelog ==
|
141 |
+
= 1.6.3 - Released: Jan 28, 2019 =
|
142 |
+
Update: Plugin Core 3.1.15
|
143 |
+
|
144 |
= 1.6.2 - Released: Dec 05, 2018 =
|
145 |
New: Support to WordPress 5.0
|
146 |
Update: Language files
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
|
5 |
* Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 1.6.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-search
|
@@ -67,7 +67,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
|
67 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
68 |
return;
|
69 |
}else{
|
70 |
-
define( 'YITH_WCAS_VERSION', '1.6.
|
71 |
}
|
72 |
|
73 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
|
5 |
* Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 1.6.3
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-search
|
67 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
68 |
return;
|
69 |
}else{
|
70 |
+
define( 'YITH_WCAS_VERSION', '1.6.3' );
|
71 |
}
|
72 |
|
73 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
plugin-fw/assets/js/multisite-updater.js
CHANGED
@@ -43,7 +43,7 @@
|
|
43 |
var plugin = registered[ init ];
|
44 |
for ( var headers in plugin ) {
|
45 |
|
46 |
-
if ( headers == 'slug' || version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '
|
47 |
continue;
|
48 |
}
|
49 |
|
@@ -60,7 +60,7 @@
|
|
60 |
|
61 |
var html = '<tr class="plugin-update-tr">' +
|
62 |
'<td colspan="3" class="plugin-update colspanchange">' +
|
63 |
-
'<div class="update-message">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
|
64 |
'<a class="thickbox open-plugin-details-modal" href="' + localize.details_url[ init ] + '">' + localize.strings.latest.replace( '%latest%', plugin[ headers ].Latest ) + '</a>';
|
65 |
|
66 |
if ( typeof activated[ init ] == "undefined" ) {
|
@@ -73,6 +73,10 @@
|
|
73 |
'. <a href="' + localize.update_url[ init ] + '">' + localize.strings.update_now + '</a>';
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
76 |
html = html +
|
77 |
'</div>' +
|
78 |
'</td>' +
|
43 |
var plugin = registered[ init ];
|
44 |
for ( var headers in plugin ) {
|
45 |
|
46 |
+
if ( headers == 'slug' || version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '=' ) ) {
|
47 |
continue;
|
48 |
}
|
49 |
|
60 |
|
61 |
var html = '<tr class="plugin-update-tr">' +
|
62 |
'<td colspan="3" class="plugin-update colspanchange">' +
|
63 |
+
'<div class="update-message notice inline notice-warning notice-alt">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
|
64 |
'<a class="thickbox open-plugin-details-modal" href="' + localize.details_url[ init ] + '">' + localize.strings.latest.replace( '%latest%', plugin[ headers ].Latest ) + '</a>';
|
65 |
|
66 |
if ( typeof activated[ init ] == "undefined" ) {
|
73 |
'. <a href="' + localize.update_url[ init ] + '">' + localize.strings.update_now + '</a>';
|
74 |
}
|
75 |
|
76 |
+
if( version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '>' ) ){
|
77 |
+
html = html + localize.strings.version_issue
|
78 |
+
}
|
79 |
+
|
80 |
html = html +
|
81 |
'</div>' +
|
82 |
'</td>' +
|
plugin-fw/assets/js/multisite-updater.min.js
CHANGED
@@ -1,7 +1,4 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
a[c]<b[c]){g=-1;break}else if(a[c]>b[c]){g=1;break}if(!d)return g;switch(d){case ">":case "gt":return 0<g;case ">=":case "ge":return 0<=g;case "<=":case "le":return 0>=g;case "==":case "=":case "eq":return 0===g;case "<>":case "!=":case "ne":return 0!==g;case "":case "<":case "lt":return 0>g;default:return null}}var b=a("#menu-plugins"),d=b.find(".update-plugins").find(".update-count").text(),e=plugins.registered,h=plugins.activated;if(0==d||""==d)d=0,b.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
|
6 |
-
(function(b,d,e,c){for(var h in b){var g=b[h],k;for(k in g)if("slug"!=k&&!f(g[k].Version,g[k].Latest,">=")){e=parseInt(e)+1;a(".plugin-count").empty().html(e);var m=""+g[k].Name,n='*[data-slug="'+m.replace(/ /g,"-").trim().toLowerCase()+'"]';a(n).addClass("update");var l='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message">'+c.strings.new_version.replace("%plugin_name%",m)+'<a class="thickbox open-plugin-details-modal" href="'+c.details_url[h]+
|
7 |
-
'">'+c.strings.latest.replace("%latest%",g[k].Latest)+"</a>";l="undefined"==typeof d[h]?l+" <em>"+c.strings.unavailable+"</em>"+c.strings.activate.replace("%activate_link%",c.licence_activation_url).replace("%plugin_name%",m):l+'. <a href="'+c.update_url[h]+'">'+c.strings.update_now+"</a>";l+="</div></td></tr>";a(l).insertAfter(n)}}})(e,h,d,plugins);a("body").on("click",".yit-changelog-button",function(){a("#TB_window").remove()})})(jQuery);
|
1 |
+
(function(f){function n(c,d,f){this.php_js=this.php_js||{};this.php_js.ENV=this.php_js.ENV||{};var a=0,h=0,b=0,e={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1};a=function(a){a=(""+a).replace(/[_\-+]/g,".");a=a.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,".");return a.length?a.split("."):[-8]};numVersion=function(a){return a?isNaN(a)?e[a]||-7:parseInt(a,10):0};c=a(c);d=a(d);h=Math.max(c.length,d.length);for(a=0;a<h;a++)if(c[a]!=d[a])if(c[a]=numVersion(c[a]),d[a]=numVersion(d[a]),
|
2 |
+
c[a]<d[a]){b=-1;break}else if(c[a]>d[a]){b=1;break}if(!f)return b;switch(f){case ">":case "gt":return 0<b;case ">=":case "ge":return 0<=b;case "<=":case "le":return 0>=b;case "==":case "=":case "eq":return 0===b;case "<>":case "!=":case "ne":return 0!==b;case "":case "<":case "lt":return 0>b;default:return null}}var l=f("#menu-plugins"),g=l.find(".update-plugins").find(".update-count").text(),p=plugins.registered,q=plugins.activated;if(0==g||""==g)g=0,l.find(".wp-menu-name").append('<span class="update-plugins"><span class="plugin-count"></span></span>');
|
3 |
+
(function(c,d,g,a){for(var h in c){var b=c[h],e;for(e in b)if("slug"!=e&&!n(b[e].Version,b[e].Latest,"=")){g=parseInt(g)+1;f(".plugin-count").empty().html(g);var m=""+b[e].Name,l='*[data-slug="'+m.replace(RegExp(" ","g"),"-").trim().toLowerCase()+'"]';f(l).addClass("update");var k='<tr class="plugin-update-tr"><td colspan="3" class="plugin-update colspanchange"><div class="update-message notice inline notice-warning notice-alt">'+a.strings.new_version.replace("%plugin_name%",m)+'<a class="thickbox open-plugin-details-modal" href="'+
|
4 |
+
a.details_url[h]+'">'+a.strings.latest.replace("%latest%",b[e].Latest)+"</a>";k="undefined"==typeof d[h]?k+" <em>"+a.strings.unavailable+"</em>"+a.strings.activate.replace("%activate_link%",a.licence_activation_url).replace("%plugin_name%",m):k+'. <a href="'+a.update_url[h]+'">'+a.strings.update_now+"</a>";n(b[e].Version,b[e].Latest,">")&&(k+=a.strings.version_issue);k+="</div></td></tr>";f(k).insertAfter(l)}}})(p,q,g,plugins);f("body").on("click",".yit-changelog-button",function(){f("#TB_window").remove()})})(jQuery);
|
|
|
|
|
|
plugin-fw/assets/js/yith-gutenberg.js
CHANGED
@@ -62,6 +62,7 @@
|
|
62 |
if (callback == 'edit' && props.do_shortcode != false) {
|
63 |
do_shortcode = (function (block_id) {
|
64 |
var ajax_call_date = null;
|
|
|
65 |
$.ajax({
|
66 |
async: true,
|
67 |
url: yith_gutenberg_ajax.ajaxurl,
|
@@ -69,12 +70,13 @@
|
|
69 |
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
70 |
success: function (data) {
|
71 |
ajax_call_date = data;
|
72 |
-
|
73 |
if (ajax_call_date != '') {
|
74 |
$('.yith_block_' + block_id).html(ajax_call_date);
|
|
|
75 |
}
|
76 |
}
|
77 |
});
|
|
|
78 |
return ajax_call_date;
|
79 |
})(block_id);
|
80 |
}
|
62 |
if (callback == 'edit' && props.do_shortcode != false) {
|
63 |
do_shortcode = (function (block_id) {
|
64 |
var ajax_call_date = null;
|
65 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
66 |
$.ajax({
|
67 |
async: true,
|
68 |
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
71 |
success: function (data) {
|
72 |
ajax_call_date = data;
|
|
|
73 |
if (ajax_call_date != '') {
|
74 |
$('.yith_block_' + block_id).html(ajax_call_date);
|
75 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
76 |
}
|
77 |
}
|
78 |
});
|
79 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
80 |
return ajax_call_date;
|
81 |
})(block_id);
|
82 |
}
|
plugin-fw/assets/js/yith-gutenberg.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
1 |
+
(function(f){function k(e,a,d){var g="";g="";if("undefined"!=typeof a.callback&&"function"==typeof f[a.callback])g=f[a.callback](e,a);else{var b="["+a.shortcode_name;f.each(e.attributes,function(c,l){"className"!=c&&(b+=" "+c+"=",b=1==a.attributes[c].remove_quotes?b+l:b+('"'+l+'"'))});b+="]";e=md5(b);g='<span class="yith_block_'+e+'">'+b+"</span>";"edit"==d&&0!=a.do_shortcode&&function(c){var a=null;f(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",[b,c]);f.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,
|
2 |
+
method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:b},success:function(d){a=d;""!=a&&(f(".yith_block_"+c).html(a),f(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[b,c,a]))}});f(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[b,c,a]);return a}(e);g=h(n,null,g)}return g}function m(e,a,d,g){var b={};if("colorpicker"==g||"color"==g)e=e.hex;b[a]=e;d.setAttributes(b);return d}var h=wp.element.createElement,p=wp.element.Fragment,q=wp.blocks.registerBlockType,
|
3 |
+
r=wp.editor.InspectorControls,n=wp.element.RawHTML,t=wp.components.SelectControl,u=wp.components.ToggleControl,v=wp.components.CheckboxControl,w=wp.components.RangeControl,x=wp.components.ColorPicker,y=wp.components.RadioControl,z=wp.components.TextControl,A=wp.components.TextareaControl,B=h("svg",{width:22,height:22},h("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 |
+
f.each(yith_gutenberg,function(e,a){q("yith/"+e,{title:a.title,description:a.description,category:a.category,attributes:a.attributes,icon:"undefined"!=typeof a.icon?a.icon:B,keywords:a.keywords,edit:function(d){var g=[];f.each(a.attributes,function(a,c){var b=null,e=c.blocktype;if("undefined"!=typeof e){switch(e){case "select":b=t;break;case "text":b=z;break;case "textarea":b=A;break;case "toggle":b=u;break;case "checkbox":b=v;break;case "number":case "range":b=w;break;case "color":case "colorpicker":b=
|
5 |
+
x;break;case "radio":b=y}if(null!=b){var f=helpMessageUncheked="";"undefined"!=typeof c.helps&&"undefined"!=typeof c.helps.checked&&"undefined"!=typeof c.helps.unchecked?(f=c.helps.checked,helpMessageUncheked=c.helps.unchecked):"undefined"!=typeof c.help&&(f=helpMessageUncheked=c.help);g.push(h(b,{value:d.attributes[a],options:c.options,label:c.label,checked:d.attributes[a],selected:d.attributes[a],help:d.attributes[a]?f:helpMessageUncheked,disableAlpha:c.disableAlpha,min:c.min,max:c.max,multiple:c.multiple,
|
6 |
+
onChange:function(b,c){c=void 0===c?a:c;d=m(b,c,d,e)},onChangeComplete:function(c,b){b=void 0===b?a:b;d=m(c,b,d,e)}}))}}});sc=k(d,a,"edit");return[h(p,null,h(r,null,g),sc)]},save:function(d){return k(d,a,"save")}})})})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.1.
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
-
* @version 3.1.
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.1.15
|
5 |
* Author: YITHEMES
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
+
* @version 3.1.14
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
plugin-fw/lib/promo/yith-promo.php
CHANGED
@@ -17,7 +17,7 @@ add_action( 'admin_enqueue_scripts', 'yith_plugin_fw_notice_dismiss', 20 );
|
|
17 |
|
18 |
if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
19 |
function yith_plugin_fw_promo_notices(){
|
20 |
-
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url', 'https://update.yithemes.com/promo/hotlink-ok' );
|
21 |
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
|
22 |
$transient = "yith_promo_message";
|
23 |
$remote_data = get_site_transient( $transient );
|
@@ -38,7 +38,8 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
|
38 |
$license = YIT_Plugin_Licence()->get_licence();
|
39 |
$xml_expiry_date = '';
|
40 |
|
41 |
-
if( is_array( $license ) ){
|
|
|
42 |
foreach( $license as $plugin => $data ){
|
43 |
if( ! empty( $data['is_membership'] ) ){
|
44 |
$is_membership_user = true;
|
@@ -61,10 +62,30 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
|
61 |
$now = strtotime( current_time( 'mysql' ) );
|
62 |
|
63 |
foreach ($promo_data->promo as $promo ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
$start_date = isset( $promo->start_date ) ? $promo->start_date : '';
|
65 |
$end_date = isset( $promo->end_date ) ? $promo->end_date : '';
|
66 |
|
67 |
-
if( ! empty( $start_date ) && ! empty( $end_date ) ){
|
68 |
$start_date = strtotime( $start_date );
|
69 |
$end_date = strtotime( $end_date );
|
70 |
|
@@ -96,7 +117,7 @@ if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
|
96 |
|
97 |
if( ! empty( $title ) ) {
|
98 |
$promo_id .= $title;
|
99 |
-
$title = sprintf( '
|
100 |
$show_notice = true;
|
101 |
}
|
102 |
|
17 |
|
18 |
if( ! function_exists( 'yith_plugin_fw_promo_notices' ) ){
|
19 |
function yith_plugin_fw_promo_notices(){
|
20 |
+
$base_url = apply_filters( 'yith_plugin_fw_promo_base_url', 'https://update.yithemes.com/promo/hotlink-ok/' );
|
21 |
$xml = apply_filters( 'yith_plugin_fw_promo_xml_url', $base_url . 'yith-promo.xml' );
|
22 |
$transient = "yith_promo_message";
|
23 |
$remote_data = get_site_transient( $transient );
|
38 |
$license = YIT_Plugin_Licence()->get_licence();
|
39 |
$xml_expiry_date = '';
|
40 |
|
41 |
+
if( is_array( $license ) && apply_filters( 'yith_plugin_fw_check_for_membership_user', true ) ){
|
42 |
+
/* === Check is the user have the YITH Club === */
|
43 |
foreach( $license as $plugin => $data ){
|
44 |
if( ! empty( $data['is_membership'] ) ){
|
45 |
$is_membership_user = true;
|
62 |
$now = strtotime( current_time( 'mysql' ) );
|
63 |
|
64 |
foreach ($promo_data->promo as $promo ){
|
65 |
+
$show_promo = true;
|
66 |
+
/* === Check for Special Promo === */
|
67 |
+
if ( ! empty( $promo->show_promo_in ) ) {
|
68 |
+
$show_promo_in = explode( ',', $promo->show_promo_in );
|
69 |
+
$show_promo_in = array_map( 'trim', $show_promo_in );
|
70 |
+
if ( ! empty( $show_promo_in ) ) {
|
71 |
+
$show_promo = false;
|
72 |
+
foreach ( $show_promo_in as $plugin ) {
|
73 |
+
if ( defined( $plugin ) ) {
|
74 |
+
$plugin_slug = constant( $plugin );
|
75 |
+
$plugin_is_activated = ! empty( $license[ $plugin_slug ]['activated'] );
|
76 |
+
if ( defined( $plugin ) && ! apply_filters( 'yith_plugin_fw_promo_plugin_is_activated', $plugin_is_activated ) ) {
|
77 |
+
$show_promo = true;
|
78 |
+
break;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
$start_date = isset( $promo->start_date ) ? $promo->start_date : '';
|
86 |
$end_date = isset( $promo->end_date ) ? $promo->end_date : '';
|
87 |
|
88 |
+
if( $show_promo && ! empty( $start_date ) && ! empty( $end_date ) ){
|
89 |
$start_date = strtotime( $start_date );
|
90 |
$end_date = strtotime( $end_date );
|
91 |
|
117 |
|
118 |
if( ! empty( $title ) ) {
|
119 |
$promo_id .= $title;
|
120 |
+
$title = sprintf( '%s: ', $title );
|
121 |
$show_notice = true;
|
122 |
}
|
123 |
|
plugin-fw/lib/yit-icons.php
CHANGED
@@ -1136,8 +1136,10 @@ if ( !class_exists( 'YIT_Icons' ) ) {
|
|
1136 |
|
1137 |
}
|
1138 |
}
|
1139 |
-
|
1140 |
-
|
|
|
|
|
1141 |
}
|
1142 |
|
1143 |
YIT_Icons();
|
1136 |
|
1137 |
}
|
1138 |
}
|
1139 |
+
if( ! function_exists( 'YIT_Icons' ) ){
|
1140 |
+
function YIT_Icons() {
|
1141 |
+
return YIT_Icons::get_instance();
|
1142 |
+
}
|
1143 |
}
|
1144 |
|
1145 |
YIT_Icons();
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -328,22 +328,19 @@ if ( !class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
328 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
329 |
*/
|
330 |
public function add_premium_version_upgrade_to_menu() {
|
331 |
-
|
|
|
|
|
|
|
332 |
|
333 |
-
|
|
|
334 |
$submenu[ 'yith_plugin_panel' ][ 'how_to' ] = array(
|
335 |
sprintf( '%s%s%s', '<span id="yith-how-to-premium">', __( 'How to install premium version', 'yith-plugin-fw' ), '</span>' ),
|
336 |
'install_plugins',
|
337 |
'//support.yithemes.com/hc/en-us/articles/217840988',
|
338 |
__( 'How to install premium version', 'yith-plugin-fw' ),
|
339 |
);
|
340 |
-
|
341 |
-
$submenu[ 'yith_plugin_panel' ][ 'frequently_license_issues' ] = array(
|
342 |
-
sprintf( '%s%s%s', '<span id="yith-license-issues-premium">', __( 'Frequently license issues', 'yith-plugin-fw' ), '</span>' ),
|
343 |
-
'install_plugins',
|
344 |
-
'//support.yithemes.com/hc/en-us/articles/360012568594-License-activation-issues',
|
345 |
-
__( 'Frequently license issues', 'yith-plugin-fw' ),
|
346 |
-
);
|
347 |
}
|
348 |
}
|
349 |
|
328 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
329 |
*/
|
330 |
public function add_premium_version_upgrade_to_menu() {
|
331 |
+
/* === Add the How To menu item only if the customer haven't a premium version enabled === */
|
332 |
+
if( function_exists( 'YIT_Plugin_Licence' ) && ! empty( YIT_Plugin_Licence()->get_products() ) ){
|
333 |
+
return false;
|
334 |
+
}
|
335 |
|
336 |
+
global $submenu;
|
337 |
+
if ( apply_filters( 'yit_show_upgrade_to_premium_version', isset( $submenu[ 'yith_plugin_panel' ] ) ) ) {
|
338 |
$submenu[ 'yith_plugin_panel' ][ 'how_to' ] = array(
|
339 |
sprintf( '%s%s%s', '<span id="yith-how-to-premium">', __( 'How to install premium version', 'yith-plugin-fw' ), '</span>' ),
|
340 |
'install_plugins',
|
341 |
'//support.yithemes.com/hc/en-us/articles/217840988',
|
342 |
__( 'How to install premium version', 'yith-plugin-fw' ),
|
343 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
}
|
346 |
|
plugin-fw/lib/yit-upgrade.php
CHANGED
@@ -183,16 +183,22 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
183 |
*
|
184 |
* @since 1.0
|
185 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
|
|
186 |
*/
|
187 |
public function multisite_updater_script() {
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
|
193 |
-
'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
|
194 |
-
'update_now' => __( 'Update now.', 'yith-plugin-fw' )
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
);
|
197 |
|
198 |
foreach ( $this->_plugins as $init => $info ) {
|
@@ -209,14 +215,17 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
209 |
'strings' => $strings,
|
210 |
);
|
211 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
212 |
-
|
|
|
|
|
|
|
213 |
|
214 |
wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
|
215 |
}
|
216 |
|
217 |
public function admin_enqueue_scripts() {
|
218 |
global $pagenow;
|
219 |
-
if ( 'plugins.php' === $pagenow ) {
|
220 |
wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
|
221 |
}
|
222 |
}
|
@@ -236,6 +245,11 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
236 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
237 |
*/
|
238 |
public function upgrader_pre_download( $reply, $package, $upgrader ) {
|
|
|
|
|
|
|
|
|
|
|
239 |
$plugin = false;
|
240 |
$is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
|
241 |
$is_bulk_ajax = $upgrader->skin instanceof WP_Ajax_Upgrader_Skin;
|
@@ -286,7 +300,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
286 |
$product_id = $plugin_info['product_id'];
|
287 |
|
288 |
if( empty( $licence[ $product_id ] ) ){
|
289 |
-
return new WP_Error( 'license_not_valid',
|
290 |
}
|
291 |
|
292 |
$args = array(
|
@@ -315,7 +329,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
315 |
/**
|
316 |
* Regenerate update_plugins transient
|
317 |
*/
|
318 |
-
|
319 |
|
320 |
if ( is_wp_error( $download_file ) ) {
|
321 |
return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
|
@@ -325,7 +339,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
325 |
}
|
326 |
|
327 |
/**
|
328 |
-
*
|
329 |
*
|
330 |
* @param string $url The package url
|
331 |
* @param string $body The post data fields
|
@@ -411,6 +425,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
411 |
* @since 1.0
|
412 |
* @see update_plugins transient and pre_set_site_transient_update_plugins hooks
|
413 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
|
|
414 |
*/
|
415 |
public function force_regenerate_update_transient() {
|
416 |
delete_site_transient( 'update_plugins' );
|
@@ -442,8 +457,10 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
442 |
$plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
|
443 |
|
444 |
if ( $plugin_remote_info ) {
|
|
|
|
|
445 |
|
446 |
-
if (
|
447 |
|
448 |
$package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
|
449 |
|
@@ -517,42 +534,51 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
517 |
*/
|
518 |
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
|
519 |
|
520 |
-
|
521 |
-
|
522 |
-
$is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
|
523 |
|
524 |
-
|
525 |
|
526 |
-
|
527 |
|
528 |
-
|
529 |
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
|
538 |
-
}
|
539 |
|
540 |
-
|
|
|
|
|
541 |
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
*
|
546 |
-
* The dynamic portion of the hook name, `$theme_key`, refers to
|
547 |
-
* the theme slug as found in the WordPress.org themes repository.
|
548 |
-
*
|
549 |
-
* @since Wordpress 3.1.0
|
550 |
-
* }
|
551 |
-
*/
|
552 |
-
do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
|
553 |
|
554 |
-
|
|
|
555 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
}
|
557 |
|
558 |
/**
|
@@ -571,7 +597,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
571 |
foreach ( $this->_plugins as $init => $plugin ) {
|
572 |
remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
|
573 |
add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
|
574 |
-
//add_action( "in_theme_update_message-{$init}", array( $this, 'in_theme_update_message' ), 10, 3 );
|
575 |
}
|
576 |
}
|
577 |
|
183 |
*
|
184 |
* @since 1.0
|
185 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
186 |
+
* @return bool
|
187 |
*/
|
188 |
public function multisite_updater_script() {
|
189 |
+
/* === If class YIT_Plugin_Licence doesn't exists, no YITH plugins enabled === */
|
190 |
+
if( ! function_exists( 'YIT_Plugin_Licence' ) ){
|
191 |
+
return false;
|
192 |
+
}
|
|
|
|
|
|
|
193 |
|
194 |
+
$update_url = $changelogs = $details_url = array();
|
195 |
+
$strings = array(
|
196 |
+
'new_version' => __( 'There is a new version of %plugin_name% available.', 'yith-plugin-fw' ),
|
197 |
+
'latest' => __( 'View version %latest% details.', 'yith-plugin-fw' ),
|
198 |
+
'unavailable' => __( 'Automatic update is unavailable for this plugin,', 'yith-plugin-fw' ),
|
199 |
+
'activate' => __( 'please <a href="%activate_link%">activate</a> your copy of %plugin_name%.', 'yith-plugin-fw' ),
|
200 |
+
'update_now' => __( 'Update now.', 'yith-plugin-fw' ),
|
201 |
+
'version_issue' => __( '<br/><b>Please note:</b> You are using a higher version than the latest available one. </em>Please, make sure you\'ve downloaded the latest version of <em>%1$s</em> from the only <a href="https://yithemes.com" target="_blank">YITH official website</a>, specifically, from your <a href="https://yithemes.com/my-account/recent-downloads/" target="_blank">Downloads page</a>. This is the only way to be sure the version you are using is 100% malware-free.', 'yith-plugin-fw' ),
|
202 |
);
|
203 |
|
204 |
foreach ( $this->_plugins as $init => $info ) {
|
215 |
'strings' => $strings,
|
216 |
);
|
217 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
218 |
+
|
219 |
+
if( defined( 'YIT_CORE_PLUGIN_URL' ) ){
|
220 |
+
yit_enqueue_script( 'yit-multisite-updater', YIT_CORE_PLUGIN_URL . '/assets/js/multisite-updater' . $suffix . '.js', array( 'jquery' ), false, true );
|
221 |
+
}
|
222 |
|
223 |
wp_localize_script( 'yit-multisite-updater', 'plugins', $localize_script_args );
|
224 |
}
|
225 |
|
226 |
public function admin_enqueue_scripts() {
|
227 |
global $pagenow;
|
228 |
+
if ( 'plugins.php' === $pagenow && defined( 'YIT_CORE_PLUGIN_URL' ) ) {
|
229 |
wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
|
230 |
}
|
231 |
}
|
245 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
246 |
*/
|
247 |
public function upgrader_pre_download( $reply, $package, $upgrader ) {
|
248 |
+
/* === If class YIT_Plugin_Licence doesn't exists, no YITH plugins enabled === */
|
249 |
+
if( ! function_exists( 'YIT_Plugin_Licence' ) ){
|
250 |
+
return $reply;
|
251 |
+
}
|
252 |
+
|
253 |
$plugin = false;
|
254 |
$is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
|
255 |
$is_bulk_ajax = $upgrader->skin instanceof WP_Ajax_Upgrader_Skin;
|
300 |
$product_id = $plugin_info['product_id'];
|
301 |
|
302 |
if( empty( $licence[ $product_id ] ) ){
|
303 |
+
return new WP_Error( 'license_not_valid', _x( 'You have to activate the plugin to benefit from automatic updates.', '[Update Plugin Message: License not enabled]', 'yith-plugin-fw' ) );
|
304 |
}
|
305 |
|
306 |
$args = array(
|
329 |
/**
|
330 |
* Regenerate update_plugins transient
|
331 |
*/
|
332 |
+
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
333 |
|
334 |
if ( is_wp_error( $download_file ) ) {
|
335 |
return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
|
339 |
}
|
340 |
|
341 |
/**
|
342 |
+
* Retrieve the temp filename
|
343 |
*
|
344 |
* @param string $url The package url
|
345 |
* @param string $body The post data fields
|
425 |
* @since 1.0
|
426 |
* @see update_plugins transient and pre_set_site_transient_update_plugins hooks
|
427 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
428 |
+
* @deprecated From version 3.1.12
|
429 |
*/
|
430 |
public function force_regenerate_update_transient() {
|
431 |
delete_site_transient( 'update_plugins' );
|
457 |
$plugin_remote_info = @simplexml_load_string( $remote_xml['body'] );
|
458 |
|
459 |
if ( $plugin_remote_info ) {
|
460 |
+
$wrong_current_version_check = version_compare( $plugin['info']['Version'], $plugin_remote_info->latest, '>' );
|
461 |
+
$update_available = version_compare( $plugin_remote_info->latest, $plugin['info']['Version'], '>' );
|
462 |
|
463 |
+
if ( ( $update_available || $wrong_current_version_check ) && ! isset( $transient->response[ $init ] ) ) {
|
464 |
|
465 |
$package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
|
466 |
|
534 |
*/
|
535 |
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
|
536 |
|
537 |
+
global $wp_version;
|
538 |
+
$is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
|
|
|
539 |
|
540 |
+
echo '<tr class="plugin-update-tr active' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
|
541 |
|
542 |
+
echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
|
543 |
|
544 |
+
echo( $is_wp_4_6 ? '<p>' : '' );
|
545 |
|
546 |
+
if ( ! current_user_can( 'update_plugins' ) ) {
|
547 |
+
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
|
548 |
+
}
|
549 |
+
|
550 |
+
elseif ( is_plugin_active_for_network( $init ) ) {
|
551 |
+
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>You have to activate the plugin on a single site of the network to benefit from automatic updates.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version );
|
552 |
+
}
|
|
|
|
|
553 |
|
554 |
+
elseif ( empty( $r->package ) ) {
|
555 |
+
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin, please <a href="%5$s" title="License activation">activate</a> your copy of %6s.</em>', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
|
556 |
+
}
|
557 |
|
558 |
+
else {
|
559 |
+
printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox yit-changelog-button open-plugin-details-modal" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $init, 'upgrade-plugin_' . $init ) );
|
560 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
|
562 |
+
if( version_compare( $this->_plugins[ $init ]['info']['Version'] , $r->new_version, '>' ) ){
|
563 |
+
printf( __( '<br/><b>Please note:</b> You are using a higher version than the latest available one. </em>Please, make sure you\'ve downloaded the latest version of <em>%1$s</em> from the only <a href="https://yithemes.com" target="_blank">YITH official website</a>, specifically, from your <a href="https://yithemes.com/my-account/recent-downloads/" target="_blank">Downloads page</a>. This is the only way to be sure the version you are using is 100%% malware-free.', 'yith-plugin-fw' ), $this->_plugins[ $init ]['info']['Name'], esc_url( $details_url ), esc_attr( $this->_plugins[ $init ]['info']['Name'] ), $r->new_version, YIT_Plugin_Licence()->get_licence_activation_page_url(), $this->_plugins[ $init ]['info']['Name'] );
|
564 |
}
|
565 |
+
|
566 |
+
|
567 |
+
echo( $is_wp_4_6 ? '</p>' : '' );
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Fires at the end of the update message container in each
|
571 |
+
* row of the themes list table.
|
572 |
+
*
|
573 |
+
* The dynamic portion of the hook name, `$theme_key`, refers to
|
574 |
+
* the theme slug as found in the WordPress.org themes repository.
|
575 |
+
*
|
576 |
+
* @since Wordpress 3.1.0
|
577 |
+
* }
|
578 |
+
*/
|
579 |
+
do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
|
580 |
+
|
581 |
+
echo '</div></td></tr>';
|
582 |
}
|
583 |
|
584 |
/**
|
597 |
foreach ( $this->_plugins as $init => $plugin ) {
|
598 |
remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
|
599 |
add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
|
|
|
600 |
}
|
601 |
}
|
602 |
|
plugin-fw/lib/yith-dashboard.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* YITH
|
4 |
+
*
|
5 |
+
* @package WordPress
|
6 |
+
* @subpackage YITH
|
7 |
+
* @author YITH <plugins@yithemes.com>
|
8 |
+
*
|
9 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
10 |
+
* that is bundled with this package in the file LICENSE.txt.
|
11 |
+
* It is also available through the world-wide-web at this URL:
|
12 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
+
*/
|
14 |
+
|
15 |
+
if( ! class_exists( 'YITH_Dashboard' ) ){
|
16 |
+
/**
|
17 |
+
* Wordpress Admin Dashboard Management
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*/
|
21 |
+
class YITH_Dashboard {
|
22 |
+
/**
|
23 |
+
* Products URL
|
24 |
+
*
|
25 |
+
* @var string
|
26 |
+
* @access protected
|
27 |
+
* @since 1.0.0
|
28 |
+
*/
|
29 |
+
static protected $_products_feed = 'https://yithemes.com/feed/?post_type=product';
|
30 |
+
static protected $_blog_feed = 'https://yithemes.com/feed/';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Dashboard widget setup
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
* @since 1.0.0
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
public static function dashboard_widget_setup() {
|
40 |
+
wp_add_dashboard_widget( 'yith_dashboard_products_news', __( 'New YITH products' , 'yith-plugin-fw' ), 'YITH_Dashboard::dashboard_products_news' );
|
41 |
+
wp_add_dashboard_widget( 'yith_dashboard_blog_news', __( 'News from the YITH Blog' , 'yith-plugin-fw' ), 'YITH_Dashboard::dashboard_blog_news' );
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Product news Widget
|
47 |
+
*
|
48 |
+
* @return void
|
49 |
+
* @since 1.0.0
|
50 |
+
* @access public
|
51 |
+
*/
|
52 |
+
public static function dashboard_products_news() {
|
53 |
+
$args = array( 'show_author' => 0, 'show_date' => 1, 'show_summary' => 1, 'items'=> 3 );
|
54 |
+
wp_widget_rss_output( static::$_products_feed, $args );
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Blog news Widget
|
60 |
+
*
|
61 |
+
* @return void
|
62 |
+
* @since 1.0.0
|
63 |
+
* @access public
|
64 |
+
*/
|
65 |
+
public static function dashboard_blog_news() {
|
66 |
+
$args = array( 'show_author' => 0, 'show_date' => 1, 'show_summary' => 1, 'items'=> 3 );
|
67 |
+
wp_widget_rss_output( static::$_blog_feed, $args );
|
68 |
+
}
|
69 |
+
}
|
70 |
+
if( apply_filters( 'yith_plugin_fw_show_dashboard_widgets', true ) ){
|
71 |
+
add_action( 'wp_dashboard_setup', 'YITH_Dashboard::dashboard_widget_setup' );
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
plugin-fw/lib/yith-gutenberg.php
CHANGED
@@ -1,321 +1,333 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* This file belongs to the YIT Framework.
|
4 |
-
*
|
5 |
-
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
-
* that is bundled with this package in the file LICENSE.txt.
|
7 |
-
* It is also available through the world-wide-web at this URL:
|
8 |
-
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Text Domain: yith-plugin-fw
|
13 |
-
*/
|
14 |
-
|
15 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
16 |
-
exit;
|
17 |
-
} // Exit if accessed directly
|
18 |
-
|
19 |
-
if( ! class_exists( 'YITH_Gutenberg' ) ){
|
20 |
-
|
21 |
-
class YITH_Gutenberg{
|
22 |
-
/**
|
23 |
-
* @var array Registered blocks
|
24 |
-
*/
|
25 |
-
private $_registered_blocks = array();
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var array Blocks to register
|
29 |
-
*/
|
30 |
-
private $_to_register_blocks = array();
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var array Blocks args
|
34 |
-
*/
|
35 |
-
private $_blocks_args = array();
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var string Block category slug
|
39 |
-
*/
|
40 |
-
private $_category_slug = 'yith-blocks';
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var YIT_Upgrade The main instance
|
44 |
-
*/
|
45 |
-
protected static $_instance;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Main plugin Instance
|
49 |
-
*
|
50 |
-
* @static
|
51 |
-
* @return object Main instance
|
52 |
-
*
|
53 |
-
* @since 1.0
|
54 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
55 |
-
*/
|
56 |
-
public static function instance() {
|
57 |
-
if ( is_null( self::$_instance ) ) {
|
58 |
-
self::$_instance = new self();
|
59 |
-
}
|
60 |
-
|
61 |
-
return self::$_instance;
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* YITH_Gutenberg constructor.
|
66 |
-
*/
|
67 |
-
private function __construct() {
|
68 |
-
add_action( 'init', array( $this, 'register_blocks' ), 30 );
|
69 |
-
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
|
70 |
-
add_action( 'wp_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
|
71 |
-
add_action( 'wc_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Enqueue scripts for gutenberg
|
76 |
-
*/
|
77 |
-
public function enqueue_block_editor_assets() {
|
78 |
-
$ajax_url = function_exists( 'WC' ) ? add_query_arg( 'wc-ajax', 'yith_plugin_fw_gutenberg_do_shortcode', trailingslashit( site_url() ) ) : admin_url( 'admin-ajax.php' );
|
79 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
80 |
-
$deps = apply_filters( 'yith_plugin_fw_gutenberg_script_deps', array(
|
81 |
-
'wp-blocks',
|
82 |
-
'wp-element',
|
83 |
-
'yith-js-md5'
|
84 |
-
) );
|
85 |
-
wp_register_script( 'yith-js-md5', YIT_CORE_PLUGIN_URL . '/assets/js/javascript-md5/md5.min.js', array(), '2.10.0', true );
|
86 |
-
wp_enqueue_script( 'yith-gutenberg', YIT_CORE_PLUGIN_URL . '/assets/js/yith-gutenberg' . $suffix . '.js', $deps, yith_plugin_fw_get_version(), true );
|
87 |
-
wp_localize_script( 'yith-gutenberg', 'yith_gutenberg', $this->_blocks_args );
|
88 |
-
wp_localize_script( 'yith-gutenberg', 'yith_gutenberg_ajax', array( 'ajaxurl' => $ajax_url ) );
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Add blocks to gutenberg editor
|
93 |
-
*
|
94 |
-
* @return void
|
95 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
96 |
-
*/
|
97 |
-
public function register_blocks(){
|
98 |
-
|
99 |
-
|
100 |
-
if(
|
101 |
-
$
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
*
|
167 |
-
*
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
*
|
176 |
-
*
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
*
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
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 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
case '
|
261 |
-
|
262 |
-
|
263 |
-
$args[ $block ]['attributes'][ $attr_name ]['
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
break;
|
270 |
-
|
271 |
-
case '
|
272 |
-
case '
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
YITH_Gutenberg();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file belongs to the YIT Framework.
|
4 |
+
*
|
5 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
+
* that is bundled with this package in the file LICENSE.txt.
|
7 |
+
* It is also available through the world-wide-web at this URL:
|
8 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Text Domain: yith-plugin-fw
|
13 |
+
*/
|
14 |
+
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
16 |
+
exit;
|
17 |
+
} // Exit if accessed directly
|
18 |
+
|
19 |
+
if( ! class_exists( 'YITH_Gutenberg' ) ){
|
20 |
+
|
21 |
+
class YITH_Gutenberg{
|
22 |
+
/**
|
23 |
+
* @var array Registered blocks
|
24 |
+
*/
|
25 |
+
private $_registered_blocks = array();
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var array Blocks to register
|
29 |
+
*/
|
30 |
+
private $_to_register_blocks = array();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array Blocks args
|
34 |
+
*/
|
35 |
+
private $_blocks_args = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string Block category slug
|
39 |
+
*/
|
40 |
+
private $_category_slug = 'yith-blocks';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var YIT_Upgrade The main instance
|
44 |
+
*/
|
45 |
+
protected static $_instance;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Main plugin Instance
|
49 |
+
*
|
50 |
+
* @static
|
51 |
+
* @return object Main instance
|
52 |
+
*
|
53 |
+
* @since 1.0
|
54 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
55 |
+
*/
|
56 |
+
public static function instance() {
|
57 |
+
if ( is_null( self::$_instance ) ) {
|
58 |
+
self::$_instance = new self();
|
59 |
+
}
|
60 |
+
|
61 |
+
return self::$_instance;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* YITH_Gutenberg constructor.
|
66 |
+
*/
|
67 |
+
private function __construct() {
|
68 |
+
add_action( 'init', array( $this, 'register_blocks' ), 30 );
|
69 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
|
70 |
+
add_action( 'wp_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
|
71 |
+
add_action( 'wc_ajax_yith_plugin_fw_gutenberg_do_shortcode', array( $this, 'do_shortcode' ) );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Enqueue scripts for gutenberg
|
76 |
+
*/
|
77 |
+
public function enqueue_block_editor_assets() {
|
78 |
+
$ajax_url = function_exists( 'WC' ) ? add_query_arg( 'wc-ajax', 'yith_plugin_fw_gutenberg_do_shortcode', trailingslashit( site_url() ) ) : admin_url( 'admin-ajax.php' );
|
79 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
80 |
+
$deps = apply_filters( 'yith_plugin_fw_gutenberg_script_deps', array(
|
81 |
+
'wp-blocks',
|
82 |
+
'wp-element',
|
83 |
+
'yith-js-md5'
|
84 |
+
) );
|
85 |
+
wp_register_script( 'yith-js-md5', YIT_CORE_PLUGIN_URL . '/assets/js/javascript-md5/md5.min.js', array(), '2.10.0', true );
|
86 |
+
wp_enqueue_script( 'yith-gutenberg', YIT_CORE_PLUGIN_URL . '/assets/js/yith-gutenberg' . $suffix . '.js', $deps, yith_plugin_fw_get_version(), true );
|
87 |
+
wp_localize_script( 'yith-gutenberg', 'yith_gutenberg', $this->_blocks_args );
|
88 |
+
wp_localize_script( 'yith-gutenberg', 'yith_gutenberg_ajax', array( 'ajaxurl' => $ajax_url ) );
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Add blocks to gutenberg editor
|
93 |
+
*
|
94 |
+
* @return void
|
95 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
96 |
+
*/
|
97 |
+
public function register_blocks(){
|
98 |
+
$block_args = array();
|
99 |
+
foreach ( $this->_to_register_blocks as $block => $args ){
|
100 |
+
if( isset( $args['style'] ) ){
|
101 |
+
$block_args['style'] = $args['style'];
|
102 |
+
}
|
103 |
+
|
104 |
+
if( isset( $args['script'] ) ){
|
105 |
+
$block_args['script'] = $args['script'];
|
106 |
+
}
|
107 |
+
|
108 |
+
if( register_block_type( "yith/{$block}", $block_args ) ){
|
109 |
+
$this->_registered_blocks[] = $block;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
if( ! empty( $this->_registered_blocks ) ){
|
114 |
+
add_filter( 'block_categories', array( $this, 'block_category' ), 10, 2 );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Add block category
|
120 |
+
*
|
121 |
+
* @param $categories array block categories array
|
122 |
+
* @param $post WP_Post current post
|
123 |
+
*
|
124 |
+
* @return array block categories
|
125 |
+
*
|
126 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
127 |
+
*/
|
128 |
+
public function block_category( $categories, $post ){
|
129 |
+
return array_merge(
|
130 |
+
$categories,
|
131 |
+
array(
|
132 |
+
array(
|
133 |
+
'slug' => 'yith-blocks',
|
134 |
+
'title' => _x( 'YITH', '[gutenberg]: Category Name', 'yith-plugin-fw' ),
|
135 |
+
),
|
136 |
+
)
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Add new blocks to Gutenberg
|
142 |
+
*
|
143 |
+
* @param $blocks string|array new blocks
|
144 |
+
* @return bool true if add a new blocks, false otherwise
|
145 |
+
*
|
146 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
147 |
+
*/
|
148 |
+
public function add_blocks( $blocks ){
|
149 |
+
$added = false;
|
150 |
+
if( ! empty( $blocks ) ){
|
151 |
+
$added = true;
|
152 |
+
if( is_array( $blocks ) ){
|
153 |
+
$this->_to_register_blocks = array_merge( $this->_to_register_blocks, $blocks );
|
154 |
+
}
|
155 |
+
|
156 |
+
else {
|
157 |
+
$this->_to_register_blocks[] = $blocks;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
return $added;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Return an array with the registered blocks
|
166 |
+
*
|
167 |
+
* @return array
|
168 |
+
*/
|
169 |
+
public function get_registered_blocks(){
|
170 |
+
return $this->_registered_blocks;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Return an array with the blocks to register
|
175 |
+
*
|
176 |
+
* @return array
|
177 |
+
*/
|
178 |
+
public function get_to_register_blocks(){
|
179 |
+
return $this->_to_register_blocks;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Return an array with the block(s) arguments
|
184 |
+
*
|
185 |
+
* @return array
|
186 |
+
*/
|
187 |
+
public function get_block_args( $block = 'all' ){
|
188 |
+
if( 'all' == $block ){
|
189 |
+
return $this->_blocks_args;
|
190 |
+
}
|
191 |
+
|
192 |
+
elseif( isset( $this->_blocks_args[ $block ] ) ){
|
193 |
+
return $this->_blocks_args[ $block ];
|
194 |
+
}
|
195 |
+
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* @return string Default block cateogyr slug
|
201 |
+
*/
|
202 |
+
public function get_default_blocks_category_slug(){
|
203 |
+
return $this->_category_slug;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Set the block arguments
|
208 |
+
*
|
209 |
+
* @param $args array The block argument
|
210 |
+
*/
|
211 |
+
public function set_block_args( $args ){
|
212 |
+
foreach( $args as $block => $block_args ){
|
213 |
+
|
214 |
+
/* === Add Default Keywords === */
|
215 |
+
$default_keywords = array( 'yith' );
|
216 |
+
if( ! empty( $block_args['shortcode_name'] ) ){
|
217 |
+
$default_keywords[] = $block_args['shortcode_name'];
|
218 |
+
}
|
219 |
+
|
220 |
+
$args[ $block ]['keywords'] = ! empty( $args[ $block ]['keywords'] ) ? array_merge( $args[ $block ]['keywords'], $default_keywords ) : $default_keywords;
|
221 |
+
|
222 |
+
if( count( $args[ $block ]['keywords'] ) > 3 ){
|
223 |
+
$args[ $block ]['keywords'] = array_slice($args[ $block ]['keywords'], 0, 3);
|
224 |
+
}
|
225 |
+
|
226 |
+
if( empty( $block_args['category'] ) ){
|
227 |
+
//Add YITH block category
|
228 |
+
$args[ $block ]['category'] = $this->get_default_blocks_category_slug();
|
229 |
+
}
|
230 |
+
|
231 |
+
if( isset( $block_args['attributes'] ) ){
|
232 |
+
foreach( $block_args['attributes'] as $attr_name => $attributes ){
|
233 |
+
// Set the do_shortcode args
|
234 |
+
if( ! empty( $attributes['do_shortcode'] ) ){
|
235 |
+
$args[ $block ]['attributes'][ $attr_name ] = true;
|
236 |
+
}
|
237 |
+
|
238 |
+
if( ! empty( $attributes['options'] ) && is_array( $attributes['options'] ) ){
|
239 |
+
$options = array();
|
240 |
+
foreach( $attributes['options'] AS $v => $l ){
|
241 |
+
//Prepare options array for react component
|
242 |
+
$options[] = array(
|
243 |
+
'label' => $l,
|
244 |
+
'value' => $v,
|
245 |
+
);
|
246 |
+
}
|
247 |
+
$args[ $block ]['attributes'][ $attr_name ]['options'] = $options;
|
248 |
+
}
|
249 |
+
|
250 |
+
if( empty( $attributes['remove_quotes'] ) ){
|
251 |
+
$args[ $block ]['attributes'][ $attr_name ]['remove_quotes'] = false;
|
252 |
+
}
|
253 |
+
|
254 |
+
/* === Special Requirements for Block Type === */
|
255 |
+
if( ! empty( $attributes['type'] ) ) {
|
256 |
+
$args[ $block ]['attributes'][ $attr_name ]['blocktype'] = $attributes['type'];
|
257 |
+
$args[ $block ]['attributes'][ $attr_name ]['type'] = 'string';
|
258 |
+
|
259 |
+
switch( $attributes['type'] ){
|
260 |
+
case 'select':
|
261 |
+
//Add default value for multiple
|
262 |
+
if( ! isset( $attributes['multiple'] ) ) {
|
263 |
+
$args[ $block ]['attributes'][ $attr_name ]['multiple'] = false;
|
264 |
+
}
|
265 |
+
|
266 |
+
if( ! empty( $attributes['multiple'] ) ){
|
267 |
+
$args[ $block ]['attributes'][ $attr_name ]['type'] = 'array';
|
268 |
+
}
|
269 |
+
break;
|
270 |
+
|
271 |
+
case 'color':
|
272 |
+
case 'colorpicker':
|
273 |
+
if( ! isset( $attributes['disableAlpha'] ) ){
|
274 |
+
//Disable alpha gradient for color picker
|
275 |
+
$args[ $block ]['attributes'][ $attr_name ]['disableAlpha'] = true;
|
276 |
+
}
|
277 |
+
break;
|
278 |
+
|
279 |
+
case 'number':
|
280 |
+
$args[ $block ]['attributes'][ $attr_name ]['type'] = 'integer';
|
281 |
+
break;
|
282 |
+
|
283 |
+
case 'toggle':
|
284 |
+
case 'checkbox':
|
285 |
+
$args[ $block ]['attributes'][ $attr_name ]['type'] = 'boolean';
|
286 |
+
break;
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
$this->_blocks_args = array_merge( $this->_blocks_args, $args );
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Get a do_shortcode in ajax call to show block preview
|
298 |
+
*
|
299 |
+
* @param $args array The block argument
|
300 |
+
*/
|
301 |
+
public function do_shortcode(){
|
302 |
+
$current_action = current_action();
|
303 |
+
$sc = ! empty( $_POST['shortcode'] ) ? $_POST['shortcode'] : '';
|
304 |
+
|
305 |
+
if( ! apply_filters( 'yith_plugin_fw_gutenberg_skip_shortcode_sanitize', false ) ){
|
306 |
+
$sc = sanitize_text_field( stripslashes( $sc ) );
|
307 |
+
}
|
308 |
+
|
309 |
+
do_action( 'yith_plugin_fw_gutenberg_before_do_shortcode', $sc, $current_action );
|
310 |
+
echo do_shortcode( apply_filters( 'yith_plugin_fw_gutenberg_shortcode', $sc, $current_action ) );
|
311 |
+
do_action( 'yith_plugin_fw_gutenberg_after_do_shortcode', $sc, $current_action );
|
312 |
+
|
313 |
+
if( is_ajax() ){
|
314 |
+
die();
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
if ( ! function_exists( 'YITH_Gutenberg' ) ) {
|
321 |
+
/**
|
322 |
+
* Main instance of plugin
|
323 |
+
*
|
324 |
+
* @return YITH_Gutenberg
|
325 |
+
* @since 1.0
|
326 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
327 |
+
*/
|
328 |
+
function YITH_Gutenberg() {
|
329 |
+
return YITH_Gutenberg::instance();
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
YITH_Gutenberg();
|
plugin-fw/licence/assets/css/yit-licence.css
CHANGED
@@ -134,13 +134,17 @@
|
|
134 |
}
|
135 |
|
136 |
.yit-container.product-licence-activation .licence-check-section{
|
137 |
-
margin-bottom:
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
.yit-container.product-licence-activation span.licence-label {
|
141 |
font-weight: 500;
|
142 |
color: #606060;
|
143 |
-
margin-bottom:
|
144 |
}
|
145 |
|
146 |
.yit-container.product-licence-activation .button-licence {
|
@@ -214,6 +218,11 @@
|
|
214 |
border-right: 1px solid #dcdcdc;
|
215 |
}
|
216 |
|
|
|
|
|
|
|
|
|
|
|
217 |
.yit-container.product-licence-activation table td:last-child,
|
218 |
.yit-container.product-licence-activation table th:last-child {
|
219 |
border-right: 0;
|
@@ -354,12 +363,23 @@
|
|
354 |
margin-left: 0;
|
355 |
visibility: hidden;
|
356 |
min-height: 38px;
|
|
|
357 |
}
|
358 |
|
359 |
#yith-licence-notice.visible {
|
360 |
visibility: visible;
|
361 |
}
|
362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
/* === Responsive === */
|
364 |
|
365 |
@media (max-width: 767px) {
|
134 |
}
|
135 |
|
136 |
.yit-container.product-licence-activation .licence-check-section{
|
137 |
+
margin-bottom: 20px;
|
138 |
+
margin-top: 20px;
|
139 |
+
background-color: #ffffff;
|
140 |
+
padding: 10px;
|
141 |
+
max-width: 670px;
|
142 |
}
|
143 |
|
144 |
.yit-container.product-licence-activation span.licence-label {
|
145 |
font-weight: 500;
|
146 |
color: #606060;
|
147 |
+
margin-bottom: 20px;
|
148 |
}
|
149 |
|
150 |
.yit-container.product-licence-activation .button-licence {
|
218 |
border-right: 1px solid #dcdcdc;
|
219 |
}
|
220 |
|
221 |
+
.yit-container.product-licence-activation table:not(.to-active-table) th{
|
222 |
+
color: #808a97;
|
223 |
+
font-weight: bold;
|
224 |
+
}
|
225 |
+
|
226 |
.yit-container.product-licence-activation table td:last-child,
|
227 |
.yit-container.product-licence-activation table th:last-child {
|
228 |
border-right: 0;
|
363 |
margin-left: 0;
|
364 |
visibility: hidden;
|
365 |
min-height: 38px;
|
366 |
+
max-width: 660px;
|
367 |
}
|
368 |
|
369 |
#yith-licence-notice.visible {
|
370 |
visibility: visible;
|
371 |
}
|
372 |
|
373 |
+
#yith-licence-issue-how-to{
|
374 |
+
margin: 20px 10px 20px 0;
|
375 |
+
font-weight: 500;
|
376 |
+
color: #606060;
|
377 |
+
}
|
378 |
+
|
379 |
+
#yith-licence-actions span.dashicons{
|
380 |
+
line-height: 60px;
|
381 |
+
}
|
382 |
+
|
383 |
/* === Responsive === */
|
384 |
|
385 |
@media (max-width: 767px) {
|
plugin-fw/licence/lib/yit-licence.php
CHANGED
@@ -87,15 +87,9 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
87 |
//show extra info and renew button in debug mode
|
88 |
$this->show_extra_info = $this->show_renew_button = true;
|
89 |
} else {
|
90 |
-
$this->show_extra_info = defined( 'YIT_SHOW_EXTRA_LICENCE_INFO' ) && YIT_SHOW_EXTRA_LICENCE_INFO;
|
91 |
$this->show_renew_button = !( defined( 'YIT_HIDE_LICENCE_RENEW_BUTTON' ) && YIT_HIDE_LICENCE_RENEW_BUTTON );
|
92 |
}
|
93 |
-
|
94 |
-
/* Update Licence Information */
|
95 |
-
//@TODO: Removed for performance
|
96 |
-
// add_action( 'core_upgrade_preamble', array( $this, 'check_all' ) );
|
97 |
-
// add_action( 'wp_maybe_auto_update', array( $this, 'check_all' ) );
|
98 |
-
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -258,7 +252,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
258 |
update_option( $this->_licence_option, $options );
|
259 |
|
260 |
/* === Update Plugin Licence Information === */
|
261 |
-
|
262 |
|
263 |
/* === Licence Activation Template === */
|
264 |
$body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
|
@@ -328,7 +322,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
328 |
$options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
|
329 |
|
330 |
/* === Update Plugin Licence Information === */
|
331 |
-
|
332 |
|
333 |
update_option( $this->_licence_option, $options );
|
334 |
|
@@ -493,7 +487,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
493 |
|
494 |
/* === Update Plugin Licence Information === */
|
495 |
if ( $regenerate_transient ) {
|
496 |
-
|
497 |
}
|
498 |
}
|
499 |
|
@@ -531,7 +525,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
531 |
$this->check_all();
|
532 |
|
533 |
/* === Regenerate Update Plugins Transient === */
|
534 |
-
|
535 |
|
536 |
do_action( 'yit_licence_after_check' );
|
537 |
|
@@ -743,7 +737,7 @@ if ( !class_exists( 'YIT_Licence' ) ) {
|
|
743 |
'107' => __( 'License key has been banned', 'yith-plugin-fw' ),
|
744 |
'108' => __( 'Current product is not included in your YITH Club Subscription key', 'yith-plugin-fw' ),
|
745 |
'200' => sprintf( '<strong>%s</strong>! %s', __( 'Great', 'yith-plugin-fw' ), __( 'License successfully activated', 'yith-plugin-fw' ) ),
|
746 |
-
'deactivated' => sprintf( '%s <strong>%s</strong>', __( 'License key deactivated for website', '
|
747 |
);
|
748 |
|
749 |
return isset( $messages[ $code ] ) ? $messages[ $code ] : false;
|
87 |
//show extra info and renew button in debug mode
|
88 |
$this->show_extra_info = $this->show_renew_button = true;
|
89 |
} else {
|
90 |
+
$this->show_extra_info = ( defined( 'YIT_SHOW_EXTRA_LICENCE_INFO' ) && YIT_SHOW_EXTRA_LICENCE_INFO ) || ( ! empty( $_GET['yith_show_extra_license_info'] ) && 'yes' == $_GET['yith_show_extra_license_info'] );
|
91 |
$this->show_renew_button = !( defined( 'YIT_HIDE_LICENCE_RENEW_BUTTON' ) && YIT_HIDE_LICENCE_RENEW_BUTTON );
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
/**
|
252 |
update_option( $this->_licence_option, $options );
|
253 |
|
254 |
/* === Update Plugin Licence Information === */
|
255 |
+
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
256 |
|
257 |
/* === Licence Activation Template === */
|
258 |
$body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
|
322 |
$options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
|
323 |
|
324 |
/* === Update Plugin Licence Information === */
|
325 |
+
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
326 |
|
327 |
update_option( $this->_licence_option, $options );
|
328 |
|
487 |
|
488 |
/* === Update Plugin Licence Information === */
|
489 |
if ( $regenerate_transient ) {
|
490 |
+
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
491 |
}
|
492 |
}
|
493 |
|
525 |
$this->check_all();
|
526 |
|
527 |
/* === Regenerate Update Plugins Transient === */
|
528 |
+
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
529 |
|
530 |
do_action( 'yit_licence_after_check' );
|
531 |
|
737 |
'107' => __( 'License key has been banned', 'yith-plugin-fw' ),
|
738 |
'108' => __( 'Current product is not included in your YITH Club Subscription key', 'yith-plugin-fw' ),
|
739 |
'200' => sprintf( '<strong>%s</strong>! %s', __( 'Great', 'yith-plugin-fw' ), __( 'License successfully activated', 'yith-plugin-fw' ) ),
|
740 |
+
'deactivated' => sprintf( '%s <strong>%s</strong>', __( 'License key deactivated for website', 'yith-plugin-fw' ), isset( $instance ) ? $instance : '' )
|
741 |
);
|
742 |
|
743 |
return isset( $messages[ $code ] ) ? $messages[ $code ] : false;
|
plugin-fw/licence/lib/yit-plugin-licence.php
CHANGED
@@ -74,7 +74,7 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
74 |
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
75 |
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
76 |
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
77 |
-
add_action( 'yit_licence_after_check',
|
78 |
|
79 |
/** @since 3.0.0 */
|
80 |
if( version_compare( PHP_VERSION, '7.0', '>=' ) ) {
|
@@ -148,11 +148,6 @@ if ( !class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
148 |
}
|
149 |
}
|
150 |
|
151 |
-
public function licence_after_check() {
|
152 |
-
/* === Regenerate Update Plugins Transient === */
|
153 |
-
YIT_Upgrade()->force_regenerate_update_transient();
|
154 |
-
}
|
155 |
-
|
156 |
/**
|
157 |
* Main plugin Instance
|
158 |
*
|
74 |
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
75 |
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
76 |
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
77 |
+
add_action( 'yit_licence_after_check', 'yith_plugin_fw_force_regenerate_plugin_update_transient' );
|
78 |
|
79 |
/** @since 3.0.0 */
|
80 |
if( version_compare( PHP_VERSION, '7.0', '>=' ) ) {
|
148 |
}
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Main plugin Instance
|
153 |
*
|
plugin-fw/licence/templates/panel/activation/activation-panel.php
CHANGED
@@ -22,15 +22,19 @@ $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_
|
|
22 |
|
23 |
<div class="yit-container product-licence-activation">
|
24 |
<h2><?php _e( 'YITH License Activation', 'yith-plugin-fw' ) ?></h2>
|
25 |
-
|
26 |
<div class="licence-check-section">
|
|
|
27 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
28 |
-
<span class="licence-label" style="display: block;"
|
|
|
|
|
29 |
<input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>"/>
|
30 |
-
<input type="submit" name="submit" value="<?php _e( '
|
31 |
<div class="spinner"></div>
|
32 |
</form>
|
33 |
</div>
|
|
|
34 |
|
35 |
<div id="yith-licence-notice" class="<?php echo $notice_class ?>">
|
36 |
<p class="yith-licence-notice-message"><?php echo $notice ?></p>
|
@@ -43,6 +47,7 @@ $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_
|
|
43 |
<?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
|
44 |
<span class="spinner"></span>
|
45 |
</h3>
|
|
|
46 |
<div class="to-active-wrapper">
|
47 |
<?php foreach ( $to_active_products as $init => $info ) : ?>
|
48 |
<form class="to-active-form" method="post" id="<?php echo $info[ 'product_id' ] ?>" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
@@ -102,7 +107,7 @@ $debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_
|
|
102 |
<?php endif; ?>
|
103 |
<?php endif; ?>
|
104 |
|
105 |
-
<th
|
106 |
</tr>
|
107 |
</thead>
|
108 |
<tbody>
|
22 |
|
23 |
<div class="yit-container product-licence-activation">
|
24 |
<h2><?php _e( 'YITH License Activation', 'yith-plugin-fw' ) ?></h2>
|
25 |
+
<?php if ( !empty( $activated_products ) ) : ?>
|
26 |
<div class="licence-check-section">
|
27 |
+
<h3><?php _e( 'License expiry date', 'yith-plugin-fw' ); ?></h3>
|
28 |
<form method="post" id="licence-check-update" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
29 |
+
<span class="licence-label" style="display: block;">
|
30 |
+
<?php _e( 'If you have renewed your product license key and the expiry date does not appear up-to-date, please, click on the button <em>Check Expiry Date</em> below and it will update.', 'yith-plugin-fw' ); ?>
|
31 |
+
</span>
|
32 |
<input type="hidden" name="action" value="yith_update_licence_information-<?php echo $this->get_product_type(); ?>"/>
|
33 |
+
<input type="submit" name="submit" value="<?php _e( 'Check expiry date', 'yith-plugin-fw' ) ?>" class="button-licence licence-check"/>
|
34 |
<div class="spinner"></div>
|
35 |
</form>
|
36 |
</div>
|
37 |
+
<?php endif; ?>
|
38 |
|
39 |
<div id="yith-licence-notice" class="<?php echo $notice_class ?>">
|
40 |
<p class="yith-licence-notice-message"><?php echo $notice ?></p>
|
47 |
<?php echo _n( 'Product to activate', 'Products to activate', $to_activate_check, 'yith-plugin-fw' ) ?>
|
48 |
<span class="spinner"></span>
|
49 |
</h3>
|
50 |
+
<p id="yith-licence-issue-how-to"><?php printf( '%s <a href="%s" target="_blank">%s</a>.', __( 'Are you having issues with the license activation?', 'yith-plugin-fw' ), '//support.yithemes.com/hc/en-us/articles/360012568594-License-activation-issues', __( 'Read this article', '[Part of]: Are you having issues with the license activation? Read this article', 'yith-plugin-fw' ) )?></p>
|
51 |
<div class="to-active-wrapper">
|
52 |
<?php foreach ( $to_active_products as $init => $info ) : ?>
|
53 |
<form class="to-active-form" method="post" id="<?php echo $info[ 'product_id' ] ?>" action="<?php echo admin_url( 'admin-ajax.php' ) ?>">
|
107 |
<?php endif; ?>
|
108 |
<?php endif; ?>
|
109 |
|
110 |
+
<th id="yith-licence-actions"><span class="dashicons dashicons-admin-generic"></span></th>
|
111 |
</tr>
|
112 |
</thead>
|
113 |
<tbody>
|
plugin-fw/templates/metaboxes/tab.php
CHANGED
@@ -20,11 +20,11 @@ do_action( 'yit_before_metaboxes_tab' ) ?>
|
|
20 |
<ul class="metaboxes-tabs clearfix"<?php if ( count( $tabs ) <= 1 ) : ?> style="display:none;"<?php endif; ?>>
|
21 |
<?php
|
22 |
$i = 0;
|
23 |
-
foreach ( $tabs as $tab ) :
|
24 |
if ( !isset( $tab[ 'fields' ] ) || empty( $tab[ 'fields' ] ) ) {
|
25 |
continue;
|
26 |
}
|
27 |
-
$anchor_id = 'yith-plugin-fw-metabox-tab-' . urldecode(
|
28 |
|
29 |
// parse deps for the tab visibility
|
30 |
if ( isset( $tab[ 'deps' ] ) ) {
|
@@ -38,30 +38,30 @@ do_action( 'yit_before_metaboxes_tab' ) ?>
|
|
38 |
}
|
39 |
?>
|
40 |
<li id="<?php echo $anchor_id ?>" <?php if ( !$i ) : ?>class="tabs"<?php endif ?> <?php echo yith_field_deps_data( $tab ); ?>>
|
41 |
-
<a href="#<?php echo urldecode(
|
42 |
$i++;
|
43 |
endforeach;
|
44 |
?>
|
45 |
</ul>
|
46 |
<?php do_action( 'yit_after_metaboxes_labels' ) ?>
|
47 |
<?php if ( isset( $tab[ 'label' ] ) ) : ?>
|
48 |
-
<?php do_action( 'yit_before_metabox_option_' . urldecode(
|
49 |
<?php endif ?>
|
50 |
|
51 |
<?php
|
52 |
// Use nonce for verification
|
53 |
wp_nonce_field( 'metaboxes-fields-nonce', 'yit_metaboxes_nonce' );
|
54 |
?>
|
55 |
-
<?php foreach ( $tabs as $tab ) :
|
56 |
|
57 |
?>
|
58 |
-
<div class="tabs-panel" id="<?php echo urldecode(
|
59 |
<?php
|
60 |
if ( !isset( $tab[ 'fields' ] ) ) {
|
61 |
continue;
|
62 |
}
|
63 |
|
64 |
-
$tab[ 'fields' ] = apply_filters( 'yit_metabox_' .
|
65 |
|
66 |
foreach ( $tab[ 'fields' ] as $id_tab => $field ) :
|
67 |
$field_name = $field[ 'name' ];
|
20 |
<ul class="metaboxes-tabs clearfix"<?php if ( count( $tabs ) <= 1 ) : ?> style="display:none;"<?php endif; ?>>
|
21 |
<?php
|
22 |
$i = 0;
|
23 |
+
foreach ( $tabs as $key=>$tab ) :
|
24 |
if ( !isset( $tab[ 'fields' ] ) || empty( $tab[ 'fields' ] ) ) {
|
25 |
continue;
|
26 |
}
|
27 |
+
$anchor_id = 'yith-plugin-fw-metabox-tab-' . urldecode( $key ) . '-anchor';
|
28 |
|
29 |
// parse deps for the tab visibility
|
30 |
if ( isset( $tab[ 'deps' ] ) ) {
|
38 |
}
|
39 |
?>
|
40 |
<li id="<?php echo $anchor_id ?>" <?php if ( !$i ) : ?>class="tabs"<?php endif ?> <?php echo yith_field_deps_data( $tab ); ?>>
|
41 |
+
<a href="#<?php echo urldecode( $key ) ?>"><?php echo $tab[ 'label' ] ?></a></li><?php
|
42 |
$i++;
|
43 |
endforeach;
|
44 |
?>
|
45 |
</ul>
|
46 |
<?php do_action( 'yit_after_metaboxes_labels' ) ?>
|
47 |
<?php if ( isset( $tab[ 'label' ] ) ) : ?>
|
48 |
+
<?php do_action( 'yit_before_metabox_option_' . urldecode( $key ) ); ?>
|
49 |
<?php endif ?>
|
50 |
|
51 |
<?php
|
52 |
// Use nonce for verification
|
53 |
wp_nonce_field( 'metaboxes-fields-nonce', 'yit_metaboxes_nonce' );
|
54 |
?>
|
55 |
+
<?php foreach ( $tabs as $key=> $tab ) :
|
56 |
|
57 |
?>
|
58 |
+
<div class="tabs-panel" id="<?php echo urldecode( $key ) ?>">
|
59 |
<?php
|
60 |
if ( !isset( $tab[ 'fields' ] ) ) {
|
61 |
continue;
|
62 |
}
|
63 |
|
64 |
+
$tab[ 'fields' ] = apply_filters( 'yit_metabox_' . $key . '_tab_fields', $tab[ 'fields' ] );
|
65 |
|
66 |
foreach ( $tab[ 'fields' ] as $id_tab => $field ) :
|
67 |
$field_name = $field[ 'name' ];
|
plugin-fw/templates/panel/woocommerce/woocommerce-option-row.php
CHANGED
@@ -13,8 +13,11 @@ $field = wp_parse_args( $field, $default_field );
|
|
13 |
$display_row = !in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title' ) );
|
14 |
$display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
|
15 |
|
|
|
|
|
|
|
16 |
?>
|
17 |
-
<tr valign="top" class="yith-plugin-fw-panel-wc-row <?php echo $field[ 'type' ] ?>" <?php echo yith_field_deps_data( $field ) ?>>
|
18 |
<?php if ( $display_row ) : ?>
|
19 |
<th scope="row" class="titledesc">
|
20 |
<label for="<?php echo esc_attr( $field[ 'id' ] ); ?>"><?php echo esc_html( $field[ 'title' ] ); ?></label>
|
13 |
$display_row = !in_array( $field[ 'type' ], array( 'hidden', 'html', 'sep', 'simple-text', 'title' ) );
|
14 |
$display_row = isset( $field[ 'yith-display-row' ] ) ? !!$field[ 'yith-display-row' ] : $display_row;
|
15 |
|
16 |
+
$extra_row_classes = apply_filters( 'yith_plugin_fw_panel_wc_extra_row_classes', array(), $field );
|
17 |
+
$extra_row_classes = is_array( $extra_row_classes ) ? implode( ' ', $extra_row_classes ) : '';
|
18 |
+
|
19 |
?>
|
20 |
+
<tr valign="top" class="yith-plugin-fw-panel-wc-row <?php echo $field[ 'type' ] ?> <?php echo $extra_row_classes ?>" <?php echo yith_field_deps_data( $field ) ?>>
|
21 |
<?php if ( $display_row ) : ?>
|
22 |
<th scope="row" class="titledesc">
|
23 |
<label for="<?php echo esc_attr( $field[ 'id' ] ); ?>"><?php echo esc_html( $field[ 'title' ] ); ?></label>
|
plugin-fw/yit-functions.php
CHANGED
@@ -401,7 +401,6 @@ if ( !function_exists( 'yit_string' ) ) {
|
|
401 |
}
|
402 |
}
|
403 |
|
404 |
-
|
405 |
if ( !function_exists( 'yit_pagination' ) ) {
|
406 |
/**
|
407 |
* Print pagination
|
@@ -598,7 +597,6 @@ if ( !function_exists( 'yit_get_excluded_categories' ) ) {
|
|
598 |
}
|
599 |
}
|
600 |
|
601 |
-
|
602 |
if ( !function_exists( 'yit_add_extra_theme_headers' ) ) {
|
603 |
add_filter( 'extra_theme_headers', 'yit_add_extra_theme_headers' );
|
604 |
|
@@ -891,7 +889,6 @@ if ( !function_exists( 'yit_wpml_object_id' ) ) {
|
|
891 |
|
892 |
}
|
893 |
|
894 |
-
|
895 |
if ( !function_exists( 'yith_get_formatted_price' ) ) {
|
896 |
/**
|
897 |
* Format the price with a currency symbol.
|
@@ -1062,6 +1059,7 @@ if ( !function_exists( 'yith_plugin_fw_html_data_to_string' ) ) {
|
|
1062 |
return $html_data;
|
1063 |
}
|
1064 |
}
|
|
|
1065 |
if ( !function_exists( 'yith_plugin_fw_get_icon' ) ) {
|
1066 |
function yith_plugin_fw_get_icon( $icon = '', $args = array() ) {
|
1067 |
return YIT_Icons()->get_icon( $icon, $args );
|
@@ -1070,11 +1068,10 @@ if ( !function_exists( 'yith_plugin_fw_get_icon' ) ) {
|
|
1070 |
|
1071 |
if ( !function_exists( 'yith_plugin_fw_is_true' ) ) {
|
1072 |
function yith_plugin_fw_is_true( $value ) {
|
1073 |
-
return true === $value || 1 === $value || '1' === $value || 'yes' === $value;
|
1074 |
}
|
1075 |
}
|
1076 |
|
1077 |
-
|
1078 |
if ( !function_exists( 'yith_plugin_fw_enqueue_enhanced_select' ) ) {
|
1079 |
function yith_plugin_fw_enqueue_enhanced_select() {
|
1080 |
wp_enqueue_script( 'yith-enhanced-select' );
|
@@ -1162,6 +1159,21 @@ if ( !function_exists( 'yith_plugin_fw_is_panel' ) ) {
|
|
1162 |
}
|
1163 |
}
|
1164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1165 |
/* === Gutenberg Support === */
|
1166 |
|
1167 |
if( ! function_exists( 'yith_plugin_fw_is_gutenberg_enabled' ) ){
|
@@ -1170,7 +1182,7 @@ if( ! function_exists( 'yith_plugin_fw_is_gutenberg_enabled' ) ){
|
|
1170 |
}
|
1171 |
}
|
1172 |
|
1173 |
-
if( ! function_exists( '
|
1174 |
/**
|
1175 |
* Add new blocks to Gutenberg
|
1176 |
*
|
401 |
}
|
402 |
}
|
403 |
|
|
|
404 |
if ( !function_exists( 'yit_pagination' ) ) {
|
405 |
/**
|
406 |
* Print pagination
|
597 |
}
|
598 |
}
|
599 |
|
|
|
600 |
if ( !function_exists( 'yit_add_extra_theme_headers' ) ) {
|
601 |
add_filter( 'extra_theme_headers', 'yit_add_extra_theme_headers' );
|
602 |
|
889 |
|
890 |
}
|
891 |
|
|
|
892 |
if ( !function_exists( 'yith_get_formatted_price' ) ) {
|
893 |
/**
|
894 |
* Format the price with a currency symbol.
|
1059 |
return $html_data;
|
1060 |
}
|
1061 |
}
|
1062 |
+
|
1063 |
if ( !function_exists( 'yith_plugin_fw_get_icon' ) ) {
|
1064 |
function yith_plugin_fw_get_icon( $icon = '', $args = array() ) {
|
1065 |
return YIT_Icons()->get_icon( $icon, $args );
|
1068 |
|
1069 |
if ( !function_exists( 'yith_plugin_fw_is_true' ) ) {
|
1070 |
function yith_plugin_fw_is_true( $value ) {
|
1071 |
+
return true === $value || 1 === $value || '1' === $value || 'yes' === $value || 'true' === $value;
|
1072 |
}
|
1073 |
}
|
1074 |
|
|
|
1075 |
if ( !function_exists( 'yith_plugin_fw_enqueue_enhanced_select' ) ) {
|
1076 |
function yith_plugin_fw_enqueue_enhanced_select() {
|
1077 |
wp_enqueue_script( 'yith-enhanced-select' );
|
1159 |
}
|
1160 |
}
|
1161 |
|
1162 |
+
if( ! function_exists( 'yith_plugin_fw_force_regenerate_plugin_update_transient' ) ){
|
1163 |
+
/**
|
1164 |
+
* Delete the update plugins transient
|
1165 |
+
*
|
1166 |
+
* @return void
|
1167 |
+
*
|
1168 |
+
* @since 1.0
|
1169 |
+
* @see update_plugins transient and pre_set_site_transient_update_plugins hooks
|
1170 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
1171 |
+
*/
|
1172 |
+
function yith_plugin_fw_force_regenerate_plugin_update_transient() {
|
1173 |
+
delete_site_transient( 'update_plugins' );
|
1174 |
+
}
|
1175 |
+
}
|
1176 |
+
|
1177 |
/* === Gutenberg Support === */
|
1178 |
|
1179 |
if( ! function_exists( 'yith_plugin_fw_is_gutenberg_enabled' ) ){
|
1182 |
}
|
1183 |
}
|
1184 |
|
1185 |
+
if( ! function_exists( 'yith_plugin_fw_gutenberg_add_blocks' ) ){
|
1186 |
/**
|
1187 |
* Add new blocks to Gutenberg
|
1188 |
*
|
plugin-fw/yit-plugin.php
CHANGED
@@ -37,6 +37,7 @@ include_once( 'lib/yit-pointers.php');
|
|
37 |
include_once( 'lib/yit-icons.php');
|
38 |
include_once( 'lib/yit-assets.php');
|
39 |
include_once( 'lib/yit-debug.php');
|
|
|
40 |
include_once( 'lib/privacy/yit-privacy.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
42 |
include_once( 'lib/promo/yith-promo.php' );
|
37 |
include_once( 'lib/yit-icons.php');
|
38 |
include_once( 'lib/yit-assets.php');
|
39 |
include_once( 'lib/yit-debug.php');
|
40 |
+
include_once( 'lib/yith-dashboard.php' );
|
41 |
include_once( 'lib/privacy/yit-privacy.php' );
|
42 |
include_once( 'lib/privacy/yit-privacy-plugin-abstract.php' );
|
43 |
include_once( 'lib/promo/yith-promo.php' );
|