YITH WooCommerce Ajax Product Filter - Version 3.6.4

Version Description

  • Released on 06th June, 2019 =

  • Tweak: WooCommerce 3.6 optimization

  • Update: Plugin Core Framework

  • Update: Languages file

  • Fix: Unable to reset filter in subcategory page

  • Fix: undefined variable term_id in attributes table

Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Product Filter
Version 3.6.4
Comparing to
See all releases

Code changes from version 3.6.3 to 3.6.4

Files changed (32) hide show
  1. README.txt +10 -2
  2. includes/class.yith-wcan-admin.php +1 -1
  3. includes/functions.yith-wcan.php +1 -2
  4. init.php +2 -2
  5. languages/yith-woocommerce-ajax-navigation-de_DE.mo +0 -0
  6. languages/yith-woocommerce-ajax-navigation-de_DE.po +2 -2
  7. languages/yith-woocommerce-ajax-navigation-es_ES.mo +0 -0
  8. languages/yith-woocommerce-ajax-navigation-es_ES.po +2 -2
  9. languages/yith-woocommerce-ajax-navigation-it_IT.mo +0 -0
  10. languages/yith-woocommerce-ajax-navigation-it_IT.po +2 -2
  11. languages/yith-woocommerce-ajax-navigation-nl_NL.mo +0 -0
  12. languages/yith-woocommerce-ajax-navigation-nl_NL.po +2 -2
  13. languages/yith-woocommerce-ajax-navigation-tr_TR.mo +0 -0
  14. languages/yith-woocommerce-ajax-navigation-tr_TR.po +2 -2
  15. plugin-fw/init.php +65 -4
  16. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  17. plugin-fw/languages/yith-plugin-fw-it_IT.po +31 -20
  18. plugin-fw/lib/yit-assets.php +0 -1
  19. plugin-fw/lib/yit-plugin-licence.php +116 -0
  20. plugin-fw/lib/yit-theme-licence.php +94 -0
  21. plugin-fw/lib/yit-upgrade.php +5 -649
  22. plugin-fw/licence/assets/css/yit-licence.css +0 -461
  23. plugin-fw/licence/assets/images/licence-error.png +0 -0
  24. plugin-fw/licence/assets/js/yit-licence.js +0 -215
  25. plugin-fw/licence/assets/js/yit-licence.min.js +0 -8
  26. plugin-fw/licence/lib/yit-licence.php +0 -804
  27. plugin-fw/licence/lib/yit-plugin-licence.php +0 -243
  28. plugin-fw/licence/lib/yit-theme-licence.php +0 -191
  29. plugin-fw/licence/templates/panel/activation/activation-panel.php +0 -247
  30. plugin-fw/yit-functions.php +41 -0
  31. plugin-fw/yit-plugin.php +3 -4
  32. widgets/class.yith-wcan-navigation-widget.php +10 -5
README.txt CHANGED
@@ -3,8 +3,8 @@
3
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.1
7
- Stable tag: 3.6.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -159,6 +159,14 @@ If you want to see a demonstration version of the premium plugin, you can see it
159
160
== Changelog ==
161
162
= 3.6.3 - Released on 23rd April, 2019 =
163
164
* Update: Plugin Core Framework
3
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.2
7
+ Stable tag: 3.6.4
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
159
160
== Changelog ==
161
162
+ = 3.6.4 - Released on 06th June, 2019 =
163
+
164
+ * Tweak: WooCommerce 3.6 optimization
165
+ * Update: Plugin Core Framework
166
+ * Update: Languages file
167
+ * Fix: Unable to reset filter in subcategory page
168
+ * Fix: undefined variable term_id in attributes table
169
+
170
= 3.6.3 - Released on 23rd April, 2019 =
171
172
* Update: Plugin Core Framework
includes/class.yith-wcan-admin.php CHANGED
@@ -230,7 +230,7 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
230
* @return string The premium landing link
231
*/
232
public function get_premium_landing_uri() {
233
- return $this->_premium_landing;
234
}
235
236
/**
230
* @return string The premium landing link
231
*/
232
public function get_premium_landing_uri() {
233
+ return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
234
}
235
236
/**
includes/functions.yith-wcan.php CHANGED
@@ -502,7 +502,7 @@ if ( ! function_exists( 'yit_get_filter_args' ) ) {
502
}
503
504
elseif( ! is_shop() && is_product_taxonomy() && $queried_object && ! isset( $filter_value['source_id'] ) && ! isset( $filter_value['source_tax'] )){
505
- $filter_value['source_id'] = $queried_object->slug;
506
$filter_value['source_tax'] = $queried_object->taxonomy;
507
}
508
@@ -566,7 +566,6 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
566
567
else {
568
$return = get_post_type_archive_link( 'product' );
569
-
570
return apply_filters( 'yith_wcan_untrailingslashit', false ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
571
}
572
502
}
503
504
elseif( ! is_shop() && is_product_taxonomy() && $queried_object && ! isset( $filter_value['source_id'] ) && ! isset( $filter_value['source_tax'] )){
505
+ $filter_value['source_id'] = $queried_object->term_id;
506
$filter_value['source_tax'] = $queried_object->taxonomy;
507
}
508
566
567
else {
568
$return = get_post_type_archive_link( 'product' );
569
return apply_filters( 'yith_wcan_untrailingslashit', false ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
570
}
571
init.php CHANGED
@@ -3,7 +3,7 @@
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.6.3
7
* Author: YITH
8
* Author URI: https://yithemes.com/
9
* Text Domain: 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.6.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
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.6.4
7
* Author: YITH
8
* Author URI: https://yithemes.com/
9
* Text Domain: 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.6.4' );
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
languages/yith-woocommerce-ajax-navigation-de_DE.mo CHANGED
Binary file
languages/yith-woocommerce-ajax-navigation-de_DE.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
- "PO-Revision-Date: 2019-04-06 15:19+0200\n"
7
"Last-Translator: Thomas Bunte <thomas@bunte-tk.de>\n"
8
"Language-Team: \n"
9
"Language: de_DE\n"
@@ -11,7 +11,7 @@ msgstr ""
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
- "X-Generator: Poedit 2.2.1\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
+ "PO-Revision-Date: 2019-06-06 10:17+0200\n"
7
"Last-Translator: Thomas Bunte <thomas@bunte-tk.de>\n"
8
"Language-Team: \n"
9
"Language: de_DE\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
+ "X-Generator: Poedit 2.2\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
languages/yith-woocommerce-ajax-navigation-es_ES.mo CHANGED
Binary file
languages/yith-woocommerce-ajax-navigation-es_ES.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
- "PO-Revision-Date: 2019-04-06 15:20+0200\n"
7
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language-Team: \n"
9
"Language: es_ES\n"
@@ -11,7 +11,7 @@ msgstr ""
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Generator: Poedit 2.2.1\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
+ "PO-Revision-Date: 2019-06-06 10:17+0200\n"
7
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language-Team: \n"
9
"Language: es_ES\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 2.2\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
languages/yith-woocommerce-ajax-navigation-it_IT.mo CHANGED
Binary file
languages/yith-woocommerce-ajax-navigation-it_IT.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
- "PO-Revision-Date: 2019-04-06 15:20+0200\n"
7
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language-Team: \n"
9
"Language: it_IT\n"
@@ -11,7 +11,7 @@ msgstr ""
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Generator: Poedit 2.2.1\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
+ "PO-Revision-Date: 2019-06-06 10:16+0200\n"
7
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
8
"Language-Team: \n"
9
"Language: it_IT\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 2.2\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
languages/yith-woocommerce-ajax-navigation-nl_NL.mo CHANGED
Binary file
languages/yith-woocommerce-ajax-navigation-nl_NL.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
- "PO-Revision-Date: 2019-04-06 15:20+0200\n"
7
"Last-Translator: \n"
8
"Language-Team: \n"
9
"Language: nl_NL\n"
@@ -11,7 +11,7 @@ msgstr ""
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
- "X-Generator: Poedit 2.2.1\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
3
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
+ "PO-Revision-Date: 2019-06-06 10:16+0200\n"
7
"Last-Translator: \n"
8
"Language-Team: \n"
9
"Language: nl_NL\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
+ "X-Generator: Poedit 2.2\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
languages/yith-woocommerce-ajax-navigation-tr_TR.mo CHANGED
Binary file
languages/yith-woocommerce-ajax-navigation-tr_TR.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
- "PO-Revision-Date: 2019-04-06 15:20+0200\n"
7
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
8
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
9
"Language: tr\n"
@@ -11,7 +11,7 @@ msgstr ""
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Generator: Poedit 2.2.1\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
3
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
4
"Report-Msgid-Bugs-To: http://wordpress.org/tag/init\n"
5
"POT-Creation-Date: 2019-04-06 13:19:15+00:00\n"
6
+ "PO-Revision-Date: 2019-06-06 10:16+0200\n"
7
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
8
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
9
"Language: tr\n"
11
"Content-Type: text/plain; charset=UTF-8\n"
12
"Content-Transfer-Encoding: 8bit\n"
13
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 2.2\n"
15
"X-Poedit-SourceCharset: UTF-8\n"
16
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
plugin-fw/init.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
- * Version: 3.1.29
5
* Author: YITHEMES
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
@@ -29,7 +29,7 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
29
* @since 1.0.0
30
*/
31
function yit_maybe_plugin_fw_loader ( $plugin_path ) {
32
- global $plugin_fw_data;
33
34
$default_headers = array (
35
'Name' => 'Framework Name',
@@ -39,8 +39,9 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
39
'DomainPath' => 'Domain Path',
40
);
41
42
- $framework_data = get_file_data ( trailingslashit ( $plugin_path ) . 'plugin-fw/init.php', $default_headers );
43
- $plugin_fw_main_file = trailingslashit ( $plugin_path ) . 'plugin-fw/yit-plugin.php';
44
45
if ( ! empty( $plugin_fw_data ) ) {
46
foreach ( $plugin_fw_data as $version => $path ) {
@@ -51,7 +52,67 @@ if ( ! function_exists ( 'yit_maybe_plugin_fw_loader' ) ) {
51
} else {
52
$plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
53
}
54
}
55
}
56
57
1
<?php
2
/**
3
* Framework Name: YIT Plugin Framework
4
+ * Version: 3.2.1
5
* Author: YITHEMES
6
* Text Domain: yith-plugin-fw
7
* Domain Path: /languages/
29
* @since 1.0.0
30
*/
31
function yit_maybe_plugin_fw_loader ( $plugin_path ) {
32
+ global $plugin_fw_data, $plugin_upgrade_fw_data;
33
34
$default_headers = array (
35
'Name' => 'Framework Name',
39
'DomainPath' => 'Domain Path',
40
);
41
42
+ $plugin_path = trailingslashit( $plugin_path );
43
+ $framework_data = get_file_data( $plugin_path . 'plugin-fw/init.php', $default_headers );
44
+ $plugin_fw_main_file = $plugin_path . 'plugin-fw/yit-plugin.php';
45
46
if ( ! empty( $plugin_fw_data ) ) {
47
foreach ( $plugin_fw_data as $version => $path ) {
52
} else {
53
$plugin_fw_data = array ( $framework_data[ 'Version' ] => $plugin_fw_main_file );
54
}
55
+
56
+ //Check for license & upgrade classes
57
+ $upgrade_fw_init_file = $plugin_path . 'plugin-upgrade/init.php';
58
+ $framework_data = file_exists( $upgrade_fw_init_file ) ? get_file_data( $upgrade_fw_init_file, $default_headers ) : $framework_data;
59
+ $plugin_license_path = $plugin_upgrade_path = $plugin_path . 'plugin-upgrade';
60
+
61
+ if( ! file_exists( $plugin_upgrade_path ) ){
62
+ //Check the path for OLD plugin FW
63
+ if( file_exists( $plugin_path . 'plugin-fw/licence' ) ){
64
+ $plugin_license_path = $plugin_path . 'plugin-fw/licence';
65
+ $plugin_upgrade_path = $plugin_path . 'plugin-fw/';
66
+ }
67
+
68
+ else {
69
+ $plugin_upgrade_path = $plugin_license_path = false;
70
+ }
71
+ }
72
+
73
+ if( file_exists( $plugin_upgrade_path ) ){
74
+ if( ! empty( $plugin_upgrade_fw_data ) ){
75
+ foreach( $plugin_upgrade_fw_data as $version => $files ){
76
+ if( version_compare ( $version, $framework_data[ 'Version' ], '<' ) ){
77
+ $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) );
78
+ }
79
+ }
80
+ }
81
+
82
+ else {
83
+ $plugin_upgrade_fw_data = array ( $framework_data[ 'Version' ] => yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path ) );
84
+ }
85
+ }
86
}
87
}
88
89
+ if( ! function_exists( 'yit_get_upgrade_files' ) ){
90
+ /**
91
+ * Retreive the core files to include to manage license and upgrade if exists
92
+ *
93
+ * @param $plugin_update_path file path
94
+ *
95
+ * @return array to files to include
96
+ */
97
+ function yit_get_upgrade_files( $plugin_license_path, $plugin_upgrade_path = '' ){
98
+ $to_include = array();
99
+
100
+ if( false ==! $plugin_license_path ){
101
+ $plugin_upgrade_path = empty( $plugin_upgrade_path ) ? $plugin_license_path : $plugin_upgrade_path;
102
+ $license_files = array(
103
+ '%yith-license-path%/lib/yit-licence.php',
104
+ '%yith-license-path%/lib/yit-plugin-licence.php',
105
+ '%yith-license-path%/lib/yit-theme-licence.php',
106
+ );
107
+
108
+ $upgrade_files = array( '%yith-upgrade-path%/lib/yit-plugin-upgrade.php' );
109
+
110
+ $to_include_license = str_replace( '%yith-license-path%', $plugin_license_path, $license_files );
111
+ $to_include_upgrade = str_replace( '%yith-upgrade-path%', $plugin_upgrade_path, $upgrade_files );
112
+
113
+ $to_include = array_merge( $to_include_license, $to_include_upgrade );
114
+ }
115
116
+ return $to_include;
117
+ }
118
+ }
plugin-fw/languages/yith-plugin-fw-it_IT.mo CHANGED
Binary file
plugin-fw/languages/yith-plugin-fw-it_IT.po CHANGED
@@ -5,14 +5,14 @@ msgstr ""
5
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
"POT-Creation-Date: 2019-02-04 16:06+0100\n"
8
- "PO-Revision-Date: 2019-02-04 16:07+0100\n"
9
"Last-Translator: \n"
10
"Language-Team: YIThemes <plugins@yithemes.com>\n"
11
"Language: it_IT\n"
12
"MIME-Version: 1.0\n"
13
"Content-Type: text/plain; charset=UTF-8\n"
14
"Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 2.2.1\n"
16
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
"esc_html_x:1,2c\n"
@@ -428,10 +428,15 @@ msgid ""
428
"\">Downloads page</a>. This is the only way to be sure the version you are "
429
"using is 100% malware-free."
430
msgstr ""
431
432
#: lib/yit-upgrade.php:303
433
- #, fuzzy
434
- #| msgid "You have to activate the plugin to benefit from automatic updates."
435
msgctxt "[Update Plugin Message: License not enabled]"
436
msgid "You have to activate the plugin to benefit from automatic updates."
437
msgstr "Devi attivare il plugin per usufruire degli update automatici."
@@ -509,6 +514,13 @@ msgid ""
509
"\">Downloads page</a>. This is the only way to be sure the version you are "
510
"using is 100%% malware-free."
511
msgstr ""
512
513
#: lib/yit-upgrade.php:635
514
msgid "You can't update the plugins for this site."
@@ -527,16 +539,16 @@ msgstr "Aggiorna plugin"
527
528
#: lib/yith-dashboard.php:40
529
msgid "New YITH products"
530
- msgstr ""
531
532
#: lib/yith-dashboard.php:41
533
msgid "News from the YITH Blog"
534
- msgstr ""
535
536
#: lib/yith-gutenberg.php:134
537
msgctxt "[gutenberg]: Category Name"
538
msgid "YITH"
539
- msgstr ""
540
541
#: licence/lib/yit-licence.php:180
542
#, php-format
@@ -625,7 +637,7 @@ msgctxt ""
625
"[Plugins List] which means you're missing out on updates and support. Enter "
626
"your license key, please."
627
msgid "Warning!"
628
- msgstr ""
629
630
#: licence/lib/yit-plugin-licence.php:142
631
msgctxt ""
@@ -633,7 +645,7 @@ msgctxt ""
633
"[Plugins List] which means you're missing out on updates and support. Enter "
634
"your license key, please."
635
msgid "You didn't set license key for the following products"
636
- msgstr ""
637
638
#: licence/lib/yit-plugin-licence.php:145
639
msgctxt ""
@@ -641,17 +653,15 @@ msgctxt ""
641
"[Plugins List] which means you're missing out on updates and support. Enter "
642
"your license key, please."
643
msgid "which means you're missing out on updates and support"
644
- msgstr ""
645
646
#: licence/lib/yit-plugin-licence.php:147
647
- #, fuzzy
648
- #| msgid "license key"
649
msgctxt ""
650
"[Part of]: Warning! You didn't set license key for the following products:"
651
"[Plugins List] which means you're missing out on updates and support. Enter "
652
"your license key, please."
653
msgid "Enter your license key"
654
- msgstr "chiave di licenza"
655
656
#: licence/lib/yit-plugin-licence.php:148
657
msgctxt ""
@@ -659,7 +669,7 @@ msgctxt ""
659
"[Plugins List] which means you're missing out on updates and support. Enter "
660
"your license key, please."
661
msgid "please"
662
- msgstr ""
663
664
#: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
665
#, php-format
@@ -703,10 +713,8 @@ msgid "YITH License Activation"
703
msgstr "Attivazione licenza YITH"
704
705
#: licence/templates/panel/activation/activation-panel.php:27
706
- #, fuzzy
707
- #| msgid "License key has expired"
708
msgid "License expiry date"
709
- msgstr "La chiave di licenza è scaduta"
710
711
#: licence/templates/panel/activation/activation-panel.php:30
712
msgid ""
@@ -714,10 +722,13 @@ msgid ""
714
"appear up-to-date, please, click on the button <em>Check Expiry Date</em> "
715
"below and it will update."
716
msgstr ""
717
718
#: licence/templates/panel/activation/activation-panel.php:33
719
msgid "Check expiry date"
720
- msgstr ""
721
722
#: licence/templates/panel/activation/activation-panel.php:47
723
msgid "Product to activate"
@@ -727,11 +738,11 @@ msgstr[1] "Prodotti da attivare"
727
728
#: licence/templates/panel/activation/activation-panel.php:50
729
msgid "Are you having issues with the license activation?"
730
- msgstr ""
731
732
#: licence/templates/panel/activation/activation-panel.php:50
733
msgid "Read this article"
734
- msgstr ""
735
736
#: licence/templates/panel/activation/activation-panel.php:70
737
msgid "Activate"
5
"Project-Id-Version: YITH Plugin Starter 1.0.0 Plugin FW\n"
6
"Report-Msgid-Bugs-To: Your Inspiration Themes <plugins@yithemes.com>\n"
7
"POT-Creation-Date: 2019-02-04 16:06+0100\n"
8
+ "PO-Revision-Date: 2019-05-29 22:44+0200\n"
9
"Last-Translator: \n"
10
"Language-Team: YIThemes <plugins@yithemes.com>\n"
11
"Language: it_IT\n"
12
"MIME-Version: 1.0\n"
13
"Content-Type: text/plain; charset=UTF-8\n"
14
"Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 2.2.3\n"
16
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
"esc_html_x:1,2c\n"
428
"\">Downloads page</a>. This is the only way to be sure the version you are "
429
"using is 100% malware-free."
430
msgstr ""
431
+ "<br/><b>Attenzione:</b> Stai utilizzando una versione superiore all'ultima "
432
+ "disponibile. </em>Per favore assicurati di aver scaricato la versione più "
433
+ "recente di <em>%1$s</em> dall'unico <a href=\"https://yithemes.com\" target="
434
+ "\"_blank\">sito ufficiale YITH</a>, nello specifico dalla tua <a href="
435
+ "\"https://yithemes.com/my-account/recent-downloads/\" target=\"_blank"
436
+ "\">pagina Downloads</a>. Questo è l'unico modo per essere sicuri che la "
437
+ "versione in uso sia al 100% priva di malware."
438
439
#: lib/yit-upgrade.php:303
440
msgctxt "[Update Plugin Message: License not enabled]"
441
msgid "You have to activate the plugin to benefit from automatic updates."
442
msgstr "Devi attivare il plugin per usufruire degli update automatici."
514
"\">Downloads page</a>. This is the only way to be sure the version you are "
515
"using is 100%% malware-free."
516
msgstr ""
517
+ "<br/><b>Attenzione:</b> Stai utilizzando una versione superiore all'ultima "
518
+ "disponibile. </em>Per favore assicurati di aver scaricato la versione più "
519
+ "recente di <em>%1$s</em> dall'unico <a href=\"https://yithemes.com\" target="
520
+ "\"_blank\">sito ufficiale YITH</a>, nello specifico dalla tua <a href="
521
+ "\"https://yithemes.com/my-account/recent-downloads/\" target=\"_blank"
522
+ "\">pagina Downloads</a>. Questo è l'unico modo per essere sicuri che la "
523
+ "versione in uso sia al 100%% priva di malware."
524
525
#: lib/yit-upgrade.php:635
526
msgid "You can't update the plugins for this site."
539
540
#: lib/yith-dashboard.php:40
541
msgid "New YITH products"
542
+ msgstr "Nuovi prodotti YITH"
543
544
#: lib/yith-dashboard.php:41
545
msgid "News from the YITH Blog"
546
+ msgstr "Novità dal blog YITH"
547
548
#: lib/yith-gutenberg.php:134
549
msgctxt "[gutenberg]: Category Name"
550
msgid "YITH"
551
+ msgstr "YITH"
552
553
#: licence/lib/yit-licence.php:180
554
#, php-format
637
"[Plugins List] which means you're missing out on updates and support. Enter "
638
"your license key, please."
639
msgid "Warning!"
640
+ msgstr "Attenzione!"
641
642
#: licence/lib/yit-plugin-licence.php:142
643
msgctxt ""
645
"[Plugins List] which means you're missing out on updates and support. Enter "
646
"your license key, please."
647
msgid "You didn't set license key for the following products"
648
+ msgstr "Non hai impostato la chiave di licenza per i seguenti prodotti"
649
650
#: licence/lib/yit-plugin-licence.php:145
651
msgctxt ""
653
"[Plugins List] which means you're missing out on updates and support. Enter "
654
"your license key, please."
655
msgid "which means you're missing out on updates and support"
656
+ msgstr "il che significa che ti stai perdendo aggiornamenti e supporto"
657
658
#: licence/lib/yit-plugin-licence.php:147
659
msgctxt ""
660
"[Part of]: Warning! You didn't set license key for the following products:"
661
"[Plugins List] which means you're missing out on updates and support. Enter "
662
"your license key, please."
663
msgid "Enter your license key"
664
+ msgstr "Inserisci la tua chiave di licenza"
665
666
#: licence/lib/yit-plugin-licence.php:148
667
msgctxt ""
669
"[Plugins List] which means you're missing out on updates and support. Enter "
670
"your license key, please."
671
msgid "please"
672
+ msgstr "per favore"
673
674
#: licence/lib/yit-theme-licence.php:117 licence/lib/yit-theme-licence.php:118
675
#, php-format
713
msgstr "Attivazione licenza YITH"
714
715
#: licence/templates/panel/activation/activation-panel.php:27
716
msgid "License expiry date"
717
+ msgstr "Data di scadenza della licenza"
718
719
#: licence/templates/panel/activation/activation-panel.php:30
720
msgid ""
722
"appear up-to-date, please, click on the button <em>Check Expiry Date</em> "
723
"below and it will update."
724
msgstr ""
725
+ "Se hai rinnovato la chiave di licenza del tuo prodotto e la data di scadenza "
726
+ "non risulta aggiornata, ti invitiamo a fare clic sul pulsante <em>Check "
727
+ "Expiry Date</em> in modo da aggiornarla."
728
729
#: licence/templates/panel/activation/activation-panel.php:33
730
msgid "Check expiry date"
731
+ msgstr "Controlla la data di scadenza"
732
733
#: licence/templates/panel/activation/activation-panel.php:47
734
msgid "Product to activate"
738
739
#: licence/templates/panel/activation/activation-panel.php:50
740
msgid "Are you having issues with the license activation?"
741
+ msgstr "Stai riscontrando problemi con l'attivazione della licenza?"
742
743
#: licence/templates/panel/activation/activation-panel.php:50
744
msgid "Read this article"
745
+ msgstr "Leggi questo articolo"
746
747
#: licence/templates/panel/activation/activation-panel.php:70
748
msgid "Activate"
plugin-fw/lib/yit-assets.php CHANGED
@@ -88,7 +88,6 @@ if ( !class_exists( 'YIT_Assets' ) ) {
88
) );
89
90
wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
91
-
92
}
93
}
94
}
88
) );
89
90
wp_enqueue_style( 'yith-plugin-fw-admin', YIT_CORE_PLUGIN_URL . '/assets/css/admin.css', array(), $this->version );
91
}
92
}
93
}
plugin-fw/lib/yit-plugin-licence.php ADDED
@@ -0,0 +1,116 @@
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin 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
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
16
+ /**
17
+ * YIT Licence Panel
18
+ *
19
+ * Setting Page to Manage Products
20
+ *
21
+ * @class YIT_Licence
22
+ * @package YITH
23
+ * @since 1.0
24
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
+ */
26
+ class YIT_Plugin_Licence {
27
+ /**
28
+ * @var object The single instance of the class
29
+ * @since 1.0
30
+ */
31
+ protected static $_instance = null;
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @since 1.0
37
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
38
+ */
39
+ public function __construct() {
40
+ //Silence is golden
41
+ }
42
+
43
+ /**
44
+ * Premium products registration
45
+ *
46
+ * @param $init string | The products identifier
47
+ * @param $secret_key string | The secret key
48
+ * @param $product_id string | The product id
49
+ *
50
+ * @return void
51
+ *
52
+ * @since 1.0
53
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
54
+ */
55
+ public function register( $init, $secret_key, $product_id ){
56
+ if( ! function_exists( 'YITH_Plugin_Licence' ) ){
57
+ //Try to load YITH_Plugin_Licence class
58
+ yith_plugin_fw_load_update_and_licence_files();
59
+ }
60
+
61
+ YITH_Plugin_Licence()->register( $init, $secret_key, $product_id );
62
+ }
63
+
64
+ /**
65
+ * Main plugin Instance
66
+ *
67
+ * @static
68
+ * @return object Main instance
69
+ *
70
+ * @since 1.0
71
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
72
+ */
73
+ public static function instance() {
74
+ if ( is_null( self::$_instance ) ) {
75
+ self::$_instance = new self();
76
+ }
77
+
78
+ return self::$_instance;
79
+ }
80
+
81
+ /**
82
+ * Get license activation URL
83
+ *
84
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
85
+ * @since 3.0.17
86
+ */
87
+ public static function get_license_activation_url(){
88
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_license_activation_url() : false;
89
+ }
90
+
91
+ /**
92
+ * Get protected array products
93
+ *
94
+ * @return mixed array
95
+ *
96
+ * @since 1.0
97
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
98
+ */
99
+ public function get_products() {
100
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_products() : array();
101
+ }
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Main instance
107
+ *
108
+ * @return object
109
+ * @since 1.0
110
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
111
+ */
112
+ if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
113
+ function YIT_Plugin_Licence() {
114
+ return YIT_Plugin_Licence::instance();
115
+ }
116
+ }
plugin-fw/lib/yit-theme-licence.php ADDED
@@ -0,0 +1,94 @@
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin 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
+ if ( !defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ } // Exit if accessed directly
14
+
15
+ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
16
+ /**
17
+ * YIT Licence Panel
18
+ *
19
+ * Setting Page to Manage Products
20
+ *
21
+ * @class YIT_Licence
22
+ * @package YITH
23
+ * @since 1.0
24
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
25
+ */
26
+ class YIT_Theme_Licence {
27
+ /**
28
+ * @var object The single instance of the class
29
+ * @since 1.0
30
+ */
31
+ protected static $_instance = null;
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @since 1.0
37
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
38
+ */
39
+ public function __construct() {
40
+ //Silence is golden
41
+ }
42
+
43
+ /**
44
+ * Premium products registration
45
+ *
46
+ * @param $init string | The products identifier
47
+ * @param $secret_key string | The secret key
48
+ * @param $product_id string | The product id
49
+ *
50
+ * @return void
51
+ *
52
+ * @since 1.0
53
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
54
+ */
55
+ public function register( $init, $secret_key, $product_id ){
56
+ if( ! function_exists( 'YITH_Theme_Licence' ) ){
57
+ //Try to load YITH_Theme_Licence class
58
+ yith_plugin_fw_load_update_and_licence_files();
59
+ }
60
+
61
+ YITH_Theme_Licence()->register( $init, $secret_key, $product_id );
62
+ }
63
+
64
+ /**
65
+ * Main plugin Instance
66
+ *
67
+ * @static
68
+ * @return object Main instance
69
+ *
70
+ * @since 1.0
71
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
72
+ */
73
+ public static function instance() {
74
+ if ( is_null( self::$_instance ) ) {
75
+ self::$_instance = new self();
76
+ }
77
+
78
+ return self::$_instance;
79
+ }
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Main instance
85
+ *
86
+ * @return object
87
+ * @since 1.0
88
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
89
+ */
90
+ if ( !function_exists( 'YIT_Theme_Licence' ) ) {
91
+ function YIT_Theme_Licence() {
92
+ return YIT_Theme_Licence::instance();
93
+ }
94
+ }
plugin-fw/lib/yit-upgrade.php CHANGED
@@ -24,22 +24,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
24
* @see WP_Updater Class
25
*/
26
class YIT_Upgrade {
27
-
28
- /**
29
- * @var string XML notifier update
30
- */
31
- protected $_remote_url = 'https://update.yithemes.com/plugin-xml.php';
32
-
33
- /**
34
- * @var string api server url
35
- */
36
- protected $_package_url = 'https://yithemes.com';
37
-
38
- /**
39
- * @var array The registered plugins
40
- */
41
- protected $_plugins = array();
42
-
43
/**
44
* @var YIT_Upgrade The main instance
45
*/
@@ -52,56 +36,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
52
* @since 1.0
53
*/
54
public function __construct() {
55
- add_filter( 'upgrader_pre_download', array( $this, 'upgrader_pre_download' ), 10, 3 );
56
- add_action( 'update-custom_upgrade-plugin-multisite', array( $this, 'upgrade_plugin_multisite' ) );
57
-
58
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-
60
- $is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
61
- if ( $is_debug_enabled ) {
62
- $this->_package_url = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
63
- add_filter( 'block_local_requests', '__return_false' );
64
- }
65
-
66
- add_action( 'install_plugins_pre_plugin-information', array(
67
- $this,
68
- 'show_changelog_for_premium_plugins'
69
- ) );
70
- add_action( 'wp_ajax_yith_plugin_fw_get_premium_changelog', array(
71
- $this,
72
- 'show_changelog_for_premium_plugins'
73
- ) );
74
- }
75
-
76
- /**
77
- * show changelog for premium plugins
78
- *
79
- * @since 3.0.14
80
- */
81
- public function show_changelog_for_premium_plugins() {
82
- if ( isset( $_GET['plugin'] ) && isset( $_GET['section'] ) && 'changelog' === $_GET['section'] ) {
83
- $plugin_init = $_GET['plugin'];
84
- if ( isset( $this->_plugins[ $plugin_init ] ) ) {
85
- // this is YITH Premium Plugin
86
- if ( ! empty( $this->_plugins[ $plugin_init ]['info']['changelog'] ) ) {
87
- $plugin_name = $this->_plugins[ $plugin_init ]['info']['Name'];
88
- $changelog = $this->_plugins[ $plugin_init ]['info']['changelog'];
89
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/changelog.php';
90
- if ( file_exists( $template ) ) {
91
- include( $template );
92
- }
93
- die();
94
- }
95
- $error = __( 'An unexpected error occurred, please try again later. Thanks!', 'yith-plugin-fw' );
96
- $template = YIT_CORE_PLUGIN_TEMPLATE_PATH . '/upgrade/error.php';
97
- if ( file_exists( $template ) ) {
98
- include( $template );
99
- } else {
100
- echo "<p>$error</p>";
101
- }
102
- die();
103
- }
104
- }
105
}
106
107
/**
@@ -116,305 +51,12 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
116
* @author Andrea Grillo <andrea.grillo@yithemes.com>
117
*/
118
public function register( $plugin_slug, $plugin_init ) {
119
-
120
- if ( ! function_exists( 'get_plugins' ) ) {
121
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
122
- }
123
-
124
- $plugins = get_plugins();
125
- $plugin_info = $plugins[ $plugin_init ];
126
-
127
- $plugin = $this->_plugins[ $plugin_init ] = array(
128
- 'info' => $plugin_info,
129
- 'slug' => $plugin_slug,
130
- );
131
-
132
- $transient = 'yith_register_' . md5( $plugin_slug );
133
- if ( apply_filters( 'yith_register_delete_transient', false ) ) {
134
- delete_transient( $transient );
135
- }
136
- $info = get_transient( $transient );
137
- if ( false === $info || apply_filters( 'yith_register_delete_transient', false ) ) {
138
- $xml = $this->get_remote_url( $plugin );
139
- $remote_xml = wp_remote_get( $xml );
140
-
141
- $error = false;
142
- if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
143
- $plugin_remote_info = function_exists( 'simplexml_load_string' ) ? @simplexml_load_string( $remote_xml['body'] ) : false;
144
- if ( $plugin_remote_info ) {
145
- $info['Latest'] = (string) $plugin_remote_info->latest;
146
- $info['changelog'] = (string) $plugin_remote_info->changelog;
147
- if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
148
- YIT_Plugin_Licence()->check( $plugin_slug, false );
149
- }
150
- set_transient( $transient, $info, DAY_IN_SECONDS );
151
- } else {
152
- $error = true;
153
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
154
- __FILE__, __FUNCTION__, $plugin_slug ) );
155
- }
156
- } else {
157
- $error = true;
158
- }
159
-
160
- if ( $error ) {
161
- // If error, set empty value in the transient to prevent multiple requests
162
- $info = array( 'Latest' => '', 'changelog' => '' );
163
- set_transient( $transient, $info, HOUR_IN_SECONDS );
164
- }
165
- }
166
-
167
- $this->_plugins[ $plugin_init ]['info']['Latest'] = $info['Latest'];
168
- $this->_plugins[ $plugin_init ]['info']['changelog'] = $info['changelog'];
169
-
170
- /* === HOOKS === */
171
- if ( ! is_multisite() || is_plugin_active_for_network( $plugin_init ) ) {
172
- add_action( 'load-plugins.php', array( $this, 'remove_wp_plugin_update_row' ), 25 );
173
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
174
- } else if ( is_multisite() && current_user_can( 'update_plugins' ) ) {
175
- add_action( 'admin_enqueue_scripts', array( $this, 'multisite_updater_script' ) );
176
- }
177
- }
178
-
179
- /**
180
- * Add the multisite updater scripts
181
- *
182
- * @return void
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>%plugin_name%</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 ) {
205
- $update_url[ $init ] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin-multisite&plugin=' ) . $init, 'upgrade-plugin-multisite_' . $init );
206
- $details_url[ $init ] = admin_url( 'admin-ajax.php?action=yith_plugin_fw_get_premium_changelog&tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
207
- }
208
-
209
- $localize_script_args = array(
210
- 'registered' => $this->_plugins,
211
- 'activated' => YIT_Plugin_Licence()->get_activated_products(),
212
- 'licence_activation_url' => YIT_Plugin_Licence()->get_licence_activation_page_url(),
213
- 'update_url' => $update_url,
214
- 'details_url' => $details_url,
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
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
230
- wp_enqueue_style( 'yit-upgrader', YIT_CORE_PLUGIN_URL . '/assets/css/yit-upgrader.css' );
231
- wp_enqueue_script( 'yith-update-plugins', YIT_CORE_PLUGIN_URL . '/assets/js/yith-update-plugins' . $suffix . '.js', array( 'jquery' ), false, true );
232
-
233
- $update_plugins_localized = array(
234
- 'ajax_nonce' => wp_create_nonce( 'updates' ),
235
- 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
236
- 'l10n' => array(
237
- /* translators: %s: Plugin name and version */
238
- 'updating' => _x( 'Updating %s...', 'plugin-fw', 'yith-plugin-fw' ), // No ellipsis.
239
- /* translators: %s: Plugin name and version */
240
- 'updated' => _x( '%s updated!', 'plugin-fw', 'yith-plugin-fw' ),
241
- /* translators: %s: Plugin name and version */
242
- 'failed' => _x( '%s update failed', 'plugin-fw', 'yith-plugin-fw' ),
243
- ),
244
- );
245
-
246
- wp_localize_script( 'yith-update-plugins', 'yith_plugin_fw', $update_plugins_localized );
247
- }
248
- }
249
-
250
- /**
251
- * Retrive the zip package file
252
- *
253
- * @param bool $reply Whether to bail without returning the package. Default false.
254
- * @param string $package The package file name.
255
- * @param \WP_Upgrader $upgrader WP_Upgrader instance.
256
- *
257
- * @return string | The download file
258
- *
259
- * @since 1.0
260
- * @see wp-admin/includes/class-wp-upgrader.php
261
- * @access public
262
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
263
- */
264
- public function upgrader_pre_download( $reply, $package, $upgrader ) {
265
- /* === If class YIT_Plugin_Licence doesn't exists, no YITH plugins enabled === */
266
- if( ! function_exists( 'YIT_Plugin_Licence' ) ){
267
- return $reply;
268
- }
269
-
270
- $plugin = false;
271
- $is_bulk = $upgrader->skin instanceof Bulk_Plugin_Upgrader_Skin;
272
- $is_bulk_ajax = $upgrader->skin instanceof WP_Ajax_Upgrader_Skin;
273
-
274
- if ( ! $is_bulk && ! $is_bulk_ajax ) {
275
- //Bulk Action: Support for old WordPress Version
276
- $plugin = isset( $upgrader->skin->plugin ) ? $upgrader->skin->plugin : false;
277
- }
278
-
279
- elseif( $is_bulk_ajax ){
280
- //Bulk Update for WordPress 4.9 or greater
281
- if( ! empty( $_POST['plugin'] ) ){
282
- $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );
283
- }
284
- }
285
-
286
- else {
287
- //Bulk action upgrade
288
- $action_url = parse_url( $upgrader->skin->options['url'] );
289
- parse_str( rawurldecode( htmlspecialchars_decode( $action_url['query'] ) ), $output );
290
- $plugins = isset( $output['plugins'] ) ? $output['plugins'] : '';
291
- $plugins = explode( ',', $plugins );
292
- foreach ( $plugins as $plugin_init ) {
293
- $to_upgrade = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_init );
294
- if ( $to_upgrade['Name'] == $upgrader->skin->plugin_info['Name'] ) {
295
- $plugin = $plugin_init;
296
- }
297
- }
298
- }
299
-
300
- /**
301
- * It isn't YITH Premium plugins, please wordpress update it for me!
302
- */
303
- if ( ! $plugin ) {
304
- return $reply;
305
- }
306
-
307
- $plugin_info = YIT_Plugin_Licence()->get_product( $plugin );
308
-
309
- /**
310
- * False ? It isn't YITH Premium plugins, please wordpress update it for me!
311
- */
312
- if ( false === $plugin_info ) {
313
- return $reply;
314
- }
315
-
316
- $licence = YIT_Plugin_Licence()->get_licence();
317
- $product_id = $plugin_info['product_id'];
318
-
319
- if( empty( $licence[ $product_id ] ) ){
320
- 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' ) );
321
- }
322
-
323
- $args = array(
324
- 'email' => $licence[ $product_id ]['email'],
325
- 'licence_key' => $licence[ $product_id ]['licence_key'],
326
- 'product_id' => $plugin_info['product_id'],
327
- 'secret_key' => $plugin_info['secret_key'],
328
- 'instance' => YIT_Plugin_Licence()->get_home_url(),
329
- 'wc-api' => 'download-api',
330
- 'request' => 'download'
331
- );
332
-
333
- if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) {
334
- //Local file or remote?
335
- return $package;
336
- }
337
-
338
- if ( empty( $package ) ) {
339
- return new WP_Error( 'no_package', $upgrader->strings['no_package'] );
340
- }
341
-
342
- $upgrader->skin->feedback( 'downloading_package', __( 'YITH Repository', 'yith-plugin-fw' ) );
343
-
344
- $download_file = $this->_download_url( $package, $args );
345
-
346
- /**
347
- * Regenerate update_plugins transient
348
- */
349
- yith_plugin_fw_force_regenerate_plugin_update_transient();
350
-
351
- if ( is_wp_error( $download_file ) ) {
352
- return new WP_Error( 'download_failed', $upgrader->strings['download_failed'], $download_file->get_error_message() );
353
}
354
355
- return $download_file;
356
- }
357
-
358
- /**
359
- * Retrieve the temp filename
360
- *
361
- * @param string $url The package url
362
- * @param string $body The post data fields
363
- * @param int $timeout Execution timeout (default: 300)
364
- *
365
- * @return string | The temp filename
366
- *
367
- * @since 1.0
368
- * @see wp-admin/includes/class-wp-upgrader.php
369
- * @access protected
370
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
371
- */
372
- protected function _download_url( $url, $body, $timeout = 300 ) {
373
-
374
- //WARNING: The file is not automatically deleted, The script must unlink() the file.
375
- if ( ! $url ) {
376
- return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.', 'yith-plugin-fw' ) );
377
- }
378
-
379
- $tmpfname = wp_tempnam( $url );
380
-
381
- $args = array(
382
- 'timeout' => $timeout,
383
- 'stream' => true,
384
- 'filename' => $tmpfname,
385
- 'body' => $body
386
- );
387
-
388
- if ( ! $tmpfname ) {
389
- return new WP_Error( 'http_no_file', __( 'Could not create Temporary file.', 'yith-plugin-fw' ) );
390
- }
391
-
392
- $response = wp_safe_remote_post( $url, $args );
393
-
394
- if ( is_wp_error( $response ) ) {
395
- unlink( $tmpfname );
396
-
397
- return $response;
398
- }
399
-
400
- if ( 200 != wp_remote_retrieve_response_code( $response ) ) {
401
- unlink( $tmpfname );
402
-
403
- return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
404
- }
405
-
406
- $content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
407
-
408
- if ( $content_md5 ) {
409
- $md5_check = verify_file_md5( $tmpfname, $content_md5 );
410
- if ( is_wp_error( $md5_check ) ) {
411
- unlink( $tmpfname );
412
-
413
- return $md5_check;
414
- }
415
- }
416
-
417
- return $tmpfname;
418
}
419
420
/**
@@ -433,292 +75,6 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
433
434
return self::$_instance;
435
}
436
-
437
- /**
438
- * Delete the update plugins transient
439
- *
440
- * @return void
441
- *
442
- * @since 1.0
443
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
444
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
445
- * @deprecated From version 3.1.12
446
- */
447
- public function force_regenerate_update_transient() {
448
- delete_site_transient( 'update_plugins' );
449
- }
450
-
451
- /**
452
- * Check for plugins update
453
- *
454
- * If a new plugin version is available set it in the pre_set_site_transient_update_plugins hooks
455
- *
456
- * @param mixed $transient | update_plugins transient value
457
- * @param bool $save | Default: false. Set true to regenerate the update_transient plugins
458
- *
459
- * @return mixed $transient | The new update_plugins transient value
460
- *
461
- * @since 1.0
462
- * @see update_plugins transient and pre_set_site_transient_update_plugins hooks
463
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
464
- */
465
- public function check_update( $transient, $save = false ) {
466
-
467
- foreach ( $this->_plugins as $init => $plugin ) {
468
- $plugin_slug = $this->_plugins[ $init ]['slug'];
469
- $xml = $this->get_remote_url( $plugin );
470
- $remote_xml = wp_remote_get( $xml );
471
-
472
- if ( ! is_wp_error( $remote_xml ) && isset( $remote_xml['response']['code'] ) && '200' == $remote_xml['response']['code'] ) {
473
-
474
- $plugin_remote_info = function_exists( 'simplexml_load_string' ) ? @simplexml_load_string( $remote_xml['body'] ) : false;
475
-
476
- if ( $plugin_remote_info ) {
477
- $wrong_current_version_check = version_compare( $plugin['info']['Version'], $plugin_remote_info->latest, '>' );
478
- $update_available = version_compare( $plugin_remote_info->latest, $plugin['info']['Version'], '>' );
479
-
480
- if ( ( $update_available || $wrong_current_version_check ) && ! isset( $transient->response[ $init ] ) ) {
481
-
482
- $package = YIT_Plugin_Licence()->check( $init ) ? $this->_package_url : null;
483
-
484
- $tested_up_to = (string) str_replace( '.x', '', $plugin_remote_info->{"up-to"} );
485
- $tested_up_to = preg_replace( '/-.*#x2F;', '', $tested_up_to );
486
- $wp_version = preg_replace( '/-.*#x2F;', '', get_bloginfo( 'version' ) );
487
-
488
- if( strpos( $wp_version, $tested_up_to ) !== false ){
489
- $tested_up_to = $wp_version;
490
- }
491
- $obj = new stdClass();
492
- $obj->slug = (string) $init;
493
- $obj->new_version = (string) $plugin_remote_info->latest;
494
- $obj->changelog = (string) $plugin_remote_info->changelog;
495
- $obj->package = $package;
496
- $obj->plugin = $init;
497
- $obj->tested = $tested_up_to;
498
-
499
- if( ! empty( $plugin_remote_info->icons ) ){
500
- $obj->icons = (array) $plugin_remote_info->icons;
501
- }
502
-
503
- $transient->response[ $init ] = $obj;
504
- }
505
-
506
- } else {
507
- error_log( sprintf( 'SimpleXML error in %s:%s [plugin slug: %s]',
508
- __FILE__, __FUNCTION__, $plugin_slug ) );
509
-
510
- return $transient;
511
- }
512
- }
513
- }
514
-
515
- if ( $save ) {
516
- set_site_transient( 'update_plugins', $transient );
517
- }
518
-
519
- return $transient;
520
- }
521
-
522
- /**
523
- * Add the plugin update row in plugin page
524
- *
525
- * @return void
526
- * @fire "in_theme_update_message-{$init}" action
527
- *
528
- * @since 1.0
529
- * @see after_plugin_row_{$init} action
530
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
531
- */
532
- public function plugin_update_row() {
533
-
534
- $current = get_site_transient( 'update_plugins' );
535
- $init = str_replace( 'after_plugin_row_', '', current_filter() );
536
- $update_now_class = apply_filters( 'yith_plugin_fw_update_now_class', '' );
537
- $update_now_class = trim( $update_now_class . ' yith-update-link update-link' );
538
-
539
- if ( ! isset( $current->response[ $init ] ) ) {
540
- return false;
541
- }
542
-
543
- /**
544
- * stdClass Object
545
- */
546
- $r = $current->response[ $init ];
547
-
548
- $changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
549
- $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $init . '&section=changelog&TB_iframe=true&width=640&height=662' );
550
-
551
- /**
552
- * @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
553
- */
554
- $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
555
-
556
- global $wp_version;
557
- $is_wp_4_6 = version_compare( $wp_version, '4.6', '>=' );
558
-
559
- echo '<tr class="plugin-update-tr' . ( is_plugin_active( $init ) ? ' active' : '' ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
560
-
561
- echo '<div class="update-message' . ( $is_wp_4_6 ? ' notice inline notice-warning notice-alt' : '' ) . '">';
562
-
563
- echo( $is_wp_4_6 ? '<p>' : '' );
564
-
565
- if ( ! current_user_can( 'update_plugins' ) ) {
566
- 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 );
567
- }
568
-
569
- elseif ( is_plugin_active_for_network( $init ) ) {
570
- 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 );
571
- }
572
-
573
- elseif ( empty( $r->package ) ) {
574
- 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'] );
575
- }
576
-
577
- else {
578
- 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" class="%6$s" data-plugin="%7$s" data-slug="%8$s" data-name="%1$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 ), $update_now_class, $init, $this->_plugins[ $init ]['slug'] );
579
- }
580
-
581
- if( version_compare( $this->_plugins[ $init ]['info']['Version'] , $r->new_version, '>' ) ){
582
- 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'] );
583
- }
584
-
585
-
586
- echo( $is_wp_4_6 ? '</p>' : '' );
587
-
588
- /**
589
- * Fires at the end of the update message container in each
590
- * row of the themes list table.
591
- *
592
- * The dynamic portion of the hook name, `$theme_key`, refers to
593
- * the theme slug as found in the WordPress.org themes repository.
594
- *
595
- * @since Wordpress 3.1.0
596
- * }
597
- */
598
- do_action( "in_theme_update_message-{$init}", $this->_plugins[ $init ], $r->changelog, $changelog_id );
599
-
600
- echo '</div></td></tr>';
601
- }
602
-
603
- /**
604
- * Remove the standard plugin_update_row
605
- *
606
- * Remove the standard plugin_update_row and Add a custom plugin update row in plugin page.
607
- *
608
- * @return void
609
- * @fire "in_theme_update_message-{$init}" action
610
- *
611
- * @since 1.0
612
- * @see after_plugin_row_{$init} action
613
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
614
- */
615
- public function remove_wp_plugin_update_row() {
616
- foreach ( $this->_plugins as $init => $plugin ) {
617
- remove_action( "after_plugin_row_{$init}", 'wp_plugin_update_row', 10 );
618
- add_action( "after_plugin_row_{$init}", array( $this, 'plugin_update_row' ) );
619
- }
620
- }
621
-
622
- public function in_theme_update_message( $plugin, $changelog, $changelog_id, $echo = true ) {
623
- $res = "<div id='{$changelog_id}' class='yit-plugin-changelog-wrapper'>
624
- <div class='yit-plugin-changelog'>
625
- <h2 class='yit-plugin-changelog-title'>{$plugin['info']['Name']} - Changelog</h2>
626
- <p>{$changelog}</p>
627
- </div>
628
- </div>";
629
-
630
- if ( $echo ) {
631
- echo $res;
632
- } else {
633
- return $res;
634
- }
635
- }
636
-
637
- /**
638
- * Auto-Update Plugin in multisite
639
- *
640
- * Manage the non standard upgrade-plugin-multisite action
641
- *
642
- * @return void
643
- *
644
- * @since 1.0
645
- * @see upgrade-plugin action
646
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
647
- */
648
- public function upgrade_plugin_multisite() {
649
-
650
- $plugin = isset( $_REQUEST['plugin'] ) ? trim( $_REQUEST['plugin'] ) : '';
651
- $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
652
-
653
- if ( 'upgrade-plugin-multisite' != $action ) {
654
- wp_die( __( 'You can\'t update the plugins for this site.', 'yith-plugin-fw' ) );
655
- }
656
-
657
- if ( ! current_user_can( 'update_plugins' ) ) {
658
- wp_die( __( 'You do not have sufficient permissions to update the plugins for this site.', 'yith-plugin-fw' ) );
659
- }
660
-
661
- $this->check_update( get_site_transient( 'update_plugins' ), true );
662
-
663
- check_admin_referer( 'upgrade-plugin-multisite_' . $plugin );
664
-
665
- $title = __( 'Update Plugin', 'yith-plugin-fw' );
666
- $parent_file = 'plugins.php';
667
- $submenu_file = 'plugins.php';
668
-
669
- wp_enqueue_script( 'updates' );
670
- require_once( ABSPATH . 'wp-admin/admin-header.php' );
671
-
672
- $nonce = 'upgrade-plugin-multisite_' . $plugin;
673
- $url = 'update.php?action=upgrade-plugin-multisite&plugin=' . urlencode( $plugin );
674
-
675
- $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'plugin' ) ) );
676
- $upgrader->upgrade( $plugin );
677
-
678
- include( ABSPATH . 'wp-admin/admin-footer.php' );
679
- }
680
-
681
- /**
682
- * Retreive the remote url with query string args
683
- *
684
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
685
- * @return string the remote url
686
- */
687
- public function get_remote_url( $plugin_info ) {
688
-
689
- $license = $is_membership_license = false;
690
- $slug = isset( $plugin_info['slug'] ) ? $plugin_info['slug'] : false;
691
-
692
- if( function_exists( 'YIT_Plugin_Licence' ) && false !== $slug ){
693
- //Get license for YITH Plugins
694
- $enabled_license = YIT_Plugin_Licence()->get_licence();
695
-
696
- if( isset( $enabled_license[ $slug ]['activated'] ) && false !== $enabled_license[ $slug ]['activated'] ){
697
- if( isset( $enabled_license[ $slug ]['licence_key'] ) ){
698
- $license = $enabled_license[ $slug ]['licence_key'];
699
- }
700
-
701
- if( isset( $enabled_license[ $slug ]['is_membership'] ) ){
702
- $is_membership_license = $enabled_license[ $slug ]['is_membership'];
703
- }
704
- }
705
- }
706
-
707
- $args = array(
708
- 'plugin' => $slug,
709
- 'instance' => md5( $_SERVER['SERVER_NAME'] ),
710
- 'license' => $license,
711
- 'is_membership_license' => $is_membership_license,
712
- 'server_ip' => $_SERVER['SERVER_ADDR'],
713
- 'version' => isset( $plugin_info['info']['Version'] ) ? $plugin_info['info']['Version'] : '1.0.0'
714
- );
715
-
716
- $args = apply_filters( 'yith_get_remove_url_args', $args );
717
-
718
- $url = add_query_arg( $args, $this->_remote_url );
719
-
720
- return $url;
721
- }
722
}
723
}
724
24
* @see WP_Updater Class
25
*/
26
class YIT_Upgrade {
27
/**
28
* @var YIT_Upgrade The main instance
29
*/
36
* @since 1.0
37
*/
38
public function __construct() {
39
+ //Silence is golden...
40
}
41
42
/**
51
* @author Andrea Grillo <andrea.grillo@yithemes.com>
52
*/
53
public function register( $plugin_slug, $plugin_init ) {
54
+ if( ! function_exists( 'YITH_Plugin_Upgrade' ) ){
55
+ //Try to load YITH_Plugin_Upgrade class
56
+ yith_plugin_fw_load_update_and_licence_files();
57
}
58
59
+ YITH_Plugin_Upgrade()->register( $plugin_slug, $plugin_init );
60
}
61
62
/**
75
76
return self::$_instance;
77
}
78
}
79
}
80
plugin-fw/licence/assets/css/yit-licence.css DELETED
@@ -1,461 +0,0 @@
1
- /* === Plugins Upgrader === */
2
-
3
- .yit-plugin-changelog-wrapper {
4
- display: none;
5
- }
6
-
7
- .yit-plugin-changelog-title {
8
- text-transform: uppercase;
9
- }
10
-
11
- .yit-plugin-changelog {
12
- height : calc(100% - 15px);
13
- width : calc(100% - 15px);
14
- overflow-x : hidden;
15
- overflow-y : auto;
16
- z-index : 999;
17
- background: #fcfcfc;
18
- }
19
-
20
- /* === Plugins Licence Activation === */
21
-
22
- .yit-container.product-licence-activation {
23
- font-family: 'Raleway', sans-serif;
24
- }
25
-
26
- .yit-container.product-licence-activation .to-active-wrapper {
27
- margin-bottom: 60px;
28
- max-width: 900px;
29
- }
30
-
31
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form {
32
- position: relative;
33
- border-color: #e1e1e1;
34
- border-style: solid;
35
- border-width: 0;
36
- }
37
-
38
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:first-child {
39
- border-top-width: 1px;
40
- }
41
-
42
- .yit-container.product-licence-activation .to-active-wrapper form.to-active-form:last-child {
43
- border-bottom-width: 1px;
44
- }
45
-
46
- .yit-container.product-licence-activation .to-active-wrapper table.to-active-table {
47
- border-width: 0;
48
- border-spacing: 0;
49
- width: 100%;
50
- }
51
-
52
- .yit-container.product-licence-activation .message {
53
- display: none;
54
- line-height: normal;
55
- background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
56
- padding-left: 65px;
57
- padding-right: 15px;
58
- width: 150px;
59
- }
60
-
61
- .yit-container.product-licence-activation .message-wrapper {
62
- height: 75px;
63
- display: none;
64
- position: absolute;
65
- top: 0;
66
- right: -250px;
67
- border: 1px solid #ff3838;
68
- }
69
-
70
- .yit-container.product-licence-activation .message-wrapper.visible {
71
- display: table;
72
- }
73
-
74
- .yit-container.product-licence-activation .message {
75
- display: table-cell;
76
- vertical-align: middle;
77
- }
78
-
79
- .yit-container.product-licence-activation .arrow-left:after,
80
- .yit-container.product-licence-activation .arrow-left:before {
81
- content: "";
82
- display: block;
83
- width: 0;
84
- height: 0;
85
- position: absolute;
86
- }
87
-
88
- .yit-container.product-licence-activation .arrow-left:before {
89
- border-top: 9px solid transparent;
90
- border-bottom: 9px solid transparent;
91
- border-right: 9px solid #ff3838;
92
- top: 26px;
93
- left: -9px;
94
- }
95
-
96
- .yit-container.product-licence-activation .arrow-left:after {
97
- border-top: 8px solid transparent;
98
- border-bottom: 8px solid transparent;
99
- border-right: 8px solid #fff;
100
- left: -8px;
101
- top: 27px;
102
- }
103
-
104
- .yit-container.product-licence-activation h2,
105
- .yit-container.product-licence-activation h3 {
106
- text-transform: uppercase;
107
- font-weight: 800;
108
- margin-bottom: 30px;
109
- }
110
-
111
- .yit-container.product-licence-activation h2 {
112
- color: #808a97;
113
- font-size: 25px;
114
- }
115
- .yit-container.product-licence-activation h3 {
116
- color: #313131;
117
- font-size: 15px;
118
- height: 20px;
119
- }
120
-
121
- .yit-container.product-licence-activation h3.to-active {
122
- height: 20px;
123
- position: relative;
124
- vertical-align: top;
125
- }
126
-
127
- .yit-container.product-licence-activation .spinner{
128
- vertical-align: -5px;
129
- float: none;
130
- }
131
-
132
- .yit-container.product-licence-activation .spinner.show{
133
- visibility: visible;
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 {
151
- border: 0;
152
- font-size: 13px;
153
- text-transform: uppercase;
154
- background-color: #808a97;
155
- color: #fff;
156
- font-weight: 700;
157
- border-radius: 3px;
158
- cursor: pointer;
159
- text-decoration: none;
160
- padding: 5px 7px;
161
- -webkit-transition: background-color 0.3s ease;
162
- -moz-transition: background-color 0.3s ease;
163
- -ms-transition: background-color 0.3s ease;
164
- -o-transition: background-color 0.3s ease;
165
- transition: background-color 0.3s ease;
166
- }
167
-
168
- .yit-container.product-licence-activation .button-licence:hover {
169
- background-color: #4d5c6f;
170
- }
171
-
172
- .yit-container.product-licence-activation .button-licence.clicked {
173
- cursor: not-allowed;
174
- background-color: #e2e2e2 !important;
175
- }
176
-
177
- .yit-container.product-licence-activation .button-licence.licence-check {
178
- font-weight: 400;
179
- padding: 12px 19px;
180
- }
181
-
182
- .yit-container.product-licence-activation .button-licence.licence-deactive,
183
- .yit-container.product-licence-activation .button-licence.licence-renew {
184
- text-decoration: none;
185
- padding: 7px 12px;
186
- font-size: 9px;
187
- }
188
-
189
- .yit-container.product-licence-activation table:not(.expired-table) .button-licence.licence-renew {
190
- margin-left: 10px;
191
- }
192
-
193
- .yit-container.product-licence-activation .button-licence.licence-deactive:focus,
194
- .yit-container.product-licence-activation .button-licence.licence-renew:focus {
195
- box-shadow: none;
196
- }
197
-
198
- .yit-container.product-licence-activation table:not(.to-active-table) {
199
- width: auto;
200
- border: 1px solid #dcdcdc;
201
- border-spacing: 0;
202
- border-radius: 5px;
203
- border-collapse: separate;
204
- overflow: hidden;
205
- }
206
-
207
- .yit-container.product-licence-activation table:not(.to-active-table) th {
208
- border-bottom: 1px solid #dcdcdc;
209
- padding: 0 10px;
210
- }
211
-
212
- .yit-container.product-licence-activation table tbody tr td.product-licence-key {
213
- text-transform: lowercase;
214
- }
215
-
216
- .yit-container.product-licence-activation table:not(.to-active-table) td,
217
- .yit-container.product-licence-activation table:not(.to-active-table) th {
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;
229
- }
230
-
231
- .yit-container.product-licence-activation table thead tr {
232
- background-color: #f6f4f4;
233
- }
234
-
235
- .yit-container.product-licence-activation table tbody tr {
236
- background-color: #ffffff;
237
- }
238
-
239
- .yit-container.product-licence-activation table tbody tr:nth-child(2n) {
240
- background-color: #f4f4f4;
241
- }
242
-
243
- .yit-container.product-licence-activation table thead tr th {
244
- font-size: 11px;
245
- color: #313131;
246
- text-transform: uppercase;
247
- font-weight: bold;
248
- }
249
-
250
- .yit-container.product-licence-activation table thead tr,
251
- .yit-container.product-licence-activation table tbody tr {
252
- line-height: 60px;
253
- }
254
-
255
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-no-alt {
256
- color: #b20015;
257
- }
258
-
259
- .yit-container.product-licence-activation table tbody tr td.product-licence-membership .dashicons-yes {
260
- color: #1ca800;
261
- }
262
-
263
- .yit-container.product-licence-activation table tbody tr td{
264
- text-align: center;
265
- line-height: 20px;
266
- padding: 10px 5px;
267
- }
268
-
269
- .yit-container.product-licence-activation .button-licence.licence-activation {
270
- padding: 12px 18px;
271
- }
272
-
273
- .yit-container.product-licence-activation .to-active-table tr {
274
- line-height: 75px;
275
- }
276
-
277
- .yit-container.product-licence-activation .to-active-table tr.product-row {
278
- background-color: transparent;
279
- -webkit-transition: all 0.3s ease;
280
- -moz-transition: all 0.3s ease;
281
- -ms-transition: all 0.3s ease;
282
- -o-transition: all 0.3s ease;
283
- transition: all 0.3s ease;
284
- }
285
-
286
- .yit-container.product-licence-activation .to-active-table tr.product-row.error {
287
- background-color: #ffdcdc;
288
- }
289
-
290
- .yit-container.product-licence-activation .to-active-table td {
291
- padding-right: 12px;
292
- width: 33%;
293
- }
294
-
295
- .yit-container.product-licence-activation td.product-name {
296
- color: #808a97;
297
- font-size: 12px;
298
- text-transform: uppercase;
299
- font-weight: bold;
300
- line-height: 20px;
301
- padding: 10px 20px;
302
- }
303
-
304
- .yit-container.product-licence-activation .to-active-table td.product-name {
305
- width: 20%;
306
- }
307
-
308
- .yit-container.product-licence-activation .to-active-table td.activate-button {
309
- width: 15%;
310
- position: relative;
311
- }
312
-
313
- .yit-container.product-licence-activation input[type=text],
314
- .yit-container.product-licence-activation input[type=email]{
315
- -webkit-transition: all 0.3s ease;
316
- -moz-transition: all 0.3s ease;
317
- -ms-transition: all 0.3s ease;
318
- -o-transition: all 0.3s ease;
319
- transition: all 0.3s ease;
320
-
321
- border: 1px solid #dcdcdc;
322
- padding: 0 15px;
323
- border-radius: 3px;
324
- height: 41px;
325
- width: 100%;
326
- }
327
-
328
- .yit-container.product-licence-activation input[type=text].require,
329
- .yit-container.product-licence-activation input[type=email].require {
330
- border: 1px solid #ff3838;
331
- }
332
-
333
- .yit-container.product-licence-activation input[type=text]:focus,
334
- .yit-container.product-licence-activation input[type=email]:focus{
335
- webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
336
- box-shadow: 0 0 1px rgba(30,140,190,.8);
337
- }
338
-
339
- .yit-container.product-licence-activation input[type=text],
340
- .yit-container.product-licence-activation input[type=email]{
341
- text-transform: uppercase;
342
- text-align: center;
343
- }
344
-
345
- .yit-container.product-licence-activation input[type=submit]:focus{
346
- outline: 0;
347
- }
348
-
349
- /* Licence FAQ */
350
- .yit-container.product-licence-activation .activation-faq {
351
- background: #ffffff;
352
- margin-bottom: 20px;
353
- border: 1px solid #dcdcdc;
354
- padding: 0 15px;
355
- border-radius: 3px;
356
- }
357
-
358
- .yit-container.product-licence-activation .activation-faq h3{
359
- color: #808a97;
360
- }
361
-
362
- #yith-licence-notice {
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) {
386
- .yit-container.product-licence-activation .activation-faq {
387
- margin-right: 5px;
388
- }
389
- }
390
-
391
- @media (max-width: 480px) {
392
- .yit-container.product-licence-activation .activation-faq {
393
- margin-right: 5px;
394
- }
395
- }
396
-
397
- @media (min-width: 768px) and (max-width: 992px) {
398
- .yit-container.product-licence-activation .button-licence.licence-deactive,
399
- .yit-container.product-licence-activation .button-licence.licence-renew {
400
- margin-bottom: 10px;
401
- display: block;
402
- margin-left: 0;
403
- padding: 5px 7px;
404
- }
405
-
406
- .yit-container.product-licence-activation .button-licence.licence-deactive {
407
- margin-bottom: 10px;
408
- }
409
-
410
- .yit-container.product-licence-activation table:not(.to-active-table) th {
411
- line-height: 20px;
412
- }
413
-
414
- .yit-container.product-licence-activation table tbody tr td {
415
- padding: 5px;
416
- }
417
-
418
- .yit-container.product-licence-activation .activation-faq {
419
- margin-right: 20px;
420
- }
421
- }
422
-
423
- @media (min-width: 980px) and (max-width: 1199px) {
424
- .yit-container.product-licence-activation .button-licence.licence-deactive,
425
- .yit-container.product-licence-activation .button-licence.licence-renew {
426
- display: block;
427
- margin-left: 0;
428
- padding: 5px 7px;
429
- }
430
-
431
- .yit-container.product-licence-activation .button-licence.licence-renew {
432
- margin-top: 10px;
433
- }
434
-
435
- .yit-container.product-licence-activation table:not(.to-active-table) th {
436
- line-height: 20px;
437
- }
438
-
439
- .yit-container.product-licence-activation table tbody tr td {
440
- padding: 5px;
441
- }
442
-
443
- .yit-container.product-licence-activation .activation-faq {
444
- width: 75%;
445
- }
446
- }
447
-
448
- @media (min-width: 1200px) {
449
- .yit-container.product-licence-activation{
450
- width: auto;
451
- }
452
-
453
- .yit-container.product-licence-activation .activation-faq {
454
- width: 50%;
455
- }
456
- }
457
-
458
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5),
459
- only screen and (-o-min-device-pixel-ratio: 3/2),
460
- only screen and (min--moz-device-pixel-ratio: 1.5),
461
- only screen and (min-device-pixel-ratio: 1.5) {}
plugin-fw/licence/assets/images/licence-error.png DELETED
Binary file
plugin-fw/licence/assets/js/yit-licence.js DELETED
@@ -1,215 +0,0 @@
1
- /**
2
- * This file belongs to the YIT Plugin Framework.
3
- *
4
- * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
5
- * that is bundled with this package in the file LICENSE.txt.
6
- * It is also available through the world-wide-web at this URL:
7
- * http://www.gnu.org/licenses/gpl-3.0.txt
8
- */
9
-
10
-
11
- ( function ( $ ) {
12
-
13
- /* === Licence API === */
14
-
15
- var licence_activation = function ( button ) {
16
- button.on( 'click', function ( e, button ) {
17
- e.preventDefault();
18
-
19
- var t = $( this ),
20
- form_id = t.data( 'formid' ),
21
- form = $( '#' + form_id ),
22
- data = form.serialize(),
23
- message = $( form ).find( '.message' ),
24
- message_wrapper = $( form ).find( '.message-wrapper' ),
25
- email = form.find( '.user-email' ),
26
- licence_key = form.find( '.licence-key' ),
27
- email_val = form.find( '.user-email' ).val(),
28
- licence_key_val = form.find( '.licence-key' ).val(),
29
- error = false,
30
- error_fields = new Array(),
31
- product_row = form.find( '.product-row' ),
32
- licence_activation = $( '.licence-activation' ),
33
- spinner = $( '#products-to-active' ).find( '.spinner' ),
34
- is_mail = function( val ){
35
- /* https://stackoverflow.com/questions/2855865/jquery-validate-e-mail-address-regex */
36
- var re = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?#x2F;i);
37
- return re.test( val );
38
- };
39
-
40
- /* Init Input Fields */
41
- message.empty();
42
- message_wrapper.removeClass( 'visible' );
43
- email.removeClass( 'require' );
44
- licence_key.removeClass( 'require' );
45
- product_row.removeClass( 'error' );
46
- spinner.addClass( 'show' );
47
- t.add( licence_activation ).prop( "disabled", true ).addClass( 'clicked' );
48
-
49
- if ( '' === email_val || ! is_mail( email_val ) ) {
50
- error = true;
51
- email.addClass( 'require' );
52
-
53
- if( '' === email_val ){
54
- error_fields[ error_fields.length ] = licence_message.email;
55
- }
56
-
57
- else {
58
- error_fields[ error_fields.length ] = licence_message.email;
59
- }
60
-
61
- }
62
-
63
- if ( '' === licence_key_val ) {
64
- error = true;
65
- error_fields[ error_fields.length ] = licence_message.license_key;
66
- licence_key.addClass( 'require' );
67
- }
68
-
69
- if ( false === error ) {
70
- jQuery.ajax( {
71
- type : 'POST',
72
- url : typeof ajaxurl != 'undefined' ? ajaxurl : yith_ajax.url,
73
- data : data,
74
- success: function ( response ) {
75
-
76
- spinner.removeClass( 'show' );
77
- t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
78
-
79
- if ( true === response.activated ) {
80
- $( '.product-licence-activation' ).empty().replaceWith( response.template );
81
- licence_api();
82
- } else if ( false !== response && typeof response.error !== 'undefined' ) {
83
- message.text( response.error );
84
- message_wrapper.addClass( 'visible' );
85
- product_row.addClass( 'error' );
86
- } else {
87
- message.text( licence_message.server );
88
- message_wrapper.addClass( 'visible' );
89
- product_row.addClass( 'error' );
90
- }
91
-
92
- if ( typeof response.debug !== 'undefined' ) {
93
- console.log( response.debug );
94
- }
95
- }
96
- } );
97
- } else {
98
- if ( error_fields.length == 1 ) {
99
- message.text( licence_message.error.replace( '%field%', error_fields[ 0 ] ) );
100
- message_wrapper.addClass( 'visible' );
101
- product_row.addClass( 'error' );
102
- } else {
103
- var message_text = licence_message.errors;
104
- for ( var i = 0; i < error_fields.length; i++ ) {
105
- message_text = message_text.replace( '%field_' + ( i + 1 ) + '%', error_fields[ i ] );
106
- message_wrapper.addClass( 'visible' );
107
- }
108
- message.text( message_text );
109
- message_wrapper.addClass( 'visible' );
110
- product_row.addClass( 'error' );
111
- }
112
-
113
- spinner.removeClass( 'show' );
114
- t.add( licence_activation ).prop( "disabled", false ).removeClass( 'clicked' );
115
- }
116
- } );
117
- };
118
-
119
- var licence_update = function ( button ) {
120