Version Description
Released on 07th June, 2019 =
Update: YITH Plugin Framework
Download this release
Release Info
Developer | yithemes |
Plugin | YITH Essential Kit for WooCommerce #1 |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- README.txt +7 -2
- init.php +3 -3
- plugin-fw/init.php +65 -4
- plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
- plugin-fw/languages/yith-plugin-fw-it_IT.po +31 -20
- plugin-fw/lib/yit-assets.php +0 -1
- plugin-fw/lib/yit-plugin-licence.php +116 -0
- plugin-fw/lib/yit-theme-licence.php +94 -0
- plugin-fw/lib/yit-upgrade.php +5 -649
- plugin-fw/licence/assets/css/yit-licence.css +0 -461
- plugin-fw/licence/assets/images/licence-error.png +0 -0
- plugin-fw/licence/assets/js/yit-licence.js +0 -215
- plugin-fw/licence/assets/js/yit-licence.min.js +0 -8
- plugin-fw/licence/lib/yit-licence.php +0 -804
- plugin-fw/licence/lib/yit-plugin-licence.php +0 -243
- plugin-fw/licence/lib/yit-theme-licence.php +0 -191
- plugin-fw/licence/templates/panel/activation/activation-panel.php +0 -247
- plugin-fw/yit-functions.php +41 -0
- plugin-fw/yit-plugin.php +3 -4
README.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce,yith woocommerce colors and labels variations,yith woocommerce zoom magnifier,yith woocommerce wishlist,yith woocommerce ajax product filter,yith woocommerce ajax search,yith woocommerce catalog mode,yith woocommerce advanced reviews, yith woocommerce badges management,yith woocommerce cart messages,yith woocommerce review reminder,yith woocommerce quick view,yith woocommerce mailchimp,yith woocommerce stripe,yith woocommerce request a quote,yith woocommerce tab manager,yith woocommerce multi vendor
|
5 |
Requires at least: 3.5.1
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -151,6 +151,11 @@ YITH Essential Kit for WooCommerce #1 will add a new submenu called "YITH Essent
|
|
151 |
|
152 |
== Changelog ==
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
= 2.0.4 =
|
155 |
|
156 |
* Update: YITH Plugin Framework
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce,yith woocommerce colors and labels variations,yith woocommerce zoom magnifier,yith woocommerce wishlist,yith woocommerce ajax product filter,yith woocommerce ajax search,yith woocommerce catalog mode,yith woocommerce advanced reviews, yith woocommerce badges management,yith woocommerce cart messages,yith woocommerce review reminder,yith woocommerce quick view,yith woocommerce mailchimp,yith woocommerce stripe,yith woocommerce request a quote,yith woocommerce tab manager,yith woocommerce multi vendor
|
5 |
Requires at least: 3.5.1
|
6 |
+
Tested up to: 5.2
|
7 |
+
Stable tag: 2.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
151 |
|
152 |
== Changelog ==
|
153 |
|
154 |
+
= 2.0.5 - Released on 07th June, 2019 =
|
155 |
+
|
156 |
+
* Update: YITH Plugin Framework
|
157 |
+
|
158 |
+
|
159 |
= 2.0.4 =
|
160 |
|
161 |
* Update: YITH Plugin Framework
|
init.php
CHANGED
@@ -7,12 +7,12 @@
|
|
7 |
* Domain Path: /languages/
|
8 |
* Author: YITH
|
9 |
* Author URI: https://yithemes.com/
|
10 |
-
* Version: 2.0.
|
11 |
* WC requires at least: 2.5.0
|
12 |
-
* WC tested up to: 3.
|
13 |
* @author YITHEMES
|
14 |
* @package YITH Essential Kit for Woocommerce #1
|
15 |
-
* @version 2.0.
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
* Domain Path: /languages/
|
8 |
* Author: YITH
|
9 |
* Author URI: https://yithemes.com/
|
10 |
+
* Version: 2.0.5
|
11 |
* WC requires at least: 2.5.0
|
12 |
+
* WC tested up to: 3.6
|
13 |
* @author YITHEMES
|
14 |
* @package YITH Essential Kit for Woocommerce #1
|
15 |
+
* @version 2.0.5
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
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/
|
@@ -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 |
-
|
43 |
-
|
|
|
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-
|
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.
|
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 "
|
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 |
-
|
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 |
-
|
121 |
-
|
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 . '§ion=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 |
-
|
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( '/-.*$/', '', $tested_up_to );
|
486 |
-
$wp_version = preg_replace( '/-.*$/', '', 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 . '§ion=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])))\.?$/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 |
-
button.on( 'click', function ( e ) {
|
121 |
-
e.preventDefault();
|
122 |
-
|
123 |
-
var t = $( this ),
|
124 |
-
form = $( '#licence-check-update' ),
|
125 |
-
data = form.serialize();
|
126 |
-
|
127 |
-
t.prop( "disabled", true ).addClass( 'clicked' );
|
128 |
-
form.find( 'div.spinner' ).addClass( 'show' );
|
129 |
-
|
130 |
-
jQuery.ajax( {
|
131 |
-
type : 'POST',
|
132 |
-
url : ajaxurl,
|
133 |
-
data : data,
|
134 |
-
success: function ( response ) {
|
135 |
-
$( '.product-licence-activation' ).empty().replaceWith( response.template );
|
136 |
-
licence_api();
|
137 |
-
}
|
138 |
-
} );
|
139 |
-
} );
|
140 |
-
};
|
141 |
-
|
142 |
-
var licence_deactivate = function ( button ) {
|
143 |
-
button.on( 'click', function ( e ) {
|
144 |
-
e.preventDefault();
|
145 |
-
|
146 |
-
var check = script_info.is_debug == true ? true : confirm( licence_message.are_you_sure );
|
147 |
-
|
148 |
-
if ( check == true ) {
|
149 |
-
var t = $( this ),
|
150 |
-
licence_key = t.data( 'licence-key' ),
|
151 |
-
licence_email = t.data( 'licence-email' ),
|
152 |
-
product_init = t.data( 'product-init' ),
|
153 |
-
action = t.data( 'action' ),
|
154 |
-
renew = $( '.licence-renew' ),
|
155 |
-
deactive = $( '.licence-deactive' ),
|
156 |
-
message = $( '#yith-licence-notice' ),
|
157 |
-
activated_table = $( '.activated-table' );
|
158 |
-
|
159 |
-
t.add( renew ).add( deactive ).prop( "disabled", true ).addClass( 'clicked' );
|
160 |
-
$( '#activated-products' ).find( '.spinner' ).addClass( 'show' );
|
161 |
-
|
162 |
-
jQuery.ajax( {
|
163 |
-
type : 'POST',
|
164 |
-
url : ajaxurl,
|
165 |
-
data : {
|
166 |
-
action : action,
|
167 |
-
licence_key : licence_key,
|
168 |
-
email : licence_email,
|
169 |
-
product_init: product_init
|
170 |
-
},
|
171 |
-
success: function ( response ) {
|
172 |
-
message.css( 'maxWidth', activated_table.width() );
|
173 |
-
if ( false == response ) {
|
174 |
-
message.find( 'p.yith-licence-notice-message' ).html( licence_message.server );
|
175 |
-
message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
|
176 |
-
t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
|
177 |
-
$( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
|
178 |
-
}
|
179 |
-
|
180 |
-
else {
|
181 |
-
if ( false == response.activated ) {
|
182 |
-
$( '.product-licence-activation' ).empty().replaceWith( response.template );
|
183 |
-
licence_api();
|
184 |
-
}
|
185 |
-
|
186 |
-
if ( typeof response.error != 'undefined' ) {
|
187 |
-
message.find( 'p.yith-licence-notice-message' ).html( response.error );
|
188 |
-
message.removeClass( 'notice-success' ).addClass( 'notice-error visible' );
|
189 |
-
t.add( renew ).add( deactive ).add( renew ).prop( "disabled", false ).removeClass( 'clicked' );
|
190 |
-
$( '#activated-products' ).find( '.spinner' ).removeClass( 'show' );
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
} );
|
195 |
-
}
|
196 |
-
} );
|
197 |
-
};
|
198 |
-
|
199 |
-
var licence_api = function () {
|
200 |
-
var button = $( '.licence-activation' ),
|
201 |
-
check = $( '.licence-check' ),
|
202 |
-
deactivated = $( '.licence-deactive' );
|
203 |
-
|
204 |
-
licence_activation( button );
|
205 |
-
licence_update( check );
|
206 |
-
licence_deactivate( deactivated );
|
207 |
-
};
|
208 |
-
|
209 |
-
licence_api();
|
210 |
-
|
211 |
-
$( 'body' ).on( 'click', '.yit-changelog-button', function ( e ) {
|
212 |
-
$( '#TB_window' ).remove();
|
213 |
-
} );
|
214 |
-
|
215 |
-
} )( jQuery );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/licence/assets/js/yit-licence.min.js
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
(function(b){var t=function(c){c.on("click",function(k,e){k.preventDefault();var c=b(this),a=c.data("formid"),d=b("#"+a),f=d.serialize(),h=b(d).find(".message"),g=b(d).find(".message-wrapper"),l=d.find(".user-email"),u=d.find(".licence-key"),v=d.find(".user-email").val(),t=d.find(".licence-key").val(),n=!1;a=[];var p=d.find(".product-row"),q=b(".licence-activation"),r=b("#products-to-active").find(".spinner");h.empty();g.removeClass("visible");l.removeClass("require");u.removeClass("require");p.removeClass("error");
|
2 |
-
r.addClass("show");c.add(q).prop("disabled",!0).addClass("clicked");""!==v&&(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])))\.?$/i)).test(v)||
|
3 |
-
(n=!0,l.addClass("require"),a[a.length]=licence_message.email);""===t&&(n=!0,a[a.length]=licence_message.license_key,u.addClass("require"));if(!1===n)jQuery.ajax({type:"POST",url:"undefined"!=typeof ajaxurl?ajaxurl:yith_ajax.url,data:f,success:function(a){r.removeClass("show");c.add(q).prop("disabled",!1).removeClass("clicked");!0===a.activated?(b(".product-licence-activation").empty().replaceWith(a.template),m()):(!1!==a&&"undefined"!==typeof a.error?h.text(a.error):h.text(licence_message.server),
|
4 |
-
g.addClass("visible"),p.addClass("error"));"undefined"!==typeof a.debug&&console.log(a.debug)}});else{if(1==a.length)h.text(licence_message.error.replace("%field%",a[0]));else{d=licence_message.errors;for(f=0;f<a.length;f++)d=d.replace("%field_"+(f+1)+"%",a[f]),g.addClass("visible");h.text(d)}g.addClass("visible");p.addClass("error");r.removeClass("show");c.add(q).prop("disabled",!1).removeClass("clicked")}})},w=function(c){c.on("click",function(c){c.preventDefault();c=b(this);var e=b("#licence-check-update"),
|
5 |
-
k=e.serialize();c.prop("disabled",!0).addClass("clicked");e.find("div.spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:k,success:function(a){b(".product-licence-activation").empty().replaceWith(a.template);m()}})})},x=function(c){c.on("click",function(c){c.preventDefault();if(1==(1==script_info.is_debug?!0:confirm(licence_message.are_you_sure))){var e=b(this);c=e.data("licence-key");var k=e.data("licence-email"),a=e.data("product-init"),d=e.data("action"),f=b(".licence-renew"),
|
6 |
-
h=b(".licence-deactive"),g=b("#yith-licence-notice"),l=b(".activated-table");e.add(f).add(h).prop("disabled",!0).addClass("clicked");b("#activated-products").find(".spinner").addClass("show");jQuery.ajax({type:"POST",url:ajaxurl,data:{action:d,licence_key:c,email:k,product_init:a},success:function(a){g.css("maxWidth",l.width());0==a?(g.find("p.yith-licence-notice-message").html(licence_message.server),g.removeClass("notice-success").addClass("notice-error visible"),e.add(f).add(h).add(f).prop("disabled",
|
7 |
-
!1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show")):(0==a.activated&&(b(".product-licence-activation").empty().replaceWith(a.template),m()),"undefined"!=typeof a.error&&(g.find("p.yith-licence-notice-message").html(a.error),g.removeClass("notice-success").addClass("notice-error visible"),e.add(f).add(h).add(f).prop("disabled",!1).removeClass("clicked"),b("#activated-products").find(".spinner").removeClass("show")))}})}})},m=function(){var c=b(".licence-activation"),
|
8 |
-
k=b(".licence-check"),e=b(".licence-deactive");t(c);w(k);x(e)};m();b("body").on("click",".yit-changelog-button",function(c){b("#TB_window").remove()})})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/licence/lib/yit-licence.php
DELETED
@@ -1,804 +0,0 @@
|
|
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_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 |
-
abstract class YIT_Licence {
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var mixed array The registered products info
|
30 |
-
* @since 1.0
|
31 |
-
*/
|
32 |
-
protected $_products = array();
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var array The settings require to add the submenu page "Activation"
|
36 |
-
* @since 1.0
|
37 |
-
*/
|
38 |
-
protected $_settings = array();
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var string Option name
|
42 |
-
* @since 1.0
|
43 |
-
*/
|
44 |
-
protected $_licence_option = 'yit_products_licence_activation';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string The yithemes api uri
|
48 |
-
* @since 1.0
|
49 |
-
*/
|
50 |
-
protected $_api_uri = 'https://yithemes.com';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var string The yithemes api uri query args
|
54 |
-
* @since 1.0
|
55 |
-
*/
|
56 |
-
protected $_api_uri_query_args = '?wc-api=software-api&request=%request%';
|
57 |
-
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @var string check for show extra info
|
61 |
-
* @since 1.0
|
62 |
-
*/
|
63 |
-
public $show_extra_info = false;
|
64 |
-
|
65 |
-
/**
|
66 |
-
* @var string check for show extra info
|
67 |
-
* @since 1.0
|
68 |
-
*/
|
69 |
-
public $show_renew_button = true;
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Constructor
|
73 |
-
*
|
74 |
-
* @since 1.0
|
75 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
76 |
-
*/
|
77 |
-
public function __construct() {
|
78 |
-
$is_debug_enabled = defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG;
|
79 |
-
if ( $is_debug_enabled ) {
|
80 |
-
$this->_api_uri = defined( 'YIT_LICENCE_DEBUG_LOCALHOST' ) ? YIT_LICENCE_DEBUG_LOCALHOST : 'http://dev.yithemes.com';
|
81 |
-
add_filter( 'block_local_requests', '__return_false' );
|
82 |
-
}
|
83 |
-
|
84 |
-
/* Style adn Script */
|
85 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
86 |
-
if ( $is_debug_enabled ) {
|
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 |
-
/**
|
96 |
-
* Premium products registration
|
97 |
-
*
|
98 |
-
* @param $init string | The products identifier
|
99 |
-
* @param $secret_key string | The secret key
|
100 |
-
* @param $product_id string | The product id
|
101 |
-
*
|
102 |
-
* @return void
|
103 |
-
*
|
104 |
-
* @since 1.0
|
105 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
106 |
-
*/
|
107 |
-
abstract public function register( $init, $secret_key, $product_id );
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Get protected array products
|
111 |
-
*
|
112 |
-
* @return mixed array
|
113 |
-
*
|
114 |
-
* @since 1.0
|
115 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
116 |
-
*/
|
117 |
-
public function get_products() {
|
118 |
-
return $this->_products;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Get The home url without protocol
|
123 |
-
*
|
124 |
-
* @return string the home url
|
125 |
-
*
|
126 |
-
* @since 1.0
|
127 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
128 |
-
*/
|
129 |
-
public function get_home_url() {
|
130 |
-
$home_url = home_url();
|
131 |
-
$schemes = array( 'https://', 'http://', 'www.' );
|
132 |
-
|
133 |
-
foreach ( $schemes as $scheme ) {
|
134 |
-
$home_url = str_replace( $scheme, '', $home_url );
|
135 |
-
}
|
136 |
-
|
137 |
-
if ( strpos( $home_url, '?' ) !== false ) {
|
138 |
-
list( $base, $query ) = explode( '?', $home_url, 2 );
|
139 |
-
$home_url = $base;
|
140 |
-
}
|
141 |
-
|
142 |
-
$home_url = untrailingslashit( $home_url );
|
143 |
-
|
144 |
-
return $home_url;
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Check if the request is ajax
|
149 |
-
*
|
150 |
-
* @return bool true if the request is ajax, false otherwise
|
151 |
-
*
|
152 |
-
* @since 1.0
|
153 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
154 |
-
*/
|
155 |
-
public function is_ajax() {
|
156 |
-
return defined( 'DOING_AJAX' ) && DOING_AJAX ? true : false;
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Admin Enqueue Scripts
|
161 |
-
*
|
162 |
-
* @return void
|
163 |
-
*
|
164 |
-
* @since 1.0
|
165 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
166 |
-
*/
|
167 |
-
public function admin_enqueue_scripts() {
|
168 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
169 |
-
/**
|
170 |
-
* Support to YIT Framework < 2.0
|
171 |
-
*/
|
172 |
-
$script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
173 |
-
$style_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
174 |
-
|
175 |
-
wp_register_script( 'yit-licence', $script_path . '/licence/assets/js/yit-licence' . $suffix . '.js', array( 'jquery' ), '1.0.0', true );
|
176 |
-
wp_register_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
|
177 |
-
|
178 |
-
/* Localize Scripts */
|
179 |
-
wp_localize_script( 'yit-licence', 'licence_message', array(
|
180 |
-
'error' => sprintf( _x( 'Please, insert a valid %s', '%s = field name', 'yith-plugin-fw' ), '%field%' ), // sprintf must be used to avoid errors with '%field%' string in translation in .po file
|
181 |
-
'errors' => sprintf( __( 'Please, insert a valid %s and a valid %s', 'yith-plugin-fw' ), '%field_1%', '%field_2%' ),
|
182 |
-
'server' => __( 'Unable to contact the remote server, please try again later. Thanks!', 'yith-plugin-fw' ),
|
183 |
-
'email' => __( 'email address', 'yith-plugin-fw' ),
|
184 |
-
'license_key' => __( 'license key', 'yith-plugin-fw' ),
|
185 |
-
'are_you_sure' => __( 'Are you sure you want to deactivate the license for current site?', 'yith-plugin-fw' )
|
186 |
-
)
|
187 |
-
);
|
188 |
-
|
189 |
-
wp_localize_script( 'yit-licence', 'script_info', array(
|
190 |
-
'is_debug' => defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG
|
191 |
-
)
|
192 |
-
);
|
193 |
-
|
194 |
-
wp_localize_script( 'yit-licence', 'yith_ajax', array(
|
195 |
-
'url' => admin_url( 'admin-ajax.php', 'relative' )
|
196 |
-
)
|
197 |
-
);
|
198 |
-
|
199 |
-
/* Enqueue Scripts only in Licence Activation page of plugins and themes */
|
200 |
-
if ( strpos( get_current_screen()->id, 'yith_plugins_activation' ) !== false || strpos( get_current_screen()->id, 'yit_panel_license' ) !== false ) {
|
201 |
-
wp_enqueue_script( 'yit-licence' );
|
202 |
-
wp_enqueue_style( 'yit-theme-licence' );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Activate Plugins
|
208 |
-
*
|
209 |
-
* Send a request to API server to activate plugins
|
210 |
-
*
|
211 |
-
* @return void
|
212 |
-
* @use wp_send_json
|
213 |
-
*
|
214 |
-
* @since 1.0
|
215 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
216 |
-
*/
|
217 |
-
public function activate() {
|
218 |
-
$product_init = $_REQUEST[ 'product_init' ];
|
219 |
-
$product = $this->get_product( $product_init );
|
220 |
-
|
221 |
-
$args = array(
|
222 |
-
'email' => urlencode( sanitize_email( $_REQUEST[ 'email' ] ) ),
|
223 |
-
'licence_key' => sanitize_text_field( $_REQUEST[ 'licence_key' ] ),
|
224 |
-
'product_id' => sanitize_text_field( $product[ 'product_id' ] ),
|
225 |
-
'secret_key' => sanitize_text_field( $product[ 'secret_key' ] ),
|
226 |
-
'instance' => $this->get_home_url()
|
227 |
-
);
|
228 |
-
|
229 |
-
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'activation' ) ) );
|
230 |
-
$timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
|
231 |
-
$response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
|
232 |
-
|
233 |
-
if ( is_wp_error( $response ) ) {
|
234 |
-
$body = false;
|
235 |
-
} else {
|
236 |
-
$body = json_decode( $response[ 'body' ] );
|
237 |
-
$body = is_object( $body ) ? get_object_vars( $body ) : false;
|
238 |
-
}
|
239 |
-
|
240 |
-
if ( $body && is_array( $body ) && isset( $body[ 'activated' ] ) && $body[ 'activated' ] ) {
|
241 |
-
|
242 |
-
$option[ $product[ 'product_id' ] ] = array(
|
243 |
-
'email' => urldecode( $args[ 'email' ] ),
|
244 |
-
'licence_key' => $args[ 'licence_key' ],
|
245 |
-
'licence_expires' => $body[ 'licence_expires' ],
|
246 |
-
'message' => $body[ 'message' ],
|
247 |
-
'activated' => true,
|
248 |
-
'activation_limit' => $body[ 'activation_limit' ],
|
249 |
-
'activation_remaining' => $body[ 'activation_remaining' ],
|
250 |
-
'is_membership' => isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false,
|
251 |
-
);
|
252 |
-
|
253 |
-
/* === Check for other plugins activation === */
|
254 |
-
$options = $this->get_licence();
|
255 |
-
$options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
|
256 |
-
|
257 |
-
update_option( $this->_licence_option, $options );
|
258 |
-
|
259 |
-
/* === Update Plugin Licence Information === */
|
260 |
-
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
261 |
-
|
262 |
-
/* === Licence Activation Template === */
|
263 |
-
$body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 200 ) );
|
264 |
-
}
|
265 |
-
|
266 |
-
if ( !empty( $_REQUEST[ 'debug' ] ) ) {
|
267 |
-
$body = is_array( $body ) ? $body : array();
|
268 |
-
$body[ 'debug' ] = array( 'response' => $response );
|
269 |
-
if ( 'print_r' === $_REQUEST[ 'debug' ] ) {
|
270 |
-
$body[ 'debug' ] = print_r( $body[ 'debug' ], true );
|
271 |
-
}
|
272 |
-
}
|
273 |
-
|
274 |
-
wp_send_json( $body );
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Deactivate Plugins
|
279 |
-
*
|
280 |
-
* Send a request to API server to activate plugins
|
281 |
-
*
|
282 |
-
* @return void
|
283 |
-
* @use wp_send_json
|
284 |
-
*
|
285 |
-
* @since 1.0
|
286 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
287 |
-
*/
|
288 |
-
public function deactivate() {
|
289 |
-
$product_init = $_REQUEST[ 'product_init' ];
|
290 |
-
$product = $this->get_product( $product_init );
|
291 |
-
|
292 |
-
$args = array(
|
293 |
-
'email' => urlencode( sanitize_email( $_REQUEST[ 'email' ] ) ),
|
294 |
-
'licence_key' => sanitize_text_field( $_REQUEST[ 'licence_key' ] ),
|
295 |
-
'product_id' => sanitize_text_field( $product[ 'product_id' ] ),
|
296 |
-
'secret_key' => sanitize_text_field( $product[ 'secret_key' ] ),
|
297 |
-
'instance' => $this->get_home_url()
|
298 |
-
);
|
299 |
-
|
300 |
-
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'deactivation' ) ) );
|
301 |
-
$timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
|
302 |
-
$response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
|
303 |
-
|
304 |
-
if ( is_wp_error( $response ) ) {
|
305 |
-
$body = false;
|
306 |
-
} else {
|
307 |
-
$body = json_decode( $response[ 'body' ] );
|
308 |
-
$body = is_object( $body ) ? get_object_vars( $body ) : false;
|
309 |
-
}
|
310 |
-
|
311 |
-
if ( $body && is_array( $body ) ) {
|
312 |
-
/* === Get License === */
|
313 |
-
$options = $this->get_licence();
|
314 |
-
if( isset( $body[ 'activated' ] ) && ! $body[ 'activated' ] && ! isset( $body[ 'error' ] ) ){
|
315 |
-
$option[ $product[ 'product_id' ] ] = array(
|
316 |
-
'activated' => false,
|
317 |
-
'email' => urldecode( $args[ 'email' ] ),
|
318 |
-
'licence_key' => $args[ 'licence_key' ],
|
319 |
-
'licence_expires' => $body[ 'licence_expires' ],
|
320 |
-
'message' => $body[ 'message' ],
|
321 |
-
'activation_limit' => $body[ 'activation_limit' ],
|
322 |
-
'activation_remaining' => $body[ 'activation_remaining' ],
|
323 |
-
'is_membership' => isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false,
|
324 |
-
);
|
325 |
-
|
326 |
-
/* === Check for other plugins activation === */
|
327 |
-
$options[ $product[ 'product_id' ] ] = $option[ $product[ 'product_id' ] ];
|
328 |
-
|
329 |
-
/* === Update Plugin Licence Information === */
|
330 |
-
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
331 |
-
|
332 |
-
update_option( $this->_licence_option, $options );
|
333 |
-
|
334 |
-
/* === Licence Activation Template === */
|
335 |
-
$body[ 'template' ] = $this->show_activation_panel( $this->get_response_code_message( 'deactivated', array( 'instance' => $body[ 'instance' ] ) ) );
|
336 |
-
}
|
337 |
-
|
338 |
-
else {
|
339 |
-
$body[ 'error' ] = $this->get_response_code_message( $body[ 'code' ] );
|
340 |
-
|
341 |
-
switch ( $body[ 'code' ] ) {
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Error Code List:
|
345 |
-
*
|
346 |
-
* 100 -> Invalid Request
|
347 |
-
* 101 -> Invalid licence key
|
348 |
-
* 102 -> Software has been deactivate
|
349 |
-
* 103 -> Exceeded maximum number of activations
|
350 |
-
* 104 -> Invalid instance ID
|
351 |
-
* 105 -> Invalid security key
|
352 |
-
* 106 -> Licence key has expired
|
353 |
-
* 107 -> Licence key has be banned
|
354 |
-
*
|
355 |
-
* Only code 101, 106 and 107 have effect on DB during activation
|
356 |
-
* All error code have effect on DB during deactivation
|
357 |
-
*
|
358 |
-
*/
|
359 |
-
|
360 |
-
case '101':
|
361 |
-
case '102':
|
362 |
-
case '104':
|
363 |
-
unset( $options[ $product[ 'product_id' ] ] );
|
364 |
-
break;
|
365 |
-
|
366 |
-
case '106':
|
367 |
-
$options[ $product[ 'product_id' ] ][ 'activated' ] = false;
|
368 |
-
$options[ $product[ 'product_id' ] ][ 'message' ] = $body[ 'error' ];
|
369 |
-
$options[ $product[ 'product_id' ] ][ 'status_code' ] = $body[ 'code' ];
|
370 |
-
$options[ $product[ 'product_id' ] ][ 'licence_expires' ] = $body[ 'licence_expires' ];
|
371 |
-
break;
|
372 |
-
|
373 |
-
case '107':
|
374 |
-
$options[ $product[ 'product_id' ] ][ 'activated' ] = false;
|
375 |
-
$options[ $product[ 'product_id' ] ][ 'message' ] = $body[ 'error' ];
|
376 |
-
$options[ $product[ 'product_id' ] ][ 'status_code' ] = $body[ 'code' ];
|
377 |
-
break;
|
378 |
-
}
|
379 |
-
|
380 |
-
update_option( $this->_licence_option, $options );
|
381 |
-
|
382 |
-
/* === Licence Activation Template === */
|
383 |
-
$deactivate_message = $this->get_response_code_message( 'deactivated' );
|
384 |
-
$error_code_message = $this->get_response_code_message( $body['code'] );
|
385 |
-
$message = sprintf( "<strong>%s</strong>: %s", $deactivate_message, $error_code_message );
|
386 |
-
$body['template'] = $this->show_activation_panel( $message );
|
387 |
-
$body['activated'] = false;
|
388 |
-
}
|
389 |
-
}
|
390 |
-
|
391 |
-
wp_send_json( $body );
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Check Plugins Licence
|
396 |
-
*
|
397 |
-
* Send a request to API server to check if plugins is activated
|
398 |
-
*
|
399 |
-
* @param string|The plugin init slug $plugin_init
|
400 |
-
* @param boolean $regenerate_transient
|
401 |
-
* @param boolean $force_check
|
402 |
-
*
|
403 |
-
* @return bool | true if activated, false otherwise
|
404 |
-
*
|
405 |
-
* @since 1.0
|
406 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
407 |
-
*/
|
408 |
-
public function check( $product_init, $regenerate_transient = true, $force_check = false ) {
|
409 |
-
|
410 |
-
$status = false;
|
411 |
-
$body = false;
|
412 |
-
$product = $this->get_product( $product_init );
|
413 |
-
$licence = $this->get_licence();
|
414 |
-
$product_id = $product[ 'product_id' ];
|
415 |
-
|
416 |
-
if ( ! isset( $licence[ $product_id ] ) ) {
|
417 |
-
return false;
|
418 |
-
}
|
419 |
-
|
420 |
-
if( ! $force_check && ! $this->is_check_needed( $licence[ $product_id ] ) ) {
|
421 |
-
return true;
|
422 |
-
}
|
423 |
-
|
424 |
-
$args = array(
|
425 |
-
'email' => urlencode( $licence[ $product_id ][ 'email' ] ),
|
426 |
-
'licence_key' => $licence[ $product_id ][ 'licence_key' ],
|
427 |
-
'product_id' => $product_id,
|
428 |
-
'secret_key' => $product[ 'secret_key' ],
|
429 |
-
'instance' => $this->get_home_url()
|
430 |
-
);
|
431 |
-
|
432 |
-
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'check' ) ) );
|
433 |
-
$timeout = apply_filters( 'yith_plugin_fw_licence_timeout', 30, __FUNCTION__ );
|
434 |
-
$response = wp_remote_get( $api_uri, array( 'timeout' => $timeout ) );
|
435 |
-
|
436 |
-
if ( ! is_wp_error( $response ) ) {
|
437 |
-
$body = json_decode( $response[ 'body' ] );
|
438 |
-
$body = is_object( $body ) ? get_object_vars( $body ) : false;
|
439 |
-
}
|
440 |
-
|
441 |
-
if ( $body && is_array( $body ) ) {
|
442 |
-
if ( isset( $body[ 'success' ] ) && $body[ 'success' ] == true ) {
|
443 |
-
|
444 |
-
/**
|
445 |
-
* Code 200 -> Licence key is valid
|
446 |
-
*/
|
447 |
-
$licence[ $product_id ][ 'status_code' ] = '200';
|
448 |
-
$licence[ $product_id ][ 'activated' ] = $body[ 'activated' ];
|
449 |
-
$licence[ $product_id ][ 'licence_expires' ] = $body[ 'licence_expires' ];
|
450 |
-
$licence[ $product_id ][ 'licence_next_check' ] = time() + ( 12 * HOUR_IN_SECONDS );
|
451 |
-
$licence[ $product_id ][ 'activation_remaining' ] = $body[ 'activation_remaining' ];
|
452 |
-
$licence[ $product_id ][ 'activation_limit' ] = $body[ 'activation_limit' ];
|
453 |
-
$licence[ $product_id ][ 'is_membership' ] = isset( $body[ 'is_membership' ] ) ? $body[ 'is_membership' ] : false;
|
454 |
-
$status = (bool) $body[ 'activated' ];
|
455 |
-
} elseif ( isset( $body[ 'code' ] ) ) {
|
456 |
-
|
457 |
-
switch ( $body[ 'code' ] ) {
|
458 |
-
|
459 |
-
/**
|
460 |
-
* Error Code List:
|
461 |
-
*
|
462 |
-
* 100 -> Invalid Request
|
463 |
-
* 101 -> Invalid licence key
|
464 |
-
* 102 -> Software has been deactivate
|
465 |
-
* 103 -> Exceeded maximum number of activations
|
466 |
-
* 104 -> Invalid instance ID
|
467 |
-
* 105 -> Invalid security key
|
468 |
-
* 106 -> Licence key has expired
|
469 |
-
* 107 -> Licence key has be banned
|
470 |
-
*
|
471 |
-
* Only code 101, 106 and 107 have effect on DB during activation
|
472 |
-
* All error code have effect on DB during deactivation
|
473 |
-
*
|
474 |
-
*/
|
475 |
-
|
476 |
-
case '101':
|
477 |
-
case '102':
|
478 |
-
case '104':
|
479 |
-
unset( $licence[ $product_id ] );
|
480 |
-
break;
|
481 |
-
|
482 |
-
case '106':
|
483 |
-
$licence[ $product_id ][ 'activated' ] = false;
|
484 |
-
$licence[ $product_id ][ 'message' ] = $body[ 'error' ];
|
485 |
-
$licence[ $product_id ][ 'status_code' ] = $body[ 'code' ];
|
486 |
-
$licence[ $product_id ][ 'licence_expires' ] = $body[ 'licence_expires' ];
|
487 |
-
break;
|
488 |
-
|
489 |
-
case '107':
|
490 |
-
$licence[ $product_id ][ 'activated' ] = false;
|
491 |
-
$licence[ $product_id ][ 'message' ] = $body[ 'error' ];
|
492 |
-
$licence[ $product_id ][ 'status_code' ] = $body[ 'code' ];
|
493 |
-
break;
|
494 |
-
}
|
495 |
-
}
|
496 |
-
|
497 |
-
/* === Update Plugin Licence Information === */
|
498 |
-
update_option( $this->_licence_option, $licence );
|
499 |
-
|
500 |
-
/* === Update Plugin Licence Information === */
|
501 |
-
if ( $regenerate_transient ) {
|
502 |
-
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
503 |
-
}
|
504 |
-
}
|
505 |
-
|
506 |
-
return $status;
|
507 |
-
}
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Check if given licence needs to be checked
|
511 |
-
*
|
512 |
-
* @since 3.1.18
|
513 |
-
* @author Francesco Licandro
|
514 |
-
* @param array $licence The licence to check
|
515 |
-
* @return boolean
|
516 |
-
*/
|
517 |
-
public function is_check_needed( $licence ){
|
518 |
-
if( empty( $licence['licence_expires'] ) || $licence['licence_expires'] < time()
|
519 |
-
|| empty( $licence['licence_next_check'] ) || $licence['licence_next_check'] < time() ){
|
520 |
-
return true;
|
521 |
-
}
|
522 |
-
|
523 |
-
return false;
|
524 |
-
}
|
525 |
-
|
526 |
-
/**
|
527 |
-
* Check for licence update
|
528 |
-
*
|
529 |
-
* @return void
|
530 |
-
* @since 2.5
|
531 |
-
*
|
532 |
-
* @use YIT_Theme_Licence->check()
|
533 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
534 |
-
* @param boolean $regenerate_transient
|
535 |
-
* @param boolean $force_check
|
536 |
-
*/
|
537 |
-
public function check_all( $regenerate_transient = true, $force_check = false ) {
|
538 |
-
foreach ( $this->_products as $init => $info ) {
|
539 |
-
$this->check( $init, $regenerate_transient, $force_check );
|
540 |
-
}
|
541 |
-
}
|
542 |
-
|
543 |
-
/**
|
544 |
-
* Update Plugins Information
|
545 |
-
*
|
546 |
-
* Send a request to API server to check activate plugins and update the informations
|
547 |
-
*
|
548 |
-
* @return void
|
549 |
-
* @use YIT_Theme_Licence->check()
|
550 |
-
*
|
551 |
-
* @since 1.0
|
552 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
553 |
-
*/
|
554 |
-
public function update_licence_information() {
|
555 |
-
/* Check licence information for alla products */
|
556 |
-
$this->check_all( false, true );
|
557 |
-
|
558 |
-
/* === Regenerate Update Plugins Transient === */
|
559 |
-
yith_plugin_fw_force_regenerate_plugin_update_transient();
|
560 |
-
|
561 |
-
do_action( 'yit_licence_after_check' );
|
562 |
-
|
563 |
-
if ( $this->is_ajax() ) {
|
564 |
-
$response[ 'template' ] = $this->show_activation_panel();
|
565 |
-
wp_send_json( $response );
|
566 |
-
}
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Include activation page template
|
571 |
-
*
|
572 |
-
* @return mixed void | string the contents of the output buffer and end output buffering.
|
573 |
-
*
|
574 |
-
* @since 1.0
|
575 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
576 |
-
*/
|
577 |
-
public function show_activation_panel( $notice = '' ) {
|
578 |
-
|
579 |
-
$path = defined( 'YIT_CORE_PLUGIN_PATH' ) ? YIT_CORE_PLUGIN_PATH : get_template_directory() . '/core/plugin-fw/';
|
580 |
-
|
581 |
-
if ( $this->is_ajax() ) {
|
582 |
-
ob_start();
|
583 |
-
require_once( $path . '/licence/templates/panel/activation/activation-panel.php' );
|
584 |
-
|
585 |
-
return ob_get_clean();
|
586 |
-
} else {
|
587 |
-
require_once( $path . '/licence/templates/panel/activation/activation-panel.php' );
|
588 |
-
}
|
589 |
-
}
|
590 |
-
|
591 |
-
/**
|
592 |
-
* Get activated products
|
593 |
-
*
|
594 |
-
* @return array
|
595 |
-
*
|
596 |
-
* @since 1.0
|
597 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
598 |
-
*/
|
599 |
-
public function get_activated_products() {
|
600 |
-
$activated_products = array();
|
601 |
-
$licence = $this->get_licence();
|
602 |
-
|
603 |
-
if ( is_array( $licence ) ) {
|
604 |
-
foreach ( $this->_products as $init => $info ) {
|
605 |
-
if ( in_array( $info[ 'product_id' ], array_keys( $licence ) ) && isset( $licence[ $info[ 'product_id' ] ][ 'activated' ] ) && $licence[ $info[ 'product_id' ] ][ 'activated' ] ) {
|
606 |
-
$product[ $init ] = $this->_products[ $init ];
|
607 |
-
$product[ $init ][ 'licence' ] = $licence[ $info[ 'product_id' ] ];
|
608 |
-
$activated_products[ $init ] = $product[ $init ];
|
609 |
-
}
|
610 |
-
}
|
611 |
-
}
|
612 |
-
|
613 |
-
return $activated_products;
|
614 |
-
}
|
615 |
-
|
616 |
-
/**
|
617 |
-
* Get to active products
|
618 |
-
*
|
619 |
-
* @return array
|
620 |
-
*
|
621 |
-
* @since 1.0
|
622 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
623 |
-
*/
|
624 |
-
public function get_to_active_products() {
|
625 |
-
return array_diff_key( $this->get_products(), $this->get_activated_products() );
|
626 |
-
}
|
627 |
-
|
628 |
-
/**
|
629 |
-
* Get no active products
|
630 |
-
*
|
631 |
-
* @return array
|
632 |
-
*
|
633 |
-
* @since 1.0
|
634 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
635 |
-
*/
|
636 |
-
public function get_no_active_licence_key() {
|
637 |
-
$unactive_products = $this->get_to_active_products();
|
638 |
-
$licence = $this->get_licence();
|
639 |
-
$licence_key = array();
|
640 |
-
|
641 |
-
/**
|
642 |
-
* Remove banned licence key
|
643 |
-
*/
|
644 |
-
foreach ( $unactive_products as $init => $info ) {
|
645 |
-
$product_id = $unactive_products[ $init ][ 'product_id' ];
|
646 |
-
if ( isset( $licence[ $product_id ][ 'activated' ] ) && !$licence[ $product_id ][ 'activated' ] && isset( $licence[ $product_id ][ 'status_code' ] ) ) {
|
647 |
-
$status_code = $licence[ $product_id ][ 'status_code' ];
|
648 |
-
|
649 |
-
switch ( $status_code ) {
|
650 |
-
case '106':
|
651 |
-
$licence_key[ $status_code ][ $init ] = $unactive_products[ $init ];
|
652 |
-
$licence_key[ $status_code ][ $init ][ 'licence' ] = $licence[ $product_id ];
|
653 |
-
break;
|
654 |
-
|
655 |
-
case '107':
|
656 |
-
$licence_key[ $status_code ][ $init ] = $unactive_products[ $init ];
|
657 |
-
$licence_key[ $status_code ][ $init ][ 'licence' ] = $licence[ $product_id ];
|
658 |
-
break;
|
659 |
-
}
|
660 |
-
}
|
661 |
-
}
|
662 |
-
|
663 |
-
return $licence_key;
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* Get a specific product information
|
668 |
-
*
|
669 |
-
* @param $product_init | product init file
|
670 |
-
*
|
671 |
-
* @return mixed array
|
672 |
-
*
|
673 |
-
* @since 1.0
|
674 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
675 |
-
*/
|
676 |
-
public function get_product( $init ) {
|
677 |
-
return isset( $this->_products[ $init ] ) ? $this->_products[ $init ] : false;
|
678 |
-
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Get product product id information
|
682 |
-
*
|
683 |
-
* @param $product_init | product init file
|
684 |
-
*
|
685 |
-
* @return mixed array
|
686 |
-
*
|
687 |
-
* @since 1.0
|
688 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
689 |
-
*/
|
690 |
-
public function get_product_id( $init ) {
|
691 |
-
return isset( $this->_products[ $init ][ 'product_id' ] ) ? $this->_products[ $init ][ 'product_id' ] : false;
|
692 |
-
}
|
693 |
-
|
694 |
-
/**
|
695 |
-
* Get Renewing uri
|
696 |
-
*
|
697 |
-
* @param $licence_key The licence key to renew
|
698 |
-
*
|
699 |
-
* @return mixed The renewing uri if licence_key exists, false otherwise
|
700 |
-
*
|
701 |
-
* @since 1.0
|
702 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
703 |
-
*/
|
704 |
-
public function get_renewing_uri( $licence_key ) {
|
705 |
-
return !empty( $licence_key ) ? str_replace( 'www.', '', $this->_api_uri ) . '?renewing_key=' . $licence_key : false;
|
706 |
-
}
|
707 |
-
|
708 |
-
/**
|
709 |
-
* Get protected yithemes api uri
|
710 |
-
*
|
711 |
-
* @param $request
|
712 |
-
*
|
713 |
-
* @return mixed array
|
714 |
-
*
|
715 |
-
* @since 1.0
|
716 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
717 |
-
*/
|
718 |
-
public function get_api_uri( $request ) {
|
719 |
-
return str_replace( '%request%', $request, $this->_api_uri . $this->_api_uri_query_args );
|
720 |
-
}
|
721 |
-
|
722 |
-
/**
|
723 |
-
* Get the activation page url
|
724 |
-
*
|
725 |
-
* @return String | Activation page url
|
726 |
-
*
|
727 |
-
* @since 1.0
|
728 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
729 |
-
*/
|
730 |
-
public function get_licence_activation_page_url() {
|
731 |
-
return esc_url( add_query_arg( array( 'page' => $this->_settings[ 'page' ] ), admin_url( 'admin.php' ) ) );
|
732 |
-
}
|
733 |
-
|
734 |
-
|
735 |
-
/**
|
736 |
-
* Get the licence information
|
737 |
-
*
|
738 |
-
* @return array | licence array
|
739 |
-
*
|
740 |
-
* @since 1.0
|
741 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
742 |
-
*/
|
743 |
-
public function get_licence() {
|
744 |
-
return get_option( $this->_licence_option );
|
745 |
-
}
|
746 |
-
|
747 |
-
/**
|
748 |
-
* Get the licence information
|
749 |
-
*
|
750 |
-
* @param $code string The error code
|
751 |
-
*
|
752 |
-
* @return string | Error code message
|
753 |
-
*
|
754 |
-
* @since 1.0
|
755 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
756 |
-
*/
|
757 |
-
public function get_response_code_message( $code, $args = array() ) {
|
758 |
-
extract( $args );
|
759 |
-
|
760 |
-
$messages = array(
|
761 |
-
'100' => __( 'Invalid Request', 'yith-plugin-fw' ),
|
762 |
-
'101' => __( 'Invalid license key', 'yith-plugin-fw' ),
|
763 |
-
'102' => __( 'Software has been deactivated', 'yith-plugin-fw' ),
|
764 |
-
'103' => __( 'Maximum number of activations exceeded', 'yith-plugin-fw' ),
|
765 |
-
'104' => __( 'Invalid instance ID', 'yith-plugin-fw' ),
|
766 |
-
'105' => __( 'Invalid security key', 'yith-plugin-fw' ),
|
767 |
-
'106' => __( 'License key has expired', 'yith-plugin-fw' ),
|
768 |
-
'107' => __( 'License key has been banned', 'yith-plugin-fw' ),
|
769 |
-
'108' => __( 'Current product is not included in your YITH Club Subscription key', 'yith-plugin-fw' ),
|
770 |
-
'200' => sprintf( '<strong>%s</strong>! %s', __( 'Great', 'yith-plugin-fw' ), __( 'License successfully activated', 'yith-plugin-fw' ) ),
|
771 |
-
'deactivated' => sprintf( '%s <strong>%s</strong>', __( 'License key deactivated for website', 'yith-plugin-fw' ), isset( $instance ) ? $instance : '' )
|
772 |
-
);
|
773 |
-
|
774 |
-
return isset( $messages[ $code ] ) ? $messages[ $code ] : false;
|
775 |
-
}
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Get the product name to display
|
779 |
-
*
|
780 |
-
* @param $product_name
|
781 |
-
*
|
782 |
-
* @return string the product name
|
783 |
-
*
|
784 |
-
* @since 2.2
|
785 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
786 |
-
*/
|
787 |
-
public function display_product_name( $product_name ) {
|
788 |
-
return str_replace( array( 'for WooCommerce', 'YITH', 'WooCommerce', 'Premium', 'Theme', 'WordPress' ), '', $product_name );
|
789 |
-
}
|
790 |
-
|
791 |
-
public function get_number_of_membership_products() {
|
792 |
-
$activated_products = $this->get_activated_products();
|
793 |
-
$num_members_products_activate = 0;
|
794 |
-
foreach ( $activated_products as $activated_product ) {
|
795 |
-
if ( isset( $activated_product[ 'licence' ][ 'is_membership' ] ) && $activated_product[ 'licence' ][ 'is_membership' ] ) {
|
796 |
-
$num_members_products_activate++;
|
797 |
-
}
|
798 |
-
}
|
799 |
-
|
800 |
-
return $num_members_products_activate;
|
801 |
-
}
|
802 |
-
|
803 |
-
}
|
804 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/licence/lib/yit-plugin-licence.php
DELETED
@@ -1,243 +0,0 @@
|
|
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 Plugin Licence Panel
|
18 |
-
*
|
19 |
-
* Setting Page to Manage Plugins
|
20 |
-
*
|
21 |
-
* @class YIT_Plugin_Licence
|
22 |
-
* @package YITH
|
23 |
-
* @since 1.0
|
24 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
-
*/
|
26 |
-
class YIT_Plugin_Licence extends YIT_Licence {
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var array The settings require to add the submenu page "Activation"
|
30 |
-
* @since 1.0
|
31 |
-
*/
|
32 |
-
protected $_settings = array();
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var object The single instance of the class
|
36 |
-
* @since 1.0
|
37 |
-
*/
|
38 |
-
protected static $_instance = null;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var string Option name
|
42 |
-
* @since 1.0
|
43 |
-
*/
|
44 |
-
protected $_licence_option = 'yit_plugin_licence_activation';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string product type
|
48 |
-
* @since 1.0
|
49 |
-
*/
|
50 |
-
protected $_product_type = 'plugin';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Constructor
|
54 |
-
*
|
55 |
-
* @since 1.0
|
56 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
57 |
-
*/
|
58 |
-
public function __construct() {
|
59 |
-
parent::__construct();
|
60 |
-
|
61 |
-
if ( !is_admin() ) {
|
62 |
-
return;
|
63 |
-
}
|
64 |
-
|
65 |
-
$this->_settings = array(
|
66 |
-
'parent_page' => 'yith_plugin_panel',
|
67 |
-
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
68 |
-
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
69 |
-
'capability' => 'manage_options',
|
70 |
-
'page' => 'yith_plugins_activation',
|
71 |
-
);
|
72 |
-
|
73 |
-
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
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', '>=' ) ) {
|
81 |
-
add_action( 'admin_notices', function () {
|
82 |
-
$this->activate_license_notice();
|
83 |
-
}, 15 );
|
84 |
-
}
|
85 |
-
|
86 |
-
else {
|
87 |
-
add_action( 'admin_notices', array( $this, 'activate_license_notice' ), 15 );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
private function _show_activate_license_notice() {
|
92 |
-
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
93 |
-
$show_license_notice = current_user_can( 'update_plugins' ) &&
|
94 |
-
( !isset( $_GET[ 'page' ] ) || 'yith_plugins_activation' !== $_GET[ 'page' ] ) &&
|
95 |
-
!( $current_screen && method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor() );
|
96 |
-
global $wp_filter;
|
97 |
-
|
98 |
-
if ( isset( $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ] ) ) {
|
99 |
-
$filter = $wp_filter[ 'yith_plugin_fw_show_activate_license_notice' ];
|
100 |
-
$v = yith_plugin_fw_get_version();
|
101 |
-
$a = explode( '.', $v );
|
102 |
-
$l = end( $a );
|
103 |
-
$p = absint( $l );
|
104 |
-
$allowed_hook = isset( $filter[ $p ] ) ? $filter[ $p ] : false;
|
105 |
-
remove_all_filters( 'yith_plugin_fw_show_activate_license_notice' );
|
106 |
-
|
107 |
-
if ( $allowed_hook && is_array( $allowed_hook ) ) {
|
108 |
-
$cb = current( $allowed_hook );
|
109 |
-
if ( isset( $cb[ 'function' ] ) && isset( $cb[ 'accepted_args' ] ) ) {
|
110 |
-
add_filter( 'yith_plugin_fw_show_activate_license_notice', $cb[ 'function' ], 10, $cb[ 'accepted_args' ] );
|
111 |
-
}
|
112 |
-
}
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
return apply_filters( 'yith_plugin_fw_show_activate_license_notice', $show_license_notice );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* print notice with products to activate
|
121 |
-
*
|
122 |
-
* @since 3.0.0
|
123 |
-
*/
|
124 |
-
public function activate_license_notice() {
|
125 |
-
if ( $this->_show_activate_license_notice() ) {
|
126 |
-
$products_to_activate = $this->get_to_active_products();
|
127 |
-
if ( !!$products_to_activate ) {
|
128 |
-
$product_names = array();
|
129 |
-
foreach ( $products_to_activate as $init => $product ) {
|
130 |
-
if ( !empty( $product[ 'Name' ] ) )
|
131 |
-
$product_names[] = $product[ 'Name' ];
|
132 |
-
}
|
133 |
-
|
134 |
-
if ( !!$product_names ) {
|
135 |
-
$start = '<span style="display:inline-block; padding:3px 10px; margin: 0 10px 10px 0; background: #f1f1f1; border-radius: 4px;">';
|
136 |
-
$end = '</span>';
|
137 |
-
$product_list = '<div>' . $start . implode( $end . $start, $product_names ) . $end . '</div>';
|
138 |
-
$activation_url = self::get_license_activation_url();
|
139 |
-
?>
|
140 |
-
<div class="notice notice-error">
|
141 |
-
<p>
|
142 |
-
<?php printf( '<strong>%s</strong> %s:', _x( 'Warning!', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ), _x( "You didn't set license key for the following products", "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.",'yith-plugin-fw' ) ); ?><strong></strong>
|
143 |
-
<?php echo $product_list ?>
|
144 |
-
<?php printf( "%s. <a href='%s'>%s</a>, %s",
|
145 |
-
_x( "which means you're missing out on updates and support", "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ),
|
146 |
-
$activation_url,
|
147 |
-
_x( 'Enter your license key', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' ),
|
148 |
-
_x( 'please', "[Part of]: Warning! You didn't set license key for the following products:[Plugins List] which means you're missing out on updates and support. Enter your license key, please.", 'yith-plugin-fw' )
|
149 |
-
); ?>
|
150 |
-
</p>
|
151 |
-
</div>
|
152 |
-
<?php
|
153 |
-
}
|
154 |
-
}
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Main plugin Instance
|
160 |
-
*
|
161 |
-
* @static
|
162 |
-
* @return object Main instance
|
163 |
-
*
|
164 |
-
* @since 1.0
|
165 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
166 |
-
*/
|
167 |
-
public static function instance() {
|
168 |
-
if ( is_null( self::$_instance ) ) {
|
169 |
-
self::$_instance = new self();
|
170 |
-
}
|
171 |
-
|
172 |
-
return self::$_instance;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Add "Activation" submenu page under YITH Plugins
|
177 |
-
*
|
178 |
-
* @return void
|
179 |
-
* @since 1.0
|
180 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
181 |
-
*/
|
182 |
-
public function add_submenu_page() {
|
183 |
-
add_submenu_page(
|
184 |
-
$this->_settings[ 'parent_page' ],
|
185 |
-
$this->_settings[ 'page_title' ],
|
186 |
-
$this->_settings[ 'menu_title' ],
|
187 |
-
$this->_settings[ 'capability' ],
|
188 |
-
$this->_settings[ 'page' ],
|
189 |
-
array( $this, 'show_activation_panel' )
|
190 |
-
);
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Premium plugin registration
|
195 |
-
*
|
196 |
-
* @param $plugin_init | string | The plugin init file
|
197 |
-
* @param $secret_key | string | The product secret key
|
198 |
-
* @param $product_id | string | The plugin slug (product_id)
|
199 |
-
*
|
200 |
-
* @return void
|
201 |
-
*
|
202 |
-
* @since 1.0
|
203 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
204 |
-
*/
|
205 |
-
public function register( $plugin_init, $secret_key, $product_id ) {
|
206 |
-
if ( !function_exists( 'get_plugins' ) ) {
|
207 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
208 |
-
}
|
209 |
-
|
210 |
-
$plugins = get_plugins();
|
211 |
-
$plugins[ $plugin_init ][ 'secret_key' ] = $secret_key;
|
212 |
-
$plugins[ $plugin_init ][ 'product_id' ] = $product_id;
|
213 |
-
$this->_products[ $plugin_init ] = $plugins[ $plugin_init ];
|
214 |
-
}
|
215 |
-
|
216 |
-
public function get_product_type() {
|
217 |
-
return $this->_product_type;
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Get license activation URL
|
222 |
-
*
|
223 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
224 |
-
* @since 3.0.17
|
225 |
-
*/
|
226 |
-
public static function get_license_activation_url(){
|
227 |
-
return add_query_arg( array( 'page' => 'yith_plugins_activation' ), admin_url( 'admin.php' ) );
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Main instance of plugin
|
234 |
-
*
|
235 |
-
* @return YIT_Plugin_Licence object of license class
|
236 |
-
* @since 1.0
|
237 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
238 |
-
*/
|
239 |
-
if ( !function_exists( 'YIT_Plugin_Licence' ) ) {
|
240 |
-
function YIT_Plugin_Licence() {
|
241 |
-
return YIT_Plugin_Licence::instance();
|
242 |
-
}
|
243 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/licence/lib/yit-theme-licence.php
DELETED
@@ -1,191 +0,0 @@
|
|
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 Plugin Licence Panel
|
18 |
-
*
|
19 |
-
* Setting Page to Manage Plugins
|
20 |
-
*
|
21 |
-
* @class YIT_Theme_Licence
|
22 |
-
* @package YITH
|
23 |
-
* @since 1.0
|
24 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
25 |
-
*/
|
26 |
-
class YIT_Theme_Licence extends YIT_Licence {
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var array The settings require to add the submenu page "Activation"
|
30 |
-
* @since 1.0
|
31 |
-
*/
|
32 |
-
protected $_settings = array();
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var object The single instance of the class
|
36 |
-
* @since 1.0
|
37 |
-
*/
|
38 |
-
protected static $_instance = null;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var string Option name
|
42 |
-
* @since 1.0
|
43 |
-
*/
|
44 |
-
protected $_licence_option = 'yit_theme_licence_activation';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var string product type
|
48 |
-
* @since 1.0
|
49 |
-
*/
|
50 |
-
protected $_product_type = 'theme';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var string Old theme licence works until 28 January 2016
|
54 |
-
* @since 1.0
|
55 |
-
*/
|
56 |
-
protected $_old_licence_expires = 1453939200; //28 January 2016
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Constructor
|
60 |
-
*
|
61 |
-
* @since 1.0
|
62 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
63 |
-
*/
|
64 |
-
public function __construct() {
|
65 |
-
parent::__construct();
|
66 |
-
|
67 |
-
$this->_settings = array(
|
68 |
-
'parent_page' => 'yit_product_panel',
|
69 |
-
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
70 |
-
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
71 |
-
'capability' => 'manage_options',
|
72 |
-
'page' => 'yith_plugins_activation',
|
73 |
-
);
|
74 |
-
|
75 |
-
add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
|
76 |
-
add_action( "wp_ajax_yith_activate-{$this->_product_type}", array( $this, 'activate' ) );
|
77 |
-
add_action( "wp_ajax_yith_deactivate-{$this->_product_type}", array( $this, 'deactivate' ) );
|
78 |
-
add_action( "wp_ajax_yith_update_licence_information-{$this->_product_type}", array( $this, 'update_licence_information' ) );
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Main plugin Instance
|
83 |
-
*
|
84 |
-
* @static
|
85 |
-
* @return object Main instance
|
86 |
-
*
|
87 |
-
* @since 1.0
|
88 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
89 |
-
*/
|
90 |
-
public static function instance() {
|
91 |
-
if ( is_null( self::$_instance ) ) {
|
92 |
-
self::$_instance = new self();
|
93 |
-
}
|
94 |
-
|
95 |
-
return self::$_instance;
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Add "Activation" submenu page under YITH Plugins
|
100 |
-
*
|
101 |
-
* @return void
|
102 |
-
* @since 1.0
|
103 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
104 |
-
*/
|
105 |
-
public function add_submenu_page() {
|
106 |
-
|
107 |
-
$admin_tree = array(
|
108 |
-
'parent_slug' => apply_filters( 'yit_licence_parent_slug', 'yit_panel' ),
|
109 |
-
'page_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
110 |
-
'menu_title' => __( 'License Activation', 'yith-plugin-fw' ),
|
111 |
-
'capability' => 'manage_options',
|
112 |
-
'menu_slug' => 'yit_panel_license',
|
113 |
-
'function' => 'show_activation_panel'
|
114 |
-
);
|
115 |
-
|
116 |
-
add_submenu_page( $admin_tree['parent_slug'],
|
117 |
-
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['page_title'] ),
|
118 |
-
sprintf( __( '%s', 'yith-plugin-fw' ), $admin_tree['menu_title'] ),
|
119 |
-
$admin_tree['capability'],
|
120 |
-
$admin_tree['menu_slug'],
|
121 |
-
array( $this, $admin_tree['function'] )
|
122 |
-
);
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Premium product registration
|
127 |
-
*
|
128 |
-
* @param $product_init | string | The product init file
|
129 |
-
* @param $secret_key | string | The product secret key
|
130 |
-
* @param $product_id | string | The product slug (product_id)
|
131 |
-
*
|
132 |
-
* @return void
|
133 |
-
*
|
134 |
-
* @since 1.0
|
135 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
136 |
-
*/
|
137 |
-
public function register( $product_init, $secret_key, $product_id ) {
|
138 |
-
$theme = wp_get_theme();
|
139 |
-
$products[$product_init]['Name'] = $theme->Name;
|
140 |
-
$products[$product_init]['secret_key'] = $secret_key;
|
141 |
-
$products[$product_init]['product_id'] = $product_id;
|
142 |
-
$this->_products[$product_init] = $products[$product_init];
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Check for old licence
|
147 |
-
*
|
148 |
-
* @return bool True for old licence period, false otherwise
|
149 |
-
* @since 2.2
|
150 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
151 |
-
*/
|
152 |
-
public function show_old_licence_message() {
|
153 |
-
return time() < $this->_old_licence_expires;
|
154 |
-
}
|
155 |
-
|
156 |
-
public function get_old_licence_message() {
|
157 |
-
ob_start(); ?>
|
158 |
-
<div class="activation-faq">
|
159 |
-
<h3><?php _e( 'I cannot find the license key for activating the theme I have bought some time ago. Where can I find it?', 'yith-plugin-fw' ) ?></h3>
|
160 |
-
|
161 |
-
<p>
|
162 |
-
<?php
|
163 |
-
_e( 'If you have purchased one of our products before 27 January 2015, you can benefit from support and updates (the services offered with the license)
|
164 |
-
until 27 January 2016 and you do not have to purchase it again to get a new license key, because, before this date, your license used to be activated automatically by our system.
|
165 |
-
After 27 January 2016, instead, if you want to benefit from support and updates you have to buy a new license and activate it through the license key you will be
|
166 |
-
provided with and that you can find in your YITH account, in section "My licenses".', 'yith-plugin-fw' )
|
167 |
-
?>
|
168 |
-
</p>
|
169 |
-
</div>
|
170 |
-
<?php
|
171 |
-
echo ob_get_clean();
|
172 |
-
}
|
173 |
-
|
174 |
-
public function get_product_type() {
|
175 |
-
return $this->_product_type;
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Main instance
|
182 |
-
*
|
183 |
-
* @return object
|
184 |
-
* @since 1.0
|
185 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
186 |
-
*/
|
187 |
-
if ( !function_exists( 'YIT_Theme_Licence' ) ) {
|
188 |
-
function YIT_Theme_Licence() {
|
189 |
-
return YIT_Theme_Licence::instance();
|
190 |
-
}
|
191 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/licence/templates/panel/activation/activation-panel.php
DELETED
@@ -1,247 +0,0 @@
|
|
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 |
-
$to_active_products = $this->get_to_active_products();
|
12 |
-
$activated_products = $this->get_activated_products();
|
13 |
-
$no_active_products = $this->get_no_active_licence_key();
|
14 |
-
$expired_products = isset( $no_active_products[ '106' ] ) ? $no_active_products[ '106' ] : array();
|
15 |
-
$banned_products = isset( $no_active_products[ '107' ] ) ? $no_active_products[ '107' ] : array();
|
16 |
-
$notice = isset( $notice ) ? $notice : '';
|
17 |
-
$notice_class = !empty( $notice ) ? 'notice notice-success visible' : 'notice notice-success';
|
18 |
-
$to_activate_check = $this instanceof YIT_Theme_Licence ? 1 : 2;
|
19 |
-
$num_members_products_activate = $this->get_number_of_membership_products();
|
20 |
-
$debug = isset( $_REQUEST[ 'yith-license-debug' ] ) ? $_REQUEST[ 'yith-license-debug' ] : false;
|
21 |
-
?>
|
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>
|
41 |
-
</div>
|
42 |
-
|
43 |
-
<!-- To Active Products -->
|
44 |
-
|
45 |
-
<?php if ( !empty( $to_active_products ) ) : ?>
|
46 |
-
<h3 id="products-to-active" class="to-active">
|
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' ) ?>">
|
54 |
-
<?php if ( $debug ): ?>
|
55 |
-
<input type="hidden" name="debug" value="<?php echo $debug ?>"/>
|
56 |
-
<?php endif ?>
|
57 |
-
<table class="to-active-table">
|
58 |
-
<tbody>
|
59 |
-
<tr class="product-row">
|
60 |
-
<td class="product-name">
|
61 |
-
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
62 |
-
</td>
|
63 |
-
<td>
|
64 |
-
<input type="text" name="email" placeholder="Your email on yithemes.com" value="" class="user-email"/>
|
65 |
-
</td>
|
66 |
-
<td>
|
67 |
-
<input type="text" name="licence_key" placeholder="License Key" value="" class="licence-key"/>
|
68 |
-
</td>
|
69 |
-
<td class="activate-button">
|
70 |
-
<input type="submit" name="submit" value="<?php _e( 'Activate', 'yith-plugin-fw' ) ?>" class="button-licence licence-activation" data-formid="<?php echo $info[ 'product_id' ] ?>"/>
|
71 |
-
</td>
|
72 |
-
</tr>
|
73 |
-
<input type="hidden" name="action" value="yith_activate-<?php echo $this->get_product_type(); ?>"/>
|
74 |
-
<input type="hidden" name="product_init" value="<?php echo $init ?>"/>
|
75 |
-
</tbody>
|
76 |
-
</table>
|
77 |
-
<div class="message-wrapper">
|
78 |
-
<span class="message arrow-left"></span>
|
79 |
-
</div>
|
80 |
-
</form>
|
81 |
-
<?php endforeach; ?>
|
82 |
-
</div>
|
83 |
-
<?php endif; ?>
|
84 |
-
|
85 |
-
<!-- Activated Products -->
|
86 |
-
|
87 |
-
<?php if ( !empty( $activated_products ) ) : ?>
|
88 |
-
<h3 id="activated-products">
|
89 |
-
<?php _e( 'Activated', 'yith-plugin-fw' ) ?>
|
90 |
-
<span class="spinner"></span>
|
91 |
-
</h3>
|
92 |
-
<table class="activated-table">
|
93 |
-
<thead>
|
94 |
-
<tr>
|
95 |
-
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
96 |
-
<?php if ( $this->show_extra_info ) : ?>
|
97 |
-
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
98 |
-
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
99 |
-
<?php endif; ?>
|
100 |
-
|
101 |
-
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
102 |
-
|
103 |
-
<?php if ( $this->show_extra_info ) : ?>
|
104 |
-
<th><?php _e( 'Remaining', 'yith-plugin-fw' ) ?></th>
|
105 |
-
<?php if ( $num_members_products_activate ) : ?>
|
106 |
-
<th><?php _e( 'Club Subscription', 'yith-plugin-fw' ) ?></th>
|
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>
|
114 |
-
<?php foreach ( $activated_products as $init => $info ) : ?>
|
115 |
-
<tr>
|
116 |
-
<td class="product-name">
|
117 |
-
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
118 |
-
</td>
|
119 |
-
|
120 |
-
<?php if ( $this->show_extra_info ) : ?>
|
121 |
-
<td class="product-licence-email">
|
122 |
-
<?php echo $info[ 'licence' ][ 'email' ] ?>
|
123 |
-
</td>
|
124 |
-
<td class="product-licence-key">
|
125 |
-
<?php echo $info[ 'licence' ][ 'licence_key' ] ?>
|
126 |
-
</td>
|
127 |
-
<?php endif; ?>
|
128 |
-
|
129 |
-
<td class="product-licence-expires">
|
130 |
-
<?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?>
|
131 |
-
</td>
|
132 |
-
|
133 |
-
<?php if ( $this->show_extra_info ) : ?>
|
134 |
-
<td class="product-licence-remaining">
|
135 |
-
<?php printf( __( '%1s out of %2s', 'yith-plugin-fw' ), $info[ 'licence' ][ 'activation_remaining' ], $info[ 'licence' ][ 'activation_limit' ] ); ?>
|
136 |
-
</td>
|
137 |
-
<?php if ( $num_members_products_activate ) : ?>
|
138 |
-
<td class="product-licence-membership">
|
139 |
-
<span class="dashicons dashicons-<?php echo $info[ 'licence' ][ 'is_membership' ] ? 'yes' : 'no-alt' ?>"></span>
|
140 |
-
</td>
|
141 |
-
<?php endif; ?>
|
142 |
-
<?php endif; ?>
|
143 |
-
|
144 |
-
<td>
|
145 |
-
<a class="button-licence licence-deactive"
|
146 |
-
href="#"
|
147 |
-
data-licence-email="<?php echo $info[ 'licence' ][ 'email' ] ?>"
|
148 |
-
data-licence-key="<?php echo $info[ 'licence' ][ 'licence_key' ] ?>"
|
149 |
-
data-product-init="<?php echo $init ?>"
|
150 |
-
data-action="yith_deactivate-<?php echo $this->get_product_type(); ?>">
|
151 |
-
<?php _e( 'Deactivate', 'yith-plugin-fw' ) ?>
|
152 |
-
</a>
|
153 |
-
|
154 |
-
<?php if ( !$info[ 'licence' ][ 'is_membership' ] && $this->show_renew_button ) : ?>
|
155 |
-
<a class="button-licence licence-renew" href="<?php echo esc_url( $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ) ?>" target="_blank">
|
156 |
-
<?php _e( 'Renew', 'yith-plugin-fw' ) ?>
|
157 |
-
</a>
|
158 |
-
<?php endif; ?>
|
159 |
-
</td>
|
160 |
-
</tr>
|
161 |
-
<?php endforeach; ?>
|
162 |
-
</tbody>
|
163 |
-
</table>
|
164 |
-
<?php endif; ?>
|
165 |
-
|
166 |
-
<!-- Banned Products -->
|
167 |
-
|
168 |
-
<?php if ( !empty( $banned_products ) ) : ?>
|
169 |
-
<h3><?php _e( 'Banned', 'yith-plugin-fw' ) ?></h3>
|
170 |
-
<table class="expired-table">
|
171 |
-
<thead>
|
172 |
-
<tr>
|
173 |
-
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
174 |
-
<?php if ( $this->show_extra_info ) : ?>
|
175 |
-
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
176 |
-
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
177 |
-
<?php endif; ?>
|
178 |
-
</tr>
|
179 |
-
</thead>
|
180 |
-
<tbody>
|
181 |
-
<?php foreach ( $banned_products as $init => $info ) : ?>
|
182 |
-
<tr>
|
183 |
-
<td class="product-name">
|
184 |
-
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
185 |
-
</td>
|
186 |
-
<?php if ( $this->show_extra_info ) : ?>
|
187 |
-
<td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
|
188 |
-
<td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
|
189 |
-
<?php endif; ?>
|
190 |
-
</tr>
|
191 |
-
<?php endforeach; ?>
|
192 |
-
</tbody>
|
193 |
-
</table>
|
194 |
-
<?php endif; ?>
|
195 |
-
|
196 |
-
<!-- Expired Products -->
|
197 |
-
|
198 |
-
<?php if ( !empty( $expired_products ) ) : ?>
|
199 |
-
<h3><?php _e( 'Expired', 'yith-plugin-fw' ) ?></h3>
|
200 |
-
<table class="expired-table">
|
201 |
-
<thead>
|
202 |
-
<tr>
|
203 |
-
<th><?php _e( 'Product Name', 'yith-plugin-fw' ) ?></th>
|
204 |
-
|
205 |
-
<?php if ( $this->show_extra_info ) : ?>
|
206 |
-
<th><?php _e( 'Email', 'yith-plugin-fw' ) ?></th>
|
207 |
-
<th><?php _e( 'License Key', 'yith-plugin-fw' ) ?></th>
|
208 |
-
<?php endif; ?>
|
209 |
-
|
210 |
-
<th><?php _e( 'Expires', 'yith-plugin-fw' ) ?></th>
|
211 |
-
|
212 |
-
<?php if ( $this->show_renew_button ) : ?>
|
213 |
-
<th><?php _e( 'Renew', 'yith-plugin-fw' ) ?></th>
|
214 |
-
<?php endif; ?>
|
215 |
-
</tr>
|
216 |
-
</thead>
|
217 |
-
<tbody>
|
218 |
-
<?php foreach ( $expired_products as $init => $info ) : ?>
|
219 |
-
<tr>
|
220 |
-
<td class="product-name">
|
221 |
-
<?php echo $this->display_product_name( $info[ 'Name' ] ) ?>
|
222 |
-
</td>
|
223 |
-
|
224 |
-
<?php if ( $this->show_extra_info ) : ?>
|
225 |
-
<td class="product-licence-email"><?php echo $info[ 'licence' ][ 'email' ] ?></td>
|
226 |
-
<td class="product-licence-key"><?php echo $info[ 'licence' ][ 'licence_key' ] ?></td>
|
227 |
-
<?php endif; ?>
|
228 |
-
|
229 |
-
<td class="product-licence-expires"><?php echo date( "F j, Y", $info[ 'licence' ][ 'licence_expires' ] ); ?></td>
|
230 |
-
|
231 |
-
<?php if ( $this->show_renew_button ) : ?>
|
232 |
-
<td>
|
233 |
-
<a class="button-licence licence-renew" href="<?php echo $this->get_renewing_uri( $info[ 'licence' ][ 'licence_key' ] ) ?>" target="_blank">
|
234 |
-
<?php if ( $info[ 'licence' ][ 'is_membership' ] ) : ?>
|
235 |
-
<?php _e( 'Order again', 'yith-plugin-fw' ) ?>
|
236 |
-
<?php else : ?>
|
237 |
-
<?php __( 'Renew license', 'yith-plugin-fw' ) ?>
|
238 |
-
<?php endif; ?>
|
239 |
-
</a>
|
240 |
-
</td>
|
241 |
-
<?php endif; ?>
|
242 |
-
</tr>
|
243 |
-
<?php endforeach; ?>
|
244 |
-
</tbody>
|
245 |
-
</table>
|
246 |
-
<?php endif; ?>
|
247 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/yit-functions.php
CHANGED
@@ -1238,4 +1238,45 @@ if( ! function_exists( 'yith_plugin_fw_get_default_logo' ) ){
|
|
1238 |
function yith_plugin_fw_get_default_logo(){
|
1239 |
return YIT_CORE_PLUGIN_URL . '/assets/images/yith-icon.svg';
|
1240 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1241 |
}
|
1238 |
function yith_plugin_fw_get_default_logo(){
|
1239 |
return YIT_CORE_PLUGIN_URL . '/assets/images/yith-icon.svg';
|
1240 |
}
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
if( ! function_exists( 'yith_plugin_fw_load_update_and_licence_files' ) ){
|
1244 |
+
/**
|
1245 |
+
* Load premium file for license and update system
|
1246 |
+
*
|
1247 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
1248 |
+
*
|
1249 |
+
* @return void
|
1250 |
+
*/
|
1251 |
+
function yith_plugin_fw_load_update_and_licence_files(){
|
1252 |
+
global $plugin_upgrade_fw_data;
|
1253 |
+
|
1254 |
+
/**
|
1255 |
+
* If the init.php was load by old plugin-fw version
|
1256 |
+
* load the upgrade and license key from local folder
|
1257 |
+
*/
|
1258 |
+
if( empty( $plugin_upgrade_fw_data ) ){
|
1259 |
+
$plugin_upgrade_path = plugin_dir_path( __DIR__ ) . 'plugin-upgrade';
|
1260 |
+
if( file_exists( $plugin_upgrade_path ) ){
|
1261 |
+
$required_files = array(
|
1262 |
+
$plugin_upgrade_path . '/lib/yit-licence.php',
|
1263 |
+
$plugin_upgrade_path . '/lib/yit-plugin-licence.php',
|
1264 |
+
$plugin_upgrade_path . '/lib/yit-theme-licence.php',
|
1265 |
+
$plugin_upgrade_path . '/lib/yit-plugin-upgrade.php'
|
1266 |
+
);
|
1267 |
+
|
1268 |
+
$plugin_upgrade_fw_data = array( '1.0' => $required_files );
|
1269 |
+
}
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
if( ! empty( $plugin_upgrade_fw_data && is_array( $plugin_upgrade_fw_data )) ){
|
1273 |
+
foreach ( $plugin_upgrade_fw_data as $fw_version=> $core_files ){
|
1274 |
+
foreach ( $core_files as $core_file ){
|
1275 |
+
if( file_exists( $core_file ) ){
|
1276 |
+
include_once $core_file;
|
1277 |
+
}
|
1278 |
+
}
|
1279 |
+
}
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
}
|
plugin-fw/yit-plugin.php
CHANGED
@@ -28,9 +28,8 @@ include_once( 'lib/yit-ajax.php' );
|
|
28 |
include_once( 'lib/yit-plugin-subpanel.php' );
|
29 |
include_once( 'lib/yit-plugin-common.php' );
|
30 |
include_once( 'lib/yit-plugin-gradients.php');
|
31 |
-
include_once( '
|
32 |
-
include_once( '
|
33 |
-
include_once( 'licence/lib/yit-theme-licence.php');
|
34 |
include_once( 'lib/yit-video.php');
|
35 |
include_once( 'lib/yit-upgrade.php');
|
36 |
include_once( 'lib/yit-pointers.php');
|
@@ -188,7 +187,7 @@ if( ! function_exists( 'yith_add_action_links' ) ){
|
|
188 |
}
|
189 |
|
190 |
if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
|
191 |
-
$links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence
|
192 |
}
|
193 |
|
194 |
return $links;
|
28 |
include_once( 'lib/yit-plugin-subpanel.php' );
|
29 |
include_once( 'lib/yit-plugin-common.php' );
|
30 |
include_once( 'lib/yit-plugin-gradients.php');
|
31 |
+
include_once( 'lib/yit-plugin-licence.php');
|
32 |
+
include_once( 'lib/yit-theme-licence.php');
|
|
|
33 |
include_once( 'lib/yit-video.php');
|
34 |
include_once( 'lib/yit-upgrade.php');
|
35 |
include_once( 'lib/yit-pointers.php');
|
187 |
}
|
188 |
|
189 |
if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
|
190 |
+
$links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence()->get_license_activation_url(),__( 'License', 'yith-plugin-fw' ) );
|
191 |
}
|
192 |
|
193 |
return $links;
|