Version Description
- 2022-05-25 =
- Added support for WooCommerce 6.6
- Fixed PRO Upgrade Box
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Shipping for WooCommerce |
Version | 4.11.8 |
Comparing to | |
See all releases |
Code changes from version 4.11.7 to 4.11.8
- classes/table-rate/views/ads/html-ads-fs-pro.php +1 -1
- flexible-shipping.php +4 -4
- lang/flexible-shipping.pot +2 -2
- readme.txt +5 -1
- vendor/composer/autoload_classmap.php +9 -37
- vendor/composer/autoload_static.php +9 -37
- vendor/composer/installed.json +8 -2
- vendor_prefixed/wpdesk/wc-currency-switchers-integrations/composer.json +1 -1
- vendor_prefixed/wpdesk/wp-logs/src/SimpleLoggerFactory.php +4 -11
- vendor_prefixed/wpdesk/wp-logs/src/WC/WooCommerceHandler.php +5 -2
- vendor_prefixed/wpdesk/{wp-wpdesk-license → wp-plugin-flow-common}/composer.json +25 -16
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/BuilderTrait.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/InitializationFactory.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/InitializationStrategy.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/PluginDisablerByFileTrait.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimpleFactory.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimpleFreeStrategy.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimplePaidStrategy.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/TrackerInstanceAsFilterTrait.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/PluginBootstrap.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/plugin-init-php52-free.php +0 -0
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/plugin-init-php52.php +1 -1
- vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-free}/composer.json +4 -11
- vendor_prefixed/wpdesk/wp-wpdesk-fs-shipment/composer.json +1 -1
- vendor_prefixed/wpdesk/wp-wpdesk-fs-table-rate/composer.json +1 -1
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/AjaxHandler.php +0 -76
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/FormContentRenderer.php +0 -119
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/PluginsPageRenderer.php +0 -76
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/Renderer.php +0 -41
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/activation-form-content.php +0 -89
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/activation-form.php +0 -136
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/plugins-page-row.php +0 -57
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php +0 -316
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-passwords.php +0 -74
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php +0 -386
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php +0 -111
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php +0 -462
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Filter/ByVersion.php +0 -37
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Formatter.php +0 -70
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser.php +0 -93
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser/Line.php +0 -65
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/InstalledPlugins.php +0 -55
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/LicenseManager.php +0 -82
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/Action.php +0 -13
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/AbstractAction.php +0 -48
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/ActionError.php +0 -48
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseActivation.php +0 -179
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseDeactivation.php +0 -91
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/Nothing.php +0 -17
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/class-wpdesk-helper-list-table.php +0 -96
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/license-actions.php +0 -70
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/licenses.php +0 -53
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePage.php +0 -128
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePageActions.php +0 -33
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginLicense.php +0 -78
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginRegistrator.php +0 -42
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/ServerAddressRepository.php +0 -94
- vendor_prefixed/wpdesk/wp-wpdesk-license/src/WpUpgrader/SubscriptionHandler.php +0 -87
classes/table-rate/views/ads/html-ads-fs-pro.php
CHANGED
@@ -32,7 +32,7 @@
|
|
32 |
</li>
|
33 |
</ul>
|
34 |
|
35 |
-
<a class="button button-primary" href="<?php echo esc_url( $fs_link
|
36 |
target="_blank"><?php esc_html_e( 'Upgrade now to PRO version →', 'flexible-shipping' ); ?></a>
|
37 |
</div>
|
38 |
</div>
|
32 |
</li>
|
33 |
</ul>
|
34 |
|
35 |
+
<a class="button button-primary" href="<?php echo esc_url( $fs_link ); ?>"
|
36 |
target="_blank"><?php esc_html_e( 'Upgrade now to PRO version →', 'flexible-shipping' ); ?></a>
|
37 |
</div>
|
38 |
</div>
|
flexible-shipping.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
-
* Version: 4.11.
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://octol.io/fs-author
|
9 |
* Text Domain: flexible-shipping
|
@@ -11,7 +11,7 @@
|
|
11 |
* Requires at least: 5.2
|
12 |
* Tested up to: 6.0
|
13 |
* WC requires at least: 6.2
|
14 |
-
* WC tested up to: 6.
|
15 |
* Requires PHP: 7.0
|
16 |
*
|
17 |
* Copyright 2017 WP Desk Ltd.
|
@@ -38,7 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
41 |
-
$plugin_version = '4.11.
|
42 |
|
43 |
$plugin_name = 'Flexible Shipping';
|
44 |
$product_id = 'Flexible Shipping';
|
@@ -61,4 +61,4 @@ $requirements = [
|
|
61 |
],
|
62 |
];
|
63 |
|
64 |
-
require __DIR__ . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/plugin-init-php52-free.php';
|
3 |
* Plugin Name: Flexible Shipping
|
4 |
* Plugin URI: https://wordpress.org/plugins/flexible-shipping/
|
5 |
* Description: Create additional shipment methods in WooCommerce and enable pricing based on cart weight or total.
|
6 |
+
* Version: 4.11.8
|
7 |
* Author: WP Desk
|
8 |
* Author URI: https://octol.io/fs-author
|
9 |
* Text Domain: flexible-shipping
|
11 |
* Requires at least: 5.2
|
12 |
* Tested up to: 6.0
|
13 |
* WC requires at least: 6.2
|
14 |
+
* WC tested up to: 6.6
|
15 |
* Requires PHP: 7.0
|
16 |
*
|
17 |
* Copyright 2017 WP Desk Ltd.
|
38 |
} // Exit if accessed directly
|
39 |
|
40 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
41 |
+
$plugin_version = '4.11.8';
|
42 |
|
43 |
$plugin_name = 'Flexible Shipping';
|
44 |
$product_id = 'Flexible Shipping';
|
61 |
],
|
62 |
];
|
63 |
|
64 |
+
require __DIR__ . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/plugin-init-php52-free.php';
|
lang/flexible-shipping.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Flexible Shipping plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Flexible Shipping 4.11.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2022-05-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: flexible-shipping\n"
|
2 |
# This file is distributed under the same license as the Flexible Shipping plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Flexible Shipping 4.11.8\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-shipping\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2022-05-25T09:58:33+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: flexible-shipping\n"
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://octol.io/fs-repo-up
|
|
4 |
Tags: table rate, table rate shipping, conditional shipping, free shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 4.11.
|
8 |
Requires PHP: 7.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -200,6 +200,10 @@ If you are upgrading from the old Flexible Shipping version (1.3.2, woo-flexible
|
|
200 |
|
201 |
== Changelog ==
|
202 |
|
|
|
|
|
|
|
|
|
203 |
= 4.11.7 - 2022-05-12 =
|
204 |
* Added support for WordPress 6.0
|
205 |
|
4 |
Tags: table rate, table rate shipping, conditional shipping, free shipping, woocommerce shipping, flexible shipping, woocommerce table rate shipping, cart based shipping, weight shipping, weight based shipping, totals based shipping, order based shipping, shipping zones, shipping classes, shipping, free shipping, advanced shipping
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 4.11.8
|
8 |
Requires PHP: 7.0
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
200 |
|
201 |
== Changelog ==
|
202 |
|
203 |
+
= 4.11.8 - 2022-05-25 =
|
204 |
+
* Added support for WooCommerce 6.6
|
205 |
+
* Fixed PRO Upgrade Box
|
206 |
+
|
207 |
= 4.11.7 - 2022-05-12 =
|
208 |
* Added support for WordPress 6.0
|
209 |
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -200,28 +200,6 @@ return array(
|
|
200 |
'FSVendor\\WPDesk\\Forms\\Validator\\NoValidateValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NoValidateValidator.php',
|
201 |
'FSVendor\\WPDesk\\Forms\\Validator\\NonceValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NonceValidator.php',
|
202 |
'FSVendor\\WPDesk\\Forms\\Validator\\RequiredValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/RequiredValidator.php',
|
203 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\AjaxHandler' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/AjaxHandler.php',
|
204 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\FormContentRenderer' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/FormContentRenderer.php',
|
205 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\PluginsPageRenderer' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/PluginsPageRenderer.php',
|
206 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\Renderer' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/Renderer.php',
|
207 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Filter\\ByVersion' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Filter/ByVersion.php',
|
208 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Formatter' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Formatter.php',
|
209 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Parser' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser.php',
|
210 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Parser\\Line' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser/Line.php',
|
211 |
-
'FSVendor\\WPDesk\\License\\InstalledPlugins' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/InstalledPlugins.php',
|
212 |
-
'FSVendor\\WPDesk\\License\\LicenseManager' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/LicenseManager.php',
|
213 |
-
'FSVendor\\WPDesk\\License\\Page\\Action' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/Action.php',
|
214 |
-
'FSVendor\\WPDesk\\License\\Page\\LicensePage' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePage.php',
|
215 |
-
'FSVendor\\WPDesk\\License\\Page\\LicensePageActions' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePageActions.php',
|
216 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\AbstractAction' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/AbstractAction.php',
|
217 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\ActionError' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/ActionError.php',
|
218 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\LicenseActivation' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseActivation.php',
|
219 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\LicenseDeactivation' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseDeactivation.php',
|
220 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\Nothing' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/Nothing.php',
|
221 |
-
'FSVendor\\WPDesk\\License\\PluginLicense' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginLicense.php',
|
222 |
-
'FSVendor\\WPDesk\\License\\PluginRegistrator' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginRegistrator.php',
|
223 |
-
'FSVendor\\WPDesk\\License\\ServerAddressRepository' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ServerAddressRepository.php',
|
224 |
-
'FSVendor\\WPDesk\\License\\WpUpgrader\\SubscriptionHandler' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/WpUpgrader/SubscriptionHandler.php',
|
225 |
'FSVendor\\WPDesk\\Logger\\BasicLoggerFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/BasicLoggerFactory.php',
|
226 |
'FSVendor\\WPDesk\\Logger\\LoggerFacade' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFacade.php',
|
227 |
'FSVendor\\WPDesk\\Logger\\LoggerFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFactory.php',
|
@@ -308,15 +286,15 @@ return array(
|
|
308 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StaticStorage' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StaticStorage.php',
|
309 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StorageFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StorageFactory.php',
|
310 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\WordpressFilterStorage' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/WordpressFilterStorage.php',
|
311 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\BuilderTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/BuilderTrait.php',
|
312 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/InitializationFactory.php',
|
313 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/InitializationStrategy.php',
|
314 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\PluginDisablerByFileTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/PluginDisablerByFileTrait.php',
|
315 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimpleFactory.php',
|
316 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFreeStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimpleFreeStrategy.php',
|
317 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimplePaidStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimplePaidStrategy.php',
|
318 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\TrackerInstanceAsFilterTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/TrackerInstanceAsFilterTrait.php',
|
319 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\PluginBootstrap' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/PluginBootstrap.php',
|
320 |
'FSVendor\\WPDesk\\Pointer\\PointerConditions' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerConditions.php',
|
321 |
'FSVendor\\WPDesk\\Pointer\\PointerMessage' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerMessage.php',
|
322 |
'FSVendor\\WPDesk\\Pointer\\PointerPosition' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerPosition.php',
|
@@ -362,16 +340,11 @@ return array(
|
|
362 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
363 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
364 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
365 |
-
'FSVendor\\WPDesk_API_KEY' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
366 |
-
'FSVendor\\WPDesk_API_MENU' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
367 |
-
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
368 |
-
'FSVendor\\WPDesk_API_Password_Management' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-passwords.php',
|
369 |
'FSVendor\\WPDesk_Basic_Requirement_Checker' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php',
|
370 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_Factory' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php',
|
371 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_With_Update_Disable' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_With_Update_Disable.php',
|
372 |
'FSVendor\\WPDesk_Buildable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Buildable.php',
|
373 |
'FSVendor\\WPDesk_Has_Plugin_Info' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Has_Plugin_Info.php',
|
374 |
-
'FSVendor\\WPDesk_Helper_List_Table' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/class-wpdesk-helper-list-table.php',
|
375 |
'FSVendor\\WPDesk_Logger' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger.php',
|
376 |
'FSVendor\\WPDesk_Logger_Factory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php',
|
377 |
'FSVendor\\WPDesk_Plugin_Info' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Plugin_Info.php',
|
@@ -409,7 +382,6 @@ return array(
|
|
409 |
'FSVendor\\WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
|
410 |
'FSVendor\\WPDesk_Translable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translable.php',
|
411 |
'FSVendor\\WPDesk_Translatable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translatable.php',
|
412 |
-
'FSVendor\\WPDesk_Update_API_Check' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php',
|
413 |
'Flexible_Shipping_Contextual_Info' => $baseDir . '/classes/Flexible_Shipping_Contextual_Info.php',
|
414 |
'Flexible_Shipping_Plugin' => $baseDir . '/classes/class-flexible-shipping-plugin.php',
|
415 |
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
|
200 |
'FSVendor\\WPDesk\\Forms\\Validator\\NoValidateValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NoValidateValidator.php',
|
201 |
'FSVendor\\WPDesk\\Forms\\Validator\\NonceValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NonceValidator.php',
|
202 |
'FSVendor\\WPDesk\\Forms\\Validator\\RequiredValidator' => $baseDir . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/RequiredValidator.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
'FSVendor\\WPDesk\\Logger\\BasicLoggerFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/BasicLoggerFactory.php',
|
204 |
'FSVendor\\WPDesk\\Logger\\LoggerFacade' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFacade.php',
|
205 |
'FSVendor\\WPDesk\\Logger\\LoggerFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFactory.php',
|
286 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StaticStorage' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StaticStorage.php',
|
287 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StorageFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StorageFactory.php',
|
288 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\WordpressFilterStorage' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/WordpressFilterStorage.php',
|
289 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\BuilderTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/BuilderTrait.php',
|
290 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/InitializationFactory.php',
|
291 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/InitializationStrategy.php',
|
292 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\PluginDisablerByFileTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/PluginDisablerByFileTrait.php',
|
293 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFactory' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimpleFactory.php',
|
294 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFreeStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimpleFreeStrategy.php',
|
295 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimplePaidStrategy' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimplePaidStrategy.php',
|
296 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\TrackerInstanceAsFilterTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/TrackerInstanceAsFilterTrait.php',
|
297 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\PluginBootstrap' => $baseDir . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/PluginBootstrap.php',
|
298 |
'FSVendor\\WPDesk\\Pointer\\PointerConditions' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerConditions.php',
|
299 |
'FSVendor\\WPDesk\\Pointer\\PointerMessage' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerMessage.php',
|
300 |
'FSVendor\\WPDesk\\Pointer\\PointerPosition' => $baseDir . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerPosition.php',
|
340 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
341 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
342 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => $baseDir . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
|
|
|
|
|
|
|
|
343 |
'FSVendor\\WPDesk_Basic_Requirement_Checker' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php',
|
344 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_Factory' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php',
|
345 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_With_Update_Disable' => $baseDir . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_With_Update_Disable.php',
|
346 |
'FSVendor\\WPDesk_Buildable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Buildable.php',
|
347 |
'FSVendor\\WPDesk_Has_Plugin_Info' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Has_Plugin_Info.php',
|
|
|
348 |
'FSVendor\\WPDesk_Logger' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger.php',
|
349 |
'FSVendor\\WPDesk_Logger_Factory' => $baseDir . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php',
|
350 |
'FSVendor\\WPDesk_Plugin_Info' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Plugin_Info.php',
|
382 |
'FSVendor\\WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
|
383 |
'FSVendor\\WPDesk_Translable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translable.php',
|
384 |
'FSVendor\\WPDesk_Translatable' => $baseDir . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translatable.php',
|
|
|
385 |
'Flexible_Shipping_Contextual_Info' => $baseDir . '/classes/Flexible_Shipping_Contextual_Info.php',
|
386 |
'Flexible_Shipping_Plugin' => $baseDir . '/classes/class-flexible-shipping-plugin.php',
|
387 |
'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php',
|
vendor/composer/autoload_static.php
CHANGED
@@ -223,28 +223,6 @@ class ComposerStaticInitFlexibleShipping
|
|
223 |
'FSVendor\\WPDesk\\Forms\\Validator\\NoValidateValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NoValidateValidator.php',
|
224 |
'FSVendor\\WPDesk\\Forms\\Validator\\NonceValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NonceValidator.php',
|
225 |
'FSVendor\\WPDesk\\Forms\\Validator\\RequiredValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/RequiredValidator.php',
|
226 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\AjaxHandler' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/AjaxHandler.php',
|
227 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\FormContentRenderer' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/FormContentRenderer.php',
|
228 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\PluginsPageRenderer' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/PluginsPageRenderer.php',
|
229 |
-
'FSVendor\\WPDesk\\License\\ActivationForm\\Renderer' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/Renderer.php',
|
230 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Filter\\ByVersion' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Filter/ByVersion.php',
|
231 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Formatter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Formatter.php',
|
232 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Parser' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser.php',
|
233 |
-
'FSVendor\\WPDesk\\License\\Changelog\\Parser\\Line' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser/Line.php',
|
234 |
-
'FSVendor\\WPDesk\\License\\InstalledPlugins' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/InstalledPlugins.php',
|
235 |
-
'FSVendor\\WPDesk\\License\\LicenseManager' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/LicenseManager.php',
|
236 |
-
'FSVendor\\WPDesk\\License\\Page\\Action' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/Action.php',
|
237 |
-
'FSVendor\\WPDesk\\License\\Page\\LicensePage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePage.php',
|
238 |
-
'FSVendor\\WPDesk\\License\\Page\\LicensePageActions' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePageActions.php',
|
239 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\AbstractAction' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/AbstractAction.php',
|
240 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\ActionError' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/ActionError.php',
|
241 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\LicenseActivation' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseActivation.php',
|
242 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\LicenseDeactivation' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseDeactivation.php',
|
243 |
-
'FSVendor\\WPDesk\\License\\Page\\License\\Action\\Nothing' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/Nothing.php',
|
244 |
-
'FSVendor\\WPDesk\\License\\PluginLicense' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginLicense.php',
|
245 |
-
'FSVendor\\WPDesk\\License\\PluginRegistrator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginRegistrator.php',
|
246 |
-
'FSVendor\\WPDesk\\License\\ServerAddressRepository' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ServerAddressRepository.php',
|
247 |
-
'FSVendor\\WPDesk\\License\\WpUpgrader\\SubscriptionHandler' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/WpUpgrader/SubscriptionHandler.php',
|
248 |
'FSVendor\\WPDesk\\Logger\\BasicLoggerFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/BasicLoggerFactory.php',
|
249 |
'FSVendor\\WPDesk\\Logger\\LoggerFacade' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFacade.php',
|
250 |
'FSVendor\\WPDesk\\Logger\\LoggerFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFactory.php',
|
@@ -331,15 +309,15 @@ class ComposerStaticInitFlexibleShipping
|
|
331 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StaticStorage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StaticStorage.php',
|
332 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StorageFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StorageFactory.php',
|
333 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\WordpressFilterStorage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/WordpressFilterStorage.php',
|
334 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\BuilderTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/BuilderTrait.php',
|
335 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/InitializationFactory.php',
|
336 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/InitializationStrategy.php',
|
337 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\PluginDisablerByFileTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/PluginDisablerByFileTrait.php',
|
338 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimpleFactory.php',
|
339 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFreeStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimpleFreeStrategy.php',
|
340 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimplePaidStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/Simple/SimplePaidStrategy.php',
|
341 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\TrackerInstanceAsFilterTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/Initialization/TrackerInstanceAsFilterTrait.php',
|
342 |
-
'FSVendor\\WPDesk\\Plugin\\Flow\\PluginBootstrap' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow/src/PluginBootstrap.php',
|
343 |
'FSVendor\\WPDesk\\Pointer\\PointerConditions' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerConditions.php',
|
344 |
'FSVendor\\WPDesk\\Pointer\\PointerMessage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerMessage.php',
|
345 |
'FSVendor\\WPDesk\\Pointer\\PointerPosition' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerPosition.php',
|
@@ -385,16 +363,11 @@ class ComposerStaticInitFlexibleShipping
|
|
385 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
386 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
387 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
388 |
-
'FSVendor\\WPDesk_API_KEY' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php',
|
389 |
-
'FSVendor\\WPDesk_API_MENU' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php',
|
390 |
-
'FSVendor\\WPDesk_API_Manager_With_Update_Flag' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php',
|
391 |
-
'FSVendor\\WPDesk_API_Password_Management' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-passwords.php',
|
392 |
'FSVendor\\WPDesk_Basic_Requirement_Checker' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php',
|
393 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_Factory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php',
|
394 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_With_Update_Disable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_With_Update_Disable.php',
|
395 |
'FSVendor\\WPDesk_Buildable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Buildable.php',
|
396 |
'FSVendor\\WPDesk_Has_Plugin_Info' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Has_Plugin_Info.php',
|
397 |
-
'FSVendor\\WPDesk_Helper_List_Table' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/class-wpdesk-helper-list-table.php',
|
398 |
'FSVendor\\WPDesk_Logger' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger.php',
|
399 |
'FSVendor\\WPDesk_Logger_Factory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php',
|
400 |
'FSVendor\\WPDesk_Plugin_Info' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Plugin_Info.php',
|
@@ -432,7 +405,6 @@ class ComposerStaticInitFlexibleShipping
|
|
432 |
'FSVendor\\WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
|
433 |
'FSVendor\\WPDesk_Translable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translable.php',
|
434 |
'FSVendor\\WPDesk_Translatable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translatable.php',
|
435 |
-
'FSVendor\\WPDesk_Update_API_Check' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php',
|
436 |
'Flexible_Shipping_Contextual_Info' => __DIR__ . '/../..' . '/classes/Flexible_Shipping_Contextual_Info.php',
|
437 |
'Flexible_Shipping_Plugin' => __DIR__ . '/../..' . '/classes/class-flexible-shipping-plugin.php',
|
438 |
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
|
223 |
'FSVendor\\WPDesk\\Forms\\Validator\\NoValidateValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NoValidateValidator.php',
|
224 |
'FSVendor\\WPDesk\\Forms\\Validator\\NonceValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/NonceValidator.php',
|
225 |
'FSVendor\\WPDesk\\Forms\\Validator\\RequiredValidator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-forms/src/Validator/RequiredValidator.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
'FSVendor\\WPDesk\\Logger\\BasicLoggerFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/BasicLoggerFactory.php',
|
227 |
'FSVendor\\WPDesk\\Logger\\LoggerFacade' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFacade.php',
|
228 |
'FSVendor\\WPDesk\\Logger\\LoggerFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/LoggerFactory.php',
|
309 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StaticStorage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StaticStorage.php',
|
310 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\StorageFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/StorageFactory.php',
|
311 |
'FSVendor\\WPDesk\\PluginBuilder\\Storage\\WordpressFilterStorage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Storage/WordpressFilterStorage.php',
|
312 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\BuilderTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/BuilderTrait.php',
|
313 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/InitializationFactory.php',
|
314 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\InitializationStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/InitializationStrategy.php',
|
315 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\PluginDisablerByFileTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/PluginDisablerByFileTrait.php',
|
316 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFactory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimpleFactory.php',
|
317 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimpleFreeStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimpleFreeStrategy.php',
|
318 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\SimplePaidStrategy' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/Simple/SimplePaidStrategy.php',
|
319 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\Initialization\\Simple\\TrackerInstanceAsFilterTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/Initialization/TrackerInstanceAsFilterTrait.php',
|
320 |
+
'FSVendor\\WPDesk\\Plugin\\Flow\\PluginBootstrap' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-plugin-flow-common/src/PluginBootstrap.php',
|
321 |
'FSVendor\\WPDesk\\Pointer\\PointerConditions' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerConditions.php',
|
322 |
'FSVendor\\WPDesk\\Pointer\\PointerMessage' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerMessage.php',
|
323 |
'FSVendor\\WPDesk\\Pointer\\PointerPosition' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-pointer/src/WPDesk/Pointer/PointerPosition.php',
|
363 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\Converter' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/Converter.php',
|
364 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodController' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodController.php',
|
365 |
'FSVendor\\WPDesk\\WooCommerce\\CurrencySwitchers\\Switcher\\WooCommerceMultiCurrency\\ShippingMethodIntegration' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wc-currency-switchers-integrations/src/Switcher/WooCommerceMultiCurrency/ShippingMethodIntegration.php',
|
|
|
|
|
|
|
|
|
366 |
'FSVendor\\WPDesk_Basic_Requirement_Checker' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker.php',
|
367 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_Factory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_Factory.php',
|
368 |
'FSVendor\\WPDesk_Basic_Requirement_Checker_With_Update_Disable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-basic-requirements/src/Basic_Requirement_Checker_With_Update_Disable.php',
|
369 |
'FSVendor\\WPDesk_Buildable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Buildable.php',
|
370 |
'FSVendor\\WPDesk_Has_Plugin_Info' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Has_Plugin_Info.php',
|
|
|
371 |
'FSVendor\\WPDesk_Logger' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger.php',
|
372 |
'FSVendor\\WPDesk_Logger_Factory' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-logs/src/deprecated/wpdesk-logger-factory.php',
|
373 |
'FSVendor\\WPDesk_Plugin_Info' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Plugin_Info.php',
|
405 |
'FSVendor\\WPDesk_Tracker_Sender_Wordpress_To_WPDesk' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-tracker/src/sender/class-wpdesk-tracker-sender-wordpress-to-wpdesk.php',
|
406 |
'FSVendor\\WPDesk_Translable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translable.php',
|
407 |
'FSVendor\\WPDesk_Translatable' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-builder/src/Plugin/WithoutNamespace/Translatable.php',
|
|
|
408 |
'Flexible_Shipping_Contextual_Info' => __DIR__ . '/../..' . '/classes/Flexible_Shipping_Contextual_Info.php',
|
409 |
'Flexible_Shipping_Plugin' => __DIR__ . '/../..' . '/classes/class-flexible-shipping-plugin.php',
|
410 |
'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php',
|
vendor/composer/installed.json
CHANGED
@@ -46,7 +46,10 @@
|
|
46 |
"log",
|
47 |
"psr",
|
48 |
"psr-3"
|
49 |
-
]
|
|
|
|
|
|
|
50 |
},
|
51 |
{
|
52 |
"name": "wpdesk/wp-wpdesk-fs-shipment-interfaces",
|
@@ -81,7 +84,10 @@
|
|
81 |
"name": "Krzysiek",
|
82 |
"email": "krzysiek@wpdesk.pl"
|
83 |
}
|
84 |
-
]
|
|
|
|
|
|
|
85 |
},
|
86 |
{
|
87 |
"name": "wpdesk/wp-wpdesk-helper-override",
|
46 |
"log",
|
47 |
"psr",
|
48 |
"psr-3"
|
49 |
+
],
|
50 |
+
"support": {
|
51 |
+
"source": "https://github.com/php-fig/log/tree/1.1.4"
|
52 |
+
}
|
53 |
},
|
54 |
{
|
55 |
"name": "wpdesk/wp-wpdesk-fs-shipment-interfaces",
|
84 |
"name": "Krzysiek",
|
85 |
"email": "krzysiek@wpdesk.pl"
|
86 |
}
|
87 |
+
],
|
88 |
+
"support": {
|
89 |
+
"issues": "https://gitlab.com/api/v4/projects/27813970/issues"
|
90 |
+
}
|
91 |
},
|
92 |
{
|
93 |
"name": "wpdesk/wp-wpdesk-helper-override",
|
vendor_prefixed/wpdesk/wc-currency-switchers-integrations/composer.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
"require": {
|
11 |
"php": ">=5.6",
|
12 |
"psr\/container": "^1.0",
|
13 |
-
"wpdesk\/wp-
|
14 |
},
|
15 |
"require-dev": {
|
16 |
"phpunit\/phpunit": "^5",
|
10 |
"require": {
|
11 |
"php": ">=5.6",
|
12 |
"psr\/container": "^1.0",
|
13 |
+
"wpdesk\/wp-builder": "^2.0"
|
14 |
},
|
15 |
"require-dev": {
|
16 |
"phpunit\/phpunit": "^5",
|
vendor_prefixed/wpdesk/wp-logs/src/SimpleLoggerFactory.php
CHANGED
@@ -27,22 +27,15 @@ final class SimpleLoggerFactory implements \FSVendor\WPDesk\Logger\LoggerFactory
|
|
27 |
return $this->logger;
|
28 |
}
|
29 |
$logger = new \FSVendor\Monolog\Logger($this->channel);
|
30 |
-
|
31 |
-
|
32 |
-
$logger->pushHandler($wc_handler);
|
33 |
}
|
34 |
-
if
|
|
|
35 |
$logger->pushHandler($this->get_wp_handler());
|
36 |
}
|
37 |
return $this->logger = $logger;
|
38 |
}
|
39 |
-
private function get_wc_handler() : \FSVendor\Monolog\Handler\HandlerInterface
|
40 |
-
{
|
41 |
-
if (\function_exists('wc_get_logger')) {
|
42 |
-
return new \FSVendor\WPDesk\Logger\WC\WooCommerceHandler(\wc_get_logger(), $this->options->level);
|
43 |
-
}
|
44 |
-
return new \FSVendor\Monolog\Handler\NullHandler();
|
45 |
-
}
|
46 |
private function get_wp_handler() : \FSVendor\Monolog\Handler\HandlerInterface
|
47 |
{
|
48 |
if (\defined('FSVendor\\WP_DEBUG_LOG') && WP_DEBUG_LOG) {
|
27 |
return $this->logger;
|
28 |
}
|
29 |
$logger = new \FSVendor\Monolog\Logger($this->channel);
|
30 |
+
if ($this->options->use_wc_log && \function_exists('wc_get_logger')) {
|
31 |
+
$logger->pushHandler(new \FSVendor\WPDesk\Logger\WC\WooCommerceHandler(\wc_get_logger(), $this->channel));
|
|
|
32 |
}
|
33 |
+
// Adding WooCommerce logger may have failed, if so add WP by default.
|
34 |
+
if ($this->options->use_wp_log || empty($logger->getHandlers())) {
|
35 |
$logger->pushHandler($this->get_wp_handler());
|
36 |
}
|
37 |
return $this->logger = $logger;
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
private function get_wp_handler() : \FSVendor\Monolog\Handler\HandlerInterface
|
40 |
{
|
41 |
if (\defined('FSVendor\\WP_DEBUG_LOG') && WP_DEBUG_LOG) {
|
vendor_prefixed/wpdesk/wp-logs/src/WC/WooCommerceHandler.php
CHANGED
@@ -12,6 +12,8 @@ class WooCommerceHandler extends \FSVendor\Monolog\Handler\AbstractProcessingHan
|
|
12 |
const DEFAULT_WC_SOURCE = 'wpdesk-logger';
|
13 |
/** @var \WC_Logger_Interface */
|
14 |
private $wc_logger;
|
|
|
|
|
15 |
/**
|
16 |
* Writes the record down to the log of the implementing handler
|
17 |
*
|
@@ -20,7 +22,7 @@ class WooCommerceHandler extends \FSVendor\Monolog\Handler\AbstractProcessingHan
|
|
20 |
*/
|
21 |
protected function write(array $record)
|
22 |
{
|
23 |
-
$context = \array_merge(['source' =>
|
24 |
$this->wc_logger->log($this->convertMonologLevelToWC($record['level']), $record['message'], $context);
|
25 |
}
|
26 |
/**
|
@@ -31,9 +33,10 @@ class WooCommerceHandler extends \FSVendor\Monolog\Handler\AbstractProcessingHan
|
|
31 |
{
|
32 |
return \FSVendor\Monolog\Logger::getLevelName($level);
|
33 |
}
|
34 |
-
public function __construct(\WC_Logger_Interface $originalWcLogger)
|
35 |
{
|
36 |
parent::__construct();
|
37 |
$this->wc_logger = $originalWcLogger;
|
|
|
38 |
}
|
39 |
}
|
12 |
const DEFAULT_WC_SOURCE = 'wpdesk-logger';
|
13 |
/** @var \WC_Logger_Interface */
|
14 |
private $wc_logger;
|
15 |
+
/** @var string */
|
16 |
+
private $channel;
|
17 |
/**
|
18 |
* Writes the record down to the log of the implementing handler
|
19 |
*
|
22 |
*/
|
23 |
protected function write(array $record)
|
24 |
{
|
25 |
+
$context = \array_merge(['source' => $this->channel], $record['extra'], $record['context']);
|
26 |
$this->wc_logger->log($this->convertMonologLevelToWC($record['level']), $record['message'], $context);
|
27 |
}
|
28 |
/**
|
33 |
{
|
34 |
return \FSVendor\Monolog\Logger::getLevelName($level);
|
35 |
}
|
36 |
+
public function __construct(\WC_Logger_Interface $originalWcLogger, string $channel = self::DEFAULT_WC_SOURCE)
|
37 |
{
|
38 |
parent::__construct();
|
39 |
$this->wc_logger = $originalWcLogger;
|
40 |
+
$this->channel = $channel;
|
41 |
}
|
42 |
}
|
vendor_prefixed/wpdesk/{wp-wpdesk-license → wp-plugin-flow-common}/composer.json
RENAMED
@@ -1,20 +1,27 @@
|
|
1 |
{
|
2 |
-
"name": "wpdesk\/wp-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
"authors": [
|
4 |
{
|
5 |
"name": "Krzysiek",
|
6 |
"email": "krzysiek@wpdesk.pl"
|
7 |
}
|
8 |
],
|
9 |
-
"
|
10 |
-
|
|
|
|
|
|
|
11 |
"require": {
|
12 |
"php": ">=7.0",
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"wpdesk\/wp-builder": "^2.0.0",
|
16 |
-
"wpdesk\/wp-notice": "^3.1.4",
|
17 |
-
"wpdesk\/wp-logs": "^1.6"
|
18 |
},
|
19 |
"require-dev": {
|
20 |
"phpunit\/phpunit": "<7",
|
@@ -25,18 +32,20 @@
|
|
25 |
},
|
26 |
"autoload": {
|
27 |
"classmap": [
|
28 |
-
"src
|
29 |
-
]
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
},
|
34 |
-
"autoload-dev": {},
|
35 |
"extra": {
|
36 |
-
"text-domain": "wp-
|
37 |
"translations-folder": "lang",
|
38 |
"po-files": {
|
39 |
-
"pl_PL": "
|
40 |
}
|
41 |
},
|
42 |
"scripts": {
|
1 |
{
|
2 |
+
"name": "wpdesk\/wp-plugin-flow-common",
|
3 |
+
"description": "WP Desk Plugin Flow Common",
|
4 |
+
"license": "MIT",
|
5 |
+
"keywords": [
|
6 |
+
"wordpress",
|
7 |
+
"plugin"
|
8 |
+
],
|
9 |
+
"homepage": "https:\/\/gitlab.com\/wpdesk\/library\/wp-plugin-flow-common",
|
10 |
"authors": [
|
11 |
{
|
12 |
"name": "Krzysiek",
|
13 |
"email": "krzysiek@wpdesk.pl"
|
14 |
}
|
15 |
],
|
16 |
+
"config": {
|
17 |
+
"platform": {
|
18 |
+
"php": "7.0"
|
19 |
+
}
|
20 |
+
},
|
21 |
"require": {
|
22 |
"php": ">=7.0",
|
23 |
+
"wpdesk\/wp-basic-requirements": "^3.2.3",
|
24 |
+
"wpdesk\/wp-builder": "^2.0.0"
|
|
|
|
|
|
|
25 |
},
|
26 |
"require-dev": {
|
27 |
"phpunit\/phpunit": "<7",
|
32 |
},
|
33 |
"autoload": {
|
34 |
"classmap": [
|
35 |
+
"src"
|
36 |
+
]
|
37 |
+
},
|
38 |
+
"autoload-dev": {
|
39 |
+
"classmap": [
|
40 |
+
"vendor\/wpdesk\/wp-basic-requirements",
|
41 |
+
"tests\/Stub"
|
42 |
+
]
|
43 |
},
|
|
|
44 |
"extra": {
|
45 |
+
"text-domain": "wp-plugin-flow-common",
|
46 |
"translations-folder": "lang",
|
47 |
"po-files": {
|
48 |
+
"pl_PL": "pl_PL.po"
|
49 |
}
|
50 |
},
|
51 |
"scripts": {
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/BuilderTrait.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/InitializationFactory.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/InitializationStrategy.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/PluginDisablerByFileTrait.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimpleFactory.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimpleFreeStrategy.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/Simple/SimplePaidStrategy.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/Initialization/TrackerInstanceAsFilterTrait.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/PluginBootstrap.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/plugin-init-php52-free.php
RENAMED
File without changes
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-common}/src/plugin-init-php52.php
RENAMED
@@ -44,6 +44,6 @@ if (\PHP_VERSION_ID > 50300) {
|
|
44 |
unset($plugin_init_factory);
|
45 |
} else {
|
46 |
/** @noinspection PhpDeprecationInspection */
|
47 |
-
$php52_function = \create_function('', 'echo sprintf( __("<p><strong style=\'color: red;\'>PHP version is older than 5.3 so no WP Desk plugins will work. Please contact your host and ask them to upgrade. </strong></p>", \'wp-plugin-flow\') );');
|
48 |
\add_action('admin_notices', $php52_function);
|
49 |
}
|
44 |
unset($plugin_init_factory);
|
45 |
} else {
|
46 |
/** @noinspection PhpDeprecationInspection */
|
47 |
+
$php52_function = \create_function('', 'echo sprintf( __("<p><strong style=\'color: red;\'>PHP version is older than 5.3 so no WP Desk plugins will work. Please contact your host and ask them to upgrade. </strong></p>", \'wp-plugin-flow-common\') );');
|
48 |
\add_action('admin_notices', $php52_function);
|
49 |
}
|
vendor_prefixed/wpdesk/{wp-plugin-flow → wp-plugin-flow-free}/composer.json
RENAMED
@@ -1,5 +1,6 @@
|
|
1 |
{
|
2 |
-
"name": "wpdesk\/wp-plugin-flow",
|
|
|
3 |
"authors": [
|
4 |
{
|
5 |
"name": "Krzysiek",
|
@@ -8,10 +9,7 @@
|
|
8 |
],
|
9 |
"require": {
|
10 |
"php": ">=7.0",
|
11 |
-
"wpdesk\/wp-
|
12 |
-
"wpdesk\/wp-builder": "^2.0.0",
|
13 |
-
"wpdesk\/wp-wpdesk-license": "^3.0.0",
|
14 |
-
"wpdesk\/wp-wpdesk-tracker": "^3.0.2"
|
15 |
},
|
16 |
"require-dev": {
|
17 |
"phpunit\/phpunit": "<7",
|
@@ -20,11 +18,6 @@
|
|
20 |
"mockery\/mockery": "*",
|
21 |
"10up\/wp_mock": "*"
|
22 |
},
|
23 |
-
"autoload": {
|
24 |
-
"classmap": [
|
25 |
-
"src"
|
26 |
-
]
|
27 |
-
},
|
28 |
"autoload-dev": {
|
29 |
"classmap": [
|
30 |
"vendor\/wpdesk\/wp-basic-requirements",
|
@@ -32,7 +25,7 @@
|
|
32 |
]
|
33 |
},
|
34 |
"extra": {
|
35 |
-
"text-domain": "wp-plugin-flow",
|
36 |
"translations-folder": "lang",
|
37 |
"po-files": {
|
38 |
"pl_PL": "pl_PL.po"
|
1 |
{
|
2 |
+
"name": "wpdesk\/wp-plugin-flow-free",
|
3 |
+
"license": "MIT",
|
4 |
"authors": [
|
5 |
{
|
6 |
"name": "Krzysiek",
|
9 |
],
|
10 |
"require": {
|
11 |
"php": ">=7.0",
|
12 |
+
"wpdesk\/wp-plugin-flow-common": "^1.0.1"
|
|
|
|
|
|
|
13 |
},
|
14 |
"require-dev": {
|
15 |
"phpunit\/phpunit": "<7",
|
18 |
"mockery\/mockery": "*",
|
19 |
"10up\/wp_mock": "*"
|
20 |
},
|
|
|
|
|
|
|
|
|
|
|
21 |
"autoload-dev": {
|
22 |
"classmap": [
|
23 |
"vendor\/wpdesk\/wp-basic-requirements",
|
25 |
]
|
26 |
},
|
27 |
"extra": {
|
28 |
+
"text-domain": "wp-plugin-flow-free",
|
29 |
"translations-folder": "lang",
|
30 |
"po-files": {
|
31 |
"pl_PL": "pl_PL.po"
|
vendor_prefixed/wpdesk/wp-wpdesk-fs-shipment/composer.json
CHANGED
@@ -14,8 +14,8 @@
|
|
14 |
},
|
15 |
"require": {
|
16 |
"php": ">=5.6",
|
|
|
17 |
"wpdesk\/wp-mutex": "^1.1",
|
18 |
-
"wpdesk\/wp-plugin-flow": "^2|^3",
|
19 |
"wpdesk\/wp-wpdesk-fs-shipment-interfaces": "^1.0"
|
20 |
},
|
21 |
"require-dev": {
|
14 |
},
|
15 |
"require": {
|
16 |
"php": ">=5.6",
|
17 |
+
"wpdesk\/wp-builder": "^2.0",
|
18 |
"wpdesk\/wp-mutex": "^1.1",
|
|
|
19 |
"wpdesk\/wp-wpdesk-fs-shipment-interfaces": "^1.0"
|
20 |
},
|
21 |
"require-dev": {
|
vendor_prefixed/wpdesk/wp-wpdesk-fs-table-rate/composer.json
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
"php": ">=5.6",
|
15 |
"wpdesk\/wp-view": "^1.1|^2.0.0",
|
16 |
"psr\/log": "^1.1",
|
17 |
-
"wpdesk\/wp-
|
18 |
},
|
19 |
"require-dev": {
|
20 |
"phpunit\/phpunit": "<7",
|
14 |
"php": ">=5.6",
|
15 |
"wpdesk\/wp-view": "^1.1|^2.0.0",
|
16 |
"psr\/log": "^1.1",
|
17 |
+
"wpdesk\/wp-builder": "^2.0"
|
18 |
},
|
19 |
"require-dev": {
|
20 |
"phpunit\/phpunit": "<7",
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/AjaxHandler.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\ActivationForm;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\LicenseManager;
|
6 |
-
use FSVendor\WPDesk\License\Page\LicensePageActions;
|
7 |
-
use FSVendor\WPDesk\License\PluginLicense;
|
8 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
9 |
-
use FSVendor\WPDesk_Plugin_Info;
|
10 |
-
/**
|
11 |
-
* Handles License Activation Ajax requests.
|
12 |
-
*/
|
13 |
-
class AjaxHandler implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
14 |
-
{
|
15 |
-
const AJAX_ACTION = 'license_activation';
|
16 |
-
/**
|
17 |
-
* @var WPDesk_Plugin_Info
|
18 |
-
*/
|
19 |
-
private $plugin_info;
|
20 |
-
/**
|
21 |
-
* @param WPDesk_Plugin_Info $plugin_info .
|
22 |
-
*/
|
23 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info)
|
24 |
-
{
|
25 |
-
$this->plugin_info = $plugin_info;
|
26 |
-
}
|
27 |
-
/**
|
28 |
-
* Hooks.
|
29 |
-
*/
|
30 |
-
public function hooks()
|
31 |
-
{
|
32 |
-
\add_action('wp_ajax_wpdesk_license_activation_' . $this->plugin_info->get_plugin_file_name(), [$this, 'handle_ajax_action']);
|
33 |
-
}
|
34 |
-
/**
|
35 |
-
* Handles ajax action.
|
36 |
-
*/
|
37 |
-
public function handle_ajax_action()
|
38 |
-
{
|
39 |
-
\check_ajax_referer(self::AJAX_ACTION, 'security');
|
40 |
-
$license_manager = new \FSVendor\WPDesk\License\LicenseManager($this->plugin_info);
|
41 |
-
$license_action = $this->get_post_value_as_string('license_action');
|
42 |
-
$plugin_info = ['plugin' => $this->plugin_info->get_plugin_file_name(), 'product_id' => $this->plugin_info->get_product_id(), 'api_manager' => $license_manager->create_api_manager(\false)];
|
43 |
-
$license_page_action = (new \FSVendor\WPDesk\License\Page\LicensePageActions())->create_action($license_action, \false);
|
44 |
-
$license_page_action->execute($plugin_info);
|
45 |
-
\delete_site_transient('update_plugins');
|
46 |
-
\wp_update_plugins();
|
47 |
-
$update_plugins = \get_site_transient('update_plugins');
|
48 |
-
$update_plugins = \is_array($update_plugins) ? $update_plugins : [$this->plugin_info->get_plugin_file_name() => new \stdClass()];
|
49 |
-
$plugin_license = new \FSVendor\WPDesk\License\PluginLicense($this->plugin_info);
|
50 |
-
$form_content_renderer = new \FSVendor\WPDesk\License\ActivationForm\FormContentRenderer($this->plugin_info, $this->is_update_possible(isset($update_plugins[$this->plugin_info->get_plugin_file_name()]) ?? new \stdClass()), $license_page_action->get_errors());
|
51 |
-
\wp_send_json_success(['activation_form_content' => $form_content_renderer->render(), 'is_active' => $plugin_license->is_active(), 'errors' => $license_page_action->get_errors()]);
|
52 |
-
}
|
53 |
-
/**
|
54 |
-
* @param \stdClass $plugin_data .
|
55 |
-
*
|
56 |
-
* @return bool
|
57 |
-
*/
|
58 |
-
private function is_update_possible($plugin_data)
|
59 |
-
{
|
60 |
-
if (isset($plugin_data->Version) && isset($plugin_data->new_version) && $plugin_data->Version !== $plugin_data->new_version && empty($plugin_data->package)) {
|
61 |
-
return \false;
|
62 |
-
}
|
63 |
-
return \true;
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* @param string $key .
|
67 |
-
*
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
private function get_post_value_as_string(string $key) : string
|
71 |
-
{
|
72 |
-
$value = \wp_unslash($_POST[$key]);
|
73 |
-
// phpcs:ignore.
|
74 |
-
return \is_array($value) ? '' : $value;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/FormContentRenderer.php
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\ActivationForm;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\License\Action\ActionError;
|
6 |
-
use FSVendor\WPDesk\License\PluginLicense;
|
7 |
-
use FSVendor\WPDesk_Plugin_Info;
|
8 |
-
/**
|
9 |
-
* Can render License Activation form content.
|
10 |
-
*/
|
11 |
-
class FormContentRenderer
|
12 |
-
{
|
13 |
-
const SHOP_WWW_WPDESK_PL = 'https://www.wpdesk.pl/';
|
14 |
-
const MY_ACCOUNT_API_KEYS_EN = 'my-account/api-keys/';
|
15 |
-
const MY_ACCOUNT_API_KEYS_PL = 'moje-konto/api-keys/';
|
16 |
-
const DOCS_EN = 'docs/how-to-activate-licenses';
|
17 |
-
const DOCS_PL = 'docs/licencje-wtyczek/';
|
18 |
-
const DOCS_URLS = ['octolize.com' => 'https://octol.io/how-to-activate-plugin'];
|
19 |
-
/**
|
20 |
-
* @var WPDesk_Plugin_Info
|
21 |
-
*/
|
22 |
-
private $plugin_info;
|
23 |
-
/**
|
24 |
-
* @var \stdClass
|
25 |
-
*/
|
26 |
-
private $update_possible;
|
27 |
-
/**
|
28 |
-
* @var ActionError[]
|
29 |
-
*/
|
30 |
-
private $errors;
|
31 |
-
/**
|
32 |
-
* @param WPDesk_Plugin_Info $plugin_info .
|
33 |
-
* @param bool $update_possible .
|
34 |
-
* @param ActionError[] $errors .
|
35 |
-
*/
|
36 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info, bool $update_possible, array $errors = [])
|
37 |
-
{
|
38 |
-
$this->plugin_info = $plugin_info;
|
39 |
-
$this->update_possible = $update_possible;
|
40 |
-
$this->errors = $errors;
|
41 |
-
}
|
42 |
-
/**
|
43 |
-
* @return string
|
44 |
-
*/
|
45 |
-
public function render() : string
|
46 |
-
{
|
47 |
-
\ob_start();
|
48 |
-
$this->output_render();
|
49 |
-
return \ob_get_clean();
|
50 |
-
}
|
51 |
-
public function output_render()
|
52 |
-
{
|
53 |
-
$plugin_license = new \FSVendor\WPDesk\License\PluginLicense($this->plugin_info);
|
54 |
-
$is_active = $plugin_license->is_active();
|
55 |
-
$plugin_slug = $this->plugin_info->get_plugin_slug();
|
56 |
-
$api_key = $plugin_license->get_api_key();
|
57 |
-
$activation_email = $plugin_license->get_activation_email();
|
58 |
-
$plugin_file = $this->plugin_info->get_plugin_file_name();
|
59 |
-
$errors = $this->errors;
|
60 |
-
$my_account_link = $this->prapare_my_account_link_according_to_locale_and_shop(\get_locale(), $this->plugin_info->get_plugin_shops());
|
61 |
-
$docs_link = $this->prapare_docs_link_according_to_locale_and_shop(\get_locale(), $this->plugin_info->get_plugin_shops());
|
62 |
-
$update_possible = $this->update_possible;
|
63 |
-
$renew_subscription_link = $this->prepare_renew_subscription_link_according_to_shop($plugin_license->get_upgrade_url());
|
64 |
-
include __DIR__ . '/views/activation-form-content.php';
|
65 |
-
}
|
66 |
-
/**
|
67 |
-
* @param string $upgrade_url .
|
68 |
-
*
|
69 |
-
* @return string
|
70 |
-
*/
|
71 |
-
private function prepare_renew_subscription_link_according_to_shop($upgrade_url)
|
72 |
-
{
|
73 |
-
$utms = '?utm_source=renew&utm_medium=plugin-list&utm_campaign=subscriptions';
|
74 |
-
return \trailingslashit($upgrade_url) . '/my-account/' . $utms;
|
75 |
-
}
|
76 |
-
/**
|
77 |
-
* @param string $locale .
|
78 |
-
* @param array<string,string> $plugin_shops .
|
79 |
-
*
|
80 |
-
* @return string
|
81 |
-
*/
|
82 |
-
private function prapare_my_account_link_according_to_locale_and_shop(string $locale, array $plugin_shops) : string
|
83 |
-
{
|
84 |
-
$default = 'default';
|
85 |
-
$default_shop = $plugin_shops[$default] ?? '';
|
86 |
-
$shop_url = $plugin_shops[$locale] ?? $default_shop;
|
87 |
-
$my_account = self::SHOP_WWW_WPDESK_PL !== $shop_url ? self::MY_ACCOUNT_API_KEYS_EN : self::MY_ACCOUNT_API_KEYS_PL;
|
88 |
-
$utms = '?utm_source=my-account-list&utm_medium=link&utm_campaign=licenses';
|
89 |
-
return isset($shop_url) ? \trailingslashit($shop_url) . $my_account . $utms : '';
|
90 |
-
}
|
91 |
-
/**
|
92 |
-
* @param string $locale .
|
93 |
-
* @param array<string,string> $plugin_shops .
|
94 |
-
*
|
95 |
-
* @return string
|
96 |
-
*/
|
97 |
-
private function prapare_docs_link_according_to_locale_and_shop(string $locale, array $plugin_shops) : string
|
98 |
-
{
|
99 |
-
$default = 'default';
|
100 |
-
$default_shop = $plugin_shops[$default] ?? '';
|
101 |
-
$shop_url = $plugin_shops[$locale] ?? $default_shop;
|
102 |
-
$shop_domain = $this->get_shop_domain($shop_url);
|
103 |
-
if (isset(self::DOCS_URLS[$shop_domain])) {
|
104 |
-
return self::DOCS_URLS[$shop_domain];
|
105 |
-
}
|
106 |
-
$docs = self::SHOP_WWW_WPDESK_PL !== $shop_url ? self::DOCS_EN : self::DOCS_PL;
|
107 |
-
$utms = '?utm_source=docs&utm_medium=link&utm_campaign=licenses';
|
108 |
-
return isset($shop_url) ? \trailingslashit($shop_url) . $docs . $utms : '';
|
109 |
-
}
|
110 |
-
/**
|
111 |
-
* @param string $shop_url .
|
112 |
-
*
|
113 |
-
* @return string
|
114 |
-
*/
|
115 |
-
private function get_shop_domain(string $shop_url) : string
|
116 |
-
{
|
117 |
-
return \parse_url($shop_url, \PHP_URL_HOST) ?? '';
|
118 |
-
}
|
119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/PluginsPageRenderer.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\ActivationForm;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\PluginLicense;
|
6 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
7 |
-
use FSVendor\WPDesk_Plugin_Info;
|
8 |
-
/**
|
9 |
-
* Can render activation form on plugins page.
|
10 |
-
*/
|
11 |
-
class PluginsPageRenderer implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* @var WPDesk_Plugin_Info
|
15 |
-
*/
|
16 |
-
private $plugin_info;
|
17 |
-
/**
|
18 |
-
* @param WPDesk_Plugin_Info $plugin_info .
|
19 |
-
*/
|
20 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info)
|
21 |
-
{
|
22 |
-
$this->plugin_info = $plugin_info;
|
23 |
-
}
|
24 |
-
public function hooks()
|
25 |
-
{
|
26 |
-
\add_action('after_plugin_row_' . $this->plugin_info->get_plugin_file_name(), [$this, 'display_activation_form_in_table_row'], 10, 3);
|
27 |
-
}
|
28 |
-
/**
|
29 |
-
* Displays activation form.
|
30 |
-
*
|
31 |
-
* @param string $plugin_file .
|
32 |
-
* @param array $plugin_data .
|
33 |
-
* @param string $status .
|
34 |
-
*/
|
35 |
-
public function display_activation_form_in_table_row($plugin_file, $plugin_data, $status)
|
36 |
-
{
|
37 |
-
$this->output_render($plugin_file, $plugin_data);
|
38 |
-
}
|
39 |
-
/**
|
40 |
-
* @param string $plugin_file .
|
41 |
-
* @param array $plugin_data .
|
42 |
-
*
|
43 |
-
* @return string
|
44 |
-
*/
|
45 |
-
public function render(string $plugin_file, $plugin_data)
|
46 |
-
{
|
47 |
-
\ob_start();
|
48 |
-
$this->output_render($plugin_file, $plugin_data);
|
49 |
-
return \ob_get_clean();
|
50 |
-
}
|
51 |
-
/**
|
52 |
-
* @param string $plugin_file .
|
53 |
-
* @param array $plugin_data .
|
54 |
-
*/
|
55 |
-
public function output_render(string $plugin_file, $plugin_data)
|
56 |
-
{
|
57 |
-
$plugin_license = new \FSVendor\WPDesk\License\PluginLicense($this->plugin_info);
|
58 |
-
$plugin_slug = $this->plugin_info->get_plugin_slug();
|
59 |
-
$is_active = $plugin_license->is_active();
|
60 |
-
$update_possible = $this->is_update_possible($plugin_data);
|
61 |
-
$form_content = new \FSVendor\WPDesk\License\ActivationForm\Renderer($this->plugin_info, $update_possible);
|
62 |
-
include __DIR__ . '/views/plugins-page-row.php';
|
63 |
-
}
|
64 |
-
/**
|
65 |
-
* @param array $plugin_data .
|
66 |
-
*
|
67 |
-
* @return bool
|
68 |
-
*/
|
69 |
-
private function is_update_possible(array $plugin_data)
|
70 |
-
{
|
71 |
-
if (isset($plugin_data['Version']) && isset($plugin_data['new_version']) && $plugin_data['Version'] !== $plugin_data['new_version'] && empty($plugin_data['package'])) {
|
72 |
-
return \false;
|
73 |
-
}
|
74 |
-
return \true;
|
75 |
-
}
|
76 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/Renderer.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\ActivationForm;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk_Plugin_Info;
|
6 |
-
class Renderer
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* @var WPDesk_Plugin_Info
|
10 |
-
*/
|
11 |
-
private $plugin_info;
|
12 |
-
/**
|
13 |
-
* @var bool
|
14 |
-
*/
|
15 |
-
private $update_possible;
|
16 |
-
/**
|
17 |
-
* @param WPDesk_Plugin_Info $plugin_info .
|
18 |
-
* @param bool $update_possible .
|
19 |
-
*/
|
20 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info, bool $update_possible)
|
21 |
-
{
|
22 |
-
$this->plugin_info = $plugin_info;
|
23 |
-
$this->update_possible = $update_possible;
|
24 |
-
}
|
25 |
-
/**
|
26 |
-
* @return string
|
27 |
-
*/
|
28 |
-
public function render()
|
29 |
-
{
|
30 |
-
\ob_start();
|
31 |
-
$this->output_render();
|
32 |
-
return \ob_get_clean();
|
33 |
-
}
|
34 |
-
public function output_render()
|
35 |
-
{
|
36 |
-
$form_content = new \FSVendor\WPDesk\License\ActivationForm\FormContentRenderer($this->plugin_info, $this->update_possible);
|
37 |
-
$plugin_slug = $this->plugin_info->get_plugin_slug();
|
38 |
-
$plugin_file = $this->plugin_info->get_plugin_file_name();
|
39 |
-
include __DIR__ . '/views/activation-form.php';
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/activation-form-content.php
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\License\Action\ActionError;
|
6 |
-
/**
|
7 |
-
* @var $plugin_slug string
|
8 |
-
* @var $api_key string
|
9 |
-
* @var $activation_email string
|
10 |
-
* @var $is_active bool
|
11 |
-
* @var $errors ActionError[]
|
12 |
-
* @var $my_account_link string
|
13 |
-
* @var $docs_link string
|
14 |
-
* @var $update_possible bool
|
15 |
-
* @var $renew_subscription_link string
|
16 |
-
*/
|
17 |
-
foreach ($errors as $error) {
|
18 |
-
?>
|
19 |
-
<div class="wpdesk-license-notice notice inline notice-alt <?php
|
20 |
-
echo \esc_html($error->get_type());
|
21 |
-
?>">
|
22 |
-
<?php
|
23 |
-
echo \wp_kses_post($error->get_message());
|
24 |
-
?>
|
25 |
-
</div>
|
26 |
-
<?php
|
27 |
-
}
|
28 |
-
?><p class="introduction">
|
29 |
-
<?php
|
30 |
-
if ($is_active) {
|
31 |
-
if ($update_possible) {
|
32 |
-
\esc_html_e(\__('Plugin\'s API key has been successfully activated. You are now fully eligible to receive plugin updates and support.', 'flexible-shipping'));
|
33 |
-
} else {
|
34 |
-
\esc_html_e(\__('Plugin\'s API key has been successfully activated, but your subscription has expired. In order to receive the upcoming updates and support please renew your subscription.', 'flexible-shipping'));
|
35 |
-
}
|
36 |
-
} else {
|
37 |
-
echo \esc_html(\__('In order to receive the upcoming updates and support please enter the plugin\'s API key obtained after the purchase.', 'flexible-shipping'));
|
38 |
-
if ($my_account_link && $docs_link) {
|
39 |
-
// Translators: my account link.
|
40 |
-
echo \wp_kses_post(' ' . \sprintf(
|
41 |
-
// Translators: my account link and docs link.
|
42 |
-
\__('You can find it in %1$sMy Account / API Keys%2$s tab. %3$sLearn more about activating the API key →%4$s', 'flexible-shipping'),
|
43 |
-
\sprintf('<a href="%1$s" target="_blank">', $my_account_link),
|
44 |
-
'</a>',
|
45 |
-
\sprintf('<a href="%1$s" target="_blank">', $docs_link),
|
46 |
-
'</a>'
|
47 |
-
));
|
48 |
-
}
|
49 |
-
}
|
50 |
-
?>
|
51 |
-
</p>
|
52 |
-
<div class="api-key">
|
53 |
-
<?php
|
54 |
-
echo \esc_html(\__('Key: ', 'flexible-shipping'));
|
55 |
-
?> <input type="text" name="api_key" value="<?php
|
56 |
-
echo \esc_html($api_key);
|
57 |
-
?>" placeholder="" <?php
|
58 |
-
\disabled($is_active);
|
59 |
-
?> />
|
60 |
-
</div>
|
61 |
-
<div class="activation-button">
|
62 |
-
<?php
|
63 |
-
if ($is_active) {
|
64 |
-
?>
|
65 |
-
<button class="deactivate button"><?php
|
66 |
-
echo \esc_html(\__('Deactivate license', 'flexible-shipping'));
|
67 |
-
?></button><span class="spinner"></span>
|
68 |
-
<?php
|
69 |
-
if (!$update_possible) {
|
70 |
-
?>
|
71 |
-
<a href="<?php
|
72 |
-
echo \esc_url($renew_subscription_link);
|
73 |
-
?>" class="button-primary" target="_blank" style="text-decoration: none;"><?php
|
74 |
-
echo \esc_html(\__('Renew subscription →', 'flexible-shipping'));
|
75 |
-
?></a>
|
76 |
-
<?php
|
77 |
-
}
|
78 |
-
?>
|
79 |
-
<?php
|
80 |
-
} else {
|
81 |
-
?>
|
82 |
-
<button class="activate button button-primary"><?php
|
83 |
-
echo \esc_html(\__('Activate license', 'flexible-shipping'));
|
84 |
-
?></button><span class="spinner"></span>
|
85 |
-
<?php
|
86 |
-
}
|
87 |
-
?>
|
88 |
-
</div>
|
89 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/activation-form.php
DELETED
@@ -1,136 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var string $plugin_slug
|
7 |
-
* @var string $plugin_file
|
8 |
-
* @var \WPDesk\License\ActivationForm\FormContentRenderer $form_content
|
9 |
-
*/
|
10 |
-
use FSVendor\WPDesk\License\ActivationForm\AjaxHandler;
|
11 |
-
?>
|
12 |
-
<div id="<?php
|
13 |
-
echo \esc_attr($plugin_slug);
|
14 |
-
?>-activation-form" class="wpdesk-license-activation-form">
|
15 |
-
<style>
|
16 |
-
#<?php
|
17 |
-
echo \esc_html($plugin_slug);
|
18 |
-
?>-activation-form {
|
19 |
-
overflow: hidden;
|
20 |
-
}
|
21 |
-
#<?php
|
22 |
-
echo \esc_html($plugin_slug);
|
23 |
-
?>-activation-form div {
|
24 |
-
float: left;
|
25 |
-
margin-right: 10px;
|
26 |
-
margin-bottom: 3px;
|
27 |
-
}
|
28 |
-
#<?php
|
29 |
-
echo \esc_html($plugin_slug);
|
30 |
-
?>-activation-form div input[type=text] {
|
31 |
-
min-width: 350px;
|
32 |
-
box-shadow: 0 0 0 transparent;
|
33 |
-
border-radius: 4px;
|
34 |
-
border: 1px solid #8c8f94;
|
35 |
-
background-color: #fff;
|
36 |
-
color: #2c3338;
|
37 |
-
}
|
38 |
-
#<?php
|
39 |
-
echo \esc_html($plugin_slug);
|
40 |
-
?>-activation-form div input[type=text]:disabled {
|
41 |
-
background: rgba(255,255,255,.5);
|
42 |
-
border-color: rgba(220,220,222,.75);
|
43 |
-
box-shadow: inset 0 1px 2px rgb(0 0 0 / 4%);
|
44 |
-
color: rgba(44,51,56,.5);
|
45 |
-
}
|
46 |
-
#<?php
|
47 |
-
echo \esc_html($plugin_slug);
|
48 |
-
?>-activation-form div.wpdesk-license-notice {
|
49 |
-
float: none;
|
50 |
-
margin-left: 0px;
|
51 |
-
font-weight: bold;
|
52 |
-
padding: 10px 10px 10px 20px;
|
53 |
-
color: rgb(60, 67, 74);
|
54 |
-
}
|
55 |
-
</style>
|
56 |
-
<div class="wpdesk-license-activation-form-content">
|
57 |
-
<?php
|
58 |
-
$form_content->output_render();
|
59 |
-
?>
|
60 |
-
</div>
|
61 |
-
<script type="text/javascript">
|
62 |
-
jQuery(function(){
|
63 |
-
let plugin_slug = "<?php
|
64 |
-
echo \esc_html($plugin_slug);
|
65 |
-
?>";
|
66 |
-
let admin_ajax_url = "<?php
|
67 |
-
echo \esc_url(\admin_url('admin-ajax.php'));
|
68 |
-
?>";
|
69 |
-
let plugin_file = "<?php
|
70 |
-
echo \esc_attr($plugin_file);
|
71 |
-
?>";
|
72 |
-
let nonce = "<?php
|
73 |
-
echo \esc_attr(\wp_create_nonce(\FSVendor\WPDesk\License\ActivationForm\AjaxHandler::AJAX_ACTION));
|
74 |
-
?>";
|
75 |
-
let alert_text = "<?php
|
76 |
-
echo \esc_attr(\__('The action failed with an error: ', 'flexible-shipping'));
|
77 |
-
?>";
|
78 |
-
let enter_license_key = "<?php
|
79 |
-
echo \esc_attr(\__('Enter license key', 'flexible-shipping'));
|
80 |
-
?>";
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Sends AJAX request.
|
84 |
-
* @param {string} action
|
85 |
-
* @param {object} $button
|
86 |
-
*/
|
87 |
-
function send_ajax_request( action, $button ) {
|
88 |
-
$button.prop( "disabled", true );
|
89 |
-
$button.parent().find( "span.spinner" ).addClass( 'is-active' );
|
90 |
-
let api_key = jQuery( "#" + plugin_slug + "-activation-form input[name='api_key']" ).val();
|
91 |
-
let activation_email = ' ';
|
92 |
-
jQuery.ajax({
|
93 |
-
type : "post",
|
94 |
-
dataType : "json",
|
95 |
-
url : admin_ajax_url,
|
96 |
-
data : {
|
97 |
-
action: "wpdesk_license_activation_" + plugin_file,
|
98 |
-
license_action: action,
|
99 |
-
api_key : api_key,
|
100 |
-
activation_email: activation_email,
|
101 |
-
security: nonce,
|
102 |
-
},
|
103 |
-
success: function( response ) {
|
104 |
-
if ( response.success ) {
|
105 |
-
let $form_content = jQuery( "#" + plugin_slug + "-activation-form div.wpdesk-license-activation-form-content" );
|
106 |
-
$form_content.html( response.data.activation_form_content );
|
107 |
-
$form_content.parent().trigger( "license-updated", response.data );
|
108 |
-
}
|
109 |
-
jQuery( "#" + plugin_slug + "-update" ).remove();
|
110 |
-
},
|
111 |
-
error: function ( xhr, ajaxOptions, thrownError ) {
|
112 |
-
alert( alert_text + thrownError );
|
113 |
-
$button.prop( "disabled", false );
|
114 |
-
$button.parent().find( "span.spinner" ).removeClass( "is-active" );
|
115 |
-
}
|
116 |
-
});
|
117 |
-
}
|
118 |
-
jQuery(document).on( "click", "#" + plugin_slug + "-activation-form button.deactivate", function (event) {
|
119 |
-
event.preventDefault();
|
120 |
-
send_ajax_request( 'deactivate', jQuery( this ) );
|
121 |
-
});
|
122 |
-
jQuery(document).on( "click", "#" + plugin_slug + "-activation-form button.activate", function (event) {
|
123 |
-
event.preventDefault();
|
124 |
-
let $api_key = jQuery( "#" + plugin_slug + "-activation-form input[name='api_key']" );
|
125 |
-
let api_key_val = $api_key.val();
|
126 |
-
if ( "" !== api_key_val ) {
|
127 |
-
send_ajax_request( "activate", jQuery( this ) );
|
128 |
-
} else {
|
129 |
-
$api_key.focus();
|
130 |
-
$api_key.attr( "placeholder", enter_license_key );
|
131 |
-
}
|
132 |
-
});
|
133 |
-
});
|
134 |
-
</script>
|
135 |
-
</div>
|
136 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ActivationForm/views/plugins-page-row.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var string $status
|
7 |
-
* @var bool $is_active
|
8 |
-
* @var string $plugin_slug
|
9 |
-
* @var string $plugin_file
|
10 |
-
* @var bool $update_possible
|
11 |
-
* @var WPDesk\License\ActivationForm\Renderer $form_content
|
12 |
-
*/
|
13 |
-
?><tr class="plugin-update-tr plugin-wpdesk-license-tr active" id="<?php
|
14 |
-
echo \esc_attr($plugin_slug);
|
15 |
-
?>-wpdesk-license" data-slug="<?php
|
16 |
-
echo \esc_attr($plugin_slug);
|
17 |
-
?>" data-plugin="<?php
|
18 |
-
echo \esc_attr($plugin_file);
|
19 |
-
?>">
|
20 |
-
<td colspan="10" class="plugin-update colspanchange">
|
21 |
-
<div id="<?php
|
22 |
-
echo \esc_attr($plugin_slug);
|
23 |
-
?>-wpdesk-license-activation-notice" class="notice inline notice-alt <?php
|
24 |
-
echo \esc_html($is_active && $update_possible ? 'notice-success' : 'notice-warning');
|
25 |
-
?>">
|
26 |
-
<?php
|
27 |
-
$form_content->output_render();
|
28 |
-
?>
|
29 |
-
</div>
|
30 |
-
<script type="text/javascript">
|
31 |
-
jQuery(function() {
|
32 |
-
let plugin_slug = "<?php
|
33 |
-
echo \esc_html($plugin_slug);
|
34 |
-
?>";
|
35 |
-
let plugin_file = "<?php
|
36 |
-
echo \esc_attr($plugin_file);
|
37 |
-
?>";
|
38 |
-
let $plugin_tr = jQuery("tr[data-plugin='" + plugin_file + "']");
|
39 |
-
if ( $plugin_tr.hasClass('update') ) {
|
40 |
-
jQuery( "#" + plugin_slug + "-wpdesk-license" ).find( 'td' ).css( 'box-shadow', 'none' );
|
41 |
-
}
|
42 |
-
$plugin_tr.addClass('update');
|
43 |
-
jQuery( "#" + plugin_slug + "-wpdesk-license-activation-notice" ).on( 'license-updated', function( event, data ){
|
44 |
-
let $notice_div = jQuery( this );
|
45 |
-
if ( data.is_active ) {
|
46 |
-
$notice_div.addClass( 'notice-success' );
|
47 |
-
$notice_div.removeClass( 'notice-warning' );
|
48 |
-
} else {
|
49 |
-
$notice_div.addClass( 'notice-warning' );
|
50 |
-
$notice_div.removeClass( 'notice-success' );
|
51 |
-
}
|
52 |
-
});
|
53 |
-
});
|
54 |
-
</script>
|
55 |
-
</td>
|
56 |
-
</tr>
|
57 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-menu.php
DELETED
@@ -1,316 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Admin Menu Class
|
7 |
-
*
|
8 |
-
* @package Update API Manager/Admin
|
9 |
-
* @author Todd Lahman LLC, WPDesk
|
10 |
-
* @copyright Copyright (c) Todd Lahman LLC
|
11 |
-
* @since 1.3
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
if (!\defined('ABSPATH')) {
|
15 |
-
exit;
|
16 |
-
}
|
17 |
-
// Exit if accessed directly
|
18 |
-
if (!\class_exists('FSVendor\\WPDesk_API_MENU')) {
|
19 |
-
class WPDesk_API_MENU
|
20 |
-
{
|
21 |
-
private $api_manager;
|
22 |
-
// Load admin menu
|
23 |
-
public function __construct($api_manager)
|
24 |
-
{
|
25 |
-
$this->api_manager = $api_manager;
|
26 |
-
}
|
27 |
-
// Draw option page
|
28 |
-
public function config_page()
|
29 |
-
{
|
30 |
-
$settings_tabs = [$this->api_manager->activation_tab_key => \__($this->api_manager->menu_tab_activation_title, $this->api_manager->text_domain), $this->api_manager->deactivation_tab_key => \__($this->api_manager->menu_tab_deactivation_title, $this->api_manager->text_domain)];
|
31 |
-
$current_tab = isset($_GET['tab']) ? \sanitize_key($_GET['tab']) : $this->api_manager->activation_tab_key;
|
32 |
-
$tab = isset($_GET['tab']) ? \sanitize_key($_GET['tab']) : $this->api_manager->activation_tab_key;
|
33 |
-
?>
|
34 |
-
<div class='wrap'>
|
35 |
-
<?php
|
36 |
-
/* screen_icon(); */
|
37 |
-
?>
|
38 |
-
<h2><?php
|
39 |
-
echo \wp_kses_post(\__($this->api_manager->settings_title, $this->api_manager->text_domain));
|
40 |
-
?></h2>
|
41 |
-
<?php
|
42 |
-
\settings_errors();
|
43 |
-
?>
|
44 |
-
<h2 class="nav-tab-wrapper">
|
45 |
-
<?php
|
46 |
-
foreach ($settings_tabs as $tab_page => $tab_name) {
|
47 |
-
$active_tab = $current_tab == $tab_page ? 'nav-tab-active' : '';
|
48 |
-
echo \wp_kses_post('<a class="nav-tab ' . $active_tab . '" href="?page=' . $this->api_manager->activation_tab_key . '&tab=' . $tab_page . '">' . $tab_name . '</a>');
|
49 |
-
}
|
50 |
-
?>
|
51 |
-
</h2>
|
52 |
-
<form action='options.php' method='post'>
|
53 |
-
<div class="main">
|
54 |
-
<?php
|
55 |
-
if ($tab == $this->api_manager->activation_tab_key) {
|
56 |
-
\settings_fields($this->api_manager->data_key);
|
57 |
-
\do_settings_sections($this->api_manager->activation_tab_key);
|
58 |
-
//if (get_option( $this->api_manager->activated_key, '0' ) != 'Activated') {
|
59 |
-
\submit_button(\__('Save Changes', $this->api_manager->text_domain));
|
60 |
-
//}
|
61 |
-
} else {
|
62 |
-
\settings_fields($this->api_manager->deactivate_checkbox);
|
63 |
-
\do_settings_sections($this->api_manager->deactivation_tab_key);
|
64 |
-
\submit_button(\__('Save Changes', $this->api_manager->text_domain));
|
65 |
-
}
|
66 |
-
?>
|
67 |
-
</div>
|
68 |
-
</form>
|
69 |
-
</div>
|
70 |
-
<?php
|
71 |
-
}
|
72 |
-
// Register settings
|
73 |
-
public function load_settings()
|
74 |
-
{
|
75 |
-
\register_setting($this->api_manager->data_key, $this->api_manager->data_key, [$this, 'validate_options']);
|
76 |
-
// API Key
|
77 |
-
\add_settings_section($this->api_manager->api_key, \__('API Key Activation', $this->api_manager->text_domain), [$this, 'wc_am_api_key_text'], $this->api_manager->activation_tab_key);
|
78 |
-
\add_settings_field('status', \__('API Key Status', $this->api_manager->text_domain), [$this, 'wc_am_api_key_status'], $this->api_manager->activation_tab_key, $this->api_manager->api_key);
|
79 |
-
\add_settings_field($this->api_manager->api_key, \__('API Subscription Key', $this->api_manager->text_domain), [$this, 'wc_am_api_key_field'], $this->api_manager->activation_tab_key, $this->api_manager->api_key);
|
80 |
-
\add_settings_field($this->api_manager->activation_email, \__('API Subscription email', $this->api_manager->text_domain), [$this, 'wc_am_api_email_field'], $this->api_manager->activation_tab_key, $this->api_manager->api_key);
|
81 |
-
// Activation settings
|
82 |
-
\register_setting($this->api_manager->deactivate_checkbox, $this->api_manager->deactivate_checkbox, [$this, 'wc_am_license_key_deactivation']);
|
83 |
-
\add_settings_section('deactivate_button', \__('API Key Deactivation', $this->api_manager->text_domain), [$this, 'wc_am_deactivate_text'], $this->api_manager->deactivation_tab_key);
|
84 |
-
\add_settings_field('deactivate_button', \__('Deactivate API Key', $this->api_manager->text_domain), [$this, 'wc_am_deactivate_textarea'], $this->api_manager->deactivation_tab_key, 'deactivate_button');
|
85 |
-
}
|
86 |
-
// Provides text for api key section
|
87 |
-
public function wc_am_api_key_text()
|
88 |
-
{
|
89 |
-
//
|
90 |
-
}
|
91 |
-
// Returns the API License Key status from the WooCommerce API Manager on the server
|
92 |
-
public function wc_am_api_key_status()
|
93 |
-
{
|
94 |
-
$license_status = $this->license_key_status();
|
95 |
-
$license_status_check = !empty($license_status['status_check']) && $license_status['status_check'] == 'active' ? 'Activated' : 'Deactivated';
|
96 |
-
if (!empty($license_status_check)) {
|
97 |
-
echo \esc_html($license_status_check);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
// Returns API License text field
|
101 |
-
public function wc_am_api_key_field()
|
102 |
-
{
|
103 |
-
echo \wp_kses_post("<input id='api_key' name='" . $this->api_manager->data_key . "[" . $this->api_manager->api_key . "]' size='55' type='text' value='" . $this->api_manager->options[$this->api_manager->api_key] . "' />");
|
104 |
-
if ($this->api_manager->options[$this->api_manager->api_key]) {
|
105 |
-
echo \wp_kses_post("<span class='icon-pos'><img src='" . \plugins_url("wpdesk-helper/assets/images/complete.png") . "' title='' style='padding-bottom: 4px; vertical-align: middle; margin-right:3px;' /></span>");
|
106 |
-
} else {
|
107 |
-
echo \wp_kses_post("<span class='icon-pos'><img src='" . \plugins_url("wpdesk-helper/assets/images/warn.png") . "' title='' style='padding-bottom: 4px; vertical-align: middle; margin-right:3px;' /></span>");
|
108 |
-
}
|
109 |
-
}
|
110 |
-
// Returns API License email text field
|
111 |
-
public function wc_am_api_email_field()
|
112 |
-
{
|
113 |
-
echo \wp_kses_post("<input id='activation_email' name='" . $this->api_manager->data_key . "[" . $this->api_manager->activation_email . "]' size='55' type='text' value='" . $this->api_manager->options[$this->api_manager->activation_email] . "' />");
|
114 |
-
if ($this->api_manager->options[$this->api_manager->activation_email]) {
|
115 |
-
echo \wp_kses_post("<span class='icon-pos'><img src='" . \plugins_url("wpdesk-helper/assets/images/complete.png") . "' title='' style='padding-bottom: 4px; vertical-align: middle; margin-right:3px;' /></span>");
|
116 |
-
} else {
|
117 |
-
echo \wp_kses_post("<span class='icon-pos'><img src='" . \plugins_url("wpdesk-helper/assets/images/warn.png") . "' title='' style='padding-bottom: 4px; vertical-align: middle; margin-right:3px;' /></span>");
|
118 |
-
}
|
119 |
-
}
|
120 |
-
// Sanitizes and validates all input and output for Dashboard
|
121 |
-
public function validate_options($input)
|
122 |
-
{
|
123 |
-
// Load existing options, validate, and update with changes from input before returning
|
124 |
-
$options = $this->api_manager->options;
|
125 |
-
$options[$this->api_manager->api_key] = \trim($input[$this->api_manager->api_key]);
|
126 |
-
$options[$this->api_manager->activation_email] = \trim($input[$this->api_manager->activation_email]);
|
127 |
-
/**
|
128 |
-
* Plugin Activation
|
129 |
-
*/
|
130 |
-
$api_email = \trim($input[$this->api_manager->activation_email]);
|
131 |
-
$api_key = \trim($input[$this->api_manager->api_key]);
|
132 |
-
$activation_status = \get_option($this->api_manager->activated_key);
|
133 |
-
$checkbox_status = \get_option($this->api_manager->deactivate_checkbox);
|
134 |
-
$current_api_key = $this->api_manager->options[$this->api_manager->api_key];
|
135 |
-
// Should match the settings_fields() value
|
136 |
-
if ($_REQUEST['option_page'] != $this->api_manager->deactivate_checkbox) {
|
137 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
138 |
-
if ($activation_status == 'Deactivated' || $activation_status == '' || $api_key == '' || $api_email == '' || $checkbox_status == 'on' || $current_api_key != $api_key) {
|
139 |
-
/**
|
140 |
-
* If this is a new key, and an existing key already exists in the database,
|
141 |
-
* deactivate the existing key before activating the new key.
|
142 |
-
*/
|
143 |
-
if ($current_api_key != $api_key) {
|
144 |
-
$this->replace_license_key($current_api_key);
|
145 |
-
}
|
146 |
-
$args = ['email' => $api_email, 'licence_key' => $api_key];
|
147 |
-
$activate_results = \json_decode($this->api_manager->key()->activate($args), \true);
|
148 |
-
if ($activate_results['activated'] === \true) {
|
149 |
-
\add_settings_error('activate_text', 'activate_msg', \__('Plugin activated. ', $this->api_manager->text_domain) . "{$activate_results['message']}.", 'updated');
|
150 |
-
\update_option($this->api_manager->activated_key, 'Activated');
|
151 |
-
\update_option($this->api_manager->deactivate_checkbox, 'off');
|
152 |
-
}
|
153 |
-
if ($activate_results == \false) {
|
154 |
-
\add_settings_error('api_key_check_text', 'api_key_check_error', \__('Connection failed to the API Key server. Try again later.', $this->api_manager->text_domain), 'error');
|
155 |
-
$options[$this->api_manager->api_key] = '';
|
156 |
-
$options[$this->api_manager->activation_email] = '';
|
157 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
158 |
-
}
|
159 |
-
if (isset($activate_results['code'])) {
|
160 |
-
switch ($activate_results['code']) {
|
161 |
-
case '100':
|
162 |
-
\add_settings_error('api_email_text', 'api_email_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
163 |
-
$options[$this->api_manager->activation_email] = '';
|
164 |
-
$options[$this->api_manager->api_key] = '';
|
165 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
166 |
-
break;
|
167 |
-
case '101':
|
168 |
-
\add_settings_error('api_key_text', 'api_key_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
169 |
-
$options[$this->api_manager->api_key] = '';
|
170 |
-
$options[$this->api_manager->activation_email] = '';
|
171 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
172 |
-
break;
|
173 |
-
case '102':
|
174 |
-
\add_settings_error('api_key_purchase_incomplete_text', 'api_key_purchase_incomplete_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
175 |
-
$options[$this->api_manager->api_key] = '';
|
176 |
-
$options[$this->api_manager->activation_email] = '';
|
177 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
178 |
-
break;
|
179 |
-
case '103':
|
180 |
-
\add_settings_error('api_key_exceeded_text', 'api_key_exceeded_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
181 |
-
$options[$this->api_manager->api_key] = '';
|
182 |
-
$options[$this->api_manager->activation_email] = '';
|
183 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
184 |
-
break;
|
185 |
-
case '104':
|
186 |
-
\add_settings_error('api_key_not_activated_text', 'api_key_not_activated_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
187 |
-
$options[$this->api_manager->api_key] = '';
|
188 |
-
$options[$this->api_manager->activation_email] = '';
|
189 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
190 |
-
break;
|
191 |
-
case '105':
|
192 |
-
\add_settings_error('api_key_invalid_text', 'api_key_invalid_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
193 |
-
$options[$this->api_manager->api_key] = '';
|
194 |
-
$options[$this->api_manager->activation_email] = '';
|
195 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
196 |
-
break;
|
197 |
-
case '106':
|
198 |
-
\add_settings_error('sub_not_active_text', 'sub_not_active_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
199 |
-
$options[$this->api_manager->api_key] = '';
|
200 |
-
$options[$this->api_manager->activation_email] = '';
|
201 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
202 |
-
break;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
}
|
206 |
-
// End Plugin Activation
|
207 |
-
}
|
208 |
-
return $options;
|
209 |
-
}
|
210 |
-
// Returns the API License Key status from the WooCommerce API Manager on the server
|
211 |
-
public function license_key_status()
|
212 |
-
{
|
213 |
-
$activation_status = \get_option($this->api_manager->activated_key);
|
214 |
-
$args = ['email' => $this->api_manager->options[$this->api_manager->activation_email], 'licence_key' => $this->api_manager->options[$this->api_manager->api_key]];
|
215 |
-
return \json_decode($this->api_manager->key()->status($args), \true);
|
216 |
-
}
|
217 |
-
// Deactivate the current license key before activating the new license key
|
218 |
-
public function replace_license_key($current_api_key)
|
219 |
-
{
|
220 |
-
$args = ['email' => $this->api_manager->options[$this->api_manager->activation_email], 'licence_key' => $current_api_key];
|
221 |
-
$reset = $this->api_manager->key()->deactivate($args);
|
222 |
-
// reset license key activation
|
223 |
-
if ($reset == \true) {
|
224 |
-
return \true;
|
225 |
-
}
|
226 |
-
return \add_settings_error('not_deactivated_text', 'not_deactivated_error', \__('The subscription could not be deactivated. Use the Subscription Deactivation tab to manually deactivate the subscription before activating a new subscription.', $this->api_manager->text_domain), 'updated');
|
227 |
-
}
|
228 |
-
// Deactivates the license key to allow key to be used on another blog
|
229 |
-
public function wc_am_license_key_deactivation($input)
|
230 |
-
{
|
231 |
-
$activation_status = \get_option($this->api_manager->activated_key);
|
232 |
-
$args = ['email' => $this->api_manager->options[$this->api_manager->activation_email], 'licence_key' => $this->api_manager->options[$this->api_manager->api_key]];
|
233 |
-
// For testing activation status_extra data
|
234 |
-
// $activate_results = json_decode( $this->api_manager->key()->status( $args ), true );
|
235 |
-
// print_r($activate_results); exit;
|
236 |
-
$options = $input == 'on' ? 'on' : 'off';
|
237 |
-
if ($options == 'on' && $activation_status == 'Activated' && $this->api_manager->options[$this->api_manager->api_key] != '' && $this->api_manager->options[$this->api_manager->activation_email] != '') {
|
238 |
-
// deactivates license key activation
|
239 |
-
$activate_results = \json_decode($this->api_manager->key()->deactivate($args), \true);
|
240 |
-
// Used to display results for development
|
241 |
-
//print_r($activate_results); exit();
|
242 |
-
if ($activate_results['deactivated'] === \true) {
|
243 |
-
$update = [$this->api_manager->api_key => '', $this->api_manager->activation_email => ''];
|
244 |
-
$merge_options = \array_merge($this->api_manager->options, $update);
|
245 |
-
\update_option($this->api_manager->data_key, $merge_options);
|
246 |
-
\update_option($this->api_manager->activated_key, 'Deactivated');
|
247 |
-
\add_settings_error('wc_am_deactivate_text', 'deactivate_msg', \__('Plugin subscription deactivated. ', $this->api_manager->text_domain) . "{$activate_results['activations_remaining']}.", 'updated');
|
248 |
-
return $options;
|
249 |
-
}
|
250 |
-
if (isset($activate_results['code'])) {
|
251 |
-
switch ($activate_results['code']) {
|
252 |
-
case '100':
|
253 |
-
\add_settings_error('api_email_text', 'api_email_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
254 |
-
$options[$this->api_manager->activation_email] = '';
|
255 |
-
$options[$this->api_manager->api_key] = '';
|
256 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
257 |
-
break;
|
258 |
-
case '101':
|
259 |
-
\add_settings_error('api_key_text', 'api_key_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
260 |
-
$options[$this->api_manager->api_key] = '';
|
261 |
-
$options[$this->api_manager->activation_email] = '';
|
262 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
263 |
-
break;
|
264 |
-
case '102':
|
265 |
-
\add_settings_error('api_key_purchase_incomplete_text', 'api_key_purchase_incomplete_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
266 |
-
$options[$this->api_manager->api_key] = '';
|
267 |
-
$options[$this->api_manager->activation_email] = '';
|
268 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
269 |
-
break;
|
270 |
-
case '103':
|
271 |
-
\add_settings_error('api_key_exceeded_text', 'api_key_exceeded_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
272 |
-
$options[$this->api_manager->api_key] = '';
|
273 |
-
$options[$this->api_manager->activation_email] = '';
|
274 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
275 |
-
break;
|
276 |
-
case '104':
|
277 |
-
\add_settings_error('api_key_not_activated_text', 'api_key_not_activated_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
278 |
-
$options[$this->api_manager->api_key] = '';
|
279 |
-
$options[$this->api_manager->activation_email] = '';
|
280 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
281 |
-
break;
|
282 |
-
case '105':
|
283 |
-
\add_settings_error('api_key_invalid_text', 'api_key_invalid_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
284 |
-
$options[$this->api_manager->api_key] = '';
|
285 |
-
$options[$this->api_manager->activation_email] = '';
|
286 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
287 |
-
break;
|
288 |
-
case '106':
|
289 |
-
\add_settings_error('sub_not_active_text', 'sub_not_active_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
290 |
-
$options[$this->api_manager->api_key] = '';
|
291 |
-
$options[$this->api_manager->activation_email] = '';
|
292 |
-
\update_option($this->api_manager->options[$this->api_manager->activated_key], 'Deactivated');
|
293 |
-
break;
|
294 |
-
}
|
295 |
-
}
|
296 |
-
} else {
|
297 |
-
return $options;
|
298 |
-
}
|
299 |
-
}
|
300 |
-
public function wc_am_deactivate_text()
|
301 |
-
{
|
302 |
-
}
|
303 |
-
public function wc_am_deactivate_textarea()
|
304 |
-
{
|
305 |
-
echo \wp_kses_post('<input type="checkbox" id="' . $this->api_manager->deactivate_checkbox . '" name="' . $this->api_manager->deactivate_checkbox . '" value="on"');
|
306 |
-
echo \wp_kses_post(\checked(\get_option($this->api_manager->deactivate_checkbox), 'on'));
|
307 |
-
echo \wp_kses_post('/>');
|
308 |
-
?><span class="description"><?php
|
309 |
-
\wp_kses_post(\__('Deactivates an API Key so it can be used on another blog.', $this->api_manager->text_domain));
|
310 |
-
?></span>
|
311 |
-
<?php
|
312 |
-
}
|
313 |
-
}
|
314 |
-
// class WPDesk_API_MENU
|
315 |
-
}
|
316 |
-
// if (!class_exists('WPDesk_API_MENU'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager-passwords.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
if (!\defined('ABSPATH')) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
// Exit if accessed directly
|
9 |
-
/**
|
10 |
-
* WooCommerce API Manager Passwords Class
|
11 |
-
*
|
12 |
-
* @package Update API Manager/Passwords
|
13 |
-
* @author Todd Lahman LLC, WPDesk
|
14 |
-
* @copyright Copyright (c) Todd Lahman LLC
|
15 |
-
* @since 1.0.0
|
16 |
-
*
|
17 |
-
*/
|
18 |
-
if (!\class_exists('FSVendor\\WPDesk_API_Password_Management')) {
|
19 |
-
class WPDesk_API_Password_Management
|
20 |
-
{
|
21 |
-
private function rand($min = 0, $max = 0)
|
22 |
-
{
|
23 |
-
global $rnd_value;
|
24 |
-
// Reset $rnd_value after 14 uses
|
25 |
-
// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
|
26 |
-
if (\strlen($rnd_value) < 8) {
|
27 |
-
if (\defined('FSVendor\\WP_SETUP_CONFIG')) {
|
28 |
-
static $seed = '';
|
29 |
-
} else {
|
30 |
-
$seed = \get_transient('random_seed');
|
31 |
-
}
|
32 |
-
$rnd_value = \md5(\uniqid(\microtime() . \mt_rand(), \true) . $seed);
|
33 |
-
$rnd_value .= \sha1($rnd_value);
|
34 |
-
$rnd_value .= \sha1($rnd_value . $seed);
|
35 |
-
$seed = \md5($seed . $rnd_value);
|
36 |
-
if (!\defined('FSVendor\\WP_SETUP_CONFIG')) {
|
37 |
-
\set_transient('random_seed', $seed);
|
38 |
-
}
|
39 |
-
}
|
40 |
-
// Take the first 8 digits for our value
|
41 |
-
$value = \substr($rnd_value, 0, 8);
|
42 |
-
// Strip the first eight, leaving the remainder for the next call to wp_rand().
|
43 |
-
$rnd_value = \substr($rnd_value, 8);
|
44 |
-
$value = \abs(\hexdec($value));
|
45 |
-
// Some misconfigured 32bit environments (Entropy PHP, for example) truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
|
46 |
-
$max_random_number = 3000000000 === 2147483647 ? (float) "4294967295" : 4294967295;
|
47 |
-
// 4294967295 = 0xffffffff
|
48 |
-
// Reduce the value to be within the min - max range
|
49 |
-
if ($max != 0) {
|
50 |
-
$value = $min + ($max - $min + 1) * $value / ($max_random_number + 1);
|
51 |
-
}
|
52 |
-
return \abs(\intval($value));
|
53 |
-
}
|
54 |
-
// Creates a unique instance ID
|
55 |
-
public function generate_password($length = 12, $special_chars = \true, $extra_special_chars = \false)
|
56 |
-
{
|
57 |
-
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
58 |
-
if ($special_chars) {
|
59 |
-
$chars .= '!@#$%^&*()';
|
60 |
-
}
|
61 |
-
if ($extra_special_chars) {
|
62 |
-
$chars .= '-_ []{}<>~`+=,.;:/?|';
|
63 |
-
}
|
64 |
-
$password = '';
|
65 |
-
for ($i = 0; $i < $length; $i++) {
|
66 |
-
$password .= \substr($chars, self::rand(0, \strlen($chars) - 1), 1);
|
67 |
-
}
|
68 |
-
// random_password filter was previously in random_password function which was deprecated
|
69 |
-
return $password;
|
70 |
-
}
|
71 |
-
}
|
72 |
-
// class Ilabs_API_Password_Management
|
73 |
-
}
|
74 |
-
// if (!class_exists('Ilabs_API_Password_Management'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-api-manager.php
DELETED
@@ -1,386 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
// Exit if accessed directly
|
6 |
-
use FSVendor\WPDesk\Notice\AjaxHandler;
|
7 |
-
use FSVendor\WPDesk\Notice\PermanentDismissibleNotice;
|
8 |
-
if (!\defined('ABSPATH')) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
if (!\class_exists('FSVendor\\WPDesk_API_Manager_With_Update_Flag')) {
|
12 |
-
class WPDesk_API_Manager_With_Update_Flag
|
13 |
-
{
|
14 |
-
const ACTIVATED = 'Activated';
|
15 |
-
/**
|
16 |
-
* Self Upgrade Values
|
17 |
-
*/
|
18 |
-
// Base URL to the remote upgrade API Manager server. If not set then the Author URI is used.
|
19 |
-
public $upgrade_url;
|
20 |
-
/**
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
//public $version = '4.0';
|
24 |
-
public $version;
|
25 |
-
/**
|
26 |
-
* @var string
|
27 |
-
* This version is saved after an upgrade to compare this db version to $version
|
28 |
-
*/
|
29 |
-
public $api_version_name;
|
30 |
-
/**
|
31 |
-
* Software Product ID is the product title string
|
32 |
-
* This value must be unique, and it must match the API tab for the product in WooCommerce
|
33 |
-
*/
|
34 |
-
private $software_product_id;
|
35 |
-
public $plugin_dir;
|
36 |
-
/**
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
private $plugin_title;
|
40 |
-
/**
|
41 |
-
* @var string
|
42 |
-
* used to defined localization for translation, but a string literal is preferred
|
43 |
-
*
|
44 |
-
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/issues/59
|
45 |
-
* http://markjaquith.wordpress.com/2011/10/06/translating-wordpress-plugins-and-themes-dont-get-clever/
|
46 |
-
* http://ottopress.com/2012/internationalization-youre-probably-doing-it-wrong/
|
47 |
-
*/
|
48 |
-
public $text_domain = 'flexible-shipping';
|
49 |
-
/**
|
50 |
-
* @var string
|
51 |
-
*/
|
52 |
-
public $plugin_url;
|
53 |
-
/**
|
54 |
-
* Data defaults
|
55 |
-
* @var mixed
|
56 |
-
*/
|
57 |
-
public $data_key;
|
58 |
-
public $api_key;
|
59 |
-
public $activation_email;
|
60 |
-
public $product_id_key;
|
61 |
-
public $instance_key;
|
62 |
-
public $deactivate_checkbox_key;
|
63 |
-
public $activated_key;
|
64 |
-
public $upgrade_url_key;
|
65 |
-
public $deactivate_checkbox;
|
66 |
-
public $activation_tab_key;
|
67 |
-
public $deactivation_tab_key;
|
68 |
-
public $menu_tab_activation_title;
|
69 |
-
public $menu_tab_deactivation_title;
|
70 |
-
public $options;
|
71 |
-
public $plugin_name;
|
72 |
-
public $product_id;
|
73 |
-
public $renew_license_url;
|
74 |
-
public $instance_id;
|
75 |
-
public $domain;
|
76 |
-
public $software_version;
|
77 |
-
public $plugin_or_theme;
|
78 |
-
public $update_version;
|
79 |
-
/**
|
80 |
-
* Used to send any extra information.
|
81 |
-
* @var mixed array, object, string, etc.
|
82 |
-
*/
|
83 |
-
public $extra;
|
84 |
-
/**
|
85 |
-
*/
|
86 |
-
private $key_insance = null;
|
87 |
-
private $update_check_insance = null;
|
88 |
-
/**
|
89 |
-
* Cloning is forbidden.
|
90 |
-
*
|
91 |
-
* @since 1.2
|
92 |
-
*/
|
93 |
-
private function __clone()
|
94 |
-
{
|
95 |
-
}
|
96 |
-
/**
|
97 |
-
* Unserializing instances of this class is forbidden.
|
98 |
-
*
|
99 |
-
* @since 1.2
|
100 |
-
*/
|
101 |
-
public function __wakeup()
|
102 |
-
{
|
103 |
-
}
|
104 |
-
public function __construct($upgrade_url, $version, $name, $product_id, $plugin_file, $plugin_dir, $hook_to_updates = \true, $plugin_title = null)
|
105 |
-
{
|
106 |
-
global $wpdesk_installed_plugins;
|
107 |
-
if (!$wpdesk_installed_plugins) {
|
108 |
-
$wpdesk_installed_plugins = [];
|
109 |
-
}
|
110 |
-
$wpdesk_installed_plugins[\trailingslashit($plugin_dir) . $plugin_file] = $this;
|
111 |
-
//
|
112 |
-
$this->upgrade_url_key = "api_{$plugin_dir}_upgrade_url";
|
113 |
-
$tmp_upgrade_url = \get_option($this->upgrade_url_key, '');
|
114 |
-
if ($tmp_upgrade_url == '') {
|
115 |
-
$tmp_upgrade_url = $upgrade_url;
|
116 |
-
\update_option($this->upgrade_url_key, $tmp_upgrade_url);
|
117 |
-
}
|
118 |
-
$this->upgrade_url = $tmp_upgrade_url;
|
119 |
-
$this->version = $version;
|
120 |
-
$this->api_version_name = 'plugin_' . $name . '_version';
|
121 |
-
$this->software_product_id = $product_id;
|
122 |
-
$this->plugin_dir = $plugin_dir;
|
123 |
-
$this->plugin_title = $plugin_title;
|
124 |
-
$this->plugin_url = \plugins_url('/', $plugin_file);
|
125 |
-
if (\is_admin()) {
|
126 |
-
// Check for external connection blocking
|
127 |
-
\add_action('admin_notices', [$this, 'check_external_blocking']);
|
128 |
-
/**
|
129 |
-
* Set all data defaults here
|
130 |
-
*/
|
131 |
-
$this->data_key = 'api_' . $plugin_dir;
|
132 |
-
$this->api_key = "api_{$plugin_dir}_key";
|
133 |
-
$this->activation_email = "api_{$plugin_dir}_activation_email";
|
134 |
-
$this->product_id_key = "api_{$plugin_dir}_product_id";
|
135 |
-
$this->instance_key = "api_{$plugin_dir}_instance";
|
136 |
-
$this->deactivate_checkbox_key = "api_{$plugin_dir}_deactivate_checkbox";
|
137 |
-
$this->activated_key = "api_{$plugin_dir}_activated";
|
138 |
-
/**
|
139 |
-
* Set all admin menu data
|
140 |
-
*/
|
141 |
-
$this->deactivate_checkbox = 'am_deactivate_example_checkbox';
|
142 |
-
$this->activation_tab_key = "api_{$plugin_dir}_dashboard";
|
143 |
-
$this->deactivation_tab_key = "api_{$plugin_dir}_deactivation";
|
144 |
-
$this->menu_tab_activation_title = \__('Subscription Activation', $this->text_domain);
|
145 |
-
$this->menu_tab_deactivation_title = \__('Subscription Deactivation', $this->text_domain);
|
146 |
-
/**
|
147 |
-
* Set all software update data here
|
148 |
-
*/
|
149 |
-
$this->options = \get_option($this->data_key);
|
150 |
-
//$this->plugin_name = untrailingslashit( dirname( $plugin_file) ); // same as plugin slug. if a theme use a theme name like 'twentyeleven'
|
151 |
-
$this->plugin_name = $name;
|
152 |
-
// same as plugin slug. if a theme use a theme name like 'twentyeleven'
|
153 |
-
$this->product_id = $this->software_product_id;
|
154 |
-
//get_option( $this->product_id_key ); // Software Title
|
155 |
-
$this->renew_license_url = $this->upgrade_url . '/my-account';
|
156 |
-
// URL to renew a license. Trailing slash in the upgrade_url is required.
|
157 |
-
$this->instance_id = \get_option($this->instance_key);
|
158 |
-
// Instance ID (unique to each blog activation)
|
159 |
-
if (\get_option($this->activated_key, '0') != self::ACTIVATED) {
|
160 |
-
$this->inactive_notice();
|
161 |
-
}
|
162 |
-
/* grola */
|
163 |
-
if (!$this->instance_id) {
|
164 |
-
$this->create_instance_id();
|
165 |
-
}
|
166 |
-
/**
|
167 |
-
* Some web hosts have security policies that block the : (colon) and // (slashes) in http://,
|
168 |
-
* so only the host portion of the URL can be sent. For example the host portion might be
|
169 |
-
* www.example.com or example.com. http://www.example.com includes the scheme http,
|
170 |
-
* and the host www.example.com.
|
171 |
-
* Sending only the host also eliminates issues when a client site changes from http to https,
|
172 |
-
* but their activation still uses the original scheme.
|
173 |
-
* To send only the host, use a line like the one below:
|
174 |
-
*
|
175 |
-
* $this->domain = str_ireplace( array( 'http://', 'https://' ), '', home_url() ); // blog domain name
|
176 |
-
*/
|
177 |
-
$this->domain = \str_ireplace(['http://', 'https://'], '', \home_url());
|
178 |
-
// blog domain name
|
179 |
-
$this->software_version = $this->version;
|
180 |
-
// The software version
|
181 |
-
$this->plugin_or_theme = 'plugin';
|
182 |
-
// 'theme' or 'plugin'
|
183 |
-
// Performs activations and deactivations of API License Keys
|
184 |
-
require_once 'class-wc-key-api.php';
|
185 |
-
// Checks for software updatess
|
186 |
-
require_once 'class-wc-plugin-update.php';
|
187 |
-
// Admin menu with the license key and license email form
|
188 |
-
// require_once( 'class-wc-api-manager-menu.php' );
|
189 |
-
// new WPDesk_API_MENU( $this );
|
190 |
-
$options = \get_option($this->data_key);
|
191 |
-
/**
|
192 |
-
* Check for software updates
|
193 |
-
*/
|
194 |
-
if ($hook_to_updates) {
|
195 |
-
if (!empty($options) && $options !== \false) {
|
196 |
-
$this->update_check($this->upgrade_url, $this->plugin_name, $this->product_id, $this->options[$this->api_key], $this->options[$this->activation_email], $this->renew_license_url, $this->instance_id, $this->domain, $this->software_version, $this->plugin_or_theme, $this->text_domain);
|
197 |
-
}
|
198 |
-
$this->add_not_possible_update_message();
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
/**
|
203 |
-
* @return bool
|
204 |
-
*/
|
205 |
-
public function is_activated()
|
206 |
-
{
|
207 |
-
return \get_option($this->activated_key, '0') === self::ACTIVATED;
|
208 |
-
}
|
209 |
-
/**
|
210 |
-
* @return string
|
211 |
-
*/
|
212 |
-
public function get_myaccount_url()
|
213 |
-
{
|
214 |
-
return $this->upgrade_url . '/my-account/';
|
215 |
-
}
|
216 |
-
/**
|
217 |
-
* Adds message to plugins page when plugin is not activated with info about subscription.
|
218 |
-
*/
|
219 |
-
private function add_not_possible_update_message()
|
220 |
-
{
|
221 |
-
\add_action('in_plugin_update_message-' . $this->plugin_name, function (array $plugin_data, \stdClass $response) {
|
222 |
-
if (isset($response->changelog) && !empty($response->changelog)) {
|
223 |
-
$this->display_changelog($plugin_data['Version'], $response->changelog);
|
224 |
-
}
|
225 |
-
}, 10, 2);
|
226 |
-
}
|
227 |
-
public function create_instance_id()
|
228 |
-
{
|
229 |
-
$password_management = new \FSVendor\WPDesk_API_Password_Management();
|
230 |
-
// Generate a unique installation $instance id
|
231 |
-
$instance = $password_management->generate_password(12, \false);
|
232 |
-
$this->instance_id = $instance;
|
233 |
-
\update_option($this->instance_key, $instance);
|
234 |
-
\update_option($this->activated_key, 'Deactivated');
|
235 |
-
$this->options = [];
|
236 |
-
$this->options[$this->api_key] = '';
|
237 |
-
$this->options[$this->activation_email] = '';
|
238 |
-
\update_option($this->data_key, $this->options);
|
239 |
-
}
|
240 |
-
/** Load Shared Classes as on-demand Instances **********************************************/
|
241 |
-
/**
|
242 |
-
* API Key Class.
|
243 |
-
*
|
244 |
-
* @return WPDesk_API_KEY
|
245 |
-
*/
|
246 |
-
public function key()
|
247 |
-
{
|
248 |
-
if ($this->key_insance == null) {
|
249 |
-
$this->key_insance = new \FSVendor\WPDesk_API_KEY($this);
|
250 |
-
}
|
251 |
-
return $this->key_insance;
|
252 |
-
}
|
253 |
-
/**
|
254 |
-
* Update Check Class.
|
255 |
-
*
|
256 |
-
* @return WPDesk_Update_API_Check
|
257 |
-
*/
|
258 |
-
public function update_check($upgrade_url, $plugin_name, $product_id, $api_key, $activation_email, $renew_license_url, $instance, $domain, $software_version, $plugin_or_theme, $text_domain, $extra = '')
|
259 |
-
{
|
260 |
-
if ($this->update_check_insance == null) {
|
261 |
-
$this->update_check_insance = new \FSVendor\WPDesk_Update_API_Check($this, $upgrade_url, $plugin_name, $product_id, $api_key, $activation_email, $renew_license_url, $instance, $domain, $software_version, $plugin_or_theme, $text_domain, $extra);
|
262 |
-
}
|
263 |
-
return $this->update_check_insance;
|
264 |
-
}
|
265 |
-
public function plugin_url()
|
266 |
-
{
|
267 |
-
if (isset($this->plugin_url)) {
|
268 |
-
return $this->plugin_url;
|
269 |
-
}
|
270 |
-
return $this->plugin_url = \plugins_url('/', __FILE__);
|
271 |
-
}
|
272 |
-
/**
|
273 |
-
* Generate the default data arrays
|
274 |
-
*/
|
275 |
-
public function activation()
|
276 |
-
{
|
277 |
-
$global_options = [$this->api_key => '', $this->activation_email => ''];
|
278 |
-
\update_option($this->data_key, $global_options);
|
279 |
-
require_once $this->plugin_dir . 'am/classes/class-wc-api-manager-passwords.php';
|
280 |
-
$password_management = new \FSVendor\WPDesk_API_Password_Management();
|
281 |
-
// Generate a unique installation $instance id
|
282 |
-
$instance = $password_management->generate_password(12, \false);
|
283 |
-
$single_options = [$this->product_id_key => $this->software_product_id, $this->instance_key => $instance, $this->deactivate_checkbox_key => 'on', $this->activated_key => 'Deactivated'];
|
284 |
-
foreach ($single_options as $key => $value) {
|
285 |
-
\update_option($key, $value);
|
286 |
-
}
|
287 |
-
$curr_ver = \get_option($this->api_version_name);
|
288 |
-
// checks if the current plugin version is lower than the version being installed
|
289 |
-
if (\version_compare($this->version, $curr_ver, '>')) {
|
290 |
-
// update the version
|
291 |
-
\update_option($this->api_version_name, $this->version);
|
292 |
-
}
|
293 |
-
}
|
294 |
-
/**
|
295 |
-
* Deletes all data if plugin deactivated
|
296 |
-
* @return void
|
297 |
-
*/
|
298 |
-
public function uninstall()
|
299 |
-
{
|
300 |
-
global $blog_id;
|
301 |
-
$this->license_key_deactivation();
|
302 |
-
// Remove options
|
303 |
-
if (\is_multisite()) {
|
304 |
-
\switch_to_blog($blog_id);
|
305 |
-
foreach ([$this->data_key, $this->product_id_key, $this->instance_key, $this->deactivate_checkbox_key, $this->activated_key] as $option) {
|
306 |
-
\delete_option($option);
|
307 |
-
}
|
308 |
-
\restore_current_blog();
|
309 |
-
} else {
|
310 |
-
foreach ([$this->data_key, $this->product_id_key, $this->instance_key, $this->deactivate_checkbox_key, $this->activated_key] as $option) {
|
311 |
-
\delete_option($option);
|
312 |
-
}
|
313 |
-
}
|
314 |
-
}
|
315 |
-
/**
|
316 |
-
* Deactivates the license on the API server
|
317 |
-
* @return void
|
318 |
-
*/
|
319 |
-
public function license_key_deactivation()
|
320 |
-
{
|
321 |
-
$activation_status = \get_option($this->activated_key);
|
322 |
-
$api_email = $this->options[$this->activation_email];
|
323 |
-
$api_key = $this->options[$this->api_key];
|
324 |
-
$args = ['email' => $api_email, 'licence_key' => $api_key];
|
325 |
-
if ($activation_status == self::ACTIVATED && $api_key != '' && $api_email != '') {
|
326 |
-
$this->key()->deactivate($args);
|
327 |
-
// reset license key activation
|
328 |
-
}
|
329 |
-
}
|
330 |
-
/**
|
331 |
-
* Displays an inactive notice when the software is inactive.
|
332 |
-
*/
|
333 |
-
public function inactive_notice()
|
334 |
-
{
|
335 |
-
if (!\current_user_can('manage_options')) {
|
336 |
-
return;
|
337 |
-
}
|
338 |
-
if (\apply_filters('wpdesk_show_plugin_activation_notice', \true)) {
|
339 |
-
(new \FSVendor\WPDesk\Notice\AjaxHandler())->hooks();
|
340 |
-
new \FSVendor\WPDesk\Notice\PermanentDismissibleNotice(\sprintf(\__('The %1$s%2$s%3$s API Key has not been activated, so you won\'t be supported and your plugin won\'t be updated! %4$sClick here%5$s to activate the API key and the plugin.', $this->text_domain), '<strong>', $this->plugin_title, '</strong>', '<a href="' . \esc_url(\admin_url('plugins.php#' . $this->plugin_dir . '-wpdesk-license')) . '">', '</a>'), "notice-{$this->software_product_id}", \FSVendor\WPDesk\Notice\PermanentDismissibleNotice::NOTICE_TYPE_WARNING);
|
341 |
-
}
|
342 |
-
}
|
343 |
-
/**
|
344 |
-
* Check for external blocking constants
|
345 |
-
* @return string
|
346 |
-
*/
|
347 |
-
public function check_external_blocking()
|
348 |
-
{
|
349 |
-
// show notice if external requests are blocked through the WP_HTTP_BLOCK_EXTERNAL constant
|
350 |
-
if (\defined('FSVendor\\WP_HTTP_BLOCK_EXTERNAL') && \FSVendor\WP_HTTP_BLOCK_EXTERNAL === \true) {
|
351 |
-
// check if our API endpoint is in the allowed hosts
|
352 |
-
$host = \parse_url($this->upgrade_url, \PHP_URL_HOST);
|
353 |
-
if (!\defined('FSVendor\\WP_ACCESSIBLE_HOSTS') || \stristr(\FSVendor\WP_ACCESSIBLE_HOSTS, $host) === \false) {
|
354 |
-
?>
|
355 |
-
<div class="error">
|
356 |
-
<p><?php
|
357 |
-
\printf(\__('<b>Warning!</b> You\'re blocking external requests which means you won\'t be able to get %s updates. Please add %s to %s.', $this->text_domain), $this->software_product_id, '<strong>' . $host . '</strong>', '<code>WP_ACCESSIBLE_HOSTS</code>');
|
358 |
-
?></p>
|
359 |
-
</div>
|
360 |
-
<?php
|
361 |
-
}
|
362 |
-
}
|
363 |
-
}
|
364 |
-
/**
|
365 |
-
* @param string $plugin_data
|
366 |
-
* @param string $response
|
367 |
-
*/
|
368 |
-
private function display_changelog($plugin_version, $changelog)
|
369 |
-
{
|
370 |
-
$parser = new \FSVendor\WPDesk\License\Changelog\Parser($changelog);
|
371 |
-
$parser->parse();
|
372 |
-
$parsed_changelog = $parser->get_parsed_changelog()->getIterator();
|
373 |
-
$changes = new \FSVendor\WPDesk\License\Changelog\Filter\ByVersion($parsed_changelog, $plugin_version);
|
374 |
-
if (\iterator_count($changes) > 0) {
|
375 |
-
$changelog = new \FSVendor\WPDesk\License\Changelog\Formatter($changes);
|
376 |
-
$changelog->set_changelog_types($parser->get_types());
|
377 |
-
$formatted_changelog = $changelog->prepare_formatted_html();
|
378 |
-
if ($formatted_changelog) {
|
379 |
-
echo \wp_kses_post('<br /><br />' . $formatted_changelog);
|
380 |
-
}
|
381 |
-
}
|
382 |
-
}
|
383 |
-
}
|
384 |
-
// class Ilabs_API_Manager
|
385 |
-
}
|
386 |
-
// if (!class_exists('Ilabs_API_Manager')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-key-api.php
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* WooCommerce API Manager API Key Class
|
7 |
-
*
|
8 |
-
* @package Update API Manager/Key Handler
|
9 |
-
* @author Todd Lahman LLC, WPDesk
|
10 |
-
* @copyright Copyright (c) Todd Lahman LLC
|
11 |
-
* @since 1.3
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
if (!\defined('ABSPATH')) {
|
15 |
-
exit;
|
16 |
-
}
|
17 |
-
// Exit if accessed directly
|
18 |
-
if (!\class_exists('FSVendor\\WPDesk_API_KEY')) {
|
19 |
-
class WPDesk_API_KEY
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @var The single instance of the class
|
23 |
-
*/
|
24 |
-
protected static $_instance = null;
|
25 |
-
private $api_manager;
|
26 |
-
public function __construct($api_manager)
|
27 |
-
{
|
28 |
-
$this->api_manager = $api_manager;
|
29 |
-
}
|
30 |
-
// API Key URL
|
31 |
-
public function create_software_api_url($args)
|
32 |
-
{
|
33 |
-
$api_url = \add_query_arg('wc-api', 'am-software-api', $this->api_manager->upgrade_url);
|
34 |
-
return $api_url . '&' . \http_build_query($args);
|
35 |
-
}
|
36 |
-
public function activate($args)
|
37 |
-
{
|
38 |
-
$this->api_manager->create_instance_id();
|
39 |
-
$defaults = ['request' => 'activation', 'product_id' => $this->api_manager->product_id, 'instance' => $this->api_manager->instance_id, 'platform' => $this->api_manager->domain, 'software_version' => $this->api_manager->software_version];
|
40 |
-
$args = \wp_parse_args($defaults, $args);
|
41 |
-
$target_url = \esc_url_raw($this->create_software_api_url($args));
|
42 |
-
$target_url = \str_replace('&', '&', $target_url);
|
43 |
-
$request = \wp_safe_remote_get($target_url, ['timeout' => 30, 'sslverify' => \false]);
|
44 |
-
if (\is_wp_error($request) || \wp_remote_retrieve_response_code($request) != 200) {
|
45 |
-
if (\class_exists('FSVendor\\WPDesk_Logger_Factory')) {
|
46 |
-
// Request failed
|
47 |
-
if (\is_wp_error($request)) {
|
48 |
-
\FSVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
49 |
-
} else {
|
50 |
-
\FSVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \FSVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
51 |
-
}
|
52 |
-
}
|
53 |
-
return \false;
|
54 |
-
}
|
55 |
-
$response = \wp_remote_retrieve_body($request);
|
56 |
-
return $response;
|
57 |
-
}
|
58 |
-
public function deactivate($args)
|
59 |
-
{
|
60 |
-
$defaults = ['request' => 'deactivation', 'product_id' => $this->api_manager->product_id, 'instance' => $this->api_manager->instance_id, 'platform' => $this->api_manager->domain];
|
61 |
-
$args = \wp_parse_args($defaults, $args);
|
62 |
-
$target_url = \esc_url_raw($this->create_software_api_url($args));
|
63 |
-
$target_url = \str_replace('&', '&', $target_url);
|
64 |
-
$request = \wp_safe_remote_get($target_url, ['timeout' => 30, 'sslverify' => \false]);
|
65 |
-
if (\is_wp_error($request) || \wp_remote_retrieve_response_code($request) != 200) {
|
66 |
-
if (\class_exists('FSVendor\\WPDesk_Logger_Factory')) {
|
67 |
-
if (\is_wp_error($request)) {
|
68 |
-
\FSVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
69 |
-
} else {
|
70 |
-
\FSVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \FSVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
71 |
-
}
|
72 |
-
}
|
73 |
-
// Request failed
|
74 |
-
return \false;
|
75 |
-
}
|
76 |
-
$response = \wp_remote_retrieve_body($request);
|
77 |
-
return $response;
|
78 |
-
}
|
79 |
-
/**
|
80 |
-
* Checks if the software is activated or deactivated
|
81 |
-
*
|
82 |
-
* @param array $args
|
83 |
-
*
|
84 |
-
* @return array
|
85 |
-
*/
|
86 |
-
public function status($args)
|
87 |
-
{
|
88 |
-
$defaults = ['request' => 'status', 'product_id' => $this->api_manager->product_id, 'instance' => $this->api_manager->instance_id, 'platform' => $this->api_manager->domain];
|
89 |
-
$args = \wp_parse_args($defaults, $args);
|
90 |
-
$target_url = \esc_url_raw($this->create_software_api_url($args));
|
91 |
-
$target_url = \str_replace('&', '&', $target_url);
|
92 |
-
$request = \wp_safe_remote_get($target_url, ['timeout' => 30, 'sslverify' => \false]);
|
93 |
-
// $request = wp_remote_post( $this->api_manager->upgrade_url . 'wc-api/am-software-api/', array( 'body' => $args ) );
|
94 |
-
if (\is_wp_error($request) || \wp_remote_retrieve_response_code($request) != 200) {
|
95 |
-
if (\class_exists('FSVendor\\WPDesk_Logger_Factory')) {
|
96 |
-
if (\is_wp_error($request)) {
|
97 |
-
\FSVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
98 |
-
} else {
|
99 |
-
\FSVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \FSVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
100 |
-
}
|
101 |
-
}
|
102 |
-
// Request failed
|
103 |
-
return \false;
|
104 |
-
}
|
105 |
-
$response = \wp_remote_retrieve_body($request);
|
106 |
-
return $response;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
// class WPDesk_API_KEY
|
110 |
-
}
|
111 |
-
// if (!class_exists('WPDesk_API_KEY'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ApiManager/class-wc-plugin-update.php
DELETED
@@ -1,462 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
if (!\defined('ABSPATH')) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
// Exit if accessed directly
|
9 |
-
/**
|
10 |
-
* Todd Lahman LLC Updater - Single Updater Class
|
11 |
-
*
|
12 |
-
* @package Update API Manager/Update Handler
|
13 |
-
* @author Todd Lahman LLC
|
14 |
-
* @copyright Copyright (c) Todd Lahman LLC
|
15 |
-
* @since 1.0.0
|
16 |
-
*
|
17 |
-
*/
|
18 |
-
if (!\class_exists('FSVendor\\WPDesk_Update_API_Check')) {
|
19 |
-
class WPDesk_Update_API_Check
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @var The single instance of the class
|
23 |
-
*/
|
24 |
-
protected static $_instance = null;
|
25 |
-
private $api_manager;
|
26 |
-
/**
|
27 |
-
*
|
28 |
-
* Ensures only one instance is loaded or can be loaded.
|
29 |
-
*
|
30 |
-
* @static
|
31 |
-
* @return class instance
|
32 |
-
*/
|
33 |
-
public static function instance($upgrade_url, $plugin_name, $product_id, $api_key, $activation_email, $renew_license_url, $instance, $domain, $software_version, $plugin_or_theme, $text_domain, $extra = '')
|
34 |
-
{
|
35 |
-
if (\is_null(self::$_instance)) {
|
36 |
-
self::$_instance = new self($upgrade_url, $plugin_name, $product_id, $api_key, $activation_email, $renew_license_url, $instance, $domain, $software_version, $plugin_or_theme, $text_domain, $extra);
|
37 |
-
}
|
38 |
-
return self::$_instance;
|
39 |
-
}
|
40 |
-
private $upgrade_url;
|
41 |
-
// URL to access the Update API Manager.
|
42 |
-
private $plugin_name;
|
43 |
-
private $plugin_file;
|
44 |
-
private $product_id;
|
45 |
-
// Software Title
|
46 |
-
private $api_key;
|
47 |
-
// API License Key
|
48 |
-
private $activation_email;
|
49 |
-
// License Email
|
50 |
-
private $renew_license_url;
|
51 |
-
// URL to renew a license
|
52 |
-
private $instance;
|
53 |
-
// Instance ID (unique to each blog activation)
|
54 |
-
private $domain;
|
55 |
-
// blog domain name
|
56 |
-
private $software_version;
|
57 |
-
private $plugin_or_theme;
|
58 |
-
// 'theme' or 'plugin'
|
59 |
-
private $text_domain;
|
60 |
-
// localization for translation
|
61 |
-
private $extra;
|
62 |
-
// Used to send any extra information.
|
63 |
-
/**
|
64 |
-
* Constructor.
|
65 |
-
*
|
66 |
-
* @access public
|
67 |
-
* @since 1.0.0
|
68 |
-
* @return void
|
69 |
-
*/
|
70 |
-
public function __construct($api_manager, $upgrade_url, $plugin_name, $product_id, $api_key, $activation_email, $renew_license_url, $instance, $domain, $software_version, $plugin_or_theme, $text_domain, $extra, $free = \false)
|
71 |
-
{
|
72 |
-
$this->api_manager = $api_manager;
|
73 |
-
// API data
|
74 |
-
$this->upgrade_url = $upgrade_url;
|
75 |
-
$this->plugin_name = $plugin_name;
|
76 |
-
$this->product_id = $product_id;
|
77 |
-
$this->api_key = $api_key;
|
78 |
-
$this->activation_email = $activation_email;
|
79 |
-
$this->renew_license_url = $renew_license_url;
|
80 |
-
$this->instance = $instance;
|
81 |
-
$this->domain = $domain;
|
82 |
-
$this->software_version = $software_version;
|
83 |
-
$this->text_domain = $text_domain;
|
84 |
-
$this->extra = $extra;
|
85 |
-
$this->free = $free;
|
86 |
-
// Slug should be the same as the plugin/theme directory name
|
87 |
-
if (\strpos($this->plugin_name, '.php') !== 0) {
|
88 |
-
$this->slug = \dirname($this->plugin_name);
|
89 |
-
} else {
|
90 |
-
$this->slug = $this->plugin_name;
|
91 |
-
}
|
92 |
-
/**
|
93 |
-
* Flag for plugin or theme updates
|
94 |
-
* @access public
|
95 |
-
* @since 1.0.0
|
96 |
-
*
|
97 |
-
* @param string, plugin or theme
|
98 |
-
*/
|
99 |
-
$this->plugin_or_theme = $plugin_or_theme;
|
100 |
-
// 'theme' or 'plugin'
|
101 |
-
/*********************************************************************
|
102 |
-
* The plugin and theme filters should not be active at the same time
|
103 |
-
*********************************************************************/
|
104 |
-
/**
|
105 |
-
* More info:
|
106 |
-
* function set_site_transient moved from wp-includes/functions.php
|
107 |
-
* to wp-includes/option.php in WordPress 3.4
|
108 |
-
*
|
109 |
-
* set_site_transient() contains the pre_set_site_transient_{$transient} filter
|
110 |
-
* {$transient} is either update_plugins or update_themes
|
111 |
-
*
|
112 |
-
* Transient data for plugins and themes exist in the Options table:
|
113 |
-
* _site_transient_update_themes
|
114 |
-
* _site_transient_update_plugins
|
115 |
-
*/
|
116 |
-
// uses the flag above to determine if this is a plugin or a theme update request
|
117 |
-
if ($this->plugin_or_theme == 'plugin') {
|
118 |
-
/**
|
119 |
-
* Plugin Updates
|
120 |
-
*/
|
121 |
-
// Check For Plugin Updates
|
122 |
-
\add_filter('pre_set_site_transient_update_plugins', [$this, 'update_check']);
|
123 |
-
// Check For Plugin Information to display on the update details page
|
124 |
-
\add_filter('plugins_api', [$this, 'request'], 10, 3);
|
125 |
-
} elseif ($this->plugin_or_theme == 'theme') {
|
126 |
-
/**
|
127 |
-
* Theme Updates
|
128 |
-
*/
|
129 |
-
// Check For Theme Updates
|
130 |
-
\add_filter('pre_set_site_transient_update_themes', [$this, 'update_check']);
|
131 |
-
// Check For Theme Information to display on the update details page
|
132 |
-
\add_filter('themes_api', [$this, 'request'], 10, 3);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
// Upgrade API URL
|
136 |
-
private function create_upgrade_api_url($args)
|
137 |
-
{
|
138 |
-
if ($this->free) {
|
139 |
-
$upgrade_url = \add_query_arg('wc-api', 'wpdesk-upgrade-api', $this->upgrade_url);
|
140 |
-
} else {
|
141 |
-
$upgrade_url = \add_query_arg('wc-api', 'upgrade-api', $this->upgrade_url);
|
142 |
-
}
|
143 |
-
return $upgrade_url . '&' . \http_build_query($args);
|
144 |
-
}
|
145 |
-
/**
|
146 |
-
* Check for updates against the remote server.
|
147 |
-
*
|
148 |
-
* @access public
|
149 |
-
* @since 1.0.0
|
150 |
-
*
|
151 |
-
* @param object $transient
|
152 |
-
*
|
153 |
-
* @return object $transient
|
154 |
-
*/
|
155 |
-
public function update_check($transient)
|
156 |
-
{
|
157 |
-
if (!\is_object($transient)) {
|
158 |
-
$transient = new \stdClass();
|
159 |
-
}
|
160 |
-
if (!isset($transient->response) || !\is_array($transient->response)) {
|
161 |
-
$transient->response = [];
|
162 |
-
}
|
163 |
-
$args = ['request' => 'pluginupdatecheck', 'slug' => $this->slug, 'plugin_name' => $this->plugin_name, 'version' => $this->software_version, 'product_id' => $this->product_id, 'api_key' => $this->api_key, 'activation_email' => $this->activation_email, 'instance' => $this->instance, 'domain' => $this->domain, 'software_version' => $this->software_version, 'extra' => $this->extra];
|
164 |
-
// Check for a plugin update
|
165 |
-
$response = $this->plugin_information($args);
|
166 |
-
// Displays an admin error message in the WordPress dashboard
|
167 |
-
$this->check_response_for_errors($response);
|
168 |
-
// Set version variables
|
169 |
-
if (isset($response) && \is_object($response) && $response !== \false) {
|
170 |
-
// New plugin version from the API
|
171 |
-
$new_ver = (string) $response->new_version;
|
172 |
-
// Current installed plugin version
|
173 |
-
$curr_ver = (string) $this->software_version;
|
174 |
-
//$curr_ver = (string)$transient->checked[$this->plugin_name];
|
175 |
-
}
|
176 |
-
// If there is a new version, modify the transient to reflect an update is available
|
177 |
-
if (isset($new_ver) && isset($curr_ver)) {
|
178 |
-
if ($response !== \false && \version_compare($new_ver, $curr_ver, '>')) {
|
179 |
-
if ($this->plugin_or_theme == 'plugin') {
|
180 |
-
$transient->response[$this->plugin_name] = $response;
|
181 |
-
} elseif ($this->plugin_or_theme == 'theme') {
|
182 |
-
$transient->response[$this->plugin_name]['new_version'] = $response->new_version;
|
183 |
-
$transient->response[$this->plugin_name]['url'] = $response->url;
|
184 |
-
$transient->response[$this->plugin_name]['package'] = $response->package;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
}
|
188 |
-
return $transient;
|
189 |
-
}
|
190 |
-
/**
|
191 |
-
* Sends and receives data to and from the server API
|
192 |
-
*
|
193 |
-
* @access public
|
194 |
-
* @since 1.0.0
|
195 |
-
* @return object|bool $response
|
196 |
-
*/
|
197 |
-
public function plugin_information($args)
|
198 |
-
{
|
199 |
-
$target_url = \esc_url_raw($this->create_upgrade_api_url($args));
|
200 |
-
$target_url = \str_replace('&', '&', $target_url);
|
201 |
-
$request = \wp_safe_remote_get($target_url, ['timeout' => 30, 'sslverify' => \false]);
|
202 |
-
if (\is_wp_error($request) || \wp_remote_retrieve_response_code($request) != 200) {
|
203 |
-
if (\class_exists('FSVendor\\WPDesk_Logger_Factory')) {
|
204 |
-
if (\is_wp_error($request)) {
|
205 |
-
\FSVendor\WPDesk_Logger_Factory::log_wp_error($request, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
206 |
-
} else {
|
207 |
-
\FSVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is invalid. Response: ' . \json_encode($request), \FSVendor\WPDesk_Logger::ERROR, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
208 |
-
}
|
209 |
-
}
|
210 |
-
return \false;
|
211 |
-
}
|
212 |
-
$raw_response = \wp_remote_retrieve_body($request);
|
213 |
-
$response = @\unserialize($raw_response);
|
214 |
-
if (\is_object($response)) {
|
215 |
-
if (isset($response->sections)) {
|
216 |
-
$response->sections['description'] = \apply_filters('the_content', isset($response->sections['description_base64']) ? \base64_decode($response->sections['description_base64']) : '');
|
217 |
-
if (isset($response->sections['installation'])) {
|
218 |
-
$response->sections['installation'] = \apply_filters('the_content', $response->sections['installation']);
|
219 |
-
}
|
220 |
-
if (isset($response->sections['faq'])) {
|
221 |
-
$response->sections['faq'] = \apply_filters('the_content', $response->sections['faq']);
|
222 |
-
}
|
223 |
-
if (isset($response->sections['screenshots'])) {
|
224 |
-
$response->sections['screenshots'] = \apply_filters('the_content', $response->sections['screenshots']);
|
225 |
-
}
|
226 |
-
if (isset($response->sections['changelog'])) {
|
227 |
-
$response->sections['changelog'] = \apply_filters('the_content', $response->sections['changelog']);
|
228 |
-
}
|
229 |
-
if (isset($response->sections['other_notes'])) {
|
230 |
-
$response->sections['other_notes'] = \apply_filters('the_content', $response->sections['other_notes']);
|
231 |
-
}
|
232 |
-
}
|
233 |
-
if (isset($response->author)) {
|
234 |
-
$response->author = "<a href='http://www.wpdesk.pl'>{$response->author}</a>";
|
235 |
-
}
|
236 |
-
unset($response->sections['description_base64']);
|
237 |
-
return $response;
|
238 |
-
} else {
|
239 |
-
if (\class_exists('FSVendor\\WPDesk_Logger_Factory')) {
|
240 |
-
\FSVendor\WPDesk_Logger_Factory::log_message_backtrace('Response is not an object', \FSVendor\WPDesk_Logger::DEBUG, \debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS));
|
241 |
-
} else {
|
242 |
-
\error_log("Unserialize error. Please send this report to support@wpdesk.net. Request: {$request}. Raw Response: {$raw_response}");
|
243 |
-
}
|
244 |
-
return \false;
|
245 |
-
}
|
246 |
-
}
|
247 |
-
/**
|
248 |
-
* Generic request helper.
|
249 |
-
*
|
250 |
-
* @access public
|
251 |
-
* @since 1.0.0
|
252 |
-
*
|
253 |
-
* @param array $args
|
254 |
-
*
|
255 |
-
* @return object $response or boolean false
|
256 |
-
*/
|
257 |
-
public function request($false, $action, $args)
|
258 |
-
{
|
259 |
-
// Is this a plugin or a theme?
|
260 |
-
if ($this->plugin_or_theme == 'plugin') {
|
261 |
-
$version = \get_site_transient('update_plugins');
|
262 |
-
} elseif ($this->plugin_or_theme == 'theme') {
|
263 |
-
$version = \get_site_transient('update_themes');
|
264 |
-
}
|
265 |
-
// Check if this plugins API is about this plugin
|
266 |
-
if (isset($args->slug)) {
|
267 |
-
//if ( $args->slug != dirname($this->slug)) {
|
268 |
-
if ($args->slug != $this->slug) {
|
269 |
-
return $false;
|
270 |
-
}
|
271 |
-
} else {
|
272 |
-
return $false;
|
273 |
-
}
|
274 |
-
$args = ['request' => 'plugininformation', 'plugin_name' => $this->plugin_name, 'slug' => $this->slug, 'version' => $this->software_version, 'product_id' => $this->product_id, 'api_key' => $this->api_key, 'activation_email' => $this->activation_email, 'instance' => $this->instance, 'domain' => $this->domain, 'software_version' => $this->software_version, 'extra' => $this->extra];
|
275 |
-
$response = $this->plugin_information($args);
|
276 |
-
if ($response) {
|
277 |
-
$response->slug = $this->slug;
|
278 |
-
$response->product_id = $this->product_id;
|
279 |
-
// If everything is okay return the $response
|
280 |
-
if (isset($response) && \is_object($response) && $response !== \false) {
|
281 |
-
return $response;
|
282 |
-
}
|
283 |
-
} else {
|
284 |
-
return \false;
|
285 |
-
}
|
286 |
-
}
|
287 |
-
/**
|
288 |
-
* Displays an admin error message in the WordPress dashboard
|
289 |
-
*
|
290 |
-
* @param array $response
|
291 |
-
*
|
292 |
-
* @return string
|
293 |
-
*/
|
294 |
-
public function check_response_for_errors($response)
|
295 |
-
{
|
296 |
-
if (!empty($response)) {
|
297 |
-
if (isset($response->errors['no_key']) && $response->errors['no_key'] == 'no_key' && isset($response->errors['no_subscription']) && $response->errors['no_subscription'] == 'no_subscription') {
|
298 |
-
\add_action('admin_notices', [$this, 'no_key_error_notice']);
|
299 |
-
\add_action('admin_notices', [$this, 'no_subscription_error_notice']);
|
300 |
-
} elseif (isset($response->errors['exp_license']) && $response->errors['exp_license'] == 'exp_license') {
|
301 |
-
\add_action('admin_notices', [$this, 'expired_license_error_notice']);
|
302 |
-
} elseif (isset($response->errors['hold_subscription']) && $response->errors['hold_subscription'] == 'hold_subscription') {
|
303 |
-
\add_action('admin_notices', [$this, 'on_hold_subscription_error_notice']);
|
304 |
-
} elseif (isset($response->errors['cancelled_subscription']) && $response->errors['cancelled_subscription'] == 'cancelled_subscription') {
|
305 |
-
\add_action('admin_notices', [$this, 'cancelled_subscription_error_notice']);
|
306 |
-
} elseif (isset($response->errors['exp_subscription']) && $response->errors['exp_subscription'] == 'exp_subscription') {
|
307 |
-
\add_action('admin_notices', [$this, 'expired_subscription_error_notice']);
|
308 |
-
} elseif (isset($response->errors['suspended_subscription']) && $response->errors['suspended_subscription'] == 'suspended_subscription') {
|
309 |
-
\add_action('admin_notices', [$this, 'suspended_subscription_error_notice']);
|
310 |
-
} elseif (isset($response->errors['pending_subscription']) && $response->errors['pending_subscription'] == 'pending_subscription') {
|
311 |
-
\add_action('admin_notices', [$this, 'pending_subscription_error_notice']);
|
312 |
-
} elseif (isset($response->errors['trash_subscription']) && $response->errors['trash_subscription'] == 'trash_subscription') {
|
313 |
-
\add_action('admin_notices', [$this, 'trash_subscription_error_notice']);
|
314 |
-
} elseif (isset($response->errors['no_subscription']) && $response->errors['no_subscription'] == 'no_subscription') {
|
315 |
-
\add_action('admin_notices', [$this, 'no_subscription_error_notice']);
|
316 |
-
} elseif (isset($response->errors['no_activation']) && $response->errors['no_activation'] == 'no_activation') {
|
317 |
-
\add_action('admin_notices', [$this, 'no_activation_error_notice']);
|
318 |
-
} elseif (isset($response->errors['no_key']) && $response->errors['no_key'] == 'no_key') {
|
319 |
-
\add_action('admin_notices', [$this, 'no_key_error_notice']);
|
320 |
-
} elseif (isset($response->errors['download_revoked']) && $response->errors['download_revoked'] == 'download_revoked') {
|
321 |
-
\add_action('admin_notices', [$this, 'download_revoked_error_notice']);
|
322 |
-
} elseif (isset($response->errors['switched_subscription']) && $response->errors['switched_subscription'] == 'switched_subscription') {
|
323 |
-
\add_action('admin_notices', [$this, 'switched_subscription_error_notice']);
|
324 |
-
}
|
325 |
-
}
|
326 |
-
}
|
327 |
-
/**
|
328 |
-
* Display license expired error notice
|
329 |
-
*
|
330 |
-
* @param string $message
|
331 |
-
*
|
332 |
-
* @return void
|
333 |
-
*/
|
334 |
-
public function expired_license_error_notice($message)
|
335 |
-
{
|
336 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The API key for %s has expired. You can reactivate or purchase a API key from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
337 |
-
}
|
338 |
-
/**
|
339 |
-
* Display subscription on-hold error notice
|
340 |
-
*
|
341 |
-
* @param string $message
|
342 |
-
*
|
343 |
-
* @return void
|
344 |
-
*/
|
345 |
-
public function on_hold_subscription_error_notice($message)
|
346 |
-
{
|
347 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s is on-hold. You can reactivate the subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
348 |
-
}
|
349 |
-
/**
|
350 |
-
* Display subscription cancelled error notice
|
351 |
-
*
|
352 |
-
* @param string $message
|
353 |
-
*
|
354 |
-
* @return void
|
355 |
-
*/
|
356 |
-
public function cancelled_subscription_error_notice($message)
|
357 |
-
{
|
358 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s has been cancelled. You can renew the subscription from your account <a href="%s" target="_blank">dashboard</a>. A new API key will be emailed to you after your order has been completed.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
359 |
-
}
|
360 |
-
/**
|
361 |
-
* Display subscription expired error notice
|
362 |
-
*
|
363 |
-
* @param string $message
|
364 |
-
*
|
365 |
-
* @return void
|
366 |
-
*/
|
367 |
-
public function expired_subscription_error_notice($message)
|
368 |
-
{
|
369 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s has expired. You can reactivate the subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
370 |
-
}
|
371 |
-
/**
|
372 |
-
* Display subscription expired error notice
|
373 |
-
*
|
374 |
-
* @param string $message
|
375 |
-
*
|
376 |
-
* @return void
|
377 |
-
*/
|
378 |
-
public function suspended_subscription_error_notice($message)
|
379 |
-
{
|
380 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s has been suspended. You can reactivate the subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
381 |
-
}
|
382 |
-
/**
|
383 |
-
* Display subscription expired error notice
|
384 |
-
*
|
385 |
-
* @param string $message
|
386 |
-
*
|
387 |
-
* @return void
|
388 |
-
*/
|
389 |
-
public function pending_subscription_error_notice($message)
|
390 |
-
{
|
391 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s is still pending. You can check on the status of the subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
392 |
-
}
|
393 |
-
/**
|
394 |
-
* Display subscription expired error notice
|
395 |
-
*
|
396 |
-
* @param string $message
|
397 |
-
*
|
398 |
-
* @return void
|
399 |
-
*/
|
400 |
-
public function trash_subscription_error_notice($message)
|
401 |
-
{
|
402 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('The subscription for %s has been placed in the trash and will be deleted soon. You can purchase a new subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
403 |
-
}
|
404 |
-
/**
|
405 |
-
* Display subscription expired error notice
|
406 |
-
*
|
407 |
-
* @param string $message
|
408 |
-
*
|
409 |
-
* @return void
|
410 |
-
*/
|
411 |
-
public function no_subscription_error_notice($message)
|
412 |
-
{
|
413 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('A subscription for %s could not be found. You can purchase a subscription from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
414 |
-
}
|
415 |
-
/**
|
416 |
-
* Display missing key error notice
|
417 |
-
*
|
418 |
-
* @param string $message
|
419 |
-
*
|
420 |
-
* @return void
|
421 |
-
*/
|
422 |
-
public function no_key_error_notice($message)
|
423 |
-
{
|
424 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('A API key for %s could not be found. Maybe you forgot to enter a API key when setting up %s, or the key was deactivated in your account. You can reactivate or purchase a subscription key from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->product_id, $this->renew_license_url));
|
425 |
-
}
|
426 |
-
/**
|
427 |
-
* Display missing download permission revoked error notice
|
428 |
-
*
|
429 |
-
* @param string $message
|
430 |
-
*
|
431 |
-
* @return void
|
432 |
-
*/
|
433 |
-
public function download_revoked_error_notice($message)
|
434 |
-
{
|
435 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('Download permission for %s has been revoked possibly due to a API key or subscription expiring. You can reactivate or purchase a API key from your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
436 |
-
}
|
437 |
-
/**
|
438 |
-
* Display no activation error notice
|
439 |
-
*
|
440 |
-
* @param string $message
|
441 |
-
*
|
442 |
-
* @return void
|
443 |
-
*/
|
444 |
-
public function no_activation_error_notice($message)
|
445 |
-
{
|
446 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('%s has not been activated. Go to the settings page and enter the API key and subscription email to activate %s.', $this->text_domain) . '</p></div>', $this->product_id, $this->product_id));
|
447 |
-
}
|
448 |
-
/**
|
449 |
-
* Display switched activation error notice
|
450 |
-
*
|
451 |
-
* @param string $message
|
452 |
-
*
|
453 |
-
* @return void
|
454 |
-
*/
|
455 |
-
public function switched_subscription_error_notice($message)
|
456 |
-
{
|
457 |
-
echo \wp_kses_post(\sprintf('<div id="message" class="error"><p>' . \__('You changed the subscription for %s, so you will need to enter your new API Key in the settings page. The API Key should have arrived in your email inbox, if not you can get it by logging into your account <a href="%s" target="_blank">dashboard</a>.', $this->text_domain) . '</p></div>', $this->product_id, $this->renew_license_url));
|
458 |
-
}
|
459 |
-
}
|
460 |
-
// class WPDesk_Update_API_Check
|
461 |
-
}
|
462 |
-
// if (!class_exists('WPDesk_Update_API_Check')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Filter/ByVersion.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Changelog\Filter;
|
4 |
-
|
5 |
-
use FilterIterator;
|
6 |
-
use Iterator;
|
7 |
-
/**
|
8 |
-
* Filters items by version.
|
9 |
-
*
|
10 |
-
* @package WPDesk\License\Changelog
|
11 |
-
*/
|
12 |
-
class ByVersion extends \FilterIterator
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
private $version;
|
18 |
-
/**
|
19 |
-
* Updates constructor.
|
20 |
-
*
|
21 |
-
* @param Iterator $changes
|
22 |
-
* @param string $version
|
23 |
-
*/
|
24 |
-
public function __construct(\Iterator $changes, string $version)
|
25 |
-
{
|
26 |
-
parent::__construct($changes);
|
27 |
-
$this->version = $version;
|
28 |
-
}
|
29 |
-
/**
|
30 |
-
* @return bool
|
31 |
-
*/
|
32 |
-
public function accept()
|
33 |
-
{
|
34 |
-
$change = $this->getInnerIterator()->current();
|
35 |
-
return (bool) \version_compare($change['version'], $this->version, '>');
|
36 |
-
}
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Formatter.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Changelog;
|
4 |
-
|
5 |
-
use Iterator;
|
6 |
-
/**
|
7 |
-
* Can format changelog.
|
8 |
-
*
|
9 |
-
* @package WPDesk\License\Changelog
|
10 |
-
*/
|
11 |
-
class Formatter
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* @var Iterator
|
15 |
-
*/
|
16 |
-
private $changes;
|
17 |
-
/**
|
18 |
-
* @var array
|
19 |
-
*/
|
20 |
-
private $types;
|
21 |
-
/**
|
22 |
-
* Formatter constructor.
|
23 |
-
*
|
24 |
-
* @param Iterator $changes
|
25 |
-
*/
|
26 |
-
public function __construct(\Iterator $changes)
|
27 |
-
{
|
28 |
-
$this->changes = $changes;
|
29 |
-
}
|
30 |
-
/**
|
31 |
-
* @param array $types
|
32 |
-
*/
|
33 |
-
public function set_changelog_types(array $types)
|
34 |
-
{
|
35 |
-
$this->types = $types;
|
36 |
-
}
|
37 |
-
/**
|
38 |
-
* @return string
|
39 |
-
*/
|
40 |
-
public function prepare_formatted_html()
|
41 |
-
{
|
42 |
-
$output = '';
|
43 |
-
foreach ($this->get_changes_data() as $name => $changes) {
|
44 |
-
if (empty($changes)) {
|
45 |
-
continue;
|
46 |
-
}
|
47 |
-
$output .= \sprintf("\n\n<strong>%s</strong>: <br/>* %s", $name, \implode(' <br />* ', \array_map('esc_html', $changes)));
|
48 |
-
}
|
49 |
-
return \wp_kses_post(\nl2br(\trim($output)));
|
50 |
-
}
|
51 |
-
/**
|
52 |
-
* @return array
|
53 |
-
*/
|
54 |
-
private function get_changes_data()
|
55 |
-
{
|
56 |
-
$changes = [];
|
57 |
-
foreach ($this->types as $type) {
|
58 |
-
$changes[$type] = [];
|
59 |
-
}
|
60 |
-
foreach ($this->changes as $item) {
|
61 |
-
foreach ($item['changes'] as $type => $change) {
|
62 |
-
if (!isset($changes[$type])) {
|
63 |
-
$changes[$type] = [];
|
64 |
-
}
|
65 |
-
$changes[$type] = \array_merge($changes[$type], $change);
|
66 |
-
}
|
67 |
-
}
|
68 |
-
return \array_filter($changes);
|
69 |
-
}
|
70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Changelog;
|
4 |
-
|
5 |
-
use ArrayObject;
|
6 |
-
use FSVendor\WPDesk\License\Changelog\Parser\Line;
|
7 |
-
/**
|
8 |
-
* Can parse changelog.
|
9 |
-
*
|
10 |
-
* @package FSVendor\WPDesk\License\Changelog
|
11 |
-
*/
|
12 |
-
class Parser
|
13 |
-
{
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
private $changelog;
|
18 |
-
/**
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
private $changelog_parsed_data;
|
22 |
-
/**
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
private $types = [];
|
26 |
-
/**
|
27 |
-
* Parser constructor.
|
28 |
-
*
|
29 |
-
* @param string $changelog
|
30 |
-
*/
|
31 |
-
public function __construct(string $changelog)
|
32 |
-
{
|
33 |
-
$this->changelog = $changelog;
|
34 |
-
}
|
35 |
-
/**
|
36 |
-
* @return ArrayObject
|
37 |
-
*/
|
38 |
-
public function get_parsed_changelog()
|
39 |
-
{
|
40 |
-
return new \ArrayObject($this->changelog_parsed_data);
|
41 |
-
}
|
42 |
-
/**
|
43 |
-
* @return Parser $this
|
44 |
-
*/
|
45 |
-
public function parse()
|
46 |
-
{
|
47 |
-
$this->changelog_parsed_data = [];
|
48 |
-
$version = $type = null;
|
49 |
-
foreach ($this->get_lines() as $line) {
|
50 |
-
if (!$this->types && ($types = $line->get_types())) {
|
51 |
-
$this->types = $types;
|
52 |
-
continue;
|
53 |
-
}
|
54 |
-
if ($release = $line->get_release_details()) {
|
55 |
-
$version = $release['version'];
|
56 |
-
$type = null;
|
57 |
-
continue;
|
58 |
-
}
|
59 |
-
if ($type_details = $line->get_type_details()) {
|
60 |
-
$type = $type_details;
|
61 |
-
continue;
|
62 |
-
}
|
63 |
-
if (!$version || !$type) {
|
64 |
-
continue;
|
65 |
-
}
|
66 |
-
if (!isset($this->changelog_parsed_data[$version])) {
|
67 |
-
$this->changelog_parsed_data[$version] = ['version' => $version, 'changes' => []];
|
68 |
-
}
|
69 |
-
$this->changelog_parsed_data[$version]['changes'][$type][] = $line->get_value();
|
70 |
-
}
|
71 |
-
return $this;
|
72 |
-
}
|
73 |
-
/**
|
74 |
-
* @return array
|
75 |
-
*/
|
76 |
-
public function get_types()
|
77 |
-
{
|
78 |
-
return $this->types;
|
79 |
-
}
|
80 |
-
/**
|
81 |
-
* @return Line[]
|
82 |
-
*/
|
83 |
-
private function get_lines()
|
84 |
-
{
|
85 |
-
$content = \base64_decode($this->changelog);
|
86 |
-
if (!$content) {
|
87 |
-
return [];
|
88 |
-
}
|
89 |
-
return \array_map(function ($line) {
|
90 |
-
return new \FSVendor\WPDesk\License\Changelog\Parser\Line($line);
|
91 |
-
}, \array_filter(\preg_split("/\r\n|\n|\r/", \wp_kses_post($content))));
|
92 |
-
}
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Changelog/Parser/Line.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Changelog\Parser;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Can parse single changelog line.
|
7 |
-
*
|
8 |
-
* @package WPDesk\License\Changelog\Parser
|
9 |
-
*/
|
10 |
-
class Line
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var string
|
14 |
-
*/
|
15 |
-
private $line;
|
16 |
-
/**
|
17 |
-
* Line constructor.
|
18 |
-
*
|
19 |
-
* @param string $line
|
20 |
-
*/
|
21 |
-
public function __construct(string $line)
|
22 |
-
{
|
23 |
-
$this->line = $line;
|
24 |
-
}
|
25 |
-
/**
|
26 |
-
* @return array
|
27 |
-
*/
|
28 |
-
public function get_release_details()
|
29 |
-
{
|
30 |
-
\preg_match('/## \\[(.*)\\] - (.*)/', $this->line, $output_array);
|
31 |
-
if (!isset($output_array[1], $output_array[2])) {
|
32 |
-
return [];
|
33 |
-
}
|
34 |
-
return ['version' => $output_array[1], 'date' => $output_array[2]];
|
35 |
-
}
|
36 |
-
/**
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
public function get_type_details()
|
40 |
-
{
|
41 |
-
\preg_match('/### (.*)/', $this->line, $output_array);
|
42 |
-
if (!isset($output_array[1])) {
|
43 |
-
return '';
|
44 |
-
}
|
45 |
-
return $output_array[1];
|
46 |
-
}
|
47 |
-
/**
|
48 |
-
* @return array
|
49 |
-
*/
|
50 |
-
public function get_types()
|
51 |
-
{
|
52 |
-
\preg_match('/##### (.*)/', $this->line, $output_array);
|
53 |
-
if (!isset($output_array[1])) {
|
54 |
-
return [];
|
55 |
-
}
|
56 |
-
return \wp_parse_list($output_array[1]);
|
57 |
-
}
|
58 |
-
/**
|
59 |
-
* @return string
|
60 |
-
*/
|
61 |
-
public function get_value()
|
62 |
-
{
|
63 |
-
return \ltrim($this->line, '- ');
|
64 |
-
}
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/InstalledPlugins.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk_API_Manager_With_Update_Flag;
|
6 |
-
/**
|
7 |
-
* Provides info about activation/update state and can refresh that state
|
8 |
-
*
|
9 |
-
* @package WPDesk\License
|
10 |
-
*/
|
11 |
-
class InstalledPlugins
|
12 |
-
{
|
13 |
-
const KEY_API_MANAGER = 'api_manager';
|
14 |
-
const KEY_ACTIVATION_STATUS = 'activation_status';
|
15 |
-
/**
|
16 |
-
* Refresh WP info about updates.
|
17 |
-
*
|
18 |
-
* @return void
|
19 |
-
*/
|
20 |
-
public function refresh_plugin_update_info()
|
21 |
-
{
|
22 |
-
$this->get_plugins_activation_info(\true);
|
23 |
-
}
|
24 |
-
/**
|
25 |
-
* Returns info about activation/update state of plugins.
|
26 |
-
*
|
27 |
-
* @param bool $hook_to_updates If updates api should be called. If not sure then no!
|
28 |
-
*
|
29 |
-
* @return array Info about plugins.
|
30 |
-
* Key is plugin name and values are plugin_info + KEY_API_MANAGER + KEY_ACTIVATION_STATUS
|
31 |
-
*/
|
32 |
-
public function get_plugins_activation_info($hook_to_updates = \false)
|
33 |
-
{
|
34 |
-
global $wpdesk_helper_plugins;
|
35 |
-
if (!isset($wpdesk_helper_plugins)) {
|
36 |
-
$wpdesk_helper_plugins = [];
|
37 |
-
}
|
38 |
-
$plugins = [];
|
39 |
-
foreach ($wpdesk_helper_plugins as $key => $wpdesk_helper_plugin) {
|
40 |
-
$config_uri = null;
|
41 |
-
if (isset($wpdesk_helper_plugin['config_uri'])) {
|
42 |
-
$config_uri = $wpdesk_helper_plugin['config_uri'];
|
43 |
-
}
|
44 |
-
$menu_title = $wpdesk_helper_plugin['product_id'];
|
45 |
-
if (isset($wpdesk_helper_plugin['title'])) {
|
46 |
-
$menu_title = $wpdesk_helper_plugin['title'];
|
47 |
-
}
|
48 |
-
$addressRepository = new \FSVendor\WPDesk\License\ServerAddressRepository($wpdesk_helper_plugin['product_id']);
|
49 |
-
$plugins[$key] = $wpdesk_helper_plugin;
|
50 |
-
$plugins[$key][self::KEY_API_MANAGER] = new \FSVendor\WPDesk_API_Manager_With_Update_Flag($upgrade_url = $addressRepository->get_default_update_url(), $version = $wpdesk_helper_plugin['version'], $name = $wpdesk_helper_plugin['plugin'], $product_id = $wpdesk_helper_plugin['product_id'], $menu_title, $title = $menu_title, $plugin_file = \basename($wpdesk_helper_plugin['plugin']), $plugin_dir = \dirname($wpdesk_helper_plugin['plugin']), $config_uri, $hook_to_updates);
|
51 |
-
$plugins[$key][self::KEY_ACTIVATION_STATUS] = \get_option($plugins[$key][self::KEY_API_MANAGER]->activated_key, 'Deactivated');
|
52 |
-
}
|
53 |
-
return $plugins;
|
54 |
-
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/LicenseManager.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\ActivationForm\AjaxHandler;
|
6 |
-
use FSVendor\WPDesk\License\ActivationForm\PluginsPageRenderer;
|
7 |
-
use FSVendor\WPDesk\License\WpUpgrader\SubscriptionHandler;
|
8 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\HookableCollection;
|
9 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\HookableParent;
|
10 |
-
use FSVendor\WPDesk_API_Manager_With_Update_Flag;
|
11 |
-
use FSVendor\WPDesk_Plugin_Info;
|
12 |
-
class LicenseManager implements \FSVendor\WPDesk\PluginBuilder\Plugin\HookableCollection
|
13 |
-
{
|
14 |
-
use HookableParent;
|
15 |
-
/**
|
16 |
-
* @var WPDesk_Plugin_Info
|
17 |
-
*/
|
18 |
-
private $plugin_info;
|
19 |
-
/**
|
20 |
-
* @var PluginsPageRenderer
|
21 |
-
*/
|
22 |
-
private $plugins_page_renderer;
|
23 |
-
/**
|
24 |
-
* @var AjaxHandler
|
25 |
-
*/
|
26 |
-
private $ajax_handler;
|
27 |
-
/**
|
28 |
-
* @param WPDesk_Plugin_Info $plugin_info
|
29 |
-
*/
|
30 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info)
|
31 |
-
{
|
32 |
-
$this->plugin_info = $plugin_info;
|
33 |
-
}
|
34 |
-
/**
|
35 |
-
* @param bool $hooks_to_updates
|
36 |
-
*
|
37 |
-
* @return WPDesk_API_Manager_With_Update_Flag
|
38 |
-
*/
|
39 |
-
public function create_api_manager(bool $hook_to_updates = \true) : \FSVendor\WPDesk_API_Manager_With_Update_Flag
|
40 |
-
{
|
41 |
-
$address_repository = new \FSVendor\WPDesk\License\ServerAddressRepository($this->plugin_info->get_product_id());
|
42 |
-
return new \FSVendor\WPDesk_API_Manager_With_Update_Flag($address_repository->get_default_update_url(), $this->plugin_info->get_version(), $this->plugin_info->get_plugin_file_name(), $this->plugin_info->get_product_id(), $this->plugin_info->get_plugin_file_name(), $this->plugin_info->get_plugin_slug(), $hook_to_updates, $this->plugin_info->get_plugin_name());
|
43 |
-
}
|
44 |
-
/**
|
45 |
-
*
|
46 |
-
*/
|
47 |
-
public function init_activation_form()
|
48 |
-
{
|
49 |
-
$this->plugins_page_renderer = new \FSVendor\WPDesk\License\ActivationForm\PluginsPageRenderer($this->plugin_info);
|
50 |
-
$this->add_hookable($this->plugins_page_renderer);
|
51 |
-
$this->ajax_handler = new \FSVendor\WPDesk\License\ActivationForm\AjaxHandler($this->plugin_info);
|
52 |
-
$this->add_hookable($this->ajax_handler);
|
53 |
-
}
|
54 |
-
/**
|
55 |
-
* .
|
56 |
-
*/
|
57 |
-
public function init_wp_upgrader(bool $activated, $subscriptions_url)
|
58 |
-
{
|
59 |
-
$this->add_hookable(new \FSVendor\WPDesk\License\WpUpgrader\SubscriptionHandler($this->plugin_info->get_plugin_file_name(), $activated, $subscriptions_url));
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* .
|
63 |
-
*/
|
64 |
-
public function hooks()
|
65 |
-
{
|
66 |
-
$this->hooks_on_hookable_objects();
|
67 |
-
}
|
68 |
-
/**
|
69 |
-
* @return PluginsPageRenderer
|
70 |
-
*/
|
71 |
-
public function get_plugins_page_renderer() : \FSVendor\WPDesk\License\ActivationForm\PluginsPageRenderer
|
72 |
-
{
|
73 |
-
return $this->plugins_page_renderer;
|
74 |
-
}
|
75 |
-
/**
|
76 |
-
* @return AjaxHandler
|
77 |
-
*/
|
78 |
-
public function get_ajax_handler() : \FSVendor\WPDesk\License\ActivationForm\AjaxHandler
|
79 |
-
{
|
80 |
-
return $this->ajax_handler;
|
81 |
-
}
|
82 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/Action.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Action that can be executed relative to plugin.
|
7 |
-
*
|
8 |
-
* @package WPDesk\License\Page
|
9 |
-
*/
|
10 |
-
interface Action
|
11 |
-
{
|
12 |
-
public function execute(array $plugin);
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/AbstractAction.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page\License\Action;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Abstract Action with error handling methods.
|
7 |
-
*/
|
8 |
-
abstract class AbstractAction
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* @var bool
|
12 |
-
*/
|
13 |
-
private $add_settings_error;
|
14 |
-
/**
|
15 |
-
* @var ActionError[]
|
16 |
-
*/
|
17 |
-
private $errors = [];
|
18 |
-
/**
|
19 |
-
* @param bool $add_settings_error .
|
20 |
-
*/
|
21 |
-
public function __construct(bool $add_settings_error)
|
22 |
-
{
|
23 |
-
$this->add_settings_error = $add_settings_error;
|
24 |
-
}
|
25 |
-
/**
|
26 |
-
* @return ActionError[]
|
27 |
-
*/
|
28 |
-
public function get_errors() : array
|
29 |
-
{
|
30 |
-
return $this->errors;
|
31 |
-
}
|
32 |
-
/**
|
33 |
-
* Adds error.
|
34 |
-
*
|
35 |
-
* @param string $setting .
|
36 |
-
* @param string $code .
|
37 |
-
* @param string $message .
|
38 |
-
* @param string $type .
|
39 |
-
*/
|
40 |
-
protected function add_error(string $setting, string $code, string $message, string $type = 'error')
|
41 |
-
{
|
42 |
-
if ($this->add_settings_error) {
|
43 |
-
\add_settings_error($setting, $code, $message, $type);
|
44 |
-
} else {
|
45 |
-
$this->errors[] = new \FSVendor\WPDesk\License\Page\License\Action\ActionError($message, $type);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/ActionError.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page\License\Action;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Action error.
|
7 |
-
*/
|
8 |
-
class ActionError implements \JsonSerializable
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* @var string
|
12 |
-
*/
|
13 |
-
private $message;
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
private $type;
|
18 |
-
/**
|
19 |
-
* @param string $message .
|
20 |
-
* @param string $type .
|
21 |
-
*/
|
22 |
-
public function __construct(string $message, string $type)
|
23 |
-
{
|
24 |
-
$this->message = $message;
|
25 |
-
$this->type = $type;
|
26 |
-
}
|
27 |
-
/**
|
28 |
-
* @return string
|
29 |
-
*/
|
30 |
-
public function get_message() : string
|
31 |
-
{
|
32 |
-
return $this->message;
|
33 |
-
}
|
34 |
-
/**
|
35 |
-
* @return string
|
36 |
-
*/
|
37 |
-
public function get_type() : string
|
38 |
-
{
|
39 |
-
return $this->type;
|
40 |
-
}
|
41 |
-
/**
|
42 |
-
* @return array
|
43 |
-
*/
|
44 |
-
public function jsonSerialize() : array
|
45 |
-
{
|
46 |
-
return ['message' => $this->message, 'type' => $this->type];
|
47 |
-
}
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseActivation.php
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page\License\Action;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\Action;
|
6 |
-
use FSVendor\WPDesk\License\ServerAddressRepository;
|
7 |
-
use FSVendor\WPDesk_API_Manager_With_Update_Flag;
|
8 |
-
/**
|
9 |
-
* Can activate plugin license.
|
10 |
-
*
|
11 |
-
* @package WPDesk\License\Page\License\Action
|
12 |
-
*/
|
13 |
-
class LicenseActivation extends \FSVendor\WPDesk\License\Page\License\Action\AbstractAction implements \FSVendor\WPDesk\License\Page\Action
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* Plugin data.
|
17 |
-
*
|
18 |
-
* @var array
|
19 |
-
*/
|
20 |
-
private $plugin_data;
|
21 |
-
/**
|
22 |
-
* Activate plugin license.
|
23 |
-
*
|
24 |
-
* @param $plugin array Info about plugin
|
25 |
-
*/
|
26 |
-
public function execute(array $plugin)
|
27 |
-
{
|
28 |
-
$activation_email = \sanitize_email(\trim($_POST['activation_email']));
|
29 |
-
$api_key = \sanitize_text_field(\trim($_POST['api_key']));
|
30 |
-
$product_id = $plugin['product_id'];
|
31 |
-
$this->plugin_data = $plugin;
|
32 |
-
$this->activate_license($activation_email, $api_key, new \FSVendor\WPDesk\License\ServerAddressRepository($product_id));
|
33 |
-
}
|
34 |
-
/**
|
35 |
-
* Get api manager from plugin data.
|
36 |
-
*
|
37 |
-
* @return WPDesk_API_Manager_With_Update_Flag
|
38 |
-
*/
|
39 |
-
private function get_api_manager_from_plugin_data()
|
40 |
-
{
|
41 |
-
return $this->plugin_data['api_manager'];
|
42 |
-
}
|
43 |
-
/**
|
44 |
-
* Is activated?
|
45 |
-
*
|
46 |
-
* @param mixed $activate_results Activate result.
|
47 |
-
*
|
48 |
-
* @return bool
|
49 |
-
*/
|
50 |
-
private function is_activated($activate_results)
|
51 |
-
{
|
52 |
-
if (\is_array($activate_results)) {
|
53 |
-
if (isset($activate_results['activated']) && \true === $activate_results['activated']) {
|
54 |
-
return \true;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
return \false;
|
58 |
-
}
|
59 |
-
/**
|
60 |
-
* Is json error?
|
61 |
-
*
|
62 |
-
* @return bool
|
63 |
-
*/
|
64 |
-
private function is_json_error()
|
65 |
-
{
|
66 |
-
if (\JSON_ERROR_NONE !== \json_last_error()) {
|
67 |
-
return \true;
|
68 |
-
}
|
69 |
-
return \false;
|
70 |
-
}
|
71 |
-
/**
|
72 |
-
* Is invalid api license key?
|
73 |
-
*
|
74 |
-
* @param mixed $activate_results Activate result.
|
75 |
-
*
|
76 |
-
* @return bool
|
77 |
-
*/
|
78 |
-
private function is_invalid_api_license_key($activate_results)
|
79 |
-
{
|
80 |
-
if (\is_array($activate_results)) {
|
81 |
-
if (isset($activate_results['code']) && '101' === $activate_results['code']) {
|
82 |
-
return \true;
|
83 |
-
}
|
84 |
-
}
|
85 |
-
return \false;
|
86 |
-
}
|
87 |
-
/**
|
88 |
-
* Activate and save data.
|
89 |
-
*
|
90 |
-
* @param WPDesk_API_Manager_With_Update_Flag $plugin_api_manager Api manager.
|
91 |
-
* @param string $activation_email Activation email.
|
92 |
-
* @param string $api_key Api key.
|
93 |
-
*/
|
94 |
-
private function activate_and_save_data($plugin_api_manager, $activation_email, $api_key)
|
95 |
-
{
|
96 |
-
$plugin_api_manager->options[$plugin_api_manager->api_key] = $api_key;
|
97 |
-
$plugin_api_manager->options[$plugin_api_manager->activation_email] = $activation_email;
|
98 |
-
\update_option($plugin_api_manager->data_key, $plugin_api_manager->options);
|
99 |
-
\update_option($plugin_api_manager->upgrade_url_key, $plugin_api_manager->upgrade_url);
|
100 |
-
\update_option($plugin_api_manager->activated_key, 'Activated');
|
101 |
-
}
|
102 |
-
/**
|
103 |
-
* Activate and save data.
|
104 |
-
*
|
105 |
-
* @param WPDesk_API_Manager_With_Update_Flag $plugin_api_manager Api manager.
|
106 |
-
*/
|
107 |
-
private function deactivate_and_save_data($plugin_api_manager)
|
108 |
-
{
|
109 |
-
$plugin_api_manager->options[$plugin_api_manager->api_key] = '';
|
110 |
-
$plugin_api_manager->options[$plugin_api_manager->activation_email] = '';
|
111 |
-
\update_option($plugin_api_manager->data_key, $plugin_api_manager->options);
|
112 |
-
\update_option($plugin_api_manager->activated_key, 'Deactivated');
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* Show error from reposne.
|
116 |
-
*
|
117 |
-
* @param array $activate_results Activate results.
|
118 |
-
*/
|
119 |
-
private function show_error(array $activate_results)
|
120 |
-
{
|
121 |
-
if (!isset($activate_results['additional info'])) {
|
122 |
-
$activate_results['additional info'] = '';
|
123 |
-
}
|
124 |
-
$message = "{$activate_results['error']} {$activate_results['additional info']}";
|
125 |
-
$this->add_error('api_manager_message', 'api_manager_error', $message, 'error');
|
126 |
-
}
|
127 |
-
/**
|
128 |
-
* Show unknown error.
|
129 |
-
*/
|
130 |
-
private function show_unknown_error()
|
131 |
-
{
|
132 |
-
$this->add_error('api_key_check_text', 'api_key_check_error', \__('Connection failed to the Subscription Key API server. Try again later.', 'flexible-shipping'), 'error');
|
133 |
-
}
|
134 |
-
/**
|
135 |
-
* Show activation message.
|
136 |
-
*
|
137 |
-
* @param array $activate_results Activation results.
|
138 |
-
*/
|
139 |
-
private function show_activation_message(array $activate_results)
|
140 |
-
{
|
141 |
-
$this->add_error('activate_text', 'activate_msg', \__('Plugin license activated. ', 'flexible-shipping') . "{$activate_results['message']}.", 'updated');
|
142 |
-
}
|
143 |
-
/**
|
144 |
-
* Activate license.
|
145 |
-
*
|
146 |
-
* @param string $activation_email Activation email.
|
147 |
-
* @param string $api_key Api key.
|
148 |
-
* @param ServerAddressRepository $address_repository Repository of server addresses to check for activation
|
149 |
-
*/
|
150 |
-
public function activate_license($activation_email, $api_key, \FSVendor\WPDesk\License\ServerAddressRepository $address_repository)
|
151 |
-
{
|
152 |
-
$plugin_api_manager = $this->get_api_manager_from_plugin_data();
|
153 |
-
$activation_args = ['email' => $activation_email, 'licence_key' => $api_key];
|
154 |
-
$activate_results = ['activated' => \false];
|
155 |
-
foreach ($address_repository->get_server_urls() as $upgrade_url) {
|
156 |
-
$plugin_api_manager->upgrade_url = $upgrade_url;
|
157 |
-
$activate_raw_response = $plugin_api_manager->key()->activate($activation_args);
|
158 |
-
$activate_results = \json_decode($activate_raw_response, \true);
|
159 |
-
if ($this->is_json_error()) {
|
160 |
-
$activate_results = ['activated' => \false, 'error' => 'Invalid response from API Server', 'additional info' => $activate_raw_response, 'code' => '500'];
|
161 |
-
break;
|
162 |
-
}
|
163 |
-
if ($this->is_activated($activate_results) || !$this->is_invalid_api_license_key($activate_results)) {
|
164 |
-
break;
|
165 |
-
}
|
166 |
-
}
|
167 |
-
if (isset($activate_results['activated']) && \true === $activate_results['activated']) {
|
168 |
-
$this->activate_and_save_data($plugin_api_manager, $activation_email, $api_key);
|
169 |
-
$this->show_activation_message($activate_results);
|
170 |
-
} else {
|
171 |
-
$this->deactivate_and_save_data($plugin_api_manager);
|
172 |
-
if (isset($activate_results['code'])) {
|
173 |
-
$this->show_error($activate_results);
|
174 |
-
} else {
|
175 |
-
$this->show_unknown_error();
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/LicenseDeactivation.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page\License\Action;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\Action;
|
6 |
-
/**
|
7 |
-
* Can deactivate plugin license.
|
8 |
-
*
|
9 |
-
* @package WPDesk\License\Page\License\Action
|
10 |
-
*/
|
11 |
-
class LicenseDeactivation extends \FSVendor\WPDesk\License\Page\License\Action\AbstractAction implements \FSVendor\WPDesk\License\Page\Action
|
12 |
-
{
|
13 |
-
/**
|
14 |
-
* Deactivate plugin subscription.
|
15 |
-
*
|
16 |
-
* @param $plugin array Info about plugin
|
17 |
-
*/
|
18 |
-
public function execute(array $plugin)
|
19 |
-
{
|
20 |
-
$args = ['email' => $plugin['api_manager']->options[$plugin['api_manager']->activation_email], 'licence_key' => $plugin['api_manager']->options[$plugin['api_manager']->api_key]];
|
21 |
-
$activate_results = \json_decode($plugin['api_manager']->key()->deactivate($args), \true);
|
22 |
-
// Used to display results for development
|
23 |
-
//print_r($activate_results); exit();
|
24 |
-
$deactivated = \false;
|
25 |
-
if ($activate_results['deactivated'] === \true) {
|
26 |
-
$update = [$plugin['api_manager']->api_key => '', $plugin['api_manager']->activation_email => ''];
|
27 |
-
$merge_options = \array_merge($plugin['api_manager']->options, $update);
|
28 |
-
\update_option($plugin['api_manager']->data_key, $merge_options);
|
29 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
30 |
-
\delete_option($plugin['api_manager']->upgrade_url_key);
|
31 |
-
$this->add_error('wc_am_deactivate_text', 'deactivate_msg', \__('Plugin license deactivated. ', 'flexible-shipping') . "{$activate_results['activations_remaining']}.", 'updated');
|
32 |
-
$deactivated = \true;
|
33 |
-
$plugin_wpdesk_name = $plugin['plugin'];
|
34 |
-
$plugin_product_id = $plugin['product_id'];
|
35 |
-
\do_action('wpdesk_subscription_deactivated', $plugin_wpdesk_name, $plugin_product_id);
|
36 |
-
}
|
37 |
-
if (!$deactivated && isset($activate_results['code'])) {
|
38 |
-
switch ($activate_results['code']) {
|
39 |
-
case '100':
|
40 |
-
$this->add_error('api_email_text', 'api_email_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
41 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
42 |
-
$options[$plugin['api_manager']->api_key] = '';
|
43 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
44 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
45 |
-
break;
|
46 |
-
case '101':
|
47 |
-
$this->add_error('api_key_text', 'api_key_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
48 |
-
$options[$plugin['api_manager']->api_key] = '';
|
49 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
50 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
51 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
52 |
-
break;
|
53 |
-
case '102':
|
54 |
-
$this->add_error('api_key_purchase_incomplete_text', 'api_key_purchase_incomplete_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
55 |
-
$options[$plugin['api_manager']->api_key] = '';
|
56 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
57 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
58 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
59 |
-
break;
|
60 |
-
case '103':
|
61 |
-
$this->add_error('api_key_exceeded_text', 'api_key_exceeded_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
62 |
-
$options[$plugin['api_manager']->api_key] = '';
|
63 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
64 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
65 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
66 |
-
break;
|
67 |
-
case '104':
|
68 |
-
$this->add_error('api_key_not_activated_text', 'api_key_not_activated_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
69 |
-
$options[$plugin['api_manager']->api_key] = '';
|
70 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
71 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
72 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
73 |
-
break;
|
74 |
-
case '105':
|
75 |
-
$this->add_error('api_key_invalid_text', 'api_key_invalid_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
76 |
-
$options[$plugin['api_manager']->api_key] = '';
|
77 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
78 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
79 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
80 |
-
break;
|
81 |
-
case '106':
|
82 |
-
$this->add_error('sub_not_active_text', 'sub_not_active_error', "{$activate_results['error']}. {$activate_results['additional info']}", 'error');
|
83 |
-
$options[$plugin['api_manager']->api_key] = '';
|
84 |
-
$options[$plugin['api_manager']->activation_email] = '';
|
85 |
-
\update_option($plugin['api_manager']->data_key, $plugin['api_manager']->options);
|
86 |
-
\update_option($plugin['api_manager']->activated_key, 'Deactivated');
|
87 |
-
break;
|
88 |
-
}
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/Action/Nothing.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page\License\Action;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\Action;
|
6 |
-
/**
|
7 |
-
* Do nothing.
|
8 |
-
*
|
9 |
-
* @package WPDesk\License\Page\License\Action
|
10 |
-
*/
|
11 |
-
class Nothing implements \FSVendor\WPDesk\License\Page\Action
|
12 |
-
{
|
13 |
-
public function execute(array $plugin)
|
14 |
-
{
|
15 |
-
// NOOP
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/class-wpdesk-helper-list-table.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
if (!\defined('ABSPATH')) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
// Exit if accessed directly
|
9 |
-
if (!\class_exists('WP_List_Table')) {
|
10 |
-
require_once \ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
11 |
-
}
|
12 |
-
class WPDesk_Helper_List_Table extends \WP_List_Table
|
13 |
-
{
|
14 |
-
public $per_page = 100;
|
15 |
-
public $data;
|
16 |
-
public function __construct($args = [])
|
17 |
-
{
|
18 |
-
global $status, $page;
|
19 |
-
parent::__construct(['singular' => 'subscription', 'plural' => 'subscriptions', 'ajax' => \false]);
|
20 |
-
$status = 'all';
|
21 |
-
$page = $this->get_pagenum();
|
22 |
-
$this->data = [];
|
23 |
-
parent::__construct($args);
|
24 |
-
}
|
25 |
-
public function no_items()
|
26 |
-
{
|
27 |
-
echo \wpautop(\__('No WP Desk plugins found.', 'flexible-shipping'));
|
28 |
-
}
|
29 |
-
public function column_default($item, $column_name)
|
30 |
-
{
|
31 |
-
return $item[$column_name];
|
32 |
-
}
|
33 |
-
public function get_sortable_columns()
|
34 |
-
{
|
35 |
-
return [];
|
36 |
-
}
|
37 |
-
public function get_columns()
|
38 |
-
{
|
39 |
-
$columns = ['product_name' => \__('Plugin', 'flexible-shipping'), 'product_status' => \__('Subscription Status', 'flexible-shipping'), 'product_license' => \__('Subscription Data', 'flexible-shipping')];
|
40 |
-
return $columns;
|
41 |
-
}
|
42 |
-
public function column_plugin_data($item)
|
43 |
-
{
|
44 |
-
return '<pre>' . \print_r($item, \true) . '</pre>';
|
45 |
-
}
|
46 |
-
public function column_product_name($item)
|
47 |
-
{
|
48 |
-
return \wpautop('<strong>' . $item['api_manager']->product_id . '</strong>');
|
49 |
-
}
|
50 |
-
public function column_product_version($item)
|
51 |
-
{
|
52 |
-
return \wpautop($item['api_manager']->version);
|
53 |
-
}
|
54 |
-
public function column_product_status($item)
|
55 |
-
{
|
56 |
-
$status = \__('Deactivated', 'flexible-shipping');
|
57 |
-
if ($item['activation_status'] == 'Activated') {
|
58 |
-
$status = \__('Activated', 'flexible-shipping');
|
59 |
-
}
|
60 |
-
return $status;
|
61 |
-
}
|
62 |
-
public function column_product_license($item)
|
63 |
-
{
|
64 |
-
$disabled = 'disabled';
|
65 |
-
$api_key = '';
|
66 |
-
$activation_email = '';
|
67 |
-
if ($item['activation_status'] == 'Deactivated') {
|
68 |
-
$disabled = '';
|
69 |
-
} else {
|
70 |
-
$api_key = $item['api_manager']->options[$item['api_manager']->api_key];
|
71 |
-
$activation_email = $item['api_manager']->options[$item['api_manager']->activation_email];
|
72 |
-
}
|
73 |
-
$plugin = $item['plugin'];
|
74 |
-
$activation_status = $item['activation_status'];
|
75 |
-
\ob_start();
|
76 |
-
include 'license-actions.php';
|
77 |
-
$output = \ob_get_contents();
|
78 |
-
\ob_end_clean();
|
79 |
-
return $output;
|
80 |
-
}
|
81 |
-
public function get_bulk_actions()
|
82 |
-
{
|
83 |
-
$actions = [];
|
84 |
-
return $actions;
|
85 |
-
}
|
86 |
-
public function prepare_items()
|
87 |
-
{
|
88 |
-
$columns = $this->get_columns();
|
89 |
-
$hidden = [];
|
90 |
-
$sortable = $this->get_sortable_columns();
|
91 |
-
$this->_column_headers = [$columns, $hidden, $sortable];
|
92 |
-
$total_items = \count($this->data);
|
93 |
-
$this->set_pagination_args(['total_items' => $total_items, 'per_page' => $total_items]);
|
94 |
-
$this->items = $this->data;
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/license-actions.php
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
if (!\defined('ABSPATH')) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
// Exit if accessed directly
|
9 |
-
?>
|
10 |
-
<form method="POST">
|
11 |
-
<table class="wpdesk_helper_key_table">
|
12 |
-
<tr>
|
13 |
-
<td><?php
|
14 |
-
\esc_html(\__('Key:', 'flexible-shipping'));
|
15 |
-
?></td>
|
16 |
-
<td><input class="wpdesk_helper_input" name="api_key" type="text"
|
17 |
-
value="<?php
|
18 |
-
echo \esc_attr($api_key);
|
19 |
-
?>" <?php
|
20 |
-
echo \esc_attr($disabled);
|
21 |
-
?> /></td>
|
22 |
-
</tr>
|
23 |
-
<tr>
|
24 |
-
<td><?php
|
25 |
-
\esc_html(\__('Email:', 'flexible-shipping'));
|
26 |
-
?></td>
|
27 |
-
<td><input class="wpdesk_helper_input" name="activation_email" type="email"
|
28 |
-
value="<?php
|
29 |
-
echo \esc_attr($activation_email);
|
30 |
-
?>" <?php
|
31 |
-
echo \esc_attr($disabled);
|
32 |
-
?> /></td>
|
33 |
-
</tr>
|
34 |
-
<tr>
|
35 |
-
<td></td>
|
36 |
-
<td>
|
37 |
-
<?php
|
38 |
-
if ($activation_status == 'Deactivated') {
|
39 |
-
?>
|
40 |
-
<button class="wpdesk_helper_button button button-primary"><?php
|
41 |
-
echo \esc_html(\__('Activate', 'flexible-shipping'));
|
42 |
-
?></button>
|
43 |
-
<?php
|
44 |
-
} else {
|
45 |
-
?>
|
46 |
-
<button class="wpdesk_helper_button button"><?php
|
47 |
-
echo \esc_html(\__('Deactivate', 'flexible-shipping'));
|
48 |
-
?></button>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
</td>
|
53 |
-
</tr>
|
54 |
-
</table>
|
55 |
-
<input type="hidden" name="plugin" value="<?php
|
56 |
-
echo \esc_attr($plugin);
|
57 |
-
?>"/>
|
58 |
-
<?php
|
59 |
-
if ($activation_status == 'Deactivated') {
|
60 |
-
?>
|
61 |
-
<input type="hidden" name="action" value="activate"/>
|
62 |
-
<?php
|
63 |
-
} else {
|
64 |
-
?>
|
65 |
-
<input type="hidden" name="action" value="deactivate"/>
|
66 |
-
<?php
|
67 |
-
}
|
68 |
-
?>
|
69 |
-
</form>
|
70 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/License/views/licenses.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor;
|
4 |
-
|
5 |
-
if (!\defined('ABSPATH')) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
// Exit if accessed directly
|
9 |
-
?>
|
10 |
-
<style>
|
11 |
-
#product_license {
|
12 |
-
width: 500px;
|
13 |
-
}
|
14 |
-
|
15 |
-
.wpdesk_helper_key_table,
|
16 |
-
.wpdesk_helper_input {
|
17 |
-
width: 100%;
|
18 |
-
}
|
19 |
-
</style>
|
20 |
-
|
21 |
-
<div class="wrap">
|
22 |
-
<?php
|
23 |
-
/* screen_icon(); */
|
24 |
-
?>
|
25 |
-
|
26 |
-
<h1><?php
|
27 |
-
\esc_html_e('WP Desk Subscriptions', 'flexible-shipping');
|
28 |
-
?></h1>
|
29 |
-
|
30 |
-
<p class="mb0">
|
31 |
-
<?php
|
32 |
-
if (\get_locale() === 'pl_PL') {
|
33 |
-
$url = 'https://www.wpdesk.pl/moje-konto/';
|
34 |
-
} else {
|
35 |
-
$url = 'https://www.wpdesk.net/my-account/';
|
36 |
-
}
|
37 |
-
$link = \sprintf(\__('Get your subscription keys <a href="%s" target="_blank">here</a>. You can activate/deactivate API keys <strong>unlimited times on different domains</strong> as long as you have an active subscription.', 'flexible-shipping'), \esc_url($url));
|
38 |
-
echo \wp_kses_post($link);
|
39 |
-
?>
|
40 |
-
</p>
|
41 |
-
|
42 |
-
<?php
|
43 |
-
\settings_errors();
|
44 |
-
?>
|
45 |
-
|
46 |
-
<?php
|
47 |
-
$list_table = new \FSVendor\WPDesk_Helper_List_Table();
|
48 |
-
$list_table->data = $plugins;
|
49 |
-
$list_table->prepare_items();
|
50 |
-
$list_table->display();
|
51 |
-
?>
|
52 |
-
</div> <!-- class="wrap" -->
|
53 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePage.php
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
6 |
-
use FSVendor\WPDesk\License\InstalledPlugins;
|
7 |
-
/**
|
8 |
-
* Can render and manage license page.
|
9 |
-
*
|
10 |
-
* @package WPDesk\License\Page\License
|
11 |
-
*/
|
12 |
-
class LicensePage implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
13 |
-
{
|
14 |
-
const PAGE_SLUG = 'wpdesk-licenses';
|
15 |
-
/** @var string Css/Js version */
|
16 |
-
private $scripts_version = '1';
|
17 |
-
/** @var InstalledPlugins */
|
18 |
-
private $plugin_database;
|
19 |
-
public function __construct(\FSVendor\WPDesk\License\InstalledPlugins $plugin_database)
|
20 |
-
{
|
21 |
-
$this->plugin_database = $plugin_database;
|
22 |
-
}
|
23 |
-
/**
|
24 |
-
* Attach license page hooks.
|
25 |
-
*
|
26 |
-
* @return void
|
27 |
-
*/
|
28 |
-
public function hooks()
|
29 |
-
{
|
30 |
-
\add_action('wp_ajax_wpdesk_api_hide_message', [$this, 'handle_api_hide_message']);
|
31 |
-
\add_action('admin_enqueue_scripts', [$this, 'handle_css_scripts'], 100);
|
32 |
-
}
|
33 |
-
/**
|
34 |
-
* Adds license page submenu.
|
35 |
-
* Have to be called from admin_menu action.
|
36 |
-
*
|
37 |
-
* @return void
|
38 |
-
*/
|
39 |
-
public function handle_add_page_submenu_item()
|
40 |
-
{
|
41 |
-
\add_submenu_page('wpdesk-helper', \__('Subscriptions', 'flexible-shipping'), \__('Subscriptions', 'flexible-shipping'), 'manage_options', self::PAGE_SLUG, [$this, 'handle_render_wpdesk_licenses_page']);
|
42 |
-
}
|
43 |
-
/**
|
44 |
-
* Renders license page.
|
45 |
-
*
|
46 |
-
* @return void
|
47 |
-
*/
|
48 |
-
public function handle_render_wpdesk_licenses_page()
|
49 |
-
{
|
50 |
-
global $wpdesk_helper_plugins;
|
51 |
-
if (!isset($wpdesk_helper_plugins)) {
|
52 |
-
$wpdesk_helper_plugins = [];
|
53 |
-
}
|
54 |
-
if (isset($_POST['plugin']) && $_POST['action']) {
|
55 |
-
$this->execute_plugin_action(\sanitize_text_field($_POST['plugin']), \sanitize_key($_POST['action']));
|
56 |
-
}
|
57 |
-
$plugins = $this->plugin_database->get_plugins_activation_info();
|
58 |
-
/** @noinspection PhpUnusedLocalVariableInspection */
|
59 |
-
$plugins = $this->ensure_unique_product($plugins);
|
60 |
-
if (!\class_exists('FSVendor\\WPDesk_Helper_List_Table')) {
|
61 |
-
require_once __DIR__ . '/License/views/class-wpdesk-helper-list-table.php';
|
62 |
-
}
|
63 |
-
include __DIR__ . '/License/views/licenses.php';
|
64 |
-
}
|
65 |
-
/**
|
66 |
-
* Ensures that no product are shown more than once
|
67 |
-
*
|
68 |
-
* @param array $plugins
|
69 |
-
*
|
70 |
-
* @return array
|
71 |
-
*/
|
72 |
-
private function ensure_unique_product(array $plugins)
|
73 |
-
{
|
74 |
-
$uniqueness = [];
|
75 |
-
return \array_filter($plugins, static function ($item) use(&$uniqueness) {
|
76 |
-
$key = $item['product_id'];
|
77 |
-
if (!isset($uniqueness[$key])) {
|
78 |
-
$uniqueness[$key] = \true;
|
79 |
-
return \true;
|
80 |
-
}
|
81 |
-
return \false;
|
82 |
-
});
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* Find plugin with given name and execute action with given name.
|
86 |
-
*
|
87 |
-
* @param $plugin string Plugin name
|
88 |
-
* @param $action string to execute
|
89 |
-
*/
|
90 |
-
private function execute_plugin_action($plugin, $action)
|
91 |
-
{
|
92 |
-
$plugins = $this->plugin_database->get_plugins_activation_info();
|
93 |
-
foreach ($plugins as $plugin_key => $wpdesk_helper_plugin) {
|
94 |
-
if ($wpdesk_helper_plugin['plugin'] === $plugin) {
|
95 |
-
$plugin_info = $wpdesk_helper_plugin;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
if (isset($plugin_info)) {
|
99 |
-
(new \FSVendor\WPDesk\License\Page\LicensePageActions())->create_action($action)->execute($plugin_info);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
/**
|
103 |
-
* Remember that the given in request message should be closed.
|
104 |
-
* Have to be called from wp_ajax_wpdesk_api_hide_message action.
|
105 |
-
*/
|
106 |
-
public function handle_api_hide_message()
|
107 |
-
{
|
108 |
-
if (\wp_verify_nonce($_REQUEST['nonce'], 'wpdesk-api-ajax-notification-nonce')) {
|
109 |
-
if (\update_option('wpdesk_api_message_close', \sanitize_key($_REQUEST['value']))) {
|
110 |
-
die('1');
|
111 |
-
}
|
112 |
-
die('0');
|
113 |
-
}
|
114 |
-
}
|
115 |
-
/**
|
116 |
-
* Append license page css.
|
117 |
-
*
|
118 |
-
* Have to be called from admin_enqueue_scripts action.
|
119 |
-
*/
|
120 |
-
public function handle_css_scripts()
|
121 |
-
{
|
122 |
-
$screen = \get_current_screen();
|
123 |
-
if (isset($screen) && \in_array($screen->base, ['toplevel_page_wpdesk-helper', 'wp-desk_page_wpdesk-licenses', 'wp-desk-1_page_wpdesk-licenses'], \true)) {
|
124 |
-
\wp_register_style(self::PAGE_SLUG, \plugins_url('wpdesk-helper/assets/css/admin-settings.css'), [], $this->scripts_version);
|
125 |
-
\wp_enqueue_style(self::PAGE_SLUG);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/Page/LicensePageActions.php
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\Page;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\License\Page\License\Action\LicenseActivation;
|
6 |
-
use FSVendor\WPDesk\License\Page\License\Action\LicenseDeactivation;
|
7 |
-
use FSVendor\WPDesk\License\Page\License\Action\Nothing;
|
8 |
-
/**
|
9 |
-
* Action factory.
|
10 |
-
*
|
11 |
-
* @package WPDesk\License\Page\License
|
12 |
-
*/
|
13 |
-
class LicensePageActions
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* Creates action object according to given param
|
17 |
-
*
|
18 |
-
* @param string $action .
|
19 |
-
* @param bool $add_settings_error .
|
20 |
-
*
|
21 |
-
* @return Action
|
22 |
-
*/
|
23 |
-
public function create_action($action, $add_settings_error = \true)
|
24 |
-
{
|
25 |
-
if ('activate' === $action) {
|
26 |
-
return new \FSVendor\WPDesk\License\Page\License\Action\LicenseActivation($add_settings_error);
|
27 |
-
}
|
28 |
-
if ('deactivate' === $action) {
|
29 |
-
return new \FSVendor\WPDesk\License\Page\License\Action\LicenseDeactivation($add_settings_error);
|
30 |
-
}
|
31 |
-
return new \FSVendor\WPDesk\License\Page\License\Action\Nothing();
|
32 |
-
}
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginLicense.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk_Plugin_Info;
|
6 |
-
/**
|
7 |
-
* Provides plugin license information.
|
8 |
-
*/
|
9 |
-
class PluginLicense
|
10 |
-
{
|
11 |
-
/**
|
12 |
-
* @var WPDesk_Plugin_Info
|
13 |
-
*/
|
14 |
-
private $plugin_info;
|
15 |
-
/**
|
16 |
-
* @param WPDesk_Plugin_Info $info
|
17 |
-
*/
|
18 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $info)
|
19 |
-
{
|
20 |
-
$this->plugin_info = $info;
|
21 |
-
}
|
22 |
-
/**
|
23 |
-
* @return bool
|
24 |
-
*/
|
25 |
-
public function is_active()
|
26 |
-
{
|
27 |
-
return \get_option($this->prepare_option_is_active()) === 'Activated';
|
28 |
-
}
|
29 |
-
/**
|
30 |
-
* @return string
|
31 |
-
*/
|
32 |
-
public function get_api_key()
|
33 |
-
{
|
34 |
-
$api_option = $this->get_api_option();
|
35 |
-
$field_key = $this->prepare_option_name('key');
|
36 |
-
return isset($api_option[$field_key]) ? $api_option[$field_key] : '';
|
37 |
-
}
|
38 |
-
/**
|
39 |
-
* @return string
|
40 |
-
*/
|
41 |
-
public function get_activation_email()
|
42 |
-
{
|
43 |
-
$api_option = $this->get_api_option();
|
44 |
-
$field_key = $this->prepare_option_name('activation_email');
|
45 |
-
return isset($api_option[$field_key]) ? $api_option[$field_key] : '';
|
46 |
-
}
|
47 |
-
/**
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
public function get_upgrade_url()
|
51 |
-
{
|
52 |
-
return (string) \get_option($this->prepare_option_name('upgrade_url', ''));
|
53 |
-
}
|
54 |
-
/**
|
55 |
-
* @return array
|
56 |
-
*/
|
57 |
-
private function get_api_option()
|
58 |
-
{
|
59 |
-
$option_value = \get_option(\sprintf('api_%1$s', \basename($this->plugin_info->get_plugin_dir())), []);
|
60 |
-
return \is_array($option_value) ? $option_value : [];
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* @return string
|
64 |
-
*/
|
65 |
-
private function prepare_option_is_active()
|
66 |
-
{
|
67 |
-
return $this->prepare_option_name('activated');
|
68 |
-
}
|
69 |
-
/**
|
70 |
-
* @param string $field .
|
71 |
-
*
|
72 |
-
* @return string
|
73 |
-
*/
|
74 |
-
private function prepare_option_name($field)
|
75 |
-
{
|
76 |
-
return \sprintf('api_%1$s_%2$s', \basename($this->plugin_info->get_plugin_slug()), $field);
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/PluginRegistrator.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk_Plugin_Info;
|
6 |
-
/**
|
7 |
-
* Replaces WPDesk_Helper_Plugin. Gets info from plugin and sends it to subscription/update integrations
|
8 |
-
*
|
9 |
-
* @package WPDesk\License
|
10 |
-
*/
|
11 |
-
class PluginRegistrator
|
12 |
-
{
|
13 |
-
/** @var WPDesk_Plugin_Info */
|
14 |
-
private $plugin_info;
|
15 |
-
/**
|
16 |
-
* @var PluginLicense
|
17 |
-
*/
|
18 |
-
private $plugin_license;
|
19 |
-
public function __construct(\FSVendor\WPDesk_Plugin_Info $plugin_info)
|
20 |
-
{
|
21 |
-
$this->plugin_info = $plugin_info;
|
22 |
-
$this->plugin_license = new \FSVendor\WPDesk\License\PluginLicense($plugin_info);
|
23 |
-
}
|
24 |
-
/**
|
25 |
-
* @return bool
|
26 |
-
*/
|
27 |
-
public function is_active()
|
28 |
-
{
|
29 |
-
return $this->plugin_license->is_active();
|
30 |
-
}
|
31 |
-
/**
|
32 |
-
* Initializes license manager.
|
33 |
-
*/
|
34 |
-
public function initialize_license_manager()
|
35 |
-
{
|
36 |
-
$license_manager = new \FSVendor\WPDesk\License\LicenseManager($this->plugin_info);
|
37 |
-
$license_manager->init_activation_form();
|
38 |
-
$api_manager = $license_manager->create_api_manager();
|
39 |
-
$license_manager->init_wp_upgrader($api_manager->is_activated(), $api_manager->get_myaccount_url());
|
40 |
-
$license_manager->hooks();
|
41 |
-
}
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/ServerAddressRepository.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Provides server urls to check for upgrade/activation
|
7 |
-
*
|
8 |
-
* @package WPDesk\License
|
9 |
-
*/
|
10 |
-
class ServerAddressRepository
|
11 |
-
{
|
12 |
-
/** @var string */
|
13 |
-
private $product_id;
|
14 |
-
/**
|
15 |
-
* @param string $product_id Product if of a plugin. Retrieve from plugin_info
|
16 |
-
*/
|
17 |
-
public function __construct($product_id)
|
18 |
-
{
|
19 |
-
$this->product_id = $product_id;
|
20 |
-
}
|
21 |
-
/**
|
22 |
-
* Returns default server to ping ie. when checking if upgrade is available but is not yet activated
|
23 |
-
*
|
24 |
-
* @return string
|
25 |
-
*/
|
26 |
-
public function get_default_update_url()
|
27 |
-
{
|
28 |
-
$urls = $this->get_server_urls();
|
29 |
-
return \reset($urls);
|
30 |
-
}
|
31 |
-
/**
|
32 |
-
* Return list of servers to check for update
|
33 |
-
*
|
34 |
-
* @return string[] Full URL with protocol. Without ending /
|
35 |
-
*/
|
36 |
-
public function get_server_urls()
|
37 |
-
{
|
38 |
-
// PL version should be default for most plugins
|
39 |
-
$servers = ['https://www.wpdesk.pl', 'https://www.wpdesk.net'];
|
40 |
-
$servers[] = 'https://flexibleinvoices.com';
|
41 |
-
if ($this->is_invoice_product($this->product_id)) {
|
42 |
-
$servers = \array_reverse($servers);
|
43 |
-
// set invoice server as first to check
|
44 |
-
}
|
45 |
-
$servers[] = 'https://shopmagic.app';
|
46 |
-
if ($this->is_magic_plugin($this->product_id)) {
|
47 |
-
$servers = \array_reverse($servers);
|
48 |
-
// set magic server as first to check
|
49 |
-
}
|
50 |
-
$servers[] = 'https://octolize.com';
|
51 |
-
if ($this->is_shipping_plugin($this->product_id)) {
|
52 |
-
$servers = \array_reverse($servers);
|
53 |
-
// set fs server as first to check
|
54 |
-
}
|
55 |
-
return $servers;
|
56 |
-
}
|
57 |
-
/**
|
58 |
-
* Is product id of a ShopMagic Plugin?
|
59 |
-
*
|
60 |
-
* @param string $product_id
|
61 |
-
*
|
62 |
-
* @return bool
|
63 |
-
*/
|
64 |
-
private function is_magic_plugin($product_id)
|
65 |
-
{
|
66 |
-
return \stripos($product_id, 'ShopMagic') !== \false;
|
67 |
-
}
|
68 |
-
/**
|
69 |
-
* Is product id of a ShopMagic Plugin?
|
70 |
-
*
|
71 |
-
* @param string $product_id
|
72 |
-
*
|
73 |
-
* @return bool
|
74 |
-
*/
|
75 |
-
private function is_invoice_product($product_id)
|
76 |
-
{
|
77 |
-
return \stripos($product_id, 'Invoices') !== \false;
|
78 |
-
}
|
79 |
-
/**
|
80 |
-
* Is product id of a Flexible Shipping plugin?
|
81 |
-
*
|
82 |
-
* @param string $product_id .
|
83 |
-
*
|
84 |
-
* @return bool
|
85 |
-
*/
|
86 |
-
private function is_shipping_plugin($product_id)
|
87 |
-
{
|
88 |
-
$plugins = ['DHL', 'UPS', 'FedEx', 'Royal', 'Hermes', 'DPD', 'Flexible Shipping'];
|
89 |
-
// if one of the $plugins phrase found in product_id
|
90 |
-
return \count(\array_filter($plugins, static function ($plugin) use($product_id) {
|
91 |
-
return \stripos($product_id, $plugin) !== \false;
|
92 |
-
})) > 0;
|
93 |
-
}
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor_prefixed/wpdesk/wp-wpdesk-license/src/WpUpgrader/SubscriptionHandler.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace FSVendor\WPDesk\License\WpUpgrader;
|
4 |
-
|
5 |
-
use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
6 |
-
/**
|
7 |
-
* Can handle plugin update for expired subscription.
|
8 |
-
*/
|
9 |
-
class SubscriptionHandler implements \FSVendor\WPDesk\PluginBuilder\Plugin\Hookable
|
10 |
-
{
|
11 |
-
const UNAVAILABLE = 'unavailable';
|
12 |
-
/**
|
13 |
-
* @var string
|
14 |
-
*/
|
15 |
-
private $plugin_file;
|
16 |
-
/**
|
17 |
-
* @var bool
|
18 |
-
*/
|
19 |
-
private $activated;
|
20 |
-
/**
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
private $my_account_subscription_link;
|
24 |
-
/**
|
25 |
-
* .
|
26 |
-
* @param string $plugin_file .
|
27 |
-
* @param bool $activated .
|
28 |
-
* @param string $my_account_subscription_link .
|
29 |
-
*/
|
30 |
-
public function __construct($plugin_file, $activated, $my_account_subscription_link)
|
31 |
-
{
|
32 |
-
$this->plugin_file = $plugin_file;
|
33 |
-
$this->activated = $activated;
|
34 |
-
$this->my_account_subscription_link = $my_account_subscription_link;
|
35 |
-
}
|
36 |
-
/**
|
37 |
-
* .
|
38 |
-
*/
|
39 |
-
public function hooks()
|
40 |
-
{
|
41 |
-
\add_filter('site_transient_update_plugins', [$this, 'add_fake_package_url_if_not_present']);
|
42 |
-
\add_filter('upgrader_pre_download', [$this, 'verify_package_url'], 1000, 3);
|
43 |
-
}
|
44 |
-
/**
|
45 |
-
* .
|
46 |
-
*
|
47 |
-
* @param \stdClass $value .
|
48 |
-
*
|
49 |
-
* @return \stdClass
|
50 |
-
*/
|
51 |
-
public function add_fake_package_url_if_not_present($value)
|
52 |
-
{
|
53 |
-
if (\function_exists('get_current_screen')) {
|
54 |
-
$current_screen = \get_current_screen();
|
55 |
-
if ($current_screen && 'update' === $current_screen->id && isset($value, $value->response, $value->response[$this->plugin_file]) && empty($value->response[$this->plugin_file]->package)) {
|
56 |
-
$value->response[$this->plugin_file]->package = self::UNAVAILABLE;
|
57 |
-
}
|
58 |
-
}
|
59 |
-
return $value;
|
60 |
-
}
|
61 |
-
/**
|
62 |
-
* @param bool $reply
|
63 |
-
* @param string $package
|
64 |
-
* @param \WP_Upgrader $upgrader
|
65 |
-
*
|
66 |
-
* @return \WP_Error|bool
|
67 |
-
*/
|
68 |
-
public function verify_package_url($reply, $package, $upgrader)
|
69 |
-
{
|
70 |
-
if (self::UNAVAILABLE === $package) {
|
71 |
-
if ($this->activated) {
|
72 |
-
return new \WP_Error('package_unavailable', \sprintf(\__('Your plugin subscription has expired. In order to update the plugin please %1$srenew your subscription →%2$s', 'flexible-shipping'), '</strong><a href="' . $this->add_utms($this->my_account_subscription_link) . '" class="button-primary" target="_blank" style="text-decoration: none;">', '</a><strong>'));
|
73 |
-
}
|
74 |
-
return new \WP_Error('package_unavailable', \sprintf(\__('An active subscription API key is required to download the plugin updates. In order to update the plugin please %1$sactivate your API key →%2$s', 'flexible-shipping'), '</strong><a href="' . \admin_url('plugins.php#flexible-shipping-import-export-activation-form') . '" class="button-primary" target="_blank" style="text-decoration: none;">', '</a><strong>'));
|
75 |
-
}
|
76 |
-
return $reply;
|
77 |
-
}
|
78 |
-
/**
|
79 |
-
* @param string $link .
|
80 |
-
*
|
81 |
-
* @return string
|
82 |
-
*/
|
83 |
-
private function add_utms($link)
|
84 |
-
{
|
85 |
-
return \trailingslashit($link) . '?utm_source=update&utm_medium=plugin-list&utm_campaign=subscriptions';
|
86 |
-
}
|
87 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|