Version Description
- [new] wordpress 6.0 support
- [updated] ui improvements
- [updated] wp-content-aware-engine library
Pro Plan:
- [new] display condition for guest author name premium by shoofly solutions
- [new] ability to control totem location and design
Download this release
Release Info
Developer | intoxstudio |
Plugin | Content Aware Sidebars – Unlimited Widget Areas |
Version | 3.18 |
Comparing to | |
See all releases |
Code changes from version 3.17.2 to 3.18
- admin/db-updates.php +3 -3
- app.php +1 -1
- assets/js/cas_admin.min.js +1 -1
- changelog.txt +27 -0
- content-aware-sidebars.php +1 -1
- lib/freemius/LICENSE.txt +673 -673
- lib/freemius/assets/css/admin/account.css +1 -1
- lib/freemius/assets/css/admin/add-ons.css +1 -1
- lib/freemius/assets/css/admin/affiliation.css +1 -1
- lib/freemius/assets/css/admin/checkout.css +1 -1
- lib/freemius/assets/css/admin/clone-resolution.css +1 -1
- lib/freemius/assets/css/admin/common.css +1 -1
- lib/freemius/assets/css/admin/connect.css +1 -1
- lib/freemius/assets/css/admin/debug.css +1 -1
- lib/freemius/assets/css/admin/dialog-boxes.css +1 -1
- lib/freemius/assets/css/admin/gdpr-optin-notice.css +1 -1
- lib/freemius/assets/css/admin/index.php +2 -2
- lib/freemius/assets/css/admin/plugins.css +1 -1
- lib/freemius/assets/css/customizer.css +1 -1
- lib/freemius/assets/css/index.php +2 -2
- lib/freemius/assets/img/index.php +2 -2
- lib/freemius/assets/index.php +2 -2
- lib/freemius/assets/js/index.php +2 -2
- lib/freemius/assets/js/nojquery.ba-postmessage.js +139 -139
- lib/freemius/assets/js/nojquery.ba-postmessage.min.js +11 -11
- lib/freemius/assets/js/postmessage.js +134 -134
- lib/freemius/config.php +391 -391
- lib/freemius/includes/class-freemius-abstract.php +596 -596
- lib/freemius/includes/class-fs-admin-notices.php +351 -351
- lib/freemius/includes/class-fs-logger.php +691 -691
- lib/freemius/includes/class-fs-security.php +85 -85
- lib/freemius/includes/class-fs-user-lock.php +125 -125
- lib/freemius/includes/customizer/class-fs-customizer-support-section.php +101 -101
- lib/freemius/includes/customizer/index.php +2 -2
- lib/freemius/includes/debug/class-fs-debug-bar-panel.php +64 -64
- lib/freemius/includes/debug/debug-bar-start.php +51 -51
- lib/freemius/includes/debug/index.php +2 -2
- lib/freemius/includes/entities/class-fs-affiliate.php +83 -83
- lib/freemius/includes/entities/class-fs-billing.php +94 -94
- lib/freemius/includes/entities/class-fs-entity.php +158 -158
- lib/freemius/includes/entities/class-fs-payment.php +167 -167
- lib/freemius/includes/entities/class-fs-plugin-info.php +33 -33
- lib/freemius/includes/entities/class-fs-plugin-license.php +330 -330
- lib/freemius/includes/entities/class-fs-plugin-plan.php +144 -144
- lib/freemius/includes/entities/class-fs-plugin-tag.php +59 -59
- lib/freemius/includes/entities/class-fs-plugin.php +158 -158
- lib/freemius/includes/entities/class-fs-pricing.php +156 -156
- lib/freemius/includes/entities/class-fs-scope-entity.php +28 -28
- lib/freemius/includes/entities/class-fs-subscription.php +146 -146
- lib/freemius/includes/entities/class-fs-user.php +72 -72
- lib/freemius/includes/entities/index.php +2 -2
- lib/freemius/includes/index.php +2 -2
- lib/freemius/includes/l10n.php +48 -48
- lib/freemius/includes/managers/class-fs-admin-menu-manager.php +1005 -1005
- lib/freemius/includes/managers/class-fs-cache-manager.php +325 -325
- lib/freemius/includes/managers/class-fs-gdpr-manager.php +201 -201
- lib/freemius/includes/managers/class-fs-key-value-storage.php +401 -401
- lib/freemius/includes/managers/class-fs-license-manager.php +103 -103
- lib/freemius/includes/managers/class-fs-option-manager.php +521 -521
- lib/freemius/includes/managers/class-fs-plan-manager.php +161 -161
- lib/freemius/includes/managers/index.php +2 -2
- lib/freemius/includes/sdk/Exceptions/index.php +2 -2
- lib/freemius/includes/sdk/LICENSE.txt +340 -340
- lib/freemius/includes/sdk/index.php +2 -2
- lib/freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +43 -43
- lib/freemius/includes/supplements/fs-essential-functions-2.2.1.php +44 -44
- lib/freemius/includes/supplements/index.php +2 -2
- lib/freemius/index.php +2 -2
- lib/freemius/languages/index.php +2 -2
- lib/freemius/require.php +54 -54
- lib/freemius/templates/account/billing.php +422 -422
- lib/freemius/templates/account/index.php +2 -2
- lib/freemius/templates/account/partials/activate-license-button.php +53 -53
- lib/freemius/templates/account/partials/deactivate-license-button.php +35 -35
- lib/freemius/templates/account/partials/index.php +2 -2
- lib/freemius/templates/account/payments.php +58 -58
- lib/freemius/templates/add-trial-to-pricing.php +30 -30
- lib/freemius/templates/admin-notice.php +79 -79
- lib/freemius/templates/ajax-loader.php +6 -6
- lib/freemius/templates/auto-installation.php +249 -249
- lib/freemius/templates/checkout.php +336 -336
- lib/freemius/templates/clone-resolution-js.php +76 -76
- lib/freemius/templates/contact.php +127 -127
- lib/freemius/templates/debug/api-calls.php +154 -154
- lib/freemius/templates/debug/index.php +2 -2
- lib/freemius/templates/debug/logger.php +65 -65
- lib/freemius/templates/debug/plugins-themes-sync.php +76 -76
- lib/freemius/templates/debug/scheduled-crons.php +136 -136
- lib/freemius/templates/email.php +48 -48
- lib/freemius/templates/firewall-issues-js.php +63 -63
- lib/freemius/templates/forms/deactivation/contact.php +23 -23
- lib/freemius/templates/forms/deactivation/index.php +2 -2
- lib/freemius/templates/forms/deactivation/retry-skip.php +23 -23
- lib/freemius/templates/forms/index.php +2 -2
- lib/freemius/templates/forms/premium-versions-upgrade-handler.php +204 -204
- lib/freemius/templates/forms/premium-versions-upgrade-metadata.php +46 -46
- lib/freemius/templates/forms/subscription-cancellation.php +276 -276
- lib/freemius/templates/forms/trial-start.php +181 -181
- lib/freemius/templates/gdpr-optin-js.php +65 -65
- lib/freemius/templates/index.php +2 -2
- lib/freemius/templates/js/index.php +2 -2
- lib/freemius/templates/js/jquery.content-change.php +57 -57
- lib/freemius/templates/js/open-license-activation.php +36 -36
- lib/freemius/templates/js/style-premium-theme.php +52 -52
- lib/freemius/templates/partials/index.php +2 -2
- lib/freemius/templates/partials/network-activation.php +94 -94
- lib/freemius/templates/plugin-icon.php +19 -19
- lib/freemius/templates/plugin-info/description.php +77 -77
- lib/freemius/templates/plugin-info/features.php +113 -113
- lib/freemius/templates/plugin-info/index.php +2 -2
- lib/freemius/templates/plugin-info/screenshots.php +34 -34
- lib/freemius/templates/powered-by.php +61 -61
- lib/freemius/templates/secure-https-header.php +38 -38
- lib/freemius/templates/sticky-admin-notice-js.php +41 -41
- lib/freemius/templates/tabs-capture-js.php +62 -62
- lib/wp-content-aware-engine/assets/css/condition_groups.css +1 -1
- lib/wp-content-aware-engine/assets/js/condition_groups.min.js +1 -1
- lib/wp-content-aware-engine/bootstrap.php +6 -2
- lib/wp-content-aware-engine/module/base.php +12 -3
- lib/wp-content-aware-engine/module/bp_member.php +1 -1
- lib/wp-content-aware-engine/module/post_type.php +1 -0
- readme.txt +17 -30
admin/db-updates.php
CHANGED
@@ -17,7 +17,7 @@ $cas_db_updater->register_version_update('3.4', 'cas_update_to_34');
|
|
17 |
$cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
|
18 |
$cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
|
19 |
$cas_db_updater->register_version_update('3.15.2', 'cas_update_to_3152');
|
20 |
-
$cas_db_updater->register_version_update('3.
|
21 |
|
22 |
/**
|
23 |
* Enable legacy date module and
|
@@ -25,11 +25,11 @@ $cas_db_updater->register_version_update('3.17.1', 'cas_update_to_3171');
|
|
25 |
*
|
26 |
* Clear condition type cache
|
27 |
*
|
28 |
-
* @since 3.
|
29 |
*
|
30 |
* @return bool
|
31 |
*/
|
32 |
-
function
|
33 |
{
|
34 |
update_option('_ca_condition_type_cache', []);
|
35 |
|
17 |
$cas_db_updater->register_version_update('3.5.1', 'cas_update_to_351');
|
18 |
$cas_db_updater->register_version_update('3.8', 'cas_update_to_38');
|
19 |
$cas_db_updater->register_version_update('3.15.2', 'cas_update_to_3152');
|
20 |
+
$cas_db_updater->register_version_update('3.18', 'cas_update_to_318');
|
21 |
|
22 |
/**
|
23 |
* Enable legacy date module and
|
25 |
*
|
26 |
* Clear condition type cache
|
27 |
*
|
28 |
+
* @since 3.18
|
29 |
*
|
30 |
* @return bool
|
31 |
*/
|
32 |
+
function cas_update_to_318()
|
33 |
{
|
34 |
update_option('_ca_condition_type_cache', []);
|
35 |
|
app.php
CHANGED
@@ -11,7 +11,7 @@ defined('ABSPATH') || exit;
|
|
11 |
final class CAS_App
|
12 |
{
|
13 |
const PLUGIN_VERSION_KEY = 'cas_db_version';
|
14 |
-
const PLUGIN_VERSION = '3.
|
15 |
|
16 |
/**
|
17 |
* Prefix for sidebar id
|
11 |
final class CAS_App
|
12 |
{
|
13 |
const PLUGIN_VERSION_KEY = 'cas_db_version';
|
14 |
+
const PLUGIN_VERSION = '3.18';
|
15 |
|
16 |
/**
|
17 |
* Prefix for sidebar id
|
assets/js/cas_admin.min.js
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
*/
|
7 |
-
!function($){"use strict";var e={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.suggestTarget(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=-1===CASAdmin.timeFormat.toLowerCase().indexOf("a"),i=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||a.config.minDate)&&a.set("minDate",e?new Date(t):null),e?s.prop("checked",!1):s.is(":checked")||a.clear()}}),a=flatpickr(".js-cas-expiry",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||i.config.maxDate)&&i.set("maxDate",e?new Date(t):null)}}),s=$(".js-cas-status");s.on("change",function(t){$(this).is(":checked")?i.clear():i.selectedDates.length||a.clear()})},initTabSections:function(){$(".js-cas-tabs").find(".nav-tab").each(function(){var t=this.href.lastIndexOf("#");0<=t&&(t=this.href.substr(t),e.sections.push(t),$(t).hide())})},tabController:function(){this.initTabSections(),this.setCurrentSection(window.location.hash),$("#poststuff").on("click",".js-nav-link",function(t){e.setCurrentSection(this.href)})},findSectionByURL:function(t){t=this.sections.indexOf(t.substring(t.lastIndexOf("#")));return 0<=t?t:null},setCurrentSection:function(t){var e=this.findSectionByURL(t)||0,t=$(".js-cas-tabs").find(".nav-tab");t.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),t.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),t.eq(this.current_section).addClass("nav-tab-active"),$("#_cas_section").val("#top"+this.sections[this.current_section]))},actionOptionHandler:function(){var t=$("
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
*/
|
7 |
+
!function($){"use strict";var e={current_section:0,sections:[],init:function(){this.tabController(),this.actionOptionHandler(),this.suggestVisibility(),this.suggestTarget(),this.initSidebarActivation(),$(".js-cas-color-field").wpColorPicker(),$(".js-cas-html").on("change",function(t){var e=$(this);$(e.data("target")).attr("disabled",!e.is(":checked"))}).trigger("change")},initSidebarActivation:function(){flatpickr.l10ns.default.weekdays=CASAdmin.weekdays,flatpickr.l10ns.default.months=CASAdmin.months,flatpickr.l10ns.default.firstDayOfWeek=CASAdmin.weekStart;var t=-1===CASAdmin.timeFormat.toLowerCase().indexOf("a"),i=flatpickr(".js-cas-activation",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||a.config.minDate)&&a.set("minDate",e?new Date(t):null),e?s.prop("checked",!1):s.is(":checked")||a.clear()}}),a=flatpickr(".js-cas-expiry",{wrap:!0,clickOpens:!0,enableTime:!0,time_24hr:t,allowInput:!0,enableSeconds:!0,onChange:function(t,e,n){(e||i.config.maxDate)&&i.set("maxDate",e?new Date(t):null)}}),s=$(".js-cas-status");s.on("change",function(t){$(this).is(":checked")?i.clear():i.selectedDates.length||a.clear()})},initTabSections:function(){$(".js-cas-tabs").find(".nav-tab").each(function(){var t=this.href.lastIndexOf("#");0<=t&&(t=this.href.substr(t),e.sections.push(t),$(t).hide())})},tabController:function(){this.initTabSections(),this.setCurrentSection(window.location.hash),$("#poststuff").on("click",".js-nav-link",function(t){e.setCurrentSection(this.href)})},findSectionByURL:function(t){t=this.sections.indexOf(t.substring(t.lastIndexOf("#")));return 0<=t?t:null},setCurrentSection:function(t){var e=this.findSectionByURL(t)||0,t=$(".js-cas-tabs").find(".nav-tab");t.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),t.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),t.eq(this.current_section).addClass("nav-tab-active"),$("#_cas_section").val("#top"+this.sections[this.current_section]))},actionOptionHandler:function(){var t=$(".cas-metabox-holder"),e=t.find(".js-cas-action");t.on("change",".js-cas-handle",function(){var t=$(this),t=e.filter(".js-cas-action-"+t.val());e.not(t).hide().find("input,select").attr("disabled",!0),t.fadeIn("fast").find("input,select").attr("disabled",!1)}),t.find(".js-cas-handle").trigger("change")},suggestVisibility:function(){var e=$(".js-cas-visibility");e.select2({theme:"wpca",placeholder:CASAdmin.allVisibility,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,nextSearchTerm:function(t,e){return e},data:CASAdmin.visibility}).on("select2:selecting",function(t){e.data("forceOpen",!0)}).on("select2:close",function(t){e.data("forceOpen")&&(t.preventDefault(),e.select2("open"),e.data("forceOpen",!1))}),e.data("value")&&e.val(e.data("value").toString().split(",")).trigger("change")},suggestTarget:function(){var e=$(".js-cas-host");e.select2({theme:"wpca",minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"250px",nextSearchTerm:function(t,e){return e},data:CASAdmin.target}).on("select2:selecting",function(t){e.data("forceOpen",!0)}).on("select2:close",function(t){e.data("forceOpen")&&(t.preventDefault(),e.select2("open"),e.data("forceOpen",!1))}),e.data("value")&&e.val(e.data("value").toString().split(",")).trigger("change")}};$(document).ready(function(){e.init()})}(jQuery);
|
changelog.txt
CHANGED
@@ -1,3 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 3.15.2 =
|
2 |
|
3 |
* [new] performance improvements
|
1 |
+
|
2 |
+
= 3.16.2 =
|
3 |
+
|
4 |
+
* [fixed] compatibility improvements
|
5 |
+
* [updated] wp-content-aware-engine library
|
6 |
+
* [updated] freemius sdk
|
7 |
+
|
8 |
+
= 3.16.1 =
|
9 |
+
|
10 |
+
* [fixed] warning on admin dashboard
|
11 |
+
|
12 |
+
= 3.16 =
|
13 |
+
|
14 |
+
* [new] enable condition type cache in toolbar menu
|
15 |
+
* [new] performance improvements
|
16 |
+
* [new] taxonomy condition added to cache system (all condition types supported now)
|
17 |
+
* [new] wordpress 5.8 support
|
18 |
+
* [new] minimum wordpress version 5.0
|
19 |
+
* [fixed] multiple taxonomy conditions now use AND properly on singular pages (long-standing bug)
|
20 |
+
* [updated] wp-content-aware-engine library
|
21 |
+
|
22 |
+
**Pro Plan:**
|
23 |
+
|
24 |
+
* [new] totem - display widgets in floating button
|
25 |
+
* [new] option to display container widget only if conditions are met
|
26 |
+
* [new] sticky support for ajax powered themes such as woodmart
|
27 |
+
|
28 |
= 3.15.2 =
|
29 |
|
30 |
* [new] performance improvements
|
content-aware-sidebars.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* Plugin Name: Content Aware Sidebars
|
9 |
* Plugin URI: https://dev.institute/wordpress-sidebars/
|
10 |
* Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
|
11 |
-
* Version: 3.
|
12 |
* Author: Joachim Jensen - DEV Institute
|
13 |
* Author URI: https://dev.institute
|
14 |
* Requires at least: 5.0
|
8 |
* Plugin Name: Content Aware Sidebars
|
9 |
* Plugin URI: https://dev.institute/wordpress-sidebars/
|
10 |
* Description: Unlimited custom sidebars and widget areas for any post, page, category etc.
|
11 |
+
* Version: 3.18
|
12 |
* Author: Joachim Jensen - DEV Institute
|
13 |
* Author URI: https://dev.institute
|
14 |
* Requires at least: 5.0
|
lib/freemius/LICENSE.txt
CHANGED
@@ -1,674 +1,674 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 3, 29 June 2007
|
3 |
-
|
4 |
-
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
-
Everyone is permitted to copy and distribute verbatim copies
|
6 |
-
of this license document, but changing it is not allowed.
|
7 |
-
|
8 |
-
Preamble
|
9 |
-
|
10 |
-
The GNU General Public License is a free, copyleft license for
|
11 |
-
software and other kinds of works.
|
12 |
-
|
13 |
-
The licenses for most software and other practical works are designed
|
14 |
-
to take away your freedom to share and change the works. By contrast,
|
15 |
-
the GNU General Public License is intended to guarantee your freedom to
|
16 |
-
share and change all versions of a program--to make sure it remains free
|
17 |
-
software for all its users. We, the Free Software Foundation, use the
|
18 |
-
GNU General Public License for most of our software; it applies also to
|
19 |
-
any other work released this way by its authors. You can apply it to
|
20 |
-
your programs, too.
|
21 |
-
|
22 |
-
When we speak of free software, we are referring to freedom, not
|
23 |
-
price. Our General Public Licenses are designed to make sure that you
|
24 |
-
have the freedom to distribute copies of free software (and charge for
|
25 |
-
them if you wish), that you receive source code or can get it if you
|
26 |
-
want it, that you can change the software or use pieces of it in new
|
27 |
-
free programs, and that you know you can do these things.
|
28 |
-
|
29 |
-
To protect your rights, we need to prevent others from denying you
|
30 |
-
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
-
certain responsibilities if you distribute copies of the software, or if
|
32 |
-
you modify it: responsibilities to respect the freedom of others.
|
33 |
-
|
34 |
-
For example, if you distribute copies of such a program, whether
|
35 |
-
gratis or for a fee, you must pass on to the recipients the same
|
36 |
-
freedoms that you received. You must make sure that they, too, receive
|
37 |
-
or can get the source code. And you must show them these terms so they
|
38 |
-
know their rights.
|
39 |
-
|
40 |
-
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
-
(1) assert copyright on the software, and (2) offer you this License
|
42 |
-
giving you legal permission to copy, distribute and/or modify it.
|
43 |
-
|
44 |
-
For the developers' and authors' protection, the GPL clearly explains
|
45 |
-
that there is no warranty for this free software. For both users' and
|
46 |
-
authors' sake, the GPL requires that modified versions be marked as
|
47 |
-
changed, so that their problems will not be attributed erroneously to
|
48 |
-
authors of previous versions.
|
49 |
-
|
50 |
-
Some devices are designed to deny users access to install or run
|
51 |
-
modified versions of the software inside them, although the manufacturer
|
52 |
-
can do so. This is fundamentally incompatible with the aim of
|
53 |
-
protecting users' freedom to change the software. The systematic
|
54 |
-
pattern of such abuse occurs in the area of products for individuals to
|
55 |
-
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
-
have designed this version of the GPL to prohibit the practice for those
|
57 |
-
products. If such problems arise substantially in other domains, we
|
58 |
-
stand ready to extend this provision to those domains in future versions
|
59 |
-
of the GPL, as needed to protect the freedom of users.
|
60 |
-
|
61 |
-
Finally, every program is threatened constantly by software patents.
|
62 |
-
States should not allow patents to restrict development and use of
|
63 |
-
software on general-purpose computers, but in those that do, we wish to
|
64 |
-
avoid the special danger that patents applied to a free program could
|
65 |
-
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
-
patents cannot be used to render the program non-free.
|
67 |
-
|
68 |
-
The precise terms and conditions for copying, distribution and
|
69 |
-
modification follow.
|
70 |
-
|
71 |
-
TERMS AND CONDITIONS
|
72 |
-
|
73 |
-
0. Definitions.
|
74 |
-
|
75 |
-
"This License" refers to version 3 of the GNU General Public License.
|
76 |
-
|
77 |
-
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
-
works, such as semiconductor masks.
|
79 |
-
|
80 |
-
"The Program" refers to any copyrightable work licensed under this
|
81 |
-
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
-
"recipients" may be individuals or organizations.
|
83 |
-
|
84 |
-
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
-
in a fashion requiring copyright permission, other than the making of an
|
86 |
-
exact copy. The resulting work is called a "modified version" of the
|
87 |
-
earlier work or a work "based on" the earlier work.
|
88 |
-
|
89 |
-
A "covered work" means either the unmodified Program or a work based
|
90 |
-
on the Program.
|
91 |
-
|
92 |
-
To "propagate" a work means to do anything with it that, without
|
93 |
-
permission, would make you directly or secondarily liable for
|
94 |
-
infringement under applicable copyright law, except executing it on a
|
95 |
-
computer or modifying a private copy. Propagation includes copying,
|
96 |
-
distribution (with or without modification), making available to the
|
97 |
-
public, and in some countries other activities as well.
|
98 |
-
|
99 |
-
To "convey" a work means any kind of propagation that enables other
|
100 |
-
parties to make or receive copies. Mere interaction with a user through
|
101 |
-
a computer network, with no transfer of a copy, is not conveying.
|
102 |
-
|
103 |
-
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
-
to the extent that it includes a convenient and prominently visible
|
105 |
-
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
-
tells the user that there is no warranty for the work (except to the
|
107 |
-
extent that warranties are provided), that licensees may convey the
|
108 |
-
work under this License, and how to view a copy of this License. If
|
109 |
-
the interface presents a list of user commands or options, such as a
|
110 |
-
menu, a prominent item in the list meets this criterion.
|
111 |
-
|
112 |
-
1. Source Code.
|
113 |
-
|
114 |
-
The "source code" for a work means the preferred form of the work
|
115 |
-
for making modifications to it. "Object code" means any non-source
|
116 |
-
form of a work.
|
117 |
-
|
118 |
-
A "Standard Interface" means an interface that either is an official
|
119 |
-
standard defined by a recognized standards body, or, in the case of
|
120 |
-
interfaces specified for a particular programming language, one that
|
121 |
-
is widely used among developers working in that language.
|
122 |
-
|
123 |
-
The "System Libraries" of an executable work include anything, other
|
124 |
-
than the work as a whole, that (a) is included in the normal form of
|
125 |
-
packaging a Major Component, but which is not part of that Major
|
126 |
-
Component, and (b) serves only to enable use of the work with that
|
127 |
-
Major Component, or to implement a Standard Interface for which an
|
128 |
-
implementation is available to the public in source code form. A
|
129 |
-
"Major Component", in this context, means a major essential component
|
130 |
-
(kernel, window system, and so on) of the specific operating system
|
131 |
-
(if any) on which the executable work runs, or a compiler used to
|
132 |
-
produce the work, or an object code interpreter used to run it.
|
133 |
-
|
134 |
-
The "Corresponding Source" for a work in object code form means all
|
135 |
-
the source code needed to generate, install, and (for an executable
|
136 |
-
work) run the object code and to modify the work, including scripts to
|
137 |
-
control those activities. However, it does not include the work's
|
138 |
-
System Libraries, or general-purpose tools or generally available free
|
139 |
-
programs which are used unmodified in performing those activities but
|
140 |
-
which are not part of the work. For example, Corresponding Source
|
141 |
-
includes interface definition files associated with source files for
|
142 |
-
the work, and the source code for shared libraries and dynamically
|
143 |
-
linked subprograms that the work is specifically designed to require,
|
144 |
-
such as by intimate data communication or control flow between those
|
145 |
-
subprograms and other parts of the work.
|
146 |
-
|
147 |
-
The Corresponding Source need not include anything that users
|
148 |
-
can regenerate automatically from other parts of the Corresponding
|
149 |
-
Source.
|
150 |
-
|
151 |
-
The Corresponding Source for a work in source code form is that
|
152 |
-
same work.
|
153 |
-
|
154 |
-
2. Basic Permissions.
|
155 |
-
|
156 |
-
All rights granted under this License are granted for the term of
|
157 |
-
copyright on the Program, and are irrevocable provided the stated
|
158 |
-
conditions are met. This License explicitly affirms your unlimited
|
159 |
-
permission to run the unmodified Program. The output from running a
|
160 |
-
covered work is covered by this License only if the output, given its
|
161 |
-
content, constitutes a covered work. This License acknowledges your
|
162 |
-
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
-
|
164 |
-
You may make, run and propagate covered works that you do not
|
165 |
-
convey, without conditions so long as your license otherwise remains
|
166 |
-
in force. You may convey covered works to others for the sole purpose
|
167 |
-
of having them make modifications exclusively for you, or provide you
|
168 |
-
with facilities for running those works, provided that you comply with
|
169 |
-
the terms of this License in conveying all material for which you do
|
170 |
-
not control copyright. Those thus making or running the covered works
|
171 |
-
for you must do so exclusively on your behalf, under your direction
|
172 |
-
and control, on terms that prohibit them from making any copies of
|
173 |
-
your copyrighted material outside their relationship with you.
|
174 |
-
|
175 |
-
Conveying under any other circumstances is permitted solely under
|
176 |
-
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
-
makes it unnecessary.
|
178 |
-
|
179 |
-
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
-
|
181 |
-
No covered work shall be deemed part of an effective technological
|
182 |
-
measure under any applicable law fulfilling obligations under article
|
183 |
-
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
-
similar laws prohibiting or restricting circumvention of such
|
185 |
-
measures.
|
186 |
-
|
187 |
-
When you convey a covered work, you waive any legal power to forbid
|
188 |
-
circumvention of technological measures to the extent such circumvention
|
189 |
-
is effected by exercising rights under this License with respect to
|
190 |
-
the covered work, and you disclaim any intention to limit operation or
|
191 |
-
modification of the work as a means of enforcing, against the work's
|
192 |
-
users, your or third parties' legal rights to forbid circumvention of
|
193 |
-
technological measures.
|
194 |
-
|
195 |
-
4. Conveying Verbatim Copies.
|
196 |
-
|
197 |
-
You may convey verbatim copies of the Program's source code as you
|
198 |
-
receive it, in any medium, provided that you conspicuously and
|
199 |
-
appropriately publish on each copy an appropriate copyright notice;
|
200 |
-
keep intact all notices stating that this License and any
|
201 |
-
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
-
keep intact all notices of the absence of any warranty; and give all
|
203 |
-
recipients a copy of this License along with the Program.
|
204 |
-
|
205 |
-
You may charge any price or no price for each copy that you convey,
|
206 |
-
and you may offer support or warranty protection for a fee.
|
207 |
-
|
208 |
-
5. Conveying Modified Source Versions.
|
209 |
-
|
210 |
-
You may convey a work based on the Program, or the modifications to
|
211 |
-
produce it from the Program, in the form of source code under the
|
212 |
-
terms of section 4, provided that you also meet all of these conditions:
|
213 |
-
|
214 |
-
a) The work must carry prominent notices stating that you modified
|
215 |
-
it, and giving a relevant date.
|
216 |
-
|
217 |
-
b) The work must carry prominent notices stating that it is
|
218 |
-
released under this License and any conditions added under section
|
219 |
-
7. This requirement modifies the requirement in section 4 to
|
220 |
-
"keep intact all notices".
|
221 |
-
|
222 |
-
c) You must license the entire work, as a whole, under this
|
223 |
-
License to anyone who comes into possession of a copy. This
|
224 |
-
License will therefore apply, along with any applicable section 7
|
225 |
-
additional terms, to the whole of the work, and all its parts,
|
226 |
-
regardless of how they are packaged. This License gives no
|
227 |
-
permission to license the work in any other way, but it does not
|
228 |
-
invalidate such permission if you have separately received it.
|
229 |
-
|
230 |
-
d) If the work has interactive user interfaces, each must display
|
231 |
-
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
-
interfaces that do not display Appropriate Legal Notices, your
|
233 |
-
work need not make them do so.
|
234 |
-
|
235 |
-
A compilation of a covered work with other separate and independent
|
236 |
-
works, which are not by their nature extensions of the covered work,
|
237 |
-
and which are not combined with it such as to form a larger program,
|
238 |
-
in or on a volume of a storage or distribution medium, is called an
|
239 |
-
"aggregate" if the compilation and its resulting copyright are not
|
240 |
-
used to limit the access or legal rights of the compilation's users
|
241 |
-
beyond what the individual works permit. Inclusion of a covered work
|
242 |
-
in an aggregate does not cause this License to apply to the other
|
243 |
-
parts of the aggregate.
|
244 |
-
|
245 |
-
6. Conveying Non-Source Forms.
|
246 |
-
|
247 |
-
You may convey a covered work in object code form under the terms
|
248 |
-
of sections 4 and 5, provided that you also convey the
|
249 |
-
machine-readable Corresponding Source under the terms of this License,
|
250 |
-
in one of these ways:
|
251 |
-
|
252 |
-
a) Convey the object code in, or embodied in, a physical product
|
253 |
-
(including a physical distribution medium), accompanied by the
|
254 |
-
Corresponding Source fixed on a durable physical medium
|
255 |
-
customarily used for software interchange.
|
256 |
-
|
257 |
-
b) Convey the object code in, or embodied in, a physical product
|
258 |
-
(including a physical distribution medium), accompanied by a
|
259 |
-
written offer, valid for at least three years and valid for as
|
260 |
-
long as you offer spare parts or customer support for that product
|
261 |
-
model, to give anyone who possesses the object code either (1) a
|
262 |
-
copy of the Corresponding Source for all the software in the
|
263 |
-
product that is covered by this License, on a durable physical
|
264 |
-
medium customarily used for software interchange, for a price no
|
265 |
-
more than your reasonable cost of physically performing this
|
266 |
-
conveying of source, or (2) access to copy the
|
267 |
-
Corresponding Source from a network server at no charge.
|
268 |
-
|
269 |
-
c) Convey individual copies of the object code with a copy of the
|
270 |
-
written offer to provide the Corresponding Source. This
|
271 |
-
alternative is allowed only occasionally and noncommercially, and
|
272 |
-
only if you received the object code with such an offer, in accord
|
273 |
-
with subsection 6b.
|
274 |
-
|
275 |
-
d) Convey the object code by offering access from a designated
|
276 |
-
place (gratis or for a charge), and offer equivalent access to the
|
277 |
-
Corresponding Source in the same way through the same place at no
|
278 |
-
further charge. You need not require recipients to copy the
|
279 |
-
Corresponding Source along with the object code. If the place to
|
280 |
-
copy the object code is a network server, the Corresponding Source
|
281 |
-
may be on a different server (operated by you or a third party)
|
282 |
-
that supports equivalent copying facilities, provided you maintain
|
283 |
-
clear directions next to the object code saying where to find the
|
284 |
-
Corresponding Source. Regardless of what server hosts the
|
285 |
-
Corresponding Source, you remain obligated to ensure that it is
|
286 |
-
available for as long as needed to satisfy these requirements.
|
287 |
-
|
288 |
-
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
-
you inform other peers where the object code and Corresponding
|
290 |
-
Source of the work are being offered to the general public at no
|
291 |
-
charge under subsection 6d.
|
292 |
-
|
293 |
-
A separable portion of the object code, whose source code is excluded
|
294 |
-
from the Corresponding Source as a System Library, need not be
|
295 |
-
included in conveying the object code work.
|
296 |
-
|
297 |
-
A "User Product" is either (1) a "consumer product", which means any
|
298 |
-
tangible personal property which is normally used for personal, family,
|
299 |
-
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
-
into a dwelling. In determining whether a product is a consumer product,
|
301 |
-
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
-
product received by a particular user, "normally used" refers to a
|
303 |
-
typical or common use of that class of product, regardless of the status
|
304 |
-
of the particular user or of the way in which the particular user
|
305 |
-
actually uses, or expects or is expected to use, the product. A product
|
306 |
-
is a consumer product regardless of whether the product has substantial
|
307 |
-
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
-
the only significant mode of use of the product.
|
309 |
-
|
310 |
-
"Installation Information" for a User Product means any methods,
|
311 |
-
procedures, authorization keys, or other information required to install
|
312 |
-
and execute modified versions of a covered work in that User Product from
|
313 |
-
a modified version of its Corresponding Source. The information must
|
314 |
-
suffice to ensure that the continued functioning of the modified object
|
315 |
-
code is in no case prevented or interfered with solely because
|
316 |
-
modification has been made.
|
317 |
-
|
318 |
-
If you convey an object code work under this section in, or with, or
|
319 |
-
specifically for use in, a User Product, and the conveying occurs as
|
320 |
-
part of a transaction in which the right of possession and use of the
|
321 |
-
User Product is transferred to the recipient in perpetuity or for a
|
322 |
-
fixed term (regardless of how the transaction is characterized), the
|
323 |
-
Corresponding Source conveyed under this section must be accompanied
|
324 |
-
by the Installation Information. But this requirement does not apply
|
325 |
-
if neither you nor any third party retains the ability to install
|
326 |
-
modified object code on the User Product (for example, the work has
|
327 |
-
been installed in ROM).
|
328 |
-
|
329 |
-
The requirement to provide Installation Information does not include a
|
330 |
-
requirement to continue to provide support service, warranty, or updates
|
331 |
-
for a work that has been modified or installed by the recipient, or for
|
332 |
-
the User Product in which it has been modified or installed. Access to a
|
333 |
-
network may be denied when the modification itself materially and
|
334 |
-
adversely affects the operation of the network or violates the rules and
|
335 |
-
protocols for communication across the network.
|
336 |
-
|
337 |
-
Corresponding Source conveyed, and Installation Information provided,
|
338 |
-
in accord with this section must be in a format that is publicly
|
339 |
-
documented (and with an implementation available to the public in
|
340 |
-
source code form), and must require no special password or key for
|
341 |
-
unpacking, reading or copying.
|
342 |
-
|
343 |
-
7. Additional Terms.
|
344 |
-
|
345 |
-
"Additional permissions" are terms that supplement the terms of this
|
346 |
-
License by making exceptions from one or more of its conditions.
|
347 |
-
Additional permissions that are applicable to the entire Program shall
|
348 |
-
be treated as though they were included in this License, to the extent
|
349 |
-
that they are valid under applicable law. If additional permissions
|
350 |
-
apply only to part of the Program, that part may be used separately
|
351 |
-
under those permissions, but the entire Program remains governed by
|
352 |
-
this License without regard to the additional permissions.
|
353 |
-
|
354 |
-
When you convey a copy of a covered work, you may at your option
|
355 |
-
remove any additional permissions from that copy, or from any part of
|
356 |
-
it. (Additional permissions may be written to require their own
|
357 |
-
removal in certain cases when you modify the work.) You may place
|
358 |
-
additional permissions on material, added by you to a covered work,
|
359 |
-
for which you have or can give appropriate copyright permission.
|
360 |
-
|
361 |
-
Notwithstanding any other provision of this License, for material you
|
362 |
-
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
-
that material) supplement the terms of this License with terms:
|
364 |
-
|
365 |
-
a) Disclaiming warranty or limiting liability differently from the
|
366 |
-
terms of sections 15 and 16 of this License; or
|
367 |
-
|
368 |
-
b) Requiring preservation of specified reasonable legal notices or
|
369 |
-
author attributions in that material or in the Appropriate Legal
|
370 |
-
Notices displayed by works containing it; or
|
371 |
-
|
372 |
-
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
-
requiring that modified versions of such material be marked in
|
374 |
-
reasonable ways as different from the original version; or
|
375 |
-
|
376 |
-
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
-
authors of the material; or
|
378 |
-
|
379 |
-
e) Declining to grant rights under trademark law for use of some
|
380 |
-
trade names, trademarks, or service marks; or
|
381 |
-
|
382 |
-
f) Requiring indemnification of licensors and authors of that
|
383 |
-
material by anyone who conveys the material (or modified versions of
|
384 |
-
it) with contractual assumptions of liability to the recipient, for
|
385 |
-
any liability that these contractual assumptions directly impose on
|
386 |
-
those licensors and authors.
|
387 |
-
|
388 |
-
All other non-permissive additional terms are considered "further
|
389 |
-
restrictions" within the meaning of section 10. If the Program as you
|
390 |
-
received it, or any part of it, contains a notice stating that it is
|
391 |
-
governed by this License along with a term that is a further
|
392 |
-
restriction, you may remove that term. If a license document contains
|
393 |
-
a further restriction but permits relicensing or conveying under this
|
394 |
-
License, you may add to a covered work material governed by the terms
|
395 |
-
of that license document, provided that the further restriction does
|
396 |
-
not survive such relicensing or conveying.
|
397 |
-
|
398 |
-
If you add terms to a covered work in accord with this section, you
|
399 |
-
must place, in the relevant source files, a statement of the
|
400 |
-
additional terms that apply to those files, or a notice indicating
|
401 |
-
where to find the applicable terms.
|
402 |
-
|
403 |
-
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
-
form of a separately written license, or stated as exceptions;
|
405 |
-
the above requirements apply either way.
|
406 |
-
|
407 |
-
8. Termination.
|
408 |
-
|
409 |
-
You may not propagate or modify a covered work except as expressly
|
410 |
-
provided under this License. Any attempt otherwise to propagate or
|
411 |
-
modify it is void, and will automatically terminate your rights under
|
412 |
-
this License (including any patent licenses granted under the third
|
413 |
-
paragraph of section 11).
|
414 |
-
|
415 |
-
However, if you cease all violation of this License, then your
|
416 |
-
license from a particular copyright holder is reinstated (a)
|
417 |
-
provisionally, unless and until the copyright holder explicitly and
|
418 |
-
finally terminates your license, and (b) permanently, if the copyright
|
419 |
-
holder fails to notify you of the violation by some reasonable means
|
420 |
-
prior to 60 days after the cessation.
|
421 |
-
|
422 |
-
Moreover, your license from a particular copyright holder is
|
423 |
-
reinstated permanently if the copyright holder notifies you of the
|
424 |
-
violation by some reasonable means, this is the first time you have
|
425 |
-
received notice of violation of this License (for any work) from that
|
426 |
-
copyright holder, and you cure the violation prior to 30 days after
|
427 |
-
your receipt of the notice.
|
428 |
-
|
429 |
-
Termination of your rights under this section does not terminate the
|
430 |
-
licenses of parties who have received copies or rights from you under
|
431 |
-
this License. If your rights have been terminated and not permanently
|
432 |
-
reinstated, you do not qualify to receive new licenses for the same
|
433 |
-
material under section 10.
|
434 |
-
|
435 |
-
9. Acceptance Not Required for Having Copies.
|
436 |
-
|
437 |
-
You are not required to accept this License in order to receive or
|
438 |
-
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
-
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
-
to receive a copy likewise does not require acceptance. However,
|
441 |
-
nothing other than this License grants you permission to propagate or
|
442 |
-
modify any covered work. These actions infringe copyright if you do
|
443 |
-
not accept this License. Therefore, by modifying or propagating a
|
444 |
-
covered work, you indicate your acceptance of this License to do so.
|
445 |
-
|
446 |
-
10. Automatic Licensing of Downstream Recipients.
|
447 |
-
|
448 |
-
Each time you convey a covered work, the recipient automatically
|
449 |
-
receives a license from the original licensors, to run, modify and
|
450 |
-
propagate that work, subject to this License. You are not responsible
|
451 |
-
for enforcing compliance by third parties with this License.
|
452 |
-
|
453 |
-
An "entity transaction" is a transaction transferring control of an
|
454 |
-
organization, or substantially all assets of one, or subdividing an
|
455 |
-
organization, or merging organizations. If propagation of a covered
|
456 |
-
work results from an entity transaction, each party to that
|
457 |
-
transaction who receives a copy of the work also receives whatever
|
458 |
-
licenses to the work the party's predecessor in interest had or could
|
459 |
-
give under the previous paragraph, plus a right to possession of the
|
460 |
-
Corresponding Source of the work from the predecessor in interest, if
|
461 |
-
the predecessor has it or can get it with reasonable efforts.
|
462 |
-
|
463 |
-
You may not impose any further restrictions on the exercise of the
|
464 |
-
rights granted or affirmed under this License. For example, you may
|
465 |
-
not impose a license fee, royalty, or other charge for exercise of
|
466 |
-
rights granted under this License, and you may not initiate litigation
|
467 |
-
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
-
any patent claim is infringed by making, using, selling, offering for
|
469 |
-
sale, or importing the Program or any portion of it.
|
470 |
-
|
471 |
-
11. Patents.
|
472 |
-
|
473 |
-
A "contributor" is a copyright holder who authorizes use under this
|
474 |
-
License of the Program or a work on which the Program is based. The
|
475 |
-
work thus licensed is called the contributor's "contributor version".
|
476 |
-
|
477 |
-
A contributor's "essential patent claims" are all patent claims
|
478 |
-
owned or controlled by the contributor, whether already acquired or
|
479 |
-
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
-
by this License, of making, using, or selling its contributor version,
|
481 |
-
but do not include claims that would be infringed only as a
|
482 |
-
consequence of further modification of the contributor version. For
|
483 |
-
purposes of this definition, "control" includes the right to grant
|
484 |
-
patent sublicenses in a manner consistent with the requirements of
|
485 |
-
this License.
|
486 |
-
|
487 |
-
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
-
patent license under the contributor's essential patent claims, to
|
489 |
-
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
-
propagate the contents of its contributor version.
|
491 |
-
|
492 |
-
In the following three paragraphs, a "patent license" is any express
|
493 |
-
agreement or commitment, however denominated, not to enforce a patent
|
494 |
-
(such as an express permission to practice a patent or covenant not to
|
495 |
-
sue for patent infringement). To "grant" such a patent license to a
|
496 |
-
party means to make such an agreement or commitment not to enforce a
|
497 |
-
patent against the party.
|
498 |
-
|
499 |
-
If you convey a covered work, knowingly relying on a patent license,
|
500 |
-
and the Corresponding Source of the work is not available for anyone
|
501 |
-
to copy, free of charge and under the terms of this License, through a
|
502 |
-
publicly available network server or other readily accessible means,
|
503 |
-
then you must either (1) cause the Corresponding Source to be so
|
504 |
-
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
-
patent license for this particular work, or (3) arrange, in a manner
|
506 |
-
consistent with the requirements of this License, to extend the patent
|
507 |
-
license to downstream recipients. "Knowingly relying" means you have
|
508 |
-
actual knowledge that, but for the patent license, your conveying the
|
509 |
-
covered work in a country, or your recipient's use of the covered work
|
510 |
-
in a country, would infringe one or more identifiable patents in that
|
511 |
-
country that you have reason to believe are valid.
|
512 |
-
|
513 |
-
If, pursuant to or in connection with a single transaction or
|
514 |
-
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
-
covered work, and grant a patent license to some of the parties
|
516 |
-
receiving the covered work authorizing them to use, propagate, modify
|
517 |
-
or convey a specific copy of the covered work, then the patent license
|
518 |
-
you grant is automatically extended to all recipients of the covered
|
519 |
-
work and works based on it.
|
520 |
-
|
521 |
-
A patent license is "discriminatory" if it does not include within
|
522 |
-
the scope of its coverage, prohibits the exercise of, or is
|
523 |
-
conditioned on the non-exercise of one or more of the rights that are
|
524 |
-
specifically granted under this License. You may not convey a covered
|
525 |
-
work if you are a party to an arrangement with a third party that is
|
526 |
-
in the business of distributing software, under which you make payment
|
527 |
-
to the third party based on the extent of your activity of conveying
|
528 |
-
the work, and under which the third party grants, to any of the
|
529 |
-
parties who would receive the covered work from you, a discriminatory
|
530 |
-
patent license (a) in connection with copies of the covered work
|
531 |
-
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
-
for and in connection with specific products or compilations that
|
533 |
-
contain the covered work, unless you entered into that arrangement,
|
534 |
-
or that patent license was granted, prior to 28 March 2007.
|
535 |
-
|
536 |
-
Nothing in this License shall be construed as excluding or limiting
|
537 |
-
any implied license or other defenses to infringement that may
|
538 |
-
otherwise be available to you under applicable patent law.
|
539 |
-
|
540 |
-
12. No Surrender of Others' Freedom.
|
541 |
-
|
542 |
-
If conditions are imposed on you (whether by court order, agreement or
|
543 |
-
otherwise) that contradict the conditions of this License, they do not
|
544 |
-
excuse you from the conditions of this License. If you cannot convey a
|
545 |
-
covered work so as to satisfy simultaneously your obligations under this
|
546 |
-
License and any other pertinent obligations, then as a consequence you may
|
547 |
-
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
-
to collect a royalty for further conveying from those to whom you convey
|
549 |
-
the Program, the only way you could satisfy both those terms and this
|
550 |
-
License would be to refrain entirely from conveying the Program.
|
551 |
-
|
552 |
-
13. Use with the GNU Affero General Public License.
|
553 |
-
|
554 |
-
Notwithstanding any other provision of this License, you have
|
555 |
-
permission to link or combine any covered work with a work licensed
|
556 |
-
under version 3 of the GNU Affero General Public License into a single
|
557 |
-
combined work, and to convey the resulting work. The terms of this
|
558 |
-
License will continue to apply to the part which is the covered work,
|
559 |
-
but the special requirements of the GNU Affero General Public License,
|
560 |
-
section 13, concerning interaction through a network will apply to the
|
561 |
-
combination as such.
|
562 |
-
|
563 |
-
14. Revised Versions of this License.
|
564 |
-
|
565 |
-
The Free Software Foundation may publish revised and/or new versions of
|
566 |
-
the GNU General Public License from time to time. Such new versions will
|
567 |
-
be similar in spirit to the present version, but may differ in detail to
|
568 |
-
address new problems or concerns.
|
569 |
-
|
570 |
-
Each version is given a distinguishing version number. If the
|
571 |
-
Program specifies that a certain numbered version of the GNU General
|
572 |
-
Public License "or any later version" applies to it, you have the
|
573 |
-
option of following the terms and conditions either of that numbered
|
574 |
-
version or of any later version published by the Free Software
|
575 |
-
Foundation. If the Program does not specify a version number of the
|
576 |
-
GNU General Public License, you may choose any version ever published
|
577 |
-
by the Free Software Foundation.
|
578 |
-
|
579 |
-
If the Program specifies that a proxy can decide which future
|
580 |
-
versions of the GNU General Public License can be used, that proxy's
|
581 |
-
public statement of acceptance of a version permanently authorizes you
|
582 |
-
to choose that version for the Program.
|
583 |
-
|
584 |
-
Later license versions may give you additional or different
|
585 |
-
permissions. However, no additional obligations are imposed on any
|
586 |
-
author or copyright holder as a result of your choosing to follow a
|
587 |
-
later version.
|
588 |
-
|
589 |
-
15. Disclaimer of Warranty.
|
590 |
-
|
591 |
-
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
-
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
-
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
-
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
-
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
-
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
-
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
-
|
600 |
-
16. Limitation of Liability.
|
601 |
-
|
602 |
-
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
-
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
-
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
-
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
-
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
-
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
-
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
-
SUCH DAMAGES.
|
611 |
-
|
612 |
-
17. Interpretation of Sections 15 and 16.
|
613 |
-
|
614 |
-
If the disclaimer of warranty and limitation of liability provided
|
615 |
-
above cannot be given local legal effect according to their terms,
|
616 |
-
reviewing courts shall apply local law that most closely approximates
|
617 |
-
an absolute waiver of all civil liability in connection with the
|
618 |
-
Program, unless a warranty or assumption of liability accompanies a
|
619 |
-
copy of the Program in return for a fee.
|
620 |
-
|
621 |
-
END OF TERMS AND CONDITIONS
|
622 |
-
|
623 |
-
How to Apply These Terms to Your New Programs
|
624 |
-
|
625 |
-
If you develop a new program, and you want it to be of the greatest
|
626 |
-
possible use to the public, the best way to achieve this is to make it
|
627 |
-
free software which everyone can redistribute and change under these terms.
|
628 |
-
|
629 |
-
To do so, attach the following notices to the program. It is safest
|
630 |
-
to attach them to the start of each source file to most effectively
|
631 |
-
state the exclusion of warranty; and each file should have at least
|
632 |
-
the "copyright" line and a pointer to where the full notice is found.
|
633 |
-
|
634 |
-
{one line to give the program's name and a brief idea of what it does.}
|
635 |
-
Copyright (C) {year} {name of author}
|
636 |
-
|
637 |
-
This program is free software: you can redistribute it and/or modify
|
638 |
-
it under the terms of the GNU General Public License as published by
|
639 |
-
the Free Software Foundation, either version 3 of the License, or
|
640 |
-
(at your option) any later version.
|
641 |
-
|
642 |
-
This program is distributed in the hope that it will be useful,
|
643 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
-
GNU General Public License for more details.
|
646 |
-
|
647 |
-
You should have received a copy of the GNU General Public License
|
648 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
-
|
650 |
-
Also add information on how to contact you by electronic and paper mail.
|
651 |
-
|
652 |
-
If the program does terminal interaction, make it output a short
|
653 |
-
notice like this when it starts in an interactive mode:
|
654 |
-
|
655 |
-
{project} Copyright (C) {year} {fullname}
|
656 |
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
-
This is free software, and you are welcome to redistribute it
|
658 |
-
under certain conditions; type `show c' for details.
|
659 |
-
|
660 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
-
parts of the General Public License. Of course, your program's commands
|
662 |
-
might be different; for a GUI interface, you would use an "about box".
|
663 |
-
|
664 |
-
You should also get your employer (if you work as a programmer) or school,
|
665 |
-
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
-
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
-
<http://www.gnu.org/licenses/>.
|
668 |
-
|
669 |
-
The GNU General Public License does not permit incorporating your program
|
670 |
-
into proprietary programs. If your program is a subroutine library, you
|
671 |
-
may consider it more useful to permit linking proprietary applications with
|
672 |
-
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
-
Public License instead of this License. But first, please read
|
674 |
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
{one line to give the program's name and a brief idea of what it does.}
|
635 |
+
Copyright (C) {year} {name of author}
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
{project} Copyright (C) {year} {fullname}
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
lib/freemius/assets/css/admin/account.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-notice[data-id=license_not_whitelabeled].success,.fs-notice[data-id=license_whitelabeled].success{color:inherit;border-left-color:#00a0d2}.fs-notice[data-id=license_not_whitelabeled].success label.fs-plugin-title,.fs-notice[data-id=license_whitelabeled].success label.fs-plugin-title{display:none}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #f1f1f1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type=text]{color:#0073aa;font-size:16px;background:none}.fs-key-value-table input[type=text]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:gray;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}@media screen and (max-width: 639px){#fs_account .fs-header-actions{position:static;padding:0 15px 12px 15px;margin:0 0 12px 0}#fs_account .fs-header-actions li{float:none;display:inline-block}#fs_account #fs_account_details{display:block}#fs_account #fs_account_details tbody,#fs_account #fs_account_details tr,#fs_account #fs_account_details td,#fs_account #fs_account_details th{display:block}#fs_account #fs_account_details tr td:first-child{text-align:left}#fs_account #fs_account_details tr td:nth-child(2){padding:0 12px}#fs_account #fs_account_details tr td:nth-child(2) code{margin:0;padding:0}#fs_account #fs_account_details tr td:nth-child(2) label{margin-left:0}#fs_account #fs_account_details tr td:nth-child(3){text-align:left}#fs_account #fs_account_details tr.fs-field-plan td:nth-child(2) .button-group{float:none;margin:12px 0}}/*# sourceMappingURL=account.css.map */
|
1 |
+
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-notice[data-id=license_not_whitelabeled].success,.fs-notice[data-id=license_whitelabeled].success{color:inherit;border-left-color:#00a0d2}.fs-notice[data-id=license_not_whitelabeled].success label.fs-plugin-title,.fs-notice[data-id=license_whitelabeled].success label.fs-plugin-title{display:none}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #f1f1f1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type=text]{color:#0073aa;font-size:16px;background:none}.fs-key-value-table input[type=text]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:gray;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}@media screen and (max-width: 639px){#fs_account .fs-header-actions{position:static;padding:0 15px 12px 15px;margin:0 0 12px 0}#fs_account .fs-header-actions li{float:none;display:inline-block}#fs_account #fs_account_details{display:block}#fs_account #fs_account_details tbody,#fs_account #fs_account_details tr,#fs_account #fs_account_details td,#fs_account #fs_account_details th{display:block}#fs_account #fs_account_details tr td:first-child{text-align:left}#fs_account #fs_account_details tr td:nth-child(2){padding:0 12px}#fs_account #fs_account_details tr td:nth-child(2) code{margin:0;padding:0}#fs_account #fs_account_details tr td:nth-child(2) label{margin-left:0}#fs_account #fs_account_details tr td:nth-child(3){text-align:left}#fs_account #fs_account_details tr.fs-field-plan td:nth-child(2) .button-group{float:none;margin:12px 0}}/*# sourceMappingURL=account.css.map */
|
lib/freemius/assets/css/admin/add-ons.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:#adff2f;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.3);box-shadow:1px 1px 1px rgba(0,0,0,.3);text-transform:uppercase;font-size:.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description iframe{max-width:100%}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:#adff2f;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid #006400;padding:2px;text-align:center;font-size:.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#f3f3f3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:#adff2f}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid #fff;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}/*# sourceMappingURL=add-ons.css.map */
|
1 |
+
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:#adff2f;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.3);box-shadow:1px 1px 1px rgba(0,0,0,.3);text-transform:uppercase;font-size:.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description iframe{max-width:100%}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:#adff2f;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid #006400;padding:2px;text-align:center;font-size:.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#f3f3f3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:#adff2f}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid #fff;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}/*# sourceMappingURL=add-ons.css.map */
|
lib/freemius/assets/css/admin/affiliation.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;padding:0;margin-left:0}#fs_affiliation_content_wrapper ul li{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:"✓";margin-right:10px;font-weight:bold}#fs_affiliation_content_wrapper p:not(.description),#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper label{font-size:16px !important;line-height:26px !important}#fs_affiliation_content_wrapper .button{margin-top:20px;margin-bottom:7px;line-height:35px;height:40px;font-size:16px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{font-weight:bold;display:block;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{text-decoration:none;display:inline-block;margin-top:3px}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0}/*# sourceMappingURL=affiliation.css.map */
|
1 |
+
#fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;padding:0;margin-left:0}#fs_affiliation_content_wrapper ul li{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:"✓";margin-right:10px;font-weight:bold}#fs_affiliation_content_wrapper p:not(.description),#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper label{font-size:16px !important;line-height:26px !important}#fs_affiliation_content_wrapper .button{margin-top:20px;margin-bottom:7px;line-height:35px;height:40px;font-size:16px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{font-weight:bold;display:block;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{text-decoration:none;display:inline-block;margin-top:3px}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0}/*# sourceMappingURL=affiliation.css.map */
|
lib/freemius/assets/css/admin/checkout.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}/*# sourceMappingURL=checkout.css.map */
|
1 |
+
@media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}/*# sourceMappingURL=checkout.css.map */
|
lib/freemius/assets/css/admin/clone-resolution.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-notice[data-id^=clone_resolution_options_notice]{padding:0;color:inherit !important}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-body{padding:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-header{padding:5px 10px}.fs-notice[data-id^=clone_resolution_options_notice] ol{margin-top:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{display:flex;flex-direction:row;padding:0 10px 10px}@media(max-width: 750px){.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{flex-direction:column}}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option{border:1px solid #ccc;padding:10px 10px 15px 10px;flex:auto;margin:5px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:first-child{margin-left:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:last-child{margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option strong{font-size:1.2em;padding:2px;line-height:1.5em}.fs-notice[data-id^=clone_resolution_options_notice] a{text-decoration:none}.fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:10px}.rtl .fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:0;margin-left:10px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-documentation-container{padding:0 10px 15px}.fs-notice[data-id=temporary_duplicate_notice] #fs_clone_resolution_error_message{border:1px solid #d3135a;background:#fee;color:#d3135a;padding:10px}.fs-notice[data-id=temporary_duplicate_notice] ol{margin-top:0}/*# sourceMappingURL=clone-resolution.css.map */
|
1 |
+
.fs-notice[data-id^=clone_resolution_options_notice]{padding:0;color:inherit !important}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-body{padding:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-header{padding:5px 10px}.fs-notice[data-id^=clone_resolution_options_notice] ol{margin-top:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{display:flex;flex-direction:row;padding:0 10px 10px}@media(max-width: 750px){.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{flex-direction:column}}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option{border:1px solid #ccc;padding:10px 10px 15px 10px;flex:auto;margin:5px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:first-child{margin-left:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:last-child{margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option strong{font-size:1.2em;padding:2px;line-height:1.5em}.fs-notice[data-id^=clone_resolution_options_notice] a{text-decoration:none}.fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:10px}.rtl .fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:0;margin-left:10px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-documentation-container{padding:0 10px 15px}.fs-notice[data-id=temporary_duplicate_notice] #fs_clone_resolution_error_message{border:1px solid #d3135a;background:#fee;color:#d3135a;padding:10px}.fs-notice[data-id=temporary_duplicate_notice] ol{margin-top:0}/*# sourceMappingURL=clone-resolution.css.map */
|
lib/freemius/assets/css/admin/common.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,.1),inset 0 1px 3px 0 rgba(0,0,0,.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,.5);z-index:999;-moz-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}.fs-switch-feedback{margin-left:10px}.fs-switch-feedback.success{color:#71ae00}.rtl .fs-switch-feedback{margin-left:0;margin-right:10px}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media(max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}.fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,.3);box-shadow:0 2px 2px rgba(6,113,6,.3);opacity:.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width: 1250px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:"↳";padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:"↲"}.fs-submenu-item.pricing.upgrade-mode{color:#adff2f}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}.fs-ajax-spinner{border:0;width:20px;height:20px;margin-right:5px;vertical-align:sub;display:inline-block;background:url("/wp-admin/images/wpspin_light-2x.gif");background-size:contain;margin-bottom:-2px}.wrap.fs-section h2{text-align:left}.plugins p.fs-upgrade-notice{border:0;background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px}/*# sourceMappingURL=common.css.map */
|
1 |
+
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,.1),inset 0 1px 3px 0 rgba(0,0,0,.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,.5);z-index:999;-moz-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}.fs-switch-feedback{margin-left:10px}.fs-switch-feedback.success{color:#71ae00}.rtl .fs-switch-feedback{margin-left:0;margin-right:10px}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media(max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}.fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,.3);box-shadow:0 2px 2px rgba(6,113,6,.3);opacity:.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width: 1250px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:"↳";padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:"↲"}.fs-submenu-item.pricing.upgrade-mode{color:#adff2f}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}.fs-ajax-spinner{border:0;width:20px;height:20px;margin-right:5px;vertical-align:sub;display:inline-block;background:url("/wp-admin/images/wpspin_light-2x.gif");background-size:contain;margin-bottom:-2px}.wrap.fs-section h2{text-align:left}.plugins p.fs-upgrade-notice{border:0;background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px}/*# sourceMappingURL=common.css.map */
|
lib/freemius/assets/css/admin/connect.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,.3);box-shadow:0px 1px 2px rgba(0,0,0,.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key .fs-sites-list-container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#fs_connect .fs-actions{padding:10px 20px;background:#c0c7ca}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:" ➜"}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:""}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#fefefe;-moz-transition:background .5s ease;-o-transition:background .5s ease;-ms-transition:background .5s ease;-webkit-transition:background .5s ease;transition:background .5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions>.fs-trigger{font-size:.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li>i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li .fs-switch{float:right}#fs_connect .fs-permissions ul li .fs-permission-description{margin-left:55px}#fs_connect .fs-permissions ul li .fs-permission-description span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li .fs-permission-description p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{overflow:initial;height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#c2eeff;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:.85em;padding:5px;background:rgba(0,0,0,.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:rgba(0,0,0,.8);color:#fff !important;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:-17px;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left;text-transform:none !important}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right;left:auto;right:-17px}.fs-tooltip-trigger .fs-tooltip::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}#fs_marketing_optin{display:none;margin-top:10px;border:1px solid #ccc;padding:10px;line-height:1.5em}#fs_marketing_optin .fs-message{display:block;margin-bottom:5px;font-size:1.05em;font-weight:600}#fs_marketing_optin.error{border:1px solid #d3135a;background:#fee}#fs_marketing_optin.error .fs-message{color:#d3135a}#fs_marketing_optin .fs-input-container{margin-top:5px}#fs_marketing_optin .fs-input-container label{margin-top:5px;display:block}#fs_marketing_optin .fs-input-container label input{float:left;margin:1px 0 0 0}#fs_marketing_optin .fs-input-container label:first-child{display:block;margin-bottom:2px}#fs_marketing_optin .fs-input-label{display:block;margin-left:20px}#fs_marketing_optin .fs-input-label .underlined{text-decoration:underline}.rtl #fs_marketing_optin .fs-input-container label input{float:right}.rtl #fs_marketing_optin .fs-input-label{margin-left:0;margin-right:20px}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#c0c7ca}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:" »"}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:""}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li .fs-permission-description{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li .fs-switch{float:left}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:#fff;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}#license_issues_link{display:block;text-align:center;font-size:.9em;margin-top:10px}/*# sourceMappingURL=connect.css.map */
|
1 |
+
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,.3);box-shadow:0px 1px 2px rgba(0,0,0,.3);margin:20px 0}@media screen and (max-width: 479px){#fs_connect{-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;width:auto;margin:0 0 0 -10px}}#fs_connect .fs-content{background:#fff;padding:15px 20px}#fs_connect .fs-content .fs-error{background:snow;color:#d3135a;border:1px solid #d3135a;-moz-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 1px 0 rgba(0,0,0,.1);text-align:center;padding:5px;margin-bottom:10px}#fs_connect .fs-content p{margin:0;padding:0;font-size:1.2em}#fs_connect .fs-license-key-container{position:relative;width:280px;margin:10px auto 0 auto}#fs_connect .fs-license-key-container input{width:100%}#fs_connect .fs-license-key-container .dashicons{position:absolute;top:5px;right:5px}#fs_connect.require-license-key .fs-sites-list-container td{cursor:pointer}#fs_connect #delegate_to_site_admins{margin-right:15px;float:right;height:26px;vertical-align:middle;line-height:37px;font-weight:bold;border-bottom:1px dashed;text-decoration:none}#fs_connect #delegate_to_site_admins.rtl{margin-left:15px;margin-right:0}#fs_connect .fs-actions{padding:10px 20px;background:#c0c7ca}#fs_connect .fs-actions .button{padding:0 10px 1px;line-height:35px;height:37px;font-size:16px;margin-bottom:0}#fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}#fs_connect .fs-actions .button.button-primary{padding-right:15px;padding-left:15px}#fs_connect .fs-actions .button.button-primary:after{content:" ➜"}#fs_connect .fs-actions .button.button-primary.fs-loading:after{content:""}#fs_connect .fs-actions .button.button-secondary{float:right}#fs_connect.fs-anonymous-disabled .fs-actions .button.button-primary{width:100%}#fs_connect .fs-permissions{padding:10px 20px;background:#fefefe;-moz-transition:background .5s ease;-o-transition:background .5s ease;-ms-transition:background .5s ease;-webkit-transition:background .5s ease;transition:background .5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions>.fs-trigger{font-size:.9em;text-decoration:none;text-align:center;display:block}#fs_connect .fs-permissions ul{height:0;overflow:hidden;margin:0}#fs_connect .fs-permissions ul li{margin-bottom:12px}#fs_connect .fs-permissions ul li:last-child{margin-bottom:0}#fs_connect .fs-permissions ul li>i.dashicons{float:left;font-size:40px;width:40px;height:40px}#fs_connect .fs-permissions ul li .fs-switch{float:right}#fs_connect .fs-permissions ul li .fs-permission-description{margin-left:55px}#fs_connect .fs-permissions ul li .fs-permission-description span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li .fs-permission-description p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{overflow:initial;height:auto;margin:20px 20px 10px 20px}@media screen and (max-width: 479px){#fs_connect .fs-permissions{background:#fff}#fs_connect .fs-permissions .fs-trigger{display:none}#fs_connect .fs-permissions ul{height:auto;margin:20px}}#fs_connect .fs-freemium-licensing{padding:8px;background:#777;color:#fff}#fs_connect .fs-freemium-licensing p{text-align:center;display:block;margin:0;padding:0}#fs_connect .fs-freemium-licensing a{color:#c2eeff;text-decoration:underline}#fs_connect .fs-visual{padding:12px;line-height:0;background:#fafafa;height:80px;position:relative}#fs_connect .fs-visual .fs-site-icon{position:absolute;left:20px;top:10px}#fs_connect .fs-visual .fs-connect-logo{position:absolute;right:20px;top:10px}#fs_connect .fs-visual .fs-plugin-icon{position:absolute;top:10px;left:50%;margin-left:-40px}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-site-icon,#fs_connect .fs-visual img,#fs_connect .fs-visual object{width:80px;height:80px}#fs_connect .fs-visual .dashicons-wordpress{font-size:64px;background:#01749a;color:#fff;width:64px;height:64px;padding:8px}#fs_connect .fs-visual .dashicons-plus{position:absolute;top:50%;font-size:30px;margin-top:-10px;color:#bbb}#fs_connect .fs-visual .dashicons-plus.fs-first{left:28%}#fs_connect .fs-visual .dashicons-plus.fs-second{left:65%}#fs_connect .fs-visual .fs-plugin-icon,#fs_connect .fs-visual .fs-connect-logo,#fs_connect .fs-visual .fs-site-icon{border:1px solid #ccc;padding:1px;background:#fff}#fs_connect .fs-terms{text-align:center;font-size:.85em;padding:5px;background:rgba(0,0,0,.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:rgba(0,0,0,.8);color:#fff !important;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:-17px;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left;text-transform:none !important}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right;left:auto;right:-17px}.fs-tooltip-trigger .fs-tooltip::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}#fs_marketing_optin{display:none;margin-top:10px;border:1px solid #ccc;padding:10px;line-height:1.5em}#fs_marketing_optin .fs-message{display:block;margin-bottom:5px;font-size:1.05em;font-weight:600}#fs_marketing_optin.error{border:1px solid #d3135a;background:#fee}#fs_marketing_optin.error .fs-message{color:#d3135a}#fs_marketing_optin .fs-input-container{margin-top:5px}#fs_marketing_optin .fs-input-container label{margin-top:5px;display:block}#fs_marketing_optin .fs-input-container label input{float:left;margin:1px 0 0 0}#fs_marketing_optin .fs-input-container label:first-child{display:block;margin-bottom:2px}#fs_marketing_optin .fs-input-label{display:block;margin-left:20px}#fs_marketing_optin .fs-input-label .underlined{text-decoration:underline}.rtl #fs_marketing_optin .fs-input-container label input{float:right}.rtl #fs_marketing_optin .fs-input-label{margin-left:0;margin-right:20px}.rtl #fs_connect .fs-actions{padding:10px 20px;background:#c0c7ca}.rtl #fs_connect .fs-actions .button .dashicons{font-size:37px;margin-left:-8px;margin-right:12px}.rtl #fs_connect .fs-actions .button.button-primary:after{content:" »"}.rtl #fs_connect .fs-actions .button.button-primary.fs-loading:after{content:""}.rtl #fs_connect .fs-actions .button.button-secondary{float:left}.rtl #fs_connect .fs-permissions ul li .fs-permission-description{margin-right:55px;margin-left:0}.rtl #fs_connect .fs-permissions ul li .fs-switch{float:left}.rtl #fs_connect .fs-permissions ul li i.dashicons{float:right}.rtl #fs_connect .fs-visual .fs-site-icon{right:20px;left:auto}.rtl #fs_connect .fs-visual .fs-connect-logo{right:auto;left:20px}#fs_theme_connect_wrapper{position:fixed;top:0;height:100%;width:100%;z-index:99990;background:rgba(0,0,0,.75);text-align:center;overflow-y:auto}#fs_theme_connect_wrapper:before{content:"";display:inline-block;vertical-align:middle;height:100%}#fs_theme_connect_wrapper>button.close{color:#fff;cursor:pointer;height:40px;width:40px;position:absolute;right:0;border:0;background-color:transparent;top:32px}#fs_theme_connect_wrapper #fs_connect{top:0;text-align:left;display:inline-block;vertical-align:middle;margin-top:52px;margin-bottom:20px}#fs_theme_connect_wrapper #fs_connect .fs-terms{background:rgba(140,140,140,.64)}#fs_theme_connect_wrapper #fs_connect .fs-terms,#fs_theme_connect_wrapper #fs_connect .fs-terms a{color:#c5c5c5}.wp-pointer-content #fs_connect{margin:0;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.fs-opt-in-pointer .wp-pointer-content{padding:0}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow{border-bottom-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#fafafa}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow{border-top-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-bottom .wp-pointer-arrow-inner{border-top-color:#fafafa}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow{border-right-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-left .wp-pointer-arrow-inner{border-right-color:#fafafa}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow{border-left-color:#dfdfdf}.fs-opt-in-pointer.wp-pointer-right .wp-pointer-arrow-inner{border-left-color:#fafafa}#license_issues_link{display:block;text-align:center;font-size:.9em;margin-top:10px}/*# sourceMappingURL=connect.css.map */
|
lib/freemius/assets/css/admin/debug.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}/*# sourceMappingURL=debug.css.map */
|
1 |
+
.fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}/*# sourceMappingURL=debug.css.map */
|
lib/freemius/assets/css/admin/dialog-boxes.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,.6)}.fs-modal .dashicons{vertical-align:middle}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media(max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal.fs-success .fs-modal-header{border-bottom-color:#46b450}.fs-modal.fs-success .fs-modal-body{background-color:#f7fff7}.fs-modal.fs-warn .fs-modal-header{border-bottom-color:#ffb900}.fs-modal.fs-warn .fs-modal-body{background-color:#fff8e5}.fs-modal.fs-error .fs-modal-header{border-bottom-color:#dc3232}.fs-modal.fs-error .fs-modal-body{background-color:#ffeaea}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-header{border-bottom:#eee solid 1px;background:#fbfbfb;padding:15px 20px;position:relative;margin-bottom:-10px}.fs-modal .fs-modal-header h4{margin:0;padding:0;text-transform:uppercase;font-size:1.2em;font-weight:bold;color:#cacaca;text-shadow:1px 1px 1px #fff;letter-spacing:.6px;-webkit-font-smoothing:antialiased}.fs-modal .fs-modal-header .fs-close{position:absolute;right:10px;top:12px;cursor:pointer;color:#bbb;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;padding:3px;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.fs-modal .fs-modal-header .fs-close:hover{color:#fff;background:#aaa}.fs-modal .fs-modal-header .fs-close .dashicons,.fs-modal .fs-modal-header .fs-close:hover .dashicons{text-decoration:none}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px;line-height:1.5em}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:last-of-type{margin:0}.fs-modal .fs-modal-panel>.notice.inline{margin:0;display:none}.fs-modal .fs-modal-panel:not(.active){display:none}.rtl .fs-modal .fs-modal-header .fs-close{right:auto;left:20px}.rtl .fs-modal .fs-modal-footer{text-align:left}body.has-fs-modal{overflow:hidden}.fs-modal.fs-modal-deactivation-feedback .reason-input,.fs-modal.fs-modal-deactivation-feedback .internal-message{margin:3px 0 3px 22px}.fs-modal.fs-modal-deactivation-feedback .reason-input input,.fs-modal.fs-modal-deactivation-feedback .reason-input textarea,.fs-modal.fs-modal-deactivation-feedback .internal-message input,.fs-modal.fs-modal-deactivation-feedback .internal-message textarea{width:100%}.fs-modal.fs-modal-deactivation-feedback li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}@media(max-width: 650px){.fs-modal.fs-modal-deactivation-feedback li.reason li.reason{margin-bottom:10px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .reason-input,.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .internal-message{margin-left:29px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label{display:table}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label,.fs-modal.fs-modal-deactivation-feedback .feedback-from-snooze-label{float:left;line-height:30px}.rtl .fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label,.rtl .fs-modal.fs-modal-deactivation-feedback .feedback-from-snooze-label{float:right}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel{margin-top:0 !important}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel h3{margin-top:0;line-height:1.5em}#the-list .deactivate>.fs-slug{display:none}.fs-modal.fs-modal-subscription-cancellation .fs-price-increase-warning{color:red;font-weight:bold;padding:0 25px;margin-bottom:0}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:left;top:5px;position:relative}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:right}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{display:block;margin-left:24px}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{margin-left:0;margin-right:24px}.fs-modal.fs-modal-license-activation .fs-modal-body input.fs-license-key{width:100%}.fs-license-options-container table,.fs-license-options-container table select,.fs-license-options-container table .fs-available-license-key{width:100%}.fs-license-options-container table td:first-child{width:1%}.fs-license-options-container table .fs-other-license-key-container label{position:relative;top:6px;float:left;margin-right:5px}.fs-license-options-container table .fs-other-license-key-container div{overflow:hidden;width:auto;height:30px;display:block;top:2px;position:relative}.fs-license-options-container table .fs-other-license-key-container div input{margin:0}.fs-sites-list-container td{cursor:pointer}.fs-modal.fs-modal-user-change .fs-modal-body input#fs_other_email_address{width:100%}.fs-user-change-options-container table{width:100%;border-collapse:collapse}.fs-user-change-options-container table tr{display:block;margin-bottom:2px}.fs-user-change-options-container table .fs-email-address-container td{display:inline-block}.fs-user-change-options-container table .fs-email-address-container input[type=radio]{margin-bottom:0;margin-top:0}.fs-user-change-options-container table .fs-other-email-address-container{width:100%}.fs-user-change-options-container table .fs-other-email-address-container>div{display:table;width:100%}.fs-user-change-options-container table .fs-other-email-address-container>div label,.fs-user-change-options-container table .fs-other-email-address-container>div>div{display:table-cell}.fs-user-change-options-container table .fs-other-email-address-container>div label{width:1%;padding-left:3px;padding-right:3px}.fs-user-change-options-container table .fs-other-email-address-container>div>div{width:auto}.fs-user-change-options-container table .fs-other-email-address-container>div>div input{width:100%}.fs-modal.fs-modal-developer-license-debug-mode .fs-modal-body input.fs-license-or-user-key{width:100%}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-modal.fs-modal-license-key-resend .email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend.fs-freemium input.email-address{width:300px}.fs-modal.fs-modal-license-key-resend.fs-freemium label{display:block;margin-bottom:10px}.fs-modal.fs-modal-license-key-resend.fs-premium input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{float:right;margin-left:7px}@media(max-width: 650px){.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{margin-top:2px}}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .input-container>.email-address-container{padding-left:2px;padding-right:0}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:left;margin-right:7px;margin-left:0}a.show-license-resend-modal{margin-top:4px;display:inline-block}.fs-modal.fs-modal-email-address-update .fs-modal-body input[type=text]{width:100%}.fs-modal.fs-modal-email-address-update p{margin-bottom:0}.fs-modal.fs-modal-email-address-update ul{margin:1em .5em}.fs-modal.fs-modal-email-address-update ul li label span{float:left;margin-top:0}.fs-modal.fs-modal-email-address-update ul li label span:last-child{display:block;float:none;margin-left:20px}.fs-ajax-loader{position:relative;width:170px;height:20px;margin:auto}.fs-ajax-loader .fs-ajax-loader-bar{position:absolute;top:0;background-color:#0074a3;width:20px;height:20px;-webkit-animation-name:bounce_ajaxLoader;-moz-animation-name:bounce_ajaxLoader;-ms-animation-name:bounce_ajaxLoader;-o-animation-name:bounce_ajaxLoader;animation-name:bounce_ajaxLoader;-webkit-animation-duration:1.5s;-moz-animation-duration:1.5s;-ms-animation-duration:1.5s;-o-animation-duration:1.5s;animation-duration:1.5s;animation-iteration-count:infinite;-o-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-webkit-animation-direction:normal;-moz-animation-direction:normal;-ms-animation-direction:normal;-o-animation-direction:normal;animation-direction:normal;-moz-transform:.3;-o-transform:.3;-ms-transform:.3;-webkit-transform:.3;transform:.3}.fs-ajax-loader .fs-ajax-loader-bar-1{left:0px;animation-delay:0.6s;-o-animation-delay:0.6s;-ms-animation-delay:0.6s;-webkit-animation-delay:0.6s;-moz-animation-delay:0.6s}.fs-ajax-loader .fs-ajax-loader-bar-2{left:19px;animation-delay:0.75s;-o-animation-delay:0.75s;-ms-animation-delay:0.75s;-webkit-animation-delay:0.75s;-moz-animation-delay:0.75s}.fs-ajax-loader .fs-ajax-loader-bar-3{left:38px;animation-delay:0.9s;-o-animation-delay:0.9s;-ms-animation-delay:0.9s;-webkit-animation-delay:0.9s;-moz-animation-delay:0.9s}.fs-ajax-loader .fs-ajax-loader-bar-4{left:57px;animation-delay:1.05s;-o-animation-delay:1.05s;-ms-animation-delay:1.05s;-webkit-animation-delay:1.05s;-moz-animation-delay:1.05s}.fs-ajax-loader .fs-ajax-loader-bar-5{left:76px;animation-delay:1.2s;-o-animation-delay:1.2s;-ms-animation-delay:1.2s;-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s}.fs-ajax-loader .fs-ajax-loader-bar-6{left:95px;animation-delay:1.35s;-o-animation-delay:1.35s;-ms-animation-delay:1.35s;-webkit-animation-delay:1.35s;-moz-animation-delay:1.35s}.fs-ajax-loader .fs-ajax-loader-bar-7{left:114px;animation-delay:1.5s;-o-animation-delay:1.5s;-ms-animation-delay:1.5s;-webkit-animation-delay:1.5s;-moz-animation-delay:1.5s}.fs-ajax-loader .fs-ajax-loader-bar-8{left:133px;animation-delay:1.65s;-o-animation-delay:1.65s;-ms-animation-delay:1.65s;-webkit-animation-delay:1.65s;-moz-animation-delay:1.65s}@-moz-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-ms-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-o-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-webkit-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}.fs-modal-auto-install #request-filesystem-credentials-form h2,.fs-modal-auto-install #request-filesystem-credentials-form .request-filesystem-credentials-action-buttons{display:none}.fs-modal-auto-install #request-filesystem-credentials-form input[type=password],.fs-modal-auto-install #request-filesystem-credentials-form input[type=email],.fs-modal-auto-install #request-filesystem-credentials-form input[type=text]{-webkit-appearance:none;padding:10px 10px 5px 10px;width:300px;max-width:100%}.fs-modal-auto-install #request-filesystem-credentials-form>div,.fs-modal-auto-install #request-filesystem-credentials-form label,.fs-modal-auto-install #request-filesystem-credentials-form fieldset{width:300px;max-width:100%;margin:0 auto;display:block}.button-primary.warn{box-shadow:0 1px 0 #d2593c;text-shadow:0 -1px 1px #d2593c,1px 0 1px #d2593c,0 1px 1px #d2593c,-1px 0 1px #d2593c;background:#f56a48;border-color:#ec6544 #d2593c #d2593c}.button-primary.warn:hover{background:#fd6d4a;border-color:#d2593c}.button-primary.warn:focus{box-shadow:0 1px 0 #dd6041,0 0 2px 1px #e4a796}.button-primary.warn:active{background:#dd6041;border-color:#d2593c;box-shadow:inset 0 2px 0 #d2593c}.button-primary.warn.disabled{color:#f5b3a1 !important;background:#e76444 !important;border-color:#d85e40 !important;text-shadow:0 -1px 0 rgba(0,0,0,.1) !important}/*# sourceMappingURL=dialog-boxes.css.map */
|
1 |
+
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,.6)}.fs-modal .dashicons{vertical-align:middle}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media(max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal.fs-success .fs-modal-header{border-bottom-color:#46b450}.fs-modal.fs-success .fs-modal-body{background-color:#f7fff7}.fs-modal.fs-warn .fs-modal-header{border-bottom-color:#ffb900}.fs-modal.fs-warn .fs-modal-body{background-color:#fff8e5}.fs-modal.fs-error .fs-modal-header{border-bottom-color:#dc3232}.fs-modal.fs-error .fs-modal-body{background-color:#ffeaea}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-header{border-bottom:#eee solid 1px;background:#fbfbfb;padding:15px 20px;position:relative;margin-bottom:-10px}.fs-modal .fs-modal-header h4{margin:0;padding:0;text-transform:uppercase;font-size:1.2em;font-weight:bold;color:#cacaca;text-shadow:1px 1px 1px #fff;letter-spacing:.6px;-webkit-font-smoothing:antialiased}.fs-modal .fs-modal-header .fs-close{position:absolute;right:10px;top:12px;cursor:pointer;color:#bbb;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;padding:3px;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.fs-modal .fs-modal-header .fs-close:hover{color:#fff;background:#aaa}.fs-modal .fs-modal-header .fs-close .dashicons,.fs-modal .fs-modal-header .fs-close:hover .dashicons{text-decoration:none}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px;line-height:1.5em}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:last-of-type{margin:0}.fs-modal .fs-modal-panel>.notice.inline{margin:0;display:none}.fs-modal .fs-modal-panel:not(.active){display:none}.rtl .fs-modal .fs-modal-header .fs-close{right:auto;left:20px}.rtl .fs-modal .fs-modal-footer{text-align:left}body.has-fs-modal{overflow:hidden}.fs-modal.fs-modal-deactivation-feedback .reason-input,.fs-modal.fs-modal-deactivation-feedback .internal-message{margin:3px 0 3px 22px}.fs-modal.fs-modal-deactivation-feedback .reason-input input,.fs-modal.fs-modal-deactivation-feedback .reason-input textarea,.fs-modal.fs-modal-deactivation-feedback .internal-message input,.fs-modal.fs-modal-deactivation-feedback .internal-message textarea{width:100%}.fs-modal.fs-modal-deactivation-feedback li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}@media(max-width: 650px){.fs-modal.fs-modal-deactivation-feedback li.reason li.reason{margin-bottom:10px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .reason-input,.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .internal-message{margin-left:29px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label{display:table}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label,.fs-modal.fs-modal-deactivation-feedback .feedback-from-snooze-label{float:left;line-height:30px}.rtl .fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label,.rtl .fs-modal.fs-modal-deactivation-feedback .feedback-from-snooze-label{float:right}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel{margin-top:0 !important}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel h3{margin-top:0;line-height:1.5em}#the-list .deactivate>.fs-slug{display:none}.fs-modal.fs-modal-subscription-cancellation .fs-price-increase-warning{color:red;font-weight:bold;padding:0 25px;margin-bottom:0}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:left;top:5px;position:relative}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:right}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{display:block;margin-left:24px}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{margin-left:0;margin-right:24px}.fs-modal.fs-modal-license-activation .fs-modal-body input.fs-license-key{width:100%}.fs-license-options-container table,.fs-license-options-container table select,.fs-license-options-container table .fs-available-license-key{width:100%}.fs-license-options-container table td:first-child{width:1%}.fs-license-options-container table .fs-other-license-key-container label{position:relative;top:6px;float:left;margin-right:5px}.fs-license-options-container table .fs-other-license-key-container div{overflow:hidden;width:auto;height:30px;display:block;top:2px;position:relative}.fs-license-options-container table .fs-other-license-key-container div input{margin:0}.fs-sites-list-container td{cursor:pointer}.fs-modal.fs-modal-user-change .fs-modal-body input#fs_other_email_address{width:100%}.fs-user-change-options-container table{width:100%;border-collapse:collapse}.fs-user-change-options-container table tr{display:block;margin-bottom:2px}.fs-user-change-options-container table .fs-email-address-container td{display:inline-block}.fs-user-change-options-container table .fs-email-address-container input[type=radio]{margin-bottom:0;margin-top:0}.fs-user-change-options-container table .fs-other-email-address-container{width:100%}.fs-user-change-options-container table .fs-other-email-address-container>div{display:table;width:100%}.fs-user-change-options-container table .fs-other-email-address-container>div label,.fs-user-change-options-container table .fs-other-email-address-container>div>div{display:table-cell}.fs-user-change-options-container table .fs-other-email-address-container>div label{width:1%;padding-left:3px;padding-right:3px}.fs-user-change-options-container table .fs-other-email-address-container>div>div{width:auto}.fs-user-change-options-container table .fs-other-email-address-container>div>div input{width:100%}.fs-modal.fs-modal-developer-license-debug-mode .fs-modal-body input.fs-license-or-user-key{width:100%}.fs-multisite-options-container{margin-top:10px;border:1px solid #ccc;padding:5px}.fs-multisite-options-container a{text-decoration:none}.fs-multisite-options-container a:focus{box-shadow:none}.fs-multisite-options-container a.selected{font-weight:bold}.fs-multisite-options-container.fs-apply-on-all-sites{border:0 none;padding:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options{border-spacing:0}.fs-multisite-options-container.fs-apply-on-all-sites .fs-all-sites-options td:not(:first-child){display:none}.fs-multisite-options-container .fs-sites-list-container{display:none;overflow:auto}.fs-multisite-options-container .fs-sites-list-container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-modal.fs-modal-license-key-resend .email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend.fs-freemium input.email-address{width:300px}.fs-modal.fs-modal-license-key-resend.fs-freemium label{display:block;margin-bottom:10px}.fs-modal.fs-modal-license-key-resend.fs-premium input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{float:right;margin-left:7px}@media(max-width: 650px){.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{margin-top:2px}}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .input-container>.email-address-container{padding-left:2px;padding-right:0}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:left;margin-right:7px;margin-left:0}a.show-license-resend-modal{margin-top:4px;display:inline-block}.fs-modal.fs-modal-email-address-update .fs-modal-body input[type=text]{width:100%}.fs-modal.fs-modal-email-address-update p{margin-bottom:0}.fs-modal.fs-modal-email-address-update ul{margin:1em .5em}.fs-modal.fs-modal-email-address-update ul li label span{float:left;margin-top:0}.fs-modal.fs-modal-email-address-update ul li label span:last-child{display:block;float:none;margin-left:20px}.fs-ajax-loader{position:relative;width:170px;height:20px;margin:auto}.fs-ajax-loader .fs-ajax-loader-bar{position:absolute;top:0;background-color:#0074a3;width:20px;height:20px;-webkit-animation-name:bounce_ajaxLoader;-moz-animation-name:bounce_ajaxLoader;-ms-animation-name:bounce_ajaxLoader;-o-animation-name:bounce_ajaxLoader;animation-name:bounce_ajaxLoader;-webkit-animation-duration:1.5s;-moz-animation-duration:1.5s;-ms-animation-duration:1.5s;-o-animation-duration:1.5s;animation-duration:1.5s;animation-iteration-count:infinite;-o-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-webkit-animation-direction:normal;-moz-animation-direction:normal;-ms-animation-direction:normal;-o-animation-direction:normal;animation-direction:normal;-moz-transform:.3;-o-transform:.3;-ms-transform:.3;-webkit-transform:.3;transform:.3}.fs-ajax-loader .fs-ajax-loader-bar-1{left:0px;animation-delay:0.6s;-o-animation-delay:0.6s;-ms-animation-delay:0.6s;-webkit-animation-delay:0.6s;-moz-animation-delay:0.6s}.fs-ajax-loader .fs-ajax-loader-bar-2{left:19px;animation-delay:0.75s;-o-animation-delay:0.75s;-ms-animation-delay:0.75s;-webkit-animation-delay:0.75s;-moz-animation-delay:0.75s}.fs-ajax-loader .fs-ajax-loader-bar-3{left:38px;animation-delay:0.9s;-o-animation-delay:0.9s;-ms-animation-delay:0.9s;-webkit-animation-delay:0.9s;-moz-animation-delay:0.9s}.fs-ajax-loader .fs-ajax-loader-bar-4{left:57px;animation-delay:1.05s;-o-animation-delay:1.05s;-ms-animation-delay:1.05s;-webkit-animation-delay:1.05s;-moz-animation-delay:1.05s}.fs-ajax-loader .fs-ajax-loader-bar-5{left:76px;animation-delay:1.2s;-o-animation-delay:1.2s;-ms-animation-delay:1.2s;-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s}.fs-ajax-loader .fs-ajax-loader-bar-6{left:95px;animation-delay:1.35s;-o-animation-delay:1.35s;-ms-animation-delay:1.35s;-webkit-animation-delay:1.35s;-moz-animation-delay:1.35s}.fs-ajax-loader .fs-ajax-loader-bar-7{left:114px;animation-delay:1.5s;-o-animation-delay:1.5s;-ms-animation-delay:1.5s;-webkit-animation-delay:1.5s;-moz-animation-delay:1.5s}.fs-ajax-loader .fs-ajax-loader-bar-8{left:133px;animation-delay:1.65s;-o-animation-delay:1.65s;-ms-animation-delay:1.65s;-webkit-animation-delay:1.65s;-moz-animation-delay:1.65s}@-moz-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-ms-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-o-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-webkit-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}.fs-modal-auto-install #request-filesystem-credentials-form h2,.fs-modal-auto-install #request-filesystem-credentials-form .request-filesystem-credentials-action-buttons{display:none}.fs-modal-auto-install #request-filesystem-credentials-form input[type=password],.fs-modal-auto-install #request-filesystem-credentials-form input[type=email],.fs-modal-auto-install #request-filesystem-credentials-form input[type=text]{-webkit-appearance:none;padding:10px 10px 5px 10px;width:300px;max-width:100%}.fs-modal-auto-install #request-filesystem-credentials-form>div,.fs-modal-auto-install #request-filesystem-credentials-form label,.fs-modal-auto-install #request-filesystem-credentials-form fieldset{width:300px;max-width:100%;margin:0 auto;display:block}.button-primary.warn{box-shadow:0 1px 0 #d2593c;text-shadow:0 -1px 1px #d2593c,1px 0 1px #d2593c,0 1px 1px #d2593c,-1px 0 1px #d2593c;background:#f56a48;border-color:#ec6544 #d2593c #d2593c}.button-primary.warn:hover{background:#fd6d4a;border-color:#d2593c}.button-primary.warn:focus{box-shadow:0 1px 0 #dd6041,0 0 2px 1px #e4a796}.button-primary.warn:active{background:#dd6041;border-color:#d2593c;box-shadow:inset 0 2px 0 #d2593c}.button-primary.warn.disabled{color:#f5b3a1 !important;background:#e76444 !important;border-color:#d85e40 !important;text-shadow:0 -1px 0 rgba(0,0,0,.1) !important}/*# sourceMappingURL=dialog-boxes.css.map */
|
lib/freemius/assets/css/admin/gdpr-optin-notice.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.fs-notice[data-id^=gdpr_optin_actions] .underlined{text-decoration:underline}.fs-notice[data-id^=gdpr_optin_actions] ul .button,.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{vertical-align:middle}.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{display:inline-block;margin-left:3px}/*# sourceMappingURL=gdpr-optin-notice.css.map */
|
1 |
+
.fs-notice[data-id^=gdpr_optin_actions] .underlined{text-decoration:underline}.fs-notice[data-id^=gdpr_optin_actions] ul .button,.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{vertical-align:middle}.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{display:inline-block;margin-left:3px}/*# sourceMappingURL=gdpr-optin-notice.css.map */
|
lib/freemius/assets/css/admin/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/assets/css/admin/plugins.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.wp-list-table.plugins .plugin-title span.fs-tag{display:inline-block;margin-left:5px;line-height:10px}/*# sourceMappingURL=plugins.css.map */
|
1 |
+
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.wp-list-table.plugins .plugin-title span.fs-tag{display:inline-block;margin-left:5px;line-height:10px}/*# sourceMappingURL=plugins.css.map */
|
lib/freemius/assets/css/customizer.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_customizer_upsell .fs-customizer-plan{padding:10px 20px 20px 20px;border-radius:3px;background:#fff}#fs_customizer_upsell .fs-customizer-plan h2{position:relative;margin:0;line-height:2em;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;vertical-align:bottom;margin-left:-7px;margin-right:10px}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:#000;color:#fff;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#000 transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{right:21px;left:auto}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{visibility:visible;opacity:1}#fs_customizer_upsell .button-primary{display:block;text-align:center;margin-top:10px}#fs_customizer_support{display:block !important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{width:100%;display:block;margin-top:10px}#fs_customizer_support .button-group .button{float:none;width:50%;text-align:center}#customize-theme-controls #accordion-section-freemius_upsell{border-top:1px solid #0085ba !important;border-bottom:1px solid #0085ba !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{color:#fff;background-color:#0085ba;border-left:4px solid #0085ba;transition:.15s background-color ease-in-out,.15s border-color ease-in-out;outline:none;border-bottom:none !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa}/*# sourceMappingURL=customizer.css.map */
|
1 |
+
#fs_customizer_upsell .fs-customizer-plan{padding:10px 20px 20px 20px;border-radius:3px;background:#fff}#fs_customizer_upsell .fs-customizer-plan h2{position:relative;margin:0;line-height:2em;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;vertical-align:bottom;margin-left:-7px;margin-right:10px}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:#000;color:#fff;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#000 transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{right:21px;left:auto}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{visibility:visible;opacity:1}#fs_customizer_upsell .button-primary{display:block;text-align:center;margin-top:10px}#fs_customizer_support{display:block !important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{width:100%;display:block;margin-top:10px}#fs_customizer_support .button-group .button{float:none;width:50%;text-align:center}#customize-theme-controls #accordion-section-freemius_upsell{border-top:1px solid #0085ba !important;border-bottom:1px solid #0085ba !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{color:#fff;background-color:#0085ba;border-left:4px solid #0085ba;transition:.15s background-color ease-in-out,.15s border-color ease-in-out;outline:none;border-bottom:none !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa}/*# sourceMappingURL=customizer.css.map */
|
lib/freemius/assets/css/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/assets/img/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/assets/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/assets/js/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/assets/js/nojquery.ba-postmessage.js
CHANGED
@@ -1,140 +1,140 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery postMessage - v0.5 - 9/11/2009
|
3 |
-
* http://benalman.com/projects/jquery-postmessage-plugin/
|
4 |
-
*
|
5 |
-
* Copyright (c) 2009 "Cowboy" Ben Alman
|
6 |
-
* Dual licensed under the MIT and GPL licenses.
|
7 |
-
* http://benalman.com/about/license/
|
8 |
-
*
|
9 |
-
* Non-jQuery fork by Jeff Lee
|
10 |
-
*
|
11 |
-
* This fork consists of the following changes:
|
12 |
-
* 1. Basic code cleanup and restructuring, for legibility.
|
13 |
-
* 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
|
14 |
-
* in terms of both function names and object scope. Scope is specified by
|
15 |
-
* the the "this" context of NoJQueryPostMessageMixin();
|
16 |
-
* 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
|
17 |
-
* at least three different GitHub users requesting the removal of this
|
18 |
-
* "Opera sniff" on the original project's Issues page, so I figured this
|
19 |
-
* would be a relatively safe change.
|
20 |
-
* 4. `postMessage` no longer uses `$.param` to serialize messages that are not
|
21 |
-
* strings. I actually prefer this structure anyway. `receiveMessage` does
|
22 |
-
* not implement a corresponding deserialization step, and as such it seems
|
23 |
-
* cleaner and more symmetric to leave both data serialization and
|
24 |
-
* deserialization to the client.
|
25 |
-
* 5. The use of `$.isFunction` is replaced by a functionally-identical check.
|
26 |
-
* 6. The `$:nomunge` YUI option is no longer necessary.
|
27 |
-
*/
|
28 |
-
|
29 |
-
function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
|
30 |
-
|
31 |
-
var setMessageCallback, unsetMessageCallback, currentMsgCallback,
|
32 |
-
intervalId, lastHash, cacheBust = 1;
|
33 |
-
|
34 |
-
if (window.postMessage) {
|
35 |
-
|
36 |
-
if (window.addEventListener) {
|
37 |
-
setMessageCallback = function(callback) {
|
38 |
-
window.addEventListener('message', callback, false);
|
39 |
-
}
|
40 |
-
|
41 |
-
unsetMessageCallback = function(callback) {
|
42 |
-
window.removeEventListener('message', callback, false);
|
43 |
-
}
|
44 |
-
} else {
|
45 |
-
setMessageCallback = function(callback) {
|
46 |
-
window.attachEvent('onmessage', callback);
|
47 |
-
}
|
48 |
-
|
49 |
-
unsetMessageCallback = function(callback) {
|
50 |
-
window.detachEvent('onmessage', callback);
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
this[postBinding] = function(message, targetUrl, target) {
|
55 |
-
if (!targetUrl) {
|
56 |
-
return;
|
57 |
-
}
|
58 |
-
|
59 |
-
// The browser supports window.postMessage, so call it with a targetOrigin
|
60 |
-
// set appropriately, based on the targetUrl parameter.
|
61 |
-
target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
|
62 |
-
}
|
63 |
-
|
64 |
-
// Since the browser supports window.postMessage, the callback will be
|
65 |
-
// bound to the actual event associated with window.postMessage.
|
66 |
-
this[receiveBinding] = function(callback, sourceOrigin, delay) {
|
67 |
-
// Unbind an existing callback if it exists.
|
68 |
-
if (currentMsgCallback) {
|
69 |
-
unsetMessageCallback(currentMsgCallback);
|
70 |
-
currentMsgCallback = null;
|
71 |
-
}
|
72 |
-
|
73 |
-
if (!callback) {
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
// Bind the callback. A reference to the callback is stored for ease of
|
78 |
-
// unbinding.
|
79 |
-
currentMsgCallback = setMessageCallback(function(e) {
|
80 |
-
switch(Object.prototype.toString.call(sourceOrigin)) {
|
81 |
-
case '[object String]':
|
82 |
-
if (sourceOrigin !== e.origin) {
|
83 |
-
return false;
|
84 |
-
}
|
85 |
-
break;
|
86 |
-
case '[object Function]':
|
87 |
-
if (sourceOrigin(e.origin)) {
|
88 |
-
return false;
|
89 |
-
}
|
90 |
-
break;
|
91 |
-
}
|
92 |
-
|
93 |
-
callback(e);
|
94 |
-
});
|
95 |
-
};
|
96 |
-
|
97 |
-
} else {
|
98 |
-
|
99 |
-
this[postBinding] = function(message, targetUrl, target) {
|
100 |
-
if (!targetUrl) {
|
101 |
-
return;
|
102 |
-
}
|
103 |
-
|
104 |
-
// The browser does not support window.postMessage, so set the location
|
105 |
-
// of the target to targetUrl#message. A bit ugly, but it works! A cache
|
106 |
-
// bust parameter is added to ensure that repeat messages trigger the
|
107 |
-
// callback.
|
108 |
-
target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
|
109 |
-
}
|
110 |
-
|
111 |
-
// Since the browser sucks, a polling loop will be started, and the
|
112 |
-
// callback will be called whenever the location.hash changes.
|
113 |
-
this[receiveBinding] = function(callback, sourceOrigin, delay) {
|
114 |
-
if (intervalId) {
|
115 |
-
clearInterval(intervalId);
|
116 |
-
intervalId = null;
|
117 |
-
}
|
118 |
-
|
119 |
-
if (callback) {
|
120 |
-
delay = typeof sourceOrigin === 'number'
|
121 |
-
? sourceOrigin
|
122 |
-
: typeof delay === 'number'
|
123 |
-
? delay
|
124 |
-
: 100;
|
125 |
-
|
126 |
-
intervalId = setInterval(function(){
|
127 |
-
var hash = document.location.hash,
|
128 |
-
re = /^#?\d+&/;
|
129 |
-
if ( hash !== lastHash && re.test( hash ) ) {
|
130 |
-
lastHash = hash;
|
131 |
-
callback({ data: hash.replace( re, '' ) });
|
132 |
-
}
|
133 |
-
}, delay );
|
134 |
-
}
|
135 |
-
};
|
136 |
-
|
137 |
-
}
|
138 |
-
|
139 |
-
return this;
|
140 |
}
|
1 |
+
/*!
|
2 |
+
* jQuery postMessage - v0.5 - 9/11/2009
|
3 |
+
* http://benalman.com/projects/jquery-postmessage-plugin/
|
4 |
+
*
|
5 |
+
* Copyright (c) 2009 "Cowboy" Ben Alman
|
6 |
+
* Dual licensed under the MIT and GPL licenses.
|
7 |
+
* http://benalman.com/about/license/
|
8 |
+
*
|
9 |
+
* Non-jQuery fork by Jeff Lee
|
10 |
+
*
|
11 |
+
* This fork consists of the following changes:
|
12 |
+
* 1. Basic code cleanup and restructuring, for legibility.
|
13 |
+
* 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
|
14 |
+
* in terms of both function names and object scope. Scope is specified by
|
15 |
+
* the the "this" context of NoJQueryPostMessageMixin();
|
16 |
+
* 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
|
17 |
+
* at least three different GitHub users requesting the removal of this
|
18 |
+
* "Opera sniff" on the original project's Issues page, so I figured this
|
19 |
+
* would be a relatively safe change.
|
20 |
+
* 4. `postMessage` no longer uses `$.param` to serialize messages that are not
|
21 |
+
* strings. I actually prefer this structure anyway. `receiveMessage` does
|
22 |
+
* not implement a corresponding deserialization step, and as such it seems
|
23 |
+
* cleaner and more symmetric to leave both data serialization and
|
24 |
+
* deserialization to the client.
|
25 |
+
* 5. The use of `$.isFunction` is replaced by a functionally-identical check.
|
26 |
+
* 6. The `$:nomunge` YUI option is no longer necessary.
|
27 |
+
*/
|
28 |
+
|
29 |
+
function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
|
30 |
+
|
31 |
+
var setMessageCallback, unsetMessageCallback, currentMsgCallback,
|
32 |
+
intervalId, lastHash, cacheBust = 1;
|
33 |
+
|
34 |
+
if (window.postMessage) {
|
35 |
+
|
36 |
+
if (window.addEventListener) {
|
37 |
+
setMessageCallback = function(callback) {
|
38 |
+
window.addEventListener('message', callback, false);
|
39 |
+
}
|
40 |
+
|
41 |
+
unsetMessageCallback = function(callback) {
|
42 |
+
window.removeEventListener('message', callback, false);
|
43 |
+
}
|
44 |
+
} else {
|
45 |
+
setMessageCallback = function(callback) {
|
46 |
+
window.attachEvent('onmessage', callback);
|
47 |
+
}
|
48 |
+
|
49 |
+
unsetMessageCallback = function(callback) {
|
50 |
+
window.detachEvent('onmessage', callback);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
this[postBinding] = function(message, targetUrl, target) {
|
55 |
+
if (!targetUrl) {
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
// The browser supports window.postMessage, so call it with a targetOrigin
|
60 |
+
// set appropriately, based on the targetUrl parameter.
|
61 |
+
target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
// Since the browser supports window.postMessage, the callback will be
|
65 |
+
// bound to the actual event associated with window.postMessage.
|
66 |
+
this[receiveBinding] = function(callback, sourceOrigin, delay) {
|
67 |
+
// Unbind an existing callback if it exists.
|
68 |
+
if (currentMsgCallback) {
|
69 |
+
unsetMessageCallback(currentMsgCallback);
|
70 |
+
currentMsgCallback = null;
|
71 |
+
}
|
72 |
+
|
73 |
+
if (!callback) {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
// Bind the callback. A reference to the callback is stored for ease of
|
78 |
+
// unbinding.
|
79 |
+
currentMsgCallback = setMessageCallback(function(e) {
|
80 |
+
switch(Object.prototype.toString.call(sourceOrigin)) {
|
81 |
+
case '[object String]':
|
82 |
+
if (sourceOrigin !== e.origin) {
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
break;
|
86 |
+
case '[object Function]':
|
87 |
+
if (sourceOrigin(e.origin)) {
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
break;
|
91 |
+
}
|
92 |
+
|
93 |
+
callback(e);
|
94 |
+
});
|
95 |
+
};
|
96 |
+
|
97 |
+
} else {
|
98 |
+
|
99 |
+
this[postBinding] = function(message, targetUrl, target) {
|
100 |
+
if (!targetUrl) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
// The browser does not support window.postMessage, so set the location
|
105 |
+
// of the target to targetUrl#message. A bit ugly, but it works! A cache
|
106 |
+
// bust parameter is added to ensure that repeat messages trigger the
|
107 |
+
// callback.
|
108 |
+
target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
|
109 |
+
}
|
110 |
+
|
111 |
+
// Since the browser sucks, a polling loop will be started, and the
|
112 |
+
// callback will be called whenever the location.hash changes.
|
113 |
+
this[receiveBinding] = function(callback, sourceOrigin, delay) {
|
114 |
+
if (intervalId) {
|
115 |
+
clearInterval(intervalId);
|
116 |
+
intervalId = null;
|
117 |
+
}
|
118 |
+
|
119 |
+
if (callback) {
|
120 |
+
delay = typeof sourceOrigin === 'number'
|
121 |
+
? sourceOrigin
|
122 |
+
: typeof delay === 'number'
|
123 |
+
? delay
|
124 |
+
: 100;
|
125 |
+
|
126 |
+
intervalId = setInterval(function(){
|
127 |
+
var hash = document.location.hash,
|
128 |
+
re = /^#?\d+&/;
|
129 |
+
if ( hash !== lastHash && re.test( hash ) ) {
|
130 |
+
lastHash = hash;
|
131 |
+
callback({ data: hash.replace( re, '' ) });
|
132 |
+
}
|
133 |
+
}, delay );
|
134 |
+
}
|
135 |
+
};
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
return this;
|
140 |
}
|
lib/freemius/assets/js/nojquery.ba-postmessage.min.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
/*
|
2 |
-
* nojquery-postmessage by Jeff Lee
|
3 |
-
* a non-jQuery fork of:
|
4 |
-
*
|
5 |
-
* jQuery postMessage - v0.5 - 9/11/2009
|
6 |
-
* http://benalman.com/projects/jquery-postmessage-plugin/
|
7 |
-
*
|
8 |
-
* Copyright (c) 2009 "Cowboy" Ben Alman
|
9 |
-
* Dual licensed under the MIT and GPL licenses.
|
10 |
-
* http://benalman.com/about/license/
|
11 |
-
*/
|
12 |
function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
|
1 |
+
/*
|
2 |
+
* nojquery-postmessage by Jeff Lee
|
3 |
+
* a non-jQuery fork of:
|
4 |
+
*
|
5 |
+
* jQuery postMessage - v0.5 - 9/11/2009
|
6 |
+
* http://benalman.com/projects/jquery-postmessage-plugin/
|
7 |
+
*
|
8 |
+
* Copyright (c) 2009 "Cowboy" Ben Alman
|
9 |
+
* Dual licensed under the MIT and GPL licenses.
|
10 |
+
* http://benalman.com/about/license/
|
11 |
+
*/
|
12 |
function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
|
lib/freemius/assets/js/postmessage.js
CHANGED
@@ -1,135 +1,135 @@
|
|
1 |
-
(function ($, undef) {
|
2 |
-
var global = this;
|
3 |
-
|
4 |
-
// Namespace.
|
5 |
-
global.FS = global.FS || {};
|
6 |
-
|
7 |
-
global.FS.PostMessage = function ()
|
8 |
-
{
|
9 |
-
var
|
10 |
-
_is_child = false,
|
11 |
-
_postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
|
12 |
-
_callbacks = {},
|
13 |
-
_base_url,
|
14 |
-
_parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
|
15 |
-
_parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
|
16 |
-
_init = function () {
|
17 |
-
_postman.receiveMessage(function (e) {
|
18 |
-
var data = JSON.parse(e.data);
|
19 |
-
|
20 |
-
if (_callbacks[data.type]) {
|
21 |
-
for (var i = 0; i < _callbacks[data.type].length; i++) {
|
22 |
-
// Execute type callbacks.
|
23 |
-
_callbacks[data.type][i](data.data);
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}, _base_url);
|
27 |
-
},
|
28 |
-
_hasParent = ('' !== _parent_url),
|
29 |
-
$window = $(window),
|
30 |
-
$html = $('html');
|
31 |
-
|
32 |
-
return {
|
33 |
-
init : function (url, iframes)
|
34 |
-
{
|
35 |
-
_base_url = url;
|
36 |
-
_init();
|
37 |
-
|
38 |
-
// Automatically receive forward messages.
|
39 |
-
FS.PostMessage.receiveOnce('forward', function (data){
|
40 |
-
window.location = data.url;
|
41 |
-
});
|
42 |
-
|
43 |
-
iframes = iframes || [];
|
44 |
-
|
45 |
-
if (iframes.length > 0) {
|
46 |
-
$window.on('scroll', function () {
|
47 |
-
for (var i = 0; i < iframes.length; i++) {
|
48 |
-
FS.PostMessage.postScroll(iframes[i]);
|
49 |
-
}
|
50 |
-
});
|
51 |
-
}
|
52 |
-
},
|
53 |
-
init_child : function ()
|
54 |
-
{
|
55 |
-
this.init(_parent_subdomain);
|
56 |
-
|
57 |
-
_is_child = true;
|
58 |
-
|
59 |
-
// Post height of a child right after window is loaded.
|
60 |
-
$(window).bind('load', function () {
|
61 |
-
FS.PostMessage.postHeight();
|
62 |
-
|
63 |
-
// Post message that window was loaded.
|
64 |
-
FS.PostMessage.post('loaded');
|
65 |
-
});
|
66 |
-
},
|
67 |
-
hasParent : function ()
|
68 |
-
{
|
69 |
-
return _hasParent;
|
70 |
-
},
|
71 |
-
postHeight : function (diff, wrapper) {
|
72 |
-
diff = diff || 0;
|
73 |
-
wrapper = wrapper || '#wrap_section';
|
74 |
-
this.post('height', {
|
75 |
-
height: diff + $(wrapper).outerHeight(true)
|
76 |
-
});
|
77 |
-
},
|
78 |
-
postScroll : function (iframe) {
|
79 |
-
this.post('scroll', {
|
80 |
-
top: $window.scrollTop(),
|
81 |
-
height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
|
82 |
-
}, iframe);
|
83 |
-
},
|
84 |
-
post : function (type, data, iframe)
|
85 |
-
{
|
86 |
-
console.debug('PostMessage.post', type);
|
87 |
-
|
88 |
-
if (iframe)
|
89 |
-
{
|
90 |
-
// Post to iframe.
|
91 |
-
_postman.postMessage(JSON.stringify({
|
92 |
-
type: type,
|
93 |
-
data: data
|
94 |
-
}), iframe.src, iframe.contentWindow);
|
95 |
-
}
|
96 |
-
else {
|
97 |
-
// Post to parent.
|
98 |
-
_postman.postMessage(JSON.stringify({
|
99 |
-
type: type,
|
100 |
-
data: data
|
101 |
-
}), _parent_url, window.parent);
|
102 |
-
}
|
103 |
-
},
|
104 |
-
receive: function (type, callback)
|
105 |
-
{
|
106 |
-
console.debug('PostMessage.receive', type);
|
107 |
-
|
108 |
-
if (undef === _callbacks[type])
|
109 |
-
_callbacks[type] = [];
|
110 |
-
|
111 |
-
_callbacks[type].push(callback);
|
112 |
-
},
|
113 |
-
receiveOnce: function (type, callback)
|
114 |
-
{
|
115 |
-
if (this.is_set(type))
|
116 |
-
return;
|
117 |
-
|
118 |
-
this.receive(type, callback);
|
119 |
-
},
|
120 |
-
// Check if any callbacks assigned to a specified message type.
|
121 |
-
is_set: function (type)
|
122 |
-
{
|
123 |
-
return (undef != _callbacks[type]);
|
124 |
-
},
|
125 |
-
parent_url: function ()
|
126 |
-
{
|
127 |
-
return _parent_url;
|
128 |
-
},
|
129 |
-
parent_subdomain: function ()
|
130 |
-
{
|
131 |
-
return _parent_subdomain;
|
132 |
-
}
|
133 |
-
};
|
134 |
-
}();
|
135 |
})(jQuery);
|
1 |
+
(function ($, undef) {
|
2 |
+
var global = this;
|
3 |
+
|
4 |
+
// Namespace.
|
5 |
+
global.FS = global.FS || {};
|
6 |
+
|
7 |
+
global.FS.PostMessage = function ()
|
8 |
+
{
|
9 |
+
var
|
10 |
+
_is_child = false,
|
11 |
+
_postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
|
12 |
+
_callbacks = {},
|
13 |
+
_base_url,
|
14 |
+
_parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
|
15 |
+
_parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
|
16 |
+
_init = function () {
|
17 |
+
_postman.receiveMessage(function (e) {
|
18 |
+
var data = JSON.parse(e.data);
|
19 |
+
|
20 |
+
if (_callbacks[data.type]) {
|
21 |
+
for (var i = 0; i < _callbacks[data.type].length; i++) {
|
22 |
+
// Execute type callbacks.
|
23 |
+
_callbacks[data.type][i](data.data);
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}, _base_url);
|
27 |
+
},
|
28 |
+
_hasParent = ('' !== _parent_url),
|
29 |
+
$window = $(window),
|
30 |
+
$html = $('html');
|
31 |
+
|
32 |
+
return {
|
33 |
+
init : function (url, iframes)
|
34 |
+
{
|
35 |
+
_base_url = url;
|
36 |
+
_init();
|
37 |
+
|
38 |
+
// Automatically receive forward messages.
|
39 |
+
FS.PostMessage.receiveOnce('forward', function (data){
|
40 |
+
window.location = data.url;
|
41 |
+
});
|
42 |
+
|
43 |
+
iframes = iframes || [];
|
44 |
+
|
45 |
+
if (iframes.length > 0) {
|
46 |
+
$window.on('scroll', function () {
|
47 |
+
for (var i = 0; i < iframes.length; i++) {
|
48 |
+
FS.PostMessage.postScroll(iframes[i]);
|
49 |
+
}
|
50 |
+
});
|
51 |
+
}
|
52 |
+
},
|
53 |
+
init_child : function ()
|
54 |
+
{
|
55 |
+
this.init(_parent_subdomain);
|
56 |
+
|
57 |
+
_is_child = true;
|
58 |
+
|
59 |
+
// Post height of a child right after window is loaded.
|
60 |
+
$(window).bind('load', function () {
|
61 |
+
FS.PostMessage.postHeight();
|
62 |
+
|
63 |
+
// Post message that window was loaded.
|
64 |
+
FS.PostMessage.post('loaded');
|
65 |
+
});
|
66 |
+
},
|
67 |
+
hasParent : function ()
|
68 |
+
{
|
69 |
+
return _hasParent;
|
70 |
+
},
|
71 |
+
postHeight : function (diff, wrapper) {
|
72 |
+
diff = diff || 0;
|
73 |
+
wrapper = wrapper || '#wrap_section';
|
74 |
+
this.post('height', {
|
75 |
+
height: diff + $(wrapper).outerHeight(true)
|
76 |
+
});
|
77 |
+
},
|
78 |
+
postScroll : function (iframe) {
|
79 |
+
this.post('scroll', {
|
80 |
+
top: $window.scrollTop(),
|
81 |
+
height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
|
82 |
+
}, iframe);
|
83 |
+
},
|
84 |
+
post : function (type, data, iframe)
|
85 |
+
{
|
86 |
+
console.debug('PostMessage.post', type);
|
87 |
+
|
88 |
+
if (iframe)
|
89 |
+
{
|
90 |
+
// Post to iframe.
|
91 |
+
_postman.postMessage(JSON.stringify({
|
92 |
+
type: type,
|
93 |
+
data: data
|
94 |
+
}), iframe.src, iframe.contentWindow);
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
// Post to parent.
|
98 |
+
_postman.postMessage(JSON.stringify({
|
99 |
+
type: type,
|
100 |
+
data: data
|
101 |
+
}), _parent_url, window.parent);
|
102 |
+
}
|
103 |
+
},
|
104 |
+
receive: function (type, callback)
|
105 |
+
{
|
106 |
+
console.debug('PostMessage.receive', type);
|
107 |
+
|
108 |
+
if (undef === _callbacks[type])
|
109 |
+
_callbacks[type] = [];
|
110 |
+
|
111 |
+
_callbacks[type].push(callback);
|
112 |
+
},
|
113 |
+
receiveOnce: function (type, callback)
|
114 |
+
{
|
115 |
+
if (this.is_set(type))
|
116 |
+
return;
|
117 |
+
|
118 |
+
this.receive(type, callback);
|
119 |
+
},
|
120 |
+
// Check if any callbacks assigned to a specified message type.
|
121 |
+
is_set: function (type)
|
122 |
+
{
|
123 |
+
return (undef != _callbacks[type]);
|
124 |
+
},
|
125 |
+
parent_url: function ()
|
126 |
+
{
|
127 |
+
return _parent_url;
|
128 |
+
},
|
129 |
+
parent_subdomain: function ()
|
130 |
+
{
|
131 |
+
return _parent_subdomain;
|
132 |
+
}
|
133 |
+
};
|
134 |
+
}();
|
135 |
})(jQuery);
|
lib/freemius/config.php
CHANGED
@@ -1,391 +1,391 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.4
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if ( ! defined( 'WP_FS__SLUG' ) ) {
|
14 |
-
define( 'WP_FS__SLUG', 'freemius' );
|
15 |
-
}
|
16 |
-
if ( ! defined( 'WP_FS__DEV_MODE' ) ) {
|
17 |
-
define( 'WP_FS__DEV_MODE', false );
|
18 |
-
}
|
19 |
-
|
20 |
-
#--------------------------------------------------------------------------------
|
21 |
-
#region API Connectivity Issues Simulation
|
22 |
-
#--------------------------------------------------------------------------------
|
23 |
-
|
24 |
-
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) {
|
25 |
-
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false );
|
26 |
-
}
|
27 |
-
if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) {
|
28 |
-
define( 'WP_FS__SIMULATE_NO_CURL', false );
|
29 |
-
}
|
30 |
-
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
|
31 |
-
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
|
32 |
-
}
|
33 |
-
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
|
34 |
-
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
|
35 |
-
}
|
36 |
-
if ( WP_FS__SIMULATE_NO_CURL ) {
|
37 |
-
define( 'FS_SDK__SIMULATE_NO_CURL', true );
|
38 |
-
}
|
39 |
-
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
|
40 |
-
define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true );
|
41 |
-
}
|
42 |
-
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
|
43 |
-
define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true );
|
44 |
-
}
|
45 |
-
|
46 |
-
#endregion
|
47 |
-
|
48 |
-
if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) {
|
49 |
-
define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false );
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) {
|
53 |
-
/**
|
54 |
-
* @since 1.1.7.3
|
55 |
-
* @author Vova Feldman (@svovaf)
|
56 |
-
*
|
57 |
-
* I'm not sure if shared servers periodically change IP, or the subdomain of the
|
58 |
-
* admin dashboard. Also, I've seen sites that have strange loop of switching
|
59 |
-
* between domains on a daily basis. Therefore, to eliminate the risk of
|
60 |
-
* multiple unwanted connectivity test pings, temporary ignore domain or
|
61 |
-
* server IP changes.
|
62 |
-
*/
|
63 |
-
define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false );
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* If your dev environment supports custom public network IP setup
|
68 |
-
* like VVV, please update WP_FS__LOCALHOST_IP with your public IP
|
69 |
-
* and uncomment it during dev.
|
70 |
-
*/
|
71 |
-
if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) {
|
72 |
-
// VVV default public network IP.
|
73 |
-
define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' );
|
74 |
-
|
75 |
-
// define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* If true and running with secret key, the opt-in process
|
80 |
-
* will skip the email activation process which is invoked
|
81 |
-
* when the email of the context user already exist in Freemius
|
82 |
-
* database (as a security precaution, to prevent sharing user
|
83 |
-
* secret with unauthorized entity).
|
84 |
-
*
|
85 |
-
* IMPORTANT:
|
86 |
-
* AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST.
|
87 |
-
* THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER,YOUR TESTING ENVIRONMENT'S
|
88 |
-
* CLOCK IS SYNCED.
|
89 |
-
*/
|
90 |
-
if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) {
|
91 |
-
define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false );
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
#--------------------------------------------------------------------------------
|
96 |
-
#region Directories
|
97 |
-
#--------------------------------------------------------------------------------
|
98 |
-
|
99 |
-
if ( ! defined( 'WP_FS__DIR' ) ) {
|
100 |
-
define( 'WP_FS__DIR', dirname( __FILE__ ) );
|
101 |
-
}
|
102 |
-
if ( ! defined( 'WP_FS__DIR_INCLUDES' ) ) {
|
103 |
-
define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' );
|
104 |
-
}
|
105 |
-
if ( ! defined( 'WP_FS__DIR_TEMPLATES' ) ) {
|
106 |
-
define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' );
|
107 |
-
}
|
108 |
-
if ( ! defined( 'WP_FS__DIR_ASSETS' ) ) {
|
109 |
-
define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' );
|
110 |
-
}
|
111 |
-
if ( ! defined( 'WP_FS__DIR_CSS' ) ) {
|
112 |
-
define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' );
|
113 |
-
}
|
114 |
-
if ( ! defined( 'WP_FS__DIR_JS' ) ) {
|
115 |
-
define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' );
|
116 |
-
}
|
117 |
-
if ( ! defined( 'WP_FS__DIR_IMG' ) ) {
|
118 |
-
define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' );
|
119 |
-
}
|
120 |
-
if ( ! defined( 'WP_FS__DIR_SDK' ) ) {
|
121 |
-
define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' );
|
122 |
-
}
|
123 |
-
|
124 |
-
#endregion
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Domain / URL / Address
|
128 |
-
*/
|
129 |
-
define( 'WP_FS__ROOT_DOMAIN_PRODUCTION', 'freemius.com' );
|
130 |
-
define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' );
|
131 |
-
define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
|
132 |
-
|
133 |
-
if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
|
134 |
-
define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
|
135 |
-
}
|
136 |
-
if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
|
137 |
-
define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
|
138 |
-
}
|
139 |
-
|
140 |
-
if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
|
141 |
-
define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
|
142 |
-
}
|
143 |
-
|
144 |
-
#--------------------------------------------------------------------------------
|
145 |
-
#region HTTP
|
146 |
-
#--------------------------------------------------------------------------------
|
147 |
-
|
148 |
-
if ( ! defined( 'WP_FS__IS_HTTP_REQUEST' ) ) {
|
149 |
-
define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
|
150 |
-
}
|
151 |
-
|
152 |
-
if ( ! defined( 'WP_FS__IS_HTTPS' ) ) {
|
153 |
-
define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
|
154 |
-
// Checks if CloudFlare's HTTPS (Flexible SSL support).
|
155 |
-
isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
|
156 |
-
'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
|
157 |
-
) ||
|
158 |
-
// Check if HTTPS request.
|
159 |
-
( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
|
160 |
-
( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
|
161 |
-
);
|
162 |
-
}
|
163 |
-
|
164 |
-
if ( ! defined( 'WP_FS__IS_POST_REQUEST' ) ) {
|
165 |
-
define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
|
166 |
-
strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
|
167 |
-
}
|
168 |
-
|
169 |
-
if ( ! defined( 'WP_FS__REMOTE_ADDR' ) ) {
|
170 |
-
define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
|
171 |
-
}
|
172 |
-
|
173 |
-
if ( ! defined( 'WP_FS__IS_LOCALHOST' ) ) {
|
174 |
-
if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
|
175 |
-
define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
|
176 |
-
} else {
|
177 |
-
define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
|
178 |
-
is_string( WP_FS__REMOTE_ADDR ) &&
|
179 |
-
( substr( WP_FS__REMOTE_ADDR, 0, 4 ) === '127.' ||
|
180 |
-
WP_FS__REMOTE_ADDR === '::1' )
|
181 |
-
);
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
if ( ! defined( 'WP_FS__IS_LOCALHOST_FOR_SERVER' ) ) {
|
186 |
-
define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
|
187 |
-
false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
|
188 |
-
}
|
189 |
-
|
190 |
-
#endregion
|
191 |
-
|
192 |
-
if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
|
193 |
-
// By default, run with Freemius production servers.
|
194 |
-
define( 'WP_FS__IS_PRODUCTION_MODE', true );
|
195 |
-
}
|
196 |
-
|
197 |
-
if ( ! defined( 'WP_FS__ADDRESS' ) ) {
|
198 |
-
define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
|
199 |
-
}
|
200 |
-
|
201 |
-
|
202 |
-
#--------------------------------------------------------------------------------
|
203 |
-
#region API
|
204 |
-
#--------------------------------------------------------------------------------
|
205 |
-
|
206 |
-
if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
|
207 |
-
define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius-local.com:8080' );
|
208 |
-
}
|
209 |
-
if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
|
210 |
-
define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
|
211 |
-
}
|
212 |
-
|
213 |
-
// Set API address for local testing.
|
214 |
-
if ( ! WP_FS__IS_PRODUCTION_MODE ) {
|
215 |
-
if ( ! defined( 'FS_API__ADDRESS' ) ) {
|
216 |
-
define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
|
217 |
-
}
|
218 |
-
if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
|
219 |
-
define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
#endregion
|
224 |
-
|
225 |
-
#--------------------------------------------------------------------------------
|
226 |
-
#region Checkout
|
227 |
-
#--------------------------------------------------------------------------------
|
228 |
-
|
229 |
-
if ( ! defined( 'FS_CHECKOUT__ADDRESS_PRODUCTION' ) ) {
|
230 |
-
define( 'FS_CHECKOUT__ADDRESS_PRODUCTION', 'https://checkout.freemius.com' );
|
231 |
-
}
|
232 |
-
|
233 |
-
if ( ! defined( 'FS_CHECKOUT__ADDRESS_LOCALHOST' ) ) {
|
234 |
-
define( 'FS_CHECKOUT__ADDRESS_LOCALHOST', 'http://checkout.freemius-local.com:8080' );
|
235 |
-
}
|
236 |
-
|
237 |
-
if ( ! defined( 'FS_CHECKOUT__ADDRESS' ) ) {
|
238 |
-
define( 'FS_CHECKOUT__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? FS_CHECKOUT__ADDRESS_PRODUCTION : FS_CHECKOUT__ADDRESS_LOCALHOST ) );
|
239 |
-
}
|
240 |
-
|
241 |
-
#endregion
|
242 |
-
|
243 |
-
define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
|
244 |
-
|
245 |
-
if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
|
246 |
-
define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
|
247 |
-
}
|
248 |
-
if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
|
249 |
-
define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
|
250 |
-
}
|
251 |
-
if ( ! defined( 'WP_FS__GDPR_OPTION_NAME' ) ) {
|
252 |
-
define( 'WP_FS__GDPR_OPTION_NAME', WP_FS___OPTION_PREFIX . 'gdpr' );
|
253 |
-
}
|
254 |
-
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Module types
|
258 |
-
*
|
259 |
-
* @since 1.2.2
|
260 |
-
*/
|
261 |
-
define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
|
262 |
-
define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Billing Frequencies
|
266 |
-
*/
|
267 |
-
define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
|
268 |
-
define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
|
269 |
-
define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
|
270 |
-
|
271 |
-
/**
|
272 |
-
* Plans
|
273 |
-
*/
|
274 |
-
define( 'WP_FS__PLAN_DEFAULT_PAID', false );
|
275 |
-
define( 'WP_FS__PLAN_FREE', 'free' );
|
276 |
-
define( 'WP_FS__PLAN_TRIAL', 'trial' );
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Times in seconds
|
280 |
-
*/
|
281 |
-
if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
|
282 |
-
define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
|
283 |
-
}
|
284 |
-
if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
|
285 |
-
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
|
286 |
-
}
|
287 |
-
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
|
288 |
-
if ( ! defined( 'WP_FS__TIME_12_HOURS_IN_SEC' ) ) {
|
289 |
-
define( 'WP_FS__TIME_12_HOURS_IN_SEC', 43200 );
|
290 |
-
}
|
291 |
-
if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
|
292 |
-
define( 'WP_FS__TIME_24_HOURS_IN_SEC', WP_FS__TIME_12_HOURS_IN_SEC * 2 );
|
293 |
-
}
|
294 |
-
if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
|
295 |
-
define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
|
296 |
-
}
|
297 |
-
|
298 |
-
#--------------------------------------------------------------------------------
|
299 |
-
#region Debugging
|
300 |
-
#--------------------------------------------------------------------------------
|
301 |
-
|
302 |
-
if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
|
303 |
-
$debug_mode = get_option( 'fs_debug_mode', null );
|
304 |
-
|
305 |
-
if ( $debug_mode === null ) {
|
306 |
-
$debug_mode = false;
|
307 |
-
add_option( 'fs_debug_mode', $debug_mode );
|
308 |
-
}
|
309 |
-
|
310 |
-
define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
|
311 |
-
}
|
312 |
-
|
313 |
-
if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
|
314 |
-
define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
|
315 |
-
}
|
316 |
-
if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
|
317 |
-
define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
|
318 |
-
}
|
319 |
-
if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
|
320 |
-
define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
|
321 |
-
}
|
322 |
-
|
323 |
-
if ( WP_FS__ECHO_DEBUG_SDK ) {
|
324 |
-
error_reporting( E_ALL );
|
325 |
-
}
|
326 |
-
|
327 |
-
#endregion
|
328 |
-
|
329 |
-
if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
|
330 |
-
define( 'WP_FS__SCRIPT_START_TIME', time() );
|
331 |
-
}
|
332 |
-
if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
|
333 |
-
define( 'WP_FS__DEFAULT_PRIORITY', 10 );
|
334 |
-
}
|
335 |
-
if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
|
336 |
-
define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
|
337 |
-
}
|
338 |
-
|
339 |
-
#--------------------------------------------------------------------------------
|
340 |
-
#region Multisite Network
|
341 |
-
#--------------------------------------------------------------------------------
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Do not use this define directly, it will have the wrong value
|
345 |
-
* during plugin uninstall/deletion when the inclusion of the plugin
|
346 |
-
* is triggered due to registration with register_uninstall_hook().
|
347 |
-
*
|
348 |
-
* Instead, use fs_is_network_admin().
|
349 |
-
*
|
350 |
-
* @author Vova Feldman (@svovaf)
|
351 |
-
*/
|
352 |
-
if ( ! defined( 'WP_FS__IS_NETWORK_ADMIN' ) ) {
|
353 |
-
define( 'WP_FS__IS_NETWORK_ADMIN',
|
354 |
-
is_multisite() &&
|
355 |
-
( is_network_admin() ||
|
356 |
-
( ( defined( 'DOING_AJAX' ) && DOING_AJAX &&
|
357 |
-
( isset( $_REQUEST['_fs_network_admin'] ) && 'true' === $_REQUEST['_fs_network_admin'] /*||
|
358 |
-
( ! empty( $_REQUEST['action'] ) && 'delete-plugin' === $_REQUEST['action'] )*/ )
|
359 |
-
) ||
|
360 |
-
// Plugin uninstall.
|
361 |
-
defined( 'WP_UNINSTALL_PLUGIN' ) )
|
362 |
-
)
|
363 |
-
);
|
364 |
-
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Do not use this define directly, it will have the wrong value
|
368 |
-
* during plugin uninstall/deletion when the inclusion of the plugin
|
369 |
-
* is triggered due to registration with register_uninstall_hook().
|
370 |
-
*
|
371 |
-
* Instead, use fs_is_blog_admin().
|
372 |
-
*
|
373 |
-
* @author Vova Feldman (@svovaf)
|
374 |
-
*/
|
375 |
-
if ( ! defined( 'WP_FS__IS_BLOG_ADMIN' ) ) {
|
376 |
-
define( 'WP_FS__IS_BLOG_ADMIN', is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['_fs_blog_admin'] ) ) );
|
377 |
-
}
|
378 |
-
|
379 |
-
if ( ! defined( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED' ) ) {
|
380 |
-
// Set to true to show network level settings even if delegated to site admins.
|
381 |
-
define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
|
382 |
-
}
|
383 |
-
|
384 |
-
#endregion
|
385 |
-
|
386 |
-
if ( ! defined( 'WP_FS__DEMO_MODE' ) ) {
|
387 |
-
define( 'WP_FS__DEMO_MODE', false );
|
388 |
-
}
|
389 |
-
if ( ! defined( 'FS_SDK__SSLVERIFY' ) ) {
|
390 |
-
define( 'FS_SDK__SSLVERIFY', false );
|
391 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.4
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( ! defined( 'WP_FS__SLUG' ) ) {
|
14 |
+
define( 'WP_FS__SLUG', 'freemius' );
|
15 |
+
}
|
16 |
+
if ( ! defined( 'WP_FS__DEV_MODE' ) ) {
|
17 |
+
define( 'WP_FS__DEV_MODE', false );
|
18 |
+
}
|
19 |
+
|
20 |
+
#--------------------------------------------------------------------------------
|
21 |
+
#region API Connectivity Issues Simulation
|
22 |
+
#--------------------------------------------------------------------------------
|
23 |
+
|
24 |
+
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY' ) ) {
|
25 |
+
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY', false );
|
26 |
+
}
|
27 |
+
if ( ! defined( 'WP_FS__SIMULATE_NO_CURL' ) ) {
|
28 |
+
define( 'WP_FS__SIMULATE_NO_CURL', false );
|
29 |
+
}
|
30 |
+
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
|
31 |
+
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
|
32 |
+
}
|
33 |
+
if ( ! defined( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
|
34 |
+
define( 'WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
|
35 |
+
}
|
36 |
+
if ( WP_FS__SIMULATE_NO_CURL ) {
|
37 |
+
define( 'FS_SDK__SIMULATE_NO_CURL', true );
|
38 |
+
}
|
39 |
+
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
|
40 |
+
define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', true );
|
41 |
+
}
|
42 |
+
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
|
43 |
+
define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', true );
|
44 |
+
}
|
45 |
+
|
46 |
+
#endregion
|
47 |
+
|
48 |
+
if ( ! defined( 'WP_FS__SIMULATE_FREEMIUS_OFF' ) ) {
|
49 |
+
define( 'WP_FS__SIMULATE_FREEMIUS_OFF', false );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( ! defined( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES' ) ) {
|
53 |
+
/**
|
54 |
+
* @since 1.1.7.3
|
55 |
+
* @author Vova Feldman (@svovaf)
|
56 |
+
*
|
57 |
+
* I'm not sure if shared servers periodically change IP, or the subdomain of the
|
58 |
+
* admin dashboard. Also, I've seen sites that have strange loop of switching
|
59 |
+
* between domains on a daily basis. Therefore, to eliminate the risk of
|
60 |
+
* multiple unwanted connectivity test pings, temporary ignore domain or
|
61 |
+
* server IP changes.
|
62 |
+
*/
|
63 |
+
define( 'WP_FS__PING_API_ON_IP_OR_HOST_CHANGES', false );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* If your dev environment supports custom public network IP setup
|
68 |
+
* like VVV, please update WP_FS__LOCALHOST_IP with your public IP
|
69 |
+
* and uncomment it during dev.
|
70 |
+
*/
|
71 |
+
if ( ! defined( 'WP_FS__LOCALHOST_IP' ) ) {
|
72 |
+
// VVV default public network IP.
|
73 |
+
define( 'WP_FS__VVV_DEFAULT_PUBLIC_IP', '192.168.50.4' );
|
74 |
+
|
75 |
+
// define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* If true and running with secret key, the opt-in process
|
80 |
+
* will skip the email activation process which is invoked
|
81 |
+
* when the email of the context user already exist in Freemius
|
82 |
+
* database (as a security precaution, to prevent sharing user
|
83 |
+
* secret with unauthorized entity).
|
84 |
+
*
|
85 |
+
* IMPORTANT:
|
86 |
+
* AS A SECURITY PRECAUTION, WE VALIDATE THE TIMESTAMP OF THE OPT-IN REQUEST.
|
87 |
+
* THEREFORE, MAKE SURE THAT WHEN USING THIS PARAMETER,YOUR TESTING ENVIRONMENT'S
|
88 |
+
* CLOCK IS SYNCED.
|
89 |
+
*/
|
90 |
+
if ( ! defined( 'WP_FS__SKIP_EMAIL_ACTIVATION' ) ) {
|
91 |
+
define( 'WP_FS__SKIP_EMAIL_ACTIVATION', false );
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
#--------------------------------------------------------------------------------
|
96 |
+
#region Directories
|
97 |
+
#--------------------------------------------------------------------------------
|
98 |
+
|
99 |
+
if ( ! defined( 'WP_FS__DIR' ) ) {
|
100 |
+
define( 'WP_FS__DIR', dirname( __FILE__ ) );
|
101 |
+
}
|
102 |
+
if ( ! defined( 'WP_FS__DIR_INCLUDES' ) ) {
|
103 |
+
define( 'WP_FS__DIR_INCLUDES', WP_FS__DIR . '/includes' );
|
104 |
+
}
|
105 |
+
if ( ! defined( 'WP_FS__DIR_TEMPLATES' ) ) {
|
106 |
+
define( 'WP_FS__DIR_TEMPLATES', WP_FS__DIR . '/templates' );
|
107 |
+
}
|
108 |
+
if ( ! defined( 'WP_FS__DIR_ASSETS' ) ) {
|
109 |
+
define( 'WP_FS__DIR_ASSETS', WP_FS__DIR . '/assets' );
|
110 |
+
}
|
111 |
+
if ( ! defined( 'WP_FS__DIR_CSS' ) ) {
|
112 |
+
define( 'WP_FS__DIR_CSS', WP_FS__DIR_ASSETS . '/css' );
|
113 |
+
}
|
114 |
+
if ( ! defined( 'WP_FS__DIR_JS' ) ) {
|
115 |
+
define( 'WP_FS__DIR_JS', WP_FS__DIR_ASSETS . '/js' );
|
116 |
+
}
|
117 |
+
if ( ! defined( 'WP_FS__DIR_IMG' ) ) {
|
118 |
+
define( 'WP_FS__DIR_IMG', WP_FS__DIR_ASSETS . '/img' );
|
119 |
+
}
|
120 |
+
if ( ! defined( 'WP_FS__DIR_SDK' ) ) {
|
121 |
+
define( 'WP_FS__DIR_SDK', WP_FS__DIR_INCLUDES . '/sdk' );
|
122 |
+
}
|
123 |
+
|
124 |
+
#endregion
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Domain / URL / Address
|
128 |
+
*/
|
129 |
+
define( 'WP_FS__ROOT_DOMAIN_PRODUCTION', 'freemius.com' );
|
130 |
+
define( 'WP_FS__DOMAIN_PRODUCTION', 'wp.freemius.com' );
|
131 |
+
define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
|
132 |
+
|
133 |
+
if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
|
134 |
+
define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
|
135 |
+
}
|
136 |
+
if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
|
137 |
+
define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
|
141 |
+
define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
|
142 |
+
}
|
143 |
+
|
144 |
+
#--------------------------------------------------------------------------------
|
145 |
+
#region HTTP
|
146 |
+
#--------------------------------------------------------------------------------
|
147 |
+
|
148 |
+
if ( ! defined( 'WP_FS__IS_HTTP_REQUEST' ) ) {
|
149 |
+
define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( ! defined( 'WP_FS__IS_HTTPS' ) ) {
|
153 |
+
define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
|
154 |
+
// Checks if CloudFlare's HTTPS (Flexible SSL support).
|
155 |
+
isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
|
156 |
+
'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
|
157 |
+
) ||
|
158 |
+
// Check if HTTPS request.
|
159 |
+
( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
|
160 |
+
( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
|
161 |
+
);
|
162 |
+
}
|
163 |
+
|
164 |
+
if ( ! defined( 'WP_FS__IS_POST_REQUEST' ) ) {
|
165 |
+
define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
|
166 |
+
strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
|
167 |
+
}
|
168 |
+
|
169 |
+
if ( ! defined( 'WP_FS__REMOTE_ADDR' ) ) {
|
170 |
+
define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
|
171 |
+
}
|
172 |
+
|
173 |
+
if ( ! defined( 'WP_FS__IS_LOCALHOST' ) ) {
|
174 |
+
if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
|
175 |
+
define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
|
176 |
+
} else {
|
177 |
+
define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
|
178 |
+
is_string( WP_FS__REMOTE_ADDR ) &&
|
179 |
+
( substr( WP_FS__REMOTE_ADDR, 0, 4 ) === '127.' ||
|
180 |
+
WP_FS__REMOTE_ADDR === '::1' )
|
181 |
+
);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
if ( ! defined( 'WP_FS__IS_LOCALHOST_FOR_SERVER' ) ) {
|
186 |
+
define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
|
187 |
+
false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
|
188 |
+
}
|
189 |
+
|
190 |
+
#endregion
|
191 |
+
|
192 |
+
if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
|
193 |
+
// By default, run with Freemius production servers.
|
194 |
+
define( 'WP_FS__IS_PRODUCTION_MODE', true );
|
195 |
+
}
|
196 |
+
|
197 |
+
if ( ! defined( 'WP_FS__ADDRESS' ) ) {
|
198 |
+
define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
#--------------------------------------------------------------------------------
|
203 |
+
#region API
|
204 |
+
#--------------------------------------------------------------------------------
|
205 |
+
|
206 |
+
if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
|
207 |
+
define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius-local.com:8080' );
|
208 |
+
}
|
209 |
+
if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
|
210 |
+
define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
|
211 |
+
}
|
212 |
+
|
213 |
+
// Set API address for local testing.
|
214 |
+
if ( ! WP_FS__IS_PRODUCTION_MODE ) {
|
215 |
+
if ( ! defined( 'FS_API__ADDRESS' ) ) {
|
216 |
+
define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
|
217 |
+
}
|
218 |
+
if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
|
219 |
+
define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
#endregion
|
224 |
+
|
225 |
+
#--------------------------------------------------------------------------------
|
226 |
+
#region Checkout
|
227 |
+
#--------------------------------------------------------------------------------
|
228 |
+
|
229 |
+
if ( ! defined( 'FS_CHECKOUT__ADDRESS_PRODUCTION' ) ) {
|
230 |
+
define( 'FS_CHECKOUT__ADDRESS_PRODUCTION', 'https://checkout.freemius.com' );
|
231 |
+
}
|
232 |
+
|
233 |
+
if ( ! defined( 'FS_CHECKOUT__ADDRESS_LOCALHOST' ) ) {
|
234 |
+
define( 'FS_CHECKOUT__ADDRESS_LOCALHOST', 'http://checkout.freemius-local.com:8080' );
|
235 |
+
}
|
236 |
+
|
237 |
+
if ( ! defined( 'FS_CHECKOUT__ADDRESS' ) ) {
|
238 |
+
define( 'FS_CHECKOUT__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? FS_CHECKOUT__ADDRESS_PRODUCTION : FS_CHECKOUT__ADDRESS_LOCALHOST ) );
|
239 |
+
}
|
240 |
+
|
241 |
+
#endregion
|
242 |
+
|
243 |
+
define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
|
244 |
+
|
245 |
+
if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
|
246 |
+
define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
|
247 |
+
}
|
248 |
+
if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
|
249 |
+
define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
|
250 |
+
}
|
251 |
+
if ( ! defined( 'WP_FS__GDPR_OPTION_NAME' ) ) {
|
252 |
+
define( 'WP_FS__GDPR_OPTION_NAME', WP_FS___OPTION_PREFIX . 'gdpr' );
|
253 |
+
}
|
254 |
+
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Module types
|
258 |
+
*
|
259 |
+
* @since 1.2.2
|
260 |
+
*/
|
261 |
+
define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
|
262 |
+
define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Billing Frequencies
|
266 |
+
*/
|
267 |
+
define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
|
268 |
+
define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
|
269 |
+
define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Plans
|
273 |
+
*/
|
274 |
+
define( 'WP_FS__PLAN_DEFAULT_PAID', false );
|
275 |
+
define( 'WP_FS__PLAN_FREE', 'free' );
|
276 |
+
define( 'WP_FS__PLAN_TRIAL', 'trial' );
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Times in seconds
|
280 |
+
*/
|
281 |
+
if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
|
282 |
+
define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
|
283 |
+
}
|
284 |
+
if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
|
285 |
+
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
|
286 |
+
}
|
287 |
+
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
|
288 |
+
if ( ! defined( 'WP_FS__TIME_12_HOURS_IN_SEC' ) ) {
|
289 |
+
define( 'WP_FS__TIME_12_HOURS_IN_SEC', 43200 );
|
290 |
+
}
|
291 |
+
if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
|
292 |
+
define( 'WP_FS__TIME_24_HOURS_IN_SEC', WP_FS__TIME_12_HOURS_IN_SEC * 2 );
|
293 |
+
}
|
294 |
+
if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
|
295 |
+
define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
|
296 |
+
}
|
297 |
+
|
298 |
+
#--------------------------------------------------------------------------------
|
299 |
+
#region Debugging
|
300 |
+
#--------------------------------------------------------------------------------
|
301 |
+
|
302 |
+
if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
|
303 |
+
$debug_mode = get_option( 'fs_debug_mode', null );
|
304 |
+
|
305 |
+
if ( $debug_mode === null ) {
|
306 |
+
$debug_mode = false;
|
307 |
+
add_option( 'fs_debug_mode', $debug_mode );
|
308 |
+
}
|
309 |
+
|
310 |
+
define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
|
311 |
+
}
|
312 |
+
|
313 |
+
if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
|
314 |
+
define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
|
315 |
+
}
|
316 |
+
if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
|
317 |
+
define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
|
318 |
+
}
|
319 |
+
if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
|
320 |
+
define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( WP_FS__ECHO_DEBUG_SDK ) {
|
324 |
+
error_reporting( E_ALL );
|
325 |
+
}
|
326 |
+
|
327 |
+
#endregion
|
328 |
+
|
329 |
+
if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
|
330 |
+
define( 'WP_FS__SCRIPT_START_TIME', time() );
|
331 |
+
}
|
332 |
+
if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
|
333 |
+
define( 'WP_FS__DEFAULT_PRIORITY', 10 );
|
334 |
+
}
|
335 |
+
if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
|
336 |
+
define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
|
337 |
+
}
|
338 |
+
|
339 |
+
#--------------------------------------------------------------------------------
|
340 |
+
#region Multisite Network
|
341 |
+
#--------------------------------------------------------------------------------
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Do not use this define directly, it will have the wrong value
|
345 |
+
* during plugin uninstall/deletion when the inclusion of the plugin
|
346 |
+
* is triggered due to registration with register_uninstall_hook().
|
347 |
+
*
|
348 |
+
* Instead, use fs_is_network_admin().
|
349 |
+
*
|
350 |
+
* @author Vova Feldman (@svovaf)
|
351 |
+
*/
|
352 |
+
if ( ! defined( 'WP_FS__IS_NETWORK_ADMIN' ) ) {
|
353 |
+
define( 'WP_FS__IS_NETWORK_ADMIN',
|
354 |
+
is_multisite() &&
|
355 |
+
( is_network_admin() ||
|
356 |
+
( ( defined( 'DOING_AJAX' ) && DOING_AJAX &&
|
357 |
+
( isset( $_REQUEST['_fs_network_admin'] ) && 'true' === $_REQUEST['_fs_network_admin'] /*||
|
358 |
+
( ! empty( $_REQUEST['action'] ) && 'delete-plugin' === $_REQUEST['action'] )*/ )
|
359 |
+
) ||
|
360 |
+
// Plugin uninstall.
|
361 |
+
defined( 'WP_UNINSTALL_PLUGIN' ) )
|
362 |
+
)
|
363 |
+
);
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Do not use this define directly, it will have the wrong value
|
368 |
+
* during plugin uninstall/deletion when the inclusion of the plugin
|
369 |
+
* is triggered due to registration with register_uninstall_hook().
|
370 |
+
*
|
371 |
+
* Instead, use fs_is_blog_admin().
|
372 |
+
*
|
373 |
+
* @author Vova Feldman (@svovaf)
|
374 |
+
*/
|
375 |
+
if ( ! defined( 'WP_FS__IS_BLOG_ADMIN' ) ) {
|
376 |
+
define( 'WP_FS__IS_BLOG_ADMIN', is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['_fs_blog_admin'] ) ) );
|
377 |
+
}
|
378 |
+
|
379 |
+
if ( ! defined( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED' ) ) {
|
380 |
+
// Set to true to show network level settings even if delegated to site admins.
|
381 |
+
define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
|
382 |
+
}
|
383 |
+
|
384 |
+
#endregion
|
385 |
+
|
386 |
+
if ( ! defined( 'WP_FS__DEMO_MODE' ) ) {
|
387 |
+
define( 'WP_FS__DEMO_MODE', false );
|
388 |
+
}
|
389 |
+
if ( ! defined( 'FS_SDK__SSLVERIFY' ) ) {
|
390 |
+
define( 'FS_SDK__SSLVERIFY', false );
|
391 |
+
}
|
lib/freemius/includes/class-freemius-abstract.php
CHANGED
@@ -1,597 +1,597 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.7
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* - Each instance of Freemius class represents a single plugin
|
16 |
-
* install by a single user (the installer of the plugin).
|
17 |
-
*
|
18 |
-
* - Each website can only have one install of the same plugin.
|
19 |
-
*
|
20 |
-
* - Install entity is only created after a user connects his account with Freemius.
|
21 |
-
*
|
22 |
-
* Class Freemius_Abstract
|
23 |
-
*/
|
24 |
-
abstract class Freemius_Abstract {
|
25 |
-
|
26 |
-
#----------------------------------------------------------------------------------
|
27 |
-
#region Identity
|
28 |
-
#----------------------------------------------------------------------------------
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Check if user has connected his account (opted-in).
|
32 |
-
*
|
33 |
-
* Note:
|
34 |
-
* If the user opted-in and opted-out on a later stage,
|
35 |
-
* this will still return true. If you want to check if the
|
36 |
-
* user is currently opted-in, use:
|
37 |
-
* `$fs->is_registered() && $fs->is_tracking_allowed()`
|
38 |
-
*
|
39 |
-
* @since 1.0.1
|
40 |
-
* @return bool
|
41 |
-
*/
|
42 |
-
abstract function is_registered();
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Check if the user skipped connecting the account with Freemius.
|
46 |
-
*
|
47 |
-
* @since 1.0.7
|
48 |
-
*
|
49 |
-
* @return bool
|
50 |
-
*/
|
51 |
-
abstract function is_anonymous();
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Check if the user currently in activation mode.
|
55 |
-
*
|
56 |
-
* @since 1.0.7
|
57 |
-
*
|
58 |
-
* @return bool
|
59 |
-
*/
|
60 |
-
abstract function is_activation_mode();
|
61 |
-
|
62 |
-
#endregion
|
63 |
-
|
64 |
-
#----------------------------------------------------------------------------------
|
65 |
-
#region Usage Tracking
|
66 |
-
#----------------------------------------------------------------------------------
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Returns TRUE if the user opted-in and didn't disconnect (opt-out).
|
70 |
-
*
|
71 |
-
* @author Leo Fajardo (@leorw)
|
72 |
-
* @since 1.2.1.5
|
73 |
-
*
|
74 |
-
* @return bool
|
75 |
-
*/
|
76 |
-
abstract function is_tracking_allowed();
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Returns TRUE if the user never opted-in or manually opted-out.
|
80 |
-
*
|
81 |
-
* @author Vova Feldman (@svovaf)
|
82 |
-
* @since 1.2.1.5
|
83 |
-
*
|
84 |
-
* @return bool
|
85 |
-
*/
|
86 |
-
function is_tracking_prohibited() {
|
87 |
-
return ! $this->is_registered() || ! $this->is_tracking_allowed();
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Opt-out from usage tracking.
|
92 |
-
*
|
93 |
-
* Note: This will not delete the account information but will stop all tracking.
|
94 |
-
*
|
95 |
-
* Returns:
|
96 |
-
* 1. FALSE - If the user never opted-in.
|
97 |
-
* 2. TRUE - If successfully opted-out.
|
98 |
-
* 3. object - API Result on failure.
|
99 |
-
*
|
100 |
-
* @author Leo Fajardo (@leorw)
|
101 |
-
* @since 1.2.1.5
|
102 |
-
*
|
103 |
-
* @return bool|object
|
104 |
-
*/
|
105 |
-
abstract function stop_tracking();
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Opt-in back into usage tracking.
|
109 |
-
*
|
110 |
-
* Note: This will only work if the user opted-in previously.
|
111 |
-
*
|
112 |
-
* Returns:
|
113 |
-
* 1. FALSE - If the user never opted-in.
|
114 |
-
* 2. TRUE - If successfully opted-in back to usage tracking.
|
115 |
-
* 3. object - API result on failure.
|
116 |
-
*
|
117 |
-
* @author Leo Fajardo (@leorw)
|
118 |
-
* @since 1.2.1.5
|
119 |
-
*
|
120 |
-
* @return bool|object
|
121 |
-
*/
|
122 |
-
abstract function allow_tracking();
|
123 |
-
|
124 |
-
#endregion
|
125 |
-
|
126 |
-
#----------------------------------------------------------------------------------
|
127 |
-
#region Module Type
|
128 |
-
#----------------------------------------------------------------------------------
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Checks if the plugin's type is "plugin". The other type is "theme".
|
132 |
-
*
|
133 |
-
* @author Leo Fajardo (@leorw)
|
134 |
-
* @since 1.2.2
|
135 |
-
*
|
136 |
-
* @return bool
|
137 |
-
*/
|
138 |
-
abstract function is_plugin();
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Checks if the module type is "theme". The other type is "plugin".
|
142 |
-
*
|
143 |
-
* @author Leo Fajardo (@leorw)
|
144 |
-
* @since 1.2.2
|
145 |
-
*
|
146 |
-
* @return bool
|
147 |
-
*/
|
148 |
-
function is_theme() {
|
149 |
-
return ( ! $this->is_plugin() );
|
150 |
-
}
|
151 |
-
|
152 |
-
#endregion
|
153 |
-
|
154 |
-
#----------------------------------------------------------------------------------
|
155 |
-
#region Permissions
|
156 |
-
#----------------------------------------------------------------------------------
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Check if plugin must be WordPress.org compliant.
|
160 |
-
*
|
161 |
-
* @since 1.0.7
|
162 |
-
*
|
163 |
-
* @return bool
|
164 |
-
*/
|
165 |
-
abstract function is_org_repo_compliant();
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Check if plugin is allowed to install executable files.
|
169 |
-
*
|
170 |
-
* @author Vova Feldman (@svovaf)
|
171 |
-
* @since 1.0.5
|
172 |
-
*
|
173 |
-
* @return bool
|
174 |
-
*/
|
175 |
-
function is_allowed_to_install() {
|
176 |
-
return ( $this->is_premium() || ! $this->is_org_repo_compliant() );
|
177 |
-
}
|
178 |
-
|
179 |
-
#endregion
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Check if user in trial or in free plan (not paying).
|
183 |
-
*
|
184 |
-
* @author Vova Feldman (@svovaf)
|
185 |
-
* @since 1.0.4
|
186 |
-
*
|
187 |
-
* @return bool
|
188 |
-
*/
|
189 |
-
function is_not_paying() {
|
190 |
-
return ( $this->is_trial() || $this->is_free_plan() );
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Check if the user has an activated and valid paid license on current plugin's install.
|
195 |
-
*
|
196 |
-
* @since 1.0.9
|
197 |
-
*
|
198 |
-
* @return bool
|
199 |
-
*/
|
200 |
-
abstract function is_paying();
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Check if the user is paying or in trial.
|
204 |
-
*
|
205 |
-
* @since 1.0.9
|
206 |
-
*
|
207 |
-
* @return bool
|
208 |
-
*/
|
209 |
-
function is_paying_or_trial() {
|
210 |
-
return ( $this->is_paying() || $this->is_trial() );
|
211 |
-
}
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Check if user in a trial or have feature enabled license.
|
215 |
-
*
|
216 |
-
* @author Vova Feldman (@svovaf)
|
217 |
-
* @since 1.1.7
|
218 |
-
*
|
219 |
-
* @return bool
|
220 |
-
*/
|
221 |
-
abstract function can_use_premium_code();
|
222 |
-
|
223 |
-
#----------------------------------------------------------------------------------
|
224 |
-
#region Premium Only
|
225 |
-
#----------------------------------------------------------------------------------
|
226 |
-
|
227 |
-
/**
|
228 |
-
* All logic wrapped in methods with "__premium_only()" suffix will be only
|
229 |
-
* included in the premium code.
|
230 |
-
*
|
231 |
-
* Example:
|
232 |
-
* if ( freemius()->is__premium_only() ) {
|
233 |
-
* ...
|
234 |
-
* }
|
235 |
-
*/
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Returns true when running premium plugin code.
|
239 |
-
*
|
240 |
-
* @since 1.0.9
|
241 |
-
*
|
242 |
-
* @return bool
|
243 |
-
*/
|
244 |
-
function is__premium_only() {
|
245 |
-
return $this->is_premium();
|
246 |
-
}
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Check if the user has an activated and valid paid license on current plugin's install.
|
250 |
-
*
|
251 |
-
* @since 1.0.9
|
252 |
-
*
|
253 |
-
* @return bool
|
254 |
-
*
|
255 |
-
*/
|
256 |
-
function is_paying__premium_only() {
|
257 |
-
return ( $this->is__premium_only() && $this->is_paying() );
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* All code wrapped in this statement will be only included in the premium code.
|
262 |
-
*
|
263 |
-
* @since 1.0.9
|
264 |
-
*
|
265 |
-
* @param string $plan Plan name.
|
266 |
-
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
267 |
-
*
|
268 |
-
* @return bool
|
269 |
-
*/
|
270 |
-
function is_plan__premium_only( $plan, $exact = false ) {
|
271 |
-
return ( $this->is_premium() && $this->is_plan( $plan, $exact ) );
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Check if plan matches active license' plan or active trial license' plan.
|
276 |
-
*
|
277 |
-
* All code wrapped in this statement will be only included in the premium code.
|
278 |
-
*
|
279 |
-
* @since 1.0.9
|
280 |
-
*
|
281 |
-
* @param string $plan Plan name.
|
282 |
-
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
283 |
-
*
|
284 |
-
* @return bool
|
285 |
-
*/
|
286 |
-
function is_plan_or_trial__premium_only( $plan, $exact = false ) {
|
287 |
-
return ( $this->is_premium() && $this->is_plan_or_trial( $plan, $exact ) );
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Check if the user is paying or in trial.
|
292 |
-
*
|
293 |
-
* All code wrapped in this statement will be only included in the premium code.
|
294 |
-
*
|
295 |
-
* @since 1.0.9
|
296 |
-
*
|
297 |
-
* @return bool
|
298 |
-
*/
|
299 |
-
function is_paying_or_trial__premium_only() {
|
300 |
-
return $this->is_premium() && $this->is_paying_or_trial();
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Check if the user has an activated and valid paid license on current plugin's install.
|
305 |
-
*
|
306 |
-
* @since 1.0.4
|
307 |
-
*
|
308 |
-
* @return bool
|
309 |
-
*
|
310 |
-
* @deprecated Method name is confusing since it's not clear from the name the code will be removed.
|
311 |
-
* @using Alias to is_paying__premium_only()
|
312 |
-
*/
|
313 |
-
function is_paying__fs__() {
|
314 |
-
return $this->is_paying__premium_only();
|
315 |
-
}
|
316 |
-
|
317 |
-
/**
|
318 |
-
* Check if user in a trial or have feature enabled license.
|
319 |
-
*
|
320 |
-
* All code wrapped in this statement will be only included in the premium code.
|
321 |
-
*
|
322 |
-
* @author Vova Feldman (@svovaf)
|
323 |
-
* @since 1.1.9
|
324 |
-
*
|
325 |
-
* @return bool
|
326 |
-
*/
|
327 |
-
function can_use_premium_code__premium_only() {
|
328 |
-
return $this->is_premium() && $this->can_use_premium_code();
|
329 |
-
}
|
330 |
-
|
331 |
-
#endregion
|
332 |
-
|
333 |
-
#----------------------------------------------------------------------------------
|
334 |
-
#region Trial
|
335 |
-
#----------------------------------------------------------------------------------
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Check if the user in a trial.
|
339 |
-
*
|
340 |
-
* @since 1.0.3
|
341 |
-
*
|
342 |
-
* @return bool
|
343 |
-
*/
|
344 |
-
abstract function is_trial();
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Check if trial already utilized.
|
348 |
-
*
|
349 |
-
* @since 1.0.9
|
350 |
-
*
|
351 |
-
* @return bool
|
352 |
-
*/
|
353 |
-
abstract function is_trial_utilized();
|
354 |
-
|
355 |
-
#endregion
|
356 |
-
|
357 |
-
#----------------------------------------------------------------------------------
|
358 |
-
#region Plans
|
359 |
-
#----------------------------------------------------------------------------------
|
360 |
-
|
361 |
-
/**
|
362 |
-
* Check if the user is on the free plan of the product.
|
363 |
-
*
|
364 |
-
* @since 1.0.4
|
365 |
-
*
|
366 |
-
* @return bool
|
367 |
-
*/
|
368 |
-
abstract function is_free_plan();
|
369 |
-
|
370 |
-
/**
|
371 |
-
* @since 1.0.2
|
372 |
-
*
|
373 |
-
* @param string $plan Plan name.
|
374 |
-
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
375 |
-
*
|
376 |
-
* @return bool
|
377 |
-
*/
|
378 |
-
abstract function is_plan( $plan, $exact = false );
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Check if plan based on trial. If not in trial mode, should return false.
|
382 |
-
*
|
383 |
-
* @since 1.0.9
|
384 |
-
*
|
385 |
-
* @param string $plan Plan name.
|
386 |
-
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
387 |
-
*
|
388 |
-
* @return bool
|
389 |
-
*/
|
390 |
-
abstract function is_trial_plan( $plan, $exact = false );
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Check if plan matches active license' plan or active trial license' plan.
|
394 |
-
*
|
395 |
-
* @since 1.0.9
|
396 |
-
*
|
397 |
-
* @param string $plan Plan name.
|
398 |
-
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
399 |
-
*
|
400 |
-
* @return bool
|
401 |
-
*/
|
402 |
-
function is_plan_or_trial( $plan, $exact = false ) {
|
403 |
-
return $this->is_plan( $plan, $exact ) ||
|
404 |
-
$this->is_trial_plan( $plan, $exact );
|
405 |
-
}
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Check if plugin has any paid plans.
|
409 |
-
*
|
410 |
-
* @author Vova Feldman (@svovaf)
|
411 |
-
* @since 1.0.7
|
412 |
-
*
|
413 |
-
* @return bool
|
414 |
-
*/
|
415 |
-
abstract function has_paid_plan();
|
416 |
-
|
417 |
-
/**
|
418 |
-
* Check if plugin has any free plan, or is it premium only.
|
419 |
-
*
|
420 |
-
* Note: If no plans configured, assume plugin is free.
|
421 |
-
*
|
422 |
-
* @author Vova Feldman (@svovaf)
|
423 |
-
* @since 1.0.7
|
424 |
-
*
|
425 |
-
* @return bool
|
426 |
-
*/
|
427 |
-
abstract function has_free_plan();
|
428 |
-
|
429 |
-
/**
|
430 |
-
* Check if plugin is premium only (no free plans).
|
431 |
-
*
|
432 |
-
* NOTE: is__premium_only() is very different method, don't get confused.
|
433 |
-
*
|
434 |
-
* @author Vova Feldman (@svovaf)
|
435 |
-
* @since 1.1.9
|
436 |
-
*
|
437 |
-
* @return bool
|
438 |
-
*/
|
439 |
-
abstract function is_only_premium();
|
440 |
-
|
441 |
-
/**
|
442 |
-
* Check if module has a premium code version.
|
443 |
-
*
|
444 |
-
* Serviceware module might be freemium without any
|
445 |
-
* premium code version, where the paid features
|
446 |
-
* are all part of the service.
|
447 |
-
*
|
448 |
-
* @author Vova Feldman (@svovaf)
|
449 |
-
* @since 1.2.1.6
|
450 |
-
*
|
451 |
-
* @return bool
|
452 |
-
*/
|
453 |
-
abstract function has_premium_version();
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Check if module has any release on Freemius,
|
457 |
-
* or all plugin's code is on WordPress.org (Serviceware).
|
458 |
-
*
|
459 |
-
* @return bool
|
460 |
-
*/
|
461 |
-
function has_release_on_freemius() {
|
462 |
-
return ! $this->is_org_repo_compliant() ||
|
463 |
-
$this->has_premium_version();
|
464 |
-
}
|
465 |
-
|
466 |
-
/**
|
467 |
-
* Checks if it's a freemium plugin.
|
468 |
-
*
|
469 |
-
* @author Vova Feldman (@svovaf)
|
470 |
-
* @since 1.1.9
|
471 |
-
*
|
472 |
-
* @return bool
|
473 |
-
*/
|
474 |
-
function is_freemium() {
|
475 |
-
return $this->has_paid_plan() &&
|
476 |
-
$this->has_free_plan();
|
477 |
-
}
|
478 |
-
|
479 |
-
/**
|
480 |
-
* Check if module has only one plan.
|
481 |
-
*
|
482 |
-
* @author Vova Feldman (@svovaf)
|
483 |
-
* @since 1.2.1.7
|
484 |
-
*
|
485 |
-
* @return bool
|
486 |
-
*/
|
487 |
-
abstract function is_single_plan();
|
488 |
-
|
489 |
-
#endregion
|
490 |
-
|
491 |
-
/**
|
492 |
-
* Check if running payments in sandbox mode.
|
493 |
-
*
|
494 |
-
* @since 1.0.4
|
495 |
-
*
|
496 |
-
* @return bool
|
497 |
-
*/
|
498 |
-
abstract function is_payments_sandbox();
|
499 |
-
|
500 |
-
/**
|
501 |
-
* Check if running test vs. live plugin.
|
502 |
-
*
|
503 |
-
* @since 1.0.5
|
504 |
-
*
|
505 |
-
* @return bool
|
506 |
-
*/
|
507 |
-
abstract function is_live();
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Check if running premium plugin code.
|
511 |
-
*
|
512 |
-
* @since 1.0.5
|
513 |
-
*
|
514 |
-
* @return bool
|
515 |
-
*/
|
516 |
-
abstract function is_premium();
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Get upgrade URL.
|
520 |
-
*
|
521 |
-
* @author Vova Feldman (@svovaf)
|
522 |
-
* @since 1.0.2
|
523 |
-
*
|
524 |
-
* @param string $period Billing cycle.
|
525 |
-
*
|
526 |
-
* @return string
|
527 |
-
*/
|
528 |
-
abstract function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY );
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Check if Freemius was first added in a plugin update.
|
532 |
-
*
|
533 |
-
* @author Vova Feldman (@svovaf)
|
534 |
-
* @since 1.1.5
|
535 |
-
*
|
536 |
-
* @return bool
|
537 |
-
*/
|
538 |
-
function is_plugin_update() {
|
539 |
-
return ! $this->is_plugin_new_install();
|
540 |
-
}
|
541 |
-
|
542 |
-
/**
|
543 |
-
* Check if Freemius was part of the plugin when the user installed it first.
|
544 |
-
*
|
545 |
-
* @author Vova Feldman (@svovaf)
|
546 |
-
* @since 1.1.5
|
547 |
-
*
|
548 |
-
* @return bool
|
549 |
-
*/
|
550 |
-
abstract function is_plugin_new_install();
|
551 |
-
|
552 |
-
#----------------------------------------------------------------------------------
|
553 |
-
#region Marketing
|
554 |
-
#----------------------------------------------------------------------------------
|
555 |
-
|
556 |
-
/**
|
557 |
-
* Check if current user purchased any other plugins before.
|
558 |
-
*
|
559 |
-
* @author Vova Feldman (@svovaf)
|
560 |
-
* @since 1.0.9
|
561 |
-
*
|
562 |
-
* @return bool
|
563 |
-
*/
|
564 |
-
abstract function has_purchased_before();
|
565 |
-
|
566 |
-
/**
|
567 |
-
* Check if current user classified as an agency.
|
568 |
-
*
|
569 |
-
* @author Vova Feldman (@svovaf)
|
570 |
-
* @since 1.0.9
|
571 |
-
*
|
572 |
-
* @return bool
|
573 |
-
*/
|
574 |
-
abstract function is_agency();
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Check if current user classified as a developer.
|
578 |
-
*
|
579 |
-
* @author Vova Feldman (@svovaf)
|
580 |
-
* @since 1.0.9
|
581 |
-
*
|
582 |
-
* @return bool
|
583 |
-
*/
|
584 |
-
abstract function is_developer();
|
585 |
-
|
586 |
-
/**
|
587 |
-
* Check if current user classified as a business.
|
588 |
-
*
|
589 |
-
* @author Vova Feldman (@svovaf)
|
590 |
-
* @since 1.0.9
|
591 |
-
*
|
592 |
-
* @return bool
|
593 |
-
*/
|
594 |
-
abstract function is_business();
|
595 |
-
|
596 |
-
#endregion
|
597 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* - Each instance of Freemius class represents a single plugin
|
16 |
+
* install by a single user (the installer of the plugin).
|
17 |
+
*
|
18 |
+
* - Each website can only have one install of the same plugin.
|
19 |
+
*
|
20 |
+
* - Install entity is only created after a user connects his account with Freemius.
|
21 |
+
*
|
22 |
+
* Class Freemius_Abstract
|
23 |
+
*/
|
24 |
+
abstract class Freemius_Abstract {
|
25 |
+
|
26 |
+
#----------------------------------------------------------------------------------
|
27 |
+
#region Identity
|
28 |
+
#----------------------------------------------------------------------------------
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Check if user has connected his account (opted-in).
|
32 |
+
*
|
33 |
+
* Note:
|
34 |
+
* If the user opted-in and opted-out on a later stage,
|
35 |
+
* this will still return true. If you want to check if the
|
36 |
+
* user is currently opted-in, use:
|
37 |
+
* `$fs->is_registered() && $fs->is_tracking_allowed()`
|
38 |
+
*
|
39 |
+
* @since 1.0.1
|
40 |
+
* @return bool
|
41 |
+
*/
|
42 |
+
abstract function is_registered();
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Check if the user skipped connecting the account with Freemius.
|
46 |
+
*
|
47 |
+
* @since 1.0.7
|
48 |
+
*
|
49 |
+
* @return bool
|
50 |
+
*/
|
51 |
+
abstract function is_anonymous();
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Check if the user currently in activation mode.
|
55 |
+
*
|
56 |
+
* @since 1.0.7
|
57 |
+
*
|
58 |
+
* @return bool
|
59 |
+
*/
|
60 |
+
abstract function is_activation_mode();
|
61 |
+
|
62 |
+
#endregion
|
63 |
+
|
64 |
+
#----------------------------------------------------------------------------------
|
65 |
+
#region Usage Tracking
|
66 |
+
#----------------------------------------------------------------------------------
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Returns TRUE if the user opted-in and didn't disconnect (opt-out).
|
70 |
+
*
|
71 |
+
* @author Leo Fajardo (@leorw)
|
72 |
+
* @since 1.2.1.5
|
73 |
+
*
|
74 |
+
* @return bool
|
75 |
+
*/
|
76 |
+
abstract function is_tracking_allowed();
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Returns TRUE if the user never opted-in or manually opted-out.
|
80 |
+
*
|
81 |
+
* @author Vova Feldman (@svovaf)
|
82 |
+
* @since 1.2.1.5
|
83 |
+
*
|
84 |
+
* @return bool
|
85 |
+
*/
|
86 |
+
function is_tracking_prohibited() {
|
87 |
+
return ! $this->is_registered() || ! $this->is_tracking_allowed();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Opt-out from usage tracking.
|
92 |
+
*
|
93 |
+
* Note: This will not delete the account information but will stop all tracking.
|
94 |
+
*
|
95 |
+
* Returns:
|
96 |
+
* 1. FALSE - If the user never opted-in.
|
97 |
+
* 2. TRUE - If successfully opted-out.
|
98 |
+
* 3. object - API Result on failure.
|
99 |
+
*
|
100 |
+
* @author Leo Fajardo (@leorw)
|
101 |
+
* @since 1.2.1.5
|
102 |
+
*
|
103 |
+
* @return bool|object
|
104 |
+
*/
|
105 |
+
abstract function stop_tracking();
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Opt-in back into usage tracking.
|
109 |
+
*
|
110 |
+
* Note: This will only work if the user opted-in previously.
|
111 |
+
*
|
112 |
+
* Returns:
|
113 |
+
* 1. FALSE - If the user never opted-in.
|
114 |
+
* 2. TRUE - If successfully opted-in back to usage tracking.
|
115 |
+
* 3. object - API result on failure.
|
116 |
+
*
|
117 |
+
* @author Leo Fajardo (@leorw)
|
118 |
+
* @since 1.2.1.5
|
119 |
+
*
|
120 |
+
* @return bool|object
|
121 |
+
*/
|
122 |
+
abstract function allow_tracking();
|
123 |
+
|
124 |
+
#endregion
|
125 |
+
|
126 |
+
#----------------------------------------------------------------------------------
|
127 |
+
#region Module Type
|
128 |
+
#----------------------------------------------------------------------------------
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Checks if the plugin's type is "plugin". The other type is "theme".
|
132 |
+
*
|
133 |
+
* @author Leo Fajardo (@leorw)
|
134 |
+
* @since 1.2.2
|
135 |
+
*
|
136 |
+
* @return bool
|
137 |
+
*/
|
138 |
+
abstract function is_plugin();
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Checks if the module type is "theme". The other type is "plugin".
|
142 |
+
*
|
143 |
+
* @author Leo Fajardo (@leorw)
|
144 |
+
* @since 1.2.2
|
145 |
+
*
|
146 |
+
* @return bool
|
147 |
+
*/
|
148 |
+
function is_theme() {
|
149 |
+
return ( ! $this->is_plugin() );
|
150 |
+
}
|
151 |
+
|
152 |
+
#endregion
|
153 |
+
|
154 |
+
#----------------------------------------------------------------------------------
|
155 |
+
#region Permissions
|
156 |
+
#----------------------------------------------------------------------------------
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Check if plugin must be WordPress.org compliant.
|
160 |
+
*
|
161 |
+
* @since 1.0.7
|
162 |
+
*
|
163 |
+
* @return bool
|
164 |
+
*/
|
165 |
+
abstract function is_org_repo_compliant();
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Check if plugin is allowed to install executable files.
|
169 |
+
*
|
170 |
+
* @author Vova Feldman (@svovaf)
|
171 |
+
* @since 1.0.5
|
172 |
+
*
|
173 |
+
* @return bool
|
174 |
+
*/
|
175 |
+
function is_allowed_to_install() {
|
176 |
+
return ( $this->is_premium() || ! $this->is_org_repo_compliant() );
|
177 |
+
}
|
178 |
+
|
179 |
+
#endregion
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Check if user in trial or in free plan (not paying).
|
183 |
+
*
|
184 |
+
* @author Vova Feldman (@svovaf)
|
185 |
+
* @since 1.0.4
|
186 |
+
*
|
187 |
+
* @return bool
|
188 |
+
*/
|
189 |
+
function is_not_paying() {
|
190 |
+
return ( $this->is_trial() || $this->is_free_plan() );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Check if the user has an activated and valid paid license on current plugin's install.
|
195 |
+
*
|
196 |
+
* @since 1.0.9
|
197 |
+
*
|
198 |
+
* @return bool
|
199 |
+
*/
|
200 |
+
abstract function is_paying();
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Check if the user is paying or in trial.
|
204 |
+
*
|
205 |
+
* @since 1.0.9
|
206 |
+
*
|
207 |
+
* @return bool
|
208 |
+
*/
|
209 |
+
function is_paying_or_trial() {
|
210 |
+
return ( $this->is_paying() || $this->is_trial() );
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Check if user in a trial or have feature enabled license.
|
215 |
+
*
|
216 |
+
* @author Vova Feldman (@svovaf)
|
217 |
+
* @since 1.1.7
|
218 |
+
*
|
219 |
+
* @return bool
|
220 |
+
*/
|
221 |
+
abstract function can_use_premium_code();
|
222 |
+
|
223 |
+
#----------------------------------------------------------------------------------
|
224 |
+
#region Premium Only
|
225 |
+
#----------------------------------------------------------------------------------
|
226 |
+
|
227 |
+
/**
|
228 |
+
* All logic wrapped in methods with "__premium_only()" suffix will be only
|
229 |
+
* included in the premium code.
|
230 |
+
*
|
231 |
+
* Example:
|
232 |
+
* if ( freemius()->is__premium_only() ) {
|
233 |
+
* ...
|
234 |
+
* }
|
235 |
+
*/
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Returns true when running premium plugin code.
|
239 |
+
*
|
240 |
+
* @since 1.0.9
|
241 |
+
*
|
242 |
+
* @return bool
|
243 |
+
*/
|
244 |
+
function is__premium_only() {
|
245 |
+
return $this->is_premium();
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Check if the user has an activated and valid paid license on current plugin's install.
|
250 |
+
*
|
251 |
+
* @since 1.0.9
|
252 |
+
*
|
253 |
+
* @return bool
|
254 |
+
*
|
255 |
+
*/
|
256 |
+
function is_paying__premium_only() {
|
257 |
+
return ( $this->is__premium_only() && $this->is_paying() );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* All code wrapped in this statement will be only included in the premium code.
|
262 |
+
*
|
263 |
+
* @since 1.0.9
|
264 |
+
*
|
265 |
+
* @param string $plan Plan name.
|
266 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
function is_plan__premium_only( $plan, $exact = false ) {
|
271 |
+
return ( $this->is_premium() && $this->is_plan( $plan, $exact ) );
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Check if plan matches active license' plan or active trial license' plan.
|
276 |
+
*
|
277 |
+
* All code wrapped in this statement will be only included in the premium code.
|
278 |
+
*
|
279 |
+
* @since 1.0.9
|
280 |
+
*
|
281 |
+
* @param string $plan Plan name.
|
282 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
283 |
+
*
|
284 |
+
* @return bool
|
285 |
+
*/
|
286 |
+
function is_plan_or_trial__premium_only( $plan, $exact = false ) {
|
287 |
+
return ( $this->is_premium() && $this->is_plan_or_trial( $plan, $exact ) );
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Check if the user is paying or in trial.
|
292 |
+
*
|
293 |
+
* All code wrapped in this statement will be only included in the premium code.
|
294 |
+
*
|
295 |
+
* @since 1.0.9
|
296 |
+
*
|
297 |
+
* @return bool
|
298 |
+
*/
|
299 |
+
function is_paying_or_trial__premium_only() {
|
300 |
+
return $this->is_premium() && $this->is_paying_or_trial();
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Check if the user has an activated and valid paid license on current plugin's install.
|
305 |
+
*
|
306 |
+
* @since 1.0.4
|
307 |
+
*
|
308 |
+
* @return bool
|
309 |
+
*
|
310 |
+
* @deprecated Method name is confusing since it's not clear from the name the code will be removed.
|
311 |
+
* @using Alias to is_paying__premium_only()
|
312 |
+
*/
|
313 |
+
function is_paying__fs__() {
|
314 |
+
return $this->is_paying__premium_only();
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Check if user in a trial or have feature enabled license.
|
319 |
+
*
|
320 |
+
* All code wrapped in this statement will be only included in the premium code.
|
321 |
+
*
|
322 |
+
* @author Vova Feldman (@svovaf)
|
323 |
+
* @since 1.1.9
|
324 |
+
*
|
325 |
+
* @return bool
|
326 |
+
*/
|
327 |
+
function can_use_premium_code__premium_only() {
|
328 |
+
return $this->is_premium() && $this->can_use_premium_code();
|
329 |
+
}
|
330 |
+
|
331 |
+
#endregion
|
332 |
+
|
333 |
+
#----------------------------------------------------------------------------------
|
334 |
+
#region Trial
|
335 |
+
#----------------------------------------------------------------------------------
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Check if the user in a trial.
|
339 |
+
*
|
340 |
+
* @since 1.0.3
|
341 |
+
*
|
342 |
+
* @return bool
|
343 |
+
*/
|
344 |
+
abstract function is_trial();
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Check if trial already utilized.
|
348 |
+
*
|
349 |
+
* @since 1.0.9
|
350 |
+
*
|
351 |
+
* @return bool
|
352 |
+
*/
|
353 |
+
abstract function is_trial_utilized();
|
354 |
+
|
355 |
+
#endregion
|
356 |
+
|
357 |
+
#----------------------------------------------------------------------------------
|
358 |
+
#region Plans
|
359 |
+
#----------------------------------------------------------------------------------
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Check if the user is on the free plan of the product.
|
363 |
+
*
|
364 |
+
* @since 1.0.4
|
365 |
+
*
|
366 |
+
* @return bool
|
367 |
+
*/
|
368 |
+
abstract function is_free_plan();
|
369 |
+
|
370 |
+
/**
|
371 |
+
* @since 1.0.2
|
372 |
+
*
|
373 |
+
* @param string $plan Plan name.
|
374 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
375 |
+
*
|
376 |
+
* @return bool
|
377 |
+
*/
|
378 |
+
abstract function is_plan( $plan, $exact = false );
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Check if plan based on trial. If not in trial mode, should return false.
|
382 |
+
*
|
383 |
+
* @since 1.0.9
|
384 |
+
*
|
385 |
+
* @param string $plan Plan name.
|
386 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
387 |
+
*
|
388 |
+
* @return bool
|
389 |
+
*/
|
390 |
+
abstract function is_trial_plan( $plan, $exact = false );
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Check if plan matches active license' plan or active trial license' plan.
|
394 |
+
*
|
395 |
+
* @since 1.0.9
|
396 |
+
*
|
397 |
+
* @param string $plan Plan name.
|
398 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
399 |
+
*
|
400 |
+
* @return bool
|
401 |
+
*/
|
402 |
+
function is_plan_or_trial( $plan, $exact = false ) {
|
403 |
+
return $this->is_plan( $plan, $exact ) ||
|
404 |
+
$this->is_trial_plan( $plan, $exact );
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Check if plugin has any paid plans.
|
409 |
+
*
|
410 |
+
* @author Vova Feldman (@svovaf)
|
411 |
+
* @since 1.0.7
|
412 |
+
*
|
413 |
+
* @return bool
|
414 |
+
*/
|
415 |
+
abstract function has_paid_plan();
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Check if plugin has any free plan, or is it premium only.
|
419 |
+
*
|
420 |
+
* Note: If no plans configured, assume plugin is free.
|
421 |
+
*
|
422 |
+
* @author Vova Feldman (@svovaf)
|
423 |
+
* @since 1.0.7
|
424 |
+
*
|
425 |
+
* @return bool
|
426 |
+
*/
|
427 |
+
abstract function has_free_plan();
|
428 |
+
|
429 |
+
/**
|
430 |
+
* Check if plugin is premium only (no free plans).
|
431 |
+
*
|
432 |
+
* NOTE: is__premium_only() is very different method, don't get confused.
|
433 |
+
*
|
434 |
+
* @author Vova Feldman (@svovaf)
|
435 |
+
* @since 1.1.9
|
436 |
+
*
|
437 |
+
* @return bool
|
438 |
+
*/
|
439 |
+
abstract function is_only_premium();
|
440 |
+
|
441 |
+
/**
|
442 |
+
* Check if module has a premium code version.
|
443 |
+
*
|
444 |
+
* Serviceware module might be freemium without any
|
445 |
+
* premium code version, where the paid features
|
446 |
+
* are all part of the service.
|
447 |
+
*
|
448 |
+
* @author Vova Feldman (@svovaf)
|
449 |
+
* @since 1.2.1.6
|
450 |
+
*
|
451 |
+
* @return bool
|
452 |
+
*/
|
453 |
+
abstract function has_premium_version();
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Check if module has any release on Freemius,
|
457 |
+
* or all plugin's code is on WordPress.org (Serviceware).
|
458 |
+
*
|
459 |
+
* @return bool
|
460 |
+
*/
|
461 |
+
function has_release_on_freemius() {
|
462 |
+
return ! $this->is_org_repo_compliant() ||
|
463 |
+
$this->has_premium_version();
|
464 |
+
}
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Checks if it's a freemium plugin.
|
468 |
+
*
|
469 |
+
* @author Vova Feldman (@svovaf)
|
470 |
+
* @since 1.1.9
|
471 |
+
*
|
472 |
+
* @return bool
|
473 |
+
*/
|
474 |
+
function is_freemium() {
|
475 |
+
return $this->has_paid_plan() &&
|
476 |
+
$this->has_free_plan();
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Check if module has only one plan.
|
481 |
+
*
|
482 |
+
* @author Vova Feldman (@svovaf)
|
483 |
+
* @since 1.2.1.7
|
484 |
+
*
|
485 |
+
* @return bool
|
486 |
+
*/
|
487 |
+
abstract function is_single_plan();
|
488 |
+
|
489 |
+
#endregion
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Check if running payments in sandbox mode.
|
493 |
+
*
|
494 |
+
* @since 1.0.4
|
495 |
+
*
|
496 |
+
* @return bool
|
497 |
+
*/
|
498 |
+
abstract function is_payments_sandbox();
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Check if running test vs. live plugin.
|
502 |
+
*
|
503 |
+
* @since 1.0.5
|
504 |
+
*
|
505 |
+
* @return bool
|
506 |
+
*/
|
507 |
+
abstract function is_live();
|
508 |
+
|
509 |
+
/**
|
510 |
+
* Check if running premium plugin code.
|
511 |
+
*
|
512 |
+
* @since 1.0.5
|
513 |
+
*
|
514 |
+
* @return bool
|
515 |
+
*/
|
516 |
+
abstract function is_premium();
|
517 |
+
|
518 |
+
/**
|
519 |
+
* Get upgrade URL.
|
520 |
+
*
|
521 |
+
* @author Vova Feldman (@svovaf)
|
522 |
+
* @since 1.0.2
|
523 |
+
*
|
524 |
+
* @param string $period Billing cycle.
|
525 |
+
*
|
526 |
+
* @return string
|
527 |
+
*/
|
528 |
+
abstract function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY );
|
529 |
+
|
530 |
+
/**
|
531 |
+
* Check if Freemius was first added in a plugin update.
|
532 |
+
*
|
533 |
+
* @author Vova Feldman (@svovaf)
|
534 |
+
* @since 1.1.5
|
535 |
+
*
|
536 |
+
* @return bool
|
537 |
+
*/
|
538 |
+
function is_plugin_update() {
|
539 |
+
return ! $this->is_plugin_new_install();
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* Check if Freemius was part of the plugin when the user installed it first.
|
544 |
+
*
|
545 |
+
* @author Vova Feldman (@svovaf)
|
546 |
+
* @since 1.1.5
|
547 |
+
*
|
548 |
+
* @return bool
|
549 |
+
*/
|
550 |
+
abstract function is_plugin_new_install();
|
551 |
+
|
552 |
+
#----------------------------------------------------------------------------------
|
553 |
+
#region Marketing
|
554 |
+
#----------------------------------------------------------------------------------
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Check if current user purchased any other plugins before.
|
558 |
+
*
|
559 |
+
* @author Vova Feldman (@svovaf)
|
560 |
+
* @since 1.0.9
|
561 |
+
*
|
562 |
+
* @return bool
|
563 |
+
*/
|
564 |
+
abstract function has_purchased_before();
|
565 |
+
|
566 |
+
/**
|
567 |
+
* Check if current user classified as an agency.
|
568 |
+
*
|
569 |
+
* @author Vova Feldman (@svovaf)
|
570 |
+
* @since 1.0.9
|
571 |
+
*
|
572 |
+
* @return bool
|
573 |
+
*/
|
574 |
+
abstract function is_agency();
|
575 |
+
|
576 |
+
/**
|
577 |
+
* Check if current user classified as a developer.
|
578 |
+
*
|
579 |
+
* @author Vova Feldman (@svovaf)
|
580 |
+
* @since 1.0.9
|
581 |
+
*
|
582 |
+
* @return bool
|
583 |
+
*/
|
584 |
+
abstract function is_developer();
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Check if current user classified as a business.
|
588 |
+
*
|
589 |
+
* @author Vova Feldman (@svovaf)
|
590 |
+
* @since 1.0.9
|
591 |
+
*
|
592 |
+
* @return bool
|
593 |
+
*/
|
594 |
+
abstract function is_business();
|
595 |
+
|
596 |
+
#endregion
|
597 |
}
|
lib/freemius/includes/class-fs-admin-notices.php
CHANGED
@@ -1,352 +1,352 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* WP Admin notices manager both for site level and network level.
|
15 |
-
*
|
16 |
-
* Class FS_Admin_Notices
|
17 |
-
*/
|
18 |
-
class FS_Admin_Notices {
|
19 |
-
/**
|
20 |
-
* @since 1.2.2
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
protected $_module_unique_affix;
|
25 |
-
/**
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
protected $_id;
|
29 |
-
/**
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
protected $_title;
|
33 |
-
/**
|
34 |
-
* @var FS_Admin_Notice_Manager
|
35 |
-
*/
|
36 |
-
protected $_notices;
|
37 |
-
/**
|
38 |
-
* @var FS_Admin_Notice_Manager
|
39 |
-
*/
|
40 |
-
protected $_network_notices;
|
41 |
-
/**
|
42 |
-
* @var int The ID of the blog that is associated with the current site level options.
|
43 |
-
*/
|
44 |
-
private $_blog_id = 0;
|
45 |
-
/**
|
46 |
-
* @var bool
|
47 |
-
*/
|
48 |
-
private $_is_multisite;
|
49 |
-
/**
|
50 |
-
* @var FS_Admin_Notices[]
|
51 |
-
*/
|
52 |
-
private static $_instances = array();
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @param string $id
|
56 |
-
* @param string $title
|
57 |
-
* @param string $module_unique_affix
|
58 |
-
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
59 |
-
* blog admin pages.
|
60 |
-
*
|
61 |
-
* @return FS_Admin_Notices
|
62 |
-
*/
|
63 |
-
static function instance( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
|
64 |
-
if ( ! isset( self::$_instances[ $id ] ) ) {
|
65 |
-
self::$_instances[ $id ] = new FS_Admin_Notices( $id, $title, $module_unique_affix, $is_network_and_blog_admins );
|
66 |
-
}
|
67 |
-
|
68 |
-
return self::$_instances[ $id ];
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param string $id
|
73 |
-
* @param string $title
|
74 |
-
* @param string $module_unique_affix
|
75 |
-
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
76 |
-
* blog admin pages.
|
77 |
-
*/
|
78 |
-
protected function __construct( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
|
79 |
-
$this->_id = $id;
|
80 |
-
$this->_title = $title;
|
81 |
-
$this->_module_unique_affix = $module_unique_affix;
|
82 |
-
$this->_is_multisite = is_multisite();
|
83 |
-
|
84 |
-
if ( $this->_is_multisite ) {
|
85 |
-
$this->_blog_id = get_current_blog_id();
|
86 |
-
|
87 |
-
$this->_network_notices = FS_Admin_Notice_Manager::instance(
|
88 |
-
$id,
|
89 |
-
$title,
|
90 |
-
$module_unique_affix,
|
91 |
-
$is_network_and_blog_admins,
|
92 |
-
true
|
93 |
-
);
|
94 |
-
}
|
95 |
-
|
96 |
-
$this->_notices = FS_Admin_Notice_Manager::instance(
|
97 |
-
$id,
|
98 |
-
$title,
|
99 |
-
$module_unique_affix,
|
100 |
-
false,
|
101 |
-
$this->_blog_id
|
102 |
-
);
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Add admin message to admin messages queue, and hook to admin_notices / all_admin_notices if not yet hooked.
|
107 |
-
*
|
108 |
-
* @author Vova Feldman (@svovaf)
|
109 |
-
* @since 1.0.4
|
110 |
-
*
|
111 |
-
* @param string $message
|
112 |
-
* @param string $title
|
113 |
-
* @param string $type
|
114 |
-
* @param bool $is_sticky
|
115 |
-
* @param string $id Message ID
|
116 |
-
* @param bool $store_if_sticky
|
117 |
-
* @param int|null $network_level_or_blog_id
|
118 |
-
*
|
119 |
-
* @uses add_action()
|
120 |
-
*/
|
121 |
-
function add(
|
122 |
-
$message,
|
123 |
-
$title = '',
|
124 |
-
$type = 'success',
|
125 |
-
$is_sticky = false,
|
126 |
-
$id = '',
|
127 |
-
$store_if_sticky = true,
|
128 |
-
$network_level_or_blog_id = null,
|
129 |
-
$is_dimissible = null
|
130 |
-
) {
|
131 |
-
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
132 |
-
|
133 |
-
$notices->add(
|
134 |
-
$message,
|
135 |
-
$title,
|
136 |
-
$type,
|
137 |
-
$is_sticky,
|
138 |
-
$id,
|
139 |
-
$store_if_sticky,
|
140 |
-
null,
|
141 |
-
null,
|
142 |
-
false,
|
143 |
-
$is_dimissible
|
144 |
-
);
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* @author Vova Feldman (@svovaf)
|
149 |
-
* @since 1.0.7
|
150 |
-
*
|
151 |
-
* @param string|string[] $ids
|
152 |
-
* @param int|null $network_level_or_blog_id
|
153 |
-
* @param bool $store
|
154 |
-
*/
|
155 |
-
function remove_sticky( $ids, $network_level_or_blog_id = null, $store = true ) {
|
156 |
-
if ( ! is_array( $ids ) ) {
|
157 |
-
$ids = array( $ids );
|
158 |
-
}
|
159 |
-
|
160 |
-
if ( $this->should_use_network_notices( $ids[0], $network_level_or_blog_id ) ) {
|
161 |
-
$notices = $this->_network_notices;
|
162 |
-
} else {
|
163 |
-
$notices = $this->get_site_notices( $network_level_or_blog_id );
|
164 |
-
}
|
165 |
-
|
166 |
-
return $notices->remove_sticky( $ids, $store );
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Check if sticky message exists by id.
|
171 |
-
*
|
172 |
-
* @author Vova Feldman (@svovaf)
|
173 |
-
* @since 1.0.9
|
174 |
-
*
|
175 |
-
* @param string $id
|
176 |
-
* @param int|null $network_level_or_blog_id
|
177 |
-
*
|
178 |
-
* @return bool
|
179 |
-
*/
|
180 |
-
function has_sticky( $id, $network_level_or_blog_id = null ) {
|
181 |
-
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
182 |
-
|
183 |
-
return $notices->has_sticky( $id );
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Adds sticky admin notification.
|
188 |
-
*
|
189 |
-
* @author Vova Feldman (@svovaf)
|
190 |
-
* @since 1.0.7
|
191 |
-
*
|
192 |
-
* @param string $message
|
193 |
-
* @param string $id Message ID
|
194 |
-
* @param string $title
|
195 |
-
* @param string $type
|
196 |
-
* @param int|null $network_level_or_blog_id
|
197 |
-
* @param number|null $wp_user_id
|
198 |
-
* @param string|null $plugin_title
|
199 |
-
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
200 |
-
* blog admin pages.
|
201 |
-
* @param bool $is_dismissible
|
202 |
-
*/
|
203 |
-
function add_sticky(
|
204 |
-
$message,
|
205 |
-
$id,
|
206 |
-
$title = '',
|
207 |
-
$type = 'success',
|
208 |
-
$network_level_or_blog_id = null,
|
209 |
-
$wp_user_id = null,
|
210 |
-
$plugin_title = null,
|
211 |
-
$is_network_and_blog_admins = false,
|
212 |
-
$is_dismissible = true,
|
213 |
-
$data = array()
|
214 |
-
) {
|
215 |
-
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
216 |
-
|
217 |
-
$notices->add_sticky( $message, $id, $title, $type, $wp_user_id, $plugin_title, $is_network_and_blog_admins, $is_dismissible, $data );
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Retrieves the data of a sticky notice.
|
222 |
-
*
|
223 |
-
* @author Leo Fajardo (@leorw)
|
224 |
-
* @since 2.4.3
|
225 |
-
*
|
226 |
-
* @param string $id
|
227 |
-
* @param int|null $network_level_or_blog_id
|
228 |
-
*
|
229 |
-
* @return array|null
|
230 |
-
*/
|
231 |
-
function get_sticky( $id, $network_level_or_blog_id ) {
|
232 |
-
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
233 |
-
|
234 |
-
return $notices->get_sticky( $id );
|
235 |
-
}
|
236 |
-
|
237 |
-
/**
|
238 |
-
* Clear all sticky messages.
|
239 |
-
*
|
240 |
-
* @author Vova Feldman (@svovaf)
|
241 |
-
* @since 2.0.0
|
242 |
-
*
|
243 |
-
* @param int|null $network_level_or_blog_id
|
244 |
-
*/
|
245 |
-
function clear_all_sticky( $network_level_or_blog_id = null ) {
|
246 |
-
if ( ! $this->_is_multisite ||
|
247 |
-
false === $network_level_or_blog_id ||
|
248 |
-
0 == $network_level_or_blog_id ||
|
249 |
-
is_null( $network_level_or_blog_id )
|
250 |
-
) {
|
251 |
-
$notices = $this->get_site_notices( $network_level_or_blog_id );
|
252 |
-
$notices->clear_all_sticky();
|
253 |
-
}
|
254 |
-
|
255 |
-
if ( $this->_is_multisite &&
|
256 |
-
( true === $network_level_or_blog_id || is_null( $network_level_or_blog_id ) )
|
257 |
-
) {
|
258 |
-
$this->_network_notices->clear_all_sticky();
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Add admin message to all admin messages queue, and hook to all_admin_notices if not yet hooked.
|
264 |
-
*
|
265 |
-
* @author Vova Feldman (@svovaf)
|
266 |
-
* @since 1.0.4
|
267 |
-
*
|
268 |
-
* @param string $message
|
269 |
-
* @param string $title
|
270 |
-
* @param string $type
|
271 |
-
* @param bool $is_sticky
|
272 |
-
* @param string $id Message ID
|
273 |
-
*/
|
274 |
-
function add_all( $message, $title = '', $type = 'success', $is_sticky = false, $id = '' ) {
|
275 |
-
$this->add( $message, $title, $type, $is_sticky, true, $id );
|
276 |
-
}
|
277 |
-
|
278 |
-
#--------------------------------------------------------------------------------
|
279 |
-
#region Helper Methods
|
280 |
-
#--------------------------------------------------------------------------------
|
281 |
-
|
282 |
-
/**
|
283 |
-
* @author Vova Feldman (@svovaf)
|
284 |
-
* @since 2.0.0
|
285 |
-
*
|
286 |
-
* @param int $blog_id
|
287 |
-
*
|
288 |
-
* @return FS_Admin_Notice_Manager
|
289 |
-
*/
|
290 |
-
private function get_site_notices( $blog_id = 0 ) {
|
291 |
-
if ( 0 == $blog_id || $blog_id == $this->_blog_id ) {
|
292 |
-
return $this->_notices;
|
293 |
-
}
|
294 |
-
|
295 |
-
return FS_Admin_Notice_Manager::instance(
|
296 |
-
$this->_id,
|
297 |
-
$this->_title,
|
298 |
-
$this->_module_unique_affix,
|
299 |
-
false,
|
300 |
-
$blog_id
|
301 |
-
);
|
302 |
-
}
|
303 |
-
|
304 |
-
/**
|
305 |
-
* Check if the network notices should be used.
|
306 |
-
*
|
307 |
-
* @author Vova Feldman (@svovaf)
|
308 |
-
* @since 2.0.0
|
309 |
-
*
|
310 |
-
* @param string $id
|
311 |
-
* @param null|bool|int $network_level_or_blog_id When an integer, use the given blog storage. When `true` use the multisite notices (if there's a network). When `false`, use the current context blog notices. When `null`, the decision which notices manager to use (MS vs. Current S) will be handled internally and determined based on the $id and the context admin (blog admin vs. network level admin).
|
312 |
-
*
|
313 |
-
* @return bool
|
314 |
-
*/
|
315 |
-
private function should_use_network_notices( $id = '', $network_level_or_blog_id = null ) {
|
316 |
-
if ( ! $this->_is_multisite ) {
|
317 |
-
// Not a multisite environment.
|
318 |
-
return false;
|
319 |
-
}
|
320 |
-
|
321 |
-
if ( is_numeric( $network_level_or_blog_id ) ) {
|
322 |
-
// Explicitly asked to use a specified blog storage.
|
323 |
-
return false;
|
324 |
-
}
|
325 |
-
|
326 |
-
if ( is_bool( $network_level_or_blog_id ) ) {
|
327 |
-
// Explicitly specified whether should use the network or blog level storage.
|
328 |
-
return $network_level_or_blog_id;
|
329 |
-
}
|
330 |
-
|
331 |
-
return fs_is_network_admin();
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Retrieves an instance of FS_Admin_Notice_Manager.
|
336 |
-
*
|
337 |
-
* @author Leo Fajardo (@leorw)
|
338 |
-
* @since 2.5.0
|
339 |
-
*
|
340 |
-
* @param string $id
|
341 |
-
* @param int|null $network_level_or_blog_id
|
342 |
-
*
|
343 |
-
* @return FS_Admin_Notice_Manager
|
344 |
-
*/
|
345 |
-
private function get_site_or_network_notices( $id, $network_level_or_blog_id ) {
|
346 |
-
return $this->should_use_network_notices( $id, $network_level_or_blog_id ) ?
|
347 |
-
$this->_network_notices :
|
348 |
-
$this->get_site_notices( $network_level_or_blog_id );
|
349 |
-
}
|
350 |
-
|
351 |
-
#endregion
|
352 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* WP Admin notices manager both for site level and network level.
|
15 |
+
*
|
16 |
+
* Class FS_Admin_Notices
|
17 |
+
*/
|
18 |
+
class FS_Admin_Notices {
|
19 |
+
/**
|
20 |
+
* @since 1.2.2
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
protected $_module_unique_affix;
|
25 |
+
/**
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
protected $_id;
|
29 |
+
/**
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_title;
|
33 |
+
/**
|
34 |
+
* @var FS_Admin_Notice_Manager
|
35 |
+
*/
|
36 |
+
protected $_notices;
|
37 |
+
/**
|
38 |
+
* @var FS_Admin_Notice_Manager
|
39 |
+
*/
|
40 |
+
protected $_network_notices;
|
41 |
+
/**
|
42 |
+
* @var int The ID of the blog that is associated with the current site level options.
|
43 |
+
*/
|
44 |
+
private $_blog_id = 0;
|
45 |
+
/**
|
46 |
+
* @var bool
|
47 |
+
*/
|
48 |
+
private $_is_multisite;
|
49 |
+
/**
|
50 |
+
* @var FS_Admin_Notices[]
|
51 |
+
*/
|
52 |
+
private static $_instances = array();
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @param string $id
|
56 |
+
* @param string $title
|
57 |
+
* @param string $module_unique_affix
|
58 |
+
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
59 |
+
* blog admin pages.
|
60 |
+
*
|
61 |
+
* @return FS_Admin_Notices
|
62 |
+
*/
|
63 |
+
static function instance( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
|
64 |
+
if ( ! isset( self::$_instances[ $id ] ) ) {
|
65 |
+
self::$_instances[ $id ] = new FS_Admin_Notices( $id, $title, $module_unique_affix, $is_network_and_blog_admins );
|
66 |
+
}
|
67 |
+
|
68 |
+
return self::$_instances[ $id ];
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param string $id
|
73 |
+
* @param string $title
|
74 |
+
* @param string $module_unique_affix
|
75 |
+
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
76 |
+
* blog admin pages.
|
77 |
+
*/
|
78 |
+
protected function __construct( $id, $title = '', $module_unique_affix = '', $is_network_and_blog_admins = false ) {
|
79 |
+
$this->_id = $id;
|
80 |
+
$this->_title = $title;
|
81 |
+
$this->_module_unique_affix = $module_unique_affix;
|
82 |
+
$this->_is_multisite = is_multisite();
|
83 |
+
|
84 |
+
if ( $this->_is_multisite ) {
|
85 |
+
$this->_blog_id = get_current_blog_id();
|
86 |
+
|
87 |
+
$this->_network_notices = FS_Admin_Notice_Manager::instance(
|
88 |
+
$id,
|
89 |
+
$title,
|
90 |
+
$module_unique_affix,
|
91 |
+
$is_network_and_blog_admins,
|
92 |
+
true
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
$this->_notices = FS_Admin_Notice_Manager::instance(
|
97 |
+
$id,
|
98 |
+
$title,
|
99 |
+
$module_unique_affix,
|
100 |
+
false,
|
101 |
+
$this->_blog_id
|
102 |
+
);
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Add admin message to admin messages queue, and hook to admin_notices / all_admin_notices if not yet hooked.
|
107 |
+
*
|
108 |
+
* @author Vova Feldman (@svovaf)
|
109 |
+
* @since 1.0.4
|
110 |
+
*
|
111 |
+
* @param string $message
|
112 |
+
* @param string $title
|
113 |
+
* @param string $type
|
114 |
+
* @param bool $is_sticky
|
115 |
+
* @param string $id Message ID
|
116 |
+
* @param bool $store_if_sticky
|
117 |
+
* @param int|null $network_level_or_blog_id
|
118 |
+
*
|
119 |
+
* @uses add_action()
|
120 |
+
*/
|
121 |
+
function add(
|
122 |
+
$message,
|
123 |
+
$title = '',
|
124 |
+
$type = 'success',
|
125 |
+
$is_sticky = false,
|
126 |
+
$id = '',
|
127 |
+
$store_if_sticky = true,
|
128 |
+
$network_level_or_blog_id = null,
|
129 |
+
$is_dimissible = null
|
130 |
+
) {
|
131 |
+
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
132 |
+
|
133 |
+
$notices->add(
|
134 |
+
$message,
|
135 |
+
$title,
|
136 |
+
$type,
|
137 |
+
$is_sticky,
|
138 |
+
$id,
|
139 |
+
$store_if_sticky,
|
140 |
+
null,
|
141 |
+
null,
|
142 |
+
false,
|
143 |
+
$is_dimissible
|
144 |
+
);
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @author Vova Feldman (@svovaf)
|
149 |
+
* @since 1.0.7
|
150 |
+
*
|
151 |
+
* @param string|string[] $ids
|
152 |
+
* @param int|null $network_level_or_blog_id
|
153 |
+
* @param bool $store
|
154 |
+
*/
|
155 |
+
function remove_sticky( $ids, $network_level_or_blog_id = null, $store = true ) {
|
156 |
+
if ( ! is_array( $ids ) ) {
|
157 |
+
$ids = array( $ids );
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( $this->should_use_network_notices( $ids[0], $network_level_or_blog_id ) ) {
|
161 |
+
$notices = $this->_network_notices;
|
162 |
+
} else {
|
163 |
+
$notices = $this->get_site_notices( $network_level_or_blog_id );
|
164 |
+
}
|
165 |
+
|
166 |
+
return $notices->remove_sticky( $ids, $store );
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Check if sticky message exists by id.
|
171 |
+
*
|
172 |
+
* @author Vova Feldman (@svovaf)
|
173 |
+
* @since 1.0.9
|
174 |
+
*
|
175 |
+
* @param string $id
|
176 |
+
* @param int|null $network_level_or_blog_id
|
177 |
+
*
|
178 |
+
* @return bool
|
179 |
+
*/
|
180 |
+
function has_sticky( $id, $network_level_or_blog_id = null ) {
|
181 |
+
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
182 |
+
|
183 |
+
return $notices->has_sticky( $id );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Adds sticky admin notification.
|
188 |
+
*
|
189 |
+
* @author Vova Feldman (@svovaf)
|
190 |
+
* @since 1.0.7
|
191 |
+
*
|
192 |
+
* @param string $message
|
193 |
+
* @param string $id Message ID
|
194 |
+
* @param string $title
|
195 |
+
* @param string $type
|
196 |
+
* @param int|null $network_level_or_blog_id
|
197 |
+
* @param number|null $wp_user_id
|
198 |
+
* @param string|null $plugin_title
|
199 |
+
* @param bool $is_network_and_blog_admins Whether or not the message should be shown both on network and
|
200 |
+
* blog admin pages.
|
201 |
+
* @param bool $is_dismissible
|
202 |
+
*/
|
203 |
+
function add_sticky(
|
204 |
+
$message,
|
205 |
+
$id,
|
206 |
+
$title = '',
|
207 |
+
$type = 'success',
|
208 |
+
$network_level_or_blog_id = null,
|
209 |
+
$wp_user_id = null,
|
210 |
+
$plugin_title = null,
|
211 |
+
$is_network_and_blog_admins = false,
|
212 |
+
$is_dismissible = true,
|
213 |
+
$data = array()
|
214 |
+
) {
|
215 |
+
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
216 |
+
|
217 |
+
$notices->add_sticky( $message, $id, $title, $type, $wp_user_id, $plugin_title, $is_network_and_blog_admins, $is_dismissible, $data );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Retrieves the data of a sticky notice.
|
222 |
+
*
|
223 |
+
* @author Leo Fajardo (@leorw)
|
224 |
+
* @since 2.4.3
|
225 |
+
*
|
226 |
+
* @param string $id
|
227 |
+
* @param int|null $network_level_or_blog_id
|
228 |
+
*
|
229 |
+
* @return array|null
|
230 |
+
*/
|
231 |
+
function get_sticky( $id, $network_level_or_blog_id ) {
|
232 |
+
$notices = $this->get_site_or_network_notices( $id, $network_level_or_blog_id );
|
233 |
+
|
234 |
+
return $notices->get_sticky( $id );
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Clear all sticky messages.
|
239 |
+
*
|
240 |
+
* @author Vova Feldman (@svovaf)
|
241 |
+
* @since 2.0.0
|
242 |
+
*
|
243 |
+
* @param int|null $network_level_or_blog_id
|
244 |
+
*/
|
245 |
+
function clear_all_sticky( $network_level_or_blog_id = null ) {
|
246 |
+
if ( ! $this->_is_multisite ||
|
247 |
+
false === $network_level_or_blog_id ||
|
248 |
+
0 == $network_level_or_blog_id ||
|
249 |
+
is_null( $network_level_or_blog_id )
|
250 |
+
) {
|
251 |
+
$notices = $this->get_site_notices( $network_level_or_blog_id );
|
252 |
+
$notices->clear_all_sticky();
|
253 |
+
}
|
254 |
+
|
255 |
+
if ( $this->_is_multisite &&
|
256 |
+
( true === $network_level_or_blog_id || is_null( $network_level_or_blog_id ) )
|
257 |
+
) {
|
258 |
+
$this->_network_notices->clear_all_sticky();
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Add admin message to all admin messages queue, and hook to all_admin_notices if not yet hooked.
|
264 |
+
*
|
265 |
+
* @author Vova Feldman (@svovaf)
|
266 |
+
* @since 1.0.4
|
267 |
+
*
|
268 |
+
* @param string $message
|
269 |
+
* @param string $title
|
270 |
+
* @param string $type
|
271 |
+
* @param bool $is_sticky
|
272 |
+
* @param string $id Message ID
|
273 |
+
*/
|
274 |
+
function add_all( $message, $title = '', $type = 'success', $is_sticky = false, $id = '' ) {
|
275 |
+
$this->add( $message, $title, $type, $is_sticky, true, $id );
|
276 |
+
}
|
277 |
+
|
278 |
+
#--------------------------------------------------------------------------------
|
279 |
+
#region Helper Methods
|
280 |
+
#--------------------------------------------------------------------------------
|
281 |
+
|
282 |
+
/**
|
283 |
+
* @author Vova Feldman (@svovaf)
|
284 |
+
* @since 2.0.0
|
285 |
+
*
|
286 |
+
* @param int $blog_id
|
287 |
+
*
|
288 |
+
* @return FS_Admin_Notice_Manager
|
289 |
+
*/
|
290 |
+
private function get_site_notices( $blog_id = 0 ) {
|
291 |
+
if ( 0 == $blog_id || $blog_id == $this->_blog_id ) {
|
292 |
+
return $this->_notices;
|
293 |
+
}
|
294 |
+
|
295 |
+
return FS_Admin_Notice_Manager::instance(
|
296 |
+
$this->_id,
|
297 |
+
$this->_title,
|
298 |
+
$this->_module_unique_affix,
|
299 |
+
false,
|
300 |
+
$blog_id
|
301 |
+
);
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Check if the network notices should be used.
|
306 |
+
*
|
307 |
+
* @author Vova Feldman (@svovaf)
|
308 |
+
* @since 2.0.0
|
309 |
+
*
|
310 |
+
* @param string $id
|
311 |
+
* @param null|bool|int $network_level_or_blog_id When an integer, use the given blog storage. When `true` use the multisite notices (if there's a network). When `false`, use the current context blog notices. When `null`, the decision which notices manager to use (MS vs. Current S) will be handled internally and determined based on the $id and the context admin (blog admin vs. network level admin).
|
312 |
+
*
|
313 |
+
* @return bool
|
314 |
+
*/
|
315 |
+
private function should_use_network_notices( $id = '', $network_level_or_blog_id = null ) {
|
316 |
+
if ( ! $this->_is_multisite ) {
|
317 |
+
// Not a multisite environment.
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
if ( is_numeric( $network_level_or_blog_id ) ) {
|
322 |
+
// Explicitly asked to use a specified blog storage.
|
323 |
+
return false;
|
324 |
+
}
|
325 |
+
|
326 |
+
if ( is_bool( $network_level_or_blog_id ) ) {
|
327 |
+
// Explicitly specified whether should use the network or blog level storage.
|
328 |
+
return $network_level_or_blog_id;
|
329 |
+
}
|
330 |
+
|
331 |
+
return fs_is_network_admin();
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Retrieves an instance of FS_Admin_Notice_Manager.
|
336 |
+
*
|
337 |
+
* @author Leo Fajardo (@leorw)
|
338 |
+
* @since 2.5.0
|
339 |
+
*
|
340 |
+
* @param string $id
|
341 |
+
* @param int|null $network_level_or_blog_id
|
342 |
+
*
|
343 |
+
* @return FS_Admin_Notice_Manager
|
344 |
+
*/
|
345 |
+
private function get_site_or_network_notices( $id, $network_level_or_blog_id ) {
|
346 |
+
return $this->should_use_network_notices( $id, $network_level_or_blog_id ) ?
|
347 |
+
$this->_network_notices :
|
348 |
+
$this->get_site_notices( $network_level_or_blog_id );
|
349 |
+
}
|
350 |
+
|
351 |
+
#endregion
|
352 |
}
|
lib/freemius/includes/class-fs-logger.php
CHANGED
@@ -1,691 +1,691 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Logger {
|
14 |
-
private $_id;
|
15 |
-
private $_on = false;
|
16 |
-
private $_echo = false;
|
17 |
-
private $_file_start = 0;
|
18 |
-
/**
|
19 |
-
* @var int PHP Process ID.
|
20 |
-
*/
|
21 |
-
private static $_processID;
|
22 |
-
/**
|
23 |
-
* @var string PHP Script user name.
|
24 |
-
*/
|
25 |
-
private static $_ownerName;
|
26 |
-
/**
|
27 |
-
* @var bool Is storage logging turned on.
|
28 |
-
*/
|
29 |
-
private static $_isStorageLoggingOn;
|
30 |
-
/**
|
31 |
-
* @var int ABSPATH length.
|
32 |
-
*/
|
33 |
-
private static $_abspathLength;
|
34 |
-
|
35 |
-
private static $LOGGERS = array();
|
36 |
-
private static $LOG = array();
|
37 |
-
private static $CNT = 0;
|
38 |
-
private static $_HOOKED_FOOTER = false;
|
39 |
-
|
40 |
-
private function __construct( $id, $on = false, $echo = false ) {
|
41 |
-
$this->_id = $id;
|
42 |
-
|
43 |
-
$bt = debug_backtrace();
|
44 |
-
$caller = $bt[2];
|
45 |
-
|
46 |
-
if ( false !== strpos( $caller['file'], 'plugins' ) ) {
|
47 |
-
$this->_file_start = strpos( $caller['file'], 'plugins' ) + strlen( 'plugins/' );
|
48 |
-
} else {
|
49 |
-
$this->_file_start = strpos( $caller['file'], 'themes' ) + strlen( 'themes/' );
|
50 |
-
}
|
51 |
-
|
52 |
-
if ( $on ) {
|
53 |
-
$this->on();
|
54 |
-
}
|
55 |
-
if ( $echo ) {
|
56 |
-
$this->echo_on();
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @param string $id
|
62 |
-
* @param bool $on
|
63 |
-
* @param bool $echo
|
64 |
-
*
|
65 |
-
* @return FS_Logger
|
66 |
-
*/
|
67 |
-
public static function get_logger( $id, $on = false, $echo = false ) {
|
68 |
-
$id = strtolower( $id );
|
69 |
-
|
70 |
-
if ( ! isset( self::$_processID ) ) {
|
71 |
-
self::init();
|
72 |
-
}
|
73 |
-
|
74 |
-
if ( ! isset( self::$LOGGERS[ $id ] ) ) {
|
75 |
-
self::$LOGGERS[ $id ] = new FS_Logger( $id, $on, $echo );
|
76 |
-
}
|
77 |
-
|
78 |
-
return self::$LOGGERS[ $id ];
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Initialize logging global info.
|
83 |
-
*
|
84 |
-
* @author Vova Feldman (@svovaf)
|
85 |
-
* @since 1.2.1.6
|
86 |
-
*/
|
87 |
-
private static function init() {
|
88 |
-
self::$_ownerName = function_exists( 'get_current_user' ) ?
|
89 |
-
get_current_user() :
|
90 |
-
'unknown';
|
91 |
-
self::$_isStorageLoggingOn = ( 1 == get_option( 'fs_storage_logger', 0 ) );
|
92 |
-
self::$_abspathLength = strlen( ABSPATH );
|
93 |
-
self::$_processID = mt_rand( 0, 32000 );
|
94 |
-
|
95 |
-
// Process ID may be `false` on errors.
|
96 |
-
if ( ! is_numeric( self::$_processID ) ) {
|
97 |
-
self::$_processID = 0;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
private static function hook_footer() {
|
102 |
-
if ( self::$_HOOKED_FOOTER ) {
|
103 |
-
return;
|
104 |
-
}
|
105 |
-
|
106 |
-
if ( is_admin() ) {
|
107 |
-
add_action( 'admin_footer', 'FS_Logger::dump', 100 );
|
108 |
-
} else {
|
109 |
-
add_action( 'wp_footer', 'FS_Logger::dump', 100 );
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
function is_on() {
|
114 |
-
return $this->_on;
|
115 |
-
}
|
116 |
-
|
117 |
-
function on() {
|
118 |
-
$this->_on = true;
|
119 |
-
|
120 |
-
if ( ! function_exists( 'dbDelta' ) ) {
|
121 |
-
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
122 |
-
}
|
123 |
-
|
124 |
-
self::hook_footer();
|
125 |
-
}
|
126 |
-
|
127 |
-
function echo_on() {
|
128 |
-
$this->on();
|
129 |
-
|
130 |
-
$this->_echo = true;
|
131 |
-
}
|
132 |
-
|
133 |
-
function is_echo_on() {
|
134 |
-
return $this->_echo;
|
135 |
-
}
|
136 |
-
|
137 |
-
function get_id() {
|
138 |
-
return $this->_id;
|
139 |
-
}
|
140 |
-
|
141 |
-
function get_file() {
|
142 |
-
return $this->_file_start;
|
143 |
-
}
|
144 |
-
|
145 |
-
private function _log( &$message, $type, $wrapper = false ) {
|
146 |
-
if ( ! $this->is_on() ) {
|
147 |
-
return;
|
148 |
-
}
|
149 |
-
|
150 |
-
$bt = debug_backtrace();
|
151 |
-
$depth = $wrapper ? 3 : 2;
|
152 |
-
while ( $depth < count( $bt ) - 1 && 'eval' === $bt[ $depth ]['function'] ) {
|
153 |
-
$depth ++;
|
154 |
-
}
|
155 |
-
|
156 |
-
$caller = $bt[ $depth ];
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Retrieve the correct call file & line number from backtrace
|
160 |
-
* when logging from a wrapper method.
|
161 |
-
*
|
162 |
-
* @author Vova Feldman
|
163 |
-
* @since 1.2.1.6
|
164 |
-
*/
|
165 |
-
if ( empty( $caller['line'] ) ) {
|
166 |
-
$depth --;
|
167 |
-
|
168 |
-
while ( $depth >= 0 ) {
|
169 |
-
if ( ! empty( $bt[ $depth ]['line'] ) ) {
|
170 |
-
$caller['line'] = $bt[ $depth ]['line'];
|
171 |
-
$caller['file'] = $bt[ $depth ]['file'];
|
172 |
-
break;
|
173 |
-
}
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
$log = array_merge( $caller, array(
|
178 |
-
'cnt' => self::$CNT ++,
|
179 |
-
'logger' => $this,
|
180 |
-
'timestamp' => microtime( true ),
|
181 |
-
'log_type' => $type,
|
182 |
-
'msg' => $message,
|
183 |
-
) );
|
184 |
-
|
185 |
-
if ( self::$_isStorageLoggingOn ) {
|
186 |
-
$this->db_log( $type, $message, self::$CNT, $caller );
|
187 |
-
}
|
188 |
-
|
189 |
-
self::$LOG[] = $log;
|
190 |
-
|
191 |
-
if ( $this->is_echo_on() && ! Freemius::is_ajax() ) {
|
192 |
-
echo self::format_html( $log ) . "\n";
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
function log( $message, $wrapper = false ) {
|
197 |
-
$this->_log( $message, 'log', $wrapper );
|
198 |
-
}
|
199 |
-
|
200 |
-
function info( $message, $wrapper = false ) {
|
201 |
-
$this->_log( $message, 'info', $wrapper );
|
202 |
-
}
|
203 |
-
|
204 |
-
function warn( $message, $wrapper = false ) {
|
205 |
-
$this->_log( $message, 'warn', $wrapper );
|
206 |
-
}
|
207 |
-
|
208 |
-
function error( $message, $wrapper = false ) {
|
209 |
-
$this->_log( $message, 'error', $wrapper );
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Log API error.
|
214 |
-
*
|
215 |
-
* @author Vova Feldman (@svovaf)
|
216 |
-
* @since 1.2.1.5
|
217 |
-
*
|
218 |
-
* @param mixed $api_result
|
219 |
-
* @param bool $wrapper
|
220 |
-
*/
|
221 |
-
function api_error( $api_result, $wrapper = false ) {
|
222 |
-
$message = '';
|
223 |
-
if ( is_object( $api_result ) &&
|
224 |
-
! empty( $api_result->error ) &&
|
225 |
-
! empty( $api_result->error->message )
|
226 |
-
) {
|
227 |
-
$message = $api_result->error->message;
|
228 |
-
} else if ( is_object( $api_result ) ) {
|
229 |
-
$message = var_export( $api_result, true );
|
230 |
-
} else if ( is_string( $api_result ) ) {
|
231 |
-
$message = $api_result;
|
232 |
-
} else if ( empty( $api_result ) ) {
|
233 |
-
$message = 'Empty API result.';
|
234 |
-
}
|
235 |
-
|
236 |
-
$message = 'API Error: ' . $message;
|
237 |
-
|
238 |
-
$this->_log( $message, 'error', $wrapper );
|
239 |
-
}
|
240 |
-
|
241 |
-
function entrance( $message = '', $wrapper = false ) {
|
242 |
-
$msg = 'Entrance' . ( empty( $message ) ? '' : ' > ' ) . $message;
|
243 |
-
|
244 |
-
$this->_log( $msg, 'log', $wrapper );
|
245 |
-
}
|
246 |
-
|
247 |
-
function departure( $message = '', $wrapper = false ) {
|
248 |
-
$msg = 'Departure' . ( empty( $message ) ? '' : ' > ' ) . $message;
|
249 |
-
|
250 |
-
$this->_log( $msg, 'log', $wrapper );
|
251 |
-
}
|
252 |
-
|
253 |
-
#--------------------------------------------------------------------------------
|
254 |
-
#region Log Formatting
|
255 |
-
#--------------------------------------------------------------------------------
|
256 |
-
|
257 |
-
private static function format( $log, $show_type = true ) {
|
258 |
-
return '[' . str_pad( $log['cnt'], strlen( self::$CNT ), '0', STR_PAD_LEFT ) . '] [' . $log['logger']->_id . '] ' . ( $show_type ? '[' . $log['log_type'] . ']' : '' ) . ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] . ' >> ' . $log['msg'] . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ') ' : '' ) . ' [' . $log['timestamp'] . ']';
|
259 |
-
}
|
260 |
-
|
261 |
-
private static function format_html( $log ) {
|
262 |
-
return '<div style="font-size: 13px; font-family: monospace; color: #7da767; padding: 8px 3px; background: #000; border-bottom: 1px solid #555;">[' . $log['cnt'] . '] [' . $log['logger']->_id . '] [' . $log['log_type'] . '] <b><code style="color: #c4b1e0;">' . ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] . '</code> >> <b style="color: #f59330;">' . esc_html( $log['msg'] ) . '</b></b>' . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ')' : '' ) . ' [' . $log['timestamp'] . ']</div>';
|
263 |
-
}
|
264 |
-
|
265 |
-
#endregion
|
266 |
-
|
267 |
-
static function dump() {
|
268 |
-
?>
|
269 |
-
<!-- BEGIN: Freemius PHP Console Log -->
|
270 |
-
<script type="text/javascript">
|
271 |
-
<?php
|
272 |
-
foreach ( self::$LOG as $log ) {
|
273 |
-
echo 'console.' . $log['log_type'] . '(' . json_encode( self::format( $log, false ) ) . ')' . "\n";
|
274 |
-
}
|
275 |
-
?>
|
276 |
-
</script>
|
277 |
-
<!-- END: Freemius PHP Console Log -->
|
278 |
-
<?php
|
279 |
-
}
|
280 |
-
|
281 |
-
static function get_log() {
|
282 |
-
return self::$LOG;
|
283 |
-
}
|
284 |
-
|
285 |
-
#--------------------------------------------------------------------------------
|
286 |
-
#region Database Logging
|
287 |
-
#--------------------------------------------------------------------------------
|
288 |
-
|
289 |
-
/**
|
290 |
-
* @author Vova Feldman (@svovaf)
|
291 |
-
* @since 1.2.1.6
|
292 |
-
*
|
293 |
-
* @return bool
|
294 |
-
*/
|
295 |
-
public static function is_storage_logging_on() {
|
296 |
-
if ( ! isset( self::$_isStorageLoggingOn ) ) {
|
297 |
-
self::$_isStorageLoggingOn = ( 1 == get_option( 'fs_storage_logger', 0 ) );
|
298 |
-
}
|
299 |
-
|
300 |
-
return self::$_isStorageLoggingOn;
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Turns on/off database persistent debugging to capture
|
305 |
-
* multi-session logs to debug complex flows like
|
306 |
-
* plugin auto-deactivate on premium version activation.
|
307 |
-
*
|
308 |
-
* @todo Check if Theme Check has issues with DB tables for themes.
|
309 |
-
*
|
310 |
-
* @author Vova Feldman (@svovaf)
|
311 |
-
* @since 1.2.1.6
|
312 |
-
*
|
313 |
-
* @param bool $is_on
|
314 |
-
*
|
315 |
-
* @return bool
|
316 |
-
*/
|
317 |
-
public static function _set_storage_logging( $is_on = true ) {
|
318 |
-
global $wpdb;
|
319 |
-
|
320 |
-
$table = "{$wpdb->prefix}fs_logger";
|
321 |
-
|
322 |
-
if ( $is_on ) {
|
323 |
-
/**
|
324 |
-
* Create logging table.
|
325 |
-
*
|
326 |
-
* NOTE:
|
327 |
-
* dbDelta must use KEY and not INDEX for indexes.
|
328 |
-
*
|
329 |
-
* @link https://core.trac.wordpress.org/ticket/2695
|
330 |
-
*/
|
331 |
-
$result = $wpdb->query( "CREATE TABLE {$table} (
|
332 |
-
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
333 |
-
`process_id` INT UNSIGNED NOT NULL,
|
334 |
-
`user_name` VARCHAR(64) NOT NULL,
|
335 |
-
`logger` VARCHAR(128) NOT NULL,
|
336 |
-
`log_order` INT UNSIGNED NOT NULL,
|
337 |
-
`type` ENUM('log','info','warn','error') NOT NULL DEFAULT 'log',
|
338 |
-
`message` TEXT NOT NULL,
|
339 |
-
`file` VARCHAR(256) NOT NULL,
|
340 |
-
`line` INT UNSIGNED NOT NULL,
|
341 |
-
`function` VARCHAR(256) NOT NULL,
|
342 |
-
`request_type` ENUM('call','ajax','cron') NOT NULL DEFAULT 'call',
|
343 |
-
`request_url` VARCHAR(1024) NOT NULL,
|
344 |
-
`created` DECIMAL(16, 6) NOT NULL,
|
345 |
-
PRIMARY KEY (`id`),
|
346 |
-
KEY `process_id` (`process_id` ASC),
|
347 |
-
KEY `process_logger` (`process_id` ASC, `logger` ASC),
|
348 |
-
KEY `function` (`function` ASC),
|
349 |
-
KEY `type` (`type` ASC))" );
|
350 |
-
} else {
|
351 |
-
/**
|
352 |
-
* Drop logging table.
|
353 |
-
*/
|
354 |
-
$result = $wpdb->query( "DROP TABLE IF EXISTS $table;" );
|
355 |
-
}
|
356 |
-
|
357 |
-
if ( false !== $result ) {
|
358 |
-
update_option( 'fs_storage_logger', ( $is_on ? 1 : 0 ) );
|
359 |
-
}
|
360 |
-
|
361 |
-
return ( false !== $result );
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* @author Vova Feldman (@svovaf)
|
366 |
-
* @since 1.2.1.6
|
367 |
-
*
|
368 |
-
* @param string $type
|
369 |
-
* @param string $message
|
370 |
-
* @param int $log_order
|
371 |
-
* @param array $caller
|
372 |
-
*
|
373 |
-
* @return false|int
|
374 |
-
*/
|
375 |
-
private function db_log(
|
376 |
-
&$type,
|
377 |
-
&$message,
|
378 |
-
&$log_order,
|
379 |
-
&$caller
|
380 |
-
) {
|
381 |
-
global $wpdb;
|
382 |
-
|
383 |
-
$request_type = 'call';
|
384 |
-
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
385 |
-
$request_type = 'cron';
|
386 |
-
} else if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
387 |
-
$request_type = 'ajax';
|
388 |
-
}
|
389 |
-
|
390 |
-
$request_url = WP_FS__IS_HTTP_REQUEST ?
|
391 |
-
$_SERVER['REQUEST_URI'] :
|
392 |
-
'';
|
393 |
-
|
394 |
-
return $wpdb->insert(
|
395 |
-
"{$wpdb->prefix}fs_logger",
|
396 |
-
array(
|
397 |
-
'process_id' => self::$_processID,
|
398 |
-
'user_name' => self::$_ownerName,
|
399 |
-
'logger' => $this->_id,
|
400 |
-
'log_order' => $log_order,
|
401 |
-
'type' => $type,
|
402 |
-
'request_type' => $request_type,
|
403 |
-
'request_url' => $request_url,
|
404 |
-
'message' => $message,
|
405 |
-
'file' => isset( $caller['file'] ) ?
|
406 |
-
substr( $caller['file'], self::$_abspathLength ) :
|
407 |
-
'',
|
408 |
-
'line' => $caller['line'],
|
409 |
-
'function' => ( ! empty( $caller['class'] ) ? $caller['class'] . $caller['type'] : '' ) . $caller['function'],
|
410 |
-
'created' => microtime( true ),
|
411 |
-
)
|
412 |
-
);
|
413 |
-
}
|
414 |
-
|
415 |
-
/**
|
416 |
-
* Persistent DB logger columns.
|
417 |
-
*
|
418 |
-
* @var array
|
419 |
-
*/
|
420 |
-
private static $_log_columns = array(
|
421 |
-
'id',
|
422 |
-
'process_id',
|
423 |
-
'user_name',
|
424 |
-
'logger',
|
425 |
-
'log_order',
|
426 |
-
'type',
|
427 |
-
'message',
|
428 |
-
'file',
|
429 |
-
'line',
|
430 |
-
'function',
|
431 |
-
'request_type',
|
432 |
-
'request_url',
|
433 |
-
'created',
|
434 |
-
);
|
435 |
-
|
436 |
-
/**
|
437 |
-
* Create DB logs query.
|
438 |
-
*
|
439 |
-
* @author Vova Feldman (@svovaf)
|
440 |
-
* @since 1.2.1.6
|
441 |
-
*
|
442 |
-
* @param bool $filters
|
443 |
-
* @param int $limit
|
444 |
-
* @param int $offset
|
445 |
-
* @param bool $order
|
446 |
-
* @param bool $escape_eol
|
447 |
-
*
|
448 |
-
* @return string
|
449 |
-
*/
|
450 |
-
private static function build_db_logs_query(
|
451 |
-
$filters = false,
|
452 |
-
$limit = 200,
|
453 |
-
$offset = 0,
|
454 |
-
$order = false,
|
455 |
-
$escape_eol = false
|
456 |
-
) {
|
457 |
-
global $wpdb;
|
458 |
-
|
459 |
-
$select = '*';
|
460 |
-
|
461 |
-
if ( $escape_eol ) {
|
462 |
-
$select = '';
|
463 |
-
for ( $i = 0, $len = count( self::$_log_columns ); $i < $len; $i ++ ) {
|
464 |
-
if ( $i > 0 ) {
|
465 |
-
$select .= ', ';
|
466 |
-
}
|
467 |
-
|
468 |
-
if ( 'message' !== self::$_log_columns[ $i ] ) {
|
469 |
-
$select .= self::$_log_columns[ $i ];
|
470 |
-
} else {
|
471 |
-
$select .= 'REPLACE(message , \'\n\', \' \') AS message';
|
472 |
-
}
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
$query = "SELECT {$select} FROM {$wpdb->prefix}fs_logger";
|
477 |
-
if ( is_array( $filters ) ) {
|
478 |
-
$criteria = array();
|
479 |
-
|
480 |
-
if ( ! empty( $filters['type'] ) && 'all' !== $filters['type'] ) {
|
481 |
-
$filters['type'] = strtolower( $filters['type'] );
|
482 |
-
|
483 |
-
switch ( $filters['type'] ) {
|
484 |
-
case 'warn_error':
|
485 |
-
$criteria[] = array( 'col' => 'type', 'val' => array( 'warn', 'error' ) );
|
486 |
-
break;
|
487 |
-
case 'error':
|
488 |
-
case 'warn':
|
489 |
-
$criteria[] = array( 'col' => 'type', 'val' => $filters['type'] );
|
490 |
-
break;
|
491 |
-
case 'info':
|
492 |
-
default:
|
493 |
-
$criteria[] = array( 'col' => 'type', 'val' => array( 'info', 'log' ) );
|
494 |
-
break;
|
495 |
-
}
|
496 |
-
}
|
497 |
-
|
498 |
-
if ( ! empty( $filters['request_type'] ) ) {
|
499 |
-
$filters['request_type'] = strtolower( $filters['request_type'] );
|
500 |
-
|
501 |
-
if ( in_array( $filters['request_type'], array( 'call', 'ajax', 'cron' ) ) ) {
|
502 |
-
$criteria[] = array( 'col' => 'request_type', 'val' => $filters['request_type'] );
|
503 |
-
}
|
504 |
-
}
|
505 |
-
|
506 |
-
if ( ! empty( $filters['file'] ) ) {
|
507 |
-
$criteria[] = array(
|
508 |
-
'col' => 'file',
|
509 |
-
'op' => 'LIKE',
|
510 |
-
'val' => '%' . esc_sql( $filters['file'] ),
|
511 |
-
);
|
512 |
-
}
|
513 |
-
|
514 |
-
if ( ! empty( $filters['function'] ) ) {
|
515 |
-
$criteria[] = array(
|
516 |
-
'col' => 'function',
|
517 |
-
'op' => 'LIKE',
|
518 |
-
'val' => '%' . esc_sql( $filters['function'] ),
|
519 |
-
);
|
520 |
-
}
|
521 |
-
|
522 |
-
if ( ! empty( $filters['process_id'] ) && is_numeric( $filters['process_id'] ) ) {
|
523 |
-
$criteria[] = array( 'col' => 'process_id', 'val' => $filters['process_id'] );
|
524 |
-
}
|
525 |
-
|
526 |
-
if ( ! empty( $filters['logger'] ) ) {
|
527 |
-
$criteria[] = array(
|
528 |
-
'col' => 'logger',
|
529 |
-
'op' => 'LIKE',
|
530 |
-
'val' => '%' . esc_sql( $filters['logger'] ) . '%',
|
531 |
-
);
|
532 |
-
}
|
533 |
-
|
534 |
-
if ( ! empty( $filters['message'] ) ) {
|
535 |
-
$criteria[] = array(
|
536 |
-
'col' => 'message',
|
537 |
-
'op' => 'LIKE',
|
538 |
-
'val' => '%' . esc_sql( $filters['message'] ) . '%',
|
539 |
-
);
|
540 |
-
}
|
541 |
-
|
542 |
-
if ( 0 < count( $criteria ) ) {
|
543 |
-
$query .= "\nWHERE\n";
|
544 |
-
|
545 |
-
$first = true;
|
546 |
-
foreach ( $criteria as $c ) {
|
547 |
-
if ( ! $first ) {
|
548 |
-
$query .= "AND\n";
|
549 |
-
}
|
550 |
-
|
551 |
-
if ( is_array( $c['val'] ) ) {
|
552 |
-
$operator = 'IN';
|
553 |
-
|
554 |
-
for ( $i = 0, $len = count( $c['val'] ); $i < $len; $i ++ ) {
|
555 |
-
$c['val'][ $i ] = "'" . esc_sql( $c['val'][ $i ] ) . "'";
|
556 |
-
}
|
557 |
-
|
558 |
-
$val = '(' . implode( ',', $c['val'] ) . ')';
|
559 |
-
} else {
|
560 |
-
$operator = ! empty( $c['op'] ) ? $c['op'] : '=';
|
561 |
-
$val = "'" . esc_sql( $c['val'] ) . "'";
|
562 |
-
}
|
563 |
-
|
564 |
-
$query .= "`{$c['col']}` {$operator} {$val}\n";
|
565 |
-
|
566 |
-
$first = false;
|
567 |
-
}
|
568 |
-
}
|
569 |
-
}
|
570 |
-
|
571 |
-
if ( ! is_array( $order ) ) {
|
572 |
-
$order = array(
|
573 |
-
'col' => 'id',
|
574 |
-
'order' => 'desc'
|
575 |
-
);
|
576 |
-
}
|
577 |
-
|
578 |
-
$query .= " ORDER BY {$order['col']} {$order['order']} LIMIT {$offset},{$limit}";
|
579 |
-
|
580 |
-
return $query;
|
581 |
-
}
|
582 |
-
|
583 |
-
/**
|
584 |
-
* Load logs from DB.
|
585 |
-
*
|
586 |
-
* @author Vova Feldman (@svovaf)
|
587 |
-
* @since 1.2.1.6
|
588 |
-
*
|
589 |
-
* @param bool $filters
|
590 |
-
* @param int $limit
|
591 |
-
* @param int $offset
|
592 |
-
* @param bool $order
|
593 |
-
*
|
594 |
-
* @return object[]|null
|
595 |
-
*/
|
596 |
-
public static function load_db_logs(
|
597 |
-
$filters = false,
|
598 |
-
$limit = 200,
|
599 |
-
$offset = 0,
|
600 |
-
$order = false
|
601 |
-
) {
|
602 |
-
global $wpdb;
|
603 |
-
|
604 |
-
$query = self::build_db_logs_query(
|
605 |
-
$filters,
|
606 |
-
$limit,
|
607 |
-
$offset,
|
608 |
-
$order
|
609 |
-
);
|
610 |
-
|
611 |
-
return $wpdb->get_results( $query );
|
612 |
-
}
|
613 |
-
|
614 |
-
/**
|
615 |
-
* Load logs from DB.
|
616 |
-
*
|
617 |
-
* @author Vova Feldman (@svovaf)
|
618 |
-
* @since 1.2.1.6
|
619 |
-
*
|
620 |
-
* @param bool $filters
|
621 |
-
* @param string $filename
|
622 |
-
* @param int $limit
|
623 |
-
* @param int $offset
|
624 |
-
* @param bool $order
|
625 |
-
*
|
626 |
-
* @return false|string File download URL or false on failure.
|
627 |
-
*/
|
628 |
-
public static function download_db_logs(
|
629 |
-
$filters = false,
|
630 |
-
$filename = '',
|
631 |
-
$limit = 10000,
|
632 |
-
$offset = 0,
|
633 |
-
$order = false
|
634 |
-
) {
|
635 |
-
global $wpdb;
|
636 |
-
|
637 |
-
$query = self::build_db_logs_query(
|
638 |
-
$filters,
|
639 |
-
$limit,
|
640 |
-
$offset,
|
641 |
-
$order,
|
642 |
-
true
|
643 |
-
);
|
644 |
-
|
645 |
-
$upload_dir = wp_upload_dir();
|
646 |
-
if ( empty( $filename ) ) {
|
647 |
-
$filename = 'fs-logs-' . date( 'Y-m-d_H-i-s', WP_FS__SCRIPT_START_TIME ) . '.csv';
|
648 |
-
}
|
649 |
-
$filepath = rtrim( $upload_dir['path'], '/' ) . "/{$filename}";
|
650 |
-
|
651 |
-
$query .= " INTO OUTFILE '{$filepath}' FIELDS TERMINATED BY '\t' ESCAPED BY '\\\\' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\\n'";
|
652 |
-
|
653 |
-
$columns = '';
|
654 |
-
for ( $i = 0, $len = count( self::$_log_columns ); $i < $len; $i ++ ) {
|
655 |
-
if ( $i > 0 ) {
|
656 |
-
$columns .= ', ';
|
657 |
-
}
|
658 |
-
|
659 |
-
$columns .= "'" . self::$_log_columns[ $i ] . "'";
|
660 |
-
}
|
661 |
-
|
662 |
-
$query = "SELECT {$columns} UNION ALL " . $query;
|
663 |
-
|
664 |
-
$result = $wpdb->query( $query );
|
665 |
-
|
666 |
-
if ( false === $result ) {
|
667 |
-
return false;
|
668 |
-
}
|
669 |
-
|
670 |
-
return rtrim( $upload_dir['url'], '/' ) . '/' . $filename;
|
671 |
-
}
|
672 |
-
|
673 |
-
/**
|
674 |
-
* @author Vova Feldman (@svovaf)
|
675 |
-
* @since 1.2.1.6
|
676 |
-
*
|
677 |
-
* @param string $filename
|
678 |
-
*
|
679 |
-
* @return string
|
680 |
-
*/
|
681 |
-
public static function get_logs_download_url( $filename = '' ) {
|
682 |
-
$upload_dir = wp_upload_dir();
|
683 |
-
if ( empty( $filename ) ) {
|
684 |
-
$filename = 'fs-logs-' . date( 'Y-m-d_H-i-s', WP_FS__SCRIPT_START_TIME ) . '.csv';
|
685 |
-
}
|
686 |
-
|
687 |
-
return rtrim( $upload_dir['url'], '/' ) . $filename;
|
688 |
-
}
|
689 |
-
|
690 |
-
#endregion
|
691 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Logger {
|
14 |
+
private $_id;
|
15 |
+
private $_on = false;
|
16 |
+
private $_echo = false;
|
17 |
+
private $_file_start = 0;
|
18 |
+
/**
|
19 |
+
* @var int PHP Process ID.
|
20 |
+
*/
|
21 |
+
private static $_processID;
|
22 |
+
/**
|
23 |
+
* @var string PHP Script user name.
|
24 |
+
*/
|
25 |
+
private static $_ownerName;
|
26 |
+
/**
|
27 |
+
* @var bool Is storage logging turned on.
|
28 |
+
*/
|
29 |
+
private static $_isStorageLoggingOn;
|
30 |
+
/**
|
31 |
+
* @var int ABSPATH length.
|
32 |
+
*/
|
33 |
+
private static $_abspathLength;
|
34 |
+
|
35 |
+
private static $LOGGERS = array();
|
36 |
+
private static $LOG = array();
|
37 |
+
private static $CNT = 0;
|
38 |
+
private static $_HOOKED_FOOTER = false;
|
39 |
+
|
40 |
+
private function __construct( $id, $on = false, $echo = false ) {
|
41 |
+
$this->_id = $id;
|
42 |
+
|
43 |
+
$bt = debug_backtrace();
|
44 |
+
$caller = $bt[2];
|
45 |
+
|
46 |
+
if ( false !== strpos( $caller['file'], 'plugins' ) ) {
|
47 |
+
$this->_file_start = strpos( $caller['file'], 'plugins' ) + strlen( 'plugins/' );
|
48 |
+
} else {
|
49 |
+
$this->_file_start = strpos( $caller['file'], 'themes' ) + strlen( 'themes/' );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $on ) {
|
53 |
+
$this->on();
|
54 |
+
}
|
55 |
+
if ( $echo ) {
|
56 |
+
$this->echo_on();
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @param string $id
|
62 |
+
* @param bool $on
|
63 |
+
* @param bool $echo
|
64 |
+
*
|
65 |
+
* @return FS_Logger
|
66 |
+
*/
|
67 |
+
public static function get_logger( $id, $on = false, $echo = false ) {
|
68 |
+
$id = strtolower( $id );
|
69 |
+
|
70 |
+
if ( ! isset( self::$_processID ) ) {
|
71 |
+
self::init();
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( ! isset( self::$LOGGERS[ $id ] ) ) {
|
75 |
+
self::$LOGGERS[ $id ] = new FS_Logger( $id, $on, $echo );
|
76 |
+
}
|
77 |
+
|
78 |
+
return self::$LOGGERS[ $id ];
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Initialize logging global info.
|
83 |
+
*
|
84 |
+
* @author Vova Feldman (@svovaf)
|
85 |
+
* @since 1.2.1.6
|
86 |
+
*/
|
87 |
+
private static function init() {
|
88 |
+
self::$_ownerName = function_exists( 'get_current_user' ) ?
|
89 |
+
get_current_user() :
|
90 |
+
'unknown';
|
91 |
+
self::$_isStorageLoggingOn = ( 1 == get_option( 'fs_storage_logger', 0 ) );
|
92 |
+
self::$_abspathLength = strlen( ABSPATH );
|
93 |
+
self::$_processID = mt_rand( 0, 32000 );
|
94 |
+
|
95 |
+
// Process ID may be `false` on errors.
|
96 |
+
if ( ! is_numeric( self::$_processID ) ) {
|
97 |
+
self::$_processID = 0;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
private static function hook_footer() {
|
102 |
+
if ( self::$_HOOKED_FOOTER ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( is_admin() ) {
|
107 |
+
add_action( 'admin_footer', 'FS_Logger::dump', 100 );
|
108 |
+
} else {
|
109 |
+
add_action( 'wp_footer', 'FS_Logger::dump', 100 );
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
function is_on() {
|
114 |
+
return $this->_on;
|
115 |
+
}
|
116 |
+
|
117 |
+
function on() {
|
118 |
+
$this->_on = true;
|
119 |
+
|
120 |
+
if ( ! function_exists( 'dbDelta' ) ) {
|
121 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
122 |
+
}
|
123 |
+
|
124 |
+
self::hook_footer();
|
125 |
+
}
|
126 |
+
|
127 |
+
function echo_on() {
|
128 |
+
$this->on();
|
129 |
+
|
130 |
+
$this->_echo = true;
|
131 |
+
}
|
132 |
+
|
133 |
+
function is_echo_on() {
|
134 |
+
return $this->_echo;
|
135 |
+
}
|
136 |
+
|
137 |
+
function get_id() {
|
138 |
+
return $this->_id;
|
139 |
+
}
|
140 |
+
|
141 |
+
function get_file() {
|
142 |
+
return $this->_file_start;
|
143 |
+
}
|
144 |
+
|
145 |
+
private function _log( &$message, $type, $wrapper = false ) {
|
146 |
+
if ( ! $this->is_on() ) {
|
147 |
+
return;
|
148 |
+
}
|
149 |
+
|
150 |
+
$bt = debug_backtrace();
|
151 |
+
$depth = $wrapper ? 3 : 2;
|
152 |
+
while ( $depth < count( $bt ) - 1 && 'eval' === $bt[ $depth ]['function'] ) {
|
153 |
+
$depth ++;
|
154 |
+
}
|
155 |
+
|
156 |
+
$caller = $bt[ $depth ];
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Retrieve the correct call file & line number from backtrace
|
160 |
+
* when logging from a wrapper method.
|
161 |
+
*
|
162 |
+
* @author Vova Feldman
|
163 |
+
* @since 1.2.1.6
|
164 |
+
*/
|
165 |
+
if ( empty( $caller['line'] ) ) {
|
166 |
+
$depth --;
|
167 |
+
|
168 |
+
while ( $depth >= 0 ) {
|
169 |
+
if ( ! empty( $bt[ $depth ]['line'] ) ) {
|
170 |
+
$caller['line'] = $bt[ $depth ]['line'];
|
171 |
+
$caller['file'] = $bt[ $depth ]['file'];
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
$log = array_merge( $caller, array(
|
178 |
+
'cnt' => self::$CNT ++,
|
179 |
+
'logger' => $this,
|
180 |
+
'timestamp' => microtime( true ),
|
181 |
+
'log_type' => $type,
|
182 |
+
'msg' => $message,
|
183 |
+
) );
|
184 |
+
|
185 |
+
if ( self::$_isStorageLoggingOn ) {
|
186 |
+
$this->db_log( $type, $message, self::$CNT, $caller );
|
187 |
+
}
|
188 |
+
|
189 |
+
self::$LOG[] = $log;
|
190 |
+
|
191 |
+
if ( $this->is_echo_on() && ! Freemius::is_ajax() ) {
|
192 |
+
echo self::format_html( $log ) . "\n";
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
function log( $message, $wrapper = false ) {
|
197 |
+
$this->_log( $message, 'log', $wrapper );
|
198 |
+
}
|
199 |
+
|
200 |
+
function info( $message, $wrapper = false ) {
|
201 |
+
$this->_log( $message, 'info', $wrapper );
|
202 |
+
}
|
203 |
+
|
204 |
+
function warn( $message, $wrapper = false ) {
|
205 |
+
$this->_log( $message, 'warn', $wrapper );
|
206 |
+
}
|
207 |
+
|
208 |
+
function error( $message, $wrapper = false ) {
|
209 |
+
$this->_log( $message, 'error', $wrapper );
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Log API error.
|
214 |
+
*
|
215 |
+
* @author Vova Feldman (@svovaf)
|
216 |
+
* @since 1.2.1.5
|
217 |
+
*
|
218 |
+
* @param mixed $api_result
|
219 |
+
* @param bool $wrapper
|
220 |
+
*/
|
221 |
+
function api_error( $api_result, $wrapper = false ) {
|
222 |
+
$message = '';
|
223 |
+
if ( is_object( $api_result ) &&
|
224 |
+
! empty( $api_result->error ) &&
|
225 |
+
! empty( $api_result->error->message )
|
226 |
+
) {
|
227 |
+
$message = $api_result->error->message;
|
228 |
+
} else if ( is_object( $api_result ) ) {
|
229 |
+
$message = var_export( $api_result, true );
|
230 |
+
} else if ( is_string( $api_result ) ) {
|
231 |
+
$message = $api_result;
|
232 |
+
} else if ( empty( $api_result ) ) {
|
233 |
+
$message = 'Empty API result.';
|
234 |
+
}
|
235 |
+
|
236 |
+
$message = 'API Error: ' . $message;
|
237 |
+
|
238 |
+
$this->_log( $message, 'error', $wrapper );
|
239 |
+
}
|
240 |
+
|
241 |
+
function entrance( $message = '', $wrapper = false ) {
|
242 |
+
$msg = 'Entrance' . ( empty( $message ) ? '' : ' > ' ) . $message;
|
243 |
+
|
244 |
+
$this->_log( $msg, 'log', $wrapper );
|
245 |
+
}
|
246 |
+
|
247 |
+
function departure( $message = '', $wrapper = false ) {
|
248 |
+
$msg = 'Departure' . ( empty( $message ) ? '' : ' > ' ) . $message;
|
249 |
+
|
250 |
+
$this->_log( $msg, 'log', $wrapper );
|
251 |
+
}
|
252 |
+
|
253 |
+
#--------------------------------------------------------------------------------
|
254 |
+
#region Log Formatting
|
255 |
+
#--------------------------------------------------------------------------------
|
256 |
+
|
257 |
+
private static function format( $log, $show_type = true ) {
|
258 |
+
return '[' . str_pad( $log['cnt'], strlen( self::$CNT ), '0', STR_PAD_LEFT ) . '] [' . $log['logger']->_id . '] ' . ( $show_type ? '[' . $log['log_type'] . ']' : '' ) . ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] . ' >> ' . $log['msg'] . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ') ' : '' ) . ' [' . $log['timestamp'] . ']';
|
259 |
+
}
|
260 |
+
|
261 |
+
private static function format_html( $log ) {
|
262 |
+
return '<div style="font-size: 13px; font-family: monospace; color: #7da767; padding: 8px 3px; background: #000; border-bottom: 1px solid #555;">[' . $log['cnt'] . '] [' . $log['logger']->_id . '] [' . $log['log_type'] . '] <b><code style="color: #c4b1e0;">' . ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] . '</code> >> <b style="color: #f59330;">' . esc_html( $log['msg'] ) . '</b></b>' . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ')' : '' ) . ' [' . $log['timestamp'] . ']</div>';
|
263 |
+
}
|
264 |
+
|
265 |
+
#endregion
|
266 |
+
|
267 |
+
static function dump() {
|
268 |
+
?>
|
269 |
+
<!-- BEGIN: Freemius PHP Console Log -->
|
270 |
+
<script type="text/javascript">
|
271 |
+
<?php
|
272 |
+
foreach ( self::$LOG as $log ) {
|
273 |
+
echo 'console.' . $log['log_type'] . '(' . json_encode( self::format( $log, false ) ) . ')' . "\n";
|
274 |
+
}
|
275 |
+
?>
|
276 |
+
</script>
|
277 |
+
<!-- END: Freemius PHP Console Log -->
|
278 |
+
<?php
|
279 |
+
}
|
280 |
+
|
281 |
+
static function get_log() {
|
282 |
+
return self::$LOG;
|
283 |
+
}
|
284 |
+
|
285 |
+
#--------------------------------------------------------------------------------
|
286 |
+
#region Database Logging
|
287 |
+
#--------------------------------------------------------------------------------
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @author Vova Feldman (@svovaf)
|
291 |
+
* @since 1.2.1.6
|
292 |
+
*
|
293 |
+
* @return bool
|
294 |
+
*/
|
295 |
+
public static function is_storage_logging_on() {
|
296 |
+
if ( ! isset( self::$_isStorageLoggingOn ) ) {
|
297 |
+
self::$_isStorageLoggingOn = ( 1 == get_option( 'fs_storage_logger', 0 ) );
|
298 |
+
}
|
299 |
+
|
300 |
+
return self::$_isStorageLoggingOn;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Turns on/off database persistent debugging to capture
|
305 |
+
* multi-session logs to debug complex flows like
|
306 |
+
* plugin auto-deactivate on premium version activation.
|
307 |
+
*
|
308 |
+
* @todo Check if Theme Check has issues with DB tables for themes.
|
309 |
+
*
|
310 |
+
* @author Vova Feldman (@svovaf)
|
311 |
+
* @since 1.2.1.6
|
312 |
+
*
|
313 |
+
* @param bool $is_on
|
314 |
+
*
|
315 |
+
* @return bool
|
316 |
+
*/
|
317 |
+
public static function _set_storage_logging( $is_on = true ) {
|
318 |
+
global $wpdb;
|
319 |
+
|
320 |
+
$table = "{$wpdb->prefix}fs_logger";
|
321 |
+
|
322 |
+
if ( $is_on ) {
|
323 |
+
/**
|
324 |
+
* Create logging table.
|
325 |
+
*
|
326 |
+
* NOTE:
|
327 |
+
* dbDelta must use KEY and not INDEX for indexes.
|
328 |
+
*
|
329 |
+
* @link https://core.trac.wordpress.org/ticket/2695
|
330 |
+
*/
|
331 |
+
$result = $wpdb->query( "CREATE TABLE {$table} (
|
332 |
+
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
333 |
+
`process_id` INT UNSIGNED NOT NULL,
|
334 |
+
`user_name` VARCHAR(64) NOT NULL,
|
335 |
+
`logger` VARCHAR(128) NOT NULL,
|
336 |
+
`log_order` INT UNSIGNED NOT NULL,
|
337 |
+
`type` ENUM('log','info','warn','error') NOT NULL DEFAULT 'log',
|
338 |
+
`message` TEXT NOT NULL,
|
339 |
+
`file` VARCHAR(256) NOT NULL,
|
340 |
+
`line` INT UNSIGNED NOT NULL,
|
341 |
+
`function` VARCHAR(256) NOT NULL,
|
342 |
+
`request_type` ENUM('call','ajax','cron') NOT NULL DEFAULT 'call',
|
343 |
+
`request_url` VARCHAR(1024) NOT NULL,
|
344 |
+
`created` DECIMAL(16, 6) NOT NULL,
|
345 |
+
PRIMARY KEY (`id`),
|
346 |
+
KEY `process_id` (`process_id` ASC),
|
347 |
+
KEY `process_logger` (`process_id` ASC, `logger` ASC),
|
348 |
+
KEY `function` (`function` ASC),
|
349 |
+
KEY `type` (`type` ASC))" );
|
350 |
+
} else {
|
351 |
+
/**
|
352 |
+
* Drop logging table.
|
353 |
+
*/
|
354 |
+
$result = $wpdb->query( "DROP TABLE IF EXISTS $table;" );
|
355 |
+
}
|
356 |
+
|
357 |
+
if ( false !== $result ) {
|
358 |
+
update_option( 'fs_storage_logger', ( $is_on ? 1 : 0 ) );
|
359 |
+
}
|
360 |
+
|
361 |
+
return ( false !== $result );
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* @author Vova Feldman (@svovaf)
|
366 |
+
* @since 1.2.1.6
|
367 |
+
*
|
368 |
+
* @param string $type
|
369 |
+
* @param string $message
|
370 |
+
* @param int $log_order
|
371 |
+
* @param array $caller
|
372 |
+
*
|
373 |
+
* @return false|int
|
374 |
+
*/
|
375 |
+
private function db_log(
|
376 |
+
&$type,
|
377 |
+
&$message,
|
378 |
+
&$log_order,
|
379 |
+
&$caller
|
380 |
+
) {
|
381 |
+
global $wpdb;
|
382 |
+
|
383 |
+
$request_type = 'call';
|
384 |
+
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
385 |
+
$request_type = 'cron';
|
386 |
+
} else if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
387 |
+
$request_type = 'ajax';
|
388 |
+
}
|
389 |
+
|
390 |
+
$request_url = WP_FS__IS_HTTP_REQUEST ?
|
391 |
+
$_SERVER['REQUEST_URI'] :
|
392 |
+
'';
|
393 |
+
|
394 |
+
return $wpdb->insert(
|
395 |
+
"{$wpdb->prefix}fs_logger",
|
396 |
+
array(
|
397 |
+
'process_id' => self::$_processID,
|
398 |
+
'user_name' => self::$_ownerName,
|
399 |
+
'logger' => $this->_id,
|
400 |
+
'log_order' => $log_order,
|
401 |
+
'type' => $type,
|
402 |
+
'request_type' => $request_type,
|
403 |
+
'request_url' => $request_url,
|
404 |
+
'message' => $message,
|
405 |
+
'file' => isset( $caller['file'] ) ?
|
406 |
+
substr( $caller['file'], self::$_abspathLength ) :
|
407 |
+
'',
|
408 |
+
'line' => $caller['line'],
|
409 |
+
'function' => ( ! empty( $caller['class'] ) ? $caller['class'] . $caller['type'] : '' ) . $caller['function'],
|
410 |
+
'created' => microtime( true ),
|
411 |
+
)
|
412 |
+
);
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Persistent DB logger columns.
|
417 |
+
*
|
418 |
+
* @var array
|
419 |
+
*/
|
420 |
+
private static $_log_columns = array(
|
421 |
+
'id',
|
422 |
+
'process_id',
|
423 |
+
'user_name',
|
424 |
+
'logger',
|
425 |
+
'log_order',
|
426 |
+
'type',
|
427 |
+
'message',
|
428 |
+
'file',
|
429 |
+
'line',
|
430 |
+
'function',
|
431 |
+
'request_type',
|
432 |
+
'request_url',
|
433 |
+
'created',
|
434 |
+
);
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Create DB logs query.
|
438 |
+
*
|
439 |
+
* @author Vova Feldman (@svovaf)
|
440 |
+
* @since 1.2.1.6
|
441 |
+
*
|
442 |
+
* @param bool $filters
|
443 |
+
* @param int $limit
|
444 |
+
* @param int $offset
|
445 |
+
* @param bool $order
|
446 |
+
* @param bool $escape_eol
|
447 |
+
*
|
448 |
+
* @return string
|
449 |
+
*/
|
450 |
+
private static function build_db_logs_query(
|
451 |
+
$filters = false,
|
452 |
+
$limit = 200,
|
453 |
+
$offset = 0,
|
454 |
+
$order = false,
|
455 |
+
$escape_eol = false
|
456 |
+
) {
|
457 |
+
global $wpdb;
|
458 |
+
|
459 |
+
$select = '*';
|
460 |
+
|
461 |
+
if ( $escape_eol ) {
|
462 |
+
$select = '';
|
463 |
+
for ( $i = 0, $len = count( self::$_log_columns ); $i < $len; $i ++ ) {
|
464 |
+
if ( $i > 0 ) {
|
465 |
+
$select .= ', ';
|
466 |
+
}
|
467 |
+
|
468 |
+
if ( 'message' !== self::$_log_columns[ $i ] ) {
|
469 |
+
$select .= self::$_log_columns[ $i ];
|
470 |
+
} else {
|
471 |
+
$select .= 'REPLACE(message , \'\n\', \' \') AS message';
|
472 |
+
}
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
$query = "SELECT {$select} FROM {$wpdb->prefix}fs_logger";
|
477 |
+
if ( is_array( $filters ) ) {
|
478 |
+
$criteria = array();
|
479 |
+
|
480 |
+
if ( ! empty( $filters['type'] ) && 'all' !== $filters['type'] ) {
|
481 |
+
$filters['type'] = strtolower( $filters['type'] );
|
482 |
+
|
483 |
+
switch ( $filters['type'] ) {
|
484 |
+
case 'warn_error':
|
485 |
+
$criteria[] = array( 'col' => 'type', 'val' => array( 'warn', 'error' ) );
|
486 |
+
break;
|
487 |
+
case 'error':
|
488 |
+
case 'warn':
|
489 |
+
$criteria[] = array( 'col' => 'type', 'val' => $filters['type'] );
|
490 |
+
break;
|
491 |
+
case 'info':
|
492 |
+
default:
|
493 |
+
$criteria[] = array( 'col' => 'type', 'val' => array( 'info', 'log' ) );
|
494 |
+
break;
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
if ( ! empty( $filters['request_type'] ) ) {
|
499 |
+
$filters['request_type'] = strtolower( $filters['request_type'] );
|
500 |
+
|
501 |
+
if ( in_array( $filters['request_type'], array( 'call', 'ajax', 'cron' ) ) ) {
|
502 |
+
$criteria[] = array( 'col' => 'request_type', 'val' => $filters['request_type'] );
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
if ( ! empty( $filters['file'] ) ) {
|
507 |
+
$criteria[] = array(
|
508 |
+
'col' => 'file',
|
509 |
+
'op' => 'LIKE',
|
510 |
+
'val' => '%' . esc_sql( $filters['file'] ),
|
511 |
+
);
|
512 |
+
}
|
513 |
+
|
514 |
+
if ( ! empty( $filters['function'] ) ) {
|
515 |
+
$criteria[] = array(
|
516 |
+
'col' => 'function',
|
517 |
+
'op' => 'LIKE',
|
518 |
+
'val' => '%' . esc_sql( $filters['function'] ),
|
519 |
+
);
|
520 |
+
}
|
521 |
+
|
522 |
+
if ( ! empty( $filters['process_id'] ) && is_numeric( $filters['process_id'] ) ) {
|
523 |
+
$criteria[] = array( 'col' => 'process_id', 'val' => $filters['process_id'] );
|
524 |
+
}
|
525 |
+
|
526 |
+
if ( ! empty( $filters['logger'] ) ) {
|
527 |
+
$criteria[] = array(
|
528 |
+
'col' => 'logger',
|
529 |
+
'op' => 'LIKE',
|
530 |
+
'val' => '%' . esc_sql( $filters['logger'] ) . '%',
|
531 |
+
);
|
532 |
+
}
|
533 |
+
|
534 |
+
if ( ! empty( $filters['message'] ) ) {
|
535 |
+
$criteria[] = array(
|
536 |
+
'col' => 'message',
|
537 |
+
'op' => 'LIKE',
|
538 |
+
'val' => '%' . esc_sql( $filters['message'] ) . '%',
|
539 |
+
);
|
540 |
+
}
|
541 |
+
|
542 |
+
if ( 0 < count( $criteria ) ) {
|
543 |
+
$query .= "\nWHERE\n";
|
544 |
+
|
545 |
+
$first = true;
|
546 |
+
foreach ( $criteria as $c ) {
|
547 |
+
if ( ! $first ) {
|
548 |
+
$query .= "AND\n";
|
549 |
+
}
|
550 |
+
|
551 |
+
if ( is_array( $c['val'] ) ) {
|
552 |
+
$operator = 'IN';
|
553 |
+
|
554 |
+
for ( $i = 0, $len = count( $c['val'] ); $i < $len; $i ++ ) {
|
555 |
+
$c['val'][ $i ] = "'" . esc_sql( $c['val'][ $i ] ) . "'";
|
556 |
+
}
|
557 |
+
|
558 |
+
$val = '(' . implode( ',', $c['val'] ) . ')';
|
559 |
+
} else {
|
560 |
+
$operator = ! empty( $c['op'] ) ? $c['op'] : '=';
|
561 |
+
$val = "'" . esc_sql( $c['val'] ) . "'";
|
562 |
+
}
|
563 |
+
|
564 |
+
$query .= "`{$c['col']}` {$operator} {$val}\n";
|
565 |
+
|
566 |
+
$first = false;
|
567 |
+
}
|
568 |
+
}
|
569 |
+
}
|
570 |
+
|
571 |
+
if ( ! is_array( $order ) ) {
|
572 |
+
$order = array(
|
573 |
+
'col' => 'id',
|
574 |
+
'order' => 'desc'
|
575 |
+
);
|
576 |
+
}
|
577 |
+
|
578 |
+
$query .= " ORDER BY {$order['col']} {$order['order']} LIMIT {$offset},{$limit}";
|
579 |
+
|
580 |
+
return $query;
|
581 |
+
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* Load logs from DB.
|
585 |
+
*
|
586 |
+
* @author Vova Feldman (@svovaf)
|
587 |
+
* @since 1.2.1.6
|
588 |
+
*
|
589 |
+
* @param bool $filters
|
590 |
+
* @param int $limit
|
591 |
+
* @param int $offset
|
592 |
+
* @param bool $order
|
593 |
+
*
|
594 |
+
* @return object[]|null
|
595 |
+
*/
|
596 |
+
public static function load_db_logs(
|
597 |
+
$filters = false,
|
598 |
+
$limit = 200,
|
599 |
+
$offset = 0,
|
600 |
+
$order = false
|
601 |
+
) {
|
602 |
+
global $wpdb;
|
603 |
+
|
604 |
+
$query = self::build_db_logs_query(
|
605 |
+
$filters,
|
606 |
+
$limit,
|
607 |
+
$offset,
|
608 |
+
$order
|
609 |
+
);
|
610 |
+
|
611 |
+
return $wpdb->get_results( $query );
|
612 |
+
}
|
613 |
+
|
614 |
+
/**
|
615 |
+
* Load logs from DB.
|
616 |
+
*
|
617 |
+
* @author Vova Feldman (@svovaf)
|
618 |
+
* @since 1.2.1.6
|
619 |
+
*
|
620 |
+
* @param bool $filters
|
621 |
+
* @param string $filename
|
622 |
+
* @param int $limit
|
623 |
+
* @param int $offset
|
624 |
+
* @param bool $order
|
625 |
+
*
|
626 |
+
* @return false|string File download URL or false on failure.
|
627 |
+
*/
|
628 |
+
public static function download_db_logs(
|
629 |
+
$filters = false,
|
630 |
+
$filename = '',
|
631 |
+
$limit = 10000,
|
632 |
+
$offset = 0,
|
633 |
+
$order = false
|
634 |
+
) {
|
635 |
+
global $wpdb;
|
636 |
+
|
637 |
+
$query = self::build_db_logs_query(
|
638 |
+
$filters,
|
639 |
+
$limit,
|
640 |
+
$offset,
|
641 |
+
$order,
|
642 |
+
true
|
643 |
+
);
|
644 |
+
|
645 |
+
$upload_dir = wp_upload_dir();
|
646 |
+
if ( empty( $filename ) ) {
|
647 |
+
$filename = 'fs-logs-' . date( 'Y-m-d_H-i-s', WP_FS__SCRIPT_START_TIME ) . '.csv';
|
648 |
+
}
|
649 |
+
$filepath = rtrim( $upload_dir['path'], '/' ) . "/{$filename}";
|
650 |
+
|
651 |
+
$query .= " INTO OUTFILE '{$filepath}' FIELDS TERMINATED BY '\t' ESCAPED BY '\\\\' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\\n'";
|
652 |
+
|
653 |
+
$columns = '';
|
654 |
+
for ( $i = 0, $len = count( self::$_log_columns ); $i < $len; $i ++ ) {
|
655 |
+
if ( $i > 0 ) {
|
656 |
+
$columns .= ', ';
|
657 |
+
}
|
658 |
+
|
659 |
+
$columns .= "'" . self::$_log_columns[ $i ] . "'";
|
660 |
+
}
|
661 |
+
|
662 |
+
$query = "SELECT {$columns} UNION ALL " . $query;
|
663 |
+
|
664 |
+
$result = $wpdb->query( $query );
|
665 |
+
|
666 |
+
if ( false === $result ) {
|
667 |
+
return false;
|
668 |
+
}
|
669 |
+
|
670 |
+
return rtrim( $upload_dir['url'], '/' ) . '/' . $filename;
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* @author Vova Feldman (@svovaf)
|
675 |
+
* @since 1.2.1.6
|
676 |
+
*
|
677 |
+
* @param string $filename
|
678 |
+
*
|
679 |
+
* @return string
|
680 |
+
*/
|
681 |
+
public static function get_logs_download_url( $filename = '' ) {
|
682 |
+
$upload_dir = wp_upload_dir();
|
683 |
+
if ( empty( $filename ) ) {
|
684 |
+
$filename = 'fs-logs-' . date( 'Y-m-d_H-i-s', WP_FS__SCRIPT_START_TIME ) . '.csv';
|
685 |
+
}
|
686 |
+
|
687 |
+
return rtrim( $upload_dir['url'], '/' ) . $filename;
|
688 |
+
}
|
689 |
+
|
690 |
+
#endregion
|
691 |
+
}
|
lib/freemius/includes/class-fs-security.php
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Class FS_Security
|
17 |
-
*/
|
18 |
-
class FS_Security {
|
19 |
-
/**
|
20 |
-
* @var FS_Security
|
21 |
-
* @since 1.0.3
|
22 |
-
*/
|
23 |
-
private static $_instance;
|
24 |
-
/**
|
25 |
-
* @var FS_Logger
|
26 |
-
* @since 1.0.3
|
27 |
-
*/
|
28 |
-
private static $_logger;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @return \FS_Security
|
32 |
-
*/
|
33 |
-
public static function instance() {
|
34 |
-
if ( ! isset( self::$_instance ) ) {
|
35 |
-
self::$_instance = new FS_Security();
|
36 |
-
self::$_logger = FS_Logger::get_logger(
|
37 |
-
WP_FS__SLUG,
|
38 |
-
WP_FS__DEBUG_SDK,
|
39 |
-
WP_FS__ECHO_DEBUG_SDK
|
40 |
-
);
|
41 |
-
}
|
42 |
-
|
43 |
-
return self::$_instance;
|
44 |
-
}
|
45 |
-
|
46 |
-
private function __construct() {
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @param \FS_Scope_Entity $entity
|
51 |
-
* @param int $timestamp
|
52 |
-
* @param string $action
|
53 |
-
*
|
54 |
-
* @return string
|
55 |
-
*/
|
56 |
-
function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
|
57 |
-
return md5(
|
58 |
-
$timestamp .
|
59 |
-
$entity->id .
|
60 |
-
$entity->secret_key .
|
61 |
-
$entity->public_key .
|
62 |
-
$action
|
63 |
-
);
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* @param \FS_Scope_Entity $entity
|
68 |
-
* @param int|bool $timestamp
|
69 |
-
* @param string $action
|
70 |
-
*
|
71 |
-
* @return array
|
72 |
-
*/
|
73 |
-
function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
|
74 |
-
if ( false === $timestamp ) {
|
75 |
-
$timestamp = time();
|
76 |
-
}
|
77 |
-
|
78 |
-
return array(
|
79 |
-
's_ctx_type' => $entity->get_type(),
|
80 |
-
's_ctx_id' => $entity->id,
|
81 |
-
's_ctx_ts' => $timestamp,
|
82 |
-
's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
|
83 |
-
);
|
84 |
-
}
|
85 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class FS_Security
|
17 |
+
*/
|
18 |
+
class FS_Security {
|
19 |
+
/**
|
20 |
+
* @var FS_Security
|
21 |
+
* @since 1.0.3
|
22 |
+
*/
|
23 |
+
private static $_instance;
|
24 |
+
/**
|
25 |
+
* @var FS_Logger
|
26 |
+
* @since 1.0.3
|
27 |
+
*/
|
28 |
+
private static $_logger;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @return \FS_Security
|
32 |
+
*/
|
33 |
+
public static function instance() {
|
34 |
+
if ( ! isset( self::$_instance ) ) {
|
35 |
+
self::$_instance = new FS_Security();
|
36 |
+
self::$_logger = FS_Logger::get_logger(
|
37 |
+
WP_FS__SLUG,
|
38 |
+
WP_FS__DEBUG_SDK,
|
39 |
+
WP_FS__ECHO_DEBUG_SDK
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
return self::$_instance;
|
44 |
+
}
|
45 |
+
|
46 |
+
private function __construct() {
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param \FS_Scope_Entity $entity
|
51 |
+
* @param int $timestamp
|
52 |
+
* @param string $action
|
53 |
+
*
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
+
function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
|
57 |
+
return md5(
|
58 |
+
$timestamp .
|
59 |
+
$entity->id .
|
60 |
+
$entity->secret_key .
|
61 |
+
$entity->public_key .
|
62 |
+
$action
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param \FS_Scope_Entity $entity
|
68 |
+
* @param int|bool $timestamp
|
69 |
+
* @param string $action
|
70 |
+
*
|
71 |
+
* @return array
|
72 |
+
*/
|
73 |
+
function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
|
74 |
+
if ( false === $timestamp ) {
|
75 |
+
$timestamp = time();
|
76 |
+
}
|
77 |
+
|
78 |
+
return array(
|
79 |
+
's_ctx_type' => $entity->get_type(),
|
80 |
+
's_ctx_id' => $entity->id,
|
81 |
+
's_ctx_ts' => $timestamp,
|
82 |
+
's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
|
83 |
+
);
|
84 |
+
}
|
85 |
+
}
|
lib/freemius/includes/class-fs-user-lock.php
CHANGED
@@ -1,126 +1,126 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.1.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class FS_User_Lock
|
15 |
-
*/
|
16 |
-
class FS_User_Lock {
|
17 |
-
/**
|
18 |
-
* @var int
|
19 |
-
*/
|
20 |
-
private $_wp_user_id;
|
21 |
-
/**
|
22 |
-
* @var int
|
23 |
-
*/
|
24 |
-
private $_thread_id;
|
25 |
-
|
26 |
-
#--------------------------------------------------------------------------------
|
27 |
-
#region Singleton
|
28 |
-
#--------------------------------------------------------------------------------
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var FS_User_Lock
|
32 |
-
*/
|
33 |
-
private static $_instance;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @author Vova Feldman (@svovaf)
|
37 |
-
* @since 2.1.0
|
38 |
-
*
|
39 |
-
* @return FS_User_Lock
|
40 |
-
*/
|
41 |
-
static function instance() {
|
42 |
-
if ( ! isset( self::$_instance ) ) {
|
43 |
-
self::$_instance = new self();
|
44 |
-
}
|
45 |
-
|
46 |
-
return self::$_instance;
|
47 |
-
}
|
48 |
-
|
49 |
-
#endregion
|
50 |
-
|
51 |
-
private function __construct() {
|
52 |
-
$this->_wp_user_id = Freemius::get_current_wp_user_id();
|
53 |
-
$this->_thread_id = mt_rand( 0, 32000 );
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
|
59 |
-
*
|
60 |
-
* @author Vova Feldman (@svovaf)
|
61 |
-
* @since 2.1.0
|
62 |
-
*
|
63 |
-
* @param int $expiration
|
64 |
-
*
|
65 |
-
* @return bool TRUE if successfully acquired lock.
|
66 |
-
*/
|
67 |
-
function try_lock( $expiration = 0 ) {
|
68 |
-
if ( $this->is_locked() ) {
|
69 |
-
// Already locked.
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
|
73 |
-
set_site_transient( "locked_{$this->_wp_user_id}", $this->_thread_id, $expiration );
|
74 |
-
|
75 |
-
if ( $this->has_lock() ) {
|
76 |
-
set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
|
77 |
-
|
78 |
-
return true;
|
79 |
-
}
|
80 |
-
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Acquire lock regardless if it's already acquired by another locker or not.
|
86 |
-
*
|
87 |
-
* @author Vova Feldman (@svovaf)
|
88 |
-
* @since 2.1.0
|
89 |
-
*
|
90 |
-
* @param int $expiration
|
91 |
-
*/
|
92 |
-
function lock( $expiration = 0 ) {
|
93 |
-
set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Checks if lock is currently acquired.
|
98 |
-
*
|
99 |
-
* @author Vova Feldman (@svovaf)
|
100 |
-
* @since 2.1.0
|
101 |
-
*
|
102 |
-
* @return bool
|
103 |
-
*/
|
104 |
-
function is_locked() {
|
105 |
-
return ( false !== get_site_transient( "locked_{$this->_wp_user_id}" ) );
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Unlock the lock.
|
110 |
-
*
|
111 |
-
* @author Vova Feldman (@svovaf)
|
112 |
-
* @since 2.1.0
|
113 |
-
*/
|
114 |
-
function unlock() {
|
115 |
-
delete_site_transient( "locked_{$this->_wp_user_id}" );
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Checks if lock is currently acquired by the current locker.
|
120 |
-
*
|
121 |
-
* @return bool
|
122 |
-
*/
|
123 |
-
private function has_lock() {
|
124 |
-
return ( $this->_thread_id == get_site_transient( "locked_{$this->_wp_user_id}" ) );
|
125 |
-
}
|
126 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class FS_User_Lock
|
15 |
+
*/
|
16 |
+
class FS_User_Lock {
|
17 |
+
/**
|
18 |
+
* @var int
|
19 |
+
*/
|
20 |
+
private $_wp_user_id;
|
21 |
+
/**
|
22 |
+
* @var int
|
23 |
+
*/
|
24 |
+
private $_thread_id;
|
25 |
+
|
26 |
+
#--------------------------------------------------------------------------------
|
27 |
+
#region Singleton
|
28 |
+
#--------------------------------------------------------------------------------
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @var FS_User_Lock
|
32 |
+
*/
|
33 |
+
private static $_instance;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @author Vova Feldman (@svovaf)
|
37 |
+
* @since 2.1.0
|
38 |
+
*
|
39 |
+
* @return FS_User_Lock
|
40 |
+
*/
|
41 |
+
static function instance() {
|
42 |
+
if ( ! isset( self::$_instance ) ) {
|
43 |
+
self::$_instance = new self();
|
44 |
+
}
|
45 |
+
|
46 |
+
return self::$_instance;
|
47 |
+
}
|
48 |
+
|
49 |
+
#endregion
|
50 |
+
|
51 |
+
private function __construct() {
|
52 |
+
$this->_wp_user_id = Freemius::get_current_wp_user_id();
|
53 |
+
$this->_thread_id = mt_rand( 0, 32000 );
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
|
59 |
+
*
|
60 |
+
* @author Vova Feldman (@svovaf)
|
61 |
+
* @since 2.1.0
|
62 |
+
*
|
63 |
+
* @param int $expiration
|
64 |
+
*
|
65 |
+
* @return bool TRUE if successfully acquired lock.
|
66 |
+
*/
|
67 |
+
function try_lock( $expiration = 0 ) {
|
68 |
+
if ( $this->is_locked() ) {
|
69 |
+
// Already locked.
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
set_site_transient( "locked_{$this->_wp_user_id}", $this->_thread_id, $expiration );
|
74 |
+
|
75 |
+
if ( $this->has_lock() ) {
|
76 |
+
set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
|
77 |
+
|
78 |
+
return true;
|
79 |
+
}
|
80 |
+
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Acquire lock regardless if it's already acquired by another locker or not.
|
86 |
+
*
|
87 |
+
* @author Vova Feldman (@svovaf)
|
88 |
+
* @since 2.1.0
|
89 |
+
*
|
90 |
+
* @param int $expiration
|
91 |
+
*/
|
92 |
+
function lock( $expiration = 0 ) {
|
93 |
+
set_site_transient( "locked_{$this->_wp_user_id}", true, $expiration );
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Checks if lock is currently acquired.
|
98 |
+
*
|
99 |
+
* @author Vova Feldman (@svovaf)
|
100 |
+
* @since 2.1.0
|
101 |
+
*
|
102 |
+
* @return bool
|
103 |
+
*/
|
104 |
+
function is_locked() {
|
105 |
+
return ( false !== get_site_transient( "locked_{$this->_wp_user_id}" ) );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Unlock the lock.
|
110 |
+
*
|
111 |
+
* @author Vova Feldman (@svovaf)
|
112 |
+
* @since 2.1.0
|
113 |
+
*/
|
114 |
+
function unlock() {
|
115 |
+
delete_site_transient( "locked_{$this->_wp_user_id}" );
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Checks if lock is currently acquired by the current locker.
|
120 |
+
*
|
121 |
+
* @return bool
|
122 |
+
*/
|
123 |
+
private function has_lock() {
|
124 |
+
return ( $this->_thread_id == get_site_transient( "locked_{$this->_wp_user_id}" ) );
|
125 |
+
}
|
126 |
}
|
lib/freemius/includes/customizer/class-fs-customizer-support-section.php
CHANGED
@@ -1,102 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.2.7
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class Zerif_Customizer_Theme_Info_Main
|
15 |
-
*
|
16 |
-
* @since 1.0.0
|
17 |
-
* @access public
|
18 |
-
*/
|
19 |
-
class FS_Customizer_Support_Section extends WP_Customize_Section {
|
20 |
-
|
21 |
-
function __construct( $manager, $id, $args = array() ) {
|
22 |
-
$manager->register_section_type( 'FS_Customizer_Support_Section' );
|
23 |
-
|
24 |
-
parent::__construct( $manager, $id, $args );
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* The type of customize section being rendered.
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
* @access public
|
32 |
-
* @var string
|
33 |
-
*/
|
34 |
-
public $type = 'freemius-support-section';
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var Freemius
|
38 |
-
*/
|
39 |
-
public $fs = null;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Add custom parameters to pass to the JS via JSON.
|
43 |
-
*
|
44 |
-
* @since 1.0.0
|
45 |
-
*/
|
46 |
-
public function json() {
|
47 |
-
$json = parent::json();
|
48 |
-
|
49 |
-
$is_contact_visible = $this->fs->is_page_visible( 'contact' );
|
50 |
-
$is_support_visible = $this->fs->is_page_visible( 'support' );
|
51 |
-
|
52 |
-
$json['theme_title'] = $this->fs->get_plugin_name();
|
53 |
-
|
54 |
-
if ( $is_contact_visible && $is_support_visible ) {
|
55 |
-
$json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
|
56 |
-
}
|
57 |
-
|
58 |
-
if ( $is_contact_visible ) {
|
59 |
-
$json['contact'] = array(
|
60 |
-
'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
|
61 |
-
'url' => $this->fs->contact_url(),
|
62 |
-
);
|
63 |
-
}
|
64 |
-
|
65 |
-
if ( $is_support_visible ) {
|
66 |
-
$json['support'] = array(
|
67 |
-
'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
|
68 |
-
'url' => $this->fs->get_support_forum_url()
|
69 |
-
);
|
70 |
-
}
|
71 |
-
|
72 |
-
return $json;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Outputs the Underscore.js template.
|
77 |
-
*
|
78 |
-
* @since 1.0.0
|
79 |
-
*/
|
80 |
-
protected function render_template() {
|
81 |
-
?>
|
82 |
-
<li id="fs_customizer_support"
|
83 |
-
class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
84 |
-
<h3 class="accordion-section-title">
|
85 |
-
<span>{{ data.theme_title }}</span>
|
86 |
-
<# if ( data.contact && data.support ) { #>
|
87 |
-
<div class="button-group">
|
88 |
-
<# } #>
|
89 |
-
<# if ( data.contact ) { #>
|
90 |
-
<a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
|
91 |
-
<# } #>
|
92 |
-
<# if ( data.support ) { #>
|
93 |
-
<a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
|
94 |
-
<# } #>
|
95 |
-
<# if ( data.contact && data.support ) { #>
|
96 |
-
</div>
|
97 |
-
<# } #>
|
98 |
-
</h3>
|
99 |
-
</li>
|
100 |
-
<?php
|
101 |
-
}
|
102 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.2.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class Zerif_Customizer_Theme_Info_Main
|
15 |
+
*
|
16 |
+
* @since 1.0.0
|
17 |
+
* @access public
|
18 |
+
*/
|
19 |
+
class FS_Customizer_Support_Section extends WP_Customize_Section {
|
20 |
+
|
21 |
+
function __construct( $manager, $id, $args = array() ) {
|
22 |
+
$manager->register_section_type( 'FS_Customizer_Support_Section' );
|
23 |
+
|
24 |
+
parent::__construct( $manager, $id, $args );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* The type of customize section being rendered.
|
29 |
+
*
|
30 |
+
* @since 1.0.0
|
31 |
+
* @access public
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
public $type = 'freemius-support-section';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var Freemius
|
38 |
+
*/
|
39 |
+
public $fs = null;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Add custom parameters to pass to the JS via JSON.
|
43 |
+
*
|
44 |
+
* @since 1.0.0
|
45 |
+
*/
|
46 |
+
public function json() {
|
47 |
+
$json = parent::json();
|
48 |
+
|
49 |
+
$is_contact_visible = $this->fs->is_page_visible( 'contact' );
|
50 |
+
$is_support_visible = $this->fs->is_page_visible( 'support' );
|
51 |
+
|
52 |
+
$json['theme_title'] = $this->fs->get_plugin_name();
|
53 |
+
|
54 |
+
if ( $is_contact_visible && $is_support_visible ) {
|
55 |
+
$json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
|
56 |
+
}
|
57 |
+
|
58 |
+
if ( $is_contact_visible ) {
|
59 |
+
$json['contact'] = array(
|
60 |
+
'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
|
61 |
+
'url' => $this->fs->contact_url(),
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
if ( $is_support_visible ) {
|
66 |
+
$json['support'] = array(
|
67 |
+
'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
|
68 |
+
'url' => $this->fs->get_support_forum_url()
|
69 |
+
);
|
70 |
+
}
|
71 |
+
|
72 |
+
return $json;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Outputs the Underscore.js template.
|
77 |
+
*
|
78 |
+
* @since 1.0.0
|
79 |
+
*/
|
80 |
+
protected function render_template() {
|
81 |
+
?>
|
82 |
+
<li id="fs_customizer_support"
|
83 |
+
class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
84 |
+
<h3 class="accordion-section-title">
|
85 |
+
<span>{{ data.theme_title }}</span>
|
86 |
+
<# if ( data.contact && data.support ) { #>
|
87 |
+
<div class="button-group">
|
88 |
+
<# } #>
|
89 |
+
<# if ( data.contact ) { #>
|
90 |
+
<a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
|
91 |
+
<# } #>
|
92 |
+
<# if ( data.support ) { #>
|
93 |
+
<a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
|
94 |
+
<# } #>
|
95 |
+
<# if ( data.contact && data.support ) { #>
|
96 |
+
</div>
|
97 |
+
<# } #>
|
98 |
+
</h3>
|
99 |
+
</li>
|
100 |
+
<?php
|
101 |
+
}
|
102 |
}
|
lib/freemius/includes/customizer/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/debug/class-fs-debug-bar-panel.php
CHANGED
@@ -1,64 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
|
15 |
-
*
|
16 |
-
* @author Vova Feldman (@svovaf)
|
17 |
-
* @since 1.1.7.3
|
18 |
-
*
|
19 |
-
* Class Freemius_Debug_Bar_Panel
|
20 |
-
*/
|
21 |
-
class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
|
22 |
-
function init() {
|
23 |
-
$this->title( 'Freemius' );
|
24 |
-
}
|
25 |
-
|
26 |
-
static function requests_count() {
|
27 |
-
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
28 |
-
$logger = Freemius_Api_WordPress::GetLogger();
|
29 |
-
} else {
|
30 |
-
$logger = array();
|
31 |
-
}
|
32 |
-
|
33 |
-
return number_format( count( $logger ) );
|
34 |
-
}
|
35 |
-
|
36 |
-
static function total_time() {
|
37 |
-
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
38 |
-
$logger = Freemius_Api_WordPress::GetLogger();
|
39 |
-
} else {
|
40 |
-
$logger = array();
|
41 |
-
}
|
42 |
-
|
43 |
-
$total_time = .0;
|
44 |
-
foreach ( $logger as $l ) {
|
45 |
-
$total_time += $l['total'];
|
46 |
-
}
|
47 |
-
|
48 |
-
return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
|
49 |
-
}
|
50 |
-
|
51 |
-
function render() {
|
52 |
-
?>
|
53 |
-
<div id='debug-bar-php'>
|
54 |
-
<?php fs_require_template( '/debug/api-calls.php' ) ?>
|
55 |
-
<br>
|
56 |
-
<?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
|
57 |
-
<br>
|
58 |
-
<?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
|
59 |
-
<br>
|
60 |
-
<?php fs_require_template( '/debug/logger.php' ) ?>
|
61 |
-
</div>
|
62 |
-
<?php
|
63 |
-
}
|
64 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
|
15 |
+
*
|
16 |
+
* @author Vova Feldman (@svovaf)
|
17 |
+
* @since 1.1.7.3
|
18 |
+
*
|
19 |
+
* Class Freemius_Debug_Bar_Panel
|
20 |
+
*/
|
21 |
+
class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
|
22 |
+
function init() {
|
23 |
+
$this->title( 'Freemius' );
|
24 |
+
}
|
25 |
+
|
26 |
+
static function requests_count() {
|
27 |
+
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
28 |
+
$logger = Freemius_Api_WordPress::GetLogger();
|
29 |
+
} else {
|
30 |
+
$logger = array();
|
31 |
+
}
|
32 |
+
|
33 |
+
return number_format( count( $logger ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
static function total_time() {
|
37 |
+
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
38 |
+
$logger = Freemius_Api_WordPress::GetLogger();
|
39 |
+
} else {
|
40 |
+
$logger = array();
|
41 |
+
}
|
42 |
+
|
43 |
+
$total_time = .0;
|
44 |
+
foreach ( $logger as $l ) {
|
45 |
+
$total_time += $l['total'];
|
46 |
+
}
|
47 |
+
|
48 |
+
return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
|
49 |
+
}
|
50 |
+
|
51 |
+
function render() {
|
52 |
+
?>
|
53 |
+
<div id='debug-bar-php'>
|
54 |
+
<?php fs_require_template( '/debug/api-calls.php' ) ?>
|
55 |
+
<br>
|
56 |
+
<?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
|
57 |
+
<br>
|
58 |
+
<?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
|
59 |
+
<br>
|
60 |
+
<?php fs_require_template( '/debug/logger.php' ) ?>
|
61 |
+
</div>
|
62 |
+
<?php
|
63 |
+
}
|
64 |
+
}
|
lib/freemius/includes/debug/debug-bar-start.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if ( ! WP_FS__DEBUG_SDK ) {
|
14 |
-
return;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Initialize Freemius custom debug panels.
|
19 |
-
*
|
20 |
-
* @param array $panels Debug bar panels objects
|
21 |
-
*
|
22 |
-
* @return array Debug bar panels with your custom panels
|
23 |
-
*/
|
24 |
-
function fs_custom_panels_init( $panels ) {
|
25 |
-
if ( class_exists( 'Debug_Bar_Panel' ) ) {
|
26 |
-
if ( FS_API__LOGGER_ON ) {
|
27 |
-
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
|
28 |
-
$panels[] = new Freemius_Debug_Bar_Panel();
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
return $panels;
|
33 |
-
}
|
34 |
-
|
35 |
-
function fs_custom_status_init( $statuses ) {
|
36 |
-
if ( class_exists( 'Debug_Bar_Panel' ) ) {
|
37 |
-
if ( FS_API__LOGGER_ON ) {
|
38 |
-
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
|
39 |
-
$statuses[] = array(
|
40 |
-
'fs_api_requests',
|
41 |
-
fs_text_inline( 'Freemius API' ),
|
42 |
-
Freemius_Debug_Bar_Panel::requests_count() . ' ' . fs_text_inline( 'Requests' ) .
|
43 |
-
' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
|
44 |
-
);
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
return $statuses;
|
49 |
-
}
|
50 |
-
|
51 |
-
add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
|
52 |
add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( ! WP_FS__DEBUG_SDK ) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Initialize Freemius custom debug panels.
|
19 |
+
*
|
20 |
+
* @param array $panels Debug bar panels objects
|
21 |
+
*
|
22 |
+
* @return array Debug bar panels with your custom panels
|
23 |
+
*/
|
24 |
+
function fs_custom_panels_init( $panels ) {
|
25 |
+
if ( class_exists( 'Debug_Bar_Panel' ) ) {
|
26 |
+
if ( FS_API__LOGGER_ON ) {
|
27 |
+
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
|
28 |
+
$panels[] = new Freemius_Debug_Bar_Panel();
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
return $panels;
|
33 |
+
}
|
34 |
+
|
35 |
+
function fs_custom_status_init( $statuses ) {
|
36 |
+
if ( class_exists( 'Debug_Bar_Panel' ) ) {
|
37 |
+
if ( FS_API__LOGGER_ON ) {
|
38 |
+
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
|
39 |
+
$statuses[] = array(
|
40 |
+
'fs_api_requests',
|
41 |
+
fs_text_inline( 'Freemius API' ),
|
42 |
+
Freemius_Debug_Bar_Panel::requests_count() . ' ' . fs_text_inline( 'Requests' ) .
|
43 |
+
' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
return $statuses;
|
49 |
+
}
|
50 |
+
|
51 |
+
add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
|
52 |
add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
|
lib/freemius/includes/debug/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/entities/class-fs-affiliate.php
CHANGED
@@ -1,84 +1,84 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Affiliate extends FS_Scope_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var string
|
19 |
-
*/
|
20 |
-
public $paypal_email;
|
21 |
-
/**
|
22 |
-
* @var number
|
23 |
-
*/
|
24 |
-
public $custom_affiliate_terms_id;
|
25 |
-
/**
|
26 |
-
* @var boolean
|
27 |
-
*/
|
28 |
-
public $is_using_custom_terms;
|
29 |
-
/**
|
30 |
-
* @var string status Enum: `pending`, `rejected`, `suspended`, or `active`. Defaults to `pending`.
|
31 |
-
*/
|
32 |
-
public $status;
|
33 |
-
/**
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
public $domain;
|
37 |
-
|
38 |
-
#endregion Properties
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @author Leo Fajardo
|
42 |
-
*
|
43 |
-
* @return bool
|
44 |
-
*/
|
45 |
-
function is_active() {
|
46 |
-
return ( 'active' === $this->status );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @author Leo Fajardo
|
51 |
-
*
|
52 |
-
* @return bool
|
53 |
-
*/
|
54 |
-
function is_pending() {
|
55 |
-
return ( 'pending' === $this->status );
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @author Leo Fajardo
|
60 |
-
*
|
61 |
-
* @return bool
|
62 |
-
*/
|
63 |
-
function is_suspended() {
|
64 |
-
return ( 'suspended' === $this->status );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @author Leo Fajardo
|
69 |
-
*
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
function is_rejected() {
|
73 |
-
return ( 'rejected' === $this->status );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* @author Leo Fajardo
|
78 |
-
*
|
79 |
-
* @return bool
|
80 |
-
*/
|
81 |
-
function is_blocked() {
|
82 |
-
return ( 'blocked' === $this->status );
|
83 |
-
}
|
84 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Affiliate extends FS_Scope_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
public $paypal_email;
|
21 |
+
/**
|
22 |
+
* @var number
|
23 |
+
*/
|
24 |
+
public $custom_affiliate_terms_id;
|
25 |
+
/**
|
26 |
+
* @var boolean
|
27 |
+
*/
|
28 |
+
public $is_using_custom_terms;
|
29 |
+
/**
|
30 |
+
* @var string status Enum: `pending`, `rejected`, `suspended`, or `active`. Defaults to `pending`.
|
31 |
+
*/
|
32 |
+
public $status;
|
33 |
+
/**
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
public $domain;
|
37 |
+
|
38 |
+
#endregion Properties
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @author Leo Fajardo
|
42 |
+
*
|
43 |
+
* @return bool
|
44 |
+
*/
|
45 |
+
function is_active() {
|
46 |
+
return ( 'active' === $this->status );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @author Leo Fajardo
|
51 |
+
*
|
52 |
+
* @return bool
|
53 |
+
*/
|
54 |
+
function is_pending() {
|
55 |
+
return ( 'pending' === $this->status );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @author Leo Fajardo
|
60 |
+
*
|
61 |
+
* @return bool
|
62 |
+
*/
|
63 |
+
function is_suspended() {
|
64 |
+
return ( 'suspended' === $this->status );
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @author Leo Fajardo
|
69 |
+
*
|
70 |
+
* @return bool
|
71 |
+
*/
|
72 |
+
function is_rejected() {
|
73 |
+
return ( 'rejected' === $this->status );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @author Leo Fajardo
|
78 |
+
*
|
79 |
+
* @return bool
|
80 |
+
*/
|
81 |
+
function is_blocked() {
|
82 |
+
return ( 'blocked' === $this->status );
|
83 |
+
}
|
84 |
}
|
lib/freemius/includes/entities/class-fs-billing.php
CHANGED
@@ -1,95 +1,95 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius for EDD Add-On
|
4 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Billing extends FS_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var int
|
19 |
-
*/
|
20 |
-
public $entity_id;
|
21 |
-
/**
|
22 |
-
* @var string (Enum) Linked entity type. One of: developer, plugin, user, install
|
23 |
-
*/
|
24 |
-
public $entity_type;
|
25 |
-
/**
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
public $business_name;
|
29 |
-
/**
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
public $first;
|
33 |
-
/**
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
public $last;
|
37 |
-
/**
|
38 |
-
* @var string
|
39 |
-
*/
|
40 |
-
public $email;
|
41 |
-
/**
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
public $phone;
|
45 |
-
/**
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
public $website;
|
49 |
-
/**
|
50 |
-
* @var string Tax or VAT ID.
|
51 |
-
*/
|
52 |
-
public $tax_id;
|
53 |
-
/**
|
54 |
-
* @var string
|
55 |
-
*/
|
56 |
-
public $address_street;
|
57 |
-
/**
|
58 |
-
* @var string
|
59 |
-
*/
|
60 |
-
public $address_apt;
|
61 |
-
/**
|
62 |
-
* @var string
|
63 |
-
*/
|
64 |
-
public $address_city;
|
65 |
-
/**
|
66 |
-
* @var string
|
67 |
-
*/
|
68 |
-
public $address_country;
|
69 |
-
/**
|
70 |
-
* @var string Two chars country code.
|
71 |
-
*/
|
72 |
-
public $address_country_code;
|
73 |
-
/**
|
74 |
-
* @var string
|
75 |
-
*/
|
76 |
-
public $address_state;
|
77 |
-
/**
|
78 |
-
* @var number Numeric ZIP code (cab be with leading zeros).
|
79 |
-
*/
|
80 |
-
public $address_zip;
|
81 |
-
|
82 |
-
#endregion Properties
|
83 |
-
|
84 |
-
|
85 |
-
/**
|
86 |
-
* @param object|bool $event
|
87 |
-
*/
|
88 |
-
function __construct( $event = false ) {
|
89 |
-
parent::__construct( $event );
|
90 |
-
}
|
91 |
-
|
92 |
-
static function get_type() {
|
93 |
-
return 'billing';
|
94 |
-
}
|
95 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius for EDD Add-On
|
4 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Billing extends FS_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var int
|
19 |
+
*/
|
20 |
+
public $entity_id;
|
21 |
+
/**
|
22 |
+
* @var string (Enum) Linked entity type. One of: developer, plugin, user, install
|
23 |
+
*/
|
24 |
+
public $entity_type;
|
25 |
+
/**
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $business_name;
|
29 |
+
/**
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
public $first;
|
33 |
+
/**
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
public $last;
|
37 |
+
/**
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
public $email;
|
41 |
+
/**
|
42 |
+
* @var string
|
43 |
+
*/
|
44 |
+
public $phone;
|
45 |
+
/**
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
public $website;
|
49 |
+
/**
|
50 |
+
* @var string Tax or VAT ID.
|
51 |
+
*/
|
52 |
+
public $tax_id;
|
53 |
+
/**
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
public $address_street;
|
57 |
+
/**
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
public $address_apt;
|
61 |
+
/**
|
62 |
+
* @var string
|
63 |
+
*/
|
64 |
+
public $address_city;
|
65 |
+
/**
|
66 |
+
* @var string
|
67 |
+
*/
|
68 |
+
public $address_country;
|
69 |
+
/**
|
70 |
+
* @var string Two chars country code.
|
71 |
+
*/
|
72 |
+
public $address_country_code;
|
73 |
+
/**
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
public $address_state;
|
77 |
+
/**
|
78 |
+
* @var number Numeric ZIP code (cab be with leading zeros).
|
79 |
+
*/
|
80 |
+
public $address_zip;
|
81 |
+
|
82 |
+
#endregion Properties
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param object|bool $event
|
87 |
+
*/
|
88 |
+
function __construct( $event = false ) {
|
89 |
+
parent::__construct( $event );
|
90 |
+
}
|
91 |
+
|
92 |
+
static function get_type() {
|
93 |
+
return 'billing';
|
94 |
+
}
|
95 |
}
|
lib/freemius/includes/entities/class-fs-entity.php
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Get object's public variables.
|
15 |
-
*
|
16 |
-
* @author Vova Feldman (@svovaf)
|
17 |
-
* @since 1.0.0
|
18 |
-
*
|
19 |
-
* @param object $object
|
20 |
-
*
|
21 |
-
* @return array
|
22 |
-
*/
|
23 |
-
function fs_get_object_public_vars( $object ) {
|
24 |
-
return get_object_vars( $object );
|
25 |
-
}
|
26 |
-
|
27 |
-
class FS_Entity {
|
28 |
-
/**
|
29 |
-
* @var number
|
30 |
-
*/
|
31 |
-
public $id;
|
32 |
-
/**
|
33 |
-
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
|
34 |
-
*/
|
35 |
-
public $updated;
|
36 |
-
/**
|
37 |
-
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
|
38 |
-
*/
|
39 |
-
public $created;
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @param bool|object $entity
|
43 |
-
*/
|
44 |
-
function __construct( $entity = false ) {
|
45 |
-
if ( ! ( $entity instanceof stdClass ) && ! ( $entity instanceof FS_Entity ) ) {
|
46 |
-
return;
|
47 |
-
}
|
48 |
-
|
49 |
-
$props = fs_get_object_public_vars( $this );
|
50 |
-
|
51 |
-
foreach ( $props as $key => $def_value ) {
|
52 |
-
$this->{$key} = isset( $entity->{$key} ) ?
|
53 |
-
$entity->{$key} :
|
54 |
-
$def_value;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
static function get_type() {
|
59 |
-
return 'type';
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @author Vova Feldman (@svovaf)
|
64 |
-
* @since 1.0.6
|
65 |
-
*
|
66 |
-
* @param FS_Entity $entity1
|
67 |
-
* @param FS_Entity $entity2
|
68 |
-
*
|
69 |
-
* @return bool
|
70 |
-
*/
|
71 |
-
static function equals( $entity1, $entity2 ) {
|
72 |
-
if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
|
73 |
-
return true;
|
74 |
-
} else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
|
75 |
-
return ( $entity1->id == $entity2->id );
|
76 |
-
} else if ( is_object( $entity1 ) ) {
|
77 |
-
return is_null( $entity1->id );
|
78 |
-
} else {
|
79 |
-
return is_null( $entity2->id );
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
private $_is_updated = false;
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Update object property.
|
87 |
-
*
|
88 |
-
* @author Vova Feldman (@svovaf)
|
89 |
-
* @since 1.0.9
|
90 |
-
*
|
91 |
-
* @param string|array[string]mixed $key
|
92 |
-
* @param string|bool $val
|
93 |
-
*
|
94 |
-
* @return bool
|
95 |
-
*/
|
96 |
-
function update( $key, $val = false ) {
|
97 |
-
if ( ! is_array( $key ) ) {
|
98 |
-
$key = array( $key => $val );
|
99 |
-
}
|
100 |
-
|
101 |
-
$is_updated = false;
|
102 |
-
|
103 |
-
foreach ( $key as $k => $v ) {
|
104 |
-
if ( $this->{$k} === $v ) {
|
105 |
-
continue;
|
106 |
-
}
|
107 |
-
|
108 |
-
if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
|
109 |
-
( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
|
110 |
-
$this->{$k} == $v
|
111 |
-
) {
|
112 |
-
continue;
|
113 |
-
}
|
114 |
-
|
115 |
-
// Update value.
|
116 |
-
$this->{$k} = $v;
|
117 |
-
|
118 |
-
$is_updated = true;
|
119 |
-
}
|
120 |
-
|
121 |
-
$this->_is_updated = $is_updated;
|
122 |
-
|
123 |
-
return $is_updated;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Checks if entity was updated.
|
128 |
-
*
|
129 |
-
* @author Vova Feldman (@svovaf)
|
130 |
-
* @since 1.0.9
|
131 |
-
*
|
132 |
-
* @return bool
|
133 |
-
*/
|
134 |
-
function is_updated() {
|
135 |
-
return $this->_is_updated;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* @param $id
|
140 |
-
*
|
141 |
-
* @author Vova Feldman (@svovaf)
|
142 |
-
* @since 1.1.2
|
143 |
-
*
|
144 |
-
* @return bool
|
145 |
-
*/
|
146 |
-
static function is_valid_id($id){
|
147 |
-
return is_numeric($id);
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* @author Leo Fajardo (@leorw)
|
152 |
-
* @since 2.3.1
|
153 |
-
*
|
154 |
-
* @return string
|
155 |
-
*/
|
156 |
-
public static function get_class_name() {
|
157 |
-
return get_called_class();
|
158 |
-
}
|
159 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Get object's public variables.
|
15 |
+
*
|
16 |
+
* @author Vova Feldman (@svovaf)
|
17 |
+
* @since 1.0.0
|
18 |
+
*
|
19 |
+
* @param object $object
|
20 |
+
*
|
21 |
+
* @return array
|
22 |
+
*/
|
23 |
+
function fs_get_object_public_vars( $object ) {
|
24 |
+
return get_object_vars( $object );
|
25 |
+
}
|
26 |
+
|
27 |
+
class FS_Entity {
|
28 |
+
/**
|
29 |
+
* @var number
|
30 |
+
*/
|
31 |
+
public $id;
|
32 |
+
/**
|
33 |
+
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
|
34 |
+
*/
|
35 |
+
public $updated;
|
36 |
+
/**
|
37 |
+
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
|
38 |
+
*/
|
39 |
+
public $created;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param bool|object $entity
|
43 |
+
*/
|
44 |
+
function __construct( $entity = false ) {
|
45 |
+
if ( ! ( $entity instanceof stdClass ) && ! ( $entity instanceof FS_Entity ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
+
|
49 |
+
$props = fs_get_object_public_vars( $this );
|
50 |
+
|
51 |
+
foreach ( $props as $key => $def_value ) {
|
52 |
+
$this->{$key} = isset( $entity->{$key} ) ?
|
53 |
+
$entity->{$key} :
|
54 |
+
$def_value;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
static function get_type() {
|
59 |
+
return 'type';
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @author Vova Feldman (@svovaf)
|
64 |
+
* @since 1.0.6
|
65 |
+
*
|
66 |
+
* @param FS_Entity $entity1
|
67 |
+
* @param FS_Entity $entity2
|
68 |
+
*
|
69 |
+
* @return bool
|
70 |
+
*/
|
71 |
+
static function equals( $entity1, $entity2 ) {
|
72 |
+
if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
|
73 |
+
return true;
|
74 |
+
} else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
|
75 |
+
return ( $entity1->id == $entity2->id );
|
76 |
+
} else if ( is_object( $entity1 ) ) {
|
77 |
+
return is_null( $entity1->id );
|
78 |
+
} else {
|
79 |
+
return is_null( $entity2->id );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
private $_is_updated = false;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Update object property.
|
87 |
+
*
|
88 |
+
* @author Vova Feldman (@svovaf)
|
89 |
+
* @since 1.0.9
|
90 |
+
*
|
91 |
+
* @param string|array[string]mixed $key
|
92 |
+
* @param string|bool $val
|
93 |
+
*
|
94 |
+
* @return bool
|
95 |
+
*/
|
96 |
+
function update( $key, $val = false ) {
|
97 |
+
if ( ! is_array( $key ) ) {
|
98 |
+
$key = array( $key => $val );
|
99 |
+
}
|
100 |
+
|
101 |
+
$is_updated = false;
|
102 |
+
|
103 |
+
foreach ( $key as $k => $v ) {
|
104 |
+
if ( $this->{$k} === $v ) {
|
105 |
+
continue;
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
|
109 |
+
( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
|
110 |
+
$this->{$k} == $v
|
111 |
+
) {
|
112 |
+
continue;
|
113 |
+
}
|
114 |
+
|
115 |
+
// Update value.
|
116 |
+
$this->{$k} = $v;
|
117 |
+
|
118 |
+
$is_updated = true;
|
119 |
+
}
|
120 |
+
|
121 |
+
$this->_is_updated = $is_updated;
|
122 |
+
|
123 |
+
return $is_updated;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Checks if entity was updated.
|
128 |
+
*
|
129 |
+
* @author Vova Feldman (@svovaf)
|
130 |
+
* @since 1.0.9
|
131 |
+
*
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
function is_updated() {
|
135 |
+
return $this->_is_updated;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @param $id
|
140 |
+
*
|
141 |
+
* @author Vova Feldman (@svovaf)
|
142 |
+
* @since 1.1.2
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
static function is_valid_id($id){
|
147 |
+
return is_numeric($id);
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @author Leo Fajardo (@leorw)
|
152 |
+
* @since 2.3.1
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
public static function get_class_name() {
|
157 |
+
return get_called_class();
|
158 |
+
}
|
159 |
}
|
lib/freemius/includes/entities/class-fs-payment.php
CHANGED
@@ -1,168 +1,168 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Payment extends FS_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var number
|
19 |
-
*/
|
20 |
-
public $plugin_id;
|
21 |
-
/**
|
22 |
-
* @var number
|
23 |
-
*/
|
24 |
-
public $user_id;
|
25 |
-
/**
|
26 |
-
* @var number
|
27 |
-
*/
|
28 |
-
public $install_id;
|
29 |
-
/**
|
30 |
-
* @var number
|
31 |
-
*/
|
32 |
-
public $subscription_id;
|
33 |
-
/**
|
34 |
-
* @var number
|
35 |
-
*/
|
36 |
-
public $plan_id;
|
37 |
-
/**
|
38 |
-
* @var number
|
39 |
-
*/
|
40 |
-
public $license_id;
|
41 |
-
/**
|
42 |
-
* @var float
|
43 |
-
*/
|
44 |
-
public $gross;
|
45 |
-
/**
|
46 |
-
* @author Leo Fajardo (@leorw)
|
47 |
-
* @since 2.3.0
|
48 |
-
*
|
49 |
-
* @var string One of the following: `usd`, `gbp`, `eur`.
|
50 |
-
*/
|
51 |
-
public $currency;
|
52 |
-
/**
|
53 |
-
* @var number
|
54 |
-
*/
|
55 |
-
public $bound_payment_id;
|
56 |
-
/**
|
57 |
-
* @var string
|
58 |
-
*/
|
59 |
-
public $external_id;
|
60 |
-
/**
|
61 |
-
* @var string
|
62 |
-
*/
|
63 |
-
public $gateway;
|
64 |
-
/**
|
65 |
-
* @var string ISO 3166-1 alpha-2 - two-letter country code.
|
66 |
-
*
|
67 |
-
* @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
|
68 |
-
*/
|
69 |
-
public $country_code;
|
70 |
-
/**
|
71 |
-
* @var string
|
72 |
-
*/
|
73 |
-
public $vat_id;
|
74 |
-
/**
|
75 |
-
* @var float Actual Tax / VAT in $$$
|
76 |
-
*/
|
77 |
-
public $vat;
|
78 |
-
/**
|
79 |
-
* @var int Payment source.
|
80 |
-
*/
|
81 |
-
public $source = 0;
|
82 |
-
|
83 |
-
#endregion Properties
|
84 |
-
|
85 |
-
const CURRENCY_USD = 'usd';
|
86 |
-
const CURRENCY_GBP = 'gbp';
|
87 |
-
const CURRENCY_EUR = 'eur';
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @param object|bool $payment
|
91 |
-
*/
|
92 |
-
function __construct( $payment = false ) {
|
93 |
-
parent::__construct( $payment );
|
94 |
-
}
|
95 |
-
|
96 |
-
static function get_type() {
|
97 |
-
return 'payment';
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* @author Vova Feldman (@svovaf)
|
102 |
-
* @since 1.0.0
|
103 |
-
*
|
104 |
-
* @return bool
|
105 |
-
*/
|
106 |
-
function is_refund() {
|
107 |
-
return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Checks if the payment was migrated from another platform.
|
112 |
-
*
|
113 |
-
* @author Vova Feldman (@svovaf)
|
114 |
-
* @since 2.0.2
|
115 |
-
*
|
116 |
-
* @return bool
|
117 |
-
*/
|
118 |
-
function is_migrated() {
|
119 |
-
return ( 0 != $this->source );
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Returns the gross in this format:
|
124 |
-
* `{symbol}{amount | 2 decimal digits} {currency | uppercase}`
|
125 |
-
*
|
126 |
-
* Examples: £9.99 GBP, -£9.99 GBP.
|
127 |
-
*
|
128 |
-
* @author Leo Fajardo (@leorw)
|
129 |
-
* @since 2.3.0
|
130 |
-
*
|
131 |
-
* @return string
|
132 |
-
*/
|
133 |
-
function formatted_gross()
|
134 |
-
{
|
135 |
-
return (
|
136 |
-
( $this->gross < 0 ? '-' : '' ) .
|
137 |
-
$this->get_symbol() .
|
138 |
-
number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' .
|
139 |
-
strtoupper( $this->currency )
|
140 |
-
);
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* A map between supported currencies with their symbols.
|
145 |
-
*
|
146 |
-
* @var array<string,string>
|
147 |
-
*/
|
148 |
-
static $CURRENCY_2_SYMBOL;
|
149 |
-
|
150 |
-
/**
|
151 |
-
* @author Leo Fajardo (@leorw)
|
152 |
-
* @since 2.3.0
|
153 |
-
*
|
154 |
-
* @return string
|
155 |
-
*/
|
156 |
-
private function get_symbol() {
|
157 |
-
if ( ! isset( self::$CURRENCY_2_SYMBOL ) ) {
|
158 |
-
// Lazy load.
|
159 |
-
self::$CURRENCY_2_SYMBOL = array(
|
160 |
-
self::CURRENCY_USD => '$',
|
161 |
-
self::CURRENCY_GBP => '£',
|
162 |
-
self::CURRENCY_EUR => '€',
|
163 |
-
);
|
164 |
-
}
|
165 |
-
|
166 |
-
return self::$CURRENCY_2_SYMBOL[ $this->currency ];
|
167 |
-
}
|
168 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Payment extends FS_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var number
|
19 |
+
*/
|
20 |
+
public $plugin_id;
|
21 |
+
/**
|
22 |
+
* @var number
|
23 |
+
*/
|
24 |
+
public $user_id;
|
25 |
+
/**
|
26 |
+
* @var number
|
27 |
+
*/
|
28 |
+
public $install_id;
|
29 |
+
/**
|
30 |
+
* @var number
|
31 |
+
*/
|
32 |
+
public $subscription_id;
|
33 |
+
/**
|
34 |
+
* @var number
|
35 |
+
*/
|
36 |
+
public $plan_id;
|
37 |
+
/**
|
38 |
+
* @var number
|
39 |
+
*/
|
40 |
+
public $license_id;
|
41 |
+
/**
|
42 |
+
* @var float
|
43 |
+
*/
|
44 |
+
public $gross;
|
45 |
+
/**
|
46 |
+
* @author Leo Fajardo (@leorw)
|
47 |
+
* @since 2.3.0
|
48 |
+
*
|
49 |
+
* @var string One of the following: `usd`, `gbp`, `eur`.
|
50 |
+
*/
|
51 |
+
public $currency;
|
52 |
+
/**
|
53 |
+
* @var number
|
54 |
+
*/
|
55 |
+
public $bound_payment_id;
|
56 |
+
/**
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
public $external_id;
|
60 |
+
/**
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
public $gateway;
|
64 |
+
/**
|
65 |
+
* @var string ISO 3166-1 alpha-2 - two-letter country code.
|
66 |
+
*
|
67 |
+
* @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
|
68 |
+
*/
|
69 |
+
public $country_code;
|
70 |
+
/**
|
71 |
+
* @var string
|
72 |
+
*/
|
73 |
+
public $vat_id;
|
74 |
+
/**
|
75 |
+
* @var float Actual Tax / VAT in $$$
|
76 |
+
*/
|
77 |
+
public $vat;
|
78 |
+
/**
|
79 |
+
* @var int Payment source.
|
80 |
+
*/
|
81 |
+
public $source = 0;
|
82 |
+
|
83 |
+
#endregion Properties
|
84 |
+
|
85 |
+
const CURRENCY_USD = 'usd';
|
86 |
+
const CURRENCY_GBP = 'gbp';
|
87 |
+
const CURRENCY_EUR = 'eur';
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param object|bool $payment
|
91 |
+
*/
|
92 |
+
function __construct( $payment = false ) {
|
93 |
+
parent::__construct( $payment );
|
94 |
+
}
|
95 |
+
|
96 |
+
static function get_type() {
|
97 |
+
return 'payment';
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @author Vova Feldman (@svovaf)
|
102 |
+
* @since 1.0.0
|
103 |
+
*
|
104 |
+
* @return bool
|
105 |
+
*/
|
106 |
+
function is_refund() {
|
107 |
+
return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if the payment was migrated from another platform.
|
112 |
+
*
|
113 |
+
* @author Vova Feldman (@svovaf)
|
114 |
+
* @since 2.0.2
|
115 |
+
*
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
function is_migrated() {
|
119 |
+
return ( 0 != $this->source );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Returns the gross in this format:
|
124 |
+
* `{symbol}{amount | 2 decimal digits} {currency | uppercase}`
|
125 |
+
*
|
126 |
+
* Examples: £9.99 GBP, -£9.99 GBP.
|
127 |
+
*
|
128 |
+
* @author Leo Fajardo (@leorw)
|
129 |
+
* @since 2.3.0
|
130 |
+
*
|
131 |
+
* @return string
|
132 |
+
*/
|
133 |
+
function formatted_gross()
|
134 |
+
{
|
135 |
+
return (
|
136 |
+
( $this->gross < 0 ? '-' : '' ) .
|
137 |
+
$this->get_symbol() .
|
138 |
+
number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' .
|
139 |
+
strtoupper( $this->currency )
|
140 |
+
);
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* A map between supported currencies with their symbols.
|
145 |
+
*
|
146 |
+
* @var array<string,string>
|
147 |
+
*/
|
148 |
+
static $CURRENCY_2_SYMBOL;
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @author Leo Fajardo (@leorw)
|
152 |
+
* @since 2.3.0
|
153 |
+
*
|
154 |
+
* @return string
|
155 |
+
*/
|
156 |
+
private function get_symbol() {
|
157 |
+
if ( ! isset( self::$CURRENCY_2_SYMBOL ) ) {
|
158 |
+
// Lazy load.
|
159 |
+
self::$CURRENCY_2_SYMBOL = array(
|
160 |
+
self::CURRENCY_USD => '$',
|
161 |
+
self::CURRENCY_GBP => '£',
|
162 |
+
self::CURRENCY_EUR => '€',
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
return self::$CURRENCY_2_SYMBOL[ $this->currency ];
|
167 |
+
}
|
168 |
}
|
lib/freemius/includes/entities/class-fs-plugin-info.php
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Plugin_Info extends FS_Entity {
|
14 |
-
public $plugin_id;
|
15 |
-
public $description;
|
16 |
-
public $short_description;
|
17 |
-
public $banner_url;
|
18 |
-
public $card_banner_url;
|
19 |
-
public $selling_point_0;
|
20 |
-
public $selling_point_1;
|
21 |
-
public $selling_point_2;
|
22 |
-
public $screenshots;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @param stdClass|bool $plugin_info
|
26 |
-
*/
|
27 |
-
function __construct( $plugin_info = false ) {
|
28 |
-
parent::__construct( $plugin_info );
|
29 |
-
}
|
30 |
-
|
31 |
-
static function get_type() {
|
32 |
-
return 'plugin';
|
33 |
-
}
|
34 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Plugin_Info extends FS_Entity {
|
14 |
+
public $plugin_id;
|
15 |
+
public $description;
|
16 |
+
public $short_description;
|
17 |
+
public $banner_url;
|
18 |
+
public $card_banner_url;
|
19 |
+
public $selling_point_0;
|
20 |
+
public $selling_point_1;
|
21 |
+
public $selling_point_2;
|
22 |
+
public $screenshots;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param stdClass|bool $plugin_info
|
26 |
+
*/
|
27 |
+
function __construct( $plugin_info = false ) {
|
28 |
+
parent::__construct( $plugin_info );
|
29 |
+
}
|
30 |
+
|
31 |
+
static function get_type() {
|
32 |
+
return 'plugin';
|
33 |
+
}
|
34 |
}
|
lib/freemius/includes/entities/class-fs-plugin-license.php
CHANGED
@@ -1,330 +1,330 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.5
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class FS_Plugin_License
|
15 |
-
*/
|
16 |
-
class FS_Plugin_License extends FS_Entity {
|
17 |
-
|
18 |
-
#region Properties
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var number
|
22 |
-
*/
|
23 |
-
public $plugin_id;
|
24 |
-
/**
|
25 |
-
* @var number
|
26 |
-
*/
|
27 |
-
public $user_id;
|
28 |
-
/**
|
29 |
-
* @var number
|
30 |
-
*/
|
31 |
-
public $plan_id;
|
32 |
-
/**
|
33 |
-
* @author Leo Fajardo (@leorw)
|
34 |
-
* @since 2.3.0
|
35 |
-
*
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
public $parent_plan_name;
|
39 |
-
/**
|
40 |
-
* @author Leo Fajardo (@leorw)
|
41 |
-
* @since 2.3.0
|
42 |
-
*
|
43 |
-
* @var string
|
44 |
-
*/
|
45 |
-
public $parent_plan_title;
|
46 |
-
/**
|
47 |
-
* @author Leo Fajardo (@leorw)
|
48 |
-
* @since 2.3.0
|
49 |
-
*
|
50 |
-
* @var number
|
51 |
-
*/
|
52 |
-
public $parent_license_id;
|
53 |
-
/**
|
54 |
-
* @author Leo Fajardo (@leorw)
|
55 |
-
* @since 2.4.0
|
56 |
-
*
|
57 |
-
* @var array
|
58 |
-
*/
|
59 |
-
public $products;
|
60 |
-
/**
|
61 |
-
* @var number
|
62 |
-
*/
|
63 |
-
public $pricing_id;
|
64 |
-
/**
|
65 |
-
* @var int|null
|
66 |
-
*/
|
67 |
-
public $quota;
|
68 |
-
/**
|
69 |
-
* @var int
|
70 |
-
*/
|
71 |
-
public $activated;
|
72 |
-
/**
|
73 |
-
* @var int
|
74 |
-
*/
|
75 |
-
public $activated_local;
|
76 |
-
/**
|
77 |
-
* @var string
|
78 |
-
*/
|
79 |
-
public $expiration;
|
80 |
-
/**
|
81 |
-
* @var string
|
82 |
-
*/
|
83 |
-
public $secret_key;
|
84 |
-
/**
|
85 |
-
* @var bool
|
86 |
-
*/
|
87 |
-
public $is_whitelabeled;
|
88 |
-
/**
|
89 |
-
* @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
|
90 |
-
* license.
|
91 |
-
*/
|
92 |
-
public $is_free_localhost;
|
93 |
-
/**
|
94 |
-
* @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
|
95 |
-
* block updates and support.
|
96 |
-
*/
|
97 |
-
public $is_block_features;
|
98 |
-
/**
|
99 |
-
* @var bool
|
100 |
-
*/
|
101 |
-
public $is_cancelled;
|
102 |
-
|
103 |
-
#endregion Properties
|
104 |
-
|
105 |
-
/**
|
106 |
-
* @param stdClass|bool $license
|
107 |
-
*/
|
108 |
-
function __construct( $license = false ) {
|
109 |
-
parent::__construct( $license );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Get entity type.
|
114 |
-
*
|
115 |
-
* @return string
|
116 |
-
*/
|
117 |
-
static function get_type() {
|
118 |
-
return 'license';
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Check how many site activations left.
|
123 |
-
*
|
124 |
-
* @author Vova Feldman (@svovaf)
|
125 |
-
* @since 1.0.5
|
126 |
-
*
|
127 |
-
* @return int
|
128 |
-
*/
|
129 |
-
function left() {
|
130 |
-
if ( ! $this->is_features_enabled() ) {
|
131 |
-
return 0;
|
132 |
-
}
|
133 |
-
|
134 |
-
if ( $this->is_unlimited() ) {
|
135 |
-
return 999;
|
136 |
-
}
|
137 |
-
|
138 |
-
return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Check if single site license.
|
143 |
-
*
|
144 |
-
* @author Vova Feldman (@svovaf)
|
145 |
-
* @since 1.1.8.1
|
146 |
-
*
|
147 |
-
* @return bool
|
148 |
-
*/
|
149 |
-
function is_single_site() {
|
150 |
-
return ( is_numeric( $this->quota ) && 1 == $this->quota );
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* @author Vova Feldman (@svovaf)
|
155 |
-
* @since 1.0.5
|
156 |
-
*
|
157 |
-
* @return bool
|
158 |
-
*/
|
159 |
-
function is_expired() {
|
160 |
-
return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Check if license is not expired.
|
165 |
-
*
|
166 |
-
* @author Vova Feldman (@svovaf)
|
167 |
-
* @since 1.2.1
|
168 |
-
*
|
169 |
-
* @return bool
|
170 |
-
*/
|
171 |
-
function is_valid() {
|
172 |
-
return ! $this->is_expired();
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* @author Vova Feldman (@svovaf)
|
177 |
-
* @since 1.0.6
|
178 |
-
*
|
179 |
-
* @return bool
|
180 |
-
*/
|
181 |
-
function is_lifetime() {
|
182 |
-
return is_null( $this->expiration );
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* @author Vova Feldman (@svovaf)
|
187 |
-
* @since 1.2.0
|
188 |
-
*
|
189 |
-
* @return bool
|
190 |
-
*/
|
191 |
-
function is_unlimited() {
|
192 |
-
return is_null( $this->quota );
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Check if license is fully utilized.
|
197 |
-
*
|
198 |
-
* @author Vova Feldman (@svovaf)
|
199 |
-
* @since 1.0.6
|
200 |
-
*
|
201 |
-
* @param bool|null $is_localhost
|
202 |
-
*
|
203 |
-
* @return bool
|
204 |
-
*/
|
205 |
-
function is_utilized( $is_localhost = null ) {
|
206 |
-
if ( is_null( $is_localhost ) ) {
|
207 |
-
$is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
|
208 |
-
}
|
209 |
-
|
210 |
-
if ( $this->is_unlimited() ) {
|
211 |
-
return false;
|
212 |
-
}
|
213 |
-
|
214 |
-
return ! ( $this->is_free_localhost && $is_localhost ) &&
|
215 |
-
( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Check if license can be activated.
|
220 |
-
*
|
221 |
-
* @author Vova Feldman (@svovaf)
|
222 |
-
* @since 2.0.0
|
223 |
-
*
|
224 |
-
* @param bool|null $is_localhost
|
225 |
-
*
|
226 |
-
* @return bool
|
227 |
-
*/
|
228 |
-
function can_activate( $is_localhost = null ) {
|
229 |
-
return ! $this->is_utilized( $is_localhost ) && $this->is_features_enabled();
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Check if license can be activated on a given number of production and localhost sites.
|
234 |
-
*
|
235 |
-
* @author Vova Feldman (@svovaf)
|
236 |
-
* @since 2.0.0
|
237 |
-
*
|
238 |
-
* @param int $production_count
|
239 |
-
* @param int $localhost_count
|
240 |
-
*
|
241 |
-
* @return bool
|
242 |
-
*/
|
243 |
-
function can_activate_bulk( $production_count, $localhost_count ) {
|
244 |
-
if ( $this->is_unlimited() ) {
|
245 |
-
return true;
|
246 |
-
}
|
247 |
-
|
248 |
-
/**
|
249 |
-
* For simplicity, the logic will work as following: when given X sites to activate the license on, if it's
|
250 |
-
* possible to activate on ALL of them, do the activation. If it's not possible to activate on ALL of them,
|
251 |
-
* do NOT activate on any of them.
|
252 |
-
*/
|
253 |
-
return ( $this->quota >= $this->activated + $production_count + ( $this->is_free_localhost ? 0 : $this->activated_local + $localhost_count ) );
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* @author Vova Feldman (@svovaf)
|
258 |
-
* @since 1.2.1
|
259 |
-
*
|
260 |
-
* @return bool
|
261 |
-
*/
|
262 |
-
function is_active() {
|
263 |
-
return ( ! $this->is_cancelled );
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Check if license's plan features are enabled.
|
268 |
-
*
|
269 |
-
* - Either if plan not expired
|
270 |
-
* - If expired, based on the configuration to block features or not.
|
271 |
-
*
|
272 |
-
* @author Vova Feldman (@svovaf)
|
273 |
-
* @since 1.0.6
|
274 |
-
*
|
275 |
-
* @return bool
|
276 |
-
*/
|
277 |
-
function is_features_enabled() {
|
278 |
-
return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* Subscription considered to be new without any payments
|
283 |
-
* if the license expires in less than 24 hours
|
284 |
-
* from the license creation.
|
285 |
-
*
|
286 |
-
* @author Vova Feldman (@svovaf)
|
287 |
-
* @since 1.0.9
|
288 |
-
*
|
289 |
-
* @return bool
|
290 |
-
*/
|
291 |
-
function is_first_payment_pending() {
|
292 |
-
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* @return int
|
297 |
-
*/
|
298 |
-
function total_activations() {
|
299 |
-
return ( $this->activated + $this->activated_local );
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* @author Vova Feldman (@svovaf)
|
304 |
-
* @since 2.3.1
|
305 |
-
*
|
306 |
-
* @return string
|
307 |
-
*/
|
308 |
-
function get_html_escaped_masked_secret_key() {
|
309 |
-
return self::mask_secret_key_for_html( $this->secret_key );
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* @author Vova Feldman (@svovaf)
|
314 |
-
* @since 2.3.1
|
315 |
-
*
|
316 |
-
* @param string $secret_key
|
317 |
-
*
|
318 |
-
* @return string
|
319 |
-
*/
|
320 |
-
static function mask_secret_key_for_html( $secret_key ) {
|
321 |
-
return (
|
322 |
-
// Initial 6 chars - sk_ABC
|
323 |
-
htmlspecialchars( substr( $secret_key, 0, 6 ) ) .
|
324 |
-
// Masking
|
325 |
-
str_pad( '', ( strlen( $secret_key ) - 9 ) * 6, '•' ) .
|
326 |
-
// Last 3 chars.
|
327 |
-
htmlspecialchars( substr( $secret_key, - 3 ) )
|
328 |
-
);
|
329 |
-
}
|
330 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.5
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class FS_Plugin_License
|
15 |
+
*/
|
16 |
+
class FS_Plugin_License extends FS_Entity {
|
17 |
+
|
18 |
+
#region Properties
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var number
|
22 |
+
*/
|
23 |
+
public $plugin_id;
|
24 |
+
/**
|
25 |
+
* @var number
|
26 |
+
*/
|
27 |
+
public $user_id;
|
28 |
+
/**
|
29 |
+
* @var number
|
30 |
+
*/
|
31 |
+
public $plan_id;
|
32 |
+
/**
|
33 |
+
* @author Leo Fajardo (@leorw)
|
34 |
+
* @since 2.3.0
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $parent_plan_name;
|
39 |
+
/**
|
40 |
+
* @author Leo Fajardo (@leorw)
|
41 |
+
* @since 2.3.0
|
42 |
+
*
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
public $parent_plan_title;
|
46 |
+
/**
|
47 |
+
* @author Leo Fajardo (@leorw)
|
48 |
+
* @since 2.3.0
|
49 |
+
*
|
50 |
+
* @var number
|
51 |
+
*/
|
52 |
+
public $parent_license_id;
|
53 |
+
/**
|
54 |
+
* @author Leo Fajardo (@leorw)
|
55 |
+
* @since 2.4.0
|
56 |
+
*
|
57 |
+
* @var array
|
58 |
+
*/
|
59 |
+
public $products;
|
60 |
+
/**
|
61 |
+
* @var number
|
62 |
+
*/
|
63 |
+
public $pricing_id;
|
64 |
+
/**
|
65 |
+
* @var int|null
|
66 |
+
*/
|
67 |
+
public $quota;
|
68 |
+
/**
|
69 |
+
* @var int
|
70 |
+
*/
|
71 |
+
public $activated;
|
72 |
+
/**
|
73 |
+
* @var int
|
74 |
+
*/
|
75 |
+
public $activated_local;
|
76 |
+
/**
|
77 |
+
* @var string
|
78 |
+
*/
|
79 |
+
public $expiration;
|
80 |
+
/**
|
81 |
+
* @var string
|
82 |
+
*/
|
83 |
+
public $secret_key;
|
84 |
+
/**
|
85 |
+
* @var bool
|
86 |
+
*/
|
87 |
+
public $is_whitelabeled;
|
88 |
+
/**
|
89 |
+
* @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
|
90 |
+
* license.
|
91 |
+
*/
|
92 |
+
public $is_free_localhost;
|
93 |
+
/**
|
94 |
+
* @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
|
95 |
+
* block updates and support.
|
96 |
+
*/
|
97 |
+
public $is_block_features;
|
98 |
+
/**
|
99 |
+
* @var bool
|
100 |
+
*/
|
101 |
+
public $is_cancelled;
|
102 |
+
|
103 |
+
#endregion Properties
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @param stdClass|bool $license
|
107 |
+
*/
|
108 |
+
function __construct( $license = false ) {
|
109 |
+
parent::__construct( $license );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Get entity type.
|
114 |
+
*
|
115 |
+
* @return string
|
116 |
+
*/
|
117 |
+
static function get_type() {
|
118 |
+
return 'license';
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Check how many site activations left.
|
123 |
+
*
|
124 |
+
* @author Vova Feldman (@svovaf)
|
125 |
+
* @since 1.0.5
|
126 |
+
*
|
127 |
+
* @return int
|
128 |
+
*/
|
129 |
+
function left() {
|
130 |
+
if ( ! $this->is_features_enabled() ) {
|
131 |
+
return 0;
|
132 |
+
}
|
133 |
+
|
134 |
+
if ( $this->is_unlimited() ) {
|
135 |
+
return 999;
|
136 |
+
}
|
137 |
+
|
138 |
+
return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Check if single site license.
|
143 |
+
*
|
144 |
+
* @author Vova Feldman (@svovaf)
|
145 |
+
* @since 1.1.8.1
|
146 |
+
*
|
147 |
+
* @return bool
|
148 |
+
*/
|
149 |
+
function is_single_site() {
|
150 |
+
return ( is_numeric( $this->quota ) && 1 == $this->quota );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @author Vova Feldman (@svovaf)
|
155 |
+
* @since 1.0.5
|
156 |
+
*
|
157 |
+
* @return bool
|
158 |
+
*/
|
159 |
+
function is_expired() {
|
160 |
+
return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Check if license is not expired.
|
165 |
+
*
|
166 |
+
* @author Vova Feldman (@svovaf)
|
167 |
+
* @since 1.2.1
|
168 |
+
*
|
169 |
+
* @return bool
|
170 |
+
*/
|
171 |
+
function is_valid() {
|
172 |
+
return ! $this->is_expired();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @author Vova Feldman (@svovaf)
|
177 |
+
* @since 1.0.6
|
178 |
+
*
|
179 |
+
* @return bool
|
180 |
+
*/
|
181 |
+
function is_lifetime() {
|
182 |
+
return is_null( $this->expiration );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* @author Vova Feldman (@svovaf)
|
187 |
+
* @since 1.2.0
|
188 |
+
*
|
189 |
+
* @return bool
|
190 |
+
*/
|
191 |
+
function is_unlimited() {
|
192 |
+
return is_null( $this->quota );
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Check if license is fully utilized.
|
197 |
+
*
|
198 |
+
* @author Vova Feldman (@svovaf)
|
199 |
+
* @since 1.0.6
|
200 |
+
*
|
201 |
+
* @param bool|null $is_localhost
|
202 |
+
*
|
203 |
+
* @return bool
|
204 |
+
*/
|
205 |
+
function is_utilized( $is_localhost = null ) {
|
206 |
+
if ( is_null( $is_localhost ) ) {
|
207 |
+
$is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( $this->is_unlimited() ) {
|
211 |
+
return false;
|
212 |
+
}
|
213 |
+
|
214 |
+
return ! ( $this->is_free_localhost && $is_localhost ) &&
|
215 |
+
( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Check if license can be activated.
|
220 |
+
*
|
221 |
+
* @author Vova Feldman (@svovaf)
|
222 |
+
* @since 2.0.0
|
223 |
+
*
|
224 |
+
* @param bool|null $is_localhost
|
225 |
+
*
|
226 |
+
* @return bool
|
227 |
+
*/
|
228 |
+
function can_activate( $is_localhost = null ) {
|
229 |
+
return ! $this->is_utilized( $is_localhost ) && $this->is_features_enabled();
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Check if license can be activated on a given number of production and localhost sites.
|
234 |
+
*
|
235 |
+
* @author Vova Feldman (@svovaf)
|
236 |
+
* @since 2.0.0
|
237 |
+
*
|
238 |
+
* @param int $production_count
|
239 |
+
* @param int $localhost_count
|
240 |
+
*
|
241 |
+
* @return bool
|
242 |
+
*/
|
243 |
+
function can_activate_bulk( $production_count, $localhost_count ) {
|
244 |
+
if ( $this->is_unlimited() ) {
|
245 |
+
return true;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* For simplicity, the logic will work as following: when given X sites to activate the license on, if it's
|
250 |
+
* possible to activate on ALL of them, do the activation. If it's not possible to activate on ALL of them,
|
251 |
+
* do NOT activate on any of them.
|
252 |
+
*/
|
253 |
+
return ( $this->quota >= $this->activated + $production_count + ( $this->is_free_localhost ? 0 : $this->activated_local + $localhost_count ) );
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @author Vova Feldman (@svovaf)
|
258 |
+
* @since 1.2.1
|
259 |
+
*
|
260 |
+
* @return bool
|
261 |
+
*/
|
262 |
+
function is_active() {
|
263 |
+
return ( ! $this->is_cancelled );
|
264 |
+
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Check if license's plan features are enabled.
|
268 |
+
*
|
269 |
+
* - Either if plan not expired
|
270 |
+
* - If expired, based on the configuration to block features or not.
|
271 |
+
*
|
272 |
+
* @author Vova Feldman (@svovaf)
|
273 |
+
* @since 1.0.6
|
274 |
+
*
|
275 |
+
* @return bool
|
276 |
+
*/
|
277 |
+
function is_features_enabled() {
|
278 |
+
return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Subscription considered to be new without any payments
|
283 |
+
* if the license expires in less than 24 hours
|
284 |
+
* from the license creation.
|
285 |
+
*
|
286 |
+
* @author Vova Feldman (@svovaf)
|
287 |
+
* @since 1.0.9
|
288 |
+
*
|
289 |
+
* @return bool
|
290 |
+
*/
|
291 |
+
function is_first_payment_pending() {
|
292 |
+
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* @return int
|
297 |
+
*/
|
298 |
+
function total_activations() {
|
299 |
+
return ( $this->activated + $this->activated_local );
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* @author Vova Feldman (@svovaf)
|
304 |
+
* @since 2.3.1
|
305 |
+
*
|
306 |
+
* @return string
|
307 |
+
*/
|
308 |
+
function get_html_escaped_masked_secret_key() {
|
309 |
+
return self::mask_secret_key_for_html( $this->secret_key );
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* @author Vova Feldman (@svovaf)
|
314 |
+
* @since 2.3.1
|
315 |
+
*
|
316 |
+
* @param string $secret_key
|
317 |
+
*
|
318 |
+
* @return string
|
319 |
+
*/
|
320 |
+
static function mask_secret_key_for_html( $secret_key ) {
|
321 |
+
return (
|
322 |
+
// Initial 6 chars - sk_ABC
|
323 |
+
htmlspecialchars( substr( $secret_key, 0, 6 ) ) .
|
324 |
+
// Masking
|
325 |
+
str_pad( '', ( strlen( $secret_key ) - 9 ) * 6, '•' ) .
|
326 |
+
// Last 3 chars.
|
327 |
+
htmlspecialchars( substr( $secret_key, - 3 ) )
|
328 |
+
);
|
329 |
+
}
|
330 |
+
}
|
lib/freemius/includes/entities/class-fs-plugin-plan.php
CHANGED
@@ -1,145 +1,145 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.5
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class FS_Plugin_Plan
|
15 |
-
*
|
16 |
-
* @property FS_Pricing[] $pricing
|
17 |
-
*/
|
18 |
-
class FS_Plugin_Plan extends FS_Entity {
|
19 |
-
|
20 |
-
#region Properties
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var number
|
24 |
-
*/
|
25 |
-
public $plugin_id;
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
public $name;
|
30 |
-
/**
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
public $title;
|
34 |
-
/**
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $description;
|
38 |
-
/**
|
39 |
-
* @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
|
40 |
-
*/
|
41 |
-
public $is_free_localhost;
|
42 |
-
/**
|
43 |
-
* @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
|
44 |
-
* support.
|
45 |
-
*/
|
46 |
-
public $is_block_features;
|
47 |
-
/**
|
48 |
-
* @var int
|
49 |
-
*/
|
50 |
-
public $license_type;
|
51 |
-
/**
|
52 |
-
* @var bool
|
53 |
-
*/
|
54 |
-
public $is_https_support;
|
55 |
-
/**
|
56 |
-
* @var int Trial days.
|
57 |
-
*/
|
58 |
-
public $trial_period;
|
59 |
-
/**
|
60 |
-
* @var string If true, require payment for trial.
|
61 |
-
*/
|
62 |
-
public $is_require_subscription;
|
63 |
-
/**
|
64 |
-
* @var string Knowledge Base URL.
|
65 |
-
*/
|
66 |
-
public $support_kb;
|
67 |
-
/**
|
68 |
-
* @var string Support Forum URL.
|
69 |
-
*/
|
70 |
-
public $support_forum;
|
71 |
-
/**
|
72 |
-
* @var string Support email address.
|
73 |
-
*/
|
74 |
-
public $support_email;
|
75 |
-
/**
|
76 |
-
* @var string Support phone.
|
77 |
-
*/
|
78 |
-
public $support_phone;
|
79 |
-
/**
|
80 |
-
* @var string Support skype username.
|
81 |
-
*/
|
82 |
-
public $support_skype;
|
83 |
-
/**
|
84 |
-
* @var bool Is personal success manager supported with the plan.
|
85 |
-
*/
|
86 |
-
public $is_success_manager;
|
87 |
-
/**
|
88 |
-
* @var bool Is featured plan.
|
89 |
-
*/
|
90 |
-
public $is_featured;
|
91 |
-
|
92 |
-
#endregion Properties
|
93 |
-
|
94 |
-
/**
|
95 |
-
* @param object|bool $plan
|
96 |
-
*/
|
97 |
-
function __construct( $plan = false ) {
|
98 |
-
parent::__construct( $plan );
|
99 |
-
|
100 |
-
if ( is_object( $plan ) ) {
|
101 |
-
$this->name = strtolower( $plan->name );
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
static function get_type() {
|
106 |
-
return 'plan';
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* @author Vova Feldman (@svovaf)
|
111 |
-
* @since 1.0.9
|
112 |
-
*
|
113 |
-
* @return bool
|
114 |
-
*/
|
115 |
-
function is_free() {
|
116 |
-
return ( 'free' === $this->name );
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Checks if this plan supports "Technical Support".
|
121 |
-
*
|
122 |
-
* @author Leo Fajardo (leorw)
|
123 |
-
* @since 1.2.0
|
124 |
-
*
|
125 |
-
* @return bool
|
126 |
-
*/
|
127 |
-
function has_technical_support() {
|
128 |
-
return ( ! empty( $this->support_email ) ||
|
129 |
-
! empty( $this->support_skype ) ||
|
130 |
-
! empty( $this->support_phone ) ||
|
131 |
-
! empty( $this->is_success_manager )
|
132 |
-
);
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* @author Vova Feldman (@svovaf)
|
137 |
-
* @since 1.0.9
|
138 |
-
*
|
139 |
-
* @return bool
|
140 |
-
*/
|
141 |
-
function has_trial() {
|
142 |
-
return ! $this->is_free() &&
|
143 |
-
is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
|
144 |
-
}
|
145 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.5
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class FS_Plugin_Plan
|
15 |
+
*
|
16 |
+
* @property FS_Pricing[] $pricing
|
17 |
+
*/
|
18 |
+
class FS_Plugin_Plan extends FS_Entity {
|
19 |
+
|
20 |
+
#region Properties
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var number
|
24 |
+
*/
|
25 |
+
public $plugin_id;
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
public $name;
|
30 |
+
/**
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
public $title;
|
34 |
+
/**
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
public $description;
|
38 |
+
/**
|
39 |
+
* @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
|
40 |
+
*/
|
41 |
+
public $is_free_localhost;
|
42 |
+
/**
|
43 |
+
* @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
|
44 |
+
* support.
|
45 |
+
*/
|
46 |
+
public $is_block_features;
|
47 |
+
/**
|
48 |
+
* @var int
|
49 |
+
*/
|
50 |
+
public $license_type;
|
51 |
+
/**
|
52 |
+
* @var bool
|
53 |
+
*/
|
54 |
+
public $is_https_support;
|
55 |
+
/**
|
56 |
+
* @var int Trial days.
|
57 |
+
*/
|
58 |
+
public $trial_period;
|
59 |
+
/**
|
60 |
+
* @var string If true, require payment for trial.
|
61 |
+
*/
|
62 |
+
public $is_require_subscription;
|
63 |
+
/**
|
64 |
+
* @var string Knowledge Base URL.
|
65 |
+
*/
|
66 |
+
public $support_kb;
|
67 |
+
/**
|
68 |
+
* @var string Support Forum URL.
|
69 |
+
*/
|
70 |
+
public $support_forum;
|
71 |
+
/**
|
72 |
+
* @var string Support email address.
|
73 |
+
*/
|
74 |
+
public $support_email;
|
75 |
+
/**
|
76 |
+
* @var string Support phone.
|
77 |
+
*/
|
78 |
+
public $support_phone;
|
79 |
+
/**
|
80 |
+
* @var string Support skype username.
|
81 |
+
*/
|
82 |
+
public $support_skype;
|
83 |
+
/**
|
84 |
+
* @var bool Is personal success manager supported with the plan.
|
85 |
+
*/
|
86 |
+
public $is_success_manager;
|
87 |
+
/**
|
88 |
+
* @var bool Is featured plan.
|
89 |
+
*/
|
90 |
+
public $is_featured;
|
91 |
+
|
92 |
+
#endregion Properties
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @param object|bool $plan
|
96 |
+
*/
|
97 |
+
function __construct( $plan = false ) {
|
98 |
+
parent::__construct( $plan );
|
99 |
+
|
100 |
+
if ( is_object( $plan ) ) {
|
101 |
+
$this->name = strtolower( $plan->name );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
static function get_type() {
|
106 |
+
return 'plan';
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @author Vova Feldman (@svovaf)
|
111 |
+
* @since 1.0.9
|
112 |
+
*
|
113 |
+
* @return bool
|
114 |
+
*/
|
115 |
+
function is_free() {
|
116 |
+
return ( 'free' === $this->name );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Checks if this plan supports "Technical Support".
|
121 |
+
*
|
122 |
+
* @author Leo Fajardo (leorw)
|
123 |
+
* @since 1.2.0
|
124 |
+
*
|
125 |
+
* @return bool
|
126 |
+
*/
|
127 |
+
function has_technical_support() {
|
128 |
+
return ( ! empty( $this->support_email ) ||
|
129 |
+
! empty( $this->support_skype ) ||
|
130 |
+
! empty( $this->support_phone ) ||
|
131 |
+
! empty( $this->is_success_manager )
|
132 |
+
);
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @author Vova Feldman (@svovaf)
|
137 |
+
* @since 1.0.9
|
138 |
+
*
|
139 |
+
* @return bool
|
140 |
+
*/
|
141 |
+
function has_trial() {
|
142 |
+
return ! $this->is_free() &&
|
143 |
+
is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
|
144 |
+
}
|
145 |
}
|
lib/freemius/includes/entities/class-fs-plugin-tag.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2018, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Plugin_Tag extends FS_Entity {
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
public $version;
|
18 |
-
/**
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
public $url;
|
22 |
-
/**
|
23 |
-
* @var string
|
24 |
-
*/
|
25 |
-
public $requires_platform_version;
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
public $tested_up_to_version;
|
30 |
-
/**
|
31 |
-
* @var bool
|
32 |
-
*/
|
33 |
-
public $has_free;
|
34 |
-
/**
|
35 |
-
* @var bool
|
36 |
-
*/
|
37 |
-
public $has_premium;
|
38 |
-
/**
|
39 |
-
* @var string One of the following: `pending`, `beta`, `unreleased`.
|
40 |
-
*/
|
41 |
-
public $release_mode;
|
42 |
-
|
43 |
-
function __construct( $tag = false ) {
|
44 |
-
parent::__construct( $tag );
|
45 |
-
}
|
46 |
-
|
47 |
-
static function get_type() {
|
48 |
-
return 'tag';
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @author Leo Fajardo (@leorw)
|
53 |
-
* @since 2.3.0
|
54 |
-
*
|
55 |
-
* @return bool
|
56 |
-
*/
|
57 |
-
function is_beta() {
|
58 |
-
return ( 'beta' === $this->release_mode );
|
59 |
-
}
|
60 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2018, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Plugin_Tag extends FS_Entity {
|
14 |
+
/**
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
public $version;
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
public $url;
|
22 |
+
/**
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
public $requires_platform_version;
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
public $tested_up_to_version;
|
30 |
+
/**
|
31 |
+
* @var bool
|
32 |
+
*/
|
33 |
+
public $has_free;
|
34 |
+
/**
|
35 |
+
* @var bool
|
36 |
+
*/
|
37 |
+
public $has_premium;
|
38 |
+
/**
|
39 |
+
* @var string One of the following: `pending`, `beta`, `unreleased`.
|
40 |
+
*/
|
41 |
+
public $release_mode;
|
42 |
+
|
43 |
+
function __construct( $tag = false ) {
|
44 |
+
parent::__construct( $tag );
|
45 |
+
}
|
46 |
+
|
47 |
+
static function get_type() {
|
48 |
+
return 'tag';
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @author Leo Fajardo (@leorw)
|
53 |
+
* @since 2.3.0
|
54 |
+
*
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
function is_beta() {
|
58 |
+
return ( 'beta' === $this->release_mode );
|
59 |
+
}
|
60 |
}
|
lib/freemius/includes/entities/class-fs-plugin.php
CHANGED
@@ -1,159 +1,159 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Plugin extends FS_Scope_Entity {
|
14 |
-
/**
|
15 |
-
* @since 1.0.6
|
16 |
-
* @var null|number
|
17 |
-
*/
|
18 |
-
public $parent_plugin_id;
|
19 |
-
/**
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
public $title;
|
23 |
-
/**
|
24 |
-
* @var string
|
25 |
-
*/
|
26 |
-
public $slug;
|
27 |
-
/**
|
28 |
-
* @author Leo Fajardo (@leorw)
|
29 |
-
* @since 2.2.1
|
30 |
-
*
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
public $premium_slug;
|
34 |
-
/**
|
35 |
-
* @since 1.2.2
|
36 |
-
*
|
37 |
-
* @var string 'plugin' or 'theme'
|
38 |
-
*/
|
39 |
-
public $type;
|
40 |
-
/**
|
41 |
-
* @author Leo Fajardo (@leorw)
|
42 |
-
*
|
43 |
-
* @since 1.2.3
|
44 |
-
*
|
45 |
-
* @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
|
46 |
-
*/
|
47 |
-
public $affiliate_moderation;
|
48 |
-
/**
|
49 |
-
* @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
|
50 |
-
*/
|
51 |
-
public $is_wp_org_compliant = true;
|
52 |
-
/**
|
53 |
-
* @author Leo Fajardo (@leorw)
|
54 |
-
* @since 2.2.5
|
55 |
-
*
|
56 |
-
* @var int
|
57 |
-
*/
|
58 |
-
public $premium_releases_count;
|
59 |
-
|
60 |
-
#region Install Specific Properties
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @var string
|
64 |
-
*/
|
65 |
-
public $file;
|
66 |
-
/**
|
67 |
-
* @var string
|
68 |
-
*/
|
69 |
-
public $version;
|
70 |
-
/**
|
71 |
-
* @var bool
|
72 |
-
*/
|
73 |
-
public $auto_update;
|
74 |
-
/**
|
75 |
-
* @var FS_Plugin_Info
|
76 |
-
*/
|
77 |
-
public $info;
|
78 |
-
/**
|
79 |
-
* @since 1.0.9
|
80 |
-
*
|
81 |
-
* @var bool
|
82 |
-
*/
|
83 |
-
public $is_premium;
|
84 |
-
/**
|
85 |
-
* @author Leo Fajardo (@leorw)
|
86 |
-
* @since 2.2.1
|
87 |
-
*
|
88 |
-
* @var string
|
89 |
-
*/
|
90 |
-
public $premium_suffix;
|
91 |
-
/**
|
92 |
-
* @since 1.0.9
|
93 |
-
*
|
94 |
-
* @var bool
|
95 |
-
*/
|
96 |
-
public $is_live;
|
97 |
-
/**
|
98 |
-
* @since 2.2.3
|
99 |
-
* @var null|number
|
100 |
-
*/
|
101 |
-
public $bundle_id;
|
102 |
-
/**
|
103 |
-
* @since 2.3.1
|
104 |
-
* @var null|string
|
105 |
-
*/
|
106 |
-
public $bundle_public_key;
|
107 |
-
|
108 |
-
const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
|
109 |
-
|
110 |
-
#endregion Install Specific Properties
|
111 |
-
|
112 |
-
/**
|
113 |
-
* @param stdClass|bool $plugin
|
114 |
-
*/
|
115 |
-
function __construct( $plugin = false ) {
|
116 |
-
parent::__construct( $plugin );
|
117 |
-
|
118 |
-
$this->is_premium = false;
|
119 |
-
$this->is_live = true;
|
120 |
-
|
121 |
-
if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
|
122 |
-
$this->premium_slug = "{$this->slug}-premium";
|
123 |
-
}
|
124 |
-
|
125 |
-
if ( empty( $this->premium_suffix ) ) {
|
126 |
-
$this->premium_suffix = '(Premium)';
|
127 |
-
}
|
128 |
-
|
129 |
-
if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
|
130 |
-
$this->info = new FS_Plugin_Info( $plugin->info );
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Check if plugin is an add-on (has parent).
|
136 |
-
*
|
137 |
-
* @author Vova Feldman (@svovaf)
|
138 |
-
* @since 1.0.6
|
139 |
-
*
|
140 |
-
* @return bool
|
141 |
-
*/
|
142 |
-
function is_addon() {
|
143 |
-
return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* @author Leo Fajardo (@leorw)
|
148 |
-
* @since 1.2.3
|
149 |
-
*
|
150 |
-
* @return bool
|
151 |
-
*/
|
152 |
-
function has_affiliate_program() {
|
153 |
-
return ( ! empty( $this->affiliate_moderation ) );
|
154 |
-
}
|
155 |
-
|
156 |
-
static function get_type() {
|
157 |
-
return 'plugin';
|
158 |
-
}
|
159 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Plugin extends FS_Scope_Entity {
|
14 |
+
/**
|
15 |
+
* @since 1.0.6
|
16 |
+
* @var null|number
|
17 |
+
*/
|
18 |
+
public $parent_plugin_id;
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $title;
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
public $slug;
|
27 |
+
/**
|
28 |
+
* @author Leo Fajardo (@leorw)
|
29 |
+
* @since 2.2.1
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
public $premium_slug;
|
34 |
+
/**
|
35 |
+
* @since 1.2.2
|
36 |
+
*
|
37 |
+
* @var string 'plugin' or 'theme'
|
38 |
+
*/
|
39 |
+
public $type;
|
40 |
+
/**
|
41 |
+
* @author Leo Fajardo (@leorw)
|
42 |
+
*
|
43 |
+
* @since 1.2.3
|
44 |
+
*
|
45 |
+
* @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
|
46 |
+
*/
|
47 |
+
public $affiliate_moderation;
|
48 |
+
/**
|
49 |
+
* @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
|
50 |
+
*/
|
51 |
+
public $is_wp_org_compliant = true;
|
52 |
+
/**
|
53 |
+
* @author Leo Fajardo (@leorw)
|
54 |
+
* @since 2.2.5
|
55 |
+
*
|
56 |
+
* @var int
|
57 |
+
*/
|
58 |
+
public $premium_releases_count;
|
59 |
+
|
60 |
+
#region Install Specific Properties
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
public $file;
|
66 |
+
/**
|
67 |
+
* @var string
|
68 |
+
*/
|
69 |
+
public $version;
|
70 |
+
/**
|
71 |
+
* @var bool
|
72 |
+
*/
|
73 |
+
public $auto_update;
|
74 |
+
/**
|
75 |
+
* @var FS_Plugin_Info
|
76 |
+
*/
|
77 |
+
public $info;
|
78 |
+
/**
|
79 |
+
* @since 1.0.9
|
80 |
+
*
|
81 |
+
* @var bool
|
82 |
+
*/
|
83 |
+
public $is_premium;
|
84 |
+
/**
|
85 |
+
* @author Leo Fajardo (@leorw)
|
86 |
+
* @since 2.2.1
|
87 |
+
*
|
88 |
+
* @var string
|
89 |
+
*/
|
90 |
+
public $premium_suffix;
|
91 |
+
/**
|
92 |
+
* @since 1.0.9
|
93 |
+
*
|
94 |
+
* @var bool
|
95 |
+
*/
|
96 |
+
public $is_live;
|
97 |
+
/**
|
98 |
+
* @since 2.2.3
|
99 |
+
* @var null|number
|
100 |
+
*/
|
101 |
+
public $bundle_id;
|
102 |
+
/**
|
103 |
+
* @since 2.3.1
|
104 |
+
* @var null|string
|
105 |
+
*/
|
106 |
+
public $bundle_public_key;
|
107 |
+
|
108 |
+
const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
|
109 |
+
|
110 |
+
#endregion Install Specific Properties
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @param stdClass|bool $plugin
|
114 |
+
*/
|
115 |
+
function __construct( $plugin = false ) {
|
116 |
+
parent::__construct( $plugin );
|
117 |
+
|
118 |
+
$this->is_premium = false;
|
119 |
+
$this->is_live = true;
|
120 |
+
|
121 |
+
if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
|
122 |
+
$this->premium_slug = "{$this->slug}-premium";
|
123 |
+
}
|
124 |
+
|
125 |
+
if ( empty( $this->premium_suffix ) ) {
|
126 |
+
$this->premium_suffix = '(Premium)';
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
|
130 |
+
$this->info = new FS_Plugin_Info( $plugin->info );
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Check if plugin is an add-on (has parent).
|
136 |
+
*
|
137 |
+
* @author Vova Feldman (@svovaf)
|
138 |
+
* @since 1.0.6
|
139 |
+
*
|
140 |
+
* @return bool
|
141 |
+
*/
|
142 |
+
function is_addon() {
|
143 |
+
return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* @author Leo Fajardo (@leorw)
|
148 |
+
* @since 1.2.3
|
149 |
+
*
|
150 |
+
* @return bool
|
151 |
+
*/
|
152 |
+
function has_affiliate_program() {
|
153 |
+
return ( ! empty( $this->affiliate_moderation ) );
|
154 |
+
}
|
155 |
+
|
156 |
+
static function get_type() {
|
157 |
+
return 'plugin';
|
158 |
+
}
|
159 |
}
|
lib/freemius/includes/entities/class-fs-pricing.php
CHANGED
@@ -1,157 +1,157 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius for EDD Add-On
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Pricing extends FS_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var number
|
19 |
-
*/
|
20 |
-
public $plan_id;
|
21 |
-
/**
|
22 |
-
* @var int
|
23 |
-
*/
|
24 |
-
public $licenses;
|
25 |
-
/**
|
26 |
-
* @var null|float
|
27 |
-
*/
|
28 |
-
public $monthly_price;
|
29 |
-
/**
|
30 |
-
* @var null|float
|
31 |
-
*/
|
32 |
-
public $annual_price;
|
33 |
-
/**
|
34 |
-
* @var null|float
|
35 |
-
*/
|
36 |
-
public $lifetime_price;
|
37 |
-
/**
|
38 |
-
* @author Leo Fajardo (@leorw)
|
39 |
-
* @since 2.3.1
|
40 |
-
*
|
41 |
-
* @var string One of the following: `usd`, `gbp`, `eur`.
|
42 |
-
*/
|
43 |
-
public $currency;
|
44 |
-
|
45 |
-
#endregion Properties
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @param object|bool $pricing
|
49 |
-
*/
|
50 |
-
function __construct( $pricing = false ) {
|
51 |
-
parent::__construct( $pricing );
|
52 |
-
}
|
53 |
-
|
54 |
-
static function get_type() {
|
55 |
-
return 'pricing';
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @author Vova Feldman (@svovaf)
|
60 |
-
* @since 1.1.8
|
61 |
-
*
|
62 |
-
* @return bool
|
63 |
-
*/
|
64 |
-
function has_monthly() {
|
65 |
-
return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @author Vova Feldman (@svovaf)
|
70 |
-
* @since 1.1.8
|
71 |
-
*
|
72 |
-
* @return bool
|
73 |
-
*/
|
74 |
-
function has_annual() {
|
75 |
-
return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @author Vova Feldman (@svovaf)
|
80 |
-
* @since 1.1.8
|
81 |
-
*
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
function has_lifetime() {
|
85 |
-
return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Check if unlimited licenses pricing.
|
90 |
-
*
|
91 |
-
* @author Vova Feldman (@svovaf)
|
92 |
-
* @since 1.1.8
|
93 |
-
*
|
94 |
-
* @return bool
|
95 |
-
*/
|
96 |
-
function is_unlimited() {
|
97 |
-
return is_null( $this->licenses );
|
98 |
-
}
|
99 |
-
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Check if pricing has more than one billing cycle.
|
103 |
-
*
|
104 |
-
* @author Vova Feldman (@svovaf)
|
105 |
-
* @since 1.1.8
|
106 |
-
*
|
107 |
-
* @return bool
|
108 |
-
*/
|
109 |
-
function is_multi_cycle() {
|
110 |
-
$cycles = 0;
|
111 |
-
if ( $this->has_monthly() ) {
|
112 |
-
$cycles ++;
|
113 |
-
}
|
114 |
-
if ( $this->has_annual() ) {
|
115 |
-
$cycles ++;
|
116 |
-
}
|
117 |
-
if ( $this->has_lifetime() ) {
|
118 |
-
$cycles ++;
|
119 |
-
}
|
120 |
-
|
121 |
-
return $cycles > 1;
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Get annual over monthly discount.
|
126 |
-
*
|
127 |
-
* @author Vova Feldman (@svovaf)
|
128 |
-
* @since 1.1.8
|
129 |
-
*
|
130 |
-
* @return int
|
131 |
-
*/
|
132 |
-
function annual_discount_percentage() {
|
133 |
-
return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Get annual over monthly savings.
|
138 |
-
*
|
139 |
-
* @author Vova Feldman (@svovaf)
|
140 |
-
* @since 1.1.8
|
141 |
-
*
|
142 |
-
* @return float
|
143 |
-
*/
|
144 |
-
function annual_savings() {
|
145 |
-
return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* @author Leo Fajardo (@leorw)
|
150 |
-
* @since 2.3.1
|
151 |
-
*
|
152 |
-
* @return bool
|
153 |
-
*/
|
154 |
-
function is_usd() {
|
155 |
-
return ( 'usd' === $this->currency );
|
156 |
-
}
|
157 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius for EDD Add-On
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Pricing extends FS_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var number
|
19 |
+
*/
|
20 |
+
public $plan_id;
|
21 |
+
/**
|
22 |
+
* @var int
|
23 |
+
*/
|
24 |
+
public $licenses;
|
25 |
+
/**
|
26 |
+
* @var null|float
|
27 |
+
*/
|
28 |
+
public $monthly_price;
|
29 |
+
/**
|
30 |
+
* @var null|float
|
31 |
+
*/
|
32 |
+
public $annual_price;
|
33 |
+
/**
|
34 |
+
* @var null|float
|
35 |
+
*/
|
36 |
+
public $lifetime_price;
|
37 |
+
/**
|
38 |
+
* @author Leo Fajardo (@leorw)
|
39 |
+
* @since 2.3.1
|
40 |
+
*
|
41 |
+
* @var string One of the following: `usd`, `gbp`, `eur`.
|
42 |
+
*/
|
43 |
+
public $currency;
|
44 |
+
|
45 |
+
#endregion Properties
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @param object|bool $pricing
|
49 |
+
*/
|
50 |
+
function __construct( $pricing = false ) {
|
51 |
+
parent::__construct( $pricing );
|
52 |
+
}
|
53 |
+
|
54 |
+
static function get_type() {
|
55 |
+
return 'pricing';
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @author Vova Feldman (@svovaf)
|
60 |
+
* @since 1.1.8
|
61 |
+
*
|
62 |
+
* @return bool
|
63 |
+
*/
|
64 |
+
function has_monthly() {
|
65 |
+
return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @author Vova Feldman (@svovaf)
|
70 |
+
* @since 1.1.8
|
71 |
+
*
|
72 |
+
* @return bool
|
73 |
+
*/
|
74 |
+
function has_annual() {
|
75 |
+
return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @author Vova Feldman (@svovaf)
|
80 |
+
* @since 1.1.8
|
81 |
+
*
|
82 |
+
* @return bool
|
83 |
+
*/
|
84 |
+
function has_lifetime() {
|
85 |
+
return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Check if unlimited licenses pricing.
|
90 |
+
*
|
91 |
+
* @author Vova Feldman (@svovaf)
|
92 |
+
* @since 1.1.8
|
93 |
+
*
|
94 |
+
* @return bool
|
95 |
+
*/
|
96 |
+
function is_unlimited() {
|
97 |
+
return is_null( $this->licenses );
|
98 |
+
}
|
99 |
+
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Check if pricing has more than one billing cycle.
|
103 |
+
*
|
104 |
+
* @author Vova Feldman (@svovaf)
|
105 |
+
* @since 1.1.8
|
106 |
+
*
|
107 |
+
* @return bool
|
108 |
+
*/
|
109 |
+
function is_multi_cycle() {
|
110 |
+
$cycles = 0;
|
111 |
+
if ( $this->has_monthly() ) {
|
112 |
+
$cycles ++;
|
113 |
+
}
|
114 |
+
if ( $this->has_annual() ) {
|
115 |
+
$cycles ++;
|
116 |
+
}
|
117 |
+
if ( $this->has_lifetime() ) {
|
118 |
+
$cycles ++;
|
119 |
+
}
|
120 |
+
|
121 |
+
return $cycles > 1;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Get annual over monthly discount.
|
126 |
+
*
|
127 |
+
* @author Vova Feldman (@svovaf)
|
128 |
+
* @since 1.1.8
|
129 |
+
*
|
130 |
+
* @return int
|
131 |
+
*/
|
132 |
+
function annual_discount_percentage() {
|
133 |
+
return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Get annual over monthly savings.
|
138 |
+
*
|
139 |
+
* @author Vova Feldman (@svovaf)
|
140 |
+
* @since 1.1.8
|
141 |
+
*
|
142 |
+
* @return float
|
143 |
+
*/
|
144 |
+
function annual_savings() {
|
145 |
+
return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* @author Leo Fajardo (@leorw)
|
150 |
+
* @since 2.3.1
|
151 |
+
*
|
152 |
+
* @return bool
|
153 |
+
*/
|
154 |
+
function is_usd() {
|
155 |
+
return ( 'usd' === $this->currency );
|
156 |
+
}
|
157 |
}
|
lib/freemius/includes/entities/class-fs-scope-entity.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.4
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Scope_Entity extends FS_Entity {
|
14 |
-
/**
|
15 |
-
* @var string
|
16 |
-
*/
|
17 |
-
public $public_key;
|
18 |
-
/**
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
public $secret_key;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param bool|stdClass $scope_entity
|
25 |
-
*/
|
26 |
-
function __construct( $scope_entity = false ) {
|
27 |
-
parent::__construct( $scope_entity );
|
28 |
-
}
|
29 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.4
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Scope_Entity extends FS_Entity {
|
14 |
+
/**
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
public $public_key;
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
public $secret_key;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param bool|stdClass $scope_entity
|
25 |
+
*/
|
26 |
+
function __construct( $scope_entity = false ) {
|
27 |
+
parent::__construct( $scope_entity );
|
28 |
+
}
|
29 |
}
|
lib/freemius/includes/entities/class-fs-subscription.php
CHANGED
@@ -1,147 +1,147 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.9
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Subscription extends FS_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var number
|
19 |
-
*/
|
20 |
-
public $user_id;
|
21 |
-
/**
|
22 |
-
* @var number
|
23 |
-
*/
|
24 |
-
public $install_id;
|
25 |
-
/**
|
26 |
-
* @var number
|
27 |
-
*/
|
28 |
-
public $plan_id;
|
29 |
-
/**
|
30 |
-
* @var number
|
31 |
-
*/
|
32 |
-
public $license_id;
|
33 |
-
/**
|
34 |
-
* @var float
|
35 |
-
*/
|
36 |
-
public $total_gross;
|
37 |
-
/**
|
38 |
-
* @var float
|
39 |
-
*/
|
40 |
-
public $amount_per_cycle;
|
41 |
-
/**
|
42 |
-
* @var int # of months
|
43 |
-
*/
|
44 |
-
public $billing_cycle;
|
45 |
-
/**
|
46 |
-
* @var float
|
47 |
-
*/
|
48 |
-
public $outstanding_balance;
|
49 |
-
/**
|
50 |
-
* @var int
|
51 |
-
*/
|
52 |
-
public $failed_payments;
|
53 |
-
/**
|
54 |
-
* @var string
|
55 |
-
*/
|
56 |
-
public $gateway;
|
57 |
-
/**
|
58 |
-
* @var string
|
59 |
-
*/
|
60 |
-
public $external_id;
|
61 |
-
/**
|
62 |
-
* @var string|null
|
63 |
-
*/
|
64 |
-
public $trial_ends;
|
65 |
-
/**
|
66 |
-
* @var string|null Datetime of the next payment, or null if cancelled.
|
67 |
-
*/
|
68 |
-
public $next_payment;
|
69 |
-
/**
|
70 |
-
* @since 2.3.1
|
71 |
-
*
|
72 |
-
* @var string|null Datetime of the cancellation.
|
73 |
-
*/
|
74 |
-
public $canceled_at;
|
75 |
-
/**
|
76 |
-
* @var string|null
|
77 |
-
*/
|
78 |
-
public $vat_id;
|
79 |
-
/**
|
80 |
-
* @var string Two characters country code
|
81 |
-
*/
|
82 |
-
public $country_code;
|
83 |
-
|
84 |
-
#endregion Properties
|
85 |
-
|
86 |
-
/**
|
87 |
-
* @param object|bool $subscription
|
88 |
-
*/
|
89 |
-
function __construct( $subscription = false ) {
|
90 |
-
parent::__construct( $subscription );
|
91 |
-
}
|
92 |
-
|
93 |
-
static function get_type() {
|
94 |
-
return 'subscription';
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Check if subscription is active.
|
99 |
-
*
|
100 |
-
* @author Vova Feldman (@svovaf)
|
101 |
-
* @since 1.0.9
|
102 |
-
*
|
103 |
-
* @return bool
|
104 |
-
*/
|
105 |
-
function is_active() {
|
106 |
-
if ( $this->is_canceled() ) {
|
107 |
-
return false;
|
108 |
-
}
|
109 |
-
|
110 |
-
return (
|
111 |
-
! empty( $this->next_payment ) &&
|
112 |
-
strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
|
113 |
-
);
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* @author Vova Feldman (@svovaf)
|
118 |
-
* @since 2.3.1
|
119 |
-
*
|
120 |
-
* @return bool
|
121 |
-
*/
|
122 |
-
function is_canceled() {
|
123 |
-
return ! is_null( $this->canceled_at );
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Subscription considered to be new without any payments
|
128 |
-
* if the next payment should be made within less than 24 hours
|
129 |
-
* from the subscription creation.
|
130 |
-
*
|
131 |
-
* @author Vova Feldman (@svovaf)
|
132 |
-
* @since 1.0.9
|
133 |
-
*
|
134 |
-
* @return bool
|
135 |
-
*/
|
136 |
-
function is_first_payment_pending() {
|
137 |
-
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* @author Vova Feldman (@svovaf)
|
142 |
-
* @since 1.1.7
|
143 |
-
*/
|
144 |
-
function has_trial() {
|
145 |
-
return ! is_null( $this->trial_ends );
|
146 |
-
}
|
147 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.9
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Subscription extends FS_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var number
|
19 |
+
*/
|
20 |
+
public $user_id;
|
21 |
+
/**
|
22 |
+
* @var number
|
23 |
+
*/
|
24 |
+
public $install_id;
|
25 |
+
/**
|
26 |
+
* @var number
|
27 |
+
*/
|
28 |
+
public $plan_id;
|
29 |
+
/**
|
30 |
+
* @var number
|
31 |
+
*/
|
32 |
+
public $license_id;
|
33 |
+
/**
|
34 |
+
* @var float
|
35 |
+
*/
|
36 |
+
public $total_gross;
|
37 |
+
/**
|
38 |
+
* @var float
|
39 |
+
*/
|
40 |
+
public $amount_per_cycle;
|
41 |
+
/**
|
42 |
+
* @var int # of months
|
43 |
+
*/
|
44 |
+
public $billing_cycle;
|
45 |
+
/**
|
46 |
+
* @var float
|
47 |
+
*/
|
48 |
+
public $outstanding_balance;
|
49 |
+
/**
|
50 |
+
* @var int
|
51 |
+
*/
|
52 |
+
public $failed_payments;
|
53 |
+
/**
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
public $gateway;
|
57 |
+
/**
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
public $external_id;
|
61 |
+
/**
|
62 |
+
* @var string|null
|
63 |
+
*/
|
64 |
+
public $trial_ends;
|
65 |
+
/**
|
66 |
+
* @var string|null Datetime of the next payment, or null if cancelled.
|
67 |
+
*/
|
68 |
+
public $next_payment;
|
69 |
+
/**
|
70 |
+
* @since 2.3.1
|
71 |
+
*
|
72 |
+
* @var string|null Datetime of the cancellation.
|
73 |
+
*/
|
74 |
+
public $canceled_at;
|
75 |
+
/**
|
76 |
+
* @var string|null
|
77 |
+
*/
|
78 |
+
public $vat_id;
|
79 |
+
/**
|
80 |
+
* @var string Two characters country code
|
81 |
+
*/
|
82 |
+
public $country_code;
|
83 |
+
|
84 |
+
#endregion Properties
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @param object|bool $subscription
|
88 |
+
*/
|
89 |
+
function __construct( $subscription = false ) {
|
90 |
+
parent::__construct( $subscription );
|
91 |
+
}
|
92 |
+
|
93 |
+
static function get_type() {
|
94 |
+
return 'subscription';
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Check if subscription is active.
|
99 |
+
*
|
100 |
+
* @author Vova Feldman (@svovaf)
|
101 |
+
* @since 1.0.9
|
102 |
+
*
|
103 |
+
* @return bool
|
104 |
+
*/
|
105 |
+
function is_active() {
|
106 |
+
if ( $this->is_canceled() ) {
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
return (
|
111 |
+
! empty( $this->next_payment ) &&
|
112 |
+
strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* @author Vova Feldman (@svovaf)
|
118 |
+
* @since 2.3.1
|
119 |
+
*
|
120 |
+
* @return bool
|
121 |
+
*/
|
122 |
+
function is_canceled() {
|
123 |
+
return ! is_null( $this->canceled_at );
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Subscription considered to be new without any payments
|
128 |
+
* if the next payment should be made within less than 24 hours
|
129 |
+
* from the subscription creation.
|
130 |
+
*
|
131 |
+
* @author Vova Feldman (@svovaf)
|
132 |
+
* @since 1.0.9
|
133 |
+
*
|
134 |
+
* @return bool
|
135 |
+
*/
|
136 |
+
function is_first_payment_pending() {
|
137 |
+
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @author Vova Feldman (@svovaf)
|
142 |
+
* @since 1.1.7
|
143 |
+
*/
|
144 |
+
function has_trial() {
|
145 |
+
return ! is_null( $this->trial_ends );
|
146 |
+
}
|
147 |
}
|
lib/freemius/includes/entities/class-fs-user.php
CHANGED
@@ -1,73 +1,73 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_User extends FS_Scope_Entity {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var string
|
19 |
-
*/
|
20 |
-
public $email;
|
21 |
-
/**
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
public $first;
|
25 |
-
/**
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
public $last;
|
29 |
-
/**
|
30 |
-
* @var bool
|
31 |
-
*/
|
32 |
-
public $is_verified;
|
33 |
-
/**
|
34 |
-
* @var string|null
|
35 |
-
*/
|
36 |
-
public $customer_id;
|
37 |
-
/**
|
38 |
-
* @var float
|
39 |
-
*/
|
40 |
-
public $gross;
|
41 |
-
|
42 |
-
#endregion Properties
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param object|bool $user
|
46 |
-
*/
|
47 |
-
function __construct( $user = false ) {
|
48 |
-
parent::__construct( $user );
|
49 |
-
}
|
50 |
-
|
51 |
-
function get_name() {
|
52 |
-
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
|
53 |
-
}
|
54 |
-
|
55 |
-
function is_verified() {
|
56 |
-
return ( isset( $this->is_verified ) && true === $this->is_verified );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @author Leo Fajardo (@leorw)
|
61 |
-
* @since 2.4.2
|
62 |
-
*
|
63 |
-
* @return bool
|
64 |
-
*/
|
65 |
-
function is_beta() {
|
66 |
-
// Return `false` since this is just for backward compatibility.
|
67 |
-
return false;
|
68 |
-
}
|
69 |
-
|
70 |
-
static function get_type() {
|
71 |
-
return 'user';
|
72 |
-
}
|
73 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_User extends FS_Scope_Entity {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var string
|
19 |
+
*/
|
20 |
+
public $email;
|
21 |
+
/**
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
public $first;
|
25 |
+
/**
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $last;
|
29 |
+
/**
|
30 |
+
* @var bool
|
31 |
+
*/
|
32 |
+
public $is_verified;
|
33 |
+
/**
|
34 |
+
* @var string|null
|
35 |
+
*/
|
36 |
+
public $customer_id;
|
37 |
+
/**
|
38 |
+
* @var float
|
39 |
+
*/
|
40 |
+
public $gross;
|
41 |
+
|
42 |
+
#endregion Properties
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param object|bool $user
|
46 |
+
*/
|
47 |
+
function __construct( $user = false ) {
|
48 |
+
parent::__construct( $user );
|
49 |
+
}
|
50 |
+
|
51 |
+
function get_name() {
|
52 |
+
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
function is_verified() {
|
56 |
+
return ( isset( $this->is_verified ) && true === $this->is_verified );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @author Leo Fajardo (@leorw)
|
61 |
+
* @since 2.4.2
|
62 |
+
*
|
63 |
+
* @return bool
|
64 |
+
*/
|
65 |
+
function is_beta() {
|
66 |
+
// Return `false` since this is just for backward compatibility.
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
static function get_type() {
|
71 |
+
return 'user';
|
72 |
+
}
|
73 |
}
|
lib/freemius/includes/entities/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/l10n.php
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.1.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Retrieve the translation of $text.
|
15 |
-
*
|
16 |
-
* @since 1.2.1.6
|
17 |
-
*
|
18 |
-
* @param string $text
|
19 |
-
*
|
20 |
-
* @return string
|
21 |
-
*/
|
22 |
-
function _fs_text( $text ) {
|
23 |
-
// Avoid misleading Theme Check warning.
|
24 |
-
$fn = 'translate';
|
25 |
-
return $fn( $text, 'freemius' );
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Retrieve translated string with gettext context.
|
30 |
-
*
|
31 |
-
* Quite a few times, there will be collisions with similar translatable text
|
32 |
-
* found in more than two places, but with different translated context.
|
33 |
-
*
|
34 |
-
* By including the context in the pot file, translators can translate the two
|
35 |
-
* strings differently.
|
36 |
-
*
|
37 |
-
* @since 1.2.1.6
|
38 |
-
*
|
39 |
-
* @param string $text
|
40 |
-
* @param string $context
|
41 |
-
*
|
42 |
-
* @return string
|
43 |
-
*/
|
44 |
-
function _fs_x( $text, $context ) {
|
45 |
-
// Avoid misleading Theme Check warning.
|
46 |
-
$fn = 'translate_with_gettext_context';
|
47 |
-
return $fn( $text, $context, 'freemius' );
|
48 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.1.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Retrieve the translation of $text.
|
15 |
+
*
|
16 |
+
* @since 1.2.1.6
|
17 |
+
*
|
18 |
+
* @param string $text
|
19 |
+
*
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
function _fs_text( $text ) {
|
23 |
+
// Avoid misleading Theme Check warning.
|
24 |
+
$fn = 'translate';
|
25 |
+
return $fn( $text, 'freemius' );
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Retrieve translated string with gettext context.
|
30 |
+
*
|
31 |
+
* Quite a few times, there will be collisions with similar translatable text
|
32 |
+
* found in more than two places, but with different translated context.
|
33 |
+
*
|
34 |
+
* By including the context in the pot file, translators can translate the two
|
35 |
+
* strings differently.
|
36 |
+
*
|
37 |
+
* @since 1.2.1.6
|
38 |
+
*
|
39 |
+
* @param string $text
|
40 |
+
* @param string $context
|
41 |
+
*
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
function _fs_x( $text, $context ) {
|
45 |
+
// Avoid misleading Theme Check warning.
|
46 |
+
$fn = 'translate_with_gettext_context';
|
47 |
+
return $fn( $text, $context, 'freemius' );
|
48 |
+
}
|
lib/freemius/includes/managers/class-fs-admin-menu-manager.php
CHANGED
@@ -1,1006 +1,1006 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Admin_Menu_Manager {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @since 1.2.2
|
19 |
-
*
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
protected $_module_unique_affix;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @since 1.2.2
|
26 |
-
*
|
27 |
-
* @var number
|
28 |
-
*/
|
29 |
-
protected $_module_id;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @since 1.2.2
|
33 |
-
*
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
protected $_module_type;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @since 1.0.6
|
40 |
-
*
|
41 |
-
* @var string
|
42 |
-
*/
|
43 |
-
private $_menu_slug;
|
44 |
-
/**
|
45 |
-
* @since 1.1.3
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
private $_parent_slug;
|
50 |
-
/**
|
51 |
-
* @since 1.1.3
|
52 |
-
*
|
53 |
-
* @var string
|
54 |
-
*/
|
55 |
-
private $_parent_type;
|
56 |
-
/**
|
57 |
-
* @since 1.1.3
|
58 |
-
*
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
private $_type;
|
62 |
-
/**
|
63 |
-
* @since 1.1.3
|
64 |
-
*
|
65 |
-
* @var bool
|
66 |
-
*/
|
67 |
-
private $_is_top_level;
|
68 |
-
/**
|
69 |
-
* @since 1.1.3
|
70 |
-
*
|
71 |
-
* @var bool
|
72 |
-
*/
|
73 |
-
private $_is_override_exact;
|
74 |
-
/**
|
75 |
-
* @since 1.1.3
|
76 |
-
*
|
77 |
-
* @var array<string,bool>
|
78 |
-
*/
|
79 |
-
private $_default_submenu_items;
|
80 |
-
/**
|
81 |
-
* @since 1.1.3
|
82 |
-
*
|
83 |
-
* @var string
|
84 |
-
*/
|
85 |
-
private $_first_time_path;
|
86 |
-
/**
|
87 |
-
* @since 1.2.2
|
88 |
-
*
|
89 |
-
* @var bool
|
90 |
-
*/
|
91 |
-
private $_menu_exists;
|
92 |
-
/**
|
93 |
-
* @since 2.0.0
|
94 |
-
*
|
95 |
-
* @var bool
|
96 |
-
*/
|
97 |
-
private $_network_menu_exists;
|
98 |
-
|
99 |
-
#endregion Properties
|
100 |
-
|
101 |
-
/**
|
102 |
-
* @var FS_Logger
|
103 |
-
*/
|
104 |
-
protected $_logger;
|
105 |
-
|
106 |
-
#region Singleton
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @var FS_Admin_Menu_Manager[]
|
110 |
-
*/
|
111 |
-
private static $_instances = array();
|
112 |
-
|
113 |
-
/**
|
114 |
-
* @param number $module_id
|
115 |
-
* @param string $module_type
|
116 |
-
* @param string $module_unique_affix
|
117 |
-
*
|
118 |
-
* @return FS_Admin_Menu_Manager
|
119 |
-
*/
|
120 |
-
static function instance( $module_id, $module_type, $module_unique_affix ) {
|
121 |
-
$key = 'm_' . $module_id;
|
122 |
-
|
123 |
-
if ( ! isset( self::$_instances[ $key ] ) ) {
|
124 |
-
self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
|
125 |
-
}
|
126 |
-
|
127 |
-
return self::$_instances[ $key ];
|
128 |
-
}
|
129 |
-
|
130 |
-
protected function __construct( $module_id, $module_type, $module_unique_affix ) {
|
131 |
-
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
132 |
-
|
133 |
-
$this->_module_id = $module_id;
|
134 |
-
$this->_module_type = $module_type;
|
135 |
-
$this->_module_unique_affix = $module_unique_affix;
|
136 |
-
}
|
137 |
-
|
138 |
-
#endregion Singleton
|
139 |
-
|
140 |
-
#region Helpers
|
141 |
-
|
142 |
-
private function get_option( &$options, $key, $default = false ) {
|
143 |
-
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
|
144 |
-
}
|
145 |
-
|
146 |
-
private function get_bool_option( &$options, $key, $default = false ) {
|
147 |
-
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
|
148 |
-
}
|
149 |
-
|
150 |
-
#endregion Helpers
|
151 |
-
|
152 |
-
/**
|
153 |
-
* @param array $menu
|
154 |
-
* @param bool $is_addon
|
155 |
-
*/
|
156 |
-
function init( $menu, $is_addon = false ) {
|
157 |
-
$this->_menu_exists = ( isset( $menu['slug'] ) && ! empty( $menu['slug'] ) );
|
158 |
-
$this->_network_menu_exists = ( ! empty( $menu['network'] ) && true === $menu['network'] );
|
159 |
-
|
160 |
-
$this->_menu_slug = ( $this->_menu_exists ? $menu['slug'] : $this->_module_unique_affix );
|
161 |
-
|
162 |
-
$this->_default_submenu_items = array();
|
163 |
-
// @deprecated
|
164 |
-
$this->_type = 'page';
|
165 |
-
$this->_is_top_level = true;
|
166 |
-
$this->_is_override_exact = false;
|
167 |
-
$this->_parent_slug = false;
|
168 |
-
// @deprecated
|
169 |
-
$this->_parent_type = 'page';
|
170 |
-
|
171 |
-
if ( isset( $menu ) ) {
|
172 |
-
if ( ! $is_addon ) {
|
173 |
-
$this->_default_submenu_items = array(
|
174 |
-
'contact' => $this->get_bool_option( $menu, 'contact', true ),
|
175 |
-
'support' => $this->get_bool_option( $menu, 'support', true ),
|
176 |
-
'affiliation' => $this->get_bool_option( $menu, 'affiliation', true ),
|
177 |
-
'account' => $this->get_bool_option( $menu, 'account', true ),
|
178 |
-
'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
|
179 |
-
'addons' => $this->get_bool_option( $menu, 'addons', true ),
|
180 |
-
);
|
181 |
-
|
182 |
-
// @deprecated
|
183 |
-
$this->_type = $this->get_option( $menu, 'type', 'page' );
|
184 |
-
}
|
185 |
-
|
186 |
-
$this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
|
187 |
-
|
188 |
-
if ( isset( $menu['parent'] ) ) {
|
189 |
-
$this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
|
190 |
-
// @deprecated
|
191 |
-
$this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
|
192 |
-
|
193 |
-
// If parent's slug is different, then it's NOT a top level menu item.
|
194 |
-
$this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
|
195 |
-
} else {
|
196 |
-
/**
|
197 |
-
* If no parent then top level if:
|
198 |
-
* - Has custom admin menu ('page')
|
199 |
-
* - CPT menu type ('cpt')
|
200 |
-
*/
|
201 |
-
// $this->_is_top_level = in_array( $this->_type, array(
|
202 |
-
// 'cpt',
|
203 |
-
// 'page'
|
204 |
-
// ) );
|
205 |
-
}
|
206 |
-
|
207 |
-
$first_path = $this->get_option( $menu, 'first-path', false );
|
208 |
-
|
209 |
-
if ( ! empty( $first_path ) && is_string( $first_path ) ) {
|
210 |
-
$this->_first_time_path = $first_path;
|
211 |
-
}
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Check if top level menu.
|
217 |
-
*
|
218 |
-
* @author Vova Feldman (@svovaf)
|
219 |
-
* @since 1.1.3
|
220 |
-
*
|
221 |
-
* @return bool False if submenu item.
|
222 |
-
*/
|
223 |
-
function is_top_level() {
|
224 |
-
return $this->_is_top_level;
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Check if the page should be override on exact URL match.
|
229 |
-
*
|
230 |
-
* @author Vova Feldman (@svovaf)
|
231 |
-
* @since 1.1.3
|
232 |
-
*
|
233 |
-
* @return bool False if submenu item.
|
234 |
-
*/
|
235 |
-
function is_override_exact() {
|
236 |
-
return $this->_is_override_exact;
|
237 |
-
}
|
238 |
-
|
239 |
-
|
240 |
-
/**
|
241 |
-
* Get the path of the page the user should be forwarded to after first activation.
|
242 |
-
*
|
243 |
-
* @author Vova Feldman (@svovaf)
|
244 |
-
* @since 1.1.3
|
245 |
-
*
|
246 |
-
* @param bool $is_network Since 2.4.5
|
247 |
-
*
|
248 |
-
* @return string
|
249 |
-
*/
|
250 |
-
function get_first_time_path( $is_network = false ) {
|
251 |
-
if ( empty ( $this->_first_time_path ) ) {
|
252 |
-
return $this->_first_time_path;
|
253 |
-
}
|
254 |
-
|
255 |
-
if ( $is_network ) {
|
256 |
-
return network_admin_url( $this->_first_time_path );
|
257 |
-
} else {
|
258 |
-
return admin_url( $this->_first_time_path );
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Check if plugin's menu item is part of a custom top level menu.
|
264 |
-
*
|
265 |
-
* @author Vova Feldman (@svovaf)
|
266 |
-
* @since 1.1.3
|
267 |
-
*
|
268 |
-
* @return bool
|
269 |
-
*/
|
270 |
-
function has_custom_parent() {
|
271 |
-
return ! $this->_is_top_level && is_string( $this->_parent_slug );
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* @author Leo Fajardo (@leorw)
|
276 |
-
* @since 1.2.2
|
277 |
-
*
|
278 |
-
* @return bool
|
279 |
-
*/
|
280 |
-
function has_menu() {
|
281 |
-
return $this->_menu_exists;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* @author Vova Feldman (@svovaf)
|
286 |
-
* @since 2.0.0
|
287 |
-
*
|
288 |
-
* @return bool
|
289 |
-
*/
|
290 |
-
function has_network_menu() {
|
291 |
-
return $this->_network_menu_exists;
|
292 |
-
}
|
293 |
-
|
294 |
-
/**
|
295 |
-
* @author Leo Fajardo (@leorw)
|
296 |
-
*
|
297 |
-
* @param string $menu_slug
|
298 |
-
*
|
299 |
-
* @since 2.1.3
|
300 |
-
*/
|
301 |
-
function set_slug_and_network_menu_exists_flag($menu_slug ) {
|
302 |
-
$this->_menu_slug = $menu_slug;
|
303 |
-
$this->_network_menu_exists = false;
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* @author Vova Feldman (@svovaf)
|
308 |
-
* @since 1.1.3
|
309 |
-
*
|
310 |
-
* @param string $id
|
311 |
-
* @param bool $default
|
312 |
-
* @param bool $ignore_menu_existence Since 1.2.2.7 If true, check if the submenu item visible even if there's no parent menu.
|
313 |
-
*
|
314 |
-
* @return bool
|
315 |
-
*/
|
316 |
-
function is_submenu_item_visible( $id, $default = true, $ignore_menu_existence = false ) {
|
317 |
-
if ( ! $ignore_menu_existence && ! $this->has_menu() ) {
|
318 |
-
return false;
|
319 |
-
}
|
320 |
-
|
321 |
-
return fs_apply_filter(
|
322 |
-
$this->_module_unique_affix,
|
323 |
-
'is_submenu_visible',
|
324 |
-
$this->get_bool_option( $this->_default_submenu_items, $id, $default ),
|
325 |
-
$id
|
326 |
-
);
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* Calculates admin settings menu slug.
|
331 |
-
* If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
|
332 |
-
*
|
333 |
-
* @author Vova Feldman (@svovaf)
|
334 |
-
* @since 1.1.3
|
335 |
-
*
|
336 |
-
* @param string $page
|
337 |
-
*
|
338 |
-
* @return string
|
339 |
-
*/
|
340 |
-
function get_slug( $page = '' ) {
|
341 |
-
return ( ( false === strpos( $this->_menu_slug, '.php?' ) ) ?
|
342 |
-
$this->_menu_slug :
|
343 |
-
$this->_module_unique_affix ) . ( empty( $page ) ? '' : ( '-' . $page ) );
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* @author Vova Feldman (@svovaf)
|
348 |
-
* @since 1.1.3
|
349 |
-
*
|
350 |
-
* @return string
|
351 |
-
*/
|
352 |
-
function get_parent_slug() {
|
353 |
-
return $this->_parent_slug;
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* @author Vova Feldman (@svovaf)
|
358 |
-
* @since 1.1.3
|
359 |
-
*
|
360 |
-
* @return string
|
361 |
-
*/
|
362 |
-
function get_type() {
|
363 |
-
return $this->_type;
|
364 |
-
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* @author Vova Feldman (@svovaf)
|
368 |
-
* @since 1.1.3
|
369 |
-
*
|
370 |
-
* @return bool
|
371 |
-
*/
|
372 |
-
function is_cpt() {
|
373 |
-
return ( 0 === strpos( $this->_menu_slug, 'edit.php?post_type=' ) ||
|
374 |
-
// Back compatibility.
|
375 |
-
'cpt' === $this->_type
|
376 |
-
);
|
377 |
-
}
|
378 |
-
|
379 |
-
/**
|
380 |
-
* @author Vova Feldman (@svovaf)
|
381 |
-
* @since 1.1.3
|
382 |
-
*
|
383 |
-
* @return string
|
384 |
-
*/
|
385 |
-
function get_parent_type() {
|
386 |
-
return $this->_parent_type;
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* @author Vova Feldman (@svovaf)
|
391 |
-
* @since 1.1.3
|
392 |
-
*
|
393 |
-
* @return string
|
394 |
-
*/
|
395 |
-
function get_raw_slug() {
|
396 |
-
return $this->_menu_slug;
|
397 |
-
}
|
398 |
-
|
399 |
-
/**
|
400 |
-
* Get plugin's original menu slug.
|
401 |
-
*
|
402 |
-
* @author Vova Feldman (@svovaf)
|
403 |
-
* @since 1.1.3
|
404 |
-
*
|
405 |
-
* @return string
|
406 |
-
*/
|
407 |
-
function get_original_menu_slug() {
|
408 |
-
if ( 'cpt' === $this->_type ) {
|
409 |
-
return add_query_arg( array(
|
410 |
-
'post_type' => $this->_menu_slug
|
411 |
-
), 'edit.php' );
|
412 |
-
}
|
413 |
-
|
414 |
-
if ( false === strpos( $this->_menu_slug, '.php?' ) ) {
|
415 |
-
return $this->_menu_slug;
|
416 |
-
} else {
|
417 |
-
return $this->_module_unique_affix;
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
/**
|
422 |
-
* @author Vova Feldman (@svovaf)
|
423 |
-
* @since 1.1.3
|
424 |
-
*
|
425 |
-
* @return string
|
426 |
-
*/
|
427 |
-
function get_top_level_menu_slug() {
|
428 |
-
return $this->has_custom_parent() ?
|
429 |
-
$this->get_parent_slug() :
|
430 |
-
$this->get_raw_slug();
|
431 |
-
}
|
432 |
-
|
433 |
-
/**
|
434 |
-
* Is user on plugin's admin activation page.
|
435 |
-
*
|
436 |
-
* @author Vova Feldman (@svovaf)
|
437 |
-
* @since 1.0.8
|
438 |
-
*
|
439 |
-
* @param bool $show_opt_in_on_themes_page Since 2.3.1
|
440 |
-
*
|
441 |
-
* @return bool
|
442 |
-
*
|
443 |
-
* @deprecated Please use is_activation_page() instead.
|
444 |
-
*/
|
445 |
-
function is_main_settings_page( $show_opt_in_on_themes_page = false ) {
|
446 |
-
return $this->is_activation_page( $show_opt_in_on_themes_page );
|
447 |
-
}
|
448 |
-
|
449 |
-
/**
|
450 |
-
* Is user on product's admin activation page.
|
451 |
-
*
|
452 |
-
* @author Vova Feldman (@svovaf)
|
453 |
-
* @since 2.3.1
|
454 |
-
*
|
455 |
-
* @param bool $show_opt_in_on_themes_page Since 2.3.1
|
456 |
-
*
|
457 |
-
* @return bool
|
458 |
-
*/
|
459 |
-
function is_activation_page( $show_opt_in_on_themes_page = false ) {
|
460 |
-
if ( $show_opt_in_on_themes_page ) {
|
461 |
-
/**
|
462 |
-
* In activation only when show_optin query string param is given.
|
463 |
-
*
|
464 |
-
* @since 1.2.2
|
465 |
-
*/
|
466 |
-
return (
|
467 |
-
( WP_FS__MODULE_TYPE_THEME === $this->_module_type ) &&
|
468 |
-
Freemius::is_themes_page() &&
|
469 |
-
fs_request_get_bool( $this->_module_unique_affix . '_show_optin' )
|
470 |
-
);
|
471 |
-
}
|
472 |
-
|
473 |
-
if ( $this->_menu_exists &&
|
474 |
-
( fs_is_plugin_page( $this->_menu_slug ) || fs_is_plugin_page( $this->_module_unique_affix ) )
|
475 |
-
) {
|
476 |
-
/**
|
477 |
-
* Module has a settings menu and the context page is the main settings page, so assume it's in
|
478 |
-
* activation (doesn't really check if already opted-in/skipped or not).
|
479 |
-
*
|
480 |
-
* @since 1.2.2
|
481 |
-
*/
|
482 |
-
return true;
|
483 |
-
}
|
484 |
-
|
485 |
-
return false;
|
486 |
-
}
|
487 |
-
|
488 |
-
#region Submenu Override
|
489 |
-
|
490 |
-
/**
|
491 |
-
* Override submenu's action.
|
492 |
-
*
|
493 |
-
* @author Vova Feldman (@svovaf)
|
494 |
-
* @since 1.1.0
|
495 |
-
*
|
496 |
-
* @param string $parent_slug
|
497 |
-
* @param string $menu_slug
|
498 |
-
* @param callable $function
|
499 |
-
*
|
500 |
-
* @return false|string If submenu exist, will return the hook name.
|
501 |
-
*/
|
502 |
-
function override_submenu_action( $parent_slug, $menu_slug, $function ) {
|
503 |
-
global $submenu;
|
504 |
-
|
505 |
-
$menu_slug = plugin_basename( $menu_slug );
|
506 |
-
$parent_slug = plugin_basename( $parent_slug );
|
507 |
-
|
508 |
-
if ( ! isset( $submenu[ $parent_slug ] ) ) {
|
509 |
-
// Parent menu not exist.
|
510 |
-
return false;
|
511 |
-
}
|
512 |
-
|
513 |
-
$found_submenu_item = false;
|
514 |
-
foreach ( $submenu[ $parent_slug ] as $submenu_item ) {
|
515 |
-
if ( $menu_slug === $submenu_item[2] ) {
|
516 |
-
$found_submenu_item = $submenu_item;
|
517 |
-
break;
|
518 |
-
}
|
519 |
-
}
|
520 |
-
|
521 |
-
if ( false === $found_submenu_item ) {
|
522 |
-
// Submenu item not found.
|
523 |
-
return false;
|
524 |
-
}
|
525 |
-
|
526 |
-
// Remove current function.
|
527 |
-
$hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
|
528 |
-
remove_all_actions( $hookname );
|
529 |
-
|
530 |
-
// Attach new action.
|
531 |
-
add_action( $hookname, $function );
|
532 |
-
|
533 |
-
return $hookname;
|
534 |
-
}
|
535 |
-
|
536 |
-
#endregion Submenu Override
|
537 |
-
|
538 |
-
#region Top level menu Override
|
539 |
-
|
540 |
-
/**
|
541 |
-
* Find plugin's admin dashboard main menu item.
|
542 |
-
*
|
543 |
-
* @author Vova Feldman (@svovaf)
|
544 |
-
* @since 1.0.2
|
545 |
-
*
|
546 |
-
* @return string[]|false
|
547 |
-
*/
|
548 |
-
private function find_top_level_menu() {
|
549 |
-
global $menu;
|
550 |
-
|
551 |
-
$position = - 1;
|
552 |
-
$found_menu = false;
|
553 |
-
|
554 |
-
$menu_slug = $this->get_raw_slug();
|
555 |
-
|
556 |
-
$hook_name = get_plugin_page_hookname( $menu_slug, '' );
|
557 |
-
foreach ( $menu as $pos => $m ) {
|
558 |
-
if ( $menu_slug === $m[2] ) {
|
559 |
-
$position = $pos;
|
560 |
-
$found_menu = $m;
|
561 |
-
break;
|
562 |
-
}
|
563 |
-
}
|
564 |
-
|
565 |
-
if ( false === $found_menu ) {
|
566 |
-
return false;
|
567 |
-
}
|
568 |
-
|
569 |
-
return array(
|
570 |
-
'menu' => $found_menu,
|
571 |
-
'position' => $position,
|
572 |
-
'hook_name' => $hook_name
|
573 |
-
);
|
574 |
-
}
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Find plugin's admin dashboard main submenu item.
|
578 |
-
*
|
579 |
-
* @author Vova Feldman (@svovaf)
|
580 |
-
* @since 1.2.1.6
|
581 |
-
*
|
582 |
-
* @return array|false
|
583 |
-
*/
|
584 |
-
private function find_main_submenu() {
|
585 |
-
global $submenu;
|
586 |
-
|
587 |
-
$top_level_menu_slug = $this->get_top_level_menu_slug();
|
588 |
-
|
589 |
-
if ( ! isset( $submenu[ $top_level_menu_slug ] ) ) {
|
590 |
-
return false;
|
591 |
-
}
|
592 |
-
|
593 |
-
$submenu_slug = $this->get_raw_slug();
|
594 |
-
|
595 |
-
$position = - 1;
|
596 |
-
$found_submenu = false;
|
597 |
-
|
598 |
-
$hook_name = get_plugin_page_hookname( $submenu_slug, '' );
|
599 |
-
|
600 |
-
foreach ( $submenu[ $top_level_menu_slug ] as $pos => $sub ) {
|
601 |
-
if ( $submenu_slug === $sub[2] ) {
|
602 |
-
$position = $pos;
|
603 |
-
$found_submenu = $sub;
|
604 |
-
}
|
605 |
-
}
|
606 |
-
|
607 |
-
if ( false === $found_submenu ) {
|
608 |
-
return false;
|
609 |
-
}
|
610 |
-
|
611 |
-
return array(
|
612 |
-
'menu' => $found_submenu,
|
613 |
-
'parent_slug' => $top_level_menu_slug,
|
614 |
-
'position' => $position,
|
615 |
-
'hook_name' => $hook_name
|
616 |
-
);
|
617 |
-
}
|
618 |
-
|
619 |
-
/**
|
620 |
-
* Remove all sub-menu items.
|
621 |
-
*
|
622 |
-
* @author Vova Feldman (@svovaf)
|
623 |
-
* @since 1.0.7
|
624 |
-
*
|
625 |
-
* @return bool If submenu with plugin's menu slug was found.
|
626 |
-
*/
|
627 |
-
private function remove_all_submenu_items() {
|
628 |
-
global $submenu;
|
629 |
-
|
630 |
-
$menu_slug = $this->get_raw_slug();
|
631 |
-
|
632 |
-
if ( ! isset( $submenu[ $menu_slug ] ) ) {
|
633 |
-
return false;
|
634 |
-
}
|
635 |
-
|
636 |
-
/**
|
637 |
-
* This method is NOT executed for WordPress.org themes.
|
638 |
-
* Since we maintain only one version of the SDK we added this small
|
639 |
-
* hack to avoid the error from Theme Check since it's a false-positive.
|
640 |
-
*
|
641 |
-
* @author Vova Feldman (@svovaf)
|
642 |
-
* @since 1.2.2.7
|
643 |
-
*/
|
644 |
-
$submenu_ref = &$submenu;
|
645 |
-
$submenu_ref[ $menu_slug ] = array();
|
646 |
-
|
647 |
-
return true;
|
648 |
-
}
|
649 |
-
|
650 |
-
/**
|
651 |
-
*
|
652 |
-
* @author Vova Feldman (@svovaf)
|
653 |
-
* @since 1.0.9
|
654 |
-
*
|
655 |
-
* @param bool $remove_top_level_menu
|
656 |
-
*
|
657 |
-
* @return false|array[string]mixed
|
658 |
-
*/
|
659 |
-
function remove_menu_item( $remove_top_level_menu = false ) {
|
660 |
-
$this->_logger->entrance();
|
661 |
-
|
662 |
-
// Find main menu item.
|
663 |
-
$top_level_menu = $this->find_top_level_menu();
|
664 |
-
|
665 |
-
if ( false === $top_level_menu ) {
|
666 |
-
return false;
|
667 |
-
}
|
668 |
-
|
669 |
-
// Remove it with its actions.
|
670 |
-
remove_all_actions( $top_level_menu['hook_name'] );
|
671 |
-
|
672 |
-
// Remove all submenu items.
|
673 |
-
$this->remove_all_submenu_items();
|
674 |
-
|
675 |
-
if ( $remove_top_level_menu ) {
|
676 |
-
global $menu;
|
677 |
-
unset( $menu[ $top_level_menu['position'] ] );
|
678 |
-
}
|
679 |
-
|
680 |
-
return $top_level_menu;
|
681 |
-
}
|
682 |
-
|
683 |
-
/**
|
684 |
-
* Get module's main admin setting page URL.
|
685 |
-
*
|
686 |
-
* @todo This method was only tested for wp.org compliant themes with a submenu item. Need to test for plugins with top level, submenu, and CPT top level, menu items.
|
687 |
-
*
|
688 |
-
* @author Vova Feldman (@svovaf)
|
689 |
-
* @since 1.2.2.7
|
690 |
-
*
|
691 |
-
* @return string
|
692 |
-
*/
|
693 |
-
function main_menu_url() {
|
694 |
-
$this->_logger->entrance();
|
695 |
-
|
696 |
-
if ( $this->_is_top_level ) {
|
697 |
-
$menu = $this->find_top_level_menu();
|
698 |
-
} else {
|
699 |
-
$menu = $this->find_main_submenu();
|
700 |
-
}
|
701 |
-
|
702 |
-
$parent_slug = isset( $menu['parent_slug'] ) ?
|
703 |
-
$menu['parent_slug'] :
|
704 |
-
'admin.php';
|
705 |
-
|
706 |
-
return admin_url(
|
707 |
-
$parent_slug .
|
708 |
-
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
|
709 |
-
'page=' .
|
710 |
-
$menu['menu'][2]
|
711 |
-
);
|
712 |
-
}
|
713 |
-
|
714 |
-
/**
|
715 |
-
* @author Vova Feldman (@svovaf)
|
716 |
-
* @since 1.1.4
|
717 |
-
*
|
718 |
-
* @param callable $function
|
719 |
-
*
|
720 |
-
* @return false|array[string]mixed
|
721 |
-
*/
|
722 |
-
function override_menu_item( $function ) {
|
723 |
-
$found_menu = $this->remove_menu_item();
|
724 |
-
|
725 |
-
if ( false === $found_menu ) {
|
726 |
-
return false;
|
727 |
-
}
|
728 |
-
|
729 |
-
if ( ! $this->is_top_level() || ! $this->is_cpt() ) {
|
730 |
-
$menu_slug = plugin_basename( $this->get_slug() );
|
731 |
-
|
732 |
-
$hookname = get_plugin_page_hookname( $menu_slug, '' );
|
733 |
-
|
734 |
-
// Override menu action.
|
735 |
-
add_action( $hookname, $function );
|
736 |
-
} else {
|
737 |
-
global $menu;
|
738 |
-
|
739 |
-
// Remove original CPT menu.
|
740 |
-
unset( $menu[ $found_menu['position'] ] );
|
741 |
-
|
742 |
-
// Create new top-level menu action.
|
743 |
-
$hookname = self::add_page(
|
744 |
-
$found_menu['menu'][3],
|
745 |
-
$found_menu['menu'][0],
|
746 |
-
'manage_options',
|
747 |
-
$this->get_slug(),
|
748 |
-
$function,
|
749 |
-
$found_menu['menu'][6],
|
750 |
-
$found_menu['position']
|
751 |
-
);
|
752 |
-
}
|
753 |
-
|
754 |
-
return $hookname;
|
755 |
-
}
|
756 |
-
|
757 |
-
/**
|
758 |
-
* Adds a counter to the module's top level menu item.
|
759 |
-
*
|
760 |
-
* @author Vova Feldman (@svovaf)
|
761 |
-
* @since 1.2.1.5
|
762 |
-
*
|
763 |
-
* @param int $counter
|
764 |
-
* @param string $class
|
765 |
-
*/
|
766 |
-
function add_counter_to_menu_item( $counter = 1, $class = '' ) {
|
767 |
-
global $menu, $submenu;
|
768 |
-
|
769 |
-
$mask = '%s <span class="update-plugins %s count-%3$s" aria-hidden="true"><span>%3$s<span class="screen-reader-text">%3$s notifications</span></span></span>';
|
770 |
-
|
771 |
-
/**
|
772 |
-
* This method is NOT executed for WordPress.org themes.
|
773 |
-
* Since we maintain only one version of the SDK we added this small
|
774 |
-
* hack to avoid the error from Theme Check since it's a false-positive.
|
775 |
-
*
|
776 |
-
* @author Vova Feldman (@svovaf)
|
777 |
-
* @since 1.2.2.7
|
778 |
-
*/
|
779 |
-
$menu_ref = &$menu;
|
780 |
-
$submenu_ref = &$submenu;
|
781 |
-
|
782 |
-
if ( $this->_is_top_level ) {
|
783 |
-
// Find main menu item.
|
784 |
-
$found_menu = $this->find_top_level_menu();
|
785 |
-
|
786 |
-
if ( false !== $found_menu ) {
|
787 |
-
// Override menu label.
|
788 |
-
$menu_ref[ $found_menu['position'] ][0] = sprintf(
|
789 |
-
$mask,
|
790 |
-
$found_menu['menu'][0],
|
791 |
-
$class,
|
792 |
-
$counter
|
793 |
-
);
|
794 |
-
}
|
795 |
-
} else {
|
796 |
-
$found_submenu = $this->find_main_submenu();
|
797 |
-
|
798 |
-
if ( false !== $found_submenu ) {
|
799 |
-
// Override menu label.
|
800 |
-
$submenu_ref[ $found_submenu['parent_slug'] ][ $found_submenu['position'] ][0] = sprintf(
|
801 |
-
$mask,
|
802 |
-
$found_submenu['menu'][0],
|
803 |
-
$class,
|
804 |
-
$counter
|
805 |
-
);
|
806 |
-
}
|
807 |
-
}
|
808 |
-
}
|
809 |
-
|
810 |
-
#endregion Top level menu Override
|
811 |
-
|
812 |
-
/**
|
813 |
-
* Add a top-level menu page.
|
814 |
-
*
|
815 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
816 |
-
*
|
817 |
-
* This is a replication of `add_menu_page()` to avoid Theme Check warning.
|
818 |
-
*
|
819 |
-
* Why?
|
820 |
-
* ====
|
821 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
822 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
823 |
-
* we only develop and maintain one code base.
|
824 |
-
*
|
825 |
-
* This method will not run for wp.org themes (only plugins) since theme
|
826 |
-
* admin settings/options are now only allowed in the customizer.
|
827 |
-
*
|
828 |
-
* If you have any questions or need clarifications, please don't hesitate
|
829 |
-
* pinging me on slack, my username is @svovaf.
|
830 |
-
*
|
831 |
-
* @author Vova Feldman (@svovaf)
|
832 |
-
* @since 1.2.2
|
833 |
-
*
|
834 |
-
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
835 |
-
* selected.
|
836 |
-
* @param string $menu_title The text to be used for the menu.
|
837 |
-
* @param string $capability The capability required for this menu to be displayed to the user.
|
838 |
-
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
839 |
-
* @param callable|string $function The function to be called to output the content for this page.
|
840 |
-
* @param string $icon_url The URL to the icon to be used for this menu.
|
841 |
-
* * Pass a base64-encoded SVG using a data URI, which will be colored to
|
842 |
-
* match the color scheme. This should begin with
|
843 |
-
* 'data:image/svg+xml;base64,'.
|
844 |
-
* * Pass the name of a Dashicons helper class to use a font icon,
|
845 |
-
* e.g. 'dashicons-chart-pie'.
|
846 |
-
* * Pass 'none' to leave div.wp-menu-image empty so an icon can be added
|
847 |
-
* via CSS.
|
848 |
-
* @param int $position The position in the menu order this one should appear.
|
849 |
-
*
|
850 |
-
* @return string The resulting page's hook_suffix.
|
851 |
-
*/
|
852 |
-
static function add_page(
|
853 |
-
$page_title,
|
854 |
-
$menu_title,
|
855 |
-
$capability,
|
856 |
-
$menu_slug,
|
857 |
-
$function = '',
|
858 |
-
$icon_url = '',
|
859 |
-
$position = null
|
860 |
-
) {
|
861 |
-
$fn = 'add_menu' . '_page';
|
862 |
-
|
863 |
-
return $fn(
|
864 |
-
$page_title,
|
865 |
-
$menu_title,
|
866 |
-
$capability,
|
867 |
-
$menu_slug,
|
868 |
-
$function,
|
869 |
-
$icon_url,
|
870 |
-
$position
|
871 |
-
);
|
872 |
-
}
|
873 |
-
|
874 |
-
/**
|
875 |
-
* Add page and update menu instance settings.
|
876 |
-
*
|
877 |
-
* @author Vova Feldman (@svovaf)
|
878 |
-
* @since 2.0.0
|
879 |
-
*
|
880 |
-
* @param string $page_title
|
881 |
-
* @param string $menu_title
|
882 |
-
* @param string $capability
|
883 |
-
* @param string $menu_slug
|
884 |
-
* @param callable|string $function
|
885 |
-
* @param string $icon_url
|
886 |
-
* @param int|null $position
|
887 |
-
*
|
888 |
-
* @return string
|
889 |
-
*/
|
890 |
-
function add_page_and_update(
|
891 |
-
$page_title,
|
892 |
-
$menu_title,
|
893 |
-
$capability,
|
894 |
-
$menu_slug,
|
895 |
-
$function = '',
|
896 |
-
$icon_url = '',
|
897 |
-
$position = null
|
898 |
-
) {
|
899 |
-
$this->_menu_slug = $menu_slug;
|
900 |
-
$this->_is_top_level = true;
|
901 |
-
$this->_menu_exists = true;
|
902 |
-
$this->_network_menu_exists = true;
|
903 |
-
|
904 |
-
return self::add_page(
|
905 |
-
$page_title,
|
906 |
-
$menu_title,
|
907 |
-
$capability,
|
908 |
-
$menu_slug,
|
909 |
-
$function,
|
910 |
-
$icon_url,
|
911 |
-
$position
|
912 |
-
);
|
913 |
-
}
|
914 |
-
|
915 |
-
/**
|
916 |
-
* Add a submenu page.
|
917 |
-
*
|
918 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
919 |
-
*
|
920 |
-
* This is a replication of `add_submenu_page()` to avoid Theme Check warning.
|
921 |
-
*
|
922 |
-
* Why?
|
923 |
-
* ====
|
924 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
925 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
926 |
-
* we only develop and maintain one code base.
|
927 |
-
*
|
928 |
-
* This method will not run for wp.org themes (only plugins) since theme
|
929 |
-
* admin settings/options are now only allowed in the customizer.
|
930 |
-
*
|
931 |
-
* If you have any questions or need clarifications, please don't hesitate
|
932 |
-
* pinging me on slack, my username is @svovaf.
|
933 |
-
*
|
934 |
-
* @author Vova Feldman (@svovaf)
|
935 |
-
* @since 1.2.2
|
936 |
-
*
|
937 |
-
* @param string $parent_slug The slug name for the parent menu (or the file name of a standard
|
938 |
-
* WordPress admin page).
|
939 |
-
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
940 |
-
* selected.
|
941 |
-
* @param string $menu_title The text to be used for the menu.
|
942 |
-
* @param string $capability The capability required for this menu to be displayed to the user.
|
943 |
-
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
944 |
-
* @param callable|string $function The function to be called to output the content for this page.
|
945 |
-
*
|
946 |
-
* @return false|string The resulting page's hook_suffix, or false if the user does not have the capability
|
947 |
-
* required.
|
948 |
-
*/
|
949 |
-
static function add_subpage(
|
950 |
-
$parent_slug,
|
951 |
-
$page_title,
|
952 |
-
$menu_title,
|
953 |
-
$capability,
|
954 |
-
$menu_slug,
|
955 |
-
$function = ''
|
956 |
-
) {
|
957 |
-
$fn = 'add_submenu' . '_page';
|
958 |
-
|
959 |
-
return $fn( $parent_slug,
|
960 |
-
$page_title,
|
961 |
-
$menu_title,
|
962 |
-
$capability,
|
963 |
-
$menu_slug,
|
964 |
-
$function
|
965 |
-
);
|
966 |
-
}
|
967 |
-
|
968 |
-
/**
|
969 |
-
* Add sub page and update menu instance settings.
|
970 |
-
*
|
971 |
-
* @author Vova Feldman (@svovaf)
|
972 |
-
* @since 2.0.0
|
973 |
-
*
|
974 |
-
* @param string $parent_slug
|
975 |
-
* @param string $page_title
|
976 |
-
* @param string $menu_title
|
977 |
-
* @param string $capability
|
978 |
-
* @param string $menu_slug
|
979 |
-
* @param callable|string $function
|
980 |
-
*
|
981 |
-
* @return string
|
982 |
-
*/
|
983 |
-
function add_subpage_and_update(
|
984 |
-
$parent_slug,
|
985 |
-
$page_title,
|
986 |
-
$menu_title,
|
987 |
-
$capability,
|
988 |
-
$menu_slug,
|
989 |
-
$function = ''
|
990 |
-
) {
|
991 |
-
$this->_menu_slug = $menu_slug;
|
992 |
-
$this->_parent_slug = $parent_slug;
|
993 |
-
$this->_is_top_level = false;
|
994 |
-
$this->_menu_exists = true;
|
995 |
-
$this->_network_menu_exists = true;
|
996 |
-
|
997 |
-
return self::add_subpage(
|
998 |
-
$parent_slug,
|
999 |
-
$page_title,
|
1000 |
-
$menu_title,
|
1001 |
-
$capability,
|
1002 |
-
$menu_slug,
|
1003 |
-
$function
|
1004 |
-
);
|
1005 |
-
}
|
1006 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Admin_Menu_Manager {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @since 1.2.2
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $_module_unique_affix;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @since 1.2.2
|
26 |
+
*
|
27 |
+
* @var number
|
28 |
+
*/
|
29 |
+
protected $_module_id;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @since 1.2.2
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $_module_type;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @since 1.0.6
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $_menu_slug;
|
44 |
+
/**
|
45 |
+
* @since 1.1.3
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $_parent_slug;
|
50 |
+
/**
|
51 |
+
* @since 1.1.3
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
private $_parent_type;
|
56 |
+
/**
|
57 |
+
* @since 1.1.3
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
private $_type;
|
62 |
+
/**
|
63 |
+
* @since 1.1.3
|
64 |
+
*
|
65 |
+
* @var bool
|
66 |
+
*/
|
67 |
+
private $_is_top_level;
|
68 |
+
/**
|
69 |
+
* @since 1.1.3
|
70 |
+
*
|
71 |
+
* @var bool
|
72 |
+
*/
|
73 |
+
private $_is_override_exact;
|
74 |
+
/**
|
75 |
+
* @since 1.1.3
|
76 |
+
*
|
77 |
+
* @var array<string,bool>
|
78 |
+
*/
|
79 |
+
private $_default_submenu_items;
|
80 |
+
/**
|
81 |
+
* @since 1.1.3
|
82 |
+
*
|
83 |
+
* @var string
|
84 |
+
*/
|
85 |
+
private $_first_time_path;
|
86 |
+
/**
|
87 |
+
* @since 1.2.2
|
88 |
+
*
|
89 |
+
* @var bool
|
90 |
+
*/
|
91 |
+
private $_menu_exists;
|
92 |
+
/**
|
93 |
+
* @since 2.0.0
|
94 |
+
*
|
95 |
+
* @var bool
|
96 |
+
*/
|
97 |
+
private $_network_menu_exists;
|
98 |
+
|
99 |
+
#endregion Properties
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @var FS_Logger
|
103 |
+
*/
|
104 |
+
protected $_logger;
|
105 |
+
|
106 |
+
#region Singleton
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @var FS_Admin_Menu_Manager[]
|
110 |
+
*/
|
111 |
+
private static $_instances = array();
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @param number $module_id
|
115 |
+
* @param string $module_type
|
116 |
+
* @param string $module_unique_affix
|
117 |
+
*
|
118 |
+
* @return FS_Admin_Menu_Manager
|
119 |
+
*/
|
120 |
+
static function instance( $module_id, $module_type, $module_unique_affix ) {
|
121 |
+
$key = 'm_' . $module_id;
|
122 |
+
|
123 |
+
if ( ! isset( self::$_instances[ $key ] ) ) {
|
124 |
+
self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
|
125 |
+
}
|
126 |
+
|
127 |
+
return self::$_instances[ $key ];
|
128 |
+
}
|
129 |
+
|
130 |
+
protected function __construct( $module_id, $module_type, $module_unique_affix ) {
|
131 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
132 |
+
|
133 |
+
$this->_module_id = $module_id;
|
134 |
+
$this->_module_type = $module_type;
|
135 |
+
$this->_module_unique_affix = $module_unique_affix;
|
136 |
+
}
|
137 |
+
|
138 |
+
#endregion Singleton
|
139 |
+
|
140 |
+
#region Helpers
|
141 |
+
|
142 |
+
private function get_option( &$options, $key, $default = false ) {
|
143 |
+
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
|
144 |
+
}
|
145 |
+
|
146 |
+
private function get_bool_option( &$options, $key, $default = false ) {
|
147 |
+
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
|
148 |
+
}
|
149 |
+
|
150 |
+
#endregion Helpers
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @param array $menu
|
154 |
+
* @param bool $is_addon
|
155 |
+
*/
|
156 |
+
function init( $menu, $is_addon = false ) {
|
157 |
+
$this->_menu_exists = ( isset( $menu['slug'] ) && ! empty( $menu['slug'] ) );
|
158 |
+
$this->_network_menu_exists = ( ! empty( $menu['network'] ) && true === $menu['network'] );
|
159 |
+
|
160 |
+
$this->_menu_slug = ( $this->_menu_exists ? $menu['slug'] : $this->_module_unique_affix );
|
161 |
+
|
162 |
+
$this->_default_submenu_items = array();
|
163 |
+
// @deprecated
|
164 |
+
$this->_type = 'page';
|
165 |
+
$this->_is_top_level = true;
|
166 |
+
$this->_is_override_exact = false;
|
167 |
+
$this->_parent_slug = false;
|
168 |
+
// @deprecated
|
169 |
+
$this->_parent_type = 'page';
|
170 |
+
|
171 |
+
if ( isset( $menu ) ) {
|
172 |
+
if ( ! $is_addon ) {
|
173 |
+
$this->_default_submenu_items = array(
|
174 |
+
'contact' => $this->get_bool_option( $menu, 'contact', true ),
|
175 |
+
'support' => $this->get_bool_option( $menu, 'support', true ),
|
176 |
+
'affiliation' => $this->get_bool_option( $menu, 'affiliation', true ),
|
177 |
+
'account' => $this->get_bool_option( $menu, 'account', true ),
|
178 |
+
'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
|
179 |
+
'addons' => $this->get_bool_option( $menu, 'addons', true ),
|
180 |
+
);
|
181 |
+
|
182 |
+
// @deprecated
|
183 |
+
$this->_type = $this->get_option( $menu, 'type', 'page' );
|
184 |
+
}
|
185 |
+
|
186 |
+
$this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
|
187 |
+
|
188 |
+
if ( isset( $menu['parent'] ) ) {
|
189 |
+
$this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
|
190 |
+
// @deprecated
|
191 |
+
$this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
|
192 |
+
|
193 |
+
// If parent's slug is different, then it's NOT a top level menu item.
|
194 |
+
$this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
|
195 |
+
} else {
|
196 |
+
/**
|
197 |
+
* If no parent then top level if:
|
198 |
+
* - Has custom admin menu ('page')
|
199 |
+
* - CPT menu type ('cpt')
|
200 |
+
*/
|
201 |
+
// $this->_is_top_level = in_array( $this->_type, array(
|
202 |
+
// 'cpt',
|
203 |
+
// 'page'
|
204 |
+
// ) );
|
205 |
+
}
|
206 |
+
|
207 |
+
$first_path = $this->get_option( $menu, 'first-path', false );
|
208 |
+
|
209 |
+
if ( ! empty( $first_path ) && is_string( $first_path ) ) {
|
210 |
+
$this->_first_time_path = $first_path;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Check if top level menu.
|
217 |
+
*
|
218 |
+
* @author Vova Feldman (@svovaf)
|
219 |
+
* @since 1.1.3
|
220 |
+
*
|
221 |
+
* @return bool False if submenu item.
|
222 |
+
*/
|
223 |
+
function is_top_level() {
|
224 |
+
return $this->_is_top_level;
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Check if the page should be override on exact URL match.
|
229 |
+
*
|
230 |
+
* @author Vova Feldman (@svovaf)
|
231 |
+
* @since 1.1.3
|
232 |
+
*
|
233 |
+
* @return bool False if submenu item.
|
234 |
+
*/
|
235 |
+
function is_override_exact() {
|
236 |
+
return $this->_is_override_exact;
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Get the path of the page the user should be forwarded to after first activation.
|
242 |
+
*
|
243 |
+
* @author Vova Feldman (@svovaf)
|
244 |
+
* @since 1.1.3
|
245 |
+
*
|
246 |
+
* @param bool $is_network Since 2.4.5
|
247 |
+
*
|
248 |
+
* @return string
|
249 |
+
*/
|
250 |
+
function get_first_time_path( $is_network = false ) {
|
251 |
+
if ( empty ( $this->_first_time_path ) ) {
|
252 |
+
return $this->_first_time_path;
|
253 |
+
}
|
254 |
+
|
255 |
+
if ( $is_network ) {
|
256 |
+
return network_admin_url( $this->_first_time_path );
|
257 |
+
} else {
|
258 |
+
return admin_url( $this->_first_time_path );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Check if plugin's menu item is part of a custom top level menu.
|
264 |
+
*
|
265 |
+
* @author Vova Feldman (@svovaf)
|
266 |
+
* @since 1.1.3
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
function has_custom_parent() {
|
271 |
+
return ! $this->_is_top_level && is_string( $this->_parent_slug );
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* @author Leo Fajardo (@leorw)
|
276 |
+
* @since 1.2.2
|
277 |
+
*
|
278 |
+
* @return bool
|
279 |
+
*/
|
280 |
+
function has_menu() {
|
281 |
+
return $this->_menu_exists;
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* @author Vova Feldman (@svovaf)
|
286 |
+
* @since 2.0.0
|
287 |
+
*
|
288 |
+
* @return bool
|
289 |
+
*/
|
290 |
+
function has_network_menu() {
|
291 |
+
return $this->_network_menu_exists;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* @author Leo Fajardo (@leorw)
|
296 |
+
*
|
297 |
+
* @param string $menu_slug
|
298 |
+
*
|
299 |
+
* @since 2.1.3
|
300 |
+
*/
|
301 |
+
function set_slug_and_network_menu_exists_flag($menu_slug ) {
|
302 |
+
$this->_menu_slug = $menu_slug;
|
303 |
+
$this->_network_menu_exists = false;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* @author Vova Feldman (@svovaf)
|
308 |
+
* @since 1.1.3
|
309 |
+
*
|
310 |
+
* @param string $id
|
311 |
+
* @param bool $default
|
312 |
+
* @param bool $ignore_menu_existence Since 1.2.2.7 If true, check if the submenu item visible even if there's no parent menu.
|
313 |
+
*
|
314 |
+
* @return bool
|
315 |
+
*/
|
316 |
+
function is_submenu_item_visible( $id, $default = true, $ignore_menu_existence = false ) {
|
317 |
+
if ( ! $ignore_menu_existence && ! $this->has_menu() ) {
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
|
321 |
+
return fs_apply_filter(
|
322 |
+
$this->_module_unique_affix,
|
323 |
+
'is_submenu_visible',
|
324 |
+
$this->get_bool_option( $this->_default_submenu_items, $id, $default ),
|
325 |
+
$id
|
326 |
+
);
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Calculates admin settings menu slug.
|
331 |
+
* If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
|
332 |
+
*
|
333 |
+
* @author Vova Feldman (@svovaf)
|
334 |
+
* @since 1.1.3
|
335 |
+
*
|
336 |
+
* @param string $page
|
337 |
+
*
|
338 |
+
* @return string
|
339 |
+
*/
|
340 |
+
function get_slug( $page = '' ) {
|
341 |
+
return ( ( false === strpos( $this->_menu_slug, '.php?' ) ) ?
|
342 |
+
$this->_menu_slug :
|
343 |
+
$this->_module_unique_affix ) . ( empty( $page ) ? '' : ( '-' . $page ) );
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* @author Vova Feldman (@svovaf)
|
348 |
+
* @since 1.1.3
|
349 |
+
*
|
350 |
+
* @return string
|
351 |
+
*/
|
352 |
+
function get_parent_slug() {
|
353 |
+
return $this->_parent_slug;
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* @author Vova Feldman (@svovaf)
|
358 |
+
* @since 1.1.3
|
359 |
+
*
|
360 |
+
* @return string
|
361 |
+
*/
|
362 |
+
function get_type() {
|
363 |
+
return $this->_type;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* @author Vova Feldman (@svovaf)
|
368 |
+
* @since 1.1.3
|
369 |
+
*
|
370 |
+
* @return bool
|
371 |
+
*/
|
372 |
+
function is_cpt() {
|
373 |
+
return ( 0 === strpos( $this->_menu_slug, 'edit.php?post_type=' ) ||
|
374 |
+
// Back compatibility.
|
375 |
+
'cpt' === $this->_type
|
376 |
+
);
|
377 |
+
}
|
378 |
+
|
379 |
+
/**
|
380 |
+
* @author Vova Feldman (@svovaf)
|
381 |
+
* @since 1.1.3
|
382 |
+
*
|
383 |
+
* @return string
|
384 |
+
*/
|
385 |
+
function get_parent_type() {
|
386 |
+
return $this->_parent_type;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* @author Vova Feldman (@svovaf)
|
391 |
+
* @since 1.1.3
|
392 |
+
*
|
393 |
+
* @return string
|
394 |
+
*/
|
395 |
+
function get_raw_slug() {
|
396 |
+
return $this->_menu_slug;
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Get plugin's original menu slug.
|
401 |
+
*
|
402 |
+
* @author Vova Feldman (@svovaf)
|
403 |
+
* @since 1.1.3
|
404 |
+
*
|
405 |
+
* @return string
|
406 |
+
*/
|
407 |
+
function get_original_menu_slug() {
|
408 |
+
if ( 'cpt' === $this->_type ) {
|
409 |
+
return add_query_arg( array(
|
410 |
+
'post_type' => $this->_menu_slug
|
411 |
+
), 'edit.php' );
|
412 |
+
}
|
413 |
+
|
414 |
+
if ( false === strpos( $this->_menu_slug, '.php?' ) ) {
|
415 |
+
return $this->_menu_slug;
|
416 |
+
} else {
|
417 |
+
return $this->_module_unique_affix;
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
/**
|
422 |
+
* @author Vova Feldman (@svovaf)
|
423 |
+
* @since 1.1.3
|
424 |
+
*
|
425 |
+
* @return string
|
426 |
+
*/
|
427 |
+
function get_top_level_menu_slug() {
|
428 |
+
return $this->has_custom_parent() ?
|
429 |
+
$this->get_parent_slug() :
|
430 |
+
$this->get_raw_slug();
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Is user on plugin's admin activation page.
|
435 |
+
*
|
436 |
+
* @author Vova Feldman (@svovaf)
|
437 |
+
* @since 1.0.8
|
438 |
+
*
|
439 |
+
* @param bool $show_opt_in_on_themes_page Since 2.3.1
|
440 |
+
*
|
441 |
+
* @return bool
|
442 |
+
*
|
443 |
+
* @deprecated Please use is_activation_page() instead.
|
444 |
+
*/
|
445 |
+
function is_main_settings_page( $show_opt_in_on_themes_page = false ) {
|
446 |
+
return $this->is_activation_page( $show_opt_in_on_themes_page );
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Is user on product's admin activation page.
|
451 |
+
*
|
452 |
+
* @author Vova Feldman (@svovaf)
|
453 |
+
* @since 2.3.1
|
454 |
+
*
|
455 |
+
* @param bool $show_opt_in_on_themes_page Since 2.3.1
|
456 |
+
*
|
457 |
+
* @return bool
|
458 |
+
*/
|
459 |
+
function is_activation_page( $show_opt_in_on_themes_page = false ) {
|
460 |
+
if ( $show_opt_in_on_themes_page ) {
|
461 |
+
/**
|
462 |
+
* In activation only when show_optin query string param is given.
|
463 |
+
*
|
464 |
+
* @since 1.2.2
|
465 |
+
*/
|
466 |
+
return (
|
467 |
+
( WP_FS__MODULE_TYPE_THEME === $this->_module_type ) &&
|
468 |
+
Freemius::is_themes_page() &&
|
469 |
+
fs_request_get_bool( $this->_module_unique_affix . '_show_optin' )
|
470 |
+
);
|
471 |
+
}
|
472 |
+
|
473 |
+
if ( $this->_menu_exists &&
|
474 |
+
( fs_is_plugin_page( $this->_menu_slug ) || fs_is_plugin_page( $this->_module_unique_affix ) )
|
475 |
+
) {
|
476 |
+
/**
|
477 |
+
* Module has a settings menu and the context page is the main settings page, so assume it's in
|
478 |
+
* activation (doesn't really check if already opted-in/skipped or not).
|
479 |
+
*
|
480 |
+
* @since 1.2.2
|
481 |
+
*/
|
482 |
+
return true;
|
483 |
+
}
|
484 |
+
|
485 |
+
return false;
|
486 |
+
}
|
487 |
+
|
488 |
+
#region Submenu Override
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Override submenu's action.
|
492 |
+
*
|
493 |
+
* @author Vova Feldman (@svovaf)
|
494 |
+
* @since 1.1.0
|
495 |
+
*
|
496 |
+
* @param string $parent_slug
|
497 |
+
* @param string $menu_slug
|
498 |
+
* @param callable $function
|
499 |
+
*
|
500 |
+
* @return false|string If submenu exist, will return the hook name.
|
501 |
+
*/
|
502 |
+
function override_submenu_action( $parent_slug, $menu_slug, $function ) {
|
503 |
+
global $submenu;
|
504 |
+
|
505 |
+
$menu_slug = plugin_basename( $menu_slug );
|
506 |
+
$parent_slug = plugin_basename( $parent_slug );
|
507 |
+
|
508 |
+
if ( ! isset( $submenu[ $parent_slug ] ) ) {
|
509 |
+
// Parent menu not exist.
|
510 |
+
return false;
|
511 |
+
}
|
512 |
+
|
513 |
+
$found_submenu_item = false;
|
514 |
+
foreach ( $submenu[ $parent_slug ] as $submenu_item ) {
|
515 |
+
if ( $menu_slug === $submenu_item[2] ) {
|
516 |
+
$found_submenu_item = $submenu_item;
|
517 |
+
break;
|
518 |
+
}
|
519 |
+
}
|
520 |
+
|
521 |
+
if ( false === $found_submenu_item ) {
|
522 |
+
// Submenu item not found.
|
523 |
+
return false;
|
524 |
+
}
|
525 |
+
|
526 |
+
// Remove current function.
|
527 |
+
$hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
|
528 |
+
remove_all_actions( $hookname );
|
529 |
+
|
530 |
+
// Attach new action.
|
531 |
+
add_action( $hookname, $function );
|
532 |
+
|
533 |
+
return $hookname;
|
534 |
+
}
|
535 |
+
|
536 |
+
#endregion Submenu Override
|
537 |
+
|
538 |
+
#region Top level menu Override
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Find plugin's admin dashboard main menu item.
|
542 |
+
*
|
543 |
+
* @author Vova Feldman (@svovaf)
|
544 |
+
* @since 1.0.2
|
545 |
+
*
|
546 |
+
* @return string[]|false
|
547 |
+
*/
|
548 |
+
private function find_top_level_menu() {
|
549 |
+
global $menu;
|
550 |
+
|
551 |
+
$position = - 1;
|
552 |
+
$found_menu = false;
|
553 |
+
|
554 |
+
$menu_slug = $this->get_raw_slug();
|
555 |
+
|
556 |
+
$hook_name = get_plugin_page_hookname( $menu_slug, '' );
|
557 |
+
foreach ( $menu as $pos => $m ) {
|
558 |
+
if ( $menu_slug === $m[2] ) {
|
559 |
+
$position = $pos;
|
560 |
+
$found_menu = $m;
|
561 |
+
break;
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
if ( false === $found_menu ) {
|
566 |
+
return false;
|
567 |
+
}
|
568 |
+
|
569 |
+
return array(
|
570 |
+
'menu' => $found_menu,
|
571 |
+
'position' => $position,
|
572 |
+
'hook_name' => $hook_name
|
573 |
+
);
|
574 |
+
}
|
575 |
+
|
576 |
+
/**
|
577 |
+
* Find plugin's admin dashboard main submenu item.
|
578 |
+
*
|
579 |
+
* @author Vova Feldman (@svovaf)
|
580 |
+
* @since 1.2.1.6
|
581 |
+
*
|
582 |
+
* @return array|false
|
583 |
+
*/
|
584 |
+
private function find_main_submenu() {
|
585 |
+
global $submenu;
|
586 |
+
|
587 |
+
$top_level_menu_slug = $this->get_top_level_menu_slug();
|
588 |
+
|
589 |
+
if ( ! isset( $submenu[ $top_level_menu_slug ] ) ) {
|
590 |
+
return false;
|
591 |
+
}
|
592 |
+
|
593 |
+
$submenu_slug = $this->get_raw_slug();
|
594 |
+
|
595 |
+
$position = - 1;
|
596 |
+
$found_submenu = false;
|
597 |
+
|
598 |
+
$hook_name = get_plugin_page_hookname( $submenu_slug, '' );
|
599 |
+
|
600 |
+
foreach ( $submenu[ $top_level_menu_slug ] as $pos => $sub ) {
|
601 |
+
if ( $submenu_slug === $sub[2] ) {
|
602 |
+
$position = $pos;
|
603 |
+
$found_submenu = $sub;
|
604 |
+
}
|
605 |
+
}
|
606 |
+
|
607 |
+
if ( false === $found_submenu ) {
|
608 |
+
return false;
|
609 |
+
}
|
610 |
+
|
611 |
+
return array(
|
612 |
+
'menu' => $found_submenu,
|
613 |
+
'parent_slug' => $top_level_menu_slug,
|
614 |
+
'position' => $position,
|
615 |
+
'hook_name' => $hook_name
|
616 |
+
);
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* Remove all sub-menu items.
|
621 |
+
*
|
622 |
+
* @author Vova Feldman (@svovaf)
|
623 |
+
* @since 1.0.7
|
624 |
+
*
|
625 |
+
* @return bool If submenu with plugin's menu slug was found.
|
626 |
+
*/
|
627 |
+
private function remove_all_submenu_items() {
|
628 |
+
global $submenu;
|
629 |
+
|
630 |
+
$menu_slug = $this->get_raw_slug();
|
631 |
+
|
632 |
+
if ( ! isset( $submenu[ $menu_slug ] ) ) {
|
633 |
+
return false;
|
634 |
+
}
|
635 |
+
|
636 |
+
/**
|
637 |
+
* This method is NOT executed for WordPress.org themes.
|
638 |
+
* Since we maintain only one version of the SDK we added this small
|
639 |
+
* hack to avoid the error from Theme Check since it's a false-positive.
|
640 |
+
*
|
641 |
+
* @author Vova Feldman (@svovaf)
|
642 |
+
* @since 1.2.2.7
|
643 |
+
*/
|
644 |
+
$submenu_ref = &$submenu;
|
645 |
+
$submenu_ref[ $menu_slug ] = array();
|
646 |
+
|
647 |
+
return true;
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
*
|
652 |
+
* @author Vova Feldman (@svovaf)
|
653 |
+
* @since 1.0.9
|
654 |
+
*
|
655 |
+
* @param bool $remove_top_level_menu
|
656 |
+
*
|
657 |
+
* @return false|array[string]mixed
|
658 |
+
*/
|
659 |
+
function remove_menu_item( $remove_top_level_menu = false ) {
|
660 |
+
$this->_logger->entrance();
|
661 |
+
|
662 |
+
// Find main menu item.
|
663 |
+
$top_level_menu = $this->find_top_level_menu();
|
664 |
+
|
665 |
+
if ( false === $top_level_menu ) {
|
666 |
+
return false;
|
667 |
+
}
|
668 |
+
|
669 |
+
// Remove it with its actions.
|
670 |
+
remove_all_actions( $top_level_menu['hook_name'] );
|
671 |
+
|
672 |
+
// Remove all submenu items.
|
673 |
+
$this->remove_all_submenu_items();
|
674 |
+
|
675 |
+
if ( $remove_top_level_menu ) {
|
676 |
+
global $menu;
|
677 |
+
unset( $menu[ $top_level_menu['position'] ] );
|
678 |
+
}
|
679 |
+
|
680 |
+
return $top_level_menu;
|
681 |
+
}
|
682 |
+
|
683 |
+
/**
|
684 |
+
* Get module's main admin setting page URL.
|
685 |
+
*
|
686 |
+
* @todo This method was only tested for wp.org compliant themes with a submenu item. Need to test for plugins with top level, submenu, and CPT top level, menu items.
|
687 |
+
*
|
688 |
+
* @author Vova Feldman (@svovaf)
|
689 |
+
* @since 1.2.2.7
|
690 |
+
*
|
691 |
+
* @return string
|
692 |
+
*/
|
693 |
+
function main_menu_url() {
|
694 |
+
$this->_logger->entrance();
|
695 |
+
|
696 |
+
if ( $this->_is_top_level ) {
|
697 |
+
$menu = $this->find_top_level_menu();
|
698 |
+
} else {
|
699 |
+
$menu = $this->find_main_submenu();
|
700 |
+
}
|
701 |
+
|
702 |
+
$parent_slug = isset( $menu['parent_slug'] ) ?
|
703 |
+
$menu['parent_slug'] :
|
704 |
+
'admin.php';
|
705 |
+
|
706 |
+
return admin_url(
|
707 |
+
$parent_slug .
|
708 |
+
( false === strpos( $parent_slug, '?' ) ? '?' : '&' ) .
|
709 |
+
'page=' .
|
710 |
+
$menu['menu'][2]
|
711 |
+
);
|
712 |
+
}
|
713 |
+
|
714 |
+
/**
|
715 |
+
* @author Vova Feldman (@svovaf)
|
716 |
+
* @since 1.1.4
|
717 |
+
*
|
718 |
+
* @param callable $function
|
719 |
+
*
|
720 |
+
* @return false|array[string]mixed
|
721 |
+
*/
|
722 |
+
function override_menu_item( $function ) {
|
723 |
+
$found_menu = $this->remove_menu_item();
|
724 |
+
|
725 |
+
if ( false === $found_menu ) {
|
726 |
+
return false;
|
727 |
+
}
|
728 |
+
|
729 |
+
if ( ! $this->is_top_level() || ! $this->is_cpt() ) {
|
730 |
+
$menu_slug = plugin_basename( $this->get_slug() );
|
731 |
+
|
732 |
+
$hookname = get_plugin_page_hookname( $menu_slug, '' );
|
733 |
+
|
734 |
+
// Override menu action.
|
735 |
+
add_action( $hookname, $function );
|
736 |
+
} else {
|
737 |
+
global $menu;
|
738 |
+
|
739 |
+
// Remove original CPT menu.
|
740 |
+
unset( $menu[ $found_menu['position'] ] );
|
741 |
+
|
742 |
+
// Create new top-level menu action.
|
743 |
+
$hookname = self::add_page(
|
744 |
+
$found_menu['menu'][3],
|
745 |
+
$found_menu['menu'][0],
|
746 |
+
'manage_options',
|
747 |
+
$this->get_slug(),
|
748 |
+
$function,
|
749 |
+
$found_menu['menu'][6],
|
750 |
+
$found_menu['position']
|
751 |
+
);
|
752 |
+
}
|
753 |
+
|
754 |
+
return $hookname;
|
755 |
+
}
|
756 |
+
|
757 |
+
/**
|
758 |
+
* Adds a counter to the module's top level menu item.
|
759 |
+
*
|
760 |
+
* @author Vova Feldman (@svovaf)
|
761 |
+
* @since 1.2.1.5
|
762 |
+
*
|
763 |
+
* @param int $counter
|
764 |
+
* @param string $class
|
765 |
+
*/
|
766 |
+
function add_counter_to_menu_item( $counter = 1, $class = '' ) {
|
767 |
+
global $menu, $submenu;
|
768 |
+
|
769 |
+
$mask = '%s <span class="update-plugins %s count-%3$s" aria-hidden="true"><span>%3$s<span class="screen-reader-text">%3$s notifications</span></span></span>';
|
770 |
+
|
771 |
+
/**
|
772 |
+
* This method is NOT executed for WordPress.org themes.
|
773 |
+
* Since we maintain only one version of the SDK we added this small
|
774 |
+
* hack to avoid the error from Theme Check since it's a false-positive.
|
775 |
+
*
|
776 |
+
* @author Vova Feldman (@svovaf)
|
777 |
+
* @since 1.2.2.7
|
778 |
+
*/
|
779 |
+
$menu_ref = &$menu;
|
780 |
+
$submenu_ref = &$submenu;
|
781 |
+
|
782 |
+
if ( $this->_is_top_level ) {
|
783 |
+
// Find main menu item.
|
784 |
+
$found_menu = $this->find_top_level_menu();
|
785 |
+
|
786 |
+
if ( false !== $found_menu ) {
|
787 |
+
// Override menu label.
|
788 |
+
$menu_ref[ $found_menu['position'] ][0] = sprintf(
|
789 |
+
$mask,
|
790 |
+
$found_menu['menu'][0],
|
791 |
+
$class,
|
792 |
+
$counter
|
793 |
+
);
|
794 |
+
}
|
795 |
+
} else {
|
796 |
+
$found_submenu = $this->find_main_submenu();
|
797 |
+
|
798 |
+
if ( false !== $found_submenu ) {
|
799 |
+
// Override menu label.
|
800 |
+
$submenu_ref[ $found_submenu['parent_slug'] ][ $found_submenu['position'] ][0] = sprintf(
|
801 |
+
$mask,
|
802 |
+
$found_submenu['menu'][0],
|
803 |
+
$class,
|
804 |
+
$counter
|
805 |
+
);
|
806 |
+
}
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
#endregion Top level menu Override
|
811 |
+
|
812 |
+
/**
|
813 |
+
* Add a top-level menu page.
|
814 |
+
*
|
815 |
+
* Note for WordPress.org Theme/Plugin reviewer:
|
816 |
+
*
|
817 |
+
* This is a replication of `add_menu_page()` to avoid Theme Check warning.
|
818 |
+
*
|
819 |
+
* Why?
|
820 |
+
* ====
|
821 |
+
* Freemius is an SDK for plugin and theme developers. Since the core
|
822 |
+
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
823 |
+
* we only develop and maintain one code base.
|
824 |
+
*
|
825 |
+
* This method will not run for wp.org themes (only plugins) since theme
|
826 |
+
* admin settings/options are now only allowed in the customizer.
|
827 |
+
*
|
828 |
+
* If you have any questions or need clarifications, please don't hesitate
|
829 |
+
* pinging me on slack, my username is @svovaf.
|
830 |
+
*
|
831 |
+
* @author Vova Feldman (@svovaf)
|
832 |
+
* @since 1.2.2
|
833 |
+
*
|
834 |
+
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
835 |
+
* selected.
|
836 |
+
* @param string $menu_title The text to be used for the menu.
|
837 |
+
* @param string $capability The capability required for this menu to be displayed to the user.
|
838 |
+
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
839 |
+
* @param callable|string $function The function to be called to output the content for this page.
|
840 |
+
* @param string $icon_url The URL to the icon to be used for this menu.
|
841 |
+
* * Pass a base64-encoded SVG using a data URI, which will be colored to
|
842 |
+
* match the color scheme. This should begin with
|
843 |
+
* 'data:image/svg+xml;base64,'.
|
844 |
+
* * Pass the name of a Dashicons helper class to use a font icon,
|
845 |
+
* e.g. 'dashicons-chart-pie'.
|
846 |
+
* * Pass 'none' to leave div.wp-menu-image empty so an icon can be added
|
847 |
+
* via CSS.
|
848 |
+
* @param int $position The position in the menu order this one should appear.
|
849 |
+
*
|
850 |
+
* @return string The resulting page's hook_suffix.
|
851 |
+
*/
|
852 |
+
static function add_page(
|
853 |
+
$page_title,
|
854 |
+
$menu_title,
|
855 |
+
$capability,
|
856 |
+
$menu_slug,
|
857 |
+
$function = '',
|
858 |
+
$icon_url = '',
|
859 |
+
$position = null
|
860 |
+
) {
|
861 |
+
$fn = 'add_menu' . '_page';
|
862 |
+
|
863 |
+
return $fn(
|
864 |
+
$page_title,
|
865 |
+
$menu_title,
|
866 |
+
$capability,
|
867 |
+
$menu_slug,
|
868 |
+
$function,
|
869 |
+
$icon_url,
|
870 |
+
$position
|
871 |
+
);
|
872 |
+
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Add page and update menu instance settings.
|
876 |
+
*
|
877 |
+
* @author Vova Feldman (@svovaf)
|
878 |
+
* @since 2.0.0
|
879 |
+
*
|
880 |
+
* @param string $page_title
|
881 |
+
* @param string $menu_title
|
882 |
+
* @param string $capability
|
883 |
+
* @param string $menu_slug
|
884 |
+
* @param callable|string $function
|
885 |
+
* @param string $icon_url
|
886 |
+
* @param int|null $position
|
887 |
+
*
|
888 |
+
* @return string
|
889 |
+
*/
|
890 |
+
function add_page_and_update(
|
891 |
+
$page_title,
|
892 |
+
$menu_title,
|
893 |
+
$capability,
|
894 |
+
$menu_slug,
|
895 |
+
$function = '',
|
896 |
+
$icon_url = '',
|
897 |
+
$position = null
|
898 |
+
) {
|
899 |
+
$this->_menu_slug = $menu_slug;
|
900 |
+
$this->_is_top_level = true;
|
901 |
+
$this->_menu_exists = true;
|
902 |
+
$this->_network_menu_exists = true;
|
903 |
+
|
904 |
+
return self::add_page(
|
905 |
+
$page_title,
|
906 |
+
$menu_title,
|
907 |
+
$capability,
|
908 |
+
$menu_slug,
|
909 |
+
$function,
|
910 |
+
$icon_url,
|
911 |
+
$position
|
912 |
+
);
|
913 |
+
}
|
914 |
+
|
915 |
+
/**
|
916 |
+
* Add a submenu page.
|
917 |
+
*
|
918 |
+
* Note for WordPress.org Theme/Plugin reviewer:
|
919 |
+
*
|
920 |
+
* This is a replication of `add_submenu_page()` to avoid Theme Check warning.
|
921 |
+
*
|
922 |
+
* Why?
|
923 |
+
* ====
|
924 |
+
* Freemius is an SDK for plugin and theme developers. Since the core
|
925 |
+
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
926 |
+
* we only develop and maintain one code base.
|
927 |
+
*
|
928 |
+
* This method will not run for wp.org themes (only plugins) since theme
|
929 |
+
* admin settings/options are now only allowed in the customizer.
|
930 |
+
*
|
931 |
+
* If you have any questions or need clarifications, please don't hesitate
|
932 |
+
* pinging me on slack, my username is @svovaf.
|
933 |
+
*
|
934 |
+
* @author Vova Feldman (@svovaf)
|
935 |
+
* @since 1.2.2
|
936 |
+
*
|
937 |
+
* @param string $parent_slug The slug name for the parent menu (or the file name of a standard
|
938 |
+
* WordPress admin page).
|
939 |
+
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
940 |
+
* selected.
|
941 |
+
* @param string $menu_title The text to be used for the menu.
|
942 |
+
* @param string $capability The capability required for this menu to be displayed to the user.
|
943 |
+
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
944 |
+
* @param callable|string $function The function to be called to output the content for this page.
|
945 |
+
*
|
946 |
+
* @return false|string The resulting page's hook_suffix, or false if the user does not have the capability
|
947 |
+
* required.
|
948 |
+
*/
|
949 |
+
static function add_subpage(
|
950 |
+
$parent_slug,
|
951 |
+
$page_title,
|
952 |
+
$menu_title,
|
953 |
+
$capability,
|
954 |
+
$menu_slug,
|
955 |
+
$function = ''
|
956 |
+
) {
|
957 |
+
$fn = 'add_submenu' . '_page';
|
958 |
+
|
959 |
+
return $fn( $parent_slug,
|
960 |
+
$page_title,
|
961 |
+
$menu_title,
|
962 |
+
$capability,
|
963 |
+
$menu_slug,
|
964 |
+
$function
|
965 |
+
);
|
966 |
+
}
|
967 |
+
|
968 |
+
/**
|
969 |
+
* Add sub page and update menu instance settings.
|
970 |
+
*
|
971 |
+
* @author Vova Feldman (@svovaf)
|
972 |
+
* @since 2.0.0
|
973 |
+
*
|
974 |
+
* @param string $parent_slug
|
975 |
+
* @param string $page_title
|
976 |
+
* @param string $menu_title
|
977 |
+
* @param string $capability
|
978 |
+
* @param string $menu_slug
|
979 |
+
* @param callable|string $function
|
980 |
+
*
|
981 |
+
* @return string
|
982 |
+
*/
|
983 |
+
function add_subpage_and_update(
|
984 |
+
$parent_slug,
|
985 |
+
$page_title,
|
986 |
+
$menu_title,
|
987 |
+
$capability,
|
988 |
+
$menu_slug,
|
989 |
+
$function = ''
|
990 |
+
) {
|
991 |
+
$this->_menu_slug = $menu_slug;
|
992 |
+
$this->_parent_slug = $parent_slug;
|
993 |
+
$this->_is_top_level = false;
|
994 |
+
$this->_menu_exists = true;
|
995 |
+
$this->_network_menu_exists = true;
|
996 |
+
|
997 |
+
return self::add_subpage(
|
998 |
+
$parent_slug,
|
999 |
+
$page_title,
|
1000 |
+
$menu_title,
|
1001 |
+
$capability,
|
1002 |
+
$menu_slug,
|
1003 |
+
$function
|
1004 |
+
);
|
1005 |
+
}
|
1006 |
}
|
lib/freemius/includes/managers/class-fs-cache-manager.php
CHANGED
@@ -1,326 +1,326 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Cache_Manager {
|
14 |
-
/**
|
15 |
-
* @var FS_Option_Manager
|
16 |
-
*/
|
17 |
-
private $_options;
|
18 |
-
/**
|
19 |
-
* @var FS_Logger
|
20 |
-
*/
|
21 |
-
private $_logger;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var FS_Cache_Manager[]
|
25 |
-
*/
|
26 |
-
private static $_MANAGERS = array();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @author Vova Feldman (@svovaf)
|
30 |
-
* @since 1.1.3
|
31 |
-
*
|
32 |
-
* @param string $id
|
33 |
-
*/
|
34 |
-
private function __construct( $id ) {
|
35 |
-
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
36 |
-
|
37 |
-
$this->_logger->entrance();
|
38 |
-
$this->_logger->log( 'id = ' . $id );
|
39 |
-
|
40 |
-
$this->_options = FS_Option_Manager::get_manager( $id, true, true, false );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @author Vova Feldman (@svovaf)
|
45 |
-
* @since 1.1.6
|
46 |
-
*
|
47 |
-
* @param $id
|
48 |
-
*
|
49 |
-
* @return FS_Cache_Manager
|
50 |
-
*/
|
51 |
-
static function get_manager( $id ) {
|
52 |
-
$id = strtolower( $id );
|
53 |
-
|
54 |
-
if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
|
55 |
-
self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
|
56 |
-
}
|
57 |
-
|
58 |
-
return self::$_MANAGERS[ $id ];
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* @author Vova Feldman (@svovaf)
|
63 |
-
* @since 1.1.6
|
64 |
-
*
|
65 |
-
* @return bool
|
66 |
-
*/
|
67 |
-
function is_empty() {
|
68 |
-
$this->_logger->entrance();
|
69 |
-
|
70 |
-
return $this->_options->is_empty();
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* @author Vova Feldman (@svovaf)
|
75 |
-
* @since 1.1.6
|
76 |
-
*/
|
77 |
-
function clear() {
|
78 |
-
$this->_logger->entrance();
|
79 |
-
|
80 |
-
$this->_options->clear( true );
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Delete cache manager from DB.
|
85 |
-
*
|
86 |
-
* @author Vova Feldman (@svovaf)
|
87 |
-
* @since 1.0.9
|
88 |
-
*/
|
89 |
-
function delete() {
|
90 |
-
$this->_options->delete();
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Check if there's a cached item.
|
95 |
-
*
|
96 |
-
* @author Vova Feldman (@svovaf)
|
97 |
-
* @since 1.1.6
|
98 |
-
*
|
99 |
-
* @param string $key
|
100 |
-
*
|
101 |
-
* @return bool
|
102 |
-
*/
|
103 |
-
function has( $key ) {
|
104 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
105 |
-
|
106 |
-
return ( is_object( $cache_entry ) &&
|
107 |
-
isset( $cache_entry->timestamp ) &&
|
108 |
-
is_numeric( $cache_entry->timestamp )
|
109 |
-
);
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Check if there's a valid cached item.
|
114 |
-
*
|
115 |
-
* @author Vova Feldman (@svovaf)
|
116 |
-
* @since 1.1.6
|
117 |
-
*
|
118 |
-
* @param string $key
|
119 |
-
* @param null|int $expiration Since 1.2.2.7
|
120 |
-
*
|
121 |
-
* @return bool
|
122 |
-
*/
|
123 |
-
function has_valid( $key, $expiration = null ) {
|
124 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
125 |
-
|
126 |
-
$is_valid = ( is_object( $cache_entry ) &&
|
127 |
-
isset( $cache_entry->timestamp ) &&
|
128 |
-
is_numeric( $cache_entry->timestamp ) &&
|
129 |
-
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
130 |
-
);
|
131 |
-
|
132 |
-
if ( $is_valid &&
|
133 |
-
is_numeric( $expiration ) &&
|
134 |
-
isset( $cache_entry->created ) &&
|
135 |
-
is_numeric( $cache_entry->created ) &&
|
136 |
-
$cache_entry->created + $expiration < WP_FS__SCRIPT_START_TIME
|
137 |
-
) {
|
138 |
-
/**
|
139 |
-
* Even if the cache is still valid, since we are checking for validity
|
140 |
-
* with an explicit expiration period, if the period has past, return
|
141 |
-
* `false` as if the cache is invalid.
|
142 |
-
*
|
143 |
-
* @since 1.2.2.7
|
144 |
-
*/
|
145 |
-
$is_valid = false;
|
146 |
-
}
|
147 |
-
|
148 |
-
return $is_valid;
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* @author Vova Feldman (@svovaf)
|
153 |
-
* @since 1.1.6
|
154 |
-
*
|
155 |
-
* @param string $key
|
156 |
-
* @param mixed $default
|
157 |
-
*
|
158 |
-
* @return mixed
|
159 |
-
*/
|
160 |
-
function get( $key, $default = null ) {
|
161 |
-
$this->_logger->entrance( 'key = ' . $key );
|
162 |
-
|
163 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
164 |
-
|
165 |
-
if ( is_object( $cache_entry ) &&
|
166 |
-
isset( $cache_entry->timestamp ) &&
|
167 |
-
is_numeric( $cache_entry->timestamp )
|
168 |
-
) {
|
169 |
-
return $cache_entry->result;
|
170 |
-
}
|
171 |
-
|
172 |
-
return is_object( $default ) ? clone $default : $default;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* @author Vova Feldman (@svovaf)
|
177 |
-
* @since 1.1.6
|
178 |
-
*
|
179 |
-
* @param string $key
|
180 |
-
* @param mixed $default
|
181 |
-
*
|
182 |
-
* @return mixed
|
183 |
-
*/
|
184 |
-
function get_valid( $key, $default = null ) {
|
185 |
-
$this->_logger->entrance( 'key = ' . $key );
|
186 |
-
|
187 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
188 |
-
|
189 |
-
if ( is_object( $cache_entry ) &&
|
190 |
-
isset( $cache_entry->timestamp ) &&
|
191 |
-
is_numeric( $cache_entry->timestamp ) &&
|
192 |
-
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
193 |
-
) {
|
194 |
-
return $cache_entry->result;
|
195 |
-
}
|
196 |
-
|
197 |
-
return is_object( $default ) ? clone $default : $default;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* @author Vova Feldman (@svovaf)
|
202 |
-
* @since 1.1.6
|
203 |
-
*
|
204 |
-
* @param string $key
|
205 |
-
* @param mixed $value
|
206 |
-
* @param int $expiration
|
207 |
-
* @param int $created Since 2.0.0 Cache creation date.
|
208 |
-
*/
|
209 |
-
function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $created = WP_FS__SCRIPT_START_TIME ) {
|
210 |
-
$this->_logger->entrance( 'key = ' . $key );
|
211 |
-
|
212 |
-
$cache_entry = new stdClass();
|
213 |
-
|
214 |
-
$cache_entry->result = $value;
|
215 |
-
$cache_entry->created = $created;
|
216 |
-
$cache_entry->timestamp = $created + $expiration;
|
217 |
-
$this->_options->set_option( $key, $cache_entry, true );
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Get cached record expiration, or false if not cached or expired.
|
222 |
-
*
|
223 |
-
* @author Vova Feldman (@svovaf)
|
224 |
-
* @since 1.1.7.3
|
225 |
-
*
|
226 |
-
* @param string $key
|
227 |
-
*
|
228 |
-
* @return bool|int
|
229 |
-
*/
|
230 |
-
function get_record_expiration( $key ) {
|
231 |
-
$this->_logger->entrance( 'key = ' . $key );
|
232 |
-
|
233 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
234 |
-
|
235 |
-
if ( is_object( $cache_entry ) &&
|
236 |
-
isset( $cache_entry->timestamp ) &&
|
237 |
-
is_numeric( $cache_entry->timestamp ) &&
|
238 |
-
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
239 |
-
) {
|
240 |
-
return $cache_entry->timestamp;
|
241 |
-
}
|
242 |
-
|
243 |
-
return false;
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Purge cached item.
|
248 |
-
*
|
249 |
-
* @author Vova Feldman (@svovaf)
|
250 |
-
* @since 1.1.6
|
251 |
-
*
|
252 |
-
* @param string $key
|
253 |
-
*/
|
254 |
-
function purge( $key ) {
|
255 |
-
$this->_logger->entrance( 'key = ' . $key );
|
256 |
-
|
257 |
-
$this->_options->unset_option( $key, true );
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Extend cached item caching period.
|
262 |
-
*
|
263 |
-
* @author Vova Feldman (@svovaf)
|
264 |
-
* @since 2.0.0
|
265 |
-
*
|
266 |
-
* @param string $key
|
267 |
-
* @param int $expiration
|
268 |
-
*
|
269 |
-
* @return bool
|
270 |
-
*/
|
271 |
-
function update_expiration( $key, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
|
272 |
-
$this->_logger->entrance( 'key = ' . $key );
|
273 |
-
|
274 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
275 |
-
|
276 |
-
if ( ! is_object( $cache_entry ) ||
|
277 |
-
! isset( $cache_entry->timestamp ) ||
|
278 |
-
! is_numeric( $cache_entry->timestamp )
|
279 |
-
) {
|
280 |
-
return false;
|
281 |
-
}
|
282 |
-
|
283 |
-
$this->set( $key, $cache_entry->result, $expiration, $cache_entry->created );
|
284 |
-
|
285 |
-
return true;
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Set cached item as expired.
|
290 |
-
*
|
291 |
-
* @author Vova Feldman (@svovaf)
|
292 |
-
* @since 1.2.2.7
|
293 |
-
*
|
294 |
-
* @param string $key
|
295 |
-
*/
|
296 |
-
function expire( $key ) {
|
297 |
-
$this->_logger->entrance( 'key = ' . $key );
|
298 |
-
|
299 |
-
$cache_entry = $this->_options->get_option( $key, false );
|
300 |
-
|
301 |
-
if ( is_object( $cache_entry ) &&
|
302 |
-
isset( $cache_entry->timestamp ) &&
|
303 |
-
is_numeric( $cache_entry->timestamp )
|
304 |
-
) {
|
305 |
-
// Set to expired.
|
306 |
-
$cache_entry->timestamp = WP_FS__SCRIPT_START_TIME;
|
307 |
-
$this->_options->set_option( $key, $cache_entry, true );
|
308 |
-
}
|
309 |
-
}
|
310 |
-
|
311 |
-
#--------------------------------------------------------------------------------
|
312 |
-
#region Migration
|
313 |
-
#--------------------------------------------------------------------------------
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Migrate options from site level.
|
317 |
-
*
|
318 |
-
* @author Vova Feldman (@svovaf)
|
319 |
-
* @since 2.0.0
|
320 |
-
*/
|
321 |
-
function migrate_to_network() {
|
322 |
-
$this->_options->migrate_to_network();
|
323 |
-
}
|
324 |
-
|
325 |
-
#endregion
|
326 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Cache_Manager {
|
14 |
+
/**
|
15 |
+
* @var FS_Option_Manager
|
16 |
+
*/
|
17 |
+
private $_options;
|
18 |
+
/**
|
19 |
+
* @var FS_Logger
|
20 |
+
*/
|
21 |
+
private $_logger;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var FS_Cache_Manager[]
|
25 |
+
*/
|
26 |
+
private static $_MANAGERS = array();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @author Vova Feldman (@svovaf)
|
30 |
+
* @since 1.1.3
|
31 |
+
*
|
32 |
+
* @param string $id
|
33 |
+
*/
|
34 |
+
private function __construct( $id ) {
|
35 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
36 |
+
|
37 |
+
$this->_logger->entrance();
|
38 |
+
$this->_logger->log( 'id = ' . $id );
|
39 |
+
|
40 |
+
$this->_options = FS_Option_Manager::get_manager( $id, true, true, false );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @author Vova Feldman (@svovaf)
|
45 |
+
* @since 1.1.6
|
46 |
+
*
|
47 |
+
* @param $id
|
48 |
+
*
|
49 |
+
* @return FS_Cache_Manager
|
50 |
+
*/
|
51 |
+
static function get_manager( $id ) {
|
52 |
+
$id = strtolower( $id );
|
53 |
+
|
54 |
+
if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
|
55 |
+
self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
|
56 |
+
}
|
57 |
+
|
58 |
+
return self::$_MANAGERS[ $id ];
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @author Vova Feldman (@svovaf)
|
63 |
+
* @since 1.1.6
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
function is_empty() {
|
68 |
+
$this->_logger->entrance();
|
69 |
+
|
70 |
+
return $this->_options->is_empty();
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @author Vova Feldman (@svovaf)
|
75 |
+
* @since 1.1.6
|
76 |
+
*/
|
77 |
+
function clear() {
|
78 |
+
$this->_logger->entrance();
|
79 |
+
|
80 |
+
$this->_options->clear( true );
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Delete cache manager from DB.
|
85 |
+
*
|
86 |
+
* @author Vova Feldman (@svovaf)
|
87 |
+
* @since 1.0.9
|
88 |
+
*/
|
89 |
+
function delete() {
|
90 |
+
$this->_options->delete();
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Check if there's a cached item.
|
95 |
+
*
|
96 |
+
* @author Vova Feldman (@svovaf)
|
97 |
+
* @since 1.1.6
|
98 |
+
*
|
99 |
+
* @param string $key
|
100 |
+
*
|
101 |
+
* @return bool
|
102 |
+
*/
|
103 |
+
function has( $key ) {
|
104 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
105 |
+
|
106 |
+
return ( is_object( $cache_entry ) &&
|
107 |
+
isset( $cache_entry->timestamp ) &&
|
108 |
+
is_numeric( $cache_entry->timestamp )
|
109 |
+
);
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Check if there's a valid cached item.
|
114 |
+
*
|
115 |
+
* @author Vova Feldman (@svovaf)
|
116 |
+
* @since 1.1.6
|
117 |
+
*
|
118 |
+
* @param string $key
|
119 |
+
* @param null|int $expiration Since 1.2.2.7
|
120 |
+
*
|
121 |
+
* @return bool
|
122 |
+
*/
|
123 |
+
function has_valid( $key, $expiration = null ) {
|
124 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
125 |
+
|
126 |
+
$is_valid = ( is_object( $cache_entry ) &&
|
127 |
+
isset( $cache_entry->timestamp ) &&
|
128 |
+
is_numeric( $cache_entry->timestamp ) &&
|
129 |
+
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
130 |
+
);
|
131 |
+
|
132 |
+
if ( $is_valid &&
|
133 |
+
is_numeric( $expiration ) &&
|
134 |
+
isset( $cache_entry->created ) &&
|
135 |
+
is_numeric( $cache_entry->created ) &&
|
136 |
+
$cache_entry->created + $expiration < WP_FS__SCRIPT_START_TIME
|
137 |
+
) {
|
138 |
+
/**
|
139 |
+
* Even if the cache is still valid, since we are checking for validity
|
140 |
+
* with an explicit expiration period, if the period has past, return
|
141 |
+
* `false` as if the cache is invalid.
|
142 |
+
*
|
143 |
+
* @since 1.2.2.7
|
144 |
+
*/
|
145 |
+
$is_valid = false;
|
146 |
+
}
|
147 |
+
|
148 |
+
return $is_valid;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @author Vova Feldman (@svovaf)
|
153 |
+
* @since 1.1.6
|
154 |
+
*
|
155 |
+
* @param string $key
|
156 |
+
* @param mixed $default
|
157 |
+
*
|
158 |
+
* @return mixed
|
159 |
+
*/
|
160 |
+
function get( $key, $default = null ) {
|
161 |
+
$this->_logger->entrance( 'key = ' . $key );
|
162 |
+
|
163 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
164 |
+
|
165 |
+
if ( is_object( $cache_entry ) &&
|
166 |
+
isset( $cache_entry->timestamp ) &&
|
167 |
+
is_numeric( $cache_entry->timestamp )
|
168 |
+
) {
|
169 |
+
return $cache_entry->result;
|
170 |
+
}
|
171 |
+
|
172 |
+
return is_object( $default ) ? clone $default : $default;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @author Vova Feldman (@svovaf)
|
177 |
+
* @since 1.1.6
|
178 |
+
*
|
179 |
+
* @param string $key
|
180 |
+
* @param mixed $default
|
181 |
+
*
|
182 |
+
* @return mixed
|
183 |
+
*/
|
184 |
+
function get_valid( $key, $default = null ) {
|
185 |
+
$this->_logger->entrance( 'key = ' . $key );
|
186 |
+
|
187 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
188 |
+
|
189 |
+
if ( is_object( $cache_entry ) &&
|
190 |
+
isset( $cache_entry->timestamp ) &&
|
191 |
+
is_numeric( $cache_entry->timestamp ) &&
|
192 |
+
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
193 |
+
) {
|
194 |
+
return $cache_entry->result;
|
195 |
+
}
|
196 |
+
|
197 |
+
return is_object( $default ) ? clone $default : $default;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @author Vova Feldman (@svovaf)
|
202 |
+
* @since 1.1.6
|
203 |
+
*
|
204 |
+
* @param string $key
|
205 |
+
* @param mixed $value
|
206 |
+
* @param int $expiration
|
207 |
+
* @param int $created Since 2.0.0 Cache creation date.
|
208 |
+
*/
|
209 |
+
function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $created = WP_FS__SCRIPT_START_TIME ) {
|
210 |
+
$this->_logger->entrance( 'key = ' . $key );
|
211 |
+
|
212 |
+
$cache_entry = new stdClass();
|
213 |
+
|
214 |
+
$cache_entry->result = $value;
|
215 |
+
$cache_entry->created = $created;
|
216 |
+
$cache_entry->timestamp = $created + $expiration;
|
217 |
+
$this->_options->set_option( $key, $cache_entry, true );
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Get cached record expiration, or false if not cached or expired.
|
222 |
+
*
|
223 |
+
* @author Vova Feldman (@svovaf)
|
224 |
+
* @since 1.1.7.3
|
225 |
+
*
|
226 |
+
* @param string $key
|
227 |
+
*
|
228 |
+
* @return bool|int
|
229 |
+
*/
|
230 |
+
function get_record_expiration( $key ) {
|
231 |
+
$this->_logger->entrance( 'key = ' . $key );
|
232 |
+
|
233 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
234 |
+
|
235 |
+
if ( is_object( $cache_entry ) &&
|
236 |
+
isset( $cache_entry->timestamp ) &&
|
237 |
+
is_numeric( $cache_entry->timestamp ) &&
|
238 |
+
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
|
239 |
+
) {
|
240 |
+
return $cache_entry->timestamp;
|
241 |
+
}
|
242 |
+
|
243 |
+
return false;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Purge cached item.
|
248 |
+
*
|
249 |
+
* @author Vova Feldman (@svovaf)
|
250 |
+
* @since 1.1.6
|
251 |
+
*
|
252 |
+
* @param string $key
|
253 |
+
*/
|
254 |
+
function purge( $key ) {
|
255 |
+
$this->_logger->entrance( 'key = ' . $key );
|
256 |
+
|
257 |
+
$this->_options->unset_option( $key, true );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Extend cached item caching period.
|
262 |
+
*
|
263 |
+
* @author Vova Feldman (@svovaf)
|
264 |
+
* @since 2.0.0
|
265 |
+
*
|
266 |
+
* @param string $key
|
267 |
+
* @param int $expiration
|
268 |
+
*
|
269 |
+
* @return bool
|
270 |
+
*/
|
271 |
+
function update_expiration( $key, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
|
272 |
+
$this->_logger->entrance( 'key = ' . $key );
|
273 |
+
|
274 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
275 |
+
|
276 |
+
if ( ! is_object( $cache_entry ) ||
|
277 |
+
! isset( $cache_entry->timestamp ) ||
|
278 |
+
! is_numeric( $cache_entry->timestamp )
|
279 |
+
) {
|
280 |
+
return false;
|
281 |
+
}
|
282 |
+
|
283 |
+
$this->set( $key, $cache_entry->result, $expiration, $cache_entry->created );
|
284 |
+
|
285 |
+
return true;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Set cached item as expired.
|
290 |
+
*
|
291 |
+
* @author Vova Feldman (@svovaf)
|
292 |
+
* @since 1.2.2.7
|
293 |
+
*
|
294 |
+
* @param string $key
|
295 |
+
*/
|
296 |
+
function expire( $key ) {
|
297 |
+
$this->_logger->entrance( 'key = ' . $key );
|
298 |
+
|
299 |
+
$cache_entry = $this->_options->get_option( $key, false );
|
300 |
+
|
301 |
+
if ( is_object( $cache_entry ) &&
|
302 |
+
isset( $cache_entry->timestamp ) &&
|
303 |
+
is_numeric( $cache_entry->timestamp )
|
304 |
+
) {
|
305 |
+
// Set to expired.
|
306 |
+
$cache_entry->timestamp = WP_FS__SCRIPT_START_TIME;
|
307 |
+
$this->_options->set_option( $key, $cache_entry, true );
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
#--------------------------------------------------------------------------------
|
312 |
+
#region Migration
|
313 |
+
#--------------------------------------------------------------------------------
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Migrate options from site level.
|
317 |
+
*
|
318 |
+
* @author Vova Feldman (@svovaf)
|
319 |
+
* @since 2.0.0
|
320 |
+
*/
|
321 |
+
function migrate_to_network() {
|
322 |
+
$this->_options->migrate_to_network();
|
323 |
+
}
|
324 |
+
|
325 |
+
#endregion
|
326 |
}
|
lib/freemius/includes/managers/class-fs-gdpr-manager.php
CHANGED
@@ -1,202 +1,202 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.1.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_GDPR_Manager {
|
14 |
-
/**
|
15 |
-
* @var FS_Option_Manager
|
16 |
-
*/
|
17 |
-
private $_storage;
|
18 |
-
/**
|
19 |
-
* @var array {
|
20 |
-
* @type bool $required Are GDPR rules apply on the current context admin.
|
21 |
-
* @type bool $show_opt_in_notice Should the marketing and offers opt-in message be shown to the admin or not. If not set, defaults to `true`.
|
22 |
-
* @type int $notice_shown_at Last time the special GDPR opt-in message was shown to the current admin.
|
23 |
-
* }
|
24 |
-
*/
|
25 |
-
private $_data;
|
26 |
-
/**
|
27 |
-
* @var int
|
28 |
-
*/
|
29 |
-
private $_wp_user_id;
|
30 |
-
/**
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
private $_option_name;
|
34 |
-
/**
|
35 |
-
* @var FS_Admin_Notices
|
36 |
-
*/
|
37 |
-
private $_notices;
|
38 |
-
|
39 |
-
#--------------------------------------------------------------------------------
|
40 |
-
#region Singleton
|
41 |
-
#--------------------------------------------------------------------------------
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var FS_GDPR_Manager
|
45 |
-
*/
|
46 |
-
private static $_instance;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @return FS_GDPR_Manager
|
50 |
-
*/
|
51 |
-
public static function instance() {
|
52 |
-
if ( ! isset( self::$_instance ) ) {
|
53 |
-
self::$_instance = new self();
|
54 |
-
}
|
55 |
-
|
56 |
-
return self::$_instance;
|
57 |
-
}
|
58 |
-
|
59 |
-
#endregion
|
60 |
-
|
61 |
-
private function __construct() {
|
62 |
-
$this->_storage = FS_Option_Manager::get_manager( WP_FS__GDPR_OPTION_NAME, true, true );
|
63 |
-
$this->_wp_user_id = Freemius::get_current_wp_user_id();
|
64 |
-
$this->_option_name = "u{$this->_wp_user_id}";
|
65 |
-
$this->_data = $this->_storage->get_option( $this->_option_name, array() );
|
66 |
-
$this->_notices = FS_Admin_Notices::instance( 'all_admins', '', '', true );
|
67 |
-
|
68 |
-
if ( ! is_array( $this->_data ) ) {
|
69 |
-
$this->_data = array();
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Update a GDPR option for the current admin and store it.
|
75 |
-
*
|
76 |
-
* @author Vova Feldman (@svovaf)
|
77 |
-
* @since 2.1.0
|
78 |
-
*
|
79 |
-
* @param string $name
|
80 |
-
* @param mixed $value
|
81 |
-
*/
|
82 |
-
private function update_option( $name, $value ) {
|
83 |
-
$this->_data[ $name ] = $value;
|
84 |
-
|
85 |
-
$this->_storage->set_option( $this->_option_name, $this->_data, true );
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @author Leo Fajardo (@leorw)
|
90 |
-
* @since 2.1.0
|
91 |
-
*
|
92 |
-
* @return bool|null
|
93 |
-
*/
|
94 |
-
public function is_required() {
|
95 |
-
return isset( $this->_data['required'] ) ?
|
96 |
-
$this->_data['required'] :
|
97 |
-
null;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* @author Leo Fajardo (@leorw)
|
102 |
-
* @since 2.1.0
|
103 |
-
*
|
104 |
-
* @param bool $is_required
|
105 |
-
*/
|
106 |
-
public function store_is_required( $is_required ) {
|
107 |
-
$this->update_option( 'required', $is_required );
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Checks if the GDPR opt-in sticky notice is currently shown.
|
112 |
-
*
|
113 |
-
* @author Vova Feldman (@svovaf)
|
114 |
-
* @since 2.1.0
|
115 |
-
*
|
116 |
-
* @return bool
|
117 |
-
*/
|
118 |
-
public function is_opt_in_notice_shown() {
|
119 |
-
return $this->_notices->has_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Remove the GDPR opt-in sticky notice.
|
124 |
-
*
|
125 |
-
* @author Vova Feldman (@svovaf)
|
126 |
-
* @since 2.1.0
|
127 |
-
*/
|
128 |
-
public function remove_opt_in_notice() {
|
129 |
-
$this->_notices->remove_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
|
130 |
-
|
131 |
-
$this->disable_opt_in_notice();
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Prevents the opt-in message from being added/shown.
|
136 |
-
*
|
137 |
-
* @author Leo Fajardo (@leorw)
|
138 |
-
* @since 2.1.0
|
139 |
-
*/
|
140 |
-
public function disable_opt_in_notice() {
|
141 |
-
$this->update_option( 'show_opt_in_notice', false );
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Checks if a GDPR opt-in message needs to be shown to the current admin.
|
146 |
-
*
|
147 |
-
* @author Vova Feldman (@svovaf)
|
148 |
-
* @since 2.1.0
|
149 |
-
*
|
150 |
-
* @return bool
|
151 |
-
*/
|
152 |
-
public function should_show_opt_in_notice() {
|
153 |
-
return (
|
154 |
-
! isset( $this->_data['show_opt_in_notice'] ) ||
|
155 |
-
true === $this->_data['show_opt_in_notice']
|
156 |
-
);
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get the last time the GDPR opt-in notice was shown.
|
161 |
-
*
|
162 |
-
* @author Vova Feldman (@svovaf)
|
163 |
-
* @since 2.1.0
|
164 |
-
*
|
165 |
-
* @return false|int
|
166 |
-
*/
|
167 |
-
public function last_time_notice_was_shown() {
|
168 |
-
return isset( $this->_data['notice_shown_at'] ) ?
|
169 |
-
$this->_data['notice_shown_at'] :
|
170 |
-
false;
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Update the timestamp of the last time the GDPR opt-in message was shown to now.
|
175 |
-
*
|
176 |
-
* @author Vova Feldman (@svovaf)
|
177 |
-
* @since 2.1.0
|
178 |
-
*/
|
179 |
-
public function notice_was_just_shown() {
|
180 |
-
$this->update_option( 'notice_shown_at', WP_FS__SCRIPT_START_TIME );
|
181 |
-
}
|
182 |
-
|
183 |
-
/**
|
184 |
-
* @param string $message
|
185 |
-
* @param string|null $plugin_title
|
186 |
-
*
|
187 |
-
* @author Vova Feldman (@svovaf)
|
188 |
-
* @since 2.1.0
|
189 |
-
*/
|
190 |
-
public function add_opt_in_sticky_notice( $message, $plugin_title = null ) {
|
191 |
-
$this->_notices->add_sticky(
|
192 |
-
$message,
|
193 |
-
"gdpr_optin_actions_{$this->_wp_user_id}",
|
194 |
-
'',
|
195 |
-
'promotion',
|
196 |
-
true,
|
197 |
-
$this->_wp_user_id,
|
198 |
-
$plugin_title,
|
199 |
-
true
|
200 |
-
);
|
201 |
-
}
|
202 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_GDPR_Manager {
|
14 |
+
/**
|
15 |
+
* @var FS_Option_Manager
|
16 |
+
*/
|
17 |
+
private $_storage;
|
18 |
+
/**
|
19 |
+
* @var array {
|
20 |
+
* @type bool $required Are GDPR rules apply on the current context admin.
|
21 |
+
* @type bool $show_opt_in_notice Should the marketing and offers opt-in message be shown to the admin or not. If not set, defaults to `true`.
|
22 |
+
* @type int $notice_shown_at Last time the special GDPR opt-in message was shown to the current admin.
|
23 |
+
* }
|
24 |
+
*/
|
25 |
+
private $_data;
|
26 |
+
/**
|
27 |
+
* @var int
|
28 |
+
*/
|
29 |
+
private $_wp_user_id;
|
30 |
+
/**
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
private $_option_name;
|
34 |
+
/**
|
35 |
+
* @var FS_Admin_Notices
|
36 |
+
*/
|
37 |
+
private $_notices;
|
38 |
+
|
39 |
+
#--------------------------------------------------------------------------------
|
40 |
+
#region Singleton
|
41 |
+
#--------------------------------------------------------------------------------
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var FS_GDPR_Manager
|
45 |
+
*/
|
46 |
+
private static $_instance;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @return FS_GDPR_Manager
|
50 |
+
*/
|
51 |
+
public static function instance() {
|
52 |
+
if ( ! isset( self::$_instance ) ) {
|
53 |
+
self::$_instance = new self();
|
54 |
+
}
|
55 |
+
|
56 |
+
return self::$_instance;
|
57 |
+
}
|
58 |
+
|
59 |
+
#endregion
|
60 |
+
|
61 |
+
private function __construct() {
|
62 |
+
$this->_storage = FS_Option_Manager::get_manager( WP_FS__GDPR_OPTION_NAME, true, true );
|
63 |
+
$this->_wp_user_id = Freemius::get_current_wp_user_id();
|
64 |
+
$this->_option_name = "u{$this->_wp_user_id}";
|
65 |
+
$this->_data = $this->_storage->get_option( $this->_option_name, array() );
|
66 |
+
$this->_notices = FS_Admin_Notices::instance( 'all_admins', '', '', true );
|
67 |
+
|
68 |
+
if ( ! is_array( $this->_data ) ) {
|
69 |
+
$this->_data = array();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Update a GDPR option for the current admin and store it.
|
75 |
+
*
|
76 |
+
* @author Vova Feldman (@svovaf)
|
77 |
+
* @since 2.1.0
|
78 |
+
*
|
79 |
+
* @param string $name
|
80 |
+
* @param mixed $value
|
81 |
+
*/
|
82 |
+
private function update_option( $name, $value ) {
|
83 |
+
$this->_data[ $name ] = $value;
|
84 |
+
|
85 |
+
$this->_storage->set_option( $this->_option_name, $this->_data, true );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @author Leo Fajardo (@leorw)
|
90 |
+
* @since 2.1.0
|
91 |
+
*
|
92 |
+
* @return bool|null
|
93 |
+
*/
|
94 |
+
public function is_required() {
|
95 |
+
return isset( $this->_data['required'] ) ?
|
96 |
+
$this->_data['required'] :
|
97 |
+
null;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @author Leo Fajardo (@leorw)
|
102 |
+
* @since 2.1.0
|
103 |
+
*
|
104 |
+
* @param bool $is_required
|
105 |
+
*/
|
106 |
+
public function store_is_required( $is_required ) {
|
107 |
+
$this->update_option( 'required', $is_required );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if the GDPR opt-in sticky notice is currently shown.
|
112 |
+
*
|
113 |
+
* @author Vova Feldman (@svovaf)
|
114 |
+
* @since 2.1.0
|
115 |
+
*
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
public function is_opt_in_notice_shown() {
|
119 |
+
return $this->_notices->has_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Remove the GDPR opt-in sticky notice.
|
124 |
+
*
|
125 |
+
* @author Vova Feldman (@svovaf)
|
126 |
+
* @since 2.1.0
|
127 |
+
*/
|
128 |
+
public function remove_opt_in_notice() {
|
129 |
+
$this->_notices->remove_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
|
130 |
+
|
131 |
+
$this->disable_opt_in_notice();
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Prevents the opt-in message from being added/shown.
|
136 |
+
*
|
137 |
+
* @author Leo Fajardo (@leorw)
|
138 |
+
* @since 2.1.0
|
139 |
+
*/
|
140 |
+
public function disable_opt_in_notice() {
|
141 |
+
$this->update_option( 'show_opt_in_notice', false );
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Checks if a GDPR opt-in message needs to be shown to the current admin.
|
146 |
+
*
|
147 |
+
* @author Vova Feldman (@svovaf)
|
148 |
+
* @since 2.1.0
|
149 |
+
*
|
150 |
+
* @return bool
|
151 |
+
*/
|
152 |
+
public function should_show_opt_in_notice() {
|
153 |
+
return (
|
154 |
+
! isset( $this->_data['show_opt_in_notice'] ) ||
|
155 |
+
true === $this->_data['show_opt_in_notice']
|
156 |
+
);
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get the last time the GDPR opt-in notice was shown.
|
161 |
+
*
|
162 |
+
* @author Vova Feldman (@svovaf)
|
163 |
+
* @since 2.1.0
|
164 |
+
*
|
165 |
+
* @return false|int
|
166 |
+
*/
|
167 |
+
public function last_time_notice_was_shown() {
|
168 |
+
return isset( $this->_data['notice_shown_at'] ) ?
|
169 |
+
$this->_data['notice_shown_at'] :
|
170 |
+
false;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Update the timestamp of the last time the GDPR opt-in message was shown to now.
|
175 |
+
*
|
176 |
+
* @author Vova Feldman (@svovaf)
|
177 |
+
* @since 2.1.0
|
178 |
+
*/
|
179 |
+
public function notice_was_just_shown() {
|
180 |
+
$this->update_option( 'notice_shown_at', WP_FS__SCRIPT_START_TIME );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @param string $message
|
185 |
+
* @param string|null $plugin_title
|
186 |
+
*
|
187 |
+
* @author Vova Feldman (@svovaf)
|
188 |
+
* @since 2.1.0
|
189 |
+
*/
|
190 |
+
public function add_opt_in_sticky_notice( $message, $plugin_title = null ) {
|
191 |
+
$this->_notices->add_sticky(
|
192 |
+
$message,
|
193 |
+
"gdpr_optin_actions_{$this->_wp_user_id}",
|
194 |
+
'',
|
195 |
+
'promotion',
|
196 |
+
true,
|
197 |
+
$this->_wp_user_id,
|
198 |
+
$plugin_title,
|
199 |
+
true
|
200 |
+
);
|
201 |
+
}
|
202 |
}
|
lib/freemius/includes/managers/class-fs-key-value-storage.php
CHANGED
@@ -1,402 +1,402 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.7
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Class FS_Key_Value_Storage
|
15 |
-
*
|
16 |
-
* @property int $install_timestamp
|
17 |
-
* @property int $activation_timestamp
|
18 |
-
* @property int $sync_timestamp
|
19 |
-
* @property object $sync_cron
|
20 |
-
* @property int $install_sync_timestamp
|
21 |
-
* @property array $connectivity_test
|
22 |
-
* @property array $is_on
|
23 |
-
* @property object $trial_plan
|
24 |
-
* @property bool $has_trial_plan
|
25 |
-
* @property bool $trial_promotion_shown
|
26 |
-
* @property string $sdk_version
|
27 |
-
* @property string $sdk_last_version
|
28 |
-
* @property bool $sdk_upgrade_mode
|
29 |
-
* @property bool $sdk_downgrade_mode
|
30 |
-
* @property bool $plugin_upgrade_mode
|
31 |
-
* @property bool $plugin_downgrade_mode
|
32 |
-
* @property string $plugin_version
|
33 |
-
* @property string $plugin_last_version
|
34 |
-
* @property bool $is_plugin_new_install
|
35 |
-
* @property bool $was_plugin_loaded
|
36 |
-
* @property object $plugin_main_file
|
37 |
-
* @property bool $prev_is_premium
|
38 |
-
* @property array $is_anonymous
|
39 |
-
* @property bool $is_pending_activation
|
40 |
-
* @property bool $sticky_optin_added
|
41 |
-
* @property object $uninstall_reason
|
42 |
-
* @property object $subscription
|
43 |
-
*/
|
44 |
-
class FS_Key_Value_Storage implements ArrayAccess, Iterator, Countable {
|
45 |
-
/**
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
protected $_id;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @since 1.2.2
|
52 |
-
*
|
53 |
-
* @var string
|
54 |
-
*/
|
55 |
-
protected $_secondary_id;
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @since 2.0.0
|
59 |
-
* @var int The ID of the blog that is associated with the current site level options.
|
60 |
-
*/
|
61 |
-
private $_blog_id = 0;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @since 2.0.0
|
65 |
-
* @var bool
|
66 |
-
*/
|
67 |
-
private $_is_multisite_storage;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @var array
|
71 |
-
*/
|
72 |
-
protected $_data;
|
73 |
-
|
74 |
-
/**
|
75 |
-
* @var FS_Key_Value_Storage[]
|
76 |
-
*/
|
77 |
-
private static $_instances = array();
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @var FS_Logger
|
81 |
-
*/
|
82 |
-
protected $_logger;
|
83 |
-
|
84 |
-
/**
|
85 |
-
* @param string $id
|
86 |
-
* @param string $secondary_id
|
87 |
-
* @param bool $network_level_or_blog_id
|
88 |
-
*
|
89 |
-
* @return FS_Key_Value_Storage
|
90 |
-
*/
|
91 |
-
static function instance( $id, $secondary_id, $network_level_or_blog_id = false ) {
|
92 |
-
$key = $id . ':' . $secondary_id;
|
93 |
-
|
94 |
-
if ( is_multisite() ) {
|
95 |
-
if ( true === $network_level_or_blog_id ) {
|
96 |
-
$key .= ':ms';
|
97 |
-
} else if ( is_numeric( $network_level_or_blog_id ) && $network_level_or_blog_id > 0 ) {
|
98 |
-
$key .= ":{$network_level_or_blog_id}";
|
99 |
-
} else {
|
100 |
-
$network_level_or_blog_id = get_current_blog_id();
|
101 |
-
|
102 |
-
$key .= ":{$network_level_or_blog_id}";
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
if ( ! isset( self::$_instances[ $key ] ) ) {
|
107 |
-
self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $secondary_id, $network_level_or_blog_id );
|
108 |
-
}
|
109 |
-
|
110 |
-
return self::$_instances[ $key ];
|
111 |
-
}
|
112 |
-
|
113 |
-
protected function __construct( $id, $secondary_id, $network_level_or_blog_id = false ) {
|
114 |
-
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $secondary_id . '_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
115 |
-
|
116 |
-
$this->_id = $id;
|
117 |
-
$this->_secondary_id = $secondary_id;
|
118 |
-
|
119 |
-
if ( is_multisite() ) {
|
120 |
-
$this->_is_multisite_storage = ( true === $network_level_or_blog_id );
|
121 |
-
|
122 |
-
if ( is_numeric( $network_level_or_blog_id ) ) {
|
123 |
-
$this->_blog_id = $network_level_or_blog_id;
|
124 |
-
}
|
125 |
-
} else {
|
126 |
-
$this->_is_multisite_storage = false;
|
127 |
-
}
|
128 |
-
|
129 |
-
$this->load();
|
130 |
-
}
|
131 |
-
|
132 |
-
protected function get_option_manager() {
|
133 |
-
return FS_Option_Manager::get_manager(
|
134 |
-
WP_FS__ACCOUNTS_OPTION_NAME,
|
135 |
-
true,
|
136 |
-
$this->_is_multisite_storage ?
|
137 |
-
true :
|
138 |
-
( $this->_blog_id > 0 ? $this->_blog_id : false )
|
139 |
-
);
|
140 |
-
}
|
141 |
-
|
142 |
-
protected function get_all_data() {
|
143 |
-
return $this->get_option_manager()->get_option( $this->_id, array() );
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Load plugin data from local DB.
|
148 |
-
*
|
149 |
-
* @author Vova Feldman (@svovaf)
|
150 |
-
* @since 1.0.7
|
151 |
-
*/
|
152 |
-
function load() {
|
153 |
-
$all_plugins_data = $this->get_all_data();
|
154 |
-
$this->_data = isset( $all_plugins_data[ $this->_secondary_id ] ) ?
|
155 |
-
$all_plugins_data[ $this->_secondary_id ] :
|
156 |
-
array();
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* @author Vova Feldman (@svovaf)
|
161 |
-
* @since 1.0.7
|
162 |
-
*
|
163 |
-
* @param string $key
|
164 |
-
* @param mixed $value
|
165 |
-
* @param bool $flush
|
166 |
-
*/
|
167 |
-
function store( $key, $value, $flush = true ) {
|
168 |
-
if ( $this->_logger->is_on() ) {
|
169 |
-
$this->_logger->entrance( $key . ' = ' . var_export( $value, true ) );
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( array_key_exists( $key, $this->_data ) && $value === $this->_data[ $key ] ) {
|
173 |
-
// No need to store data if the value wasn't changed.
|
174 |
-
return;
|
175 |
-
}
|
176 |
-
|
177 |
-
$all_data = $this->get_all_data();
|
178 |
-
|
179 |
-
$this->_data[ $key ] = $value;
|
180 |
-
|
181 |
-
$all_data[ $this->_secondary_id ] = $this->_data;
|
182 |
-
|
183 |
-
$options_manager = $this->get_option_manager();
|
184 |
-
$options_manager->set_option( $this->_id, $all_data, $flush );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* @author Vova Feldman (@svovaf)
|
189 |
-
* @since 2.0.0
|
190 |
-
*/
|
191 |
-
function save() {
|
192 |
-
$this->get_option_manager()->store();
|
193 |
-
}
|
194 |
-
|
195 |
-
/**
|
196 |
-
* @author Vova Feldman (@svovaf)
|
197 |
-
* @since 1.0.7
|
198 |
-
*
|
199 |
-
* @param bool $store
|
200 |
-
* @param string[] $exceptions Set of keys to keep and not clear.
|
201 |
-
*/
|
202 |
-
function clear_all( $store = true, $exceptions = array() ) {
|
203 |
-
$new_data = array();
|
204 |
-
foreach ( $exceptions as $key ) {
|
205 |
-
if ( isset( $this->_data[ $key ] ) ) {
|
206 |
-
$new_data[ $key ] = $this->_data[ $key ];
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
$this->_data = $new_data;
|
211 |
-
|
212 |
-
if ( $store ) {
|
213 |
-
$all_data = $this->get_all_data();
|
214 |
-
$all_data[ $this->_secondary_id ] = $this->_data;
|
215 |
-
$options_manager = $this->get_option_manager();
|
216 |
-
$options_manager->set_option( $this->_id, $all_data, true );
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Delete key-value storage.
|
222 |
-
*
|
223 |
-
* @author Vova Feldman (@svovaf)
|
224 |
-
* @since 1.0.9
|
225 |
-
*/
|
226 |
-
function delete() {
|
227 |
-
$this->_data = array();
|
228 |
-
|
229 |
-
$all_data = $this->get_all_data();
|
230 |
-
unset( $all_data[ $this->_secondary_id ] );
|
231 |
-
$options_manager = $this->get_option_manager();
|
232 |
-
$options_manager->set_option( $this->_id, $all_data, true );
|
233 |
-
}
|
234 |
-
|
235 |
-
/**
|
236 |
-
* @author Vova Feldman (@svovaf)
|
237 |
-
* @since 1.0.7
|
238 |
-
*
|
239 |
-
* @param string $key
|
240 |
-
* @param bool $store
|
241 |
-
*/
|
242 |
-
function remove( $key, $store = true ) {
|
243 |
-
if ( ! array_key_exists( $key, $this->_data ) ) {
|
244 |
-
return;
|
245 |
-
}
|
246 |
-
|
247 |
-
unset( $this->_data[ $key ] );
|
248 |
-
|
249 |
-
if ( $store ) {
|
250 |
-
$all_data = $this->get_all_data();
|
251 |
-
$all_data[ $this->_secondary_id ] = $this->_data;
|
252 |
-
$options_manager = $this->get_option_manager();
|
253 |
-
$options_manager->set_option( $this->_id, $all_data, true );
|
254 |
-
}
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* @author Vova Feldman (@svovaf)
|
259 |
-
* @since 1.0.7
|
260 |
-
*
|
261 |
-
* @param string $key
|
262 |
-
* @param mixed $default
|
263 |
-
*
|
264 |
-
* @return bool|\FS_Plugin
|
265 |
-
*/
|
266 |
-
function get( $key, $default = false ) {
|
267 |
-
return array_key_exists( $key, $this->_data ) ?
|
268 |
-
$this->_data[ $key ] :
|
269 |
-
$default;
|
270 |
-
}
|
271 |
-
|
272 |
-
/**
|
273 |
-
* @author Vova Feldman (@svovaf)
|
274 |
-
* @since 2.0.0
|
275 |
-
*
|
276 |
-
* @return string
|
277 |
-
*/
|
278 |
-
function get_secondary_id() {
|
279 |
-
return $this->_secondary_id;
|
280 |
-
}
|
281 |
-
|
282 |
-
|
283 |
-
/* ArrayAccess + Magic Access (better for refactoring)
|
284 |
-
-----------------------------------------------------------------------------------*/
|
285 |
-
function __set( $k, $v ) {
|
286 |
-
$this->store( $k, $v );
|
287 |
-
}
|
288 |
-
|
289 |
-
function __isset( $k ) {
|
290 |
-
return array_key_exists( $k, $this->_data );
|
291 |
-
}
|
292 |
-
|
293 |
-
function __unset( $k ) {
|
294 |
-
$this->remove( $k );
|
295 |
-
}
|
296 |
-
|
297 |
-
function __get( $k ) {
|
298 |
-
return $this->get( $k, null );
|
299 |
-
}
|
300 |
-
|
301 |
-
#[ReturnTypeWillChange]
|
302 |
-
function offsetSet( $k, $v ) {
|
303 |
-
if ( is_null( $k ) ) {
|
304 |
-
throw new Exception( 'Can\'t append value to request params.' );
|
305 |
-
} else {
|
306 |
-
$this->{$k} = $v;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
#[ReturnTypeWillChange]
|
311 |
-
function offsetExists( $k ) {
|
312 |
-
return array_key_exists( $k, $this->_data );
|
313 |
-
}
|
314 |
-
|
315 |
-
#[ReturnTypeWillChange]
|
316 |
-
function offsetUnset( $k ) {
|
317 |
-
unset( $this->$k );
|
318 |
-
}
|
319 |
-
|
320 |
-
#[ReturnTypeWillChange]
|
321 |
-
function offsetGet( $k ) {
|
322 |
-
return $this->get( $k, null );
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* (PHP 5 >= 5.0.0)<br/>
|
327 |
-
* Return the current element
|
328 |
-
*
|
329 |
-
* @link http://php.net/manual/en/iterator.current.php
|
330 |
-
* @return mixed Can return any type.
|
331 |
-
*/
|
332 |
-
#[ReturnTypeWillChange]
|
333 |
-
public function current() {
|
334 |
-
return current( $this->_data );
|
335 |
-
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* (PHP 5 >= 5.0.0)<br/>
|
339 |
-
* Move forward to next element
|
340 |
-
*
|
341 |
-
* @link http://php.net/manual/en/iterator.next.php
|
342 |
-
* @return void Any returned value is ignored.
|
343 |
-
*/
|
344 |
-
#[ReturnTypeWillChange]
|
345 |
-
public function next() {
|
346 |
-
next( $this->_data );
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* (PHP 5 >= 5.0.0)<br/>
|
351 |
-
* Return the key of the current element
|
352 |
-
*
|
353 |
-
* @link http://php.net/manual/en/iterator.key.php
|
354 |
-
* @return mixed scalar on success, or null on failure.
|
355 |
-
*/
|
356 |
-
#[ReturnTypeWillChange]
|
357 |
-
public function key() {
|
358 |
-
return key( $this->_data );
|
359 |
-
}
|
360 |
-
|
361 |
-
/**
|
362 |
-
* (PHP 5 >= 5.0.0)<br/>
|
363 |
-
* Checks if current position is valid
|
364 |
-
*
|
365 |
-
* @link http://php.net/manual/en/iterator.valid.php
|
366 |
-
* @return boolean The return value will be casted to boolean and then evaluated.
|
367 |
-
* Returns true on success or false on failure.
|
368 |
-
*/
|
369 |
-
#[ReturnTypeWillChange]
|
370 |
-
public function valid() {
|
371 |
-
$key = key( $this->_data );
|
372 |
-
|
373 |
-
return ( $key !== null && $key !== false );
|
374 |
-
}
|
375 |
-
|
376 |
-
/**
|
377 |
-
* (PHP 5 >= 5.0.0)<br/>
|
378 |
-
* Rewind the Iterator to the first element
|
379 |
-
*
|
380 |
-
* @link http://php.net/manual/en/iterator.rewind.php
|
381 |
-
* @return void Any returned value is ignored.
|
382 |
-
*/
|
383 |
-
#[ReturnTypeWillChange]
|
384 |
-
public function rewind() {
|
385 |
-
reset( $this->_data );
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* (PHP 5 >= 5.1.0)<br/>
|
390 |
-
* Count elements of an object
|
391 |
-
*
|
392 |
-
* @link http://php.net/manual/en/countable.count.php
|
393 |
-
* @return int The custom count as an integer.
|
394 |
-
* </p>
|
395 |
-
* <p>
|
396 |
-
* The return value is cast to an integer.
|
397 |
-
*/
|
398 |
-
#[ReturnTypeWillChange]
|
399 |
-
public function count() {
|
400 |
-
return count( $this->_data );
|
401 |
-
}
|
402 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Class FS_Key_Value_Storage
|
15 |
+
*
|
16 |
+
* @property int $install_timestamp
|
17 |
+
* @property int $activation_timestamp
|
18 |
+
* @property int $sync_timestamp
|
19 |
+
* @property object $sync_cron
|
20 |
+
* @property int $install_sync_timestamp
|
21 |
+
* @property array $connectivity_test
|
22 |
+
* @property array $is_on
|
23 |
+
* @property object $trial_plan
|
24 |
+
* @property bool $has_trial_plan
|
25 |
+
* @property bool $trial_promotion_shown
|
26 |
+
* @property string $sdk_version
|
27 |
+
* @property string $sdk_last_version
|
28 |
+
* @property bool $sdk_upgrade_mode
|
29 |
+
* @property bool $sdk_downgrade_mode
|
30 |
+
* @property bool $plugin_upgrade_mode
|
31 |
+
* @property bool $plugin_downgrade_mode
|
32 |
+
* @property string $plugin_version
|
33 |
+
* @property string $plugin_last_version
|
34 |
+
* @property bool $is_plugin_new_install
|
35 |
+
* @property bool $was_plugin_loaded
|
36 |
+
* @property object $plugin_main_file
|
37 |
+
* @property bool $prev_is_premium
|
38 |
+
* @property array $is_anonymous
|
39 |
+
* @property bool $is_pending_activation
|
40 |
+
* @property bool $sticky_optin_added
|
41 |
+
* @property object $uninstall_reason
|
42 |
+
* @property object $subscription
|
43 |
+
*/
|
44 |
+
class FS_Key_Value_Storage implements ArrayAccess, Iterator, Countable {
|
45 |
+
/**
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $_id;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* @since 1.2.2
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
protected $_secondary_id;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @since 2.0.0
|
59 |
+
* @var int The ID of the blog that is associated with the current site level options.
|
60 |
+
*/
|
61 |
+
private $_blog_id = 0;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @since 2.0.0
|
65 |
+
* @var bool
|
66 |
+
*/
|
67 |
+
private $_is_multisite_storage;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @var array
|
71 |
+
*/
|
72 |
+
protected $_data;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @var FS_Key_Value_Storage[]
|
76 |
+
*/
|
77 |
+
private static $_instances = array();
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @var FS_Logger
|
81 |
+
*/
|
82 |
+
protected $_logger;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @param string $id
|
86 |
+
* @param string $secondary_id
|
87 |
+
* @param bool $network_level_or_blog_id
|
88 |
+
*
|
89 |
+
* @return FS_Key_Value_Storage
|
90 |
+
*/
|
91 |
+
static function instance( $id, $secondary_id, $network_level_or_blog_id = false ) {
|
92 |
+
$key = $id . ':' . $secondary_id;
|
93 |
+
|
94 |
+
if ( is_multisite() ) {
|
95 |
+
if ( true === $network_level_or_blog_id ) {
|
96 |
+
$key .= ':ms';
|
97 |
+
} else if ( is_numeric( $network_level_or_blog_id ) && $network_level_or_blog_id > 0 ) {
|
98 |
+
$key .= ":{$network_level_or_blog_id}";
|
99 |
+
} else {
|
100 |
+
$network_level_or_blog_id = get_current_blog_id();
|
101 |
+
|
102 |
+
$key .= ":{$network_level_or_blog_id}";
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( ! isset( self::$_instances[ $key ] ) ) {
|
107 |
+
self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $secondary_id, $network_level_or_blog_id );
|
108 |
+
}
|
109 |
+
|
110 |
+
return self::$_instances[ $key ];
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function __construct( $id, $secondary_id, $network_level_or_blog_id = false ) {
|
114 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $secondary_id . '_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
115 |
+
|
116 |
+
$this->_id = $id;
|
117 |
+
$this->_secondary_id = $secondary_id;
|
118 |
+
|
119 |
+
if ( is_multisite() ) {
|
120 |
+
$this->_is_multisite_storage = ( true === $network_level_or_blog_id );
|
121 |
+
|
122 |
+
if ( is_numeric( $network_level_or_blog_id ) ) {
|
123 |
+
$this->_blog_id = $network_level_or_blog_id;
|
124 |
+
}
|
125 |
+
} else {
|
126 |
+
$this->_is_multisite_storage = false;
|
127 |
+
}
|
128 |
+
|
129 |
+
$this->load();
|
130 |
+
}
|
131 |
+
|
132 |
+
protected function get_option_manager() {
|
133 |
+
return FS_Option_Manager::get_manager(
|
134 |
+
WP_FS__ACCOUNTS_OPTION_NAME,
|
135 |
+
true,
|
136 |
+
$this->_is_multisite_storage ?
|
137 |
+
true :
|
138 |
+
( $this->_blog_id > 0 ? $this->_blog_id : false )
|
139 |
+
);
|
140 |
+
}
|
141 |
+
|
142 |
+
protected function get_all_data() {
|
143 |
+
return $this->get_option_manager()->get_option( $this->_id, array() );
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Load plugin data from local DB.
|
148 |
+
*
|
149 |
+
* @author Vova Feldman (@svovaf)
|
150 |
+
* @since 1.0.7
|
151 |
+
*/
|
152 |
+
function load() {
|
153 |
+
$all_plugins_data = $this->get_all_data();
|
154 |
+
$this->_data = isset( $all_plugins_data[ $this->_secondary_id ] ) ?
|
155 |
+
$all_plugins_data[ $this->_secondary_id ] :
|
156 |
+
array();
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @author Vova Feldman (@svovaf)
|
161 |
+
* @since 1.0.7
|
162 |
+
*
|
163 |
+
* @param string $key
|
164 |
+
* @param mixed $value
|
165 |
+
* @param bool $flush
|
166 |
+
*/
|
167 |
+
function store( $key, $value, $flush = true ) {
|
168 |
+
if ( $this->_logger->is_on() ) {
|
169 |
+
$this->_logger->entrance( $key . ' = ' . var_export( $value, true ) );
|
170 |
+
}
|
171 |
+
|
172 |
+
if ( array_key_exists( $key, $this->_data ) && $value === $this->_data[ $key ] ) {
|
173 |
+
// No need to store data if the value wasn't changed.
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
|
177 |
+
$all_data = $this->get_all_data();
|
178 |
+
|
179 |
+
$this->_data[ $key ] = $value;
|
180 |
+
|
181 |
+
$all_data[ $this->_secondary_id ] = $this->_data;
|
182 |
+
|
183 |
+
$options_manager = $this->get_option_manager();
|
184 |
+
$options_manager->set_option( $this->_id, $all_data, $flush );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* @author Vova Feldman (@svovaf)
|
189 |
+
* @since 2.0.0
|
190 |
+
*/
|
191 |
+
function save() {
|
192 |
+
$this->get_option_manager()->store();
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @author Vova Feldman (@svovaf)
|
197 |
+
* @since 1.0.7
|
198 |
+
*
|
199 |
+
* @param bool $store
|
200 |
+
* @param string[] $exceptions Set of keys to keep and not clear.
|
201 |
+
*/
|
202 |
+
function clear_all( $store = true, $exceptions = array() ) {
|
203 |
+
$new_data = array();
|
204 |
+
foreach ( $exceptions as $key ) {
|
205 |
+
if ( isset( $this->_data[ $key ] ) ) {
|
206 |
+
$new_data[ $key ] = $this->_data[ $key ];
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
$this->_data = $new_data;
|
211 |
+
|
212 |
+
if ( $store ) {
|
213 |
+
$all_data = $this->get_all_data();
|
214 |
+
$all_data[ $this->_secondary_id ] = $this->_data;
|
215 |
+
$options_manager = $this->get_option_manager();
|
216 |
+
$options_manager->set_option( $this->_id, $all_data, true );
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Delete key-value storage.
|
222 |
+
*
|
223 |
+
* @author Vova Feldman (@svovaf)
|
224 |
+
* @since 1.0.9
|
225 |
+
*/
|
226 |
+
function delete() {
|
227 |
+
$this->_data = array();
|
228 |
+
|
229 |
+
$all_data = $this->get_all_data();
|
230 |
+
unset( $all_data[ $this->_secondary_id ] );
|
231 |
+
$options_manager = $this->get_option_manager();
|
232 |
+
$options_manager->set_option( $this->_id, $all_data, true );
|
233 |
+
}
|
234 |
+
|
235 |
+
/**
|
236 |
+
* @author Vova Feldman (@svovaf)
|
237 |
+
* @since 1.0.7
|
238 |
+
*
|
239 |
+
* @param string $key
|
240 |
+
* @param bool $store
|
241 |
+
*/
|
242 |
+
function remove( $key, $store = true ) {
|
243 |
+
if ( ! array_key_exists( $key, $this->_data ) ) {
|
244 |
+
return;
|
245 |
+
}
|
246 |
+
|
247 |
+
unset( $this->_data[ $key ] );
|
248 |
+
|
249 |
+
if ( $store ) {
|
250 |
+
$all_data = $this->get_all_data();
|
251 |
+
$all_data[ $this->_secondary_id ] = $this->_data;
|
252 |
+
$options_manager = $this->get_option_manager();
|
253 |
+
$options_manager->set_option( $this->_id, $all_data, true );
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @author Vova Feldman (@svovaf)
|
259 |
+
* @since 1.0.7
|
260 |
+
*
|
261 |
+
* @param string $key
|
262 |
+
* @param mixed $default
|
263 |
+
*
|
264 |
+
* @return bool|\FS_Plugin
|
265 |
+
*/
|
266 |
+
function get( $key, $default = false ) {
|
267 |
+
return array_key_exists( $key, $this->_data ) ?
|
268 |
+
$this->_data[ $key ] :
|
269 |
+
$default;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* @author Vova Feldman (@svovaf)
|
274 |
+
* @since 2.0.0
|
275 |
+
*
|
276 |
+
* @return string
|
277 |
+
*/
|
278 |
+
function get_secondary_id() {
|
279 |
+
return $this->_secondary_id;
|
280 |
+
}
|
281 |
+
|
282 |
+
|
283 |
+
/* ArrayAccess + Magic Access (better for refactoring)
|
284 |
+
-----------------------------------------------------------------------------------*/
|
285 |
+
function __set( $k, $v ) {
|
286 |
+
$this->store( $k, $v );
|
287 |
+
}
|
288 |
+
|
289 |
+
function __isset( $k ) {
|
290 |
+
return array_key_exists( $k, $this->_data );
|
291 |
+
}
|
292 |
+
|
293 |
+
function __unset( $k ) {
|
294 |
+
$this->remove( $k );
|
295 |
+
}
|
296 |
+
|
297 |
+
function __get( $k ) {
|
298 |
+
return $this->get( $k, null );
|
299 |
+
}
|
300 |
+
|
301 |
+
#[ReturnTypeWillChange]
|
302 |
+
function offsetSet( $k, $v ) {
|
303 |
+
if ( is_null( $k ) ) {
|
304 |
+
throw new Exception( 'Can\'t append value to request params.' );
|
305 |
+
} else {
|
306 |
+
$this->{$k} = $v;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
#[ReturnTypeWillChange]
|
311 |
+
function offsetExists( $k ) {
|
312 |
+
return array_key_exists( $k, $this->_data );
|
313 |
+
}
|
314 |
+
|
315 |
+
#[ReturnTypeWillChange]
|
316 |
+
function offsetUnset( $k ) {
|
317 |
+
unset( $this->$k );
|
318 |
+
}
|
319 |
+
|
320 |
+
#[ReturnTypeWillChange]
|
321 |
+
function offsetGet( $k ) {
|
322 |
+
return $this->get( $k, null );
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* (PHP 5 >= 5.0.0)<br/>
|
327 |
+
* Return the current element
|
328 |
+
*
|
329 |
+
* @link http://php.net/manual/en/iterator.current.php
|
330 |
+
* @return mixed Can return any type.
|
331 |
+
*/
|
332 |
+
#[ReturnTypeWillChange]
|
333 |
+
public function current() {
|
334 |
+
return current( $this->_data );
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* (PHP 5 >= 5.0.0)<br/>
|
339 |
+
* Move forward to next element
|
340 |
+
*
|
341 |
+
* @link http://php.net/manual/en/iterator.next.php
|
342 |
+
* @return void Any returned value is ignored.
|
343 |
+
*/
|
344 |
+
#[ReturnTypeWillChange]
|
345 |
+
public function next() {
|
346 |
+
next( $this->_data );
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* (PHP 5 >= 5.0.0)<br/>
|
351 |
+
* Return the key of the current element
|
352 |
+
*
|
353 |
+
* @link http://php.net/manual/en/iterator.key.php
|
354 |
+
* @return mixed scalar on success, or null on failure.
|
355 |
+
*/
|
356 |
+
#[ReturnTypeWillChange]
|
357 |
+
public function key() {
|
358 |
+
return key( $this->_data );
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* (PHP 5 >= 5.0.0)<br/>
|
363 |
+
* Checks if current position is valid
|
364 |
+
*
|
365 |
+
* @link http://php.net/manual/en/iterator.valid.php
|
366 |
+
* @return boolean The return value will be casted to boolean and then evaluated.
|
367 |
+
* Returns true on success or false on failure.
|
368 |
+
*/
|
369 |
+
#[ReturnTypeWillChange]
|
370 |
+
public function valid() {
|
371 |
+
$key = key( $this->_data );
|
372 |
+
|
373 |
+
return ( $key !== null && $key !== false );
|
374 |
+
}
|
375 |
+
|
376 |
+
/**
|
377 |
+
* (PHP 5 >= 5.0.0)<br/>
|
378 |
+
* Rewind the Iterator to the first element
|
379 |
+
*
|
380 |
+
* @link http://php.net/manual/en/iterator.rewind.php
|
381 |
+
* @return void Any returned value is ignored.
|
382 |
+
*/
|
383 |
+
#[ReturnTypeWillChange]
|
384 |
+
public function rewind() {
|
385 |
+
reset( $this->_data );
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* (PHP 5 >= 5.1.0)<br/>
|
390 |
+
* Count elements of an object
|
391 |
+
*
|
392 |
+
* @link http://php.net/manual/en/countable.count.php
|
393 |
+
* @return int The custom count as an integer.
|
394 |
+
* </p>
|
395 |
+
* <p>
|
396 |
+
* The return value is cast to an integer.
|
397 |
+
*/
|
398 |
+
#[ReturnTypeWillChange]
|
399 |
+
public function count() {
|
400 |
+
return count( $this->_data );
|
401 |
+
}
|
402 |
}
|
lib/freemius/includes/managers/class-fs-license-manager.php
CHANGED
@@ -1,104 +1,104 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_License_Manager /*extends FS_Abstract_Manager*/
|
14 |
-
{
|
15 |
-
//
|
16 |
-
//
|
17 |
-
// /**
|
18 |
-
// * @var FS_License_Manager[]
|
19 |
-
// */
|
20 |
-
// private static $_instances = array();
|
21 |
-
//
|
22 |
-
// static function instance( Freemius $fs ) {
|
23 |
-
// $slug = strtolower( $fs->get_slug() );
|
24 |
-
//
|
25 |
-
// if ( ! isset( self::$_instances[ $slug ] ) ) {
|
26 |
-
// self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
|
27 |
-
// }
|
28 |
-
//
|
29 |
-
// return self::$_instances[ $slug ];
|
30 |
-
// }
|
31 |
-
//
|
32 |
-
//// private function __construct($slug) {
|
33 |
-
//// parent::__construct($slug);
|
34 |
-
//// }
|
35 |
-
//
|
36 |
-
// function entry_id() {
|
37 |
-
// return 'licenses';
|
38 |
-
// }
|
39 |
-
//
|
40 |
-
// function sync( $id ) {
|
41 |
-
//
|
42 |
-
// }
|
43 |
-
//
|
44 |
-
// /**
|
45 |
-
// * @author Vova Feldman (@svovaf)
|
46 |
-
// * @since 1.0.5
|
47 |
-
// * @uses FS_Api
|
48 |
-
// *
|
49 |
-
// * @param number|bool $plugin_id
|
50 |
-
// *
|
51 |
-
// * @return FS_Plugin_License[]|stdClass Licenses or API error.
|
52 |
-
// */
|
53 |
-
// function api_get_user_plugin_licenses( $plugin_id = false ) {
|
54 |
-
// $api = $this->_fs->get_api_user_scope();
|
55 |
-
//
|
56 |
-
// if ( ! is_numeric( $plugin_id ) ) {
|
57 |
-
// $plugin_id = $this->_fs->get_id();
|
58 |
-
// }
|
59 |
-
//
|
60 |
-
// $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
|
61 |
-
//
|
62 |
-
// if ( ! isset( $result->error ) ) {
|
63 |
-
// for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
|
64 |
-
// $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
|
65 |
-
// }
|
66 |
-
//
|
67 |
-
// $result = $result->licenses;
|
68 |
-
// }
|
69 |
-
//
|
70 |
-
// return $result;
|
71 |
-
// }
|
72 |
-
//
|
73 |
-
// function api_get_many() {
|
74 |
-
//
|
75 |
-
// }
|
76 |
-
//
|
77 |
-
// function api_activate( $id ) {
|
78 |
-
//
|
79 |
-
// }
|
80 |
-
//
|
81 |
-
// function api_deactivate( $id ) {
|
82 |
-
//
|
83 |
-
// }
|
84 |
-
|
85 |
-
/**
|
86 |
-
* @param FS_Plugin_License[] $licenses
|
87 |
-
*
|
88 |
-
* @return bool
|
89 |
-
*/
|
90 |
-
static function has_premium_license( $licenses ) {
|
91 |
-
if ( is_array( $licenses ) ) {
|
92 |
-
foreach ( $licenses as $license ) {
|
93 |
-
/**
|
94 |
-
* @var FS_Plugin_License $license
|
95 |
-
*/
|
96 |
-
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
|
97 |
-
return true;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
return false;
|
103 |
-
}
|
104 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_License_Manager /*extends FS_Abstract_Manager*/
|
14 |
+
{
|
15 |
+
//
|
16 |
+
//
|
17 |
+
// /**
|
18 |
+
// * @var FS_License_Manager[]
|
19 |
+
// */
|
20 |
+
// private static $_instances = array();
|
21 |
+
//
|
22 |
+
// static function instance( Freemius $fs ) {
|
23 |
+
// $slug = strtolower( $fs->get_slug() );
|
24 |
+
//
|
25 |
+
// if ( ! isset( self::$_instances[ $slug ] ) ) {
|
26 |
+
// self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
|
27 |
+
// }
|
28 |
+
//
|
29 |
+
// return self::$_instances[ $slug ];
|
30 |
+
// }
|
31 |
+
//
|
32 |
+
//// private function __construct($slug) {
|
33 |
+
//// parent::__construct($slug);
|
34 |
+
//// }
|
35 |
+
//
|
36 |
+
// function entry_id() {
|
37 |
+
// return 'licenses';
|
38 |
+
// }
|
39 |
+
//
|
40 |
+
// function sync( $id ) {
|
41 |
+
//
|
42 |
+
// }
|
43 |
+
//
|
44 |
+
// /**
|
45 |
+
// * @author Vova Feldman (@svovaf)
|
46 |
+
// * @since 1.0.5
|
47 |
+
// * @uses FS_Api
|
48 |
+
// *
|
49 |
+
// * @param number|bool $plugin_id
|
50 |
+
// *
|
51 |
+
// * @return FS_Plugin_License[]|stdClass Licenses or API error.
|
52 |
+
// */
|
53 |
+
// function api_get_user_plugin_licenses( $plugin_id = false ) {
|
54 |
+
// $api = $this->_fs->get_api_user_scope();
|
55 |
+
//
|
56 |
+
// if ( ! is_numeric( $plugin_id ) ) {
|
57 |
+
// $plugin_id = $this->_fs->get_id();
|
58 |
+
// }
|
59 |
+
//
|
60 |
+
// $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
|
61 |
+
//
|
62 |
+
// if ( ! isset( $result->error ) ) {
|
63 |
+
// for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
|
64 |
+
// $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
|
65 |
+
// }
|
66 |
+
//
|
67 |
+
// $result = $result->licenses;
|
68 |
+
// }
|
69 |
+
//
|
70 |
+
// return $result;
|
71 |
+
// }
|
72 |
+
//
|
73 |
+
// function api_get_many() {
|
74 |
+
//
|
75 |
+
// }
|
76 |
+
//
|
77 |
+
// function api_activate( $id ) {
|
78 |
+
//
|
79 |
+
// }
|
80 |
+
//
|
81 |
+
// function api_deactivate( $id ) {
|
82 |
+
//
|
83 |
+
// }
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param FS_Plugin_License[] $licenses
|
87 |
+
*
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
static function has_premium_license( $licenses ) {
|
91 |
+
if ( is_array( $licenses ) ) {
|
92 |
+
foreach ( $licenses as $license ) {
|
93 |
+
/**
|
94 |
+
* @var FS_Plugin_License $license
|
95 |
+
*/
|
96 |
+
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
|
97 |
+
return true;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
return false;
|
103 |
+
}
|
104 |
}
|
lib/freemius/includes/managers/class-fs-option-manager.php
CHANGED
@@ -1,521 +1,521 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* 3-layer lazy options manager.
|
15 |
-
* layer 3: Memory
|
16 |
-
* layer 2: Cache (if there's any caching plugin and if WP_FS__DEBUG_SDK is FALSE)
|
17 |
-
* layer 1: Database (options table). All options stored as one option record in the DB to reduce number of DB
|
18 |
-
* queries.
|
19 |
-
*
|
20 |
-
* If load() is not explicitly called, starts as empty manager. Same thing about saving the data - you have to
|
21 |
-
* explicitly call store().
|
22 |
-
*
|
23 |
-
* Class Freemius_Option_Manager
|
24 |
-
*/
|
25 |
-
class FS_Option_Manager {
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
private $_id;
|
30 |
-
/**
|
31 |
-
* @var array|object
|
32 |
-
*/
|
33 |
-
private $_options;
|
34 |
-
/**
|
35 |
-
* @var FS_Logger
|
36 |
-
*/
|
37 |
-
private $_logger;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @since 2.0.0
|
41 |
-
* @var int The ID of the blog that is associated with the current site level options.
|
42 |
-
*/
|
43 |
-
private $_blog_id = 0;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @since 2.0.0
|
47 |
-
* @var bool
|
48 |
-
*/
|
49 |
-
private $_is_network_storage;
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var bool|null
|
53 |
-
*/
|
54 |
-
private $_autoload;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var array[string]FS_Option_Manager {
|
58 |
-
* @key string
|
59 |
-
* @value FS_Option_Manager
|
60 |
-
* }
|
61 |
-
*/
|
62 |
-
private static $_MANAGERS = array();
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @author Vova Feldman (@svovaf)
|
66 |
-
* @since 1.0.3
|
67 |
-
*
|
68 |
-
* @param string $id
|
69 |
-
* @param bool $load
|
70 |
-
* @param bool|int $network_level_or_blog_id Since 2.0.0
|
71 |
-
* @param bool|null $autoload
|
72 |
-
*/
|
73 |
-
private function __construct(
|
74 |
-
$id,
|
75 |
-
$load = false,
|
76 |
-
$network_level_or_blog_id = false,
|
77 |
-
$autoload = null
|
78 |
-
) {
|
79 |
-
$id = strtolower( $id );
|
80 |
-
|
81 |
-
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
82 |
-
|
83 |
-
$this->_logger->entrance();
|
84 |
-
$this->_logger->log( 'id = ' . $id );
|
85 |
-
|
86 |
-
$this->_id = $id;
|
87 |
-
|
88 |
-
$this->_autoload = $autoload;
|
89 |
-
|
90 |
-
if ( is_multisite() ) {
|
91 |
-
$this->_is_network_storage = ( true === $network_level_or_blog_id );
|
92 |
-
|
93 |
-
if ( is_numeric( $network_level_or_blog_id ) ) {
|
94 |
-
$this->_blog_id = $network_level_or_blog_id;
|
95 |
-
}
|
96 |
-
} else {
|
97 |
-
$this->_is_network_storage = false;
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( $load ) {
|
101 |
-
$this->load();
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* @author Vova Feldman (@svovaf)
|
107 |
-
* @since 1.0.3
|
108 |
-
*
|
109 |
-
* @param string $id
|
110 |
-
* @param bool $load
|
111 |
-
* @param bool|int $network_level_or_blog_id Since 2.0.0
|
112 |
-
* @param bool|null $autoload
|
113 |
-
*
|
114 |
-
* @return \FS_Option_Manager
|
115 |
-
*/
|
116 |
-
static function get_manager(
|
117 |
-
$id,
|
118 |
-
$load = false,
|
119 |
-
$network_level_or_blog_id = false,
|
120 |
-
$autoload = null
|
121 |
-
) {
|
122 |
-
$key = strtolower( $id );
|
123 |
-
|
124 |
-
if ( is_multisite() ) {
|
125 |
-
if ( true === $network_level_or_blog_id ) {
|
126 |
-
$key .= ':ms';
|
127 |
-
} else if ( is_numeric( $network_level_or_blog_id ) && $network_level_or_blog_id > 0 ) {
|
128 |
-
$key .= ":{$network_level_or_blog_id}";
|
129 |
-
} else {
|
130 |
-
$network_level_or_blog_id = get_current_blog_id();
|
131 |
-
|
132 |
-
$key .= ":{$network_level_or_blog_id}";
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
if ( ! isset( self::$_MANAGERS[ $key ] ) ) {
|
137 |
-
self::$_MANAGERS[ $key ] = new FS_Option_Manager(
|
138 |
-
$id,
|
139 |
-
$load,
|
140 |
-
$network_level_or_blog_id,
|
141 |
-
$autoload
|
142 |
-
);
|
143 |
-
} // If load required but not yet loaded, load.
|
144 |
-
else if ( $load && ! self::$_MANAGERS[ $key ]->is_loaded() ) {
|
145 |
-
self::$_MANAGERS[ $key ]->load();
|
146 |
-
}
|
147 |
-
|
148 |
-
return self::$_MANAGERS[ $key ];
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* @author Vova Feldman (@svovaf)
|
153 |
-
* @since 1.0.3
|
154 |
-
*
|
155 |
-
* @param bool $flush
|
156 |
-
*/
|
157 |
-
function load( $flush = false ) {
|
158 |
-
$this->_logger->entrance();
|
159 |
-
|
160 |
-
$option_name = $this->get_option_manager_name();
|
161 |
-
|
162 |
-
if ( $flush || ! isset( $this->_options ) ) {
|
163 |
-
if ( isset( $this->_options ) ) {
|
164 |
-
// Clear prev options.
|
165 |
-
$this->clear();
|
166 |
-
}
|
167 |
-
|
168 |
-
$cache_group = $this->get_cache_group();
|
169 |
-
|
170 |
-
if ( WP_FS__DEBUG_SDK ) {
|
171 |
-
|
172 |
-
// Don't use cache layer in DEBUG mode.
|
173 |
-
$load_options = empty( $this->_options );
|
174 |
-
|
175 |
-
} else {
|
176 |
-
|
177 |
-
$this->_options = wp_cache_get(
|
178 |
-
$option_name,
|
179 |
-
$cache_group
|
180 |
-
);
|
181 |
-
|
182 |
-
$load_options = ( false === $this->_options );
|
183 |
-
}
|
184 |
-
|
185 |
-
$cached = true;
|
186 |
-
|
187 |
-
if ( $load_options ) {
|
188 |
-
if ( $this->_is_network_storage ) {
|
189 |
-
$this->_options = get_site_option( $option_name );
|
190 |
-
} else if ( $this->_blog_id > 0 ) {
|
191 |
-
$this->_options = get_blog_option( $this->_blog_id, $option_name );
|
192 |
-
} else {
|
193 |
-
$this->_options = get_option( $option_name );
|
194 |
-
}
|
195 |
-
|
196 |
-
if ( is_string( $this->_options ) ) {
|
197 |
-
$this->_options = json_decode( $this->_options );
|
198 |
-
}
|
199 |
-
|
200 |
-
// $this->_logger->info('get_option = ' . var_export($this->_options, true));
|
201 |
-
|
202 |
-
if ( false === $this->_options ) {
|
203 |
-
$this->clear();
|
204 |
-
}
|
205 |
-
|
206 |
-
$cached = false;
|
207 |
-
}
|
208 |
-
|
209 |
-
if ( ! WP_FS__DEBUG_SDK && ! $cached ) {
|
210 |
-
// Set non encoded cache.
|
211 |
-
wp_cache_set( $option_name, $this->_options, $cache_group );
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
/**
|
217 |
-
* @author Vova Feldman (@svovaf)
|
218 |
-
* @since 1.0.3
|
219 |
-
*
|
220 |
-
* @return bool
|
221 |
-
*/
|
222 |
-
function is_loaded() {
|
223 |
-
return isset( $this->_options );
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* @author Vova Feldman (@svovaf)
|
228 |
-
* @since 1.0.3
|
229 |
-
*
|
230 |
-
* @return bool
|
231 |
-
*/
|
232 |
-
function is_empty() {
|
233 |
-
return ( $this->is_loaded() && false === $this->_options );
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* @author Vova Feldman (@svovaf)
|
238 |
-
* @since 1.0.6
|
239 |
-
*
|
240 |
-
* @param bool $flush
|
241 |
-
*/
|
242 |
-
function clear( $flush = false ) {
|
243 |
-
$this->_logger->entrance();
|
244 |
-
|
245 |
-
$this->_options = array();
|
246 |
-
|
247 |
-
if ( $flush ) {
|
248 |
-
$this->store();
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Delete options manager from DB.
|
254 |
-
*
|
255 |
-
* @author Vova Feldman (@svovaf)
|
256 |
-
* @since 1.0.9
|
257 |
-
*/
|
258 |
-
function delete() {
|
259 |
-
$option_name = $this->get_option_manager_name();
|
260 |
-
|
261 |
-
if ( $this->_is_network_storage ) {
|
262 |
-
delete_site_option( $option_name );
|
263 |
-
} else if ( $this->_blog_id > 0 ) {
|
264 |
-
delete_blog_option( $this->_blog_id, $option_name );
|
265 |
-
} else {
|
266 |
-
delete_option( $option_name );
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* @author Vova Feldman (@svovaf)
|
272 |
-
* @since 1.0.6
|
273 |
-
*
|
274 |
-
* @param string $option
|
275 |
-
*
|
276 |
-
* @return bool
|
277 |
-
*/
|
278 |
-
function has_option( $option ) {
|
279 |
-
return array_key_exists( $option, $this->_options );
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* @author Vova Feldman (@svovaf)
|
284 |
-
* @since 1.0.3
|
285 |
-
*
|
286 |
-
* @param string $option
|
287 |
-
* @param mixed $default
|
288 |
-
*
|
289 |
-
* @return mixed
|
290 |
-
*/
|
291 |
-
function get_option( $option, $default = null ) {
|
292 |
-
$this->_logger->entrance( 'option = ' . $option );
|
293 |
-
|
294 |
-
if ( ! $this->is_loaded() ) {
|
295 |
-
$this->load();
|
296 |
-
}
|
297 |
-
|
298 |
-
if ( is_array( $this->_options ) ) {
|
299 |
-
$value = isset( $this->_options[ $option ] ) ?
|
300 |
-
$this->_options[ $option ] :
|
301 |
-
$default;
|
302 |
-
} else if ( is_object( $this->_options ) ) {
|
303 |
-
$value = isset( $this->_options->{$option} ) ?
|
304 |
-
$this->_options->{$option} :
|
305 |
-
$default;
|
306 |
-
} else {
|
307 |
-
$value = $default;
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* If it's an object, return a clone of the object, otherwise,
|
312 |
-
* external changes of the object will actually change the value
|
313 |
-
* of the object in the options manager which may lead to an unexpected
|
314 |
-
* behaviour and data integrity when a store() call is triggered.
|
315 |
-
*
|
316 |
-
* Example:
|
317 |
-
* $object1 = $options->get_option( 'object1' );
|
318 |
-
* $object1->x = 123;
|
319 |
-
*
|
320 |
-
* $object2 = $options->get_option( 'object2' );
|
321 |
-
* $object2->y = 'dummy';
|
322 |
-
*
|
323 |
-
* $options->set_option( 'object2', $object2, true );
|
324 |
-
*
|
325 |
-
* If we don't return a clone of option 'object1', setting 'object2'
|
326 |
-
* will also store the updated value of 'object1' which is quite not
|
327 |
-
* an expected behaviour.
|
328 |
-
*
|
329 |
-
* @author Vova Feldman
|
330 |
-
*/
|
331 |
-
return is_object( $value ) ? clone $value : $value;
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* @author Vova Feldman (@svovaf)
|
336 |
-
* @since 1.0.3
|
337 |
-
*
|
338 |
-
* @param string $option
|
339 |
-
* @param mixed $value
|
340 |
-
* @param bool $flush
|
341 |
-
*/
|
342 |
-
function set_option( $option, $value, $flush = false ) {
|
343 |
-
$this->_logger->entrance( 'option = ' . $option );
|
344 |
-
|
345 |
-
if ( ! $this->is_loaded() ) {
|
346 |
-
$this->clear();
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* If it's an object, store a clone of the object, otherwise,
|
351 |
-
* external changes of the object will actually change the value
|
352 |
-
* of the object in the options manager which may lead to an unexpected
|
353 |
-
* behaviour and data integrity when a store() call is triggered.
|
354 |
-
*
|
355 |
-
* Example:
|
356 |
-
* $object1 = new stdClass();
|
357 |
-
* $object1->x = 123;
|
358 |
-
*
|
359 |
-
* $options->set_option( 'object1', $object1 );
|
360 |
-
*
|
361 |
-
* $object1->x = 456;
|
362 |
-
*
|
363 |
-
* $options->set_option( 'object2', $object2, true );
|
364 |
-
*
|
365 |
-
* If we don't set the option as a clone of option 'object1', setting 'object2'
|
366 |
-
* will also store the updated value of 'object1' ($object1->x = 456 instead of
|
367 |
-
* $object1->x = 123) which is quite not an expected behaviour.
|
368 |
-
*
|
369 |
-
* @author Vova Feldman
|
370 |
-
*/
|
371 |
-
$copy = is_object( $value ) ? clone $value : $value;
|
372 |
-
|
373 |
-
if ( is_array( $this->_options ) ) {
|
374 |
-
$this->_options[ $option ] = $copy;
|
375 |
-
} else if ( is_object( $this->_options ) ) {
|
376 |
-
$this->_options->{$option} = $copy;
|
377 |
-
}
|
378 |
-
|
379 |
-
if ( $flush ) {
|
380 |
-
$this->store();
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Unset option.
|
386 |
-
*
|
387 |
-
* @author Vova Feldman (@svovaf)
|
388 |
-
* @since 1.0.3
|
389 |
-
*
|
390 |
-
* @param string $option
|
391 |
-
* @param bool $flush
|
392 |
-
*/
|
393 |
-
function unset_option( $option, $flush = false ) {
|
394 |
-
$this->_logger->entrance( 'option = ' . $option );
|
395 |
-
|
396 |
-
if ( is_array( $this->_options ) ) {
|
397 |
-
if ( ! isset( $this->_options[ $option ] ) ) {
|
398 |
-
return;
|
399 |
-
}
|
400 |
-
|
401 |
-
unset( $this->_options[ $option ] );
|
402 |
-
|
403 |
-
} else if ( is_object( $this->_options ) ) {
|
404 |
-
if ( ! isset( $this->_options->{$option} ) ) {
|
405 |
-
return;
|
406 |
-
}
|
407 |
-
|
408 |
-
unset( $this->_options->{$option} );
|
409 |
-
}
|
410 |
-
|
411 |
-
if ( $flush ) {
|
412 |
-
$this->store();
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
/**
|
417 |
-
* Dump options to database.
|
418 |
-
*
|
419 |
-
* @author Vova Feldman (@svovaf)
|
420 |
-
* @since 1.0.3
|
421 |
-
*/
|
422 |
-
function store() {
|
423 |
-
$this->_logger->entrance();
|
424 |
-
|
425 |
-
$option_name = $this->get_option_manager_name();
|
426 |
-
|
427 |
-
if ( $this->_logger->is_on() ) {
|
428 |
-
$this->_logger->info( $option_name . ' = ' . var_export( $this->_options, true ) );
|
429 |
-
}
|
430 |
-
|
431 |
-
// Update DB.
|
432 |
-
if ( $this->_is_network_storage ) {
|
433 |
-
update_site_option( $option_name, $this->_options );
|
434 |
-
} else if ( $this->_blog_id > 0 ) {
|
435 |
-
update_blog_option( $this->_blog_id, $option_name, $this->_options );
|
436 |
-
} else {
|
437 |
-
update_option( $option_name, $this->_options, $this->_autoload );
|
438 |
-
}
|
439 |
-
|
440 |
-
if ( ! WP_FS__DEBUG_SDK ) {
|
441 |
-
wp_cache_set( $option_name, $this->_options, $this->get_cache_group() );
|
442 |
-
}
|
443 |
-
}
|
444 |
-
|
445 |
-
/**
|
446 |
-
* Get options keys.
|
447 |
-
*
|
448 |
-
* @author Vova Feldman (@svovaf)
|
449 |
-
* @since 1.0.3
|
450 |
-
*
|
451 |
-
* @return string[]
|
452 |
-
*/
|
453 |
-
function get_options_keys() {
|
454 |
-
if ( is_array( $this->_options ) ) {
|
455 |
-
return array_keys( $this->_options );
|
456 |
-
} else if ( is_object( $this->_options ) ) {
|
457 |
-
return array_keys( get_object_vars( $this->_options ) );
|
458 |
-
}
|
459 |
-
|
460 |
-
return array();
|
461 |
-
}
|
462 |
-
|
463 |
-
#--------------------------------------------------------------------------------
|
464 |
-
#region Migration
|
465 |
-
#--------------------------------------------------------------------------------
|
466 |
-
|
467 |
-
/**
|
468 |
-
* Migrate options from site level.
|
469 |
-
*
|
470 |
-
* @author Vova Feldman (@svovaf)
|
471 |
-
* @since 2.0.0
|
472 |
-
*/
|
473 |
-
function migrate_to_network() {
|
474 |
-
$site_options = FS_Option_Manager::get_manager($this->_id, true, false);
|
475 |
-
|
476 |
-
$options = is_object( $site_options->_options ) ?
|
477 |
-
get_object_vars( $site_options->_options ) :
|
478 |
-
$site_options->_options;
|
479 |
-
|
480 |
-
if ( ! empty( $options ) ) {
|
481 |
-
foreach ( $options as $key => $val ) {
|
482 |
-
$this->set_option( $key, $val, false );
|
483 |
-
}
|
484 |
-
|
485 |
-
$this->store();
|
486 |
-
}
|
487 |
-
}
|
488 |
-
|
489 |
-
#endregion
|
490 |
-
|
491 |
-
#--------------------------------------------------------------------------------
|
492 |
-
#region Helper Methods
|
493 |
-
#--------------------------------------------------------------------------------
|
494 |
-
|
495 |
-
/**
|
496 |
-
* @return string
|
497 |
-
*/
|
498 |
-
private function get_option_manager_name() {
|
499 |
-
return $this->_id;
|
500 |
-
}
|
501 |
-
|
502 |
-
/**
|
503 |
-
* @author Vova Feldman (@svovaf)
|
504 |
-
* @since 2.0.0
|
505 |
-
*
|
506 |
-
* @return string
|
507 |
-
*/
|
508 |
-
private function get_cache_group() {
|
509 |
-
$group = WP_FS__SLUG;
|
510 |
-
|
511 |
-
if ( $this->_is_network_storage ) {
|
512 |
-
$group .= '_ms';
|
513 |
-
} else if ( $this->_blog_id > 0 ) {
|
514 |
-
$group .= "_s{$this->_blog_id}";
|
515 |
-
}
|
516 |
-
|
517 |
-
return $group;
|
518 |
-
}
|
519 |
-
|
520 |
-
#endregion
|
521 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* 3-layer lazy options manager.
|
15 |
+
* layer 3: Memory
|
16 |
+
* layer 2: Cache (if there's any caching plugin and if WP_FS__DEBUG_SDK is FALSE)
|
17 |
+
* layer 1: Database (options table). All options stored as one option record in the DB to reduce number of DB
|
18 |
+
* queries.
|
19 |
+
*
|
20 |
+
* If load() is not explicitly called, starts as empty manager. Same thing about saving the data - you have to
|
21 |
+
* explicitly call store().
|
22 |
+
*
|
23 |
+
* Class Freemius_Option_Manager
|
24 |
+
*/
|
25 |
+
class FS_Option_Manager {
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
private $_id;
|
30 |
+
/**
|
31 |
+
* @var array|object
|
32 |
+
*/
|
33 |
+
private $_options;
|
34 |
+
/**
|
35 |
+
* @var FS_Logger
|
36 |
+
*/
|
37 |
+
private $_logger;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @since 2.0.0
|
41 |
+
* @var int The ID of the blog that is associated with the current site level options.
|
42 |
+
*/
|
43 |
+
private $_blog_id = 0;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @since 2.0.0
|
47 |
+
* @var bool
|
48 |
+
*/
|
49 |
+
private $_is_network_storage;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var bool|null
|
53 |
+
*/
|
54 |
+
private $_autoload;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @var array[string]FS_Option_Manager {
|
58 |
+
* @key string
|
59 |
+
* @value FS_Option_Manager
|
60 |
+
* }
|
61 |
+
*/
|
62 |
+
private static $_MANAGERS = array();
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @author Vova Feldman (@svovaf)
|
66 |
+
* @since 1.0.3
|
67 |
+
*
|
68 |
+
* @param string $id
|
69 |
+
* @param bool $load
|
70 |
+
* @param bool|int $network_level_or_blog_id Since 2.0.0
|
71 |
+
* @param bool|null $autoload
|
72 |
+
*/
|
73 |
+
private function __construct(
|
74 |
+
$id,
|
75 |
+
$load = false,
|
76 |
+
$network_level_or_blog_id = false,
|
77 |
+
$autoload = null
|
78 |
+
) {
|
79 |
+
$id = strtolower( $id );
|
80 |
+
|
81 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
82 |
+
|
83 |
+
$this->_logger->entrance();
|
84 |
+
$this->_logger->log( 'id = ' . $id );
|
85 |
+
|
86 |
+
$this->_id = $id;
|
87 |
+
|
88 |
+
$this->_autoload = $autoload;
|
89 |
+
|
90 |
+
if ( is_multisite() ) {
|
91 |
+
$this->_is_network_storage = ( true === $network_level_or_blog_id );
|
92 |
+
|
93 |
+
if ( is_numeric( $network_level_or_blog_id ) ) {
|
94 |
+
$this->_blog_id = $network_level_or_blog_id;
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$this->_is_network_storage = false;
|
98 |
+
}
|
99 |
+
|
100 |
+
if ( $load ) {
|
101 |
+
$this->load();
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @author Vova Feldman (@svovaf)
|
107 |
+
* @since 1.0.3
|
108 |
+
*
|
109 |
+
* @param string $id
|
110 |
+
* @param bool $load
|
111 |
+
* @param bool|int $network_level_or_blog_id Since 2.0.0
|
112 |
+
* @param bool|null $autoload
|
113 |
+
*
|
114 |
+
* @return \FS_Option_Manager
|
115 |
+
*/
|
116 |
+
static function get_manager(
|
117 |
+
$id,
|
118 |
+
$load = false,
|
119 |
+
$network_level_or_blog_id = false,
|
120 |
+
$autoload = null
|
121 |
+
) {
|
122 |
+
$key = strtolower( $id );
|
123 |
+
|
124 |
+
if ( is_multisite() ) {
|
125 |
+
if ( true === $network_level_or_blog_id ) {
|
126 |
+
$key .= ':ms';
|
127 |
+
} else if ( is_numeric( $network_level_or_blog_id ) && $network_level_or_blog_id > 0 ) {
|
128 |
+
$key .= ":{$network_level_or_blog_id}";
|
129 |
+
} else {
|
130 |
+
$network_level_or_blog_id = get_current_blog_id();
|
131 |
+
|
132 |
+
$key .= ":{$network_level_or_blog_id}";
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
if ( ! isset( self::$_MANAGERS[ $key ] ) ) {
|
137 |
+
self::$_MANAGERS[ $key ] = new FS_Option_Manager(
|
138 |
+
$id,
|
139 |
+
$load,
|
140 |
+
$network_level_or_blog_id,
|
141 |
+
$autoload
|
142 |
+
);
|
143 |
+
} // If load required but not yet loaded, load.
|
144 |
+
else if ( $load && ! self::$_MANAGERS[ $key ]->is_loaded() ) {
|
145 |
+
self::$_MANAGERS[ $key ]->load();
|
146 |
+
}
|
147 |
+
|
148 |
+
return self::$_MANAGERS[ $key ];
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @author Vova Feldman (@svovaf)
|
153 |
+
* @since 1.0.3
|
154 |
+
*
|
155 |
+
* @param bool $flush
|
156 |
+
*/
|
157 |
+
function load( $flush = false ) {
|
158 |
+
$this->_logger->entrance();
|
159 |
+
|
160 |
+
$option_name = $this->get_option_manager_name();
|
161 |
+
|
162 |
+
if ( $flush || ! isset( $this->_options ) ) {
|
163 |
+
if ( isset( $this->_options ) ) {
|
164 |
+
// Clear prev options.
|
165 |
+
$this->clear();
|
166 |
+
}
|
167 |
+
|
168 |
+
$cache_group = $this->get_cache_group();
|
169 |
+
|
170 |
+
if ( WP_FS__DEBUG_SDK ) {
|
171 |
+
|
172 |
+
// Don't use cache layer in DEBUG mode.
|
173 |
+
$load_options = empty( $this->_options );
|
174 |
+
|
175 |
+
} else {
|
176 |
+
|
177 |
+
$this->_options = wp_cache_get(
|
178 |
+
$option_name,
|
179 |
+
$cache_group
|
180 |
+
);
|
181 |
+
|
182 |
+
$load_options = ( false === $this->_options );
|
183 |
+
}
|
184 |
+
|
185 |
+
$cached = true;
|
186 |
+
|
187 |
+
if ( $load_options ) {
|
188 |
+
if ( $this->_is_network_storage ) {
|
189 |
+
$this->_options = get_site_option( $option_name );
|
190 |
+
} else if ( $this->_blog_id > 0 ) {
|
191 |
+
$this->_options = get_blog_option( $this->_blog_id, $option_name );
|
192 |
+
} else {
|
193 |
+
$this->_options = get_option( $option_name );
|
194 |
+
}
|
195 |
+
|
196 |
+
if ( is_string( $this->_options ) ) {
|
197 |
+
$this->_options = json_decode( $this->_options );
|
198 |
+
}
|
199 |
+
|
200 |
+
// $this->_logger->info('get_option = ' . var_export($this->_options, true));
|
201 |
+
|
202 |
+
if ( false === $this->_options ) {
|
203 |
+
$this->clear();
|
204 |
+
}
|
205 |
+
|
206 |
+
$cached = false;
|
207 |
+
}
|
208 |
+
|
209 |
+
if ( ! WP_FS__DEBUG_SDK && ! $cached ) {
|
210 |
+
// Set non encoded cache.
|
211 |
+
wp_cache_set( $option_name, $this->_options, $cache_group );
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* @author Vova Feldman (@svovaf)
|
218 |
+
* @since 1.0.3
|
219 |
+
*
|
220 |
+
* @return bool
|
221 |
+
*/
|
222 |
+
function is_loaded() {
|
223 |
+
return isset( $this->_options );
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* @author Vova Feldman (@svovaf)
|
228 |
+
* @since 1.0.3
|
229 |
+
*
|
230 |
+
* @return bool
|
231 |
+
*/
|
232 |
+
function is_empty() {
|
233 |
+
return ( $this->is_loaded() && false === $this->_options );
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* @author Vova Feldman (@svovaf)
|
238 |
+
* @since 1.0.6
|
239 |
+
*
|
240 |
+
* @param bool $flush
|
241 |
+
*/
|
242 |
+
function clear( $flush = false ) {
|
243 |
+
$this->_logger->entrance();
|
244 |
+
|
245 |
+
$this->_options = array();
|
246 |
+
|
247 |
+
if ( $flush ) {
|
248 |
+
$this->store();
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Delete options manager from DB.
|
254 |
+
*
|
255 |
+
* @author Vova Feldman (@svovaf)
|
256 |
+
* @since 1.0.9
|
257 |
+
*/
|
258 |
+
function delete() {
|
259 |
+
$option_name = $this->get_option_manager_name();
|
260 |
+
|
261 |
+
if ( $this->_is_network_storage ) {
|
262 |
+
delete_site_option( $option_name );
|
263 |
+
} else if ( $this->_blog_id > 0 ) {
|
264 |
+
delete_blog_option( $this->_blog_id, $option_name );
|
265 |
+
} else {
|
266 |
+
delete_option( $option_name );
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
/**
|
271 |
+
* @author Vova Feldman (@svovaf)
|
272 |
+
* @since 1.0.6
|
273 |
+
*
|
274 |
+
* @param string $option
|
275 |
+
*
|
276 |
+
* @return bool
|
277 |
+
*/
|
278 |
+
function has_option( $option ) {
|
279 |
+
return array_key_exists( $option, $this->_options );
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* @author Vova Feldman (@svovaf)
|
284 |
+
* @since 1.0.3
|
285 |
+
*
|
286 |
+
* @param string $option
|
287 |
+
* @param mixed $default
|
288 |
+
*
|
289 |
+
* @return mixed
|
290 |
+
*/
|
291 |
+
function get_option( $option, $default = null ) {
|
292 |
+
$this->_logger->entrance( 'option = ' . $option );
|
293 |
+
|
294 |
+
if ( ! $this->is_loaded() ) {
|
295 |
+
$this->load();
|
296 |
+
}
|
297 |
+
|
298 |
+
if ( is_array( $this->_options ) ) {
|
299 |
+
$value = isset( $this->_options[ $option ] ) ?
|
300 |
+
$this->_options[ $option ] :
|
301 |
+
$default;
|
302 |
+
} else if ( is_object( $this->_options ) ) {
|
303 |
+
$value = isset( $this->_options->{$option} ) ?
|
304 |
+
$this->_options->{$option} :
|
305 |
+
$default;
|
306 |
+
} else {
|
307 |
+
$value = $default;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* If it's an object, return a clone of the object, otherwise,
|
312 |
+
* external changes of the object will actually change the value
|
313 |
+
* of the object in the options manager which may lead to an unexpected
|
314 |
+
* behaviour and data integrity when a store() call is triggered.
|
315 |
+
*
|
316 |
+
* Example:
|
317 |
+
* $object1 = $options->get_option( 'object1' );
|
318 |
+
* $object1->x = 123;
|
319 |
+
*
|
320 |
+
* $object2 = $options->get_option( 'object2' );
|
321 |
+
* $object2->y = 'dummy';
|
322 |
+
*
|
323 |
+
* $options->set_option( 'object2', $object2, true );
|
324 |
+
*
|
325 |
+
* If we don't return a clone of option 'object1', setting 'object2'
|
326 |
+
* will also store the updated value of 'object1' which is quite not
|
327 |
+
* an expected behaviour.
|
328 |
+
*
|
329 |
+
* @author Vova Feldman
|
330 |
+
*/
|
331 |
+
return is_object( $value ) ? clone $value : $value;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @author Vova Feldman (@svovaf)
|
336 |
+
* @since 1.0.3
|
337 |
+
*
|
338 |
+
* @param string $option
|
339 |
+
* @param mixed $value
|
340 |
+
* @param bool $flush
|
341 |
+
*/
|
342 |
+
function set_option( $option, $value, $flush = false ) {
|
343 |
+
$this->_logger->entrance( 'option = ' . $option );
|
344 |
+
|
345 |
+
if ( ! $this->is_loaded() ) {
|
346 |
+
$this->clear();
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* If it's an object, store a clone of the object, otherwise,
|
351 |
+
* external changes of the object will actually change the value
|
352 |
+
* of the object in the options manager which may lead to an unexpected
|
353 |
+
* behaviour and data integrity when a store() call is triggered.
|
354 |
+
*
|
355 |
+
* Example:
|
356 |
+
* $object1 = new stdClass();
|
357 |
+
* $object1->x = 123;
|
358 |
+
*
|
359 |
+
* $options->set_option( 'object1', $object1 );
|
360 |
+
*
|
361 |
+
* $object1->x = 456;
|
362 |
+
*
|
363 |
+
* $options->set_option( 'object2', $object2, true );
|
364 |
+
*
|
365 |
+
* If we don't set the option as a clone of option 'object1', setting 'object2'
|
366 |
+
* will also store the updated value of 'object1' ($object1->x = 456 instead of
|
367 |
+
* $object1->x = 123) which is quite not an expected behaviour.
|
368 |
+
*
|
369 |
+
* @author Vova Feldman
|
370 |
+
*/
|
371 |
+
$copy = is_object( $value ) ? clone $value : $value;
|
372 |
+
|
373 |
+
if ( is_array( $this->_options ) ) {
|
374 |
+
$this->_options[ $option ] = $copy;
|
375 |
+
} else if ( is_object( $this->_options ) ) {
|
376 |
+
$this->_options->{$option} = $copy;
|
377 |
+
}
|
378 |
+
|
379 |
+
if ( $flush ) {
|
380 |
+
$this->store();
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Unset option.
|
386 |
+
*
|
387 |
+
* @author Vova Feldman (@svovaf)
|
388 |
+
* @since 1.0.3
|
389 |
+
*
|
390 |
+
* @param string $option
|
391 |
+
* @param bool $flush
|
392 |
+
*/
|
393 |
+
function unset_option( $option, $flush = false ) {
|
394 |
+
$this->_logger->entrance( 'option = ' . $option );
|
395 |
+
|
396 |
+
if ( is_array( $this->_options ) ) {
|
397 |
+
if ( ! isset( $this->_options[ $option ] ) ) {
|
398 |
+
return;
|
399 |
+
}
|
400 |
+
|
401 |
+
unset( $this->_options[ $option ] );
|
402 |
+
|
403 |
+
} else if ( is_object( $this->_options ) ) {
|
404 |
+
if ( ! isset( $this->_options->{$option} ) ) {
|
405 |
+
return;
|
406 |
+
}
|
407 |
+
|
408 |
+
unset( $this->_options->{$option} );
|
409 |
+
}
|
410 |
+
|
411 |
+
if ( $flush ) {
|
412 |
+
$this->store();
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Dump options to database.
|
418 |
+
*
|
419 |
+
* @author Vova Feldman (@svovaf)
|
420 |
+
* @since 1.0.3
|
421 |
+
*/
|
422 |
+
function store() {
|
423 |
+
$this->_logger->entrance();
|
424 |
+
|
425 |
+
$option_name = $this->get_option_manager_name();
|
426 |
+
|
427 |
+
if ( $this->_logger->is_on() ) {
|
428 |
+
$this->_logger->info( $option_name . ' = ' . var_export( $this->_options, true ) );
|
429 |
+
}
|
430 |
+
|
431 |
+
// Update DB.
|
432 |
+
if ( $this->_is_network_storage ) {
|
433 |
+
update_site_option( $option_name, $this->_options );
|
434 |
+
} else if ( $this->_blog_id > 0 ) {
|
435 |
+
update_blog_option( $this->_blog_id, $option_name, $this->_options );
|
436 |
+
} else {
|
437 |
+
update_option( $option_name, $this->_options, $this->_autoload );
|
438 |
+
}
|
439 |
+
|
440 |
+
if ( ! WP_FS__DEBUG_SDK ) {
|
441 |
+
wp_cache_set( $option_name, $this->_options, $this->get_cache_group() );
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Get options keys.
|
447 |
+
*
|
448 |
+
* @author Vova Feldman (@svovaf)
|
449 |
+
* @since 1.0.3
|
450 |
+
*
|
451 |
+
* @return string[]
|
452 |
+
*/
|
453 |
+
function get_options_keys() {
|
454 |
+
if ( is_array( $this->_options ) ) {
|
455 |
+
return array_keys( $this->_options );
|
456 |
+
} else if ( is_object( $this->_options ) ) {
|
457 |
+
return array_keys( get_object_vars( $this->_options ) );
|
458 |
+
}
|
459 |
+
|
460 |
+
return array();
|
461 |
+
}
|
462 |
+
|
463 |
+
#--------------------------------------------------------------------------------
|
464 |
+
#region Migration
|
465 |
+
#--------------------------------------------------------------------------------
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Migrate options from site level.
|
469 |
+
*
|
470 |
+
* @author Vova Feldman (@svovaf)
|
471 |
+
* @since 2.0.0
|
472 |
+
*/
|
473 |
+
function migrate_to_network() {
|
474 |
+
$site_options = FS_Option_Manager::get_manager($this->_id, true, false);
|
475 |
+
|
476 |
+
$options = is_object( $site_options->_options ) ?
|
477 |
+
get_object_vars( $site_options->_options ) :
|
478 |
+
$site_options->_options;
|
479 |
+
|
480 |
+
if ( ! empty( $options ) ) {
|
481 |
+
foreach ( $options as $key => $val ) {
|
482 |
+
$this->set_option( $key, $val, false );
|
483 |
+
}
|
484 |
+
|
485 |
+
$this->store();
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
#endregion
|
490 |
+
|
491 |
+
#--------------------------------------------------------------------------------
|
492 |
+
#region Helper Methods
|
493 |
+
#--------------------------------------------------------------------------------
|
494 |
+
|
495 |
+
/**
|
496 |
+
* @return string
|
497 |
+
*/
|
498 |
+
private function get_option_manager_name() {
|
499 |
+
return $this->_id;
|
500 |
+
}
|
501 |
+
|
502 |
+
/**
|
503 |
+
* @author Vova Feldman (@svovaf)
|
504 |
+
* @since 2.0.0
|
505 |
+
*
|
506 |
+
* @return string
|
507 |
+
*/
|
508 |
+
private function get_cache_group() {
|
509 |
+
$group = WP_FS__SLUG;
|
510 |
+
|
511 |
+
if ( $this->_is_network_storage ) {
|
512 |
+
$group .= '_ms';
|
513 |
+
} else if ( $this->_blog_id > 0 ) {
|
514 |
+
$group .= "_s{$this->_blog_id}";
|
515 |
+
}
|
516 |
+
|
517 |
+
return $group;
|
518 |
+
}
|
519 |
+
|
520 |
+
#endregion
|
521 |
+
}
|
lib/freemius/includes/managers/class-fs-plan-manager.php
CHANGED
@@ -1,162 +1,162 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Plan_Manager {
|
14 |
-
/**
|
15 |
-
* @var FS_Plan_Manager
|
16 |
-
*/
|
17 |
-
private static $_instance;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @return FS_Plan_Manager
|
21 |
-
*/
|
22 |
-
static function instance() {
|
23 |
-
if ( ! isset( self::$_instance ) ) {
|
24 |
-
self::$_instance = new FS_Plan_Manager();
|
25 |
-
}
|
26 |
-
|
27 |
-
return self::$_instance;
|
28 |
-
}
|
29 |
-
|
30 |
-
private function __construct() {
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @param FS_Plugin_License[] $licenses
|
35 |
-
*
|
36 |
-
* @return bool
|
37 |
-
*/
|
38 |
-
function has_premium_license( $licenses ) {
|
39 |
-
if ( is_array( $licenses ) ) {
|
40 |
-
/**
|
41 |
-
* @var FS_Plugin_License[] $licenses
|
42 |
-
*/
|
43 |
-
foreach ( $licenses as $license ) {
|
44 |
-
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
|
45 |
-
return true;
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
return false;
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Check if plugin has any paid plans.
|
55 |
-
*
|
56 |
-
* @author Vova Feldman (@svovaf)
|
57 |
-
* @since 1.0.7
|
58 |
-
*
|
59 |
-
* @param FS_Plugin_Plan[] $plans
|
60 |
-
*
|
61 |
-
* @return bool
|
62 |
-
*/
|
63 |
-
function has_paid_plan( $plans ) {
|
64 |
-
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
65 |
-
return false;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* @var FS_Plugin_Plan[] $plans
|
70 |
-
*/
|
71 |
-
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
72 |
-
if ( ! $plans[ $i ]->is_free() ) {
|
73 |
-
return true;
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Check if plugin has any free plan, or is it premium only.
|
82 |
-
*
|
83 |
-
* Note: If no plans configured, assume plugin is free.
|
84 |
-
*
|
85 |
-
* @author Vova Feldman (@svovaf)
|
86 |
-
* @since 1.0.7
|
87 |
-
*
|
88 |
-
* @param FS_Plugin_Plan[] $plans
|
89 |
-
*
|
90 |
-
* @return bool
|
91 |
-
*/
|
92 |
-
function has_free_plan( $plans ) {
|
93 |
-
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
94 |
-
return true;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* @var FS_Plugin_Plan[] $plans
|
99 |
-
*/
|
100 |
-
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
101 |
-
if ( $plans[ $i ]->is_free() ) {
|
102 |
-
return true;
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
return false;
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Find all plans that have trial.
|
111 |
-
*
|
112 |
-
* @author Vova Feldman (@svovaf)
|
113 |
-
* @since 1.0.9
|
114 |
-
*
|
115 |
-
* @param FS_Plugin_Plan[] $plans
|
116 |
-
*
|
117 |
-
* @return FS_Plugin_Plan[]
|
118 |
-
*/
|
119 |
-
function get_trial_plans( $plans ) {
|
120 |
-
$trial_plans = array();
|
121 |
-
|
122 |
-
if ( is_array( $plans ) && 0 < count( $plans ) ) {
|
123 |
-
/**
|
124 |
-
* @var FS_Plugin_Plan[] $plans
|
125 |
-
*/
|
126 |
-
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
127 |
-
if ( $plans[ $i ]->has_trial() ) {
|
128 |
-
$trial_plans[] = $plans[ $i ];
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
return $trial_plans;
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Check if plugin has any trial plan.
|
138 |
-
*
|
139 |
-
* @author Vova Feldman (@svovaf)
|
140 |
-
* @since 1.0.9
|
141 |
-
*
|
142 |
-
* @param FS_Plugin_Plan[] $plans
|
143 |
-
*
|
144 |
-
* @return bool
|
145 |
-
*/
|
146 |
-
function has_trial_plan( $plans ) {
|
147 |
-
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
148 |
-
return true;
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* @var FS_Plugin_Plan[] $plans
|
153 |
-
*/
|
154 |
-
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
155 |
-
if ( $plans[ $i ]->has_trial() ) {
|
156 |
-
return true;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
return false;
|
161 |
-
}
|
162 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Plan_Manager {
|
14 |
+
/**
|
15 |
+
* @var FS_Plan_Manager
|
16 |
+
*/
|
17 |
+
private static $_instance;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @return FS_Plan_Manager
|
21 |
+
*/
|
22 |
+
static function instance() {
|
23 |
+
if ( ! isset( self::$_instance ) ) {
|
24 |
+
self::$_instance = new FS_Plan_Manager();
|
25 |
+
}
|
26 |
+
|
27 |
+
return self::$_instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
private function __construct() {
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param FS_Plugin_License[] $licenses
|
35 |
+
*
|
36 |
+
* @return bool
|
37 |
+
*/
|
38 |
+
function has_premium_license( $licenses ) {
|
39 |
+
if ( is_array( $licenses ) ) {
|
40 |
+
/**
|
41 |
+
* @var FS_Plugin_License[] $licenses
|
42 |
+
*/
|
43 |
+
foreach ( $licenses as $license ) {
|
44 |
+
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
|
45 |
+
return true;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Check if plugin has any paid plans.
|
55 |
+
*
|
56 |
+
* @author Vova Feldman (@svovaf)
|
57 |
+
* @since 1.0.7
|
58 |
+
*
|
59 |
+
* @param FS_Plugin_Plan[] $plans
|
60 |
+
*
|
61 |
+
* @return bool
|
62 |
+
*/
|
63 |
+
function has_paid_plan( $plans ) {
|
64 |
+
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @var FS_Plugin_Plan[] $plans
|
70 |
+
*/
|
71 |
+
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
72 |
+
if ( ! $plans[ $i ]->is_free() ) {
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Check if plugin has any free plan, or is it premium only.
|
82 |
+
*
|
83 |
+
* Note: If no plans configured, assume plugin is free.
|
84 |
+
*
|
85 |
+
* @author Vova Feldman (@svovaf)
|
86 |
+
* @since 1.0.7
|
87 |
+
*
|
88 |
+
* @param FS_Plugin_Plan[] $plans
|
89 |
+
*
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
function has_free_plan( $plans ) {
|
93 |
+
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
94 |
+
return true;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @var FS_Plugin_Plan[] $plans
|
99 |
+
*/
|
100 |
+
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
101 |
+
if ( $plans[ $i ]->is_free() ) {
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Find all plans that have trial.
|
111 |
+
*
|
112 |
+
* @author Vova Feldman (@svovaf)
|
113 |
+
* @since 1.0.9
|
114 |
+
*
|
115 |
+
* @param FS_Plugin_Plan[] $plans
|
116 |
+
*
|
117 |
+
* @return FS_Plugin_Plan[]
|
118 |
+
*/
|
119 |
+
function get_trial_plans( $plans ) {
|
120 |
+
$trial_plans = array();
|
121 |
+
|
122 |
+
if ( is_array( $plans ) && 0 < count( $plans ) ) {
|
123 |
+
/**
|
124 |
+
* @var FS_Plugin_Plan[] $plans
|
125 |
+
*/
|
126 |
+
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
127 |
+
if ( $plans[ $i ]->has_trial() ) {
|
128 |
+
$trial_plans[] = $plans[ $i ];
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
return $trial_plans;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Check if plugin has any trial plan.
|
138 |
+
*
|
139 |
+
* @author Vova Feldman (@svovaf)
|
140 |
+
* @since 1.0.9
|
141 |
+
*
|
142 |
+
* @param FS_Plugin_Plan[] $plans
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
function has_trial_plan( $plans ) {
|
147 |
+
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
|
148 |
+
return true;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* @var FS_Plugin_Plan[] $plans
|
153 |
+
*/
|
154 |
+
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
|
155 |
+
if ( $plans[ $i ]->has_trial() ) {
|
156 |
+
return true;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
return false;
|
161 |
+
}
|
162 |
}
|
lib/freemius/includes/managers/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/sdk/Exceptions/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/sdk/LICENSE.txt
CHANGED
@@ -1,340 +1,340 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 2, June 1991
|
3 |
-
|
4 |
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
5 |
-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
-
Everyone is permitted to copy and distribute verbatim copies
|
7 |
-
of this license document, but changing it is not allowed.
|
8 |
-
|
9 |
-
Preamble
|
10 |
-
|
11 |
-
The licenses for most software are designed to take away your
|
12 |
-
freedom to share and change it. By contrast, the GNU General Public
|
13 |
-
License is intended to guarantee your freedom to share and change free
|
14 |
-
software--to make sure the software is free for all its users. This
|
15 |
-
General Public License applies to most of the Free Software
|
16 |
-
Foundation's software and to any other program whose authors commit to
|
17 |
-
using it. (Some other Free Software Foundation software is covered by
|
18 |
-
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
-
your programs, too.
|
20 |
-
|
21 |
-
When we speak of free software, we are referring to freedom, not
|
22 |
-
price. Our General Public Licenses are designed to make sure that you
|
23 |
-
have the freedom to distribute copies of free software (and charge for
|
24 |
-
this service if you wish), that you receive source code or can get it
|
25 |
-
if you want it, that you can change the software or use pieces of it
|
26 |
-
in new free programs; and that you know you can do these things.
|
27 |
-
|
28 |
-
To protect your rights, we need to make restrictions that forbid
|
29 |
-
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
-
These restrictions translate to certain responsibilities for you if you
|
31 |
-
distribute copies of the software, or if you modify it.
|
32 |
-
|
33 |
-
For example, if you distribute copies of such a program, whether
|
34 |
-
gratis or for a fee, you must give the recipients all the rights that
|
35 |
-
you have. You must make sure that they, too, receive or can get the
|
36 |
-
source code. And you must show them these terms so they know their
|
37 |
-
rights.
|
38 |
-
|
39 |
-
We protect your rights with two steps: (1) copyright the software, and
|
40 |
-
(2) offer you this license which gives you legal permission to copy,
|
41 |
-
distribute and/or modify the software.
|
42 |
-
|
43 |
-
Also, for each author's protection and ours, we want to make certain
|
44 |
-
that everyone understands that there is no warranty for this free
|
45 |
-
software. If the software is modified by someone else and passed on, we
|
46 |
-
want its recipients to know that what they have is not the original, so
|
47 |
-
that any problems introduced by others will not reflect on the original
|
48 |
-
authors' reputations.
|
49 |
-
|
50 |
-
Finally, any free program is threatened constantly by software
|
51 |
-
patents. We wish to avoid the danger that redistributors of a free
|
52 |
-
program will individually obtain patent licenses, in effect making the
|
53 |
-
program proprietary. To prevent this, we have made it clear that any
|
54 |
-
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
-
|
56 |
-
The precise terms and conditions for copying, distribution and
|
57 |
-
modification follow.
|
58 |
-
|
59 |
-
GNU GENERAL PUBLIC LICENSE
|
60 |
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
-
|
62 |
-
0. This License applies to any program or other work which contains
|
63 |
-
a notice placed by the copyright holder saying it may be distributed
|
64 |
-
under the terms of this General Public License. The "Program", below,
|
65 |
-
refers to any such program or work, and a "work based on the Program"
|
66 |
-
means either the Program or any derivative work under copyright law:
|
67 |
-
that is to say, a work containing the Program or a portion of it,
|
68 |
-
either verbatim or with modifications and/or translated into another
|
69 |
-
language. (Hereinafter, translation is included without limitation in
|
70 |
-
the term "modification".) Each licensee is addressed as "you".
|
71 |
-
|
72 |
-
Activities other than copying, distribution and modification are not
|
73 |
-
covered by this License; they are outside its scope. The act of
|
74 |
-
running the Program is not restricted, and the output from the Program
|
75 |
-
is covered only if its contents constitute a work based on the
|
76 |
-
Program (independent of having been made by running the Program).
|
77 |
-
Whether that is true depends on what the Program does.
|
78 |
-
|
79 |
-
1. You may copy and distribute verbatim copies of the Program's
|
80 |
-
source code as you receive it, in any medium, provided that you
|
81 |
-
conspicuously and appropriately publish on each copy an appropriate
|
82 |
-
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
-
notices that refer to this License and to the absence of any warranty;
|
84 |
-
and give any other recipients of the Program a copy of this License
|
85 |
-
along with the Program.
|
86 |
-
|
87 |
-
You may charge a fee for the physical act of transferring a copy, and
|
88 |
-
you may at your option offer warranty protection in exchange for a fee.
|
89 |
-
|
90 |
-
2. You may modify your copy or copies of the Program or any portion
|
91 |
-
of it, thus forming a work based on the Program, and copy and
|
92 |
-
distribute such modifications or work under the terms of Section 1
|
93 |
-
above, provided that you also meet all of these conditions:
|
94 |
-
|
95 |
-
a) You must cause the modified files to carry prominent notices
|
96 |
-
stating that you changed the files and the date of any change.
|
97 |
-
|
98 |
-
b) You must cause any work that you distribute or publish, that in
|
99 |
-
whole or in part contains or is derived from the Program or any
|
100 |
-
part thereof, to be licensed as a whole at no charge to all third
|
101 |
-
parties under the terms of this License.
|
102 |
-
|
103 |
-
c) If the modified program normally reads commands interactively
|
104 |
-
when run, you must cause it, when started running for such
|
105 |
-
interactive use in the most ordinary way, to print or display an
|
106 |
-
announcement including an appropriate copyright notice and a
|
107 |
-
notice that there is no warranty (or else, saying that you provide
|
108 |
-
a warranty) and that users may redistribute the program under
|
109 |
-
these conditions, and telling the user how to view a copy of this
|
110 |
-
License. (Exception: if the Program itself is interactive but
|
111 |
-
does not normally print such an announcement, your work based on
|
112 |
-
the Program is not required to print an announcement.)
|
113 |
-
|
114 |
-
These requirements apply to the modified work as a whole. If
|
115 |
-
identifiable sections of that work are not derived from the Program,
|
116 |
-
and can be reasonably considered independent and separate works in
|
117 |
-
themselves, then this License, and its terms, do not apply to those
|
118 |
-
sections when you distribute them as separate works. But when you
|
119 |
-
distribute the same sections as part of a whole which is a work based
|
120 |
-
on the Program, the distribution of the whole must be on the terms of
|
121 |
-
this License, whose permissions for other licensees extend to the
|
122 |
-
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
-
|
124 |
-
Thus, it is not the intent of this section to claim rights or contest
|
125 |
-
your rights to work written entirely by you; rather, the intent is to
|
126 |
-
exercise the right to control the distribution of derivative or
|
127 |
-
collective works based on the Program.
|
128 |
-
|
129 |
-
In addition, mere aggregation of another work not based on the Program
|
130 |
-
with the Program (or with a work based on the Program) on a volume of
|
131 |
-
a storage or distribution medium does not bring the other work under
|
132 |
-
the scope of this License.
|
133 |
-
|
134 |
-
3. You may copy and distribute the Program (or a work based on it,
|
135 |
-
under Section 2) in object code or executable form under the terms of
|
136 |
-
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
-
|
138 |
-
a) Accompany it with the complete corresponding machine-readable
|
139 |
-
source code, which must be distributed under the terms of Sections
|
140 |
-
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
-
|
142 |
-
b) Accompany it with a written offer, valid for at least three
|
143 |
-
years, to give any third party, for a charge no more than your
|
144 |
-
cost of physically performing source distribution, a complete
|
145 |
-
machine-readable copy of the corresponding source code, to be
|
146 |
-
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
-
customarily used for software interchange; or,
|
148 |
-
|
149 |
-
c) Accompany it with the information you received as to the offer
|
150 |
-
to distribute corresponding source code. (This alternative is
|
151 |
-
allowed only for noncommercial distribution and only if you
|
152 |
-
received the program in object code or executable form with such
|
153 |
-
an offer, in accord with Subsection b above.)
|
154 |
-
|
155 |
-
The source code for a work means the preferred form of the work for
|
156 |
-
making modifications to it. For an executable work, complete source
|
157 |
-
code means all the source code for all modules it contains, plus any
|
158 |
-
associated interface definition files, plus the scripts used to
|
159 |
-
control compilation and installation of the executable. However, as a
|
160 |
-
special exception, the source code distributed need not include
|
161 |
-
anything that is normally distributed (in either source or binary
|
162 |
-
form) with the major components (compiler, kernel, and so on) of the
|
163 |
-
operating system on which the executable runs, unless that component
|
164 |
-
itself accompanies the executable.
|
165 |
-
|
166 |
-
If distribution of executable or object code is made by offering
|
167 |
-
access to copy from a designated place, then offering equivalent
|
168 |
-
access to copy the source code from the same place counts as
|
169 |
-
distribution of the source code, even though third parties are not
|
170 |
-
compelled to copy the source along with the object code.
|
171 |
-
|
172 |
-
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
-
except as expressly provided under this License. Any attempt
|
174 |
-
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
-
void, and will automatically terminate your rights under this License.
|
176 |
-
However, parties who have received copies, or rights, from you under
|
177 |
-
this License will not have their licenses terminated so long as such
|
178 |
-
parties remain in full compliance.
|
179 |
-
|
180 |
-
5. You are not required to accept this License, since you have not
|
181 |
-
signed it. However, nothing else grants you permission to modify or
|
182 |
-
distribute the Program or its derivative works. These actions are
|
183 |
-
prohibited by law if you do not accept this License. Therefore, by
|
184 |
-
modifying or distributing the Program (or any work based on the
|
185 |
-
Program), you indicate your acceptance of this License to do so, and
|
186 |
-
all its terms and conditions for copying, distributing or modifying
|
187 |
-
the Program or works based on it.
|
188 |
-
|
189 |
-
6. Each time you redistribute the Program (or any work based on the
|
190 |
-
Program), the recipient automatically receives a license from the
|
191 |
-
original licensor to copy, distribute or modify the Program subject to
|
192 |
-
these terms and conditions. You may not impose any further
|
193 |
-
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
-
You are not responsible for enforcing compliance by third parties to
|
195 |
-
this License.
|
196 |
-
|
197 |
-
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
-
infringement or for any other reason (not limited to patent issues),
|
199 |
-
conditions are imposed on you (whether by court order, agreement or
|
200 |
-
otherwise) that contradict the conditions of this License, they do not
|
201 |
-
excuse you from the conditions of this License. If you cannot
|
202 |
-
distribute so as to satisfy simultaneously your obligations under this
|
203 |
-
License and any other pertinent obligations, then as a consequence you
|
204 |
-
may not distribute the Program at all. For example, if a patent
|
205 |
-
license would not permit royalty-free redistribution of the Program by
|
206 |
-
all those who receive copies directly or indirectly through you, then
|
207 |
-
the only way you could satisfy both it and this License would be to
|
208 |
-
refrain entirely from distribution of the Program.
|
209 |
-
|
210 |
-
If any portion of this section is held invalid or unenforceable under
|
211 |
-
any particular circumstance, the balance of the section is intended to
|
212 |
-
apply and the section as a whole is intended to apply in other
|
213 |
-
circumstances.
|
214 |
-
|
215 |
-
It is not the purpose of this section to induce you to infringe any
|
216 |
-
patents or other property right claims or to contest validity of any
|
217 |
-
such claims; this section has the sole purpose of protecting the
|
218 |
-
integrity of the free software distribution system, which is
|
219 |
-
implemented by public license practices. Many people have made
|
220 |
-
generous contributions to the wide range of software distributed
|
221 |
-
through that system in reliance on consistent application of that
|
222 |
-
system; it is up to the author/donor to decide if he or she is willing
|
223 |
-
to distribute software through any other system and a licensee cannot
|
224 |
-
impose that choice.
|
225 |
-
|
226 |
-
This section is intended to make thoroughly clear what is believed to
|
227 |
-
be a consequence of the rest of this License.
|
228 |
-
|
229 |
-
8. If the distribution and/or use of the Program is restricted in
|
230 |
-
certain countries either by patents or by copyrighted interfaces, the
|
231 |
-
original copyright holder who places the Program under this License
|
232 |
-
may add an explicit geographical distribution limitation excluding
|
233 |
-
those countries, so that distribution is permitted only in or among
|
234 |
-
countries not thus excluded. In such case, this License incorporates
|
235 |
-
the limitation as if written in the body of this License.
|
236 |
-
|
237 |
-
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
-
of the General Public License from time to time. Such new versions will
|
239 |
-
be similar in spirit to the present version, but may differ in detail to
|
240 |
-
address new problems or concerns.
|
241 |
-
|
242 |
-
Each version is given a distinguishing version number. If the Program
|
243 |
-
specifies a version number of this License which applies to it and "any
|
244 |
-
later version", you have the option of following the terms and conditions
|
245 |
-
either of that version or of any later version published by the Free
|
246 |
-
Software Foundation. If the Program does not specify a version number of
|
247 |
-
this License, you may choose any version ever published by the Free Software
|
248 |
-
Foundation.
|
249 |
-
|
250 |
-
10. If you wish to incorporate parts of the Program into other free
|
251 |
-
programs whose distribution conditions are different, write to the author
|
252 |
-
to ask for permission. For software which is copyrighted by the Free
|
253 |
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
-
make exceptions for this. Our decision will be guided by the two goals
|
255 |
-
of preserving the free status of all derivatives of our free software and
|
256 |
-
of promoting the sharing and reuse of software generally.
|
257 |
-
|
258 |
-
NO WARRANTY
|
259 |
-
|
260 |
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
-
REPAIR OR CORRECTION.
|
269 |
-
|
270 |
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
-
POSSIBILITY OF SUCH DAMAGES.
|
279 |
-
|
280 |
-
END OF TERMS AND CONDITIONS
|
281 |
-
|
282 |
-
How to Apply These Terms to Your New Programs
|
283 |
-
|
284 |
-
If you develop a new program, and you want it to be of the greatest
|
285 |
-
possible use to the public, the best way to achieve this is to make it
|
286 |
-
free software which everyone can redistribute and change under these terms.
|
287 |
-
|
288 |
-
To do so, attach the following notices to the program. It is safest
|
289 |
-
to attach them to the start of each source file to most effectively
|
290 |
-
convey the exclusion of warranty; and each file should have at least
|
291 |
-
the "copyright" line and a pointer to where the full notice is found.
|
292 |
-
|
293 |
-
{description}
|
294 |
-
Copyright (C) {year} {fullname}
|
295 |
-
|
296 |
-
This program is free software; you can redistribute it and/or modify
|
297 |
-
it under the terms of the GNU General Public License as published by
|
298 |
-
the Free Software Foundation; either version 2 of the License, or
|
299 |
-
(at your option) any later version.
|
300 |
-
|
301 |
-
This program is distributed in the hope that it will be useful,
|
302 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
-
GNU General Public License for more details.
|
305 |
-
|
306 |
-
You should have received a copy of the GNU General Public License along
|
307 |
-
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
-
|
310 |
-
Also add information on how to contact you by electronic and paper mail.
|
311 |
-
|
312 |
-
If the program is interactive, make it output a short notice like this
|
313 |
-
when it starts in an interactive mode:
|
314 |
-
|
315 |
-
Gnomovision version 69, Copyright (C) year name of author
|
316 |
-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
-
This is free software, and you are welcome to redistribute it
|
318 |
-
under certain conditions; type `show c' for details.
|
319 |
-
|
320 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
-
parts of the General Public License. Of course, the commands you use may
|
322 |
-
be called something other than `show w' and `show c'; they could even be
|
323 |
-
mouse-clicks or menu items--whatever suits your program.
|
324 |
-
|
325 |
-
You should also get your employer (if you work as a programmer) or your
|
326 |
-
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
-
necessary. Here is a sample; alter the names:
|
328 |
-
|
329 |
-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
-
|
332 |
-
{signature of Ty Coon}, 1 April 1989
|
333 |
-
Ty Coon, President of Vice
|
334 |
-
|
335 |
-
This General Public License does not permit incorporating your program into
|
336 |
-
proprietary programs. If your program is a subroutine library, you may
|
337 |
-
consider it more useful to permit linking proprietary applications with the
|
338 |
-
library. If this is what you want to do, use the GNU Lesser General
|
339 |
-
Public License instead of this License.
|
340 |
-
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
{description}
|
294 |
+
Copyright (C) {year} {fullname}
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
{signature of Ty Coon}, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
340 |
+
|
lib/freemius/includes/sdk/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/includes/supplements/fs-essential-functions-1.1.7.1.php
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Find the plugin main file path based on any given file inside the plugin's folder.
|
15 |
-
*
|
16 |
-
* @author Vova Feldman (@svovaf)
|
17 |
-
* @since 1.1.7.1
|
18 |
-
*
|
19 |
-
* @param string $file Absolute path to a file inside a plugin's folder.
|
20 |
-
*
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
function fs_find_direct_caller_plugin_file( $file ) {
|
24 |
-
/**
|
25 |
-
* All the code below will be executed once on activation.
|
26 |
-
* If the user changes the main plugin's file name, the file_exists()
|
27 |
-
* will catch it.
|
28 |
-
*/
|
29 |
-
$all_plugins = fs_get_plugins( true );
|
30 |
-
|
31 |
-
$file_real_path = fs_normalize_path( realpath( $file ) );
|
32 |
-
|
33 |
-
// Get active plugin's main files real full names (might be symlinks).
|
34 |
-
foreach ( $all_plugins as $relative_path => $data ) {
|
35 |
-
if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) . '/' ) ) ) {
|
36 |
-
if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
|
37 |
-
return $relative_path;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
return null;
|
43 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Find the plugin main file path based on any given file inside the plugin's folder.
|
15 |
+
*
|
16 |
+
* @author Vova Feldman (@svovaf)
|
17 |
+
* @since 1.1.7.1
|
18 |
+
*
|
19 |
+
* @param string $file Absolute path to a file inside a plugin's folder.
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
function fs_find_direct_caller_plugin_file( $file ) {
|
24 |
+
/**
|
25 |
+
* All the code below will be executed once on activation.
|
26 |
+
* If the user changes the main plugin's file name, the file_exists()
|
27 |
+
* will catch it.
|
28 |
+
*/
|
29 |
+
$all_plugins = fs_get_plugins( true );
|
30 |
+
|
31 |
+
$file_real_path = fs_normalize_path( realpath( $file ) );
|
32 |
+
|
33 |
+
// Get active plugin's main files real full names (might be symlinks).
|
34 |
+
foreach ( $all_plugins as $relative_path => $data ) {
|
35 |
+
if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) . '/' ) ) ) {
|
36 |
+
if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
|
37 |
+
return $relative_path;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return null;
|
43 |
+
}
|
lib/freemius/includes/supplements/fs-essential-functions-2.2.1.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.2.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if ( ! function_exists( 'fs_get_plugins' ) ) {
|
14 |
-
/**
|
15 |
-
* @author Leo Fajardo (@leorw)
|
16 |
-
* @since 2.2.1
|
17 |
-
*
|
18 |
-
* @param bool $delete_cache
|
19 |
-
*
|
20 |
-
* @return array
|
21 |
-
*/
|
22 |
-
function fs_get_plugins( $delete_cache = false ) {
|
23 |
-
$cached_plugins = wp_cache_get( 'plugins', 'plugins' );
|
24 |
-
if ( ! is_array( $cached_plugins ) ) {
|
25 |
-
$cached_plugins = array();
|
26 |
-
}
|
27 |
-
|
28 |
-
$plugin_folder = '';
|
29 |
-
if ( isset( $cached_plugins[ $plugin_folder ] ) ) {
|
30 |
-
$plugins = $cached_plugins[ $plugin_folder ];
|
31 |
-
} else {
|
32 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
33 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
34 |
-
}
|
35 |
-
|
36 |
-
$plugins = get_plugins();
|
37 |
-
|
38 |
-
if ( $delete_cache && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
39 |
-
wp_cache_delete( 'plugins', 'plugins' );
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return $plugins;
|
44 |
-
}
|
45 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.2.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( ! function_exists( 'fs_get_plugins' ) ) {
|
14 |
+
/**
|
15 |
+
* @author Leo Fajardo (@leorw)
|
16 |
+
* @since 2.2.1
|
17 |
+
*
|
18 |
+
* @param bool $delete_cache
|
19 |
+
*
|
20 |
+
* @return array
|
21 |
+
*/
|
22 |
+
function fs_get_plugins( $delete_cache = false ) {
|
23 |
+
$cached_plugins = wp_cache_get( 'plugins', 'plugins' );
|
24 |
+
if ( ! is_array( $cached_plugins ) ) {
|
25 |
+
$cached_plugins = array();
|
26 |
+
}
|
27 |
+
|
28 |
+
$plugin_folder = '';
|
29 |
+
if ( isset( $cached_plugins[ $plugin_folder ] ) ) {
|
30 |
+
$plugins = $cached_plugins[ $plugin_folder ];
|
31 |
+
} else {
|
32 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
33 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
34 |
+
}
|
35 |
+
|
36 |
+
$plugins = get_plugins();
|
37 |
+
|
38 |
+
if ( $delete_cache && is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
39 |
+
wp_cache_delete( 'plugins', 'plugins' );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return $plugins;
|
44 |
+
}
|
45 |
}
|
lib/freemius/includes/supplements/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/languages/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/require.php
CHANGED
@@ -1,54 +1,54 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.9
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
// Configuration should be loaded first.
|
14 |
-
require_once dirname( __FILE__ ) . '/config.php';
|
15 |
-
require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
|
16 |
-
|
17 |
-
// Logger must be loaded before any other.
|
18 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-logger.php';
|
19 |
-
require_once WP_FS__DIR_INCLUDES . '/debug/debug-bar-start.php';
|
20 |
-
|
21 |
-
// require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-abstract-manager.php';
|
22 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-option-manager.php';
|
23 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-gdpr-manager.php';
|
24 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-clone-manager.php';
|
25 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-cache-manager.php';
|
26 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-notice-manager.php';
|
27 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-menu-manager.php';
|
28 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-key-value-storage.php';
|
29 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-license-manager.php';
|
30 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plan-manager.php';
|
31 |
-
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plugin-manager.php';
|
32 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-entity.php';
|
33 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-scope-entity.php';
|
34 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-user.php';
|
35 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-site.php';
|
36 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin.php';
|
37 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-affiliate.php';
|
38 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-affiliate-terms.php';
|
39 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-info.php';
|
40 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-tag.php';
|
41 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-plan.php';
|
42 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-pricing.php';
|
43 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-payment.php';
|
44 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-license.php';
|
45 |
-
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-subscription.php';
|
46 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-api.php';
|
47 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-plugin-updater.php';
|
48 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-security.php';
|
49 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-options.php';
|
50 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-storage.php';
|
51 |
-
require_once WP_FS__DIR_INCLUDES . '/class-fs-admin-notices.php';
|
52 |
-
require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
|
53 |
-
require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
|
54 |
-
require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.9
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
// Configuration should be loaded first.
|
14 |
+
require_once dirname( __FILE__ ) . '/config.php';
|
15 |
+
require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
|
16 |
+
|
17 |
+
// Logger must be loaded before any other.
|
18 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-logger.php';
|
19 |
+
require_once WP_FS__DIR_INCLUDES . '/debug/debug-bar-start.php';
|
20 |
+
|
21 |
+
// require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-abstract-manager.php';
|
22 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-option-manager.php';
|
23 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-gdpr-manager.php';
|
24 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-clone-manager.php';
|
25 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-cache-manager.php';
|
26 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-notice-manager.php';
|
27 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-menu-manager.php';
|
28 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-key-value-storage.php';
|
29 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-license-manager.php';
|
30 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plan-manager.php';
|
31 |
+
require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plugin-manager.php';
|
32 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-entity.php';
|
33 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-scope-entity.php';
|
34 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-user.php';
|
35 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-site.php';
|
36 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin.php';
|
37 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-affiliate.php';
|
38 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-affiliate-terms.php';
|
39 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-info.php';
|
40 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-tag.php';
|
41 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-plan.php';
|
42 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-pricing.php';
|
43 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-payment.php';
|
44 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-license.php';
|
45 |
+
require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-subscription.php';
|
46 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-api.php';
|
47 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-plugin-updater.php';
|
48 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-security.php';
|
49 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-options.php';
|
50 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-storage.php';
|
51 |
+
require_once WP_FS__DIR_INCLUDES . '/class-fs-admin-notices.php';
|
52 |
+
require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
|
53 |
+
require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
|
54 |
+
require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
|
lib/freemius/templates/account/billing.php
CHANGED
@@ -1,423 +1,423 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
*/
|
17 |
-
$fs = freemius( $VARS['id'] );
|
18 |
-
|
19 |
-
$slug = $fs->get_slug();
|
20 |
-
|
21 |
-
$edit_text = fs_text_x_inline( 'Edit', 'verb', 'edit', $slug );
|
22 |
-
$update_text = fs_text_x_inline( 'Update', 'verb', 'update', $slug );
|
23 |
-
|
24 |
-
$billing = $fs->_fetch_billing();
|
25 |
-
$has_billing = ( $billing instanceof FS_Billing );
|
26 |
-
if ( ! $has_billing ) {
|
27 |
-
$billing = new FS_Billing();
|
28 |
-
}
|
29 |
-
?>
|
30 |
-
<!-- Billing -->
|
31 |
-
<div class="postbox">
|
32 |
-
<div id="fs_billing">
|
33 |
-
<h3><span class="dashicons dashicons-portfolio"></span> <?php fs_esc_html_echo_inline( 'Billing', 'billing', $slug ) ?></h3>
|
34 |
-
<table id="fs_billing_address"<?php if ( $has_billing ) {
|
35 |
-
echo ' class="fs-read-mode"';
|
36 |
-
} ?>>
|
37 |
-
<tr>
|
38 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'Business name', 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo $billing->business_name ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Business name', 'business-name', $slug ) ?>"></label></td>
|
39 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo $billing->tax_id ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>"></label></td>
|
40 |
-
</tr>
|
41 |
-
<tr>
|
42 |
-
<td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>:</span> <input id="address_street" value="<?php echo $billing->address_street ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>"></label></td>
|
43 |
-
<td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>:</span> <input id="address_apt" value="<?php echo $billing->address_apt ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>"></label></td>
|
44 |
-
</tr>
|
45 |
-
<tr>
|
46 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Town', 'town', $slug ) ?>:</span> <input id="address_city" value="<?php echo $billing->address_city ?>" placeholder="<?php fs_esc_attr_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_attr_echo_inline( 'Town', 'town', $slug ) ?>"></label></td>
|
47 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo $billing->address_zip ?>" placeholder="<?php fs_esc_attr_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>"></label></td>
|
48 |
-
</tr>
|
49 |
-
<tr>
|
50 |
-
<?php $countries = array(
|
51 |
-
'AF' => 'Afghanistan',
|
52 |
-
'AX' => 'Aland Islands',
|
53 |
-
'AL' => 'Albania',
|
54 |
-
'DZ' => 'Algeria',
|
55 |
-
'AS' => 'American Samoa',
|
56 |
-
'AD' => 'Andorra',
|
57 |
-
'AO' => 'Angola',
|
58 |
-
'AI' => 'Anguilla',
|
59 |
-
'AQ' => 'Antarctica',
|
60 |
-
'AG' => 'Antigua and Barbuda',
|
61 |
-
'AR' => 'Argentina',
|
62 |
-
'AM' => 'Armenia',
|
63 |
-
'AW' => 'Aruba',
|
64 |
-
'AU' => 'Australia',
|
65 |
-
'AT' => 'Austria',
|
66 |
-
'AZ' => 'Azerbaijan',
|
67 |
-
'BS' => 'Bahamas',
|
68 |
-
'BH' => 'Bahrain',
|
69 |
-
'BD' => 'Bangladesh',
|
70 |
-
'BB' => 'Barbados',
|
71 |
-
'BY' => 'Belarus',
|
72 |
-
'BE' => 'Belgium',
|
73 |
-
'BZ' => 'Belize',
|
74 |
-
'BJ' => 'Benin',
|
75 |
-
'BM' => 'Bermuda',
|
76 |
-
'BT' => 'Bhutan',
|
77 |
-
'BO' => 'Bolivia',
|
78 |
-
'BQ' => 'Bonaire, Saint Eustatius and Saba',
|
79 |
-
'BA' => 'Bosnia and Herzegovina',
|
80 |
-
'BW' => 'Botswana',
|
81 |
-
'BV' => 'Bouvet Island',
|
82 |
-
'BR' => 'Brazil',
|
83 |
-
'IO' => 'British Indian Ocean Territory',
|
84 |
-
'VG' => 'British Virgin Islands',
|
85 |
-
'BN' => 'Brunei',
|
86 |
-
'BG' => 'Bulgaria',
|
87 |
-
'BF' => 'Burkina Faso',
|
88 |
-
'BI' => 'Burundi',
|
89 |
-
'KH' => 'Cambodia',
|
90 |
-
'CM' => 'Cameroon',
|
91 |
-
'CA' => 'Canada',
|
92 |
-
'CV' => 'Cape Verde',
|
93 |
-
'KY' => 'Cayman Islands',
|
94 |
-
'CF' => 'Central African Republic',
|
95 |
-
'TD' => 'Chad',
|
96 |
-
'CL' => 'Chile',
|
97 |
-
'CN' => 'China',
|
98 |
-
'CX' => 'Christmas Island',
|
99 |
-
'CC' => 'Cocos Islands',
|
100 |
-
'CO' => 'Colombia',
|
101 |
-
'KM' => 'Comoros',
|
102 |
-
'CK' => 'Cook Islands',
|
103 |
-
'CR' => 'Costa Rica',
|
104 |
-
'HR' => 'Croatia',
|
105 |
-
'CU' => 'Cuba',
|
106 |
-
'CW' => 'Curacao',
|
107 |
-
'CY' => 'Cyprus',
|
108 |
-
'CZ' => 'Czech Republic',
|
109 |
-
'CD' => 'Democratic Republic of the Congo',
|
110 |
-
'DK' => 'Denmark',
|
111 |
-
'DJ' => 'Djibouti',
|
112 |
-
'DM' => 'Dominica',
|
113 |
-
'DO' => 'Dominican Republic',
|
114 |
-
'TL' => 'East Timor',
|
115 |
-
'EC' => 'Ecuador',
|
116 |
-
'EG' => 'Egypt',
|
117 |
-
'SV' => 'El Salvador',
|
118 |
-
'GQ' => 'Equatorial Guinea',
|
119 |
-
'ER' => 'Eritrea',
|
120 |
-
'EE' => 'Estonia',
|
121 |
-
'ET' => 'Ethiopia',
|
122 |
-
'FK' => 'Falkland Islands',
|
123 |
-
'FO' => 'Faroe Islands',
|
124 |
-
'FJ' => 'Fiji',
|
125 |
-
'FI' => 'Finland',
|
126 |
-
'FR' => 'France',
|
127 |
-
'GF' => 'French Guiana',
|
128 |
-
'PF' => 'French Polynesia',
|
129 |
-
'TF' => 'French Southern Territories',
|
130 |
-
'GA' => 'Gabon',
|
131 |
-
'GM' => 'Gambia',
|
132 |
-
'GE' => 'Georgia',
|
133 |
-
'DE' => 'Germany',
|
134 |
-
'GH' => 'Ghana',
|
135 |
-
'GI' => 'Gibraltar',
|
136 |
-
'GR' => 'Greece',
|
137 |
-
'GL' => 'Greenland',
|
138 |
-
'GD' => 'Grenada',
|
139 |
-
'GP' => 'Guadeloupe',
|
140 |
-
'GU' => 'Guam',
|
141 |
-
'GT' => 'Guatemala',
|
142 |
-
'GG' => 'Guernsey',
|
143 |
-
'GN' => 'Guinea',
|
144 |
-
'GW' => 'Guinea-Bissau',
|
145 |
-
'GY' => 'Guyana',
|
146 |
-
'HT' => 'Haiti',
|
147 |
-
'HM' => 'Heard Island and McDonald Islands',
|
148 |
-
'HN' => 'Honduras',
|
149 |
-
'HK' => 'Hong Kong',
|
150 |
-
'HU' => 'Hungary',
|
151 |
-
'IS' => 'Iceland',
|
152 |
-
'IN' => 'India',
|
153 |
-
'ID' => 'Indonesia',
|
154 |
-
'IR' => 'Iran',
|
155 |
-
'IQ' => 'Iraq',
|
156 |
-
'IE' => 'Ireland',
|
157 |
-
'IM' => 'Isle of Man',
|
158 |
-
'IL' => 'Israel',
|
159 |
-
'IT' => 'Italy',
|
160 |
-
'CI' => 'Ivory Coast',
|
161 |
-
'JM' => 'Jamaica',
|
162 |
-
'JP' => 'Japan',
|
163 |
-
'JE' => 'Jersey',
|
164 |
-
'JO' => 'Jordan',
|
165 |
-
'KZ' => 'Kazakhstan',
|
166 |
-
'KE' => 'Kenya',
|
167 |
-
'KI' => 'Kiribati',
|
168 |
-
'XK' => 'Kosovo',
|
169 |
-
'KW' => 'Kuwait',
|
170 |
-
'KG' => 'Kyrgyzstan',
|
171 |
-
'LA' => 'Laos',
|
172 |
-
'LV' => 'Latvia',
|
173 |
-
'LB' => 'Lebanon',
|
174 |
-
'LS' => 'Lesotho',
|
175 |
-
'LR' => 'Liberia',
|
176 |
-
'LY' => 'Libya',
|
177 |
-
'LI' => 'Liechtenstein',
|
178 |
-
'LT' => 'Lithuania',
|
179 |
-
'LU' => 'Luxembourg',
|
180 |
-
'MO' => 'Macao',
|
181 |
-
'MK' => 'Macedonia',
|
182 |
-
'MG' => 'Madagascar',
|
183 |
-
'MW' => 'Malawi',
|
184 |
-
'MY' => 'Malaysia',
|
185 |
-
'MV' => 'Maldives',
|
186 |
-
'ML' => 'Mali',
|
187 |
-
'MT' => 'Malta',
|
188 |
-
'MH' => 'Marshall Islands',
|
189 |
-
'MQ' => 'Martinique',
|
190 |
-
'MR' => 'Mauritania',
|
191 |
-
'MU' => 'Mauritius',
|
192 |
-
'YT' => 'Mayotte',
|
193 |
-
'MX' => 'Mexico',
|
194 |
-
'FM' => 'Micronesia',
|
195 |
-
'MD' => 'Moldova',
|
196 |
-
'MC' => 'Monaco',
|
197 |
-
'MN' => 'Mongolia',
|
198 |
-
'ME' => 'Montenegro',
|
199 |
-
'MS' => 'Montserrat',
|
200 |
-
'MA' => 'Morocco',
|
201 |
-
'MZ' => 'Mozambique',
|
202 |
-
'MM' => 'Myanmar',
|
203 |
-
'NA' => 'Namibia',
|
204 |
-
'NR' => 'Nauru',
|
205 |
-
'NP' => 'Nepal',
|
206 |
-
'NL' => 'Netherlands',
|
207 |
-
'NC' => 'New Caledonia',
|
208 |
-
'NZ' => 'New Zealand',
|
209 |
-
'NI' => 'Nicaragua',
|
210 |
-
'NE' => 'Niger',
|
211 |
-
'NG' => 'Nigeria',
|
212 |
-
'NU' => 'Niue',
|
213 |
-
'NF' => 'Norfolk Island',
|
214 |
-
'KP' => 'North Korea',
|
215 |
-
'MP' => 'Northern Mariana Islands',
|
216 |
-
'NO' => 'Norway',
|
217 |
-
'OM' => 'Oman',
|
218 |
-
'PK' => 'Pakistan',
|
219 |
-
'PW' => 'Palau',
|
220 |
-
'PS' => 'Palestinian Territory',
|
221 |
-
'PA' => 'Panama',
|
222 |
-
'PG' => 'Papua New Guinea',
|
223 |
-
'PY' => 'Paraguay',
|
224 |
-
'PE' => 'Peru',
|
225 |
-
'PH' => 'Philippines',
|
226 |
-
'PN' => 'Pitcairn',
|
227 |
-
'PL' => 'Poland',
|
228 |
-
'PT' => 'Portugal',
|
229 |
-
'PR' => 'Puerto Rico',
|
230 |
-
'QA' => 'Qatar',
|
231 |
-
'CG' => 'Republic of the Congo',
|
232 |
-
'RE' => 'Reunion',
|
233 |
-
'RO' => 'Romania',
|
234 |
-
'RU' => 'Russia',
|
235 |
-
'RW' => 'Rwanda',
|
236 |
-
'BL' => 'Saint Barthelemy',
|
237 |
-
'SH' => 'Saint Helena',
|
238 |
-
'KN' => 'Saint Kitts and Nevis',
|
239 |
-
'LC' => 'Saint Lucia',
|
240 |
-
'MF' => 'Saint Martin',
|
241 |
-
'PM' => 'Saint Pierre and Miquelon',
|
242 |
-
'VC' => 'Saint Vincent and the Grenadines',
|
243 |
-
'WS' => 'Samoa',
|
244 |
-
'SM' => 'San Marino',
|
245 |
-
'ST' => 'Sao Tome and Principe',
|
246 |
-
'SA' => 'Saudi Arabia',
|
247 |
-
'SN' => 'Senegal',
|
248 |
-
'RS' => 'Serbia',
|
249 |
-
'SC' => 'Seychelles',
|
250 |
-
'SL' => 'Sierra Leone',
|
251 |
-
'SG' => 'Singapore',
|
252 |
-
'SX' => 'Sint Maarten',
|
253 |
-
'SK' => 'Slovakia',
|
254 |
-
'SI' => 'Slovenia',
|
255 |
-
'SB' => 'Solomon Islands',
|
256 |
-
'SO' => 'Somalia',
|
257 |
-
'ZA' => 'South Africa',
|
258 |
-
'GS' => 'South Georgia and the South Sandwich Islands',
|
259 |
-
'KR' => 'South Korea',
|
260 |
-
'SS' => 'South Sudan',
|
261 |
-
'ES' => 'Spain',
|
262 |
-
'LK' => 'Sri Lanka',
|
263 |
-
'SD' => 'Sudan',
|
264 |
-
'SR' => 'Suriname',
|
265 |
-
'SJ' => 'Svalbard and Jan Mayen',
|
266 |
-
'SZ' => 'Swaziland',
|
267 |
-
'SE' => 'Sweden',
|
268 |
-
'CH' => 'Switzerland',
|
269 |
-
'SY' => 'Syria',
|
270 |
-
'TW' => 'Taiwan',
|
271 |
-
'TJ' => 'Tajikistan',
|
272 |
-
'TZ' => 'Tanzania',
|
273 |
-
'TH' => 'Thailand',
|
274 |
-
'TG' => 'Togo',
|
275 |
-
'TK' => 'Tokelau',
|
276 |
-
'TO' => 'Tonga',
|
277 |
-
'TT' => 'Trinidad and Tobago',
|
278 |
-
'TN' => 'Tunisia',
|
279 |
-
'TR' => 'Turkey',
|
280 |
-
'TM' => 'Turkmenistan',
|
281 |
-
'TC' => 'Turks and Caicos Islands',
|
282 |
-
'TV' => 'Tuvalu',
|
283 |
-
'VI' => 'U.S. Virgin Islands',
|
284 |
-
'UG' => 'Uganda',
|
285 |
-
'UA' => 'Ukraine',
|
286 |
-
'AE' => 'United Arab Emirates',
|
287 |
-
'GB' => 'United Kingdom',
|
288 |
-
'US' => 'United States',
|
289 |
-
'UM' => 'United States Minor Outlying Islands',
|
290 |
-
'UY' => 'Uruguay',
|
291 |
-
'UZ' => 'Uzbekistan',
|
292 |
-
'VU' => 'Vanuatu',
|
293 |
-
'VA' => 'Vatican',
|
294 |
-
'VE' => 'Venezuela',
|
295 |
-
'VN' => 'Vietnam',
|
296 |
-
'WF' => 'Wallis and Futuna',
|
297 |
-
'EH' => 'Western Sahara',
|
298 |
-
'YE' => 'Yemen',
|
299 |
-
'ZM' => 'Zambia',
|
300 |
-
'ZW' => 'Zimbabwe',
|
301 |
-
) ?>
|
302 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'Country', 'country', $slug ) ?>:</span> <select id="address_country_code">
|
303 |
-
<?php if ( empty( $billing->address_country_code ) ) : ?>
|
304 |
-
<option value="" selected><?php fs_esc_html_echo_inline( 'Select Country', 'select-country', $slug ) ?></option>
|
305 |
-
<?php endif ?>
|
306 |
-
<?php foreach ( $countries as $code => $country ) : ?>
|
307 |
-
<option
|
308 |
-
value="<?php echo $code ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo $country ?></option>
|
309 |
-
<?php endforeach ?>
|
310 |
-
</select></label></td>
|
311 |
-
<td><label><span><?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>:</span>
|
312 |
-
<input id="address_state" value="<?php echo $billing->address_state ?>" placeholder="<?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>"></label></td>
|
313 |
-
</tr>
|
314 |
-
<tr>
|
315 |
-
<td colspan="2">
|
316 |
-
<button
|
317 |
-
class="button"><?php echo esc_html( $has_billing ?
|
318 |
-
$edit_text :
|
319 |
-
$update_text
|
320 |
-
) ?></button>
|
321 |
-
</td>
|
322 |
-
</tr>
|
323 |
-
</table>
|
324 |
-
</div>
|
325 |
-
</div>
|
326 |
-
<!--/ Billing -->
|
327 |
-
<script type="text/javascript">
|
328 |
-
(function($){
|
329 |
-
var $billingAddress = $('#fs_billing_address'),
|
330 |
-
$billingInputs = $billingAddress.find('input, select');
|
331 |
-
|
332 |
-
var setPrevValues = function () {
|
333 |
-
$billingInputs.each(function () {
|
334 |
-
$(this).attr('data-val', $(this).val());
|
335 |
-
});
|
336 |
-
};
|
337 |
-
|
338 |
-
setPrevValues();
|
339 |
-
|
340 |
-
var hasBillingChanged = function () {
|
341 |
-
for (var i = 0, len = $billingInputs.length; i < len; i++){
|
342 |
-
var $this = $($billingInputs[i]);
|
343 |
-
if ($this.attr('data-val') !== $this.val()) {
|
344 |
-
return true;
|
345 |
-
}
|
346 |
-
}
|
347 |
-
|
348 |
-
return false;
|
349 |
-
};
|
350 |
-
|
351 |
-
var isEditAllFieldsMode = false;
|
352 |
-
|
353 |
-
$billingAddress.find('.button').click(function(){
|
354 |
-
$billingAddress.toggleClass('fs-read-mode');
|
355 |
-
|
356 |
-
var isEditMode = !$billingAddress.hasClass('fs-read-mode');
|
357 |
-
|
358 |
-
$(this)
|
359 |
-
.html(isEditMode ? '<?php echo esc_js( $update_text ) ?>' : '<?php echo esc_js( $edit_text ) ?>')
|
360 |
-
.toggleClass('button-primary');
|
361 |
-
|
362 |
-
if (isEditMode) {
|
363 |
-
$('#business_name').focus().select();
|
364 |
-
isEditAllFieldsMode = true;
|
365 |
-
} else {
|
366 |
-
isEditAllFieldsMode = false;
|
367 |
-
|
368 |
-
if (!hasBillingChanged())
|
369 |
-
return;
|
370 |
-
|
371 |
-
var billing = {};
|
372 |
-
|
373 |
-
$billingInputs.each(function(){
|
374 |
-
if ($(this).attr('data-val') !== $(this).val()) {
|
375 |
-
billing[$(this).attr('id')] = $(this).val();
|
376 |
-
}
|
377 |
-
});
|
378 |
-
|
379 |
-
$.ajax({
|
380 |
-
url : ajaxurl,
|
381 |
-
method : 'POST',
|
382 |
-
data : {
|
383 |
-
action : '<?php echo $fs->get_ajax_action( 'update_billing' ) ?>',
|
384 |
-
security : '<?php echo $fs->get_ajax_security( 'update_billing' ) ?>',
|
385 |
-
module_id: '<?php echo $fs->get_id() ?>',
|
386 |
-
billing : billing
|
387 |
-
},
|
388 |
-
success: function (resultObj) {
|
389 |
-
if (resultObj.success) {
|
390 |
-
setPrevValues();
|
391 |
-
} else {
|
392 |
-
alert(resultObj.error);
|
393 |
-
}
|
394 |
-
}
|
395 |
-
});
|
396 |
-
}
|
397 |
-
});
|
398 |
-
|
399 |
-
$billingInputs
|
400 |
-
// Get into edit mode upon selection.
|
401 |
-
.focus(function () {
|
402 |
-
var isEditMode = !$billingAddress.hasClass('fs-read-mode');
|
403 |
-
|
404 |
-
if (isEditMode) {
|
405 |
-
return;
|
406 |
-
}
|
407 |
-
|
408 |
-
$billingAddress.toggleClass('fs-read-mode');
|
409 |
-
$billingAddress.find('.button')
|
410 |
-
.html('<?php echo esc_js( $update_text ) ?>')
|
411 |
-
.toggleClass('button-primary');
|
412 |
-
})
|
413 |
-
// If blured after editing only one field without changes, exit edit mode.
|
414 |
-
.blur(function () {
|
415 |
-
if (!isEditAllFieldsMode && !hasBillingChanged()) {
|
416 |
-
$billingAddress.toggleClass('fs-read-mode');
|
417 |
-
$billingAddress.find('.button')
|
418 |
-
.html('<?php echo esc_js( $edit_text ) ?>')
|
419 |
-
.toggleClass('button-primary');
|
420 |
-
}
|
421 |
-
});
|
422 |
-
})(jQuery);
|
423 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
*/
|
17 |
+
$fs = freemius( $VARS['id'] );
|
18 |
+
|
19 |
+
$slug = $fs->get_slug();
|
20 |
+
|
21 |
+
$edit_text = fs_text_x_inline( 'Edit', 'verb', 'edit', $slug );
|
22 |
+
$update_text = fs_text_x_inline( 'Update', 'verb', 'update', $slug );
|
23 |
+
|
24 |
+
$billing = $fs->_fetch_billing();
|
25 |
+
$has_billing = ( $billing instanceof FS_Billing );
|
26 |
+
if ( ! $has_billing ) {
|
27 |
+
$billing = new FS_Billing();
|
28 |
+
}
|
29 |
+
?>
|
30 |
+
<!-- Billing -->
|
31 |
+
<div class="postbox">
|
32 |
+
<div id="fs_billing">
|
33 |
+
<h3><span class="dashicons dashicons-portfolio"></span> <?php fs_esc_html_echo_inline( 'Billing', 'billing', $slug ) ?></h3>
|
34 |
+
<table id="fs_billing_address"<?php if ( $has_billing ) {
|
35 |
+
echo ' class="fs-read-mode"';
|
36 |
+
} ?>>
|
37 |
+
<tr>
|
38 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'Business name', 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo $billing->business_name ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Business name', 'business-name', $slug ) ?>"></label></td>
|
39 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo $billing->tax_id ?>" placeholder="<?php fs_esc_attr_echo_inline( 'Tax / VAT ID', 'tax-vat-id', $slug ) ?>"></label></td>
|
40 |
+
</tr>
|
41 |
+
<tr>
|
42 |
+
<td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>:</span> <input id="address_street" value="<?php echo $billing->address_street ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 1 ) ?>"></label></td>
|
43 |
+
<td><label><span><?php printf( fs_esc_html_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>:</span> <input id="address_apt" value="<?php echo $billing->address_apt ?>" placeholder="<?php printf( fs_esc_attr_inline( 'Address Line %d', 'address-line-n', $slug ), 2 ) ?>"></label></td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Town', 'town', $slug ) ?>:</span> <input id="address_city" value="<?php echo $billing->address_city ?>" placeholder="<?php fs_esc_attr_echo_inline( 'City', 'city', $slug ) ?> / <?php fs_esc_attr_echo_inline( 'Town', 'town', $slug ) ?>"></label></td>
|
47 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo $billing->address_zip ?>" placeholder="<?php fs_esc_attr_echo_inline( 'ZIP / Postal Code', 'zip-postal-code', $slug ) ?>"></label></td>
|
48 |
+
</tr>
|
49 |
+
<tr>
|
50 |
+
<?php $countries = array(
|
51 |
+
'AF' => 'Afghanistan',
|
52 |
+
'AX' => 'Aland Islands',
|
53 |
+
'AL' => 'Albania',
|
54 |
+
'DZ' => 'Algeria',
|
55 |
+
'AS' => 'American Samoa',
|
56 |
+
'AD' => 'Andorra',
|
57 |
+
'AO' => 'Angola',
|
58 |
+
'AI' => 'Anguilla',
|
59 |
+
'AQ' => 'Antarctica',
|
60 |
+
'AG' => 'Antigua and Barbuda',
|
61 |
+
'AR' => 'Argentina',
|
62 |
+
'AM' => 'Armenia',
|
63 |
+
'AW' => 'Aruba',
|
64 |
+
'AU' => 'Australia',
|
65 |
+
'AT' => 'Austria',
|
66 |
+
'AZ' => 'Azerbaijan',
|
67 |
+
'BS' => 'Bahamas',
|
68 |
+
'BH' => 'Bahrain',
|
69 |
+
'BD' => 'Bangladesh',
|
70 |
+
'BB' => 'Barbados',
|
71 |
+
'BY' => 'Belarus',
|
72 |
+
'BE' => 'Belgium',
|
73 |
+
'BZ' => 'Belize',
|
74 |
+
'BJ' => 'Benin',
|
75 |
+
'BM' => 'Bermuda',
|
76 |
+
'BT' => 'Bhutan',
|
77 |
+
'BO' => 'Bolivia',
|
78 |
+
'BQ' => 'Bonaire, Saint Eustatius and Saba',
|
79 |
+
'BA' => 'Bosnia and Herzegovina',
|
80 |
+
'BW' => 'Botswana',
|
81 |
+
'BV' => 'Bouvet Island',
|
82 |
+
'BR' => 'Brazil',
|
83 |
+
'IO' => 'British Indian Ocean Territory',
|
84 |
+
'VG' => 'British Virgin Islands',
|
85 |
+
'BN' => 'Brunei',
|
86 |
+
'BG' => 'Bulgaria',
|
87 |
+
'BF' => 'Burkina Faso',
|
88 |
+
'BI' => 'Burundi',
|
89 |
+
'KH' => 'Cambodia',
|
90 |
+
'CM' => 'Cameroon',
|
91 |
+
'CA' => 'Canada',
|
92 |
+
'CV' => 'Cape Verde',
|
93 |
+
'KY' => 'Cayman Islands',
|
94 |
+
'CF' => 'Central African Republic',
|
95 |
+
'TD' => 'Chad',
|
96 |
+
'CL' => 'Chile',
|
97 |
+
'CN' => 'China',
|
98 |
+
'CX' => 'Christmas Island',
|
99 |
+
'CC' => 'Cocos Islands',
|
100 |
+
'CO' => 'Colombia',
|
101 |
+
'KM' => 'Comoros',
|
102 |
+
'CK' => 'Cook Islands',
|
103 |
+
'CR' => 'Costa Rica',
|
104 |
+
'HR' => 'Croatia',
|
105 |
+
'CU' => 'Cuba',
|
106 |
+
'CW' => 'Curacao',
|
107 |
+
'CY' => 'Cyprus',
|
108 |
+
'CZ' => 'Czech Republic',
|
109 |
+
'CD' => 'Democratic Republic of the Congo',
|
110 |
+
'DK' => 'Denmark',
|
111 |
+
'DJ' => 'Djibouti',
|
112 |
+
'DM' => 'Dominica',
|
113 |
+
'DO' => 'Dominican Republic',
|
114 |
+
'TL' => 'East Timor',
|
115 |
+
'EC' => 'Ecuador',
|
116 |
+
'EG' => 'Egypt',
|
117 |
+
'SV' => 'El Salvador',
|
118 |
+
'GQ' => 'Equatorial Guinea',
|
119 |
+
'ER' => 'Eritrea',
|
120 |
+
'EE' => 'Estonia',
|
121 |
+
'ET' => 'Ethiopia',
|
122 |
+
'FK' => 'Falkland Islands',
|
123 |
+
'FO' => 'Faroe Islands',
|
124 |
+
'FJ' => 'Fiji',
|
125 |
+
'FI' => 'Finland',
|
126 |
+
'FR' => 'France',
|
127 |
+
'GF' => 'French Guiana',
|
128 |
+
'PF' => 'French Polynesia',
|
129 |
+
'TF' => 'French Southern Territories',
|
130 |
+
'GA' => 'Gabon',
|
131 |
+
'GM' => 'Gambia',
|
132 |
+
'GE' => 'Georgia',
|
133 |
+
'DE' => 'Germany',
|
134 |
+
'GH' => 'Ghana',
|
135 |
+
'GI' => 'Gibraltar',
|
136 |
+
'GR' => 'Greece',
|
137 |
+
'GL' => 'Greenland',
|
138 |
+
'GD' => 'Grenada',
|
139 |
+
'GP' => 'Guadeloupe',
|
140 |
+
'GU' => 'Guam',
|
141 |
+
'GT' => 'Guatemala',
|
142 |
+
'GG' => 'Guernsey',
|
143 |
+
'GN' => 'Guinea',
|
144 |
+
'GW' => 'Guinea-Bissau',
|
145 |
+
'GY' => 'Guyana',
|
146 |
+
'HT' => 'Haiti',
|
147 |
+
'HM' => 'Heard Island and McDonald Islands',
|
148 |
+
'HN' => 'Honduras',
|
149 |
+
'HK' => 'Hong Kong',
|
150 |
+
'HU' => 'Hungary',
|
151 |
+
'IS' => 'Iceland',
|
152 |
+
'IN' => 'India',
|
153 |
+
'ID' => 'Indonesia',
|
154 |
+
'IR' => 'Iran',
|
155 |
+
'IQ' => 'Iraq',
|
156 |
+
'IE' => 'Ireland',
|
157 |
+
'IM' => 'Isle of Man',
|
158 |
+
'IL' => 'Israel',
|
159 |
+
'IT' => 'Italy',
|
160 |
+
'CI' => 'Ivory Coast',
|
161 |
+
'JM' => 'Jamaica',
|
162 |
+
'JP' => 'Japan',
|
163 |
+
'JE' => 'Jersey',
|
164 |
+
'JO' => 'Jordan',
|
165 |
+
'KZ' => 'Kazakhstan',
|
166 |
+
'KE' => 'Kenya',
|
167 |
+
'KI' => 'Kiribati',
|
168 |
+
'XK' => 'Kosovo',
|
169 |
+
'KW' => 'Kuwait',
|
170 |
+
'KG' => 'Kyrgyzstan',
|
171 |
+
'LA' => 'Laos',
|
172 |
+
'LV' => 'Latvia',
|
173 |
+
'LB' => 'Lebanon',
|
174 |
+
'LS' => 'Lesotho',
|
175 |
+
'LR' => 'Liberia',
|
176 |
+
'LY' => 'Libya',
|
177 |
+
'LI' => 'Liechtenstein',
|
178 |
+
'LT' => 'Lithuania',
|
179 |
+
'LU' => 'Luxembourg',
|
180 |
+
'MO' => 'Macao',
|
181 |
+
'MK' => 'Macedonia',
|
182 |
+
'MG' => 'Madagascar',
|
183 |
+
'MW' => 'Malawi',
|
184 |
+
'MY' => 'Malaysia',
|
185 |
+
'MV' => 'Maldives',
|
186 |
+
'ML' => 'Mali',
|
187 |
+
'MT' => 'Malta',
|
188 |
+
'MH' => 'Marshall Islands',
|
189 |
+
'MQ' => 'Martinique',
|
190 |
+
'MR' => 'Mauritania',
|
191 |
+
'MU' => 'Mauritius',
|
192 |
+
'YT' => 'Mayotte',
|
193 |
+
'MX' => 'Mexico',
|
194 |
+
'FM' => 'Micronesia',
|
195 |
+
'MD' => 'Moldova',
|
196 |
+
'MC' => 'Monaco',
|
197 |
+
'MN' => 'Mongolia',
|
198 |
+
'ME' => 'Montenegro',
|
199 |
+
'MS' => 'Montserrat',
|
200 |
+
'MA' => 'Morocco',
|
201 |
+
'MZ' => 'Mozambique',
|
202 |
+
'MM' => 'Myanmar',
|
203 |
+
'NA' => 'Namibia',
|
204 |
+
'NR' => 'Nauru',
|
205 |
+
'NP' => 'Nepal',
|
206 |
+
'NL' => 'Netherlands',
|
207 |
+
'NC' => 'New Caledonia',
|
208 |
+
'NZ' => 'New Zealand',
|
209 |
+
'NI' => 'Nicaragua',
|
210 |
+
'NE' => 'Niger',
|
211 |
+
'NG' => 'Nigeria',
|
212 |
+
'NU' => 'Niue',
|
213 |
+
'NF' => 'Norfolk Island',
|
214 |
+
'KP' => 'North Korea',
|
215 |
+
'MP' => 'Northern Mariana Islands',
|
216 |
+
'NO' => 'Norway',
|
217 |
+
'OM' => 'Oman',
|
218 |
+
'PK' => 'Pakistan',
|
219 |
+
'PW' => 'Palau',
|
220 |
+
'PS' => 'Palestinian Territory',
|
221 |
+
'PA' => 'Panama',
|
222 |
+
'PG' => 'Papua New Guinea',
|
223 |
+
'PY' => 'Paraguay',
|
224 |
+
'PE' => 'Peru',
|
225 |
+
'PH' => 'Philippines',
|
226 |
+
'PN' => 'Pitcairn',
|
227 |
+
'PL' => 'Poland',
|
228 |
+
'PT' => 'Portugal',
|
229 |
+
'PR' => 'Puerto Rico',
|
230 |
+
'QA' => 'Qatar',
|
231 |
+
'CG' => 'Republic of the Congo',
|
232 |
+
'RE' => 'Reunion',
|
233 |
+
'RO' => 'Romania',
|
234 |
+
'RU' => 'Russia',
|
235 |
+
'RW' => 'Rwanda',
|
236 |
+
'BL' => 'Saint Barthelemy',
|
237 |
+
'SH' => 'Saint Helena',
|
238 |
+
'KN' => 'Saint Kitts and Nevis',
|
239 |
+
'LC' => 'Saint Lucia',
|
240 |
+
'MF' => 'Saint Martin',
|
241 |
+
'PM' => 'Saint Pierre and Miquelon',
|
242 |
+
'VC' => 'Saint Vincent and the Grenadines',
|
243 |
+
'WS' => 'Samoa',
|
244 |
+
'SM' => 'San Marino',
|
245 |
+
'ST' => 'Sao Tome and Principe',
|
246 |
+
'SA' => 'Saudi Arabia',
|
247 |
+
'SN' => 'Senegal',
|
248 |
+
'RS' => 'Serbia',
|
249 |
+
'SC' => 'Seychelles',
|
250 |
+
'SL' => 'Sierra Leone',
|
251 |
+
'SG' => 'Singapore',
|
252 |
+
'SX' => 'Sint Maarten',
|
253 |
+
'SK' => 'Slovakia',
|
254 |
+
'SI' => 'Slovenia',
|
255 |
+
'SB' => 'Solomon Islands',
|
256 |
+
'SO' => 'Somalia',
|
257 |
+
'ZA' => 'South Africa',
|
258 |
+
'GS' => 'South Georgia and the South Sandwich Islands',
|
259 |
+
'KR' => 'South Korea',
|
260 |
+
'SS' => 'South Sudan',
|
261 |
+
'ES' => 'Spain',
|
262 |
+
'LK' => 'Sri Lanka',
|
263 |
+
'SD' => 'Sudan',
|
264 |
+
'SR' => 'Suriname',
|
265 |
+
'SJ' => 'Svalbard and Jan Mayen',
|
266 |
+
'SZ' => 'Swaziland',
|
267 |
+
'SE' => 'Sweden',
|
268 |
+
'CH' => 'Switzerland',
|
269 |
+
'SY' => 'Syria',
|
270 |
+
'TW' => 'Taiwan',
|
271 |
+
'TJ' => 'Tajikistan',
|
272 |
+
'TZ' => 'Tanzania',
|
273 |
+
'TH' => 'Thailand',
|
274 |
+
'TG' => 'Togo',
|
275 |
+
'TK' => 'Tokelau',
|
276 |
+
'TO' => 'Tonga',
|
277 |
+
'TT' => 'Trinidad and Tobago',
|
278 |
+
'TN' => 'Tunisia',
|
279 |
+
'TR' => 'Turkey',
|
280 |
+
'TM' => 'Turkmenistan',
|
281 |
+
'TC' => 'Turks and Caicos Islands',
|
282 |
+
'TV' => 'Tuvalu',
|
283 |
+
'VI' => 'U.S. Virgin Islands',
|
284 |
+
'UG' => 'Uganda',
|
285 |
+
'UA' => 'Ukraine',
|
286 |
+
'AE' => 'United Arab Emirates',
|
287 |
+
'GB' => 'United Kingdom',
|
288 |
+
'US' => 'United States',
|
289 |
+
'UM' => 'United States Minor Outlying Islands',
|
290 |
+
'UY' => 'Uruguay',
|
291 |
+
'UZ' => 'Uzbekistan',
|
292 |
+
'VU' => 'Vanuatu',
|
293 |
+
'VA' => 'Vatican',
|
294 |
+
'VE' => 'Venezuela',
|
295 |
+
'VN' => 'Vietnam',
|
296 |
+
'WF' => 'Wallis and Futuna',
|
297 |
+
'EH' => 'Western Sahara',
|
298 |
+
'YE' => 'Yemen',
|
299 |
+
'ZM' => 'Zambia',
|
300 |
+
'ZW' => 'Zimbabwe',
|
301 |
+
) ?>
|
302 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'Country', 'country', $slug ) ?>:</span> <select id="address_country_code">
|
303 |
+
<?php if ( empty( $billing->address_country_code ) ) : ?>
|
304 |
+
<option value="" selected><?php fs_esc_html_echo_inline( 'Select Country', 'select-country', $slug ) ?></option>
|
305 |
+
<?php endif ?>
|
306 |
+
<?php foreach ( $countries as $code => $country ) : ?>
|
307 |
+
<option
|
308 |
+
value="<?php echo $code ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo $country ?></option>
|
309 |
+
<?php endforeach ?>
|
310 |
+
</select></label></td>
|
311 |
+
<td><label><span><?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>:</span>
|
312 |
+
<input id="address_state" value="<?php echo $billing->address_state ?>" placeholder="<?php fs_esc_html_echo_inline( 'State', 'state', $slug ) ?> / <?php fs_esc_html_echo_inline( 'Province', 'province', $slug ) ?>"></label></td>
|
313 |
+
</tr>
|
314 |
+
<tr>
|
315 |
+
<td colspan="2">
|
316 |
+
<button
|
317 |
+
class="button"><?php echo esc_html( $has_billing ?
|
318 |
+
$edit_text :
|
319 |
+
$update_text
|
320 |
+
) ?></button>
|
321 |
+
</td>
|
322 |
+
</tr>
|
323 |
+
</table>
|
324 |
+
</div>
|
325 |
+
</div>
|
326 |
+
<!--/ Billing -->
|
327 |
+
<script type="text/javascript">
|
328 |
+
(function($){
|
329 |
+
var $billingAddress = $('#fs_billing_address'),
|
330 |
+
$billingInputs = $billingAddress.find('input, select');
|
331 |
+
|
332 |
+
var setPrevValues = function () {
|
333 |
+
$billingInputs.each(function () {
|
334 |
+
$(this).attr('data-val', $(this).val());
|
335 |
+
});
|
336 |
+
};
|
337 |
+
|
338 |
+
setPrevValues();
|
339 |
+
|
340 |
+
var hasBillingChanged = function () {
|
341 |
+
for (var i = 0, len = $billingInputs.length; i < len; i++){
|
342 |
+
var $this = $($billingInputs[i]);
|
343 |
+
if ($this.attr('data-val') !== $this.val()) {
|
344 |
+
return true;
|
345 |
+
}
|
346 |
+
}
|
347 |
+
|
348 |
+
return false;
|
349 |
+
};
|
350 |
+
|
351 |
+
var isEditAllFieldsMode = false;
|
352 |
+
|
353 |
+
$billingAddress.find('.button').click(function(){
|
354 |
+
$billingAddress.toggleClass('fs-read-mode');
|
355 |
+
|
356 |
+
var isEditMode = !$billingAddress.hasClass('fs-read-mode');
|
357 |
+
|
358 |
+
$(this)
|
359 |
+
.html(isEditMode ? '<?php echo esc_js( $update_text ) ?>' : '<?php echo esc_js( $edit_text ) ?>')
|
360 |
+
.toggleClass('button-primary');
|
361 |
+
|
362 |
+
if (isEditMode) {
|
363 |
+
$('#business_name').focus().select();
|
364 |
+
isEditAllFieldsMode = true;
|
365 |
+
} else {
|
366 |
+
isEditAllFieldsMode = false;
|
367 |
+
|
368 |
+
if (!hasBillingChanged())
|
369 |
+
return;
|
370 |
+
|
371 |
+
var billing = {};
|
372 |
+
|
373 |
+
$billingInputs.each(function(){
|
374 |
+
if ($(this).attr('data-val') !== $(this).val()) {
|
375 |
+
billing[$(this).attr('id')] = $(this).val();
|
376 |
+
}
|
377 |
+
});
|
378 |
+
|
379 |
+
$.ajax({
|
380 |
+
url : ajaxurl,
|
381 |
+
method : 'POST',
|
382 |
+
data : {
|
383 |
+
action : '<?php echo $fs->get_ajax_action( 'update_billing' ) ?>',
|
384 |
+
security : '<?php echo $fs->get_ajax_security( 'update_billing' ) ?>',
|
385 |
+
module_id: '<?php echo $fs->get_id() ?>',
|
386 |
+
billing : billing
|
387 |
+
},
|
388 |
+
success: function (resultObj) {
|
389 |
+
if (resultObj.success) {
|
390 |
+
setPrevValues();
|
391 |
+
} else {
|
392 |
+
alert(resultObj.error);
|
393 |
+
}
|
394 |
+
}
|
395 |
+
});
|
396 |
+
}
|
397 |
+
});
|
398 |
+
|
399 |
+
$billingInputs
|
400 |
+
// Get into edit mode upon selection.
|
401 |
+
.focus(function () {
|
402 |
+
var isEditMode = !$billingAddress.hasClass('fs-read-mode');
|
403 |
+
|
404 |
+
if (isEditMode) {
|
405 |
+
return;
|
406 |
+
}
|
407 |
+
|
408 |
+
$billingAddress.toggleClass('fs-read-mode');
|
409 |
+
$billingAddress.find('.button')
|
410 |
+
.html('<?php echo esc_js( $update_text ) ?>')
|
411 |
+
.toggleClass('button-primary');
|
412 |
+
})
|
413 |
+
// If blured after editing only one field without changes, exit edit mode.
|
414 |
+
.blur(function () {
|
415 |
+
if (!isEditAllFieldsMode && !hasBillingChanged()) {
|
416 |
+
$billingAddress.toggleClass('fs-read-mode');
|
417 |
+
$billingAddress.find('.button')
|
418 |
+
.html('<?php echo esc_js( $edit_text ) ?>')
|
419 |
+
.toggleClass('button-primary');
|
420 |
+
}
|
421 |
+
});
|
422 |
+
})(jQuery);
|
423 |
</script>
|
lib/freemius/templates/account/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/account/partials/activate-license-button.php
CHANGED
@@ -1,54 +1,54 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
* @var FS_Plugin_License $available_license
|
17 |
-
* @var string $slug
|
18 |
-
*/
|
19 |
-
$fs = $VARS['freemius'];
|
20 |
-
$available_license = $VARS['license'];
|
21 |
-
$premium_plan = $VARS['plan'];
|
22 |
-
$slug = $VARS['slug'];
|
23 |
-
|
24 |
-
$blog_id = ! empty( $VARS['blog_id'] ) && is_numeric( $VARS['blog_id'] ) ?
|
25 |
-
$VARS['blog_id'] :
|
26 |
-
'';
|
27 |
-
$install_id = ! empty( $VARS['install_id'] ) && FS_Site::is_valid_id( $VARS['install_id'] ) ?
|
28 |
-
$VARS['install_id'] :
|
29 |
-
'';
|
30 |
-
|
31 |
-
$activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
|
32 |
-
|
33 |
-
$action = 'activate_license';
|
34 |
-
?>
|
35 |
-
<form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
|
36 |
-
<input type="hidden" name="fs_action" value="<?php echo $action ?>">
|
37 |
-
<?php wp_nonce_field( trim("{$action}:{$blog_id}:{$install_id}", ':') ) ?>
|
38 |
-
<input type="hidden" name="install_id" value="<?php echo $install_id ?>">
|
39 |
-
<input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
|
40 |
-
<input type="hidden" name="license_id" value="<?php echo $available_license->id ?>">
|
41 |
-
<input type="submit" class="fs-activate-license button<?php echo ! empty( $VARS['class'] ) ? ' ' . $VARS['class'] : '' ?>"
|
42 |
-
value="<?php echo esc_attr( sprintf(
|
43 |
-
$activate_plan_text . '%s',
|
44 |
-
$premium_plan->title,
|
45 |
-
( $VARS['is_localhost'] && $available_license->is_free_localhost ) ?
|
46 |
-
' [' . fs_text_inline( 'Localhost', 'localhost', $slug ) . ']' :
|
47 |
-
( $available_license->is_single_site() ?
|
48 |
-
'' :
|
49 |
-
' [' . ( 1 < $available_license->left() ?
|
50 |
-
sprintf( fs_text_x_inline( '%s left', 'as 5 licenses left', 'x-left', $slug ), $available_license->left() ) :
|
51 |
-
strtolower( fs_text_inline( 'Last license', 'last-license', $slug ) ) ) . ']'
|
52 |
-
)
|
53 |
-
) ) ?> ">
|
54 |
</form>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
* @var FS_Plugin_License $available_license
|
17 |
+
* @var string $slug
|
18 |
+
*/
|
19 |
+
$fs = $VARS['freemius'];
|
20 |
+
$available_license = $VARS['license'];
|
21 |
+
$premium_plan = $VARS['plan'];
|
22 |
+
$slug = $VARS['slug'];
|
23 |
+
|
24 |
+
$blog_id = ! empty( $VARS['blog_id'] ) && is_numeric( $VARS['blog_id'] ) ?
|
25 |
+
$VARS['blog_id'] :
|
26 |
+
'';
|
27 |
+
$install_id = ! empty( $VARS['install_id'] ) && FS_Site::is_valid_id( $VARS['install_id'] ) ?
|
28 |
+
$VARS['install_id'] :
|
29 |
+
'';
|
30 |
+
|
31 |
+
$activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
|
32 |
+
|
33 |
+
$action = 'activate_license';
|
34 |
+
?>
|
35 |
+
<form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
|
36 |
+
<input type="hidden" name="fs_action" value="<?php echo $action ?>">
|
37 |
+
<?php wp_nonce_field( trim("{$action}:{$blog_id}:{$install_id}", ':') ) ?>
|
38 |
+
<input type="hidden" name="install_id" value="<?php echo $install_id ?>">
|
39 |
+
<input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
|
40 |
+
<input type="hidden" name="license_id" value="<?php echo $available_license->id ?>">
|
41 |
+
<input type="submit" class="fs-activate-license button<?php echo ! empty( $VARS['class'] ) ? ' ' . $VARS['class'] : '' ?>"
|
42 |
+
value="<?php echo esc_attr( sprintf(
|
43 |
+
$activate_plan_text . '%s',
|
44 |
+
$premium_plan->title,
|
45 |
+
( $VARS['is_localhost'] && $available_license->is_free_localhost ) ?
|
46 |
+
' [' . fs_text_inline( 'Localhost', 'localhost', $slug ) . ']' :
|
47 |
+
( $available_license->is_single_site() ?
|
48 |
+
'' :
|
49 |
+
' [' . ( 1 < $available_license->left() ?
|
50 |
+
sprintf( fs_text_x_inline( '%s left', 'as 5 licenses left', 'x-left', $slug ), $available_license->left() ) :
|
51 |
+
strtolower( fs_text_inline( 'Last license', 'last-license', $slug ) ) ) . ']'
|
52 |
+
)
|
53 |
+
) ) ?> ">
|
54 |
</form>
|
lib/freemius/templates/account/partials/deactivate-license-button.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
* @var string $slug
|
17 |
-
*/
|
18 |
-
$slug = $VARS['slug'];
|
19 |
-
$fs = $VARS['freemius'];
|
20 |
-
|
21 |
-
$blog_id = ! empty( $VARS['blog_id'] ) && is_numeric( $VARS['blog_id'] ) ?
|
22 |
-
$VARS['blog_id'] :
|
23 |
-
'';
|
24 |
-
$install_id = ! empty( $VARS['install_id'] ) && FS_Site::is_valid_id( $VARS['install_id'] ) ?
|
25 |
-
$VARS['install_id'] :
|
26 |
-
'';
|
27 |
-
|
28 |
-
$action = 'deactivate_license';
|
29 |
-
?>
|
30 |
-
<form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
|
31 |
-
<input type="hidden" name="fs_action" value="<?php echo $action ?>">
|
32 |
-
<?php wp_nonce_field( trim("{$action}:{$blog_id}:{$install_id}", ':') ) ?>
|
33 |
-
<input type="hidden" name="install_id" value="<?php echo $install_id ?>">
|
34 |
-
<input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
|
35 |
-
<button type="button" class="fs-deactivate-license button<?php echo ! empty( $VARS['class'] ) ? ' ' . $VARS['class'] : '' ?>"><?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?></button>
|
36 |
</form>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
* @var string $slug
|
17 |
+
*/
|
18 |
+
$slug = $VARS['slug'];
|
19 |
+
$fs = $VARS['freemius'];
|
20 |
+
|
21 |
+
$blog_id = ! empty( $VARS['blog_id'] ) && is_numeric( $VARS['blog_id'] ) ?
|
22 |
+
$VARS['blog_id'] :
|
23 |
+
'';
|
24 |
+
$install_id = ! empty( $VARS['install_id'] ) && FS_Site::is_valid_id( $VARS['install_id'] ) ?
|
25 |
+
$VARS['install_id'] :
|
26 |
+
'';
|
27 |
+
|
28 |
+
$action = 'deactivate_license';
|
29 |
+
?>
|
30 |
+
<form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
|
31 |
+
<input type="hidden" name="fs_action" value="<?php echo $action ?>">
|
32 |
+
<?php wp_nonce_field( trim("{$action}:{$blog_id}:{$install_id}", ':') ) ?>
|
33 |
+
<input type="hidden" name="install_id" value="<?php echo $install_id ?>">
|
34 |
+
<input type="hidden" name="blog_id" value="<?php echo $blog_id ?>">
|
35 |
+
<button type="button" class="fs-deactivate-license button<?php echo ! empty( $VARS['class'] ) ? ' ' . $VARS['class'] : '' ?>"><?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?></button>
|
36 |
</form>
|
lib/freemius/templates/account/partials/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/account/payments.php
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
*/
|
17 |
-
$fs = freemius( $VARS['id'] );
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var FS_Payment[] $payments
|
21 |
-
*/
|
22 |
-
$payments = $VARS['payments'];
|
23 |
-
|
24 |
-
$slug = $fs->get_slug();
|
25 |
-
|
26 |
-
?>
|
27 |
-
<div class="postbox">
|
28 |
-
<div id="fs_payments">
|
29 |
-
<h3><span class="dashicons dashicons-paperclip"></span> <?php fs_esc_html_echo_inline( 'Payments', 'payments', $slug ) ?></h3>
|
30 |
-
|
31 |
-
<div class="inside">
|
32 |
-
<table class="widefat">
|
33 |
-
<thead>
|
34 |
-
<tr>
|
35 |
-
<th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
|
36 |
-
<th><?php fs_esc_html_echo_inline( 'Date', 'date', $slug ) ?></th>
|
37 |
-
<th><?php fs_esc_html_echo_inline( 'Amount', 'amount', $slug ) ?></th>
|
38 |
-
<th><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></th>
|
39 |
-
</tr>
|
40 |
-
</thead>
|
41 |
-
<tbody>
|
42 |
-
<?php $odd = true ?>
|
43 |
-
<?php foreach ( $payments as $payment ) : ?>
|
44 |
-
<tr<?php echo $odd ? ' class="alternate"' : '' ?>>
|
45 |
-
<td><?php echo $payment->id ?></td>
|
46 |
-
<td><?php echo date( 'M j, Y', strtotime( $payment->created ) ) ?></td>
|
47 |
-
<td><?php echo $payment->formatted_gross() ?></td>
|
48 |
-
<td><?php if (! $payment->is_migrated() ) : ?><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
|
49 |
-
class="button button-small"
|
50 |
-
target="_blank" rel="noopener"><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></a><?php endif ?></td>
|
51 |
-
</tr>
|
52 |
-
<?php $odd = ! $odd; endforeach ?>
|
53 |
-
</tbody>
|
54 |
-
</table>
|
55 |
-
</div>
|
56 |
-
</div>
|
57 |
-
</div>
|
58 |
-
<?php
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
*/
|
17 |
+
$fs = freemius( $VARS['id'] );
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var FS_Payment[] $payments
|
21 |
+
*/
|
22 |
+
$payments = $VARS['payments'];
|
23 |
+
|
24 |
+
$slug = $fs->get_slug();
|
25 |
+
|
26 |
+
?>
|
27 |
+
<div class="postbox">
|
28 |
+
<div id="fs_payments">
|
29 |
+
<h3><span class="dashicons dashicons-paperclip"></span> <?php fs_esc_html_echo_inline( 'Payments', 'payments', $slug ) ?></h3>
|
30 |
+
|
31 |
+
<div class="inside">
|
32 |
+
<table class="widefat">
|
33 |
+
<thead>
|
34 |
+
<tr>
|
35 |
+
<th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
|
36 |
+
<th><?php fs_esc_html_echo_inline( 'Date', 'date', $slug ) ?></th>
|
37 |
+
<th><?php fs_esc_html_echo_inline( 'Amount', 'amount', $slug ) ?></th>
|
38 |
+
<th><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></th>
|
39 |
+
</tr>
|
40 |
+
</thead>
|
41 |
+
<tbody>
|
42 |
+
<?php $odd = true ?>
|
43 |
+
<?php foreach ( $payments as $payment ) : ?>
|
44 |
+
<tr<?php echo $odd ? ' class="alternate"' : '' ?>>
|
45 |
+
<td><?php echo $payment->id ?></td>
|
46 |
+
<td><?php echo date( 'M j, Y', strtotime( $payment->created ) ) ?></td>
|
47 |
+
<td><?php echo $payment->formatted_gross() ?></td>
|
48 |
+
<td><?php if (! $payment->is_migrated() ) : ?><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
|
49 |
+
class="button button-small"
|
50 |
+
target="_blank" rel="noopener"><?php fs_esc_html_echo_inline( 'Invoice', 'invoice', $slug ) ?></a><?php endif ?></td>
|
51 |
+
</tr>
|
52 |
+
<?php $odd = ! $odd; endforeach ?>
|
53 |
+
</tbody>
|
54 |
+
</table>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<?php
|
lib/freemius/templates/add-trial-to-pricing.php
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Add "&trial=true" to pricing menu item href when running in trial
|
4 |
-
* promotion context.
|
5 |
-
*
|
6 |
-
* @package Freemius
|
7 |
-
* @copyright Copyright (c) 2016, Freemius, Inc.
|
8 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
9 |
-
* @since 1.2.1.5
|
10 |
-
*/
|
11 |
-
|
12 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
-
exit;
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @var Freemius $fs
|
18 |
-
*/
|
19 |
-
$fs = freemius( $VARS['id'] );
|
20 |
-
?>
|
21 |
-
<script type="text/javascript">
|
22 |
-
(function ($) {
|
23 |
-
$(document).ready(function () {
|
24 |
-
var $pricingMenu = $('.fs-submenu-item.<?php echo $fs->get_unique_affix() ?>.pricing'),
|
25 |
-
$pricingMenuLink = $pricingMenu.parents('a');
|
26 |
-
|
27 |
-
// Add trial querystring param.
|
28 |
-
$pricingMenuLink.attr('href', $pricingMenuLink.attr('href') + '&trial=true');
|
29 |
-
});
|
30 |
-
})(jQuery);
|
31 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add "&trial=true" to pricing menu item href when running in trial
|
4 |
+
* promotion context.
|
5 |
+
*
|
6 |
+
* @package Freemius
|
7 |
+
* @copyright Copyright (c) 2016, Freemius, Inc.
|
8 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
9 |
+
* @since 1.2.1.5
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var Freemius $fs
|
18 |
+
*/
|
19 |
+
$fs = freemius( $VARS['id'] );
|
20 |
+
?>
|
21 |
+
<script type="text/javascript">
|
22 |
+
(function ($) {
|
23 |
+
$(document).ready(function () {
|
24 |
+
var $pricingMenu = $('.fs-submenu-item.<?php echo $fs->get_unique_affix() ?>.pricing'),
|
25 |
+
$pricingMenuLink = $pricingMenu.parents('a');
|
26 |
+
|
27 |
+
// Add trial querystring param.
|
28 |
+
$pricingMenuLink.attr('href', $pricingMenuLink.attr('href') + '&trial=true');
|
29 |
+
});
|
30 |
+
})(jQuery);
|
31 |
</script>
|
lib/freemius/templates/admin-notice.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
$dismiss_text = fs_text_x_inline( 'Dismiss', 'as close a window', 'dismiss' );
|
14 |
-
|
15 |
-
$slug = '';
|
16 |
-
$type = '';
|
17 |
-
|
18 |
-
if ( ! empty( $VARS['manager_id'] ) ) {
|
19 |
-
/**
|
20 |
-
* @var array $VARS
|
21 |
-
*/
|
22 |
-
$slug = $VARS['manager_id'];
|
23 |
-
|
24 |
-
$type = WP_FS__MODULE_TYPE_PLUGIN;
|
25 |
-
|
26 |
-
if ( false !== strpos( $slug, ':' ) ) {
|
27 |
-
$parts = explode( ':', $slug );
|
28 |
-
|
29 |
-
$slug = $parts[0];
|
30 |
-
|
31 |
-
$parts_count = count( $parts );
|
32 |
-
|
33 |
-
if ( 1 < $parts_count && WP_FS__MODULE_TYPE_THEME == $parts[1] ) {
|
34 |
-
$type = $parts[1];
|
35 |
-
}
|
36 |
-
}
|
37 |
-
}
|
38 |
-
?>
|
39 |
-
<div<?php if ( ! empty( $VARS['id'] ) ) : ?> data-id="<?php echo $VARS['id'] ?>"<?php endif ?><?php if ( ! empty( $VARS['manager_id'] ) ) : ?> data-manager-id="<?php echo $VARS['manager_id'] ?>"<?php endif ?><?php if ( ! empty( $slug ) ) : ?> data-slug="<?php echo $slug ?>"<?php endif ?><?php if ( ! empty( $type ) ) : ?> data-type="<?php echo $type ?>"<?php endif ?>
|
40 |
-
class="<?php
|
41 |
-
switch ( $VARS['type'] ) {
|
42 |
-
case 'error':
|
43 |
-
echo 'error form-invalid';
|
44 |
-
break;
|
45 |
-
case 'promotion':
|
46 |
-
echo 'updated promotion';
|
47 |
-
break;
|
48 |
-
case 'warn':
|
49 |
-
echo 'notice notice-warning';
|
50 |
-
break;
|
51 |
-
case 'update':
|
52 |
-
// echo 'update-nag update';
|
53 |
-
// break;
|
54 |
-
case 'success':
|
55 |
-
default:
|
56 |
-
echo 'updated success';
|
57 |
-
break;
|
58 |
-
}
|
59 |
-
?> fs-notice<?php if ( ! empty( $VARS['sticky'] ) ) {
|
60 |
-
echo ' fs-sticky';
|
61 |
-
} ?><?php if ( ! empty( $VARS['plugin'] ) ) {
|
62 |
-
echo ' fs-has-title';
|
63 |
-
} ?><?php if ( ! empty( $slug ) ) {
|
64 |
-
echo " fs-slug-{$slug}";
|
65 |
-
} ?><?php if ( ! empty( $type ) ) {
|
66 |
-
echo " fs-type-{$type}";
|
67 |
-
} ?>"><?php if ( ! empty( $VARS['plugin'] ) ) : ?>
|
68 |
-
<label class="fs-plugin-title"><?php echo $VARS['plugin'] ?></label>
|
69 |
-
<?php endif ?>
|
70 |
-
<?php if ( ! empty( $VARS['sticky'] ) && ( ! isset( $VARS['dismissible'] ) || false !== $VARS['dismissible'] ) ) : ?>
|
71 |
-
<div class="fs-close"><i class="dashicons dashicons-no"
|
72 |
-
title="<?php echo esc_attr( $dismiss_text ) ?>"></i> <span><?php echo esc_html( $dismiss_text ) ?></span>
|
73 |
-
</div>
|
74 |
-
<?php endif ?>
|
75 |
-
<div class="fs-notice-body">
|
76 |
-
<?php if ( ! empty( $VARS['title'] ) ) : ?><b><?php echo $VARS['title'] ?></b> <?php endif ?>
|
77 |
-
<?php echo $VARS['message'] ?>
|
78 |
-
</div>
|
79 |
-
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
$dismiss_text = fs_text_x_inline( 'Dismiss', 'as close a window', 'dismiss' );
|
14 |
+
|
15 |
+
$slug = '';
|
16 |
+
$type = '';
|
17 |
+
|
18 |
+
if ( ! empty( $VARS['manager_id'] ) ) {
|
19 |
+
/**
|
20 |
+
* @var array $VARS
|
21 |
+
*/
|
22 |
+
$slug = $VARS['manager_id'];
|
23 |
+
|
24 |
+
$type = WP_FS__MODULE_TYPE_PLUGIN;
|
25 |
+
|
26 |
+
if ( false !== strpos( $slug, ':' ) ) {
|
27 |
+
$parts = explode( ':', $slug );
|
28 |
+
|
29 |
+
$slug = $parts[0];
|
30 |
+
|
31 |
+
$parts_count = count( $parts );
|
32 |
+
|
33 |
+
if ( 1 < $parts_count && WP_FS__MODULE_TYPE_THEME == $parts[1] ) {
|
34 |
+
$type = $parts[1];
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
<div<?php if ( ! empty( $VARS['id'] ) ) : ?> data-id="<?php echo $VARS['id'] ?>"<?php endif ?><?php if ( ! empty( $VARS['manager_id'] ) ) : ?> data-manager-id="<?php echo $VARS['manager_id'] ?>"<?php endif ?><?php if ( ! empty( $slug ) ) : ?> data-slug="<?php echo $slug ?>"<?php endif ?><?php if ( ! empty( $type ) ) : ?> data-type="<?php echo $type ?>"<?php endif ?>
|
40 |
+
class="<?php
|
41 |
+
switch ( $VARS['type'] ) {
|
42 |
+
case 'error':
|
43 |
+
echo 'error form-invalid';
|
44 |
+
break;
|
45 |
+
case 'promotion':
|
46 |
+
echo 'updated promotion';
|
47 |
+
break;
|
48 |
+
case 'warn':
|
49 |
+
echo 'notice notice-warning';
|
50 |
+
break;
|
51 |
+
case 'update':
|
52 |
+
// echo 'update-nag update';
|
53 |
+
// break;
|
54 |
+
case 'success':
|
55 |
+
default:
|
56 |
+
echo 'updated success';
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
?> fs-notice<?php if ( ! empty( $VARS['sticky'] ) ) {
|
60 |
+
echo ' fs-sticky';
|
61 |
+
} ?><?php if ( ! empty( $VARS['plugin'] ) ) {
|
62 |
+
echo ' fs-has-title';
|
63 |
+
} ?><?php if ( ! empty( $slug ) ) {
|
64 |
+
echo " fs-slug-{$slug}";
|
65 |
+
} ?><?php if ( ! empty( $type ) ) {
|
66 |
+
echo " fs-type-{$type}";
|
67 |
+
} ?>"><?php if ( ! empty( $VARS['plugin'] ) ) : ?>
|
68 |
+
<label class="fs-plugin-title"><?php echo $VARS['plugin'] ?></label>
|
69 |
+
<?php endif ?>
|
70 |
+
<?php if ( ! empty( $VARS['sticky'] ) && ( ! isset( $VARS['dismissible'] ) || false !== $VARS['dismissible'] ) ) : ?>
|
71 |
+
<div class="fs-close"><i class="dashicons dashicons-no"
|
72 |
+
title="<?php echo esc_attr( $dismiss_text ) ?>"></i> <span><?php echo esc_html( $dismiss_text ) ?></span>
|
73 |
+
</div>
|
74 |
+
<?php endif ?>
|
75 |
+
<div class="fs-notice-body">
|
76 |
+
<?php if ( ! empty( $VARS['title'] ) ) : ?><b><?php echo $VARS['title'] ?></b> <?php endif ?>
|
77 |
+
<?php echo $VARS['message'] ?>
|
78 |
+
</div>
|
79 |
+
</div>
|
lib/freemius/templates/ajax-loader.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit;
|
4 |
-
}
|
5 |
-
?>
|
6 |
-
<div class="fs-ajax-loader" style="display: none"><?php for ( $i = 1; $i <= 8; $i ++ ) : ?><div class="fs-ajax-loader-bar fs-ajax-loader-bar-<?php echo $i ?>"></div><?php endfor ?></div>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
<div class="fs-ajax-loader" style="display: none"><?php for ( $i = 1; $i <= 8; $i ++ ) : ?><div class="fs-ajax-loader-bar fs-ajax-loader-bar-<?php echo $i ?>"></div><?php endfor ?></div>
|
lib/freemius/templates/auto-installation.php
CHANGED
@@ -1,249 +1,249 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.1.5
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
*/
|
17 |
-
$slug = $VARS['slug'];
|
18 |
-
$plugin_id = $VARS['target_module_id'];
|
19 |
-
|
20 |
-
$fs = freemius( $VARS['id'] );
|
21 |
-
|
22 |
-
$action = $fs->is_tracking_allowed() ?
|
23 |
-
'stop_tracking' :
|
24 |
-
'allow_tracking';
|
25 |
-
|
26 |
-
$title = $fs->get_plugin_title();
|
27 |
-
|
28 |
-
if ( $plugin_id != $fs->get_id() ) {
|
29 |
-
$addon = $fs->get_addon( $plugin_id );
|
30 |
-
|
31 |
-
if ( is_object( $addon ) ) {
|
32 |
-
$title = $addon->title . ' ' . fs_text_inline( 'Add-On', 'addon', $slug );
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
$plugin_title = sprintf(
|
37 |
-
'<strong>%s</strong>',
|
38 |
-
esc_html( $title )
|
39 |
-
);
|
40 |
-
|
41 |
-
$sec_countdown = 30;
|
42 |
-
$countdown_html = sprintf(
|
43 |
-
esc_js(
|
44 |
-
/* translators: %s: Number of seconds */
|
45 |
-
fs_text_inline( '%s sec', 'x-sec', $slug )
|
46 |
-
),
|
47 |
-
sprintf( '<span class="fs-countdown">%s</span>', $sec_countdown )
|
48 |
-
);
|
49 |
-
|
50 |
-
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
51 |
-
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
|
52 |
-
|
53 |
-
$params = array();
|
54 |
-
$loader_html = fs_get_template( 'ajax-loader.php', $params );
|
55 |
-
|
56 |
-
// Pass unique auto installation URL if WP_Filesystem is needed.
|
57 |
-
$install_url = $fs->_get_sync_license_url(
|
58 |
-
$plugin_id,
|
59 |
-
true,
|
60 |
-
array( 'auto_install' => 'true' )
|
61 |
-
);
|
62 |
-
|
63 |
-
|
64 |
-
ob_start();
|
65 |
-
|
66 |
-
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
|
67 |
-
|
68 |
-
$credentials = request_filesystem_credentials(
|
69 |
-
esc_url_raw( $install_url ),
|
70 |
-
$method,
|
71 |
-
false,
|
72 |
-
WP_PLUGIN_DIR,
|
73 |
-
array()
|
74 |
-
);
|
75 |
-
|
76 |
-
$credentials_form = ob_get_clean();
|
77 |
-
|
78 |
-
$require_credentials = ! empty( $credentials_form );
|
79 |
-
?>
|
80 |
-
<div class="fs-modal fs-modal-auto-install">
|
81 |
-
<div class="fs-modal-dialog">
|
82 |
-
<div class="fs-modal-header">
|
83 |
-
<h4><?php echo esc_js( fs_text_inline( 'Automatic Installation', 'auto-installation', $slug ) ) ?></h4>
|
84 |
-
</div>
|
85 |
-
<div class="fs-modal-body">
|
86 |
-
<div class="fs-notice-error" style="display: none"><p></p></div>
|
87 |
-
<?php if ( $require_credentials ) : ?>
|
88 |
-
<div id="request-filesystem-credentials-dialog">
|
89 |
-
<?php echo $credentials_form ?>
|
90 |
-
</div>
|
91 |
-
<?php else : ?>
|
92 |
-
<p class="fs-installation-notice"><?php echo sprintf(
|
93 |
-
fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ),
|
94 |
-
$plugin_title,
|
95 |
-
sprintf(
|
96 |
-
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
97 |
-
'https://freemius.com',
|
98 |
-
'freemius.com'
|
99 |
-
),
|
100 |
-
$countdown_html
|
101 |
-
) ?></p>
|
102 |
-
<?php endif ?>
|
103 |
-
<p class="fs-installing"
|
104 |
-
style="display: none"><?php echo sprintf( fs_esc_html_inline( 'The installation process has started and may take a few minutes to complete. Please wait until it is done - do not refresh this page.', 'installing-module-x', $slug ), $plugin_title ) ?></p>
|
105 |
-
</div>
|
106 |
-
<div class="fs-modal-footer">
|
107 |
-
<?php echo $loader_html ?>
|
108 |
-
<button
|
109 |
-
class="button button-secondary button-cancel"><?php fs_esc_html_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button>
|
110 |
-
<button
|
111 |
-
class="button button-primary"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></button>
|
112 |
-
</div>
|
113 |
-
</div>
|
114 |
-
</div>'
|
115 |
-
|
116 |
-
<script type="text/javascript">
|
117 |
-
(function ($) {
|
118 |
-
$(document).ready(function () {
|
119 |
-
var $modal = $('.fs-modal-auto-install'),
|
120 |
-
$body = $('body'),
|
121 |
-
$countdown = $modal.find('.fs-countdown'),
|
122 |
-
requireCredentials = <?php echo json_encode( $require_credentials ) ?>,
|
123 |
-
$credentialsForm = $('#request-filesystem-credentials-dialog'),
|
124 |
-
$errorNotice = $modal.find('.fs-notice-error'),
|
125 |
-
installing = false;
|
126 |
-
|
127 |
-
$modal.appendTo($body);
|
128 |
-
|
129 |
-
var startAutoInstall = function () {
|
130 |
-
if (installing)
|
131 |
-
return;
|
132 |
-
|
133 |
-
installing = true;
|
134 |
-
|
135 |
-
// Start auto-install.
|
136 |
-
$modal.addClass('fs-warn');
|
137 |
-
if (requireCredentials) {
|
138 |
-
$credentialsForm.hide();
|
139 |
-
} else {
|
140 |
-
$modal.find('.fs-installation-notice').hide();
|
141 |
-
}
|
142 |
-
|
143 |
-
$errorNotice.hide();
|
144 |
-
$modal.find('.fs-installing').show();
|
145 |
-
$modal.find('button').hide();
|
146 |
-
$modal.find('.fs-ajax-loader').show();
|
147 |
-
|
148 |
-
var data = {
|
149 |
-
action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>',
|
150 |
-
security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>',
|
151 |
-
slug : '<?php echo $slug ?>',
|
152 |
-
module_id : '<?php echo $fs->get_id() ?>',
|
153 |
-
target_module_id: '<?php echo $plugin_id ?>'
|
154 |
-
};
|
155 |
-
|
156 |
-
if (requireCredentials) {
|
157 |
-
// Add filesystem credentials.
|
158 |
-
data.hostname = $('#hostname').val();
|
159 |
-
data.username = $('#username').val();
|
160 |
-
data.password = $('#password').val();
|
161 |
-
data.connection_type = $('input[name="connection_type"]:checked').val();
|
162 |
-
data.public_key = $('#public_key').val();
|
163 |
-
data.private_key = $('#private_key').val();
|
164 |
-
}
|
165 |
-
|
166 |
-
$.ajax({
|
167 |
-
url : ajaxurl,
|
168 |
-
method : 'POST',
|
169 |
-
data : data,
|
170 |
-
success: function (resultObj) {
|
171 |
-
var reloadAccount = false;
|
172 |
-
|
173 |
-
if (resultObj.success) {
|
174 |
-
// Reload account page to show new data.
|
175 |
-
reloadAccount = true;
|
176 |
-
} else {
|
177 |
-
switch (resultObj.error.code) {
|
178 |
-
case 'invalid_module_id':
|
179 |
-
case 'premium_installed':
|
180 |
-
reloadAccount = true;
|
181 |
-
break;
|
182 |
-
case 'invalid_license':
|
183 |
-
case 'premium_version_missing':
|
184 |
-
case 'unable_to_connect_to_filesystem':
|
185 |
-
default:
|
186 |
-
$modal.removeClass('fs-warn');
|
187 |
-
$modal.find('.fs-installing').hide();
|
188 |
-
$modal.find('.fs-ajax-loader').hide();
|
189 |
-
$modal.find('.button-cancel').html(<?php fs_json_encode_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?>);
|
190 |
-
$modal.find('button').show();
|
191 |
-
|
192 |
-
$errorNotice.find('p').text(resultObj.error.message);
|
193 |
-
$errorNotice.addClass('notice notice-alt notice-error').show();
|
194 |
-
if (requireCredentials) {
|
195 |
-
$credentialsForm.show();
|
196 |
-
}
|
197 |
-
break;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
if (reloadAccount) {
|
202 |
-
window.location = '<?php echo $fs->get_account_url() ?>';
|
203 |
-
}
|
204 |
-
|
205 |
-
installing = false;
|
206 |
-
}
|
207 |
-
});
|
208 |
-
};
|
209 |
-
|
210 |
-
var clearCountdown = function () {
|
211 |
-
clearInterval(countdownInterval);
|
212 |
-
countdownInterval = null;
|
213 |
-
};
|
214 |
-
|
215 |
-
var cancelAutoInstall = function () {
|
216 |
-
$modal.fadeOut(function () {
|
217 |
-
$modal.remove();
|
218 |
-
$body.removeClass('has-fs-modal');
|
219 |
-
});
|
220 |
-
};
|
221 |
-
|
222 |
-
var countdown = <?php echo $sec_countdown ?>,
|
223 |
-
countdownInterval = requireCredentials ? null : setInterval(function () {
|
224 |
-
$countdown.html(--countdown);
|
225 |
-
if (0 == countdown) {
|
226 |
-
clearCountdown();
|
227 |
-
startAutoInstall();
|
228 |
-
}
|
229 |
-
}, 1000);
|
230 |
-
|
231 |
-
$modal.addClass('active');
|
232 |
-
$body.addClass('has-fs-modal');
|
233 |
-
|
234 |
-
$modal.find('.button-primary').click(function () {
|
235 |
-
clearCountdown();
|
236 |
-
startAutoInstall();
|
237 |
-
});
|
238 |
-
|
239 |
-
$modal.find('.button-cancel').click(function () {
|
240 |
-
clearCountdown();
|
241 |
-
cancelAutoInstall();
|
242 |
-
});
|
243 |
-
|
244 |
-
if (requireCredentials) {
|
245 |
-
|
246 |
-
}
|
247 |
-
});
|
248 |
-
})(jQuery);
|
249 |
-
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.1.5
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
*/
|
17 |
+
$slug = $VARS['slug'];
|
18 |
+
$plugin_id = $VARS['target_module_id'];
|
19 |
+
|
20 |
+
$fs = freemius( $VARS['id'] );
|
21 |
+
|
22 |
+
$action = $fs->is_tracking_allowed() ?
|
23 |
+
'stop_tracking' :
|
24 |
+
'allow_tracking';
|
25 |
+
|
26 |
+
$title = $fs->get_plugin_title();
|
27 |
+
|
28 |
+
if ( $plugin_id != $fs->get_id() ) {
|
29 |
+
$addon = $fs->get_addon( $plugin_id );
|
30 |
+
|
31 |
+
if ( is_object( $addon ) ) {
|
32 |
+
$title = $addon->title . ' ' . fs_text_inline( 'Add-On', 'addon', $slug );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
$plugin_title = sprintf(
|
37 |
+
'<strong>%s</strong>',
|
38 |
+
esc_html( $title )
|
39 |
+
);
|
40 |
+
|
41 |
+
$sec_countdown = 30;
|
42 |
+
$countdown_html = sprintf(
|
43 |
+
esc_js(
|
44 |
+
/* translators: %s: Number of seconds */
|
45 |
+
fs_text_inline( '%s sec', 'x-sec', $slug )
|
46 |
+
),
|
47 |
+
sprintf( '<span class="fs-countdown">%s</span>', $sec_countdown )
|
48 |
+
);
|
49 |
+
|
50 |
+
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
51 |
+
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
|
52 |
+
|
53 |
+
$params = array();
|
54 |
+
$loader_html = fs_get_template( 'ajax-loader.php', $params );
|
55 |
+
|
56 |
+
// Pass unique auto installation URL if WP_Filesystem is needed.
|
57 |
+
$install_url = $fs->_get_sync_license_url(
|
58 |
+
$plugin_id,
|
59 |
+
true,
|
60 |
+
array( 'auto_install' => 'true' )
|
61 |
+
);
|
62 |
+
|
63 |
+
|
64 |
+
ob_start();
|
65 |
+
|
66 |
+
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
|
67 |
+
|
68 |
+
$credentials = request_filesystem_credentials(
|
69 |
+
esc_url_raw( $install_url ),
|
70 |
+
$method,
|
71 |
+
false,
|
72 |
+
WP_PLUGIN_DIR,
|
73 |
+
array()
|
74 |
+
);
|
75 |
+
|
76 |
+
$credentials_form = ob_get_clean();
|
77 |
+
|
78 |
+
$require_credentials = ! empty( $credentials_form );
|
79 |
+
?>
|
80 |
+
<div class="fs-modal fs-modal-auto-install">
|
81 |
+
<div class="fs-modal-dialog">
|
82 |
+
<div class="fs-modal-header">
|
83 |
+
<h4><?php echo esc_js( fs_text_inline( 'Automatic Installation', 'auto-installation', $slug ) ) ?></h4>
|
84 |
+
</div>
|
85 |
+
<div class="fs-modal-body">
|
86 |
+
<div class="fs-notice-error" style="display: none"><p></p></div>
|
87 |
+
<?php if ( $require_credentials ) : ?>
|
88 |
+
<div id="request-filesystem-credentials-dialog">
|
89 |
+
<?php echo $credentials_form ?>
|
90 |
+
</div>
|
91 |
+
<?php else : ?>
|
92 |
+
<p class="fs-installation-notice"><?php echo sprintf(
|
93 |
+
fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ),
|
94 |
+
$plugin_title,
|
95 |
+
sprintf(
|
96 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
97 |
+
'https://freemius.com',
|
98 |
+
'freemius.com'
|
99 |
+
),
|
100 |
+
$countdown_html
|
101 |
+
) ?></p>
|
102 |
+
<?php endif ?>
|
103 |
+
<p class="fs-installing"
|
104 |
+
style="display: none"><?php echo sprintf( fs_esc_html_inline( 'The installation process has started and may take a few minutes to complete. Please wait until it is done - do not refresh this page.', 'installing-module-x', $slug ), $plugin_title ) ?></p>
|
105 |
+
</div>
|
106 |
+
<div class="fs-modal-footer">
|
107 |
+
<?php echo $loader_html ?>
|
108 |
+
<button
|
109 |
+
class="button button-secondary button-cancel"><?php fs_esc_html_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button>
|
110 |
+
<button
|
111 |
+
class="button button-primary"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></button>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
</div>'
|
115 |
+
|
116 |
+
<script type="text/javascript">
|
117 |
+
(function ($) {
|
118 |
+
$(document).ready(function () {
|
119 |
+
var $modal = $('.fs-modal-auto-install'),
|
120 |
+
$body = $('body'),
|
121 |
+
$countdown = $modal.find('.fs-countdown'),
|
122 |
+
requireCredentials = <?php echo json_encode( $require_credentials ) ?>,
|
123 |
+
$credentialsForm = $('#request-filesystem-credentials-dialog'),
|
124 |
+
$errorNotice = $modal.find('.fs-notice-error'),
|
125 |
+
installing = false;
|
126 |
+
|
127 |
+
$modal.appendTo($body);
|
128 |
+
|
129 |
+
var startAutoInstall = function () {
|
130 |
+
if (installing)
|
131 |
+
return;
|
132 |
+
|
133 |
+
installing = true;
|
134 |
+
|
135 |
+
// Start auto-install.
|
136 |
+
$modal.addClass('fs-warn');
|
137 |
+
if (requireCredentials) {
|
138 |
+
$credentialsForm.hide();
|
139 |
+
} else {
|
140 |
+
$modal.find('.fs-installation-notice').hide();
|
141 |
+
}
|
142 |
+
|
143 |
+
$errorNotice.hide();
|
144 |
+
$modal.find('.fs-installing').show();
|
145 |
+
$modal.find('button').hide();
|
146 |
+
$modal.find('.fs-ajax-loader').show();
|
147 |
+
|
148 |
+
var data = {
|
149 |
+
action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>',
|
150 |
+
security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>',
|
151 |
+
slug : '<?php echo $slug ?>',
|
152 |
+
module_id : '<?php echo $fs->get_id() ?>',
|
153 |
+
target_module_id: '<?php echo $plugin_id ?>'
|
154 |
+
};
|
155 |
+
|
156 |
+
if (requireCredentials) {
|
157 |
+
// Add filesystem credentials.
|
158 |
+
data.hostname = $('#hostname').val();
|
159 |
+
data.username = $('#username').val();
|
160 |
+
data.password = $('#password').val();
|
161 |
+
data.connection_type = $('input[name="connection_type"]:checked').val();
|
162 |
+
data.public_key = $('#public_key').val();
|
163 |
+
data.private_key = $('#private_key').val();
|
164 |
+
}
|
165 |
+
|
166 |
+
$.ajax({
|
167 |
+
url : ajaxurl,
|
168 |
+
method : 'POST',
|
169 |
+
data : data,
|
170 |
+
success: function (resultObj) {
|
171 |
+
var reloadAccount = false;
|
172 |
+
|
173 |
+
if (resultObj.success) {
|
174 |
+
// Reload account page to show new data.
|
175 |
+
reloadAccount = true;
|
176 |
+
} else {
|
177 |
+
switch (resultObj.error.code) {
|
178 |
+
case 'invalid_module_id':
|
179 |
+
case 'premium_installed':
|
180 |
+
reloadAccount = true;
|
181 |
+
break;
|
182 |
+
case 'invalid_license':
|
183 |
+
case 'premium_version_missing':
|
184 |
+
case 'unable_to_connect_to_filesystem':
|
185 |
+
default:
|
186 |
+
$modal.removeClass('fs-warn');
|
187 |
+
$modal.find('.fs-installing').hide();
|
188 |
+
$modal.find('.fs-ajax-loader').hide();
|
189 |
+
$modal.find('.button-cancel').html(<?php fs_json_encode_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?>);
|
190 |
+
$modal.find('button').show();
|
191 |
+
|
192 |
+
$errorNotice.find('p').text(resultObj.error.message);
|
193 |
+
$errorNotice.addClass('notice notice-alt notice-error').show();
|
194 |
+
if (requireCredentials) {
|
195 |
+
$credentialsForm.show();
|
196 |
+
}
|
197 |
+
break;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
if (reloadAccount) {
|
202 |
+
window.location = '<?php echo $fs->get_account_url() ?>';
|
203 |
+
}
|
204 |
+
|
205 |
+
installing = false;
|
206 |
+
}
|
207 |
+
});
|
208 |
+
};
|
209 |
+
|
210 |
+
var clearCountdown = function () {
|
211 |
+
clearInterval(countdownInterval);
|
212 |
+
countdownInterval = null;
|
213 |
+
};
|
214 |
+
|
215 |
+
var cancelAutoInstall = function () {
|
216 |
+
$modal.fadeOut(function () {
|
217 |
+
$modal.remove();
|
218 |
+
$body.removeClass('has-fs-modal');
|
219 |
+
});
|
220 |
+
};
|
221 |
+
|
222 |
+
var countdown = <?php echo $sec_countdown ?>,
|
223 |
+
countdownInterval = requireCredentials ? null : setInterval(function () {
|
224 |
+
$countdown.html(--countdown);
|
225 |
+
if (0 == countdown) {
|
226 |
+
clearCountdown();
|
227 |
+
startAutoInstall();
|
228 |
+
}
|
229 |
+
}, 1000);
|
230 |
+
|
231 |
+
$modal.addClass('active');
|
232 |
+
$body.addClass('has-fs-modal');
|
233 |
+
|
234 |
+
$modal.find('.button-primary').click(function () {
|
235 |
+
clearCountdown();
|
236 |
+
startAutoInstall();
|
237 |
+
});
|
238 |
+
|
239 |
+
$modal.find('.button-cancel').click(function () {
|
240 |
+
clearCountdown();
|
241 |
+
cancelAutoInstall();
|
242 |
+
});
|
243 |
+
|
244 |
+
if (requireCredentials) {
|
245 |
+
|
246 |
+
}
|
247 |
+
});
|
248 |
+
})(jQuery);
|
249 |
+
</script>
|
lib/freemius/templates/checkout.php
CHANGED
@@ -1,337 +1,337 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
-
* we only develop and maintain one code base.
|
14 |
-
*
|
15 |
-
* This code (and page) will not run for wp.org themes (only plugins).
|
16 |
-
*
|
17 |
-
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
18 |
-
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
19 |
-
*
|
20 |
-
* UPDATE:
|
21 |
-
* After ongoing conversations with the WordPress.org TRT we received
|
22 |
-
* an official approval for including i-frames in the theme's WP Admin setting's
|
23 |
-
* page tab (the SDK will never add any i-frames on the sitefront). i-frames
|
24 |
-
* were never against the guidelines, but we wanted to get the team's blessings
|
25 |
-
* before we move forward. For the record, I got the final approval from
|
26 |
-
* Ulrich Pogson (@grapplerulrich), a team lead at the TRT during WordCamp
|
27 |
-
* Europe 2017 (June 16th, 2017).
|
28 |
-
*
|
29 |
-
* If you have any questions or need clarifications, please don't hesitate
|
30 |
-
* pinging me on slack, my username is @svovaf.
|
31 |
-
*
|
32 |
-
* @author Vova Feldman (@svovaf)
|
33 |
-
* @since 1.2.2
|
34 |
-
*/
|
35 |
-
|
36 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
37 |
-
exit;
|
38 |
-
}
|
39 |
-
|
40 |
-
wp_enqueue_script( 'jquery' );
|
41 |
-
wp_enqueue_script( 'json2' );
|
42 |
-
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
43 |
-
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
44 |
-
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
|
45 |
-
|
46 |
-
fs_enqueue_local_style( 'fs_checkout', '/admin/checkout.css' );
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var array $VARS
|
50 |
-
* @var Freemius $fs
|
51 |
-
*/
|
52 |
-
$fs = freemius( $VARS['id'] );
|
53 |
-
$slug = $fs->get_slug();
|
54 |
-
|
55 |
-
$timestamp = time();
|
56 |
-
|
57 |
-
$context_params = array(
|
58 |
-
'plugin_id' => $fs->get_id(),
|
59 |
-
'public_key' => $fs->get_public_key(),
|
60 |
-
'plugin_version' => $fs->get_plugin_version(),
|
61 |
-
'mode' => 'dashboard',
|
62 |
-
'trial' => fs_request_get_bool( 'trial' ),
|
63 |
-
);
|
64 |
-
|
65 |
-
$plan_id = fs_request_get( 'plan_id' );
|
66 |
-
if ( FS_Plugin_Plan::is_valid_id( $plan_id ) ) {
|
67 |
-
$context_params['plan_id'] = $plan_id;
|
68 |
-
}
|
69 |
-
|
70 |
-
$licenses = fs_request_get( 'licenses' );
|
71 |
-
if ( $licenses === strval( intval( $licenses ) ) && $licenses > 0 ) {
|
72 |
-
$context_params['licenses'] = $licenses;
|
73 |
-
}
|
74 |
-
|
75 |
-
$plugin_id = fs_request_get( 'plugin_id' );
|
76 |
-
if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
|
77 |
-
$plugin_id = $fs->get_id();
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( $plugin_id == $fs->get_id() ) {
|
81 |
-
$is_premium = $fs->is_premium();
|
82 |
-
|
83 |
-
$bundle_id = $fs->get_bundle_id();
|
84 |
-
if ( ! is_null( $bundle_id ) ) {
|
85 |
-
$context_params['bundle_id'] = $bundle_id;
|
86 |
-
}
|
87 |
-
} else {
|
88 |
-
// Identify the module code version of the checkout context module.
|
89 |
-
if ( $fs->is_addon_activated( $plugin_id ) ) {
|
90 |
-
$fs_addon = Freemius::get_instance_by_id( $plugin_id );
|
91 |
-
$is_premium = $fs_addon->is_premium();
|
92 |
-
} else {
|
93 |
-
// If add-on isn't activated assume the premium version isn't installed.
|
94 |
-
$is_premium = false;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
// Get site context secure params.
|
99 |
-
if ( $fs->is_registered() ) {
|
100 |
-
$site = $fs->get_site();
|
101 |
-
|
102 |
-
if ( $plugin_id != $fs->get_id() ) {
|
103 |
-
if ( $fs->is_addon_activated( $plugin_id ) ) {
|
104 |
-
$fs_addon = Freemius::get_instance_by_id( $plugin_id );
|
105 |
-
$addon_site = $fs_addon->get_site();
|
106 |
-
if ( is_object( $addon_site ) ) {
|
107 |
-
$site = $addon_site;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
113 |
-
$site,
|
114 |
-
$timestamp,
|
115 |
-
'checkout'
|
116 |
-
) );
|
117 |
-
} else {
|
118 |
-
$current_user = Freemius::_get_current_wp_user();
|
119 |
-
|
120 |
-
// Add site and user info to the request, this information
|
121 |
-
// is NOT being stored unless the user complete the purchase
|
122 |
-
// and agrees to the TOS.
|
123 |
-
$context_params = array_merge( $context_params, array(
|
124 |
-
'user_firstname' => $current_user->user_firstname,
|
125 |
-
'user_lastname' => $current_user->user_lastname,
|
126 |
-
'user_email' => $current_user->user_email,
|
127 |
-
'home_url' => home_url(),
|
128 |
-
) );
|
129 |
-
|
130 |
-
$fs_user = Freemius::_get_user_by_email( $current_user->user_email );
|
131 |
-
|
132 |
-
if ( is_object( $fs_user ) && $fs_user->is_verified() ) {
|
133 |
-
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
134 |
-
$fs_user,
|
135 |
-
$timestamp,
|
136 |
-
'checkout'
|
137 |
-
) );
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
if ( $fs->is_payments_sandbox() ) {
|
142 |
-
// Append plugin secure token for sandbox mode authentication.
|
143 |
-
$context_params['sandbox'] = FS_Security::instance()->get_secure_token(
|
144 |
-
$fs->get_plugin(),
|
145 |
-
$timestamp,
|
146 |
-
'checkout'
|
147 |
-
);
|
148 |
-
|
149 |
-
/**
|
150 |
-
* @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
|
151 |
-
*/
|
152 |
-
if ( empty( $context_params['s_ctx_ts'] ) ) {
|
153 |
-
$context_params['s_ctx_ts'] = $timestamp;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
$return_url = $fs->_get_sync_license_url( $plugin_id );
|
158 |
-
|
159 |
-
$can_user_install = (
|
160 |
-
( $fs->is_plugin() && current_user_can( 'install_plugins' ) ) ||
|
161 |
-
( $fs->is_theme() && current_user_can( 'install_themes' ) )
|
162 |
-
);
|
163 |
-
|
164 |
-
$query_params = array_merge( $context_params, $_GET, array(
|
165 |
-
// Current plugin version.
|
166 |
-
'plugin_version' => $fs->get_plugin_version(),
|
167 |
-
'sdk_version' => WP_FS__SDK_VERSION,
|
168 |
-
'is_premium' => $is_premium ? 'true' : 'false',
|
169 |
-
'can_install' => $can_user_install ? 'true' : 'false',
|
170 |
-
'return_url' => $return_url,
|
171 |
-
) );
|
172 |
-
|
173 |
-
$xdebug_session = fs_request_get( 'XDEBUG_SESSION' );
|
174 |
-
if ( false !== $xdebug_session ) {
|
175 |
-
$query_params['XDEBUG_SESSION'] = $xdebug_session;
|
176 |
-
}
|
177 |
-
|
178 |
-
$view_params = array(
|
179 |
-
'id' => $VARS['id'],
|
180 |
-
'page' => strtolower( $fs->get_text_inline( 'Checkout', 'checkout' ) ) . ' ' . $fs->get_text_inline( 'PCI compliant', 'pci-compliant' ),
|
181 |
-
);
|
182 |
-
fs_require_once_template('secure-https-header.php', $view_params);
|
183 |
-
?>
|
184 |
-
<div id="fs_checkout" class="wrap fs-section fs-full-size-wrapper">
|
185 |
-
<div id="fs_frame"></div>
|
186 |
-
<script type="text/javascript">
|
187 |
-
// http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
|
188 |
-
jQuery(function ($) {
|
189 |
-
$.extend({
|
190 |
-
form: function (url, data, method) {
|
191 |
-
if (method == null) method = 'POST';
|
192 |
-
if (data == null) data = {};
|
193 |
-
|
194 |
-
var form = $('<form>').attr({
|
195 |
-
method: method,
|
196 |
-
action: url
|
197 |
-
}).css({
|
198 |
-
display: 'none'
|
199 |
-
});
|
200 |
-
|
201 |
-
var addData = function (name, data) {
|
202 |
-
if ($.isArray(data)) {
|
203 |
-
for (var i = 0; i < data.length; i++) {
|
204 |
-
var value = data[i];
|
205 |
-
addData(name + '[]', value);
|
206 |
-
}
|
207 |
-
} else if (typeof data === 'object') {
|
208 |
-
for (var key in data) {
|
209 |
-
if (data.hasOwnProperty(key)) {
|
210 |
-
addData(name + '[' + key + ']', data[key]);
|
211 |
-
}
|
212 |
-
}
|
213 |
-
} else if (data != null) {
|
214 |
-
form.append($('<input>').attr({
|
215 |
-
type : 'hidden',
|
216 |
-
name : String(name),
|
217 |
-
value: String(data)
|
218 |
-
}));
|
219 |
-
}
|
220 |
-
};
|
221 |
-
|
222 |
-
for (var key in data) {
|
223 |
-
if (data.hasOwnProperty(key)) {
|
224 |
-
addData(key, data[key]);
|
225 |
-
}
|
226 |
-
}
|
227 |
-
|
228 |
-
return form.appendTo('body');
|
229 |
-
}
|
230 |
-
});
|
231 |
-
});
|
232 |
-
|
233 |
-
(function ($) {
|
234 |
-
$(function () {
|
235 |
-
|
236 |
-
var
|
237 |
-
// Keep track of the i-frame height.
|
238 |
-
frame_height = 800,
|
239 |
-
base_url = '<?php echo FS_CHECKOUT__ADDRESS ?>',
|
240 |
-
// Pass the parent page URL into the i-frame in a meaningful way (this URL could be
|
241 |
-
// passed via query string or hard coded into the child page, it depends on your needs).
|
242 |
-
src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
|
243 |
-
// Append the i-frame into the DOM.
|
244 |
-
frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
|
245 |
-
.appendTo('#fs_frame');
|
246 |
-
|
247 |
-
FS.PostMessage.init(base_url, [frame[0]]);
|
248 |
-
FS.PostMessage.receiveOnce('height', function (data) {
|
249 |
-
var h = data.height;
|
250 |
-
if (!isNaN(h) && h > 0 && h != frame_height) {
|
251 |
-
frame_height = h;
|
252 |
-
frame.height(frame_height + 'px');
|
253 |
-
|
254 |
-
FS.PostMessage.postScroll(frame[0]);
|
255 |
-
}
|
256 |
-
});
|
257 |
-
|
258 |
-
FS.PostMessage.receiveOnce('install', function (data) {
|
259 |
-
var requestData = {
|
260 |
-
user_id : data.user.id,
|
261 |
-
user_secret_key : data.user.secret_key,
|
262 |
-
user_public_key : data.user.public_key,
|
263 |
-
install_id : data.install.id,
|
264 |
-
install_secret_key: data.install.secret_key,
|
265 |
-
install_public_key: data.install.public_key
|
266 |
-
};
|
267 |
-
|
268 |
-
if (true === data.auto_install)
|
269 |
-
requestData.auto_install = true;
|
270 |
-
|
271 |
-
// Post data to activation URL.
|
272 |
-
$.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
|
273 |
-
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
274 |
-
'plugin_id' => $plugin_id
|
275 |
-
) ), $fs->get_unique_affix() . '_activate_new' ) ?>', requestData).submit();
|
276 |
-
});
|
277 |
-
|
278 |
-
FS.PostMessage.receiveOnce('pending_activation', function (data) {
|
279 |
-
var requestData = {
|
280 |
-
user_email: data.user_email
|
281 |
-
};
|
282 |
-
|
283 |
-
if (true === data.auto_install)
|
284 |
-
requestData.auto_install = true;
|
285 |
-
|
286 |
-
$.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
|
287 |
-
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
288 |
-
'plugin_id' => $plugin_id,
|
289 |
-
'pending_activation' => true,
|
290 |
-
) ), $fs->get_unique_affix() . '_activate_new' ) ?>', requestData).submit();
|
291 |
-
});
|
292 |
-
|
293 |
-
FS.PostMessage.receiveOnce('get_context', function () {
|
294 |
-
console.debug('receiveOnce', 'get_context');
|
295 |
-
|
296 |
-
// If the user didn't connect his account with Freemius,
|
297 |
-
// once he accepts the Terms of Service and Privacy Policy,
|
298 |
-
// and then click the purchase button, the context information
|
299 |
-
// of the user will be shared with Freemius in order to complete the
|
300 |
-
// purchase workflow and activate the license for the right user.
|
301 |
-
<?php $install_data = array_merge( $fs->get_opt_in_params(),
|
302 |
-
array(
|
303 |
-
'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
|
304 |
-
array(
|
305 |
-
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
306 |
-
'plugin_id' => $plugin_id,
|
307 |
-
|
308 |
-
) ),
|
309 |
-
$fs->get_unique_affix() . '_activate_new' )
|
310 |
-
) ) ?>
|
311 |
-
FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, frame[0]);
|
312 |
-
});
|
313 |
-
|
314 |
-
FS.PostMessage.receiveOnce('purchaseCompleted', <?php echo $fs->apply_filters('checkout/purchaseCompleted', 'function (data) {
|
315 |
-
console.log("checkout", "purchaseCompleted");
|
316 |
-
}') ?>);
|
317 |
-
|
318 |
-
FS.PostMessage.receiveOnce('get_dimensions', function (data) {
|
319 |
-
console.debug('receiveOnce', 'get_dimensions');
|
320 |
-
|
321 |
-
FS.PostMessage.post('dimensions', {
|
322 |
-
height : $(document.body).height(),
|
323 |
-
scrollTop: $(document).scrollTop()
|
324 |
-
}, frame[0]);
|
325 |
-
});
|
326 |
-
|
327 |
-
var updateHeight = function () {
|
328 |
-
frame.css('min-height', $(document.body).height() + 'px');
|
329 |
-
};
|
330 |
-
|
331 |
-
$(document).ready(updateHeight);
|
332 |
-
|
333 |
-
$(window).resize(updateHeight);
|
334 |
-
});
|
335 |
-
})(jQuery);
|
336 |
-
</script>
|
337 |
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
+
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
+
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
+
* we only develop and maintain one code base.
|
14 |
+
*
|
15 |
+
* This code (and page) will not run for wp.org themes (only plugins).
|
16 |
+
*
|
17 |
+
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
18 |
+
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
19 |
+
*
|
20 |
+
* UPDATE:
|
21 |
+
* After ongoing conversations with the WordPress.org TRT we received
|
22 |
+
* an official approval for including i-frames in the theme's WP Admin setting's
|
23 |
+
* page tab (the SDK will never add any i-frames on the sitefront). i-frames
|
24 |
+
* were never against the guidelines, but we wanted to get the team's blessings
|
25 |
+
* before we move forward. For the record, I got the final approval from
|
26 |
+
* Ulrich Pogson (@grapplerulrich), a team lead at the TRT during WordCamp
|
27 |
+
* Europe 2017 (June 16th, 2017).
|
28 |
+
*
|
29 |
+
* If you have any questions or need clarifications, please don't hesitate
|
30 |
+
* pinging me on slack, my username is @svovaf.
|
31 |
+
*
|
32 |
+
* @author Vova Feldman (@svovaf)
|
33 |
+
* @since 1.2.2
|
34 |
+
*/
|
35 |
+
|
36 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
37 |
+
exit;
|
38 |
+
}
|
39 |
+
|
40 |
+
wp_enqueue_script( 'jquery' );
|
41 |
+
wp_enqueue_script( 'json2' );
|
42 |
+
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
43 |
+
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
44 |
+
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
|
45 |
+
|
46 |
+
fs_enqueue_local_style( 'fs_checkout', '/admin/checkout.css' );
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var array $VARS
|
50 |
+
* @var Freemius $fs
|
51 |
+
*/
|
52 |
+
$fs = freemius( $VARS['id'] );
|
53 |
+
$slug = $fs->get_slug();
|
54 |
+
|
55 |
+
$timestamp = time();
|
56 |
+
|
57 |
+
$context_params = array(
|
58 |
+
'plugin_id' => $fs->get_id(),
|
59 |
+
'public_key' => $fs->get_public_key(),
|
60 |
+
'plugin_version' => $fs->get_plugin_version(),
|
61 |
+
'mode' => 'dashboard',
|
62 |
+
'trial' => fs_request_get_bool( 'trial' ),
|
63 |
+
);
|
64 |
+
|
65 |
+
$plan_id = fs_request_get( 'plan_id' );
|
66 |
+
if ( FS_Plugin_Plan::is_valid_id( $plan_id ) ) {
|
67 |
+
$context_params['plan_id'] = $plan_id;
|
68 |
+
}
|
69 |
+
|
70 |
+
$licenses = fs_request_get( 'licenses' );
|
71 |
+
if ( $licenses === strval( intval( $licenses ) ) && $licenses > 0 ) {
|
72 |
+
$context_params['licenses'] = $licenses;
|
73 |
+
}
|
74 |
+
|
75 |
+
$plugin_id = fs_request_get( 'plugin_id' );
|
76 |
+
if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
|
77 |
+
$plugin_id = $fs->get_id();
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( $plugin_id == $fs->get_id() ) {
|
81 |
+
$is_premium = $fs->is_premium();
|
82 |
+
|
83 |
+
$bundle_id = $fs->get_bundle_id();
|
84 |
+
if ( ! is_null( $bundle_id ) ) {
|
85 |
+
$context_params['bundle_id'] = $bundle_id;
|
86 |
+
}
|
87 |
+
} else {
|
88 |
+
// Identify the module code version of the checkout context module.
|
89 |
+
if ( $fs->is_addon_activated( $plugin_id ) ) {
|
90 |
+
$fs_addon = Freemius::get_instance_by_id( $plugin_id );
|
91 |
+
$is_premium = $fs_addon->is_premium();
|
92 |
+
} else {
|
93 |
+
// If add-on isn't activated assume the premium version isn't installed.
|
94 |
+
$is_premium = false;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
// Get site context secure params.
|
99 |
+
if ( $fs->is_registered() ) {
|
100 |
+
$site = $fs->get_site();
|
101 |
+
|
102 |
+
if ( $plugin_id != $fs->get_id() ) {
|
103 |
+
if ( $fs->is_addon_activated( $plugin_id ) ) {
|
104 |
+
$fs_addon = Freemius::get_instance_by_id( $plugin_id );
|
105 |
+
$addon_site = $fs_addon->get_site();
|
106 |
+
if ( is_object( $addon_site ) ) {
|
107 |
+
$site = $addon_site;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
113 |
+
$site,
|
114 |
+
$timestamp,
|
115 |
+
'checkout'
|
116 |
+
) );
|
117 |
+
} else {
|
118 |
+
$current_user = Freemius::_get_current_wp_user();
|
119 |
+
|
120 |
+
// Add site and user info to the request, this information
|
121 |
+
// is NOT being stored unless the user complete the purchase
|
122 |
+
// and agrees to the TOS.
|
123 |
+
$context_params = array_merge( $context_params, array(
|
124 |
+
'user_firstname' => $current_user->user_firstname,
|
125 |
+
'user_lastname' => $current_user->user_lastname,
|
126 |
+
'user_email' => $current_user->user_email,
|
127 |
+
'home_url' => home_url(),
|
128 |
+
) );
|
129 |
+
|
130 |
+
$fs_user = Freemius::_get_user_by_email( $current_user->user_email );
|
131 |
+
|
132 |
+
if ( is_object( $fs_user ) && $fs_user->is_verified() ) {
|
133 |
+
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
134 |
+
$fs_user,
|
135 |
+
$timestamp,
|
136 |
+
'checkout'
|
137 |
+
) );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( $fs->is_payments_sandbox() ) {
|
142 |
+
// Append plugin secure token for sandbox mode authentication.
|
143 |
+
$context_params['sandbox'] = FS_Security::instance()->get_secure_token(
|
144 |
+
$fs->get_plugin(),
|
145 |
+
$timestamp,
|
146 |
+
'checkout'
|
147 |
+
);
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
|
151 |
+
*/
|
152 |
+
if ( empty( $context_params['s_ctx_ts'] ) ) {
|
153 |
+
$context_params['s_ctx_ts'] = $timestamp;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
$return_url = $fs->_get_sync_license_url( $plugin_id );
|
158 |
+
|
159 |
+
$can_user_install = (
|
160 |
+
( $fs->is_plugin() && current_user_can( 'install_plugins' ) ) ||
|
161 |
+
( $fs->is_theme() && current_user_can( 'install_themes' ) )
|
162 |
+
);
|
163 |
+
|
164 |
+
$query_params = array_merge( $context_params, $_GET, array(
|
165 |
+
// Current plugin version.
|
166 |
+
'plugin_version' => $fs->get_plugin_version(),
|
167 |
+
'sdk_version' => WP_FS__SDK_VERSION,
|
168 |
+
'is_premium' => $is_premium ? 'true' : 'false',
|
169 |
+
'can_install' => $can_user_install ? 'true' : 'false',
|
170 |
+
'return_url' => $return_url,
|
171 |
+
) );
|
172 |
+
|
173 |
+
$xdebug_session = fs_request_get( 'XDEBUG_SESSION' );
|
174 |
+
if ( false !== $xdebug_session ) {
|
175 |
+
$query_params['XDEBUG_SESSION'] = $xdebug_session;
|
176 |
+
}
|
177 |
+
|
178 |
+
$view_params = array(
|
179 |
+
'id' => $VARS['id'],
|
180 |
+
'page' => strtolower( $fs->get_text_inline( 'Checkout', 'checkout' ) ) . ' ' . $fs->get_text_inline( 'PCI compliant', 'pci-compliant' ),
|
181 |
+
);
|
182 |
+
fs_require_once_template('secure-https-header.php', $view_params);
|
183 |
+
?>
|
184 |
+
<div id="fs_checkout" class="wrap fs-section fs-full-size-wrapper">
|
185 |
+
<div id="fs_frame"></div>
|
186 |
+
<script type="text/javascript">
|
187 |
+
// http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
|
188 |
+
jQuery(function ($) {
|
189 |
+
$.extend({
|
190 |
+
form: function (url, data, method) {
|
191 |
+
if (method == null) method = 'POST';
|
192 |
+
if (data == null) data = {};
|
193 |
+
|
194 |
+
var form = $('<form>').attr({
|
195 |
+
method: method,
|
196 |
+
action: url
|
197 |
+
}).css({
|
198 |
+
display: 'none'
|
199 |
+
});
|
200 |
+
|
201 |
+
var addData = function (name, data) {
|
202 |
+
if ($.isArray(data)) {
|
203 |
+
for (var i = 0; i < data.length; i++) {
|
204 |
+
var value = data[i];
|
205 |
+
addData(name + '[]', value);
|
206 |
+
}
|
207 |
+
} else if (typeof data === 'object') {
|
208 |
+
for (var key in data) {
|
209 |
+
if (data.hasOwnProperty(key)) {
|
210 |
+
addData(name + '[' + key + ']', data[key]);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
} else if (data != null) {
|
214 |
+
form.append($('<input>').attr({
|
215 |
+
type : 'hidden',
|
216 |
+
name : String(name),
|
217 |
+
value: String(data)
|
218 |
+
}));
|
219 |
+
}
|
220 |
+
};
|
221 |
+
|
222 |
+
for (var key in data) {
|
223 |
+
if (data.hasOwnProperty(key)) {
|
224 |
+
addData(key, data[key]);
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
return form.appendTo('body');
|
229 |
+
}
|
230 |
+
});
|
231 |
+
});
|
232 |
+
|
233 |
+
(function ($) {
|
234 |
+
$(function () {
|
235 |
+
|
236 |
+
var
|
237 |
+
// Keep track of the i-frame height.
|
238 |
+
frame_height = 800,
|
239 |
+
base_url = '<?php echo FS_CHECKOUT__ADDRESS ?>',
|
240 |
+
// Pass the parent page URL into the i-frame in a meaningful way (this URL could be
|
241 |
+
// passed via query string or hard coded into the child page, it depends on your needs).
|
242 |
+
src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
|
243 |
+
// Append the i-frame into the DOM.
|
244 |
+
frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
|
245 |
+
.appendTo('#fs_frame');
|
246 |
+
|
247 |
+
FS.PostMessage.init(base_url, [frame[0]]);
|
248 |
+
FS.PostMessage.receiveOnce('height', function (data) {
|
249 |
+
var h = data.height;
|
250 |
+
if (!isNaN(h) && h > 0 && h != frame_height) {
|
251 |
+
frame_height = h;
|
252 |
+
frame.height(frame_height + 'px');
|
253 |
+
|
254 |
+
FS.PostMessage.postScroll(frame[0]);
|
255 |
+
}
|
256 |
+
});
|
257 |
+
|
258 |
+
FS.PostMessage.receiveOnce('install', function (data) {
|
259 |
+
var requestData = {
|
260 |
+
user_id : data.user.id,
|
261 |
+
user_secret_key : data.user.secret_key,
|
262 |
+
user_public_key : data.user.public_key,
|
263 |
+
install_id : data.install.id,
|
264 |
+
install_secret_key: data.install.secret_key,
|
265 |
+
install_public_key: data.install.public_key
|
266 |
+
};
|
267 |
+
|
268 |
+
if (true === data.auto_install)
|
269 |
+
requestData.auto_install = true;
|
270 |
+
|
271 |
+
// Post data to activation URL.
|
272 |
+
$.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
|
273 |
+
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
274 |
+
'plugin_id' => $plugin_id
|
275 |
+
) ), $fs->get_unique_affix() . '_activate_new' ) ?>', requestData).submit();
|
276 |
+
});
|
277 |
+
|
278 |
+
FS.PostMessage.receiveOnce('pending_activation', function (data) {
|
279 |
+
var requestData = {
|
280 |
+
user_email: data.user_email
|
281 |
+
};
|
282 |
+
|
283 |
+
if (true === data.auto_install)
|
284 |
+
requestData.auto_install = true;
|
285 |
+
|
286 |
+
$.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
|
287 |
+
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
288 |
+
'plugin_id' => $plugin_id,
|
289 |
+
'pending_activation' => true,
|
290 |
+
) ), $fs->get_unique_affix() . '_activate_new' ) ?>', requestData).submit();
|
291 |
+
});
|
292 |
+
|
293 |
+
FS.PostMessage.receiveOnce('get_context', function () {
|
294 |
+
console.debug('receiveOnce', 'get_context');
|
295 |
+
|
296 |
+
// If the user didn't connect his account with Freemius,
|
297 |
+
// once he accepts the Terms of Service and Privacy Policy,
|
298 |
+
// and then click the purchase button, the context information
|
299 |
+
// of the user will be shared with Freemius in order to complete the
|
300 |
+
// purchase workflow and activate the license for the right user.
|
301 |
+
<?php $install_data = array_merge( $fs->get_opt_in_params(),
|
302 |
+
array(
|
303 |
+
'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
|
304 |
+
array(
|
305 |
+
'fs_action' => $fs->get_unique_affix() . '_activate_new',
|
306 |
+
'plugin_id' => $plugin_id,
|
307 |
+
|
308 |
+
) ),
|
309 |
+
$fs->get_unique_affix() . '_activate_new' )
|
310 |
+
) ) ?>
|
311 |
+
FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, frame[0]);
|
312 |
+
});
|
313 |
+
|
314 |
+
FS.PostMessage.receiveOnce('purchaseCompleted', <?php echo $fs->apply_filters('checkout/purchaseCompleted', 'function (data) {
|
315 |
+
console.log("checkout", "purchaseCompleted");
|
316 |
+
}') ?>);
|
317 |
+
|
318 |
+
FS.PostMessage.receiveOnce('get_dimensions', function (data) {
|
319 |
+
console.debug('receiveOnce', 'get_dimensions');
|
320 |
+
|
321 |
+
FS.PostMessage.post('dimensions', {
|
322 |
+
height : $(document.body).height(),
|
323 |
+
scrollTop: $(document).scrollTop()
|
324 |
+
}, frame[0]);
|
325 |
+
});
|
326 |
+
|
327 |
+
var updateHeight = function () {
|
328 |
+
frame.css('min-height', $(document.body).height() + 'px');
|
329 |
+
};
|
330 |
+
|
331 |
+
$(document).ready(updateHeight);
|
332 |
+
|
333 |
+
$(window).resize(updateHeight);
|
334 |
+
});
|
335 |
+
})(jQuery);
|
336 |
+
</script>
|
337 |
</div>
|
lib/freemius/templates/clone-resolution-js.php
CHANGED
@@ -1,77 +1,77 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.5.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
?>
|
13 |
-
<script type="text/javascript">
|
14 |
-
( function( $ ) {
|
15 |
-
var $errorMessage = null;
|
16 |
-
|
17 |
-
$( document ).ready( function() {
|
18 |
-
var $cloneResolutionNotice = $( 'div[data-id="clone_resolution_options_notice"], div[data-id="temporary_duplicate_notice"]' );
|
19 |
-
|
20 |
-
if ( 0 === $cloneResolutionNotice.length ) {
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
|
24 |
-
$errorMessage = $cloneResolutionNotice.find( '#fs_clone_resolution_error_message' );
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Triggers an AJAX request when the license activation link or any of the buttons on the clone resolution options notice is clicked. The AJAX request will then handle the action the user has chosen.
|
28 |
-
*/
|
29 |
-
$cloneResolutionNotice.on( 'click', '.button, #fs_temporary_duplicate_license_activation_link', function( evt ) {
|
30 |
-
evt.preventDefault();
|
31 |
-
|
32 |
-
var $this = $( this ),
|
33 |
-
$body = $( 'body' ),
|
34 |
-
cursor = $body.css( 'cursor' );
|
35 |
-
|
36 |
-
if ( $this.hasClass( 'disabled' ) ) {
|
37 |
-
return;
|
38 |
-
}
|
39 |
-
|
40 |
-
var beforeUnload = function() {
|
41 |
-
return '<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait' ) ?>';
|
42 |
-
};
|
43 |
-
|
44 |
-
$.ajax( {
|
45 |
-
// Get the parent options container from the child as `$cloneResolutionNotice` can have different AJAX URLs if both the manual clone resolution options and temporary duplicate notices are shown (for different subsites in a multisite network).
|
46 |
-
url : $this.parents( '.fs-clone-resolution-options-container' ).data( 'ajax-url' ),
|
47 |
-
method : 'POST',
|
48 |
-
data : {
|
49 |
-
action : '<?php echo $VARS['ajax_action'] ?>',
|
50 |
-
security : '<?php echo wp_create_nonce( $VARS['ajax_action'] ) ?>',
|
51 |
-
clone_action: $this.data( 'clone-action' )
|
52 |
-
},
|
53 |
-
beforeSend: function() {
|
54 |
-
$body.css( { cursor: 'wait' } );
|
55 |
-
|
56 |
-
$cloneResolutionNotice.find( '.button' ).addClass( 'disabled' );
|
57 |
-
|
58 |
-
$( window ).on( 'beforeunload', beforeUnload );
|
59 |
-
},
|
60 |
-
success : function( resultObj ) {
|
61 |
-
$( window ).off( 'beforeunload', beforeUnload );
|
62 |
-
|
63 |
-
if ( resultObj.data.redirect_url && '' !== resultObj.data.redirect_url ) {
|
64 |
-
window.location = resultObj.data.redirect_url;
|
65 |
-
} else {
|
66 |
-
window.location.reload();
|
67 |
-
}
|
68 |
-
},
|
69 |
-
error : function() {
|
70 |
-
$body.css( { cursor: cursor } );
|
71 |
-
$cloneResolutionNotice.find( '.button' ).removeClass( 'disabled' );
|
72 |
-
}
|
73 |
-
} );
|
74 |
-
} );
|
75 |
-
} );
|
76 |
-
} )( jQuery );
|
77 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.5.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
?>
|
13 |
+
<script type="text/javascript">
|
14 |
+
( function( $ ) {
|
15 |
+
var $errorMessage = null;
|
16 |
+
|
17 |
+
$( document ).ready( function() {
|
18 |
+
var $cloneResolutionNotice = $( 'div[data-id="clone_resolution_options_notice"], div[data-id="temporary_duplicate_notice"]' );
|
19 |
+
|
20 |
+
if ( 0 === $cloneResolutionNotice.length ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
|
24 |
+
$errorMessage = $cloneResolutionNotice.find( '#fs_clone_resolution_error_message' );
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Triggers an AJAX request when the license activation link or any of the buttons on the clone resolution options notice is clicked. The AJAX request will then handle the action the user has chosen.
|
28 |
+
*/
|
29 |
+
$cloneResolutionNotice.on( 'click', '.button, #fs_temporary_duplicate_license_activation_link', function( evt ) {
|
30 |
+
evt.preventDefault();
|
31 |
+
|
32 |
+
var $this = $( this ),
|
33 |
+
$body = $( 'body' ),
|
34 |
+
cursor = $body.css( 'cursor' );
|
35 |
+
|
36 |
+
if ( $this.hasClass( 'disabled' ) ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
var beforeUnload = function() {
|
41 |
+
return '<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait' ) ?>';
|
42 |
+
};
|
43 |
+
|
44 |
+
$.ajax( {
|
45 |
+
// Get the parent options container from the child as `$cloneResolutionNotice` can have different AJAX URLs if both the manual clone resolution options and temporary duplicate notices are shown (for different subsites in a multisite network).
|
46 |
+
url : $this.parents( '.fs-clone-resolution-options-container' ).data( 'ajax-url' ),
|
47 |
+
method : 'POST',
|
48 |
+
data : {
|
49 |
+
action : '<?php echo $VARS['ajax_action'] ?>',
|
50 |
+
security : '<?php echo wp_create_nonce( $VARS['ajax_action'] ) ?>',
|
51 |
+
clone_action: $this.data( 'clone-action' )
|
52 |
+
},
|
53 |
+
beforeSend: function() {
|
54 |
+
$body.css( { cursor: 'wait' } );
|
55 |
+
|
56 |
+
$cloneResolutionNotice.find( '.button' ).addClass( 'disabled' );
|
57 |
+
|
58 |
+
$( window ).on( 'beforeunload', beforeUnload );
|
59 |
+
},
|
60 |
+
success : function( resultObj ) {
|
61 |
+
$( window ).off( 'beforeunload', beforeUnload );
|
62 |
+
|
63 |
+
if ( resultObj.data.redirect_url && '' !== resultObj.data.redirect_url ) {
|
64 |
+
window.location = resultObj.data.redirect_url;
|
65 |
+
} else {
|
66 |
+
window.location.reload();
|
67 |
+
}
|
68 |
+
},
|
69 |
+
error : function() {
|
70 |
+
$body.css( { cursor: cursor } );
|
71 |
+
$cloneResolutionNotice.find( '.button' ).removeClass( 'disabled' );
|
72 |
+
}
|
73 |
+
} );
|
74 |
+
} );
|
75 |
+
} );
|
76 |
+
} )( jQuery );
|
77 |
</script>
|
lib/freemius/templates/contact.php
CHANGED
@@ -1,128 +1,128 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
-
* we only develop and maintain one code base.
|
14 |
-
*
|
15 |
-
* This code (and page) will not run for wp.org themes (only plugins).
|
16 |
-
*
|
17 |
-
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
18 |
-
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
19 |
-
*
|
20 |
-
* UPDATE:
|
21 |
-
* After ongoing conversations with the WordPress.org TRT we received
|
22 |
-
* an official approval for including i-frames in the theme's WP Admin setting's
|
23 |
-
* page tab (the SDK will never add any i-frames on the sitefront). i-frames
|
24 |
-
* were never against the guidelines, but we wanted to get the team's blessings
|
25 |
-
* before we move forward. For the record, I got the final approval from
|
26 |
-
* Ulrich Pogson (@grapplerulrich), a team lead at the TRT during WordCamp
|
27 |
-
* Europe 2017 (June 16th, 2017).
|
28 |
-
*
|
29 |
-
* If you have any questions or need clarifications, please don't hesitate
|
30 |
-
* pinging me on slack, my username is @svovaf.
|
31 |
-
*
|
32 |
-
* @author Vova Feldman (@svovaf)
|
33 |
-
* @since 1.2.2
|
34 |
-
*/
|
35 |
-
|
36 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
37 |
-
exit;
|
38 |
-
}
|
39 |
-
|
40 |
-
wp_enqueue_script( 'jquery' );
|
41 |
-
wp_enqueue_script( 'json2' );
|
42 |
-
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
43 |
-
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
44 |
-
fs_enqueue_local_style( 'fs_checkout', '/admin/common.css' );
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var array $VARS
|
48 |
-
* @var Freemius $fs
|
49 |
-
*/
|
50 |
-
$fs = freemius( $VARS['id'] );
|
51 |
-
$slug = $fs->get_slug();
|
52 |
-
|
53 |
-
$context_params = array(
|
54 |
-
'plugin_id' => $fs->get_id(),
|
55 |
-
'plugin_public_key' => $fs->get_public_key(),
|
56 |
-
'plugin_version' => $fs->get_plugin_version(),
|
57 |
-
);
|
58 |
-
|
59 |
-
|
60 |
-
// Get site context secure params.
|
61 |
-
if ( $fs->is_registered() ) {
|
62 |
-
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
63 |
-
$fs->get_site(),
|
64 |
-
time(),
|
65 |
-
'contact'
|
66 |
-
) );
|
67 |
-
}
|
68 |
-
|
69 |
-
$query_params = array_merge( $_GET, array_merge( $context_params, array(
|
70 |
-
'plugin_version' => $fs->get_plugin_version(),
|
71 |
-
'wp_login_url' => wp_login_url(),
|
72 |
-
'site_url' => get_site_url(),
|
73 |
-
// 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
|
74 |
-
) ) );
|
75 |
-
|
76 |
-
$view_params = array(
|
77 |
-
'id' => $VARS['id'],
|
78 |
-
'page' => strtolower( $fs->get_text_inline( 'Contact', 'contact' ) ),
|
79 |
-
);
|
80 |
-
fs_require_once_template('secure-https-header.php', $view_params);
|
81 |
-
|
82 |
-
$has_tabs = $fs->_add_tabs_before_content();
|
83 |
-
|
84 |
-
if ( $has_tabs ) {
|
85 |
-
$query_params['tabs'] = 'true';
|
86 |
-
}
|
87 |
-
?>
|
88 |
-
<div id="fs_contact" class="wrap fs-section fs-full-size-wrapper">
|
89 |
-
<div id="fs_frame"></div>
|
90 |
-
<script type="text/javascript">
|
91 |
-
(function ($) {
|
92 |
-
$(function () {
|
93 |
-
|
94 |
-
var
|
95 |
-
// Keep track of the i-frame height.
|
96 |
-
frame_height = 800,
|
97 |
-
base_url = '<?php echo WP_FS__ADDRESS ?>',
|
98 |
-
src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
|
99 |
-
|
100 |
-
// Append the i-frame into the DOM.
|
101 |
-
frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
|
102 |
-
.appendTo('#fs_frame');
|
103 |
-
|
104 |
-
FS.PostMessage.init(base_url);
|
105 |
-
FS.PostMessage.receive('height', function (data) {
|
106 |
-
var h = data.height;
|
107 |
-
if (!isNaN(h) && h > 0 && h != frame_height) {
|
108 |
-
frame_height = h;
|
109 |
-
$('#fs_frame i' + 'frame').height(frame_height + 'px');
|
110 |
-
}
|
111 |
-
});
|
112 |
-
});
|
113 |
-
})(jQuery);
|
114 |
-
</script>
|
115 |
-
</div>
|
116 |
-
<?php
|
117 |
-
if ( $has_tabs ) {
|
118 |
-
$fs->_add_tabs_after_content();
|
119 |
-
}
|
120 |
-
|
121 |
-
$params = array(
|
122 |
-
'page' => 'contact',
|
123 |
-
'module_id' => $fs->get_id(),
|
124 |
-
'module_type' => $fs->get_module_type(),
|
125 |
-
'module_slug' => $slug,
|
126 |
-
'module_version' => $fs->get_plugin_version(),
|
127 |
-
);
|
128 |
fs_require_template( 'powered-by.php', $params );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
+
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
+
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
+
* we only develop and maintain one code base.
|
14 |
+
*
|
15 |
+
* This code (and page) will not run for wp.org themes (only plugins).
|
16 |
+
*
|
17 |
+
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
18 |
+
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
19 |
+
*
|
20 |
+
* UPDATE:
|
21 |
+
* After ongoing conversations with the WordPress.org TRT we received
|
22 |
+
* an official approval for including i-frames in the theme's WP Admin setting's
|
23 |
+
* page tab (the SDK will never add any i-frames on the sitefront). i-frames
|
24 |
+
* were never against the guidelines, but we wanted to get the team's blessings
|
25 |
+
* before we move forward. For the record, I got the final approval from
|
26 |
+
* Ulrich Pogson (@grapplerulrich), a team lead at the TRT during WordCamp
|
27 |
+
* Europe 2017 (June 16th, 2017).
|
28 |
+
*
|
29 |
+
* If you have any questions or need clarifications, please don't hesitate
|
30 |
+
* pinging me on slack, my username is @svovaf.
|
31 |
+
*
|
32 |
+
* @author Vova Feldman (@svovaf)
|
33 |
+
* @since 1.2.2
|
34 |
+
*/
|
35 |
+
|
36 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
37 |
+
exit;
|
38 |
+
}
|
39 |
+
|
40 |
+
wp_enqueue_script( 'jquery' );
|
41 |
+
wp_enqueue_script( 'json2' );
|
42 |
+
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
43 |
+
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
44 |
+
fs_enqueue_local_style( 'fs_checkout', '/admin/common.css' );
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var array $VARS
|
48 |
+
* @var Freemius $fs
|
49 |
+
*/
|
50 |
+
$fs = freemius( $VARS['id'] );
|
51 |
+
$slug = $fs->get_slug();
|
52 |
+
|
53 |
+
$context_params = array(
|
54 |
+
'plugin_id' => $fs->get_id(),
|
55 |
+
'plugin_public_key' => $fs->get_public_key(),
|
56 |
+
'plugin_version' => $fs->get_plugin_version(),
|
57 |
+
);
|
58 |
+
|
59 |
+
|
60 |
+
// Get site context secure params.
|
61 |
+
if ( $fs->is_registered() ) {
|
62 |
+
$context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
|
63 |
+
$fs->get_site(),
|
64 |
+
time(),
|
65 |
+
'contact'
|
66 |
+
) );
|
67 |
+
}
|
68 |
+
|
69 |
+
$query_params = array_merge( $_GET, array_merge( $context_params, array(
|
70 |
+
'plugin_version' => $fs->get_plugin_version(),
|
71 |
+
'wp_login_url' => wp_login_url(),
|
72 |
+
'site_url' => get_site_url(),
|
73 |
+
// 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
|
74 |
+
) ) );
|
75 |
+
|
76 |
+
$view_params = array(
|
77 |
+
'id' => $VARS['id'],
|
78 |
+
'page' => strtolower( $fs->get_text_inline( 'Contact', 'contact' ) ),
|
79 |
+
);
|
80 |
+
fs_require_once_template('secure-https-header.php', $view_params);
|
81 |
+
|
82 |
+
$has_tabs = $fs->_add_tabs_before_content();
|
83 |
+
|
84 |
+
if ( $has_tabs ) {
|
85 |
+
$query_params['tabs'] = 'true';
|
86 |
+
}
|
87 |
+
?>
|
88 |
+
<div id="fs_contact" class="wrap fs-section fs-full-size-wrapper">
|
89 |
+
<div id="fs_frame"></div>
|
90 |
+
<script type="text/javascript">
|
91 |
+
(function ($) {
|
92 |
+
$(function () {
|
93 |
+
|
94 |
+
var
|
95 |
+
// Keep track of the i-frame height.
|
96 |
+
frame_height = 800,
|
97 |
+
base_url = '<?php echo WP_FS__ADDRESS ?>',
|
98 |
+
src = base_url + '/contact/?<?php echo http_build_query($query_params) ?>#' + encodeURIComponent(document.location.href),
|
99 |
+
|
100 |
+
// Append the i-frame into the DOM.
|
101 |
+
frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
|
102 |
+
.appendTo('#fs_frame');
|
103 |
+
|
104 |
+
FS.PostMessage.init(base_url);
|
105 |
+
FS.PostMessage.receive('height', function (data) {
|
106 |
+
var h = data.height;
|
107 |
+
if (!isNaN(h) && h > 0 && h != frame_height) {
|
108 |
+
frame_height = h;
|
109 |
+
$('#fs_frame i' + 'frame').height(frame_height + 'px');
|
110 |
+
}
|
111 |
+
});
|
112 |
+
});
|
113 |
+
})(jQuery);
|
114 |
+
</script>
|
115 |
+
</div>
|
116 |
+
<?php
|
117 |
+
if ( $has_tabs ) {
|
118 |
+
$fs->_add_tabs_after_content();
|
119 |
+
}
|
120 |
+
|
121 |
+
$params = array(
|
122 |
+
'page' => 'contact',
|
123 |
+
'module_id' => $fs->get_id(),
|
124 |
+
'module_type' => $fs->get_module_type(),
|
125 |
+
'module_slug' => $slug,
|
126 |
+
'module_version' => $fs->get_plugin_version(),
|
127 |
+
);
|
128 |
fs_require_template( 'powered-by.php', $params );
|
lib/freemius/templates/debug/api-calls.php
CHANGED
@@ -1,155 +1,155 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
14 |
-
$logger = Freemius_Api_WordPress::GetLogger();
|
15 |
-
} else {
|
16 |
-
$logger = array();
|
17 |
-
}
|
18 |
-
|
19 |
-
$counters = array(
|
20 |
-
'GET' => 0,
|
21 |
-
'POST' => 0,
|
22 |
-
'PUT' => 0,
|
23 |
-
'DELETE' => 0
|
24 |
-
);
|
25 |
-
|
26 |
-
$show_body = false;
|
27 |
-
foreach ( $logger as $log ) {
|
28 |
-
$counters[ $log['method'] ] ++;
|
29 |
-
|
30 |
-
if ( ! is_null( $log['body'] ) ) {
|
31 |
-
$show_body = true;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
$pretty_print = $show_body && defined( 'JSON_PRETTY_PRINT' ) && version_compare( phpversion(), '5.3', '>=' );
|
36 |
-
|
37 |
-
/**
|
38 |
-
* This template is used for debugging, therefore, when possible
|
39 |
-
* we'd like to prettify the output of a JSON encoded variable.
|
40 |
-
* This will only be executed when $pretty_print is `true`, and
|
41 |
-
* the var is `true` only for PHP 5.3 and higher. Due to the
|
42 |
-
* limitations of the current Theme Check, it throws an error
|
43 |
-
* that using the "options" parameter (the 2nd param) is not
|
44 |
-
* supported in PHP 5.2 and lower. Thus, we added this alias
|
45 |
-
* variable to work around that false-positive.
|
46 |
-
*
|
47 |
-
* @author Vova Feldman (@svovaf)
|
48 |
-
* @since 1.2.2.7
|
49 |
-
*/
|
50 |
-
$encode = 'json_encode';
|
51 |
-
|
52 |
-
$root_path_len = strlen( ABSPATH );
|
53 |
-
|
54 |
-
$ms_text = fs_text_x_inline( 'ms', 'milliseconds' );
|
55 |
-
?>
|
56 |
-
<h1><?php fs_echo_inline( 'API' ) ?></h1>
|
57 |
-
|
58 |
-
<h2><span>Total Time:</span><?php echo Freemius_Debug_Bar_Panel::total_time() ?></h2>
|
59 |
-
|
60 |
-
<h2><span>Total Requests:</span><?php echo Freemius_Debug_Bar_Panel::requests_count() ?></h2>
|
61 |
-
<?php foreach ( $counters as $method => $count ) : ?>
|
62 |
-
<h2><span><?php echo $method ?>:</span><?php echo number_format( $count ) ?></h2>
|
63 |
-
<?php endforeach ?>
|
64 |
-
<table class="widefat">
|
65 |
-
<thead>
|
66 |
-
<tr>
|
67 |
-
<th>#</th>
|
68 |
-
<th><?php fs_esc_html_echo_inline( 'Method' ) ?></th>
|
69 |
-
<th><?php fs_esc_html_echo_inline( 'Code' ) ?></th>
|
70 |
-
<th><?php fs_esc_html_echo_inline( 'Length' ) ?></th>
|
71 |
-
<th><?php fs_esc_html_echo_x_inline( 'Path', 'as file/folder path' ) ?></th>
|
72 |
-
<?php if ( $show_body ) : ?>
|
73 |
-
<th><?php fs_esc_html_echo_inline( 'Body' ) ?></th>
|
74 |
-
<?php endif ?>
|
75 |
-
<th><?php fs_esc_html_echo_inline( 'Result' ) ?></th>
|
76 |
-
<th><?php fs_esc_html_echo_inline( 'Start' ) ?></th>
|
77 |
-
<th><?php fs_esc_html_echo_inline( 'End' ) ?></th>
|
78 |
-
</tr>
|
79 |
-
</thead>
|
80 |
-
<tbody>
|
81 |
-
<?php foreach ( $logger as $log ) : ?>
|
82 |
-
<tr>
|
83 |
-
<td><?php echo $log['id'] ?>.</td>
|
84 |
-
<td><?php echo $log['method'] ?></td>
|
85 |
-
<td><?php echo $log['code'] ?></td>
|
86 |
-
<td><?php echo number_format( 100 * $log['total'], 2 ) . ' ' . $ms_text ?></td>
|
87 |
-
<td>
|
88 |
-
<?php
|
89 |
-
printf( '<a href="#" onclick="jQuery(this).parent().find(\'table\').toggle(); return false;">%s</a>',
|
90 |
-
$log['path']
|
91 |
-
);
|
92 |
-
?>
|
93 |
-
<table class="widefat" style="display: none">
|
94 |
-
<tbody>
|
95 |
-
<?php for ( $i = 0, $bt = $log['backtrace'], $len = count( $bt ); $i < $len; $i ++ ) : ?>
|
96 |
-
<tr>
|
97 |
-
<td><?php echo( $len - $i ) ?></td>
|
98 |
-
<td><?php if ( isset( $bt[ $i ]['function'] ) ) {
|
99 |
-
echo ( isset( $bt[ $i ]['class'] ) ? $bt[ $i ]['class'] . $bt[ $i ]['type'] : '' ) . $bt[ $i ]['function'];
|
100 |
-
} ?></td>
|
101 |
-
<td><?php if ( isset( $bt[ $i ]['file'] ) ) {
|
102 |
-
echo substr( $bt[ $i ]['file'], $root_path_len ) . ':' . $bt[ $i ]['line'];
|
103 |
-
} ?></td>
|
104 |
-
</tr>
|
105 |
-
<?php endfor ?>
|
106 |
-
</tbody>
|
107 |
-
</table>
|
108 |
-
</td>
|
109 |
-
<?php if ( $show_body ) : ?>
|
110 |
-
<td>
|
111 |
-
<?php if ( 'GET' !== $log['method'] ) : ?>
|
112 |
-
<?php
|
113 |
-
$body = $log['body'];
|
114 |
-
printf(
|
115 |
-
'<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
|
116 |
-
substr( $body, 0, 32 ) . ( 32 < strlen( $body ) ? '...' : '' )
|
117 |
-
);
|
118 |
-
if ( $pretty_print ) {
|
119 |
-
$body = $encode( json_decode( $log['body'] ), JSON_PRETTY_PRINT );
|
120 |
-
}
|
121 |
-
?>
|
122 |
-
<pre style="display: none"><code><?php echo esc_html( $body ) ?></code></pre>
|
123 |
-
<?php endif ?>
|
124 |
-
</td>
|
125 |
-
<?php endif ?>
|
126 |
-
<td>
|
127 |
-
<?php
|
128 |
-
$result = $log['result'];
|
129 |
-
|
130 |
-
$is_not_empty_result = ( is_string( $result ) && ! empty( $result ) );
|
131 |
-
|
132 |
-
if ( $is_not_empty_result ) {
|
133 |
-
printf(
|
134 |
-
'<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
|
135 |
-
substr( $result, 0, 32 ) . ( 32 < strlen( $result ) ? '...' : '' )
|
136 |
-
);
|
137 |
-
}
|
138 |
-
|
139 |
-
if ( $is_not_empty_result && $pretty_print ) {
|
140 |
-
$decoded = json_decode( $result );
|
141 |
-
if ( ! is_null( $decoded ) ) {
|
142 |
-
$result = $encode( $decoded, JSON_PRETTY_PRINT );
|
143 |
-
}
|
144 |
-
} else {
|
145 |
-
$result = is_string( $result ) ? $result : json_encode( $result );
|
146 |
-
}
|
147 |
-
?>
|
148 |
-
<pre<?php if ( $is_not_empty_result ) : ?> style="display: none"<?php endif ?>><code><?php echo esc_html( $result ) ?></code></pre>
|
149 |
-
</td>
|
150 |
-
<td><?php echo number_format( 100 * ( $log['start'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . $ms_text ?></td>
|
151 |
-
<td><?php echo number_format( 100 * ( $log['end'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . $ms_text ?></td>
|
152 |
-
</tr>
|
153 |
-
<?php endforeach ?>
|
154 |
-
</tbody>
|
155 |
</table>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
|
14 |
+
$logger = Freemius_Api_WordPress::GetLogger();
|
15 |
+
} else {
|
16 |
+
$logger = array();
|
17 |
+
}
|
18 |
+
|
19 |
+
$counters = array(
|
20 |
+
'GET' => 0,
|
21 |
+
'POST' => 0,
|
22 |
+
'PUT' => 0,
|
23 |
+
'DELETE' => 0
|
24 |
+
);
|
25 |
+
|
26 |
+
$show_body = false;
|
27 |
+
foreach ( $logger as $log ) {
|
28 |
+
$counters[ $log['method'] ] ++;
|
29 |
+
|
30 |
+
if ( ! is_null( $log['body'] ) ) {
|
31 |
+
$show_body = true;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
$pretty_print = $show_body && defined( 'JSON_PRETTY_PRINT' ) && version_compare( phpversion(), '5.3', '>=' );
|
36 |
+
|
37 |
+
/**
|
38 |
+
* This template is used for debugging, therefore, when possible
|
39 |
+
* we'd like to prettify the output of a JSON encoded variable.
|
40 |
+
* This will only be executed when $pretty_print is `true`, and
|
41 |
+
* the var is `true` only for PHP 5.3 and higher. Due to the
|
42 |
+
* limitations of the current Theme Check, it throws an error
|
43 |
+
* that using the "options" parameter (the 2nd param) is not
|
44 |
+
* supported in PHP 5.2 and lower. Thus, we added this alias
|
45 |
+
* variable to work around that false-positive.
|
46 |
+
*
|
47 |
+
* @author Vova Feldman (@svovaf)
|
48 |
+
* @since 1.2.2.7
|
49 |
+
*/
|
50 |
+
$encode = 'json_encode';
|
51 |
+
|
52 |
+
$root_path_len = strlen( ABSPATH );
|
53 |
+
|
54 |
+
$ms_text = fs_text_x_inline( 'ms', 'milliseconds' );
|
55 |
+
?>
|
56 |
+
<h1><?php fs_echo_inline( 'API' ) ?></h1>
|
57 |
+
|
58 |
+
<h2><span>Total Time:</span><?php echo Freemius_Debug_Bar_Panel::total_time() ?></h2>
|
59 |
+
|
60 |
+
<h2><span>Total Requests:</span><?php echo Freemius_Debug_Bar_Panel::requests_count() ?></h2>
|
61 |
+
<?php foreach ( $counters as $method => $count ) : ?>
|
62 |
+
<h2><span><?php echo $method ?>:</span><?php echo number_format( $count ) ?></h2>
|
63 |
+
<?php endforeach ?>
|
64 |
+
<table class="widefat">
|
65 |
+
<thead>
|
66 |
+
<tr>
|
67 |
+
<th>#</th>
|
68 |
+
<th><?php fs_esc_html_echo_inline( 'Method' ) ?></th>
|
69 |
+
<th><?php fs_esc_html_echo_inline( 'Code' ) ?></th>
|
70 |
+
<th><?php fs_esc_html_echo_inline( 'Length' ) ?></th>
|
71 |
+
<th><?php fs_esc_html_echo_x_inline( 'Path', 'as file/folder path' ) ?></th>
|
72 |
+
<?php if ( $show_body ) : ?>
|
73 |
+
<th><?php fs_esc_html_echo_inline( 'Body' ) ?></th>
|
74 |
+
<?php endif ?>
|
75 |
+
<th><?php fs_esc_html_echo_inline( 'Result' ) ?></th>
|
76 |
+
<th><?php fs_esc_html_echo_inline( 'Start' ) ?></th>
|
77 |
+
<th><?php fs_esc_html_echo_inline( 'End' ) ?></th>
|
78 |
+
</tr>
|
79 |
+
</thead>
|
80 |
+
<tbody>
|
81 |
+
<?php foreach ( $logger as $log ) : ?>
|
82 |
+
<tr>
|
83 |
+
<td><?php echo $log['id'] ?>.</td>
|
84 |
+
<td><?php echo $log['method'] ?></td>
|
85 |
+
<td><?php echo $log['code'] ?></td>
|
86 |
+
<td><?php echo number_format( 100 * $log['total'], 2 ) . ' ' . $ms_text ?></td>
|
87 |
+
<td>
|
88 |
+
<?php
|
89 |
+
printf( '<a href="#" onclick="jQuery(this).parent().find(\'table\').toggle(); return false;">%s</a>',
|
90 |
+
$log['path']
|
91 |
+
);
|
92 |
+
?>
|
93 |
+
<table class="widefat" style="display: none">
|
94 |
+
<tbody>
|
95 |
+
<?php for ( $i = 0, $bt = $log['backtrace'], $len = count( $bt ); $i < $len; $i ++ ) : ?>
|
96 |
+
<tr>
|
97 |
+
<td><?php echo( $len - $i ) ?></td>
|
98 |
+
<td><?php if ( isset( $bt[ $i ]['function'] ) ) {
|
99 |
+
echo ( isset( $bt[ $i ]['class'] ) ? $bt[ $i ]['class'] . $bt[ $i ]['type'] : '' ) . $bt[ $i ]['function'];
|
100 |
+
} ?></td>
|
101 |
+
<td><?php if ( isset( $bt[ $i ]['file'] ) ) {
|
102 |
+
echo substr( $bt[ $i ]['file'], $root_path_len ) . ':' . $bt[ $i ]['line'];
|
103 |
+
} ?></td>
|
104 |
+
</tr>
|
105 |
+
<?php endfor ?>
|
106 |
+
</tbody>
|
107 |
+
</table>
|
108 |
+
</td>
|
109 |
+
<?php if ( $show_body ) : ?>
|
110 |
+
<td>
|
111 |
+
<?php if ( 'GET' !== $log['method'] ) : ?>
|
112 |
+
<?php
|
113 |
+
$body = $log['body'];
|
114 |
+
printf(
|
115 |
+
'<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
|
116 |
+
substr( $body, 0, 32 ) . ( 32 < strlen( $body ) ? '...' : '' )
|
117 |
+
);
|
118 |
+
if ( $pretty_print ) {
|
119 |
+
$body = $encode( json_decode( $log['body'] ), JSON_PRETTY_PRINT );
|
120 |
+
}
|
121 |
+
?>
|
122 |
+
<pre style="display: none"><code><?php echo esc_html( $body ) ?></code></pre>
|
123 |
+
<?php endif ?>
|
124 |
+
</td>
|
125 |
+
<?php endif ?>
|
126 |
+
<td>
|
127 |
+
<?php
|
128 |
+
$result = $log['result'];
|
129 |
+
|
130 |
+
$is_not_empty_result = ( is_string( $result ) && ! empty( $result ) );
|
131 |
+
|
132 |
+
if ( $is_not_empty_result ) {
|
133 |
+
printf(
|
134 |
+
'<a href="#" onclick="jQuery(this).parent().find(\'pre\').toggle(); return false;">%s</a>',
|
135 |
+
substr( $result, 0, 32 ) . ( 32 < strlen( $result ) ? '...' : '' )
|
136 |
+
);
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( $is_not_empty_result && $pretty_print ) {
|
140 |
+
$decoded = json_decode( $result );
|
141 |
+
if ( ! is_null( $decoded ) ) {
|
142 |
+
$result = $encode( $decoded, JSON_PRETTY_PRINT );
|
143 |
+
}
|
144 |
+
} else {
|
145 |
+
$result = is_string( $result ) ? $result : json_encode( $result );
|
146 |
+
}
|
147 |
+
?>
|
148 |
+
<pre<?php if ( $is_not_empty_result ) : ?> style="display: none"<?php endif ?>><code><?php echo esc_html( $result ) ?></code></pre>
|
149 |
+
</td>
|
150 |
+
<td><?php echo number_format( 100 * ( $log['start'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . $ms_text ?></td>
|
151 |
+
<td><?php echo number_format( 100 * ( $log['end'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . $ms_text ?></td>
|
152 |
+
</tr>
|
153 |
+
<?php endforeach ?>
|
154 |
+
</tbody>
|
155 |
</table>
|
lib/freemius/templates/debug/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/debug/logger.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
$log_book = FS_Logger::get_log();
|
14 |
-
?>
|
15 |
-
<h1><?php fs_echo_inline( 'Log' ) ?></h1>
|
16 |
-
|
17 |
-
<table class="widefat" style="font-size: 11px;">
|
18 |
-
<thead>
|
19 |
-
<tr>
|
20 |
-
<th>#</th>
|
21 |
-
<th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
|
22 |
-
<th><?php fs_esc_html_echo_inline( 'Type' ) ?></th>
|
23 |
-
<th><?php fs_esc_html_echo_inline( 'Function' ) ?></th>
|
24 |
-
<th><?php fs_esc_html_echo_inline( 'Message' ) ?></th>
|
25 |
-
<th><?php fs_esc_html_echo_inline( 'File' ) ?></th>
|
26 |
-
<th><?php fs_esc_html_echo_inline( 'Timestamp' ) ?></th>
|
27 |
-
</tr>
|
28 |
-
</thead>
|
29 |
-
<tbody>
|
30 |
-
|
31 |
-
<?php $i = 0;
|
32 |
-
foreach ( $log_book as $log ) : ?>
|
33 |
-
<?php
|
34 |
-
/**
|
35 |
-
* @var FS_Logger $logger
|
36 |
-
*/
|
37 |
-
$logger = $log['logger'];
|
38 |
-
?>
|
39 |
-
<tr<?php if ( $i % 2 ) {
|
40 |
-
echo ' class="alternate"';
|
41 |
-
} ?>>
|
42 |
-
<td><?php echo $log['cnt'] ?>.</td>
|
43 |
-
<td><?php echo $logger->get_id() ?></td>
|
44 |
-
<td><?php echo $log['log_type'] ?></td>
|
45 |
-
<td><b><code style="color: blue;"><?php echo ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] ?></code></b></td>
|
46 |
-
<td>
|
47 |
-
<?php
|
48 |
-
printf(
|
49 |
-
'<a href="#" style="color: darkorange !important;" onclick="jQuery(this).parent().find(\'div\').toggle(); return false;"><nobr>%s</nobr></a>',
|
50 |
-
esc_html( substr( $log['msg'], 0, 32 ) ) . ( 32 < strlen( $log['msg'] ) ? '...' : '' )
|
51 |
-
);
|
52 |
-
?>
|
53 |
-
<div style="display: none;">
|
54 |
-
<b style="color: darkorange;"><?php echo esc_html( $log['msg'] ) ?></b>
|
55 |
-
</div>
|
56 |
-
</td>
|
57 |
-
<td><?php
|
58 |
-
if ( isset( $log['file'] ) ) {
|
59 |
-
echo substr( $log['file'], $logger->get_file() ) . ':' . $log['line'];
|
60 |
-
}
|
61 |
-
?></td>
|
62 |
-
<td><?php echo number_format( 100 * ( $log['timestamp'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' ) ?></td>
|
63 |
-
</tr>
|
64 |
-
<?php $i ++; endforeach ?>
|
65 |
-
</tbody>
|
66 |
</table>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
$log_book = FS_Logger::get_log();
|
14 |
+
?>
|
15 |
+
<h1><?php fs_echo_inline( 'Log' ) ?></h1>
|
16 |
+
|
17 |
+
<table class="widefat" style="font-size: 11px;">
|
18 |
+
<thead>
|
19 |
+
<tr>
|
20 |
+
<th>#</th>
|
21 |
+
<th><?php fs_esc_html_echo_inline( 'ID', 'id' ) ?></th>
|
22 |
+
<th><?php fs_esc_html_echo_inline( 'Type' ) ?></th>
|
23 |
+
<th><?php fs_esc_html_echo_inline( 'Function' ) ?></th>
|
24 |
+
<th><?php fs_esc_html_echo_inline( 'Message' ) ?></th>
|
25 |
+
<th><?php fs_esc_html_echo_inline( 'File' ) ?></th>
|
26 |
+
<th><?php fs_esc_html_echo_inline( 'Timestamp' ) ?></th>
|
27 |
+
</tr>
|
28 |
+
</thead>
|
29 |
+
<tbody>
|
30 |
+
|
31 |
+
<?php $i = 0;
|
32 |
+
foreach ( $log_book as $log ) : ?>
|
33 |
+
<?php
|
34 |
+
/**
|
35 |
+
* @var FS_Logger $logger
|
36 |
+
*/
|
37 |
+
$logger = $log['logger'];
|
38 |
+
?>
|
39 |
+
<tr<?php if ( $i % 2 ) {
|
40 |
+
echo ' class="alternate"';
|
41 |
+
} ?>>
|
42 |
+
<td><?php echo $log['cnt'] ?>.</td>
|
43 |
+
<td><?php echo $logger->get_id() ?></td>
|
44 |
+
<td><?php echo $log['log_type'] ?></td>
|
45 |
+
<td><b><code style="color: blue;"><?php echo ( ! empty( $log['class'] ) ? $log['class'] . $log['type'] : '' ) . $log['function'] ?></code></b></td>
|
46 |
+
<td>
|
47 |
+
<?php
|
48 |
+
printf(
|
49 |
+
'<a href="#" style="color: darkorange !important;" onclick="jQuery(this).parent().find(\'div\').toggle(); return false;"><nobr>%s</nobr></a>',
|
50 |
+
esc_html( substr( $log['msg'], 0, 32 ) ) . ( 32 < strlen( $log['msg'] ) ? '...' : '' )
|
51 |
+
);
|
52 |
+
?>
|
53 |
+
<div style="display: none;">
|
54 |
+
<b style="color: darkorange;"><?php echo esc_html( $log['msg'] ) ?></b>
|
55 |
+
</div>
|
56 |
+
</td>
|
57 |
+
<td><?php
|
58 |
+
if ( isset( $log['file'] ) ) {
|
59 |
+
echo substr( $log['file'], $logger->get_file() ) . ':' . $log['line'];
|
60 |
+
}
|
61 |
+
?></td>
|
62 |
+
<td><?php echo number_format( 100 * ( $log['timestamp'] - WP_FS__SCRIPT_START_TIME ), 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' ) ?></td>
|
63 |
+
</tr>
|
64 |
+
<?php $i ++; endforeach ?>
|
65 |
+
</tbody>
|
66 |
</table>
|
lib/freemius/templates/debug/plugins-themes-sync.php
CHANGED
@@ -1,76 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
$fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
|
14 |
-
$all_plugins = $fs_options->get_option( 'all_plugins' );
|
15 |
-
$all_themes = $fs_options->get_option( 'all_themes' );
|
16 |
-
|
17 |
-
/* translators: %s: time period (e.g. In "2 hours") */
|
18 |
-
$in_x_text = fs_text_inline( 'In %s', 'in-x' );
|
19 |
-
/* translators: %s: time period (e.g. "2 hours" ago) */
|
20 |
-
$x_ago_text = fs_text_inline( '%s ago', 'x-ago' );
|
21 |
-
$sec_text = fs_text_x_inline( 'sec', 'seconds' );
|
22 |
-
?>
|
23 |
-
<h1><?php fs_esc_html_echo_inline( 'Plugins & Themes Sync', 'plugins-themes-sync' ) ?></h1>
|
24 |
-
<table class="widefat">
|
25 |
-
<thead>
|
26 |
-
<tr>
|
27 |
-
<th></th>
|
28 |
-
<th><?php fs_esc_html_echo_inline( 'Total', 'total' ) ?></th>
|
29 |
-
<th><?php fs_esc_html_echo_inline( 'Last', 'last' ) ?></th>
|
30 |
-
</tr>
|
31 |
-
</thead>
|
32 |
-
<tbody>
|
33 |
-
<?php if ( is_object( $all_plugins ) ) : ?>
|
34 |
-
<tr>
|
35 |
-
<td><?php fs_esc_html_echo_inline( 'Plugins', 'plugins' ) ?></td>
|
36 |
-
<td><?php echo count( $all_plugins->plugins ) ?></td>
|
37 |
-
<td><?php
|
38 |
-
if ( isset( $all_plugins->timestamp ) && is_numeric( $all_plugins->timestamp ) ) {
|
39 |
-
$diff = abs( WP_FS__SCRIPT_START_TIME - $all_plugins->timestamp );
|
40 |
-
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
41 |
-
$diff . ' ' . $sec_text :
|
42 |
-
human_time_diff( WP_FS__SCRIPT_START_TIME, $all_plugins->timestamp );
|
43 |
-
|
44 |
-
echo esc_html( sprintf(
|
45 |
-
( ( WP_FS__SCRIPT_START_TIME < $all_plugins->timestamp ) ?
|
46 |
-
$in_x_text :
|
47 |
-
$x_ago_text ),
|
48 |
-
$human_diff
|
49 |
-
) );
|
50 |
-
}
|
51 |
-
?></td>
|
52 |
-
</tr>
|
53 |
-
<?php endif ?>
|
54 |
-
<?php if ( is_object( $all_themes ) ) : ?>
|
55 |
-
<tr>
|
56 |
-
<td><?php fs_esc_html_echo_inline( 'Themes', 'themes' ) ?></td>
|
57 |
-
<td><?php echo count( $all_themes->themes ) ?></td>
|
58 |
-
<td><?php
|
59 |
-
if ( isset( $all_themes->timestamp ) && is_numeric( $all_themes->timestamp ) ) {
|
60 |
-
$diff = abs( WP_FS__SCRIPT_START_TIME - $all_themes->timestamp );
|
61 |
-
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
62 |
-
$diff . ' ' . $sec_text :
|
63 |
-
human_time_diff( WP_FS__SCRIPT_START_TIME, $all_themes->timestamp );
|
64 |
-
|
65 |
-
echo esc_html( sprintf(
|
66 |
-
( ( WP_FS__SCRIPT_START_TIME < $all_themes->timestamp ) ?
|
67 |
-
$in_x_text :
|
68 |
-
$x_ago_text ),
|
69 |
-
$human_diff
|
70 |
-
) );
|
71 |
-
}
|
72 |
-
?></td>
|
73 |
-
</tr>
|
74 |
-
<?php endif ?>
|
75 |
-
</tbody>
|
76 |
-
</table>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
$fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
|
14 |
+
$all_plugins = $fs_options->get_option( 'all_plugins' );
|
15 |
+
$all_themes = $fs_options->get_option( 'all_themes' );
|
16 |
+
|
17 |
+
/* translators: %s: time period (e.g. In "2 hours") */
|
18 |
+
$in_x_text = fs_text_inline( 'In %s', 'in-x' );
|
19 |
+
/* translators: %s: time period (e.g. "2 hours" ago) */
|
20 |
+
$x_ago_text = fs_text_inline( '%s ago', 'x-ago' );
|
21 |
+
$sec_text = fs_text_x_inline( 'sec', 'seconds' );
|
22 |
+
?>
|
23 |
+
<h1><?php fs_esc_html_echo_inline( 'Plugins & Themes Sync', 'plugins-themes-sync' ) ?></h1>
|
24 |
+
<table class="widefat">
|
25 |
+
<thead>
|
26 |
+
<tr>
|
27 |
+
<th></th>
|
28 |
+
<th><?php fs_esc_html_echo_inline( 'Total', 'total' ) ?></th>
|
29 |
+
<th><?php fs_esc_html_echo_inline( 'Last', 'last' ) ?></th>
|
30 |
+
</tr>
|
31 |
+
</thead>
|
32 |
+
<tbody>
|
33 |
+
<?php if ( is_object( $all_plugins ) ) : ?>
|
34 |
+
<tr>
|
35 |
+
<td><?php fs_esc_html_echo_inline( 'Plugins', 'plugins' ) ?></td>
|
36 |
+
<td><?php echo count( $all_plugins->plugins ) ?></td>
|
37 |
+
<td><?php
|
38 |
+
if ( isset( $all_plugins->timestamp ) && is_numeric( $all_plugins->timestamp ) ) {
|
39 |
+
$diff = abs( WP_FS__SCRIPT_START_TIME - $all_plugins->timestamp );
|
40 |
+
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
41 |
+
$diff . ' ' . $sec_text :
|
42 |
+
human_time_diff( WP_FS__SCRIPT_START_TIME, $all_plugins->timestamp );
|
43 |
+
|
44 |
+
echo esc_html( sprintf(
|
45 |
+
( ( WP_FS__SCRIPT_START_TIME < $all_plugins->timestamp ) ?
|
46 |
+
$in_x_text :
|
47 |
+
$x_ago_text ),
|
48 |
+
$human_diff
|
49 |
+
) );
|
50 |
+
}
|
51 |
+
?></td>
|
52 |
+
</tr>
|
53 |
+
<?php endif ?>
|
54 |
+
<?php if ( is_object( $all_themes ) ) : ?>
|
55 |
+
<tr>
|
56 |
+
<td><?php fs_esc_html_echo_inline( 'Themes', 'themes' ) ?></td>
|
57 |
+
<td><?php echo count( $all_themes->themes ) ?></td>
|
58 |
+
<td><?php
|
59 |
+
if ( isset( $all_themes->timestamp ) && is_numeric( $all_themes->timestamp ) ) {
|
60 |
+
$diff = abs( WP_FS__SCRIPT_START_TIME - $all_themes->timestamp );
|
61 |
+
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
62 |
+
$diff . ' ' . $sec_text :
|
63 |
+
human_time_diff( WP_FS__SCRIPT_START_TIME, $all_themes->timestamp );
|
64 |
+
|
65 |
+
echo esc_html( sprintf(
|
66 |
+
( ( WP_FS__SCRIPT_START_TIME < $all_themes->timestamp ) ?
|
67 |
+
$in_x_text :
|
68 |
+
$x_ago_text ),
|
69 |
+
$human_diff
|
70 |
+
) );
|
71 |
+
}
|
72 |
+
?></td>
|
73 |
+
</tr>
|
74 |
+
<?php endif ?>
|
75 |
+
</tbody>
|
76 |
+
</table>
|
lib/freemius/templates/debug/scheduled-crons.php
CHANGED
@@ -1,136 +1,136 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.7.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
$fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
|
14 |
-
$scheduled_crons = array();
|
15 |
-
|
16 |
-
$module_types = array(
|
17 |
-
WP_FS__MODULE_TYPE_PLUGIN,
|
18 |
-
WP_FS__MODULE_TYPE_THEME
|
19 |
-
);
|
20 |
-
|
21 |
-
foreach ( $module_types as $module_type ) {
|
22 |
-
$modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() );
|
23 |
-
if ( is_array( $modules ) && count( $modules ) > 0 ) {
|
24 |
-
foreach ( $modules as $slug => $data ) {
|
25 |
-
if ( WP_FS__MODULE_TYPE_THEME === $module_type ) {
|
26 |
-
$current_theme = wp_get_theme();
|
27 |
-
$is_active = ( $current_theme->stylesheet === $data->file );
|
28 |
-
} else {
|
29 |
-
$is_active = is_plugin_active( $data->file );
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @author Vova Feldman
|
34 |
-
*
|
35 |
-
* @since 1.2.1 Don't load data from inactive modules.
|
36 |
-
*/
|
37 |
-
if ( $is_active ) {
|
38 |
-
$fs = freemius( $data->id );
|
39 |
-
|
40 |
-
$next_execution = $fs->next_sync_cron();
|
41 |
-
$last_execution = $fs->last_sync_cron();
|
42 |
-
|
43 |
-
if ( false !== $next_execution ) {
|
44 |
-
$scheduled_crons[ $slug ][] = array(
|
45 |
-
'name' => $fs->get_plugin_name(),
|
46 |
-
'slug' => $slug,
|
47 |
-
'module_type' => $fs->get_module_type(),
|
48 |
-
'type' => 'sync_cron',
|
49 |
-
'last' => $last_execution,
|
50 |
-
'next' => $next_execution,
|
51 |
-
);
|
52 |
-
}
|
53 |
-
|
54 |
-
$next_install_execution = $fs->next_install_sync();
|
55 |
-
$last_install_execution = $fs->last_install_sync();
|
56 |
-
|
57 |
-
if (false !== $next_install_execution ||
|
58 |
-
false !== $last_install_execution
|
59 |
-
) {
|
60 |
-
$scheduled_crons[ $slug ][] = array(
|
61 |
-
'name' => $fs->get_plugin_name(),
|
62 |
-
'slug' => $slug,
|
63 |
-
'module_type' => $fs->get_module_type(),
|
64 |
-
'type' => 'install_sync',
|
65 |
-
'last' => $last_install_execution,
|
66 |
-
'next' => $next_install_execution,
|
67 |
-
);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
$sec_text = fs_text_x_inline( 'sec', 'seconds' );
|
75 |
-
?>
|
76 |
-
<h1><?php fs_esc_html_echo_inline( 'Scheduled Crons' ) ?></h1>
|
77 |
-
<table class="widefat">
|
78 |
-
<thead>
|
79 |
-
<tr>
|
80 |
-
<th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th>
|
81 |
-
<th><?php fs_esc_html_echo_inline( 'Module' ) ?></th>
|
82 |
-
<th><?php fs_esc_html_echo_inline( 'Module Type' ) ?></th>
|
83 |
-
<th><?php fs_esc_html_echo_inline( 'Cron Type' ) ?></th>
|
84 |
-
<th><?php fs_esc_html_echo_inline( 'Last' ) ?></th>
|
85 |
-
<th><?php fs_esc_html_echo_inline( 'Next' ) ?></th>
|
86 |
-
</tr>
|
87 |
-
</thead>
|
88 |
-
<tbody>
|
89 |
-
<?php
|
90 |
-
/* translators: %s: time period (e.g. In "2 hours") */
|
91 |
-
$in_x_text = fs_text_inline( 'In %s', 'in-x' );
|
92 |
-
/* translators: %s: time period (e.g. "2 hours" ago) */
|
93 |
-
$x_ago_text = fs_text_inline( '%s ago', 'x-ago' );
|
94 |
-
?>
|
95 |
-
<?php foreach ( $scheduled_crons as $slug => $crons ) : ?>
|
96 |
-
<?php foreach ( $crons as $cron ) : ?>
|
97 |
-
<tr>
|
98 |
-
<td><?php echo $slug ?></td>
|
99 |
-
<td><?php echo $cron['name'] ?></td>
|
100 |
-
<td><?php echo $cron['module_type'] ?></td>
|
101 |
-
<td><?php echo $cron['type'] ?></td>
|
102 |
-
<td><?php
|
103 |
-
if ( is_numeric( $cron['last'] ) ) {
|
104 |
-
$diff = abs( WP_FS__SCRIPT_START_TIME - $cron['last'] );
|
105 |
-
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
106 |
-
$diff . ' ' . $sec_text :
|
107 |
-
human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['last'] );
|
108 |
-
|
109 |
-
echo esc_html( sprintf(
|
110 |
-
( ( WP_FS__SCRIPT_START_TIME < $cron['last'] ) ?
|
111 |
-
$in_x_text :
|
112 |
-
$x_ago_text ),
|
113 |
-
$human_diff
|
114 |
-
) );
|
115 |
-
}
|
116 |
-
?></td>
|
117 |
-
<td><?php
|
118 |
-
if ( is_numeric( $cron['next'] ) ) {
|
119 |
-
$diff = abs( WP_FS__SCRIPT_START_TIME - $cron['next'] );
|
120 |
-
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
121 |
-
$diff . ' ' . $sec_text :
|
122 |
-
human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['next'] );
|
123 |
-
|
124 |
-
echo esc_html( sprintf(
|
125 |
-
( ( WP_FS__SCRIPT_START_TIME < $cron['next'] ) ?
|
126 |
-
$in_x_text :
|
127 |
-
$x_ago_text ),
|
128 |
-
$human_diff
|
129 |
-
) );
|
130 |
-
}
|
131 |
-
?></td>
|
132 |
-
</tr>
|
133 |
-
<?php endforeach ?>
|
134 |
-
<?php endforeach ?>
|
135 |
-
</tbody>
|
136 |
-
</table>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.7.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
$fs_options = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
|
14 |
+
$scheduled_crons = array();
|
15 |
+
|
16 |
+
$module_types = array(
|
17 |
+
WP_FS__MODULE_TYPE_PLUGIN,
|
18 |
+
WP_FS__MODULE_TYPE_THEME
|
19 |
+
);
|
20 |
+
|
21 |
+
foreach ( $module_types as $module_type ) {
|
22 |
+
$modules = fs_get_entities( $fs_options->get_option( $module_type . 's' ), FS_Plugin::get_class_name() );
|
23 |
+
if ( is_array( $modules ) && count( $modules ) > 0 ) {
|
24 |
+
foreach ( $modules as $slug => $data ) {
|
25 |
+
if ( WP_FS__MODULE_TYPE_THEME === $module_type ) {
|
26 |
+
$current_theme = wp_get_theme();
|
27 |
+
$is_active = ( $current_theme->stylesheet === $data->file );
|
28 |
+
} else {
|
29 |
+
$is_active = is_plugin_active( $data->file );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @author Vova Feldman
|
34 |
+
*
|
35 |
+
* @since 1.2.1 Don't load data from inactive modules.
|
36 |
+
*/
|
37 |
+
if ( $is_active ) {
|
38 |
+
$fs = freemius( $data->id );
|
39 |
+
|
40 |
+
$next_execution = $fs->next_sync_cron();
|
41 |
+
$last_execution = $fs->last_sync_cron();
|
42 |
+
|
43 |
+
if ( false !== $next_execution ) {
|
44 |
+
$scheduled_crons[ $slug ][] = array(
|
45 |
+
'name' => $fs->get_plugin_name(),
|
46 |
+
'slug' => $slug,
|
47 |
+
'module_type' => $fs->get_module_type(),
|
48 |
+
'type' => 'sync_cron',
|
49 |
+
'last' => $last_execution,
|
50 |
+
'next' => $next_execution,
|
51 |
+
);
|
52 |
+
}
|
53 |
+
|
54 |
+
$next_install_execution = $fs->next_install_sync();
|
55 |
+
$last_install_execution = $fs->last_install_sync();
|
56 |
+
|
57 |
+
if (false !== $next_install_execution ||
|
58 |
+
false !== $last_install_execution
|
59 |
+
) {
|
60 |
+
$scheduled_crons[ $slug ][] = array(
|
61 |
+
'name' => $fs->get_plugin_name(),
|
62 |
+
'slug' => $slug,
|
63 |
+
'module_type' => $fs->get_module_type(),
|
64 |
+
'type' => 'install_sync',
|
65 |
+
'last' => $last_install_execution,
|
66 |
+
'next' => $next_install_execution,
|
67 |
+
);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
$sec_text = fs_text_x_inline( 'sec', 'seconds' );
|
75 |
+
?>
|
76 |
+
<h1><?php fs_esc_html_echo_inline( 'Scheduled Crons' ) ?></h1>
|
77 |
+
<table class="widefat">
|
78 |
+
<thead>
|
79 |
+
<tr>
|
80 |
+
<th><?php fs_esc_html_echo_inline( 'Slug' ) ?></th>
|
81 |
+
<th><?php fs_esc_html_echo_inline( 'Module' ) ?></th>
|
82 |
+
<th><?php fs_esc_html_echo_inline( 'Module Type' ) ?></th>
|
83 |
+
<th><?php fs_esc_html_echo_inline( 'Cron Type' ) ?></th>
|
84 |
+
<th><?php fs_esc_html_echo_inline( 'Last' ) ?></th>
|
85 |
+
<th><?php fs_esc_html_echo_inline( 'Next' ) ?></th>
|
86 |
+
</tr>
|
87 |
+
</thead>
|
88 |
+
<tbody>
|
89 |
+
<?php
|
90 |
+
/* translators: %s: time period (e.g. In "2 hours") */
|
91 |
+
$in_x_text = fs_text_inline( 'In %s', 'in-x' );
|
92 |
+
/* translators: %s: time period (e.g. "2 hours" ago) */
|
93 |
+
$x_ago_text = fs_text_inline( '%s ago', 'x-ago' );
|
94 |
+
?>
|
95 |
+
<?php foreach ( $scheduled_crons as $slug => $crons ) : ?>
|
96 |
+
<?php foreach ( $crons as $cron ) : ?>
|
97 |
+
<tr>
|
98 |
+
<td><?php echo $slug ?></td>
|
99 |
+
<td><?php echo $cron['name'] ?></td>
|
100 |
+
<td><?php echo $cron['module_type'] ?></td>
|
101 |
+
<td><?php echo $cron['type'] ?></td>
|
102 |
+
<td><?php
|
103 |
+
if ( is_numeric( $cron['last'] ) ) {
|
104 |
+
$diff = abs( WP_FS__SCRIPT_START_TIME - $cron['last'] );
|
105 |
+
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
106 |
+
$diff . ' ' . $sec_text :
|
107 |
+
human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['last'] );
|
108 |
+
|
109 |
+
echo esc_html( sprintf(
|
110 |
+
( ( WP_FS__SCRIPT_START_TIME < $cron['last'] ) ?
|
111 |
+
$in_x_text :
|
112 |
+
$x_ago_text ),
|
113 |
+
$human_diff
|
114 |
+
) );
|
115 |
+
}
|
116 |
+
?></td>
|
117 |
+
<td><?php
|
118 |
+
if ( is_numeric( $cron['next'] ) ) {
|
119 |
+
$diff = abs( WP_FS__SCRIPT_START_TIME - $cron['next'] );
|
120 |
+
$human_diff = ( $diff < MINUTE_IN_SECONDS ) ?
|
121 |
+
$diff . ' ' . $sec_text :
|
122 |
+
human_time_diff( WP_FS__SCRIPT_START_TIME, $cron['next'] );
|
123 |
+
|
124 |
+
echo esc_html( sprintf(
|
125 |
+
( ( WP_FS__SCRIPT_START_TIME < $cron['next'] ) ?
|
126 |
+
$in_x_text :
|
127 |
+
$x_ago_text ),
|
128 |
+
$human_diff
|
129 |
+
) );
|
130 |
+
}
|
131 |
+
?></td>
|
132 |
+
</tr>
|
133 |
+
<?php endforeach ?>
|
134 |
+
<?php endforeach ?>
|
135 |
+
</tbody>
|
136 |
+
</table>
|
lib/freemius/templates/email.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$sections = $VARS['sections'];
|
17 |
-
?>
|
18 |
-
<table>
|
19 |
-
<?php
|
20 |
-
foreach ( $sections as $section_id => $section ) {
|
21 |
-
?>
|
22 |
-
<thead>
|
23 |
-
<tr><th colspan="2" style="text-align: left; background: #333; color: #fff; padding: 5px;"><?php echo esc_html($section['title']) ?></th></tr>
|
24 |
-
</thead>
|
25 |
-
<tbody>
|
26 |
-
<?php
|
27 |
-
foreach ( $section['rows'] as $row_id => $row ) {
|
28 |
-
$col_count = count( $row );
|
29 |
-
?>
|
30 |
-
<tr>
|
31 |
-
<?php
|
32 |
-
if ( 1 === $col_count ) { ?>
|
33 |
-
<td style="vertical-align: top;" colspan="2"><?php echo $row[0] ?></td>
|
34 |
-
<?php
|
35 |
-
} else { ?>
|
36 |
-
<td style="vertical-align: top;"><b><?php echo esc_html($row[0]) ?>:</b></td>
|
37 |
-
<td><?php echo $row[1]; ?></td>
|
38 |
-
<?php
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
</tr>
|
42 |
-
<?php
|
43 |
-
}
|
44 |
-
?>
|
45 |
-
</tbody>
|
46 |
-
<?php
|
47 |
-
}
|
48 |
-
?>
|
49 |
</table>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$sections = $VARS['sections'];
|
17 |
+
?>
|
18 |
+
<table>
|
19 |
+
<?php
|
20 |
+
foreach ( $sections as $section_id => $section ) {
|
21 |
+
?>
|
22 |
+
<thead>
|
23 |
+
<tr><th colspan="2" style="text-align: left; background: #333; color: #fff; padding: 5px;"><?php echo esc_html($section['title']) ?></th></tr>
|
24 |
+
</thead>
|
25 |
+
<tbody>
|
26 |
+
<?php
|
27 |
+
foreach ( $section['rows'] as $row_id => $row ) {
|
28 |
+
$col_count = count( $row );
|
29 |
+
?>
|
30 |
+
<tr>
|
31 |
+
<?php
|
32 |
+
if ( 1 === $col_count ) { ?>
|
33 |
+
<td style="vertical-align: top;" colspan="2"><?php echo $row[0] ?></td>
|
34 |
+
<?php
|
35 |
+
} else { ?>
|
36 |
+
<td style="vertical-align: top;"><b><?php echo esc_html($row[0]) ?>:</b></td>
|
37 |
+
<td><?php echo $row[1]; ?></td>
|
38 |
+
<?php
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
</tr>
|
42 |
+
<?php
|
43 |
+
}
|
44 |
+
?>
|
45 |
+
</tbody>
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
?>
|
49 |
</table>
|
lib/freemius/templates/firewall-issues-js.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* API connectivity issues (CloudFlare's firewall) handler for handling different
|
4 |
-
* scenarios selected by the user after connectivity issue is detected, by sending
|
5 |
-
* AJAX call to the server in order to make the actual actions.
|
6 |
-
*
|
7 |
-
* @package Freemius
|
8 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
9 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
10 |
-
* @since 1.0.9
|
11 |
-
*/
|
12 |
-
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
?>
|
17 |
-
<script type="text/javascript">
|
18 |
-
jQuery( document ).ready(function( $ ) {
|
19 |
-
$( '#fs_firewall_issue_options a.fs-resolve' ).click(function() {
|
20 |
-
var
|
21 |
-
error_type = $( this ).attr( 'data-type' ),
|
22 |
-
notice = $( this ).parents( '.fs-notice' ),
|
23 |
-
ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
|
24 |
-
|
25 |
-
var data = {
|
26 |
-
action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix,
|
27 |
-
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
28 |
-
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_resolve_firewall_issues' ) ); ?>,
|
29 |
-
error_type: error_type
|
30 |
-
};
|
31 |
-
|
32 |
-
if ( 'squid' === error_type ) {
|
33 |
-
data.hosting_company = prompt( 'What is the name or URL of your hosting company?' );
|
34 |
-
if ( null == data.hosting_company )
|
35 |
-
return false;
|
36 |
-
|
37 |
-
if ( '' === data.hosting_company ) {
|
38 |
-
alert( 'We won\'t be able to help without knowing your hosting company.' );
|
39 |
-
return false;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
if ( 'retry_ping' === error_type ) {
|
44 |
-
data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix;
|
45 |
-
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
46 |
-
data._wpnonce = <?php echo wp_json_encode( wp_create_nonce( 'fs_retry_connectivity_test' ) ); ?>;
|
47 |
-
}
|
48 |
-
|
49 |
-
$( this ).css({'cursor': 'wait'});
|
50 |
-
|
51 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
52 |
-
$.post( ajaxurl, data, function( response ) {
|
53 |
-
if ( 1 == response ) {
|
54 |
-
// Refresh page on success.
|
55 |
-
location.reload();
|
56 |
-
} else if ( 'http' === response.substr( 0, 4 ) ) {
|
57 |
-
// Ping actually worked, redirect.
|
58 |
-
window.location = response;
|
59 |
-
}
|
60 |
-
});
|
61 |
-
});
|
62 |
-
});
|
63 |
-
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* API connectivity issues (CloudFlare's firewall) handler for handling different
|
4 |
+
* scenarios selected by the user after connectivity issue is detected, by sending
|
5 |
+
* AJAX call to the server in order to make the actual actions.
|
6 |
+
*
|
7 |
+
* @package Freemius
|
8 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
9 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
10 |
+
* @since 1.0.9
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
?>
|
17 |
+
<script type="text/javascript">
|
18 |
+
jQuery( document ).ready(function( $ ) {
|
19 |
+
$( '#fs_firewall_issue_options a.fs-resolve' ).click(function() {
|
20 |
+
var
|
21 |
+
error_type = $( this ).attr( 'data-type' ),
|
22 |
+
notice = $( this ).parents( '.fs-notice' ),
|
23 |
+
ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
|
24 |
+
|
25 |
+
var data = {
|
26 |
+
action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix,
|
27 |
+
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
28 |
+
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_resolve_firewall_issues' ) ); ?>,
|
29 |
+
error_type: error_type
|
30 |
+
};
|
31 |
+
|
32 |
+
if ( 'squid' === error_type ) {
|
33 |
+
data.hosting_company = prompt( 'What is the name or URL of your hosting company?' );
|
34 |
+
if ( null == data.hosting_company )
|
35 |
+
return false;
|
36 |
+
|
37 |
+
if ( '' === data.hosting_company ) {
|
38 |
+
alert( 'We won\'t be able to help without knowing your hosting company.' );
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( 'retry_ping' === error_type ) {
|
44 |
+
data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix;
|
45 |
+
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
46 |
+
data._wpnonce = <?php echo wp_json_encode( wp_create_nonce( 'fs_retry_connectivity_test' ) ); ?>;
|
47 |
+
}
|
48 |
+
|
49 |
+
$( this ).css({'cursor': 'wait'});
|
50 |
+
|
51 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
52 |
+
$.post( ajaxurl, data, function( response ) {
|
53 |
+
if ( 1 == response ) {
|
54 |
+
// Refresh page on success.
|
55 |
+
location.reload();
|
56 |
+
} else if ( 'http' === response.substr( 0, 4 ) ) {
|
57 |
+
// Ping actually worked, redirect.
|
58 |
+
window.location = response;
|
59 |
+
}
|
60 |
+
});
|
61 |
+
});
|
62 |
+
});
|
63 |
+
</script>
|
lib/freemius/templates/forms/deactivation/contact.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
$slug = $fs->get_slug();
|
18 |
-
|
19 |
-
echo fs_text_inline( 'Sorry for the inconvenience and we are here to help if you give us a chance.', 'contact-support-before-deactivation', $slug )
|
20 |
-
. sprintf(" <a href='%s' class='button button-small button-primary'>%s</a>",
|
21 |
-
$fs->contact_url( 'technical_support' ),
|
22 |
-
fs_text_inline( 'Contact Support', 'contact-support', $slug )
|
23 |
-
);
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
$slug = $fs->get_slug();
|
18 |
+
|
19 |
+
echo fs_text_inline( 'Sorry for the inconvenience and we are here to help if you give us a chance.', 'contact-support-before-deactivation', $slug )
|
20 |
+
. sprintf(" <a href='%s' class='button button-small button-primary'>%s</a>",
|
21 |
+
$fs->contact_url( 'technical_support' ),
|
22 |
+
fs_text_inline( 'Contact Support', 'contact-support', $slug )
|
23 |
+
);
|
lib/freemius/templates/forms/deactivation/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/forms/deactivation/retry-skip.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
$slug = $fs->get_slug();
|
18 |
-
|
19 |
-
$skip_url = fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ) ), $fs->get_unique_affix() . '_skip_activation' );
|
20 |
-
$skip_text = strtolower( fs_text_x_inline( 'Skip', 'verb', 'skip', $slug ) );
|
21 |
-
$use_plugin_anonymously_text = fs_text_inline( 'Click here to use the plugin anonymously', 'click-here-to-use-plugin-anonymously', $slug );
|
22 |
-
|
23 |
-
echo sprintf( fs_text_inline( "You might have missed it, but you don't have to share any data and can just %s the opt-in.", 'dont-have-to-share-any-data', $slug ), "<a href='{$skip_url}'>{$skip_text}</a>" )
|
24 |
. " <a href='{$skip_url}' class='button button-small button-secondary'>{$use_plugin_anonymously_text}</a>";
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
$slug = $fs->get_slug();
|
18 |
+
|
19 |
+
$skip_url = fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ) ), $fs->get_unique_affix() . '_skip_activation' );
|
20 |
+
$skip_text = strtolower( fs_text_x_inline( 'Skip', 'verb', 'skip', $slug ) );
|
21 |
+
$use_plugin_anonymously_text = fs_text_inline( 'Click here to use the plugin anonymously', 'click-here-to-use-plugin-anonymously', $slug );
|
22 |
+
|
23 |
+
echo sprintf( fs_text_inline( "You might have missed it, but you don't have to share any data and can just %s the opt-in.", 'dont-have-to-share-any-data', $slug ), "<a href='{$skip_url}'>{$skip_text}</a>" )
|
24 |
. " <a href='{$skip_url}' class='button button-small button-secondary'>{$use_plugin_anonymously_text}</a>";
|
lib/freemius/templates/forms/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/forms/premium-versions-upgrade-handler.php
CHANGED
@@ -1,205 +1,205 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.2
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var Freemius $fs
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
$slug = $fs->get_slug();
|
18 |
-
|
19 |
-
$plugin_data = $fs->get_plugin_data();
|
20 |
-
$plugin_name = $plugin_data['Name'];
|
21 |
-
$plugin_basename = $fs->get_plugin_basename();
|
22 |
-
|
23 |
-
$license = $fs->_get_license();
|
24 |
-
|
25 |
-
if ( ! is_object( $license ) ) {
|
26 |
-
$purchase_url = $fs->pricing_url();
|
27 |
-
} else {
|
28 |
-
$subscription = $fs->_get_subscription( $license->id );
|
29 |
-
|
30 |
-
$purchase_url = $fs->checkout_url(
|
31 |
-
is_object( $subscription ) ?
|
32 |
-
( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
|
33 |
-
WP_FS__PERIOD_LIFETIME,
|
34 |
-
false,
|
35 |
-
array( 'licenses' => $license->quota )
|
36 |
-
);
|
37 |
-
}
|
38 |
-
|
39 |
-
$message = sprintf(
|
40 |
-
fs_text_inline( 'There is a new version of %s available.', 'new-version-available-message', $slug ) .
|
41 |
-
fs_text_inline( ' %s to access version %s security & feature updates, and support.', 'x-for-updates-and-support', $slug ),
|
42 |
-
'<span id="plugin_name"></span>',
|
43 |
-
sprintf(
|
44 |
-
'<a id="pricing_url" href="">%s</a>',
|
45 |
-
is_object( $license ) ?
|
46 |
-
fs_text_inline( 'Renew your license now', 'renew-license-now', $slug ) :
|
47 |
-
fs_text_inline( 'Buy a license now', 'buy-license-now', $slug )
|
48 |
-
),
|
49 |
-
'<span id="new_version"></span>'
|
50 |
-
);
|
51 |
-
|
52 |
-
$modal_content_html = "<p>{$message}</p>";
|
53 |
-
|
54 |
-
$header_title = fs_text_inline( 'New Version Available', 'new-version-available', $slug );
|
55 |
-
|
56 |
-
$renew_license_button_text = is_object( $license ) ?
|
57 |
-
fs_text_inline( 'Renew license', 'renew-license', $slug ) :
|
58 |
-
fs_text_inline( 'Buy license', 'buy-license', $slug );
|
59 |
-
|
60 |
-
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
61 |
-
?>
|
62 |
-
<script type="text/javascript">
|
63 |
-
(function( $ ) {
|
64 |
-
$( document ).ready(function() {
|
65 |
-
if ( 0 === $( '.license-expired' ).length ) {
|
66 |
-
return;
|
67 |
-
}
|
68 |
-
|
69 |
-
var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
|
70 |
-
modalHtml =
|
71 |
-
'<div class="fs-modal fs-modal-upgrade-premium-version">'
|
72 |
-
+ ' <div class="fs-modal-dialog">'
|
73 |
-
+ ' <div class="fs-modal-header">'
|
74 |
-
+ ' <h4><?php echo esc_js( $header_title ) ?></h4>'
|
75 |
-
+ ' <a href="!#" class="fs-close"><i class="dashicons dashicons-no" title="<?php echo esc_js( fs_text_x_inline( 'Dismiss', 'close a window', 'dismiss', $slug ) ) ?>"></i></a>'
|
76 |
-
+ ' </div>'
|
77 |
-
+ ' <div class="fs-modal-body">'
|
78 |
-
+ ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
|
79 |
-
+ ' </div>'
|
80 |
-
+ ' <div class="fs-modal-footer">'
|
81 |
-
+ ' <a class="button button-primary button-renew-license" tabindex="3" href="<?php echo $purchase_url ?>"><?php echo esc_js( $renew_license_button_text ) ?></a>'
|
82 |
-
+ ' <button class="button button-secondary button-close" tabindex="4"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></button>'
|
83 |
-
+ ' </div>'
|
84 |
-
+ ' </div>'
|
85 |
-
+ '</div>',
|
86 |
-
$modal = $( modalHtml ),
|
87 |
-
isPluginsPage = <?php echo Freemius::is_plugins_page() ? 'true' : 'false' ?>;
|
88 |
-
|
89 |
-
$modal.appendTo( $( 'body' ) );
|
90 |
-
|
91 |
-
function registerEventHandlers() {
|
92 |
-
$( 'body' ).on( 'click', '.license-expired', function( evt ) {
|
93 |
-
var $this = $( this );
|
94 |
-
|
95 |
-
if ( ! $this.is( ':checked' ) ||
|
96 |
-
(
|
97 |
-
isPluginsPage &&
|
98 |
-
'update-selected' !== $( '#bulk-action-selector-top' ).val() &&
|
99 |
-
'update-selected' !== $( '#bulk-action-selector-bottom' ).val()
|
100 |
-
)
|
101 |
-
) {
|
102 |
-
return true;
|
103 |
-
}
|
104 |
-
|
105 |
-
evt.preventDefault();
|
106 |
-
evt.stopImmediatePropagation();
|
107 |
-
|
108 |
-
showModal( $this );
|
109 |
-
});
|
110 |
-
|
111 |
-
// If the user has clicked outside the window, close the modal.
|
112 |
-
$modal.on( 'click', '.fs-close, .button-secondary', function() {
|
113 |
-
closeModal();
|
114 |
-
return false;
|
115 |
-
});
|
116 |
-
|
117 |
-
if ( isPluginsPage ) {
|
118 |
-
$( 'body' ).on( 'change', 'select[id*="bulk-action-selector"]', function() {
|
119 |
-
if ( 'update-selected' === $( this ).val() ) {
|
120 |
-
setTimeout(function() {
|
121 |
-
$( '.license-expired' ).prop( 'checked', false );
|
122 |
-
$( '[id*="select-all"]' ).prop( 'checked', false );
|
123 |
-
}, 0);
|
124 |
-
}
|
125 |
-
});
|
126 |
-
}
|
127 |
-
|
128 |
-
$( 'body' ).on( 'click', '[id*="select-all"]', function( evt ) {
|
129 |
-
var $this = $( this );
|
130 |
-
|
131 |
-
if ( ! $this.is( ':checked' ) ) {
|
132 |
-
return true;
|
133 |
-
}
|
134 |
-
|
135 |
-
if ( isPluginsPage ) {
|
136 |
-
if ( 'update-selected' !== $( '#bulk-action-selector-top' ).val() &&
|
137 |
-
'update-selected' !== $( '#bulk-action-selector-bottom' ).val() ) {
|
138 |
-
return true;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
var $table = $this.closest( 'table' ),
|
143 |
-
controlChecked = $this.prop( 'checked' ),
|
144 |
-
toggle = ( event.shiftKey || $this.data( 'wp-toggle' ) ),
|
145 |
-
$modules = $table.children( 'tbody' ).filter( ':visible' ).children().children( '.check-column' ).find( ':checkbox' ),
|
146 |
-
$modulesWithNonActiveLicense = $modules.filter( '.license-expired' );
|
147 |
-
|
148 |
-
if ( 0 === $modulesWithNonActiveLicense.length ) {
|
149 |
-
/**
|
150 |
-
* It's possible that the context HTML table element doesn't have checkboxes with
|
151 |
-
* ".license-expired" class if for example only the themes table has such checkboxes and the user
|
152 |
-
* clicks on a "Select All" checkbox on the plugins table which has no such checkboxes.
|
153 |
-
*
|
154 |
-
* @author Leo Fajardo (@leorw)
|
155 |
-
*/
|
156 |
-
return true;
|
157 |
-
} else if ( 1 === $modulesWithNonActiveLicense.length ) {
|
158 |
-
showModal( $modulesWithNonActiveLicense );
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Prevent the default WordPress handler from checking all checkboxes.
|
163 |
-
*
|
164 |
-
* @author Leo Fajardo (@leorw)
|
165 |
-
*/
|
166 |
-
evt.stopImmediatePropagation();
|
167 |
-
|
168 |
-
$modules.filter( ':not(.license-expired)' )
|
169 |
-
.prop( 'checked', function() {
|
170 |
-
if ( $( this ).is( ':hidden,:disabled' ) ) {
|
171 |
-
return false;
|
172 |
-
}
|
173 |
-
|
174 |
-
if ( toggle ) {
|
175 |
-
return ! $( this ).prop( 'checked' );
|
176 |
-
} else if ( controlChecked ) {
|
177 |
-
return true;
|
178 |
-
}
|
179 |
-
|
180 |
-
return false;
|
181 |
-
});
|
182 |
-
|
183 |
-
return false;
|
184 |
-
});
|
185 |
-
}
|
186 |
-
|
187 |
-
registerEventHandlers();
|
188 |
-
|
189 |
-
function showModal( $module ) {
|
190 |
-
$modal.find( '#plugin_name' ).text( $module.data( 'plugin-name' ) );
|
191 |
-
$modal.find( '#pricing_url' ).attr( 'href', $module.data( 'pricing-url' ) );
|
192 |
-
$modal.find( '#new_version' ).text( $module.data( 'new-version' ) );
|
193 |
-
|
194 |
-
// Display the dialog box.
|
195 |
-
$modal.addClass( 'active' );
|
196 |
-
$( 'body' ).addClass( 'has-fs-modal' );
|
197 |
-
}
|
198 |
-
|
199 |
-
function closeModal() {
|
200 |
-
$modal.removeClass( 'active' );
|
201 |
-
$( 'body' ).removeClass( 'has-fs-modal' );
|
202 |
-
}
|
203 |
-
});
|
204 |
-
})( jQuery );
|
205 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.2
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Freemius $fs
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
$slug = $fs->get_slug();
|
18 |
+
|
19 |
+
$plugin_data = $fs->get_plugin_data();
|
20 |
+
$plugin_name = $plugin_data['Name'];
|
21 |
+
$plugin_basename = $fs->get_plugin_basename();
|
22 |
+
|
23 |
+
$license = $fs->_get_license();
|
24 |
+
|
25 |
+
if ( ! is_object( $license ) ) {
|
26 |
+
$purchase_url = $fs->pricing_url();
|
27 |
+
} else {
|
28 |
+
$subscription = $fs->_get_subscription( $license->id );
|
29 |
+
|
30 |
+
$purchase_url = $fs->checkout_url(
|
31 |
+
is_object( $subscription ) ?
|
32 |
+
( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
|
33 |
+
WP_FS__PERIOD_LIFETIME,
|
34 |
+
false,
|
35 |
+
array( 'licenses' => $license->quota )
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
$message = sprintf(
|
40 |
+
fs_text_inline( 'There is a new version of %s available.', 'new-version-available-message', $slug ) .
|
41 |
+
fs_text_inline( ' %s to access version %s security & feature updates, and support.', 'x-for-updates-and-support', $slug ),
|
42 |
+
'<span id="plugin_name"></span>',
|
43 |
+
sprintf(
|
44 |
+
'<a id="pricing_url" href="">%s</a>',
|
45 |
+
is_object( $license ) ?
|
46 |
+
fs_text_inline( 'Renew your license now', 'renew-license-now', $slug ) :
|
47 |
+
fs_text_inline( 'Buy a license now', 'buy-license-now', $slug )
|
48 |
+
),
|
49 |
+
'<span id="new_version"></span>'
|
50 |
+
);
|
51 |
+
|
52 |
+
$modal_content_html = "<p>{$message}</p>";
|
53 |
+
|
54 |
+
$header_title = fs_text_inline( 'New Version Available', 'new-version-available', $slug );
|
55 |
+
|
56 |
+
$renew_license_button_text = is_object( $license ) ?
|
57 |
+
fs_text_inline( 'Renew license', 'renew-license', $slug ) :
|
58 |
+
fs_text_inline( 'Buy license', 'buy-license', $slug );
|
59 |
+
|
60 |
+
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
61 |
+
?>
|
62 |
+
<script type="text/javascript">
|
63 |
+
(function( $ ) {
|
64 |
+
$( document ).ready(function() {
|
65 |
+
if ( 0 === $( '.license-expired' ).length ) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
|
70 |
+
modalHtml =
|
71 |
+
'<div class="fs-modal fs-modal-upgrade-premium-version">'
|
72 |
+
+ ' <div class="fs-modal-dialog">'
|
73 |
+
+ ' <div class="fs-modal-header">'
|
74 |
+
+ ' <h4><?php echo esc_js( $header_title ) ?></h4>'
|
75 |
+
+ ' <a href="!#" class="fs-close"><i class="dashicons dashicons-no" title="<?php echo esc_js( fs_text_x_inline( 'Dismiss', 'close a window', 'dismiss', $slug ) ) ?>"></i></a>'
|
76 |
+
+ ' </div>'
|
77 |
+
+ ' <div class="fs-modal-body">'
|
78 |
+
+ ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
|
79 |
+
+ ' </div>'
|
80 |
+
+ ' <div class="fs-modal-footer">'
|
81 |
+
+ ' <a class="button button-primary button-renew-license" tabindex="3" href="<?php echo $purchase_url ?>"><?php echo esc_js( $renew_license_button_text ) ?></a>'
|
82 |
+
+ ' <button class="button button-secondary button-close" tabindex="4"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></button>'
|
83 |
+
+ ' </div>'
|
84 |
+
+ ' </div>'
|
85 |
+
+ '</div>',
|
86 |
+
$modal = $( modalHtml ),
|
87 |
+
isPluginsPage = <?php echo Freemius::is_plugins_page() ? 'true' : 'false' ?>;
|
88 |
+
|
89 |
+
$modal.appendTo( $( 'body' ) );
|
90 |
+
|
91 |
+
function registerEventHandlers() {
|
92 |
+
$( 'body' ).on( 'click', '.license-expired', function( evt ) {
|
93 |
+
var $this = $( this );
|
94 |
+
|
95 |
+
if ( ! $this.is( ':checked' ) ||
|
96 |
+
(
|
97 |
+
isPluginsPage &&
|
98 |
+
'update-selected' !== $( '#bulk-action-selector-top' ).val() &&
|
99 |
+
'update-selected' !== $( '#bulk-action-selector-bottom' ).val()
|
100 |
+
)
|
101 |
+
) {
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
|
105 |
+
evt.preventDefault();
|
106 |
+
evt.stopImmediatePropagation();
|
107 |
+
|
108 |
+
showModal( $this );
|
109 |
+
});
|
110 |
+
|
111 |
+
// If the user has clicked outside the window, close the modal.
|
112 |
+
$modal.on( 'click', '.fs-close, .button-secondary', function() {
|
113 |
+
closeModal();
|
114 |
+
return false;
|
115 |
+
});
|
116 |
+
|
117 |
+
if ( isPluginsPage ) {
|
118 |
+
$( 'body' ).on( 'change', 'select[id*="bulk-action-selector"]', function() {
|
119 |
+
if ( 'update-selected' === $( this ).val() ) {
|
120 |
+
setTimeout(function() {
|
121 |
+
$( '.license-expired' ).prop( 'checked', false );
|
122 |
+
$( '[id*="select-all"]' ).prop( 'checked', false );
|
123 |
+
}, 0);
|
124 |
+
}
|
125 |
+
});
|
126 |
+
}
|
127 |
+
|
128 |
+
$( 'body' ).on( 'click', '[id*="select-all"]', function( evt ) {
|
129 |
+
var $this = $( this );
|
130 |
+
|
131 |
+
if ( ! $this.is( ':checked' ) ) {
|
132 |
+
return true;
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( isPluginsPage ) {
|
136 |
+
if ( 'update-selected' !== $( '#bulk-action-selector-top' ).val() &&
|
137 |
+
'update-selected' !== $( '#bulk-action-selector-bottom' ).val() ) {
|
138 |
+
return true;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
var $table = $this.closest( 'table' ),
|
143 |
+
controlChecked = $this.prop( 'checked' ),
|
144 |
+
toggle = ( event.shiftKey || $this.data( 'wp-toggle' ) ),
|
145 |
+
$modules = $table.children( 'tbody' ).filter( ':visible' ).children().children( '.check-column' ).find( ':checkbox' ),
|
146 |
+
$modulesWithNonActiveLicense = $modules.filter( '.license-expired' );
|
147 |
+
|
148 |
+
if ( 0 === $modulesWithNonActiveLicense.length ) {
|
149 |
+
/**
|
150 |
+
* It's possible that the context HTML table element doesn't have checkboxes with
|
151 |
+
* ".license-expired" class if for example only the themes table has such checkboxes and the user
|
152 |
+
* clicks on a "Select All" checkbox on the plugins table which has no such checkboxes.
|
153 |
+
*
|
154 |
+
* @author Leo Fajardo (@leorw)
|
155 |
+
*/
|
156 |
+
return true;
|
157 |
+
} else if ( 1 === $modulesWithNonActiveLicense.length ) {
|
158 |
+
showModal( $modulesWithNonActiveLicense );
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Prevent the default WordPress handler from checking all checkboxes.
|
163 |
+
*
|
164 |
+
* @author Leo Fajardo (@leorw)
|
165 |
+
*/
|
166 |
+
evt.stopImmediatePropagation();
|
167 |
+
|
168 |
+
$modules.filter( ':not(.license-expired)' )
|
169 |
+
.prop( 'checked', function() {
|
170 |
+
if ( $( this ).is( ':hidden,:disabled' ) ) {
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
|
174 |
+
if ( toggle ) {
|
175 |
+
return ! $( this ).prop( 'checked' );
|
176 |
+
} else if ( controlChecked ) {
|
177 |
+
return true;
|
178 |
+
}
|
179 |
+
|
180 |
+
return false;
|
181 |
+
});
|
182 |
+
|
183 |
+
return false;
|
184 |
+
});
|
185 |
+
}
|
186 |
+
|
187 |
+
registerEventHandlers();
|
188 |
+
|
189 |
+
function showModal( $module ) {
|
190 |
+
$modal.find( '#plugin_name' ).text( $module.data( 'plugin-name' ) );
|
191 |
+
$modal.find( '#pricing_url' ).attr( 'href', $module.data( 'pricing-url' ) );
|
192 |
+
$modal.find( '#new_version' ).text( $module.data( 'new-version' ) );
|
193 |
+
|
194 |
+
// Display the dialog box.
|
195 |
+
$modal.addClass( 'active' );
|
196 |
+
$( 'body' ).addClass( 'has-fs-modal' );
|
197 |
+
}
|
198 |
+
|
199 |
+
function closeModal() {
|
200 |
+
$modal.removeClass( 'active' );
|
201 |
+
$( 'body' ).removeClass( 'has-fs-modal' );
|
202 |
+
}
|
203 |
+
});
|
204 |
+
})( jQuery );
|
205 |
</script>
|
lib/freemius/templates/forms/premium-versions-upgrade-metadata.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.2
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var Freemius $fs
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
|
18 |
-
$license = $fs->_get_license();
|
19 |
-
|
20 |
-
if ( ! is_object( $license ) ) {
|
21 |
-
$purchase_url = $fs->pricing_url();
|
22 |
-
} else {
|
23 |
-
$subscription = $fs->_get_subscription( $license->id );
|
24 |
-
|
25 |
-
$purchase_url = $fs->checkout_url(
|
26 |
-
is_object( $subscription ) ?
|
27 |
-
( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
|
28 |
-
WP_FS__PERIOD_LIFETIME,
|
29 |
-
false,
|
30 |
-
array( 'licenses' => $license->quota )
|
31 |
-
);
|
32 |
-
}
|
33 |
-
|
34 |
-
$plugin_data = $fs->get_plugin_data();
|
35 |
-
?>
|
36 |
-
<script type="text/javascript">
|
37 |
-
(function( $ ) {
|
38 |
-
$( document ).ready(function() {
|
39 |
-
var $premiumVersionCheckbox = $( 'input[type="checkbox"][value="<?php echo $fs->get_plugin_basename() ?>"]' );
|
40 |
-
|
41 |
-
$premiumVersionCheckbox.addClass( 'license-expired' );
|
42 |
-
$premiumVersionCheckbox.data( 'plugin-name', <?php echo json_encode( $plugin_data['Name'] ) ?> );
|
43 |
-
$premiumVersionCheckbox.data( 'pricing-url', <?php echo json_encode( $purchase_url ) ?> );
|
44 |
-
$premiumVersionCheckbox.data( 'new-version', <?php echo json_encode( $VARS['new_version'] ) ?> );
|
45 |
-
});
|
46 |
-
})( jQuery );
|
47 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.2
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var Freemius $fs
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
|
18 |
+
$license = $fs->_get_license();
|
19 |
+
|
20 |
+
if ( ! is_object( $license ) ) {
|
21 |
+
$purchase_url = $fs->pricing_url();
|
22 |
+
} else {
|
23 |
+
$subscription = $fs->_get_subscription( $license->id );
|
24 |
+
|
25 |
+
$purchase_url = $fs->checkout_url(
|
26 |
+
is_object( $subscription ) ?
|
27 |
+
( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
|
28 |
+
WP_FS__PERIOD_LIFETIME,
|
29 |
+
false,
|
30 |
+
array( 'licenses' => $license->quota )
|
31 |
+
);
|
32 |
+
}
|
33 |
+
|
34 |
+
$plugin_data = $fs->get_plugin_data();
|
35 |
+
?>
|
36 |
+
<script type="text/javascript">
|
37 |
+
(function( $ ) {
|
38 |
+
$( document ).ready(function() {
|
39 |
+
var $premiumVersionCheckbox = $( 'input[type="checkbox"][value="<?php echo $fs->get_plugin_basename() ?>"]' );
|
40 |
+
|
41 |
+
$premiumVersionCheckbox.addClass( 'license-expired' );
|
42 |
+
$premiumVersionCheckbox.data( 'plugin-name', <?php echo json_encode( $plugin_data['Name'] ) ?> );
|
43 |
+
$premiumVersionCheckbox.data( 'pricing-url', <?php echo json_encode( $purchase_url ) ?> );
|
44 |
+
$premiumVersionCheckbox.data( 'new-version', <?php echo json_encode( $VARS['new_version'] ) ?> );
|
45 |
+
});
|
46 |
+
})( jQuery );
|
47 |
</script>
|
lib/freemius/templates/forms/subscription-cancellation.php
CHANGED
@@ -1,277 +1,277 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.2.1
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
$slug = $fs->get_slug();
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var FS_Plugin_License $license
|
21 |
-
*/
|
22 |
-
$license = $VARS['license'];
|
23 |
-
|
24 |
-
$has_trial = $VARS['has_trial'];
|
25 |
-
|
26 |
-
$subscription_cancellation_context = $has_trial ?
|
27 |
-
fs_text_inline( 'trial', 'trial', $slug ) :
|
28 |
-
fs_text_inline( 'subscription', 'subscription', $slug );
|
29 |
-
|
30 |
-
$plan = $fs->get_plan();
|
31 |
-
$module_label = $fs->get_module_label( true );
|
32 |
-
|
33 |
-
if ( $VARS['is_license_deactivation'] ) {
|
34 |
-
$subscription_cancellation_text = '';
|
35 |
-
} else {
|
36 |
-
$subscription_cancellation_text = sprintf(
|
37 |
-
fs_text_inline(
|
38 |
-
"Deactivating or uninstalling the %s will automatically disable the license, which you'll be able to use on another site.",
|
39 |
-
'deactivation-or-uninstall-message',
|
40 |
-
$slug
|
41 |
-
),
|
42 |
-
$module_label
|
43 |
-
) . ' ';
|
44 |
-
}
|
45 |
-
|
46 |
-
$subscription_cancellation_text .= sprintf(
|
47 |
-
fs_text_inline(
|
48 |
-
'In case you are NOT planning on using this %s on this site (or any other site) - would you like to cancel the %s as well?',
|
49 |
-
'cancel-subscription-message',
|
50 |
-
$slug
|
51 |
-
),
|
52 |
-
( $VARS['is_license_deactivation'] ? fs_text_inline( 'license', 'license', $slug ) : $module_label ),
|
53 |
-
$subscription_cancellation_context
|
54 |
-
);
|
55 |
-
|
56 |
-
$cancel_subscription_action_label = sprintf(
|
57 |
-
fs_esc_html_inline(
|
58 |
-
"Cancel %s - I no longer need any security & feature updates, nor support for %s because I'm not planning to use the %s on this, or any other site.",
|
59 |
-
'cancel-x',
|
60 |
-
$slug
|
61 |
-
),
|
62 |
-
esc_html( $subscription_cancellation_context ),
|
63 |
-
sprintf( '<strong>%s</strong>', esc_html( $fs->get_plugin_title() ) ),
|
64 |
-
esc_html( $module_label )
|
65 |
-
);
|
66 |
-
|
67 |
-
$keep_subscription_active_action_label = esc_html( sprintf(
|
68 |
-
fs_text_inline(
|
69 |
-
"Don't cancel %s - I'm still interested in getting security & feature updates, as well as be able to contact support.",
|
70 |
-
'dont-cancel-x',
|
71 |
-
$slug
|
72 |
-
),
|
73 |
-
$subscription_cancellation_context
|
74 |
-
) );
|
75 |
-
|
76 |
-
$subscription_cancellation_text = esc_html( $subscription_cancellation_text );
|
77 |
-
|
78 |
-
$subscription_cancellation_html = <<< HTML
|
79 |
-
<div class="notice notice-error inline"><p></p></div><p>{$subscription_cancellation_text}</p>
|
80 |
-
<ul class="subscription-actions">
|
81 |
-
<li>
|
82 |
-
<label>
|
83 |
-
<input type="radio" name="cancel-subscription" value="false"/>
|
84 |
-
<span>{$keep_subscription_active_action_label}</span>
|
85 |
-
</label>
|
86 |
-
</li>
|
87 |
-
<li>
|
88 |
-
<label>
|
89 |
-
<input type="radio" name="cancel-subscription" value="true"/>
|
90 |
-
<span>{$cancel_subscription_action_label}</span>
|
91 |
-
</label>
|
92 |
-
</li>
|
93 |
-
</ul>
|
94 |
-
HTML;
|
95 |
-
|
96 |
-
$downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
|
97 |
-
$cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
|
98 |
-
/* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
|
99 |
-
$downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
|
100 |
-
$prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
|
101 |
-
$after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
|
102 |
-
$after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
|
103 |
-
$after_downgrade_blocking_text_premium_only = fs_text_inline( 'Once your license expires you will no longer be able to use the %s, unless you activate it again with a valid premium license.', 'after-downgrade-blocking-premium-only', $slug );
|
104 |
-
|
105 |
-
$subscription_cancellation_confirmation_message = $has_trial ?
|
106 |
-
fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug ) :
|
107 |
-
sprintf(
|
108 |
-
'%s %s %s %s',
|
109 |
-
sprintf(
|
110 |
-
$downgrade_x_confirm_text,
|
111 |
-
($fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
|
112 |
-
$plan->title,
|
113 |
-
human_time_diff( time(), strtotime( $license->expiration ) )
|
114 |
-
),
|
115 |
-
(
|
116 |
-
$license->is_block_features ?
|
117 |
-
(
|
118 |
-
$fs->is_only_premium() ?
|
119 |
-
sprintf( $after_downgrade_blocking_text_premium_only, $module_label ) :
|
120 |
-
sprintf( $after_downgrade_blocking_text, $plan->title )
|
121 |
-
) :
|
122 |
-
sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) )
|
123 |
-
),
|
124 |
-
$prices_increase_text,
|
125 |
-
fs_esc_attr_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug )
|
126 |
-
);
|
127 |
-
|
128 |
-
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
129 |
-
?>
|
130 |
-
<script type="text/javascript">
|
131 |
-
(function( $ ) {
|
132 |
-
var modalHtml =
|
133 |
-
'<div class="fs-modal fs-modal-subscription-cancellation fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>">'
|
134 |
-
+ ' <div class="fs-modal-dialog">'
|
135 |
-
+ ' <div class="fs-modal-header">'
|
136 |
-
+ ' <h4><?php echo esc_html( sprintf( fs_text_inline( 'Cancel %s?', 'cancel-x', $slug ), ucfirst( $subscription_cancellation_context ) ) ) ?></h4>'
|
137 |
-
+ ' </div>'
|
138 |
-
+ ' <div class="fs-modal-body">'
|
139 |
-
+ ' <div class="fs-modal-panel active">' + <?php echo json_encode( $subscription_cancellation_html ) ?> + '<p class="fs-price-increase-warning" style="display: none;">' + <?php echo json_encode( $prices_increase_text ) ?> + '</p></div>'
|
140 |
-
+ ' </div>'
|
141 |
-
+ ' <div class="fs-modal-footer">'
|
142 |
-
+ ' <a href="#" class="button button-secondary button-close"><?php fs_esc_attr_echo( 'cancel', $slug ) ?></a>'
|
143 |
-
+ ' <a href="#" class="button button-primary button-deactivate disabled"><?php fs_esc_attr_echo_inline( 'Proceed', 'proceed', $slug ) ?></a>'
|
144 |
-
+ ' </div>'
|
145 |
-
+ ' </div>'
|
146 |
-
+ '</div>',
|
147 |
-
$modal = $(modalHtml);
|
148 |
-
|
149 |
-
$modal.appendTo($('body'));
|
150 |
-
|
151 |
-
registerEventHandlers();
|
152 |
-
|
153 |
-
function registerEventHandlers() {
|
154 |
-
$modal.on( 'showModal', function() {
|
155 |
-
showModal();
|
156 |
-
});
|
157 |
-
|
158 |
-
$modal.on( 'closeModal', function() {
|
159 |
-
closeModal();
|
160 |
-
});
|
161 |
-
|
162 |
-
$modal.on('click', '.fs-modal-footer .button', function (evt) {
|
163 |
-
evt.preventDefault();
|
164 |
-
|
165 |
-
if ($(this).hasClass('disabled')) {
|
166 |
-
return;
|
167 |
-
}
|
168 |
-
|
169 |
-
var _this = $(this),
|
170 |
-
subscriptionCancellationActionEventName = <?php echo json_encode( $fs->get_action_tag( 'subscription_cancellation_action' ) ) ?>;
|
171 |
-
|
172 |
-
if ( _this.hasClass( 'button-primary' ) ) {
|
173 |
-
if ( 'true' !== $modal.find( 'input[name="cancel-subscription"]:checked' ).val() ) {
|
174 |
-
$modal.trigger( subscriptionCancellationActionEventName, false );
|
175 |
-
} else {
|
176 |
-
if ( confirm( <?php echo json_encode( $subscription_cancellation_confirmation_message ) ?> ) ) {
|
177 |
-
$modal.trigger( subscriptionCancellationActionEventName, true );
|
178 |
-
}
|
179 |
-
}
|
180 |
-
}
|
181 |
-
});
|
182 |
-
|
183 |
-
$modal.on('click', 'input[type="radio"]', function () {
|
184 |
-
var
|
185 |
-
$selectedOption = $( this ),
|
186 |
-
$primaryButton = $modal.find( '.button-primary' ),
|
187 |
-
isSelected = ( 'true' === $selectedOption.val() );
|
188 |
-
|
189 |
-
if ( isSelected ) {
|
190 |
-
$primaryButton.html( <?php echo json_encode( sprintf(
|
191 |
-
fs_text_inline( 'Cancel %s & Proceed', 'cancel-x-and-proceed', $slug ),
|
192 |
-
ucfirst( $subscription_cancellation_context )
|
193 |
-
) ) ?> );
|
194 |
-
|
195 |
-
$modal.find('.fs-price-increase-warning').show();
|
196 |
-
} else {
|
197 |
-
$primaryButton.html( <?php echo fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
|
198 |
-
$modal.find('.fs-price-increase-warning').hide();
|
199 |
-
}
|
200 |
-
|
201 |
-
$primaryButton.toggleClass( 'warn', isSelected );
|
202 |
-
$primaryButton.removeClass( 'disabled' );
|
203 |
-
});
|
204 |
-
|
205 |
-
// If the user has clicked outside the window, cancel it.
|
206 |
-
$modal.on('click', function (evt) {
|
207 |
-
var $target = $(evt.target);
|
208 |
-
|
209 |
-
// If the user has clicked anywhere in the modal dialog, just return.
|
210 |
-
if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
|
211 |
-
return;
|
212 |
-
}
|
213 |
-
|
214 |
-
// If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
|
215 |
-
if (
|
216 |
-
( ! $target.hasClass( 'button-close' ) ) &&
|
217 |
-
( $target.parents( '.fs-modal-body' ).length > 0 || $target.parents( '.fs-modal-footer' ).length > 0 )
|
218 |
-
) {
|
219 |
-
return;
|
220 |
-
}
|
221 |
-
|
222 |
-
closeModal();
|
223 |
-
|
224 |
-
return false;
|
225 |
-
});
|
226 |
-
}
|
227 |
-
|
228 |
-
function showModal() {
|
229 |
-
resetModal();
|
230 |
-
|
231 |
-
// Display the dialog box.
|
232 |
-
$modal.addClass('active');
|
233 |
-
|
234 |
-
$('body').addClass('has-fs-modal');
|
235 |
-
}
|
236 |
-
|
237 |
-
function closeModal() {
|
238 |
-
var activeModalsCount = $( '.fs-modal.active' ).length;
|
239 |
-
|
240 |
-
$modal.removeClass('active');
|
241 |
-
|
242 |
-
// If child modal, do not remove the "has-fs-modal" class of the <body> element to keep its scrollbars hidden.
|
243 |
-
if ( activeModalsCount > 1 ) {
|
244 |
-
return;
|
245 |
-
}
|
246 |
-
|
247 |
-
$('body').removeClass('has-fs-modal');
|
248 |
-
}
|
249 |
-
|
250 |
-
function resetModal() {
|
251 |
-
updateButtonLabels();
|
252 |
-
|
253 |
-
if ( 0 === $modal.find( '.subscription-actions' ).length ) {
|
254 |
-
$modal.find('.button-deactivate').removeClass('disabled');
|
255 |
-
} else {
|
256 |
-
$modal.find('.button-deactivate').addClass('disabled');
|
257 |
-
}
|
258 |
-
|
259 |
-
$modal.find('.fs-price-increase-warning').hide();
|
260 |
-
|
261 |
-
// Uncheck all radio buttons.
|
262 |
-
$modal.find('input[type="radio"]').prop('checked', false);
|
263 |
-
|
264 |
-
$modal.find('.message').hide();
|
265 |
-
}
|
266 |
-
|
267 |
-
function showMessage(message) {
|
268 |
-
$modal.find('.message').text(message).show();
|
269 |
-
}
|
270 |
-
|
271 |
-
function updateButtonLabels() {
|
272 |
-
$modal.find('.button-primary').text( <?php fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
|
273 |
-
|
274 |
-
$modal.find('.button-secondary').text( <?php fs_json_encode_echo( 'cancel', $slug ) ?> );
|
275 |
-
}
|
276 |
-
})( jQuery );
|
277 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.2.1
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
$slug = $fs->get_slug();
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var FS_Plugin_License $license
|
21 |
+
*/
|
22 |
+
$license = $VARS['license'];
|
23 |
+
|
24 |
+
$has_trial = $VARS['has_trial'];
|
25 |
+
|
26 |
+
$subscription_cancellation_context = $has_trial ?
|
27 |
+
fs_text_inline( 'trial', 'trial', $slug ) :
|
28 |
+
fs_text_inline( 'subscription', 'subscription', $slug );
|
29 |
+
|
30 |
+
$plan = $fs->get_plan();
|
31 |
+
$module_label = $fs->get_module_label( true );
|
32 |
+
|
33 |
+
if ( $VARS['is_license_deactivation'] ) {
|
34 |
+
$subscription_cancellation_text = '';
|
35 |
+
} else {
|
36 |
+
$subscription_cancellation_text = sprintf(
|
37 |
+
fs_text_inline(
|
38 |
+
"Deactivating or uninstalling the %s will automatically disable the license, which you'll be able to use on another site.",
|
39 |
+
'deactivation-or-uninstall-message',
|
40 |
+
$slug
|
41 |
+
),
|
42 |
+
$module_label
|
43 |
+
) . ' ';
|
44 |
+
}
|
45 |
+
|
46 |
+
$subscription_cancellation_text .= sprintf(
|
47 |
+
fs_text_inline(
|
48 |
+
'In case you are NOT planning on using this %s on this site (or any other site) - would you like to cancel the %s as well?',
|
49 |
+
'cancel-subscription-message',
|
50 |
+
$slug
|
51 |
+
),
|
52 |
+
( $VARS['is_license_deactivation'] ? fs_text_inline( 'license', 'license', $slug ) : $module_label ),
|
53 |
+
$subscription_cancellation_context
|
54 |
+
);
|
55 |
+
|
56 |
+
$cancel_subscription_action_label = sprintf(
|
57 |
+
fs_esc_html_inline(
|
58 |
+
"Cancel %s - I no longer need any security & feature updates, nor support for %s because I'm not planning to use the %s on this, or any other site.",
|
59 |
+
'cancel-x',
|
60 |
+
$slug
|
61 |
+
),
|
62 |
+
esc_html( $subscription_cancellation_context ),
|
63 |
+
sprintf( '<strong>%s</strong>', esc_html( $fs->get_plugin_title() ) ),
|
64 |
+
esc_html( $module_label )
|
65 |
+
);
|
66 |
+
|
67 |
+
$keep_subscription_active_action_label = esc_html( sprintf(
|
68 |
+
fs_text_inline(
|
69 |
+
"Don't cancel %s - I'm still interested in getting security & feature updates, as well as be able to contact support.",
|
70 |
+
'dont-cancel-x',
|
71 |
+
$slug
|
72 |
+
),
|
73 |
+
$subscription_cancellation_context
|
74 |
+
) );
|
75 |
+
|
76 |
+
$subscription_cancellation_text = esc_html( $subscription_cancellation_text );
|
77 |
+
|
78 |
+
$subscription_cancellation_html = <<< HTML
|
79 |
+
<div class="notice notice-error inline"><p></p></div><p>{$subscription_cancellation_text}</p>
|
80 |
+
<ul class="subscription-actions">
|
81 |
+
<li>
|
82 |
+
<label>
|
83 |
+
<input type="radio" name="cancel-subscription" value="false"/>
|
84 |
+
<span>{$keep_subscription_active_action_label}</span>
|
85 |
+
</label>
|
86 |
+
</li>
|
87 |
+
<li>
|
88 |
+
<label>
|
89 |
+
<input type="radio" name="cancel-subscription" value="true"/>
|
90 |
+
<span>{$cancel_subscription_action_label}</span>
|
91 |
+
</label>
|
92 |
+
</li>
|
93 |
+
</ul>
|
94 |
+
HTML;
|
95 |
+
|
96 |
+
$downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
|
97 |
+
$cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
|
98 |
+
/* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
|
99 |
+
$downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
|
100 |
+
$prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
|
101 |
+
$after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
|
102 |
+
$after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
|
103 |
+
$after_downgrade_blocking_text_premium_only = fs_text_inline( 'Once your license expires you will no longer be able to use the %s, unless you activate it again with a valid premium license.', 'after-downgrade-blocking-premium-only', $slug );
|
104 |
+
|
105 |
+
$subscription_cancellation_confirmation_message = $has_trial ?
|
106 |
+
fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug ) :
|
107 |
+
sprintf(
|
108 |
+
'%s %s %s %s',
|
109 |
+
sprintf(
|
110 |
+
$downgrade_x_confirm_text,
|
111 |
+
($fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
|
112 |
+
$plan->title,
|
113 |
+
human_time_diff( time(), strtotime( $license->expiration ) )
|
114 |
+
),
|
115 |
+
(
|
116 |
+
$license->is_block_features ?
|
117 |
+
(
|
118 |
+
$fs->is_only_premium() ?
|
119 |
+
sprintf( $after_downgrade_blocking_text_premium_only, $module_label ) :
|
120 |
+
sprintf( $after_downgrade_blocking_text, $plan->title )
|
121 |
+
) :
|
122 |
+
sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) )
|
123 |
+
),
|
124 |
+
$prices_increase_text,
|
125 |
+
fs_esc_attr_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug )
|
126 |
+
);
|
127 |
+
|
128 |
+
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
129 |
+
?>
|
130 |
+
<script type="text/javascript">
|
131 |
+
(function( $ ) {
|
132 |
+
var modalHtml =
|
133 |
+
'<div class="fs-modal fs-modal-subscription-cancellation fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>">'
|
134 |
+
+ ' <div class="fs-modal-dialog">'
|
135 |
+
+ ' <div class="fs-modal-header">'
|
136 |
+
+ ' <h4><?php echo esc_html( sprintf( fs_text_inline( 'Cancel %s?', 'cancel-x', $slug ), ucfirst( $subscription_cancellation_context ) ) ) ?></h4>'
|
137 |
+
+ ' </div>'
|
138 |
+
+ ' <div class="fs-modal-body">'
|
139 |
+
+ ' <div class="fs-modal-panel active">' + <?php echo json_encode( $subscription_cancellation_html ) ?> + '<p class="fs-price-increase-warning" style="display: none;">' + <?php echo json_encode( $prices_increase_text ) ?> + '</p></div>'
|
140 |
+
+ ' </div>'
|
141 |
+
+ ' <div class="fs-modal-footer">'
|
142 |
+
+ ' <a href="#" class="button button-secondary button-close"><?php fs_esc_attr_echo( 'cancel', $slug ) ?></a>'
|
143 |
+
+ ' <a href="#" class="button button-primary button-deactivate disabled"><?php fs_esc_attr_echo_inline( 'Proceed', 'proceed', $slug ) ?></a>'
|
144 |
+
+ ' </div>'
|
145 |
+
+ ' </div>'
|
146 |
+
+ '</div>',
|
147 |
+
$modal = $(modalHtml);
|
148 |
+
|
149 |
+
$modal.appendTo($('body'));
|
150 |
+
|
151 |
+
registerEventHandlers();
|
152 |
+
|
153 |
+
function registerEventHandlers() {
|
154 |
+
$modal.on( 'showModal', function() {
|
155 |
+
showModal();
|
156 |
+
});
|
157 |
+
|
158 |
+
$modal.on( 'closeModal', function() {
|
159 |
+
closeModal();
|
160 |
+
});
|
161 |
+
|
162 |
+
$modal.on('click', '.fs-modal-footer .button', function (evt) {
|
163 |
+
evt.preventDefault();
|
164 |
+
|
165 |
+
if ($(this).hasClass('disabled')) {
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
|
169 |
+
var _this = $(this),
|
170 |
+
subscriptionCancellationActionEventName = <?php echo json_encode( $fs->get_action_tag( 'subscription_cancellation_action' ) ) ?>;
|
171 |
+
|
172 |
+
if ( _this.hasClass( 'button-primary' ) ) {
|
173 |
+
if ( 'true' !== $modal.find( 'input[name="cancel-subscription"]:checked' ).val() ) {
|
174 |
+
$modal.trigger( subscriptionCancellationActionEventName, false );
|
175 |
+
} else {
|
176 |
+
if ( confirm( <?php echo json_encode( $subscription_cancellation_confirmation_message ) ?> ) ) {
|
177 |
+
$modal.trigger( subscriptionCancellationActionEventName, true );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
});
|
182 |
+
|
183 |
+
$modal.on('click', 'input[type="radio"]', function () {
|
184 |
+
var
|
185 |
+
$selectedOption = $( this ),
|
186 |
+
$primaryButton = $modal.find( '.button-primary' ),
|
187 |
+
isSelected = ( 'true' === $selectedOption.val() );
|
188 |
+
|
189 |
+
if ( isSelected ) {
|
190 |
+
$primaryButton.html( <?php echo json_encode( sprintf(
|
191 |
+
fs_text_inline( 'Cancel %s & Proceed', 'cancel-x-and-proceed', $slug ),
|
192 |
+
ucfirst( $subscription_cancellation_context )
|
193 |
+
) ) ?> );
|
194 |
+
|
195 |
+
$modal.find('.fs-price-increase-warning').show();
|
196 |
+
} else {
|
197 |
+
$primaryButton.html( <?php echo fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
|
198 |
+
$modal.find('.fs-price-increase-warning').hide();
|
199 |
+
}
|
200 |
+
|
201 |
+
$primaryButton.toggleClass( 'warn', isSelected );
|
202 |
+
$primaryButton.removeClass( 'disabled' );
|
203 |
+
});
|
204 |
+
|
205 |
+
// If the user has clicked outside the window, cancel it.
|
206 |
+
$modal.on('click', function (evt) {
|
207 |
+
var $target = $(evt.target);
|
208 |
+
|
209 |
+
// If the user has clicked anywhere in the modal dialog, just return.
|
210 |
+
if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
|
214 |
+
// If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
|
215 |
+
if (
|
216 |
+
( ! $target.hasClass( 'button-close' ) ) &&
|
217 |
+
( $target.parents( '.fs-modal-body' ).length > 0 || $target.parents( '.fs-modal-footer' ).length > 0 )
|
218 |
+
) {
|
219 |
+
return;
|
220 |
+
}
|
221 |
+
|
222 |
+
closeModal();
|
223 |
+
|
224 |
+
return false;
|
225 |
+
});
|
226 |
+
}
|
227 |
+
|
228 |
+
function showModal() {
|
229 |
+
resetModal();
|
230 |
+
|
231 |
+
// Display the dialog box.
|
232 |
+
$modal.addClass('active');
|
233 |
+
|
234 |
+
$('body').addClass('has-fs-modal');
|
235 |
+
}
|
236 |
+
|
237 |
+
function closeModal() {
|
238 |
+
var activeModalsCount = $( '.fs-modal.active' ).length;
|
239 |
+
|
240 |
+
$modal.removeClass('active');
|
241 |
+
|
242 |
+
// If child modal, do not remove the "has-fs-modal" class of the <body> element to keep its scrollbars hidden.
|
243 |
+
if ( activeModalsCount > 1 ) {
|
244 |
+
return;
|
245 |
+
}
|
246 |
+
|
247 |
+
$('body').removeClass('has-fs-modal');
|
248 |
+
}
|
249 |
+
|
250 |
+
function resetModal() {
|
251 |
+
updateButtonLabels();
|
252 |
+
|
253 |
+
if ( 0 === $modal.find( '.subscription-actions' ).length ) {
|
254 |
+
$modal.find('.button-deactivate').removeClass('disabled');
|
255 |
+
} else {
|
256 |
+
$modal.find('.button-deactivate').addClass('disabled');
|
257 |
+
}
|
258 |
+
|
259 |
+
$modal.find('.fs-price-increase-warning').hide();
|
260 |
+
|
261 |
+
// Uncheck all radio buttons.
|
262 |
+
$modal.find('input[type="radio"]').prop('checked', false);
|
263 |
+
|
264 |
+
$modal.find('.message').hide();
|
265 |
+
}
|
266 |
+
|
267 |
+
function showMessage(message) {
|
268 |
+
$modal.find('.message').text(message).show();
|
269 |
+
}
|
270 |
+
|
271 |
+
function updateButtonLabels() {
|
272 |
+
$modal.find('.button-primary').text( <?php fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
|
273 |
+
|
274 |
+
$modal.find('.button-secondary').text( <?php fs_json_encode_echo( 'cancel', $slug ) ?> );
|
275 |
+
}
|
276 |
+
})( jQuery );
|
277 |
</script>
|
lib/freemius/templates/forms/trial-start.php
CHANGED
@@ -1,181 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
*/
|
17 |
-
$fs = freemius( $VARS['id'] );
|
18 |
-
$slug = $fs->get_slug();
|
19 |
-
|
20 |
-
$message_header = sprintf(
|
21 |
-
/* translators: %1$s: Number of trial days; %2$s: Plan name; */
|
22 |
-
fs_text_inline( 'You are 1-click away from starting your %1$s-day free trial of the %2$s plan.', 'start-trial-prompt-header', $slug ),
|
23 |
-
'<span class="var-trial_period"></span>',
|
24 |
-
'<span class="var-plan_title"></span>'
|
25 |
-
);
|
26 |
-
$message_content = sprintf(
|
27 |
-
/* translators: %s: Link to freemius.com */
|
28 |
-
fs_text_inline( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt in with your user and non-sensitive site information, allowing the %s to periodically send data to %s to check for version updates and to validate your trial.', 'start-trial-prompt-message', $slug ),
|
29 |
-
$fs->get_module_type(),
|
30 |
-
sprintf(
|
31 |
-
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
32 |
-
'https://freemius.com',
|
33 |
-
'freemius.com'
|
34 |
-
)
|
35 |
-
);
|
36 |
-
|
37 |
-
$modal_content_html = <<< HTML
|
38 |
-
<div class="notice notice-error inline"><p></p></div>
|
39 |
-
<h3>{$message_header}</h3>
|
40 |
-
<p>{$message_content}</p>
|
41 |
-
HTML;
|
42 |
-
|
43 |
-
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
44 |
-
?>
|
45 |
-
<script type="text/javascript">
|
46 |
-
(function ($) {
|
47 |
-
$(document).ready(function () {
|
48 |
-
var modalContentHtml = <?php echo json_encode( $modal_content_html ); ?>,
|
49 |
-
modalHtml =
|
50 |
-
'<div class="fs-modal fs-modal-license-key-resend">'
|
51 |
-
+ ' <div class="fs-modal-dialog">'
|
52 |
-
+ ' <div class="fs-modal-header">'
|
53 |
-
+ ' <h4><?php echo esc_js( fs_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial', $slug ) ) ?></h4>'
|
54 |
-
+ ' </div>'
|
55 |
-
+ ' <div class="fs-modal-body">' + modalContentHtml + '</div>'
|
56 |
-
+ ' <div class="fs-modal-footer">'
|
57 |
-
+ ' <button class="button button-secondary button-close">' + <?php fs_json_encode_echo_inline( 'Cancel', 'cancel', $slug ) ?> +'</button>'
|
58 |
-
+ ' <button class="button button-primary button-connect">' + <?php fs_json_encode_echo_inline( 'Approve & Start Trial', 'approve-start-trial', $slug ) ?> +'</button>'
|
59 |
-
+ ' </div>'
|
60 |
-
+ ' </div>'
|
61 |
-
+ '</div>',
|
62 |
-
$modal = $( modalHtml ),
|
63 |
-
trialData;
|
64 |
-
|
65 |
-
$modal.appendTo($('body'));
|
66 |
-
|
67 |
-
var $errorNotice = $modal.find('.notice-error');
|
68 |
-
|
69 |
-
registerEventHandlers();
|
70 |
-
|
71 |
-
function registerEventHandlers() {
|
72 |
-
$modal.on('click', '.button-close', function () {
|
73 |
-
closeModal();
|
74 |
-
return false;
|
75 |
-
});
|
76 |
-
|
77 |
-
$modal.on('click', '.button-connect', function (evt) {
|
78 |
-
evt.preventDefault();
|
79 |
-
|
80 |
-
var $button = $(this);
|
81 |
-
|
82 |
-
$.ajax({
|
83 |
-
url : ajaxurl,
|
84 |
-
method : 'POST',
|
85 |
-
data : {
|
86 |
-
action : '<?php echo $fs->get_ajax_action( 'start_trial' ) ?>',
|
87 |
-
security : '<?php echo $fs->get_ajax_security( 'start_trial' ) ?>',
|
88 |
-
module_id: '<?php echo $fs->get_id() ?>',
|
89 |
-
trial : trialData
|
90 |
-
},
|
91 |
-
beforeSend: function () {
|
92 |
-
// Disable all buttons during trial activation.
|
93 |
-
$modal.find('.button').prop('disabled', true);
|
94 |
-
|
95 |
-
$button.text(<?php fs_json_encode_echo_inline( 'Starting trial', 'starting-trial', $slug ) ?> + '...');
|
96 |
-
|
97 |
-
setLoadingMode();
|
98 |
-
},
|
99 |
-
success : function (resultObj) {
|
100 |
-
if (resultObj.success) {
|
101 |
-
$button.text(<?php fs_json_encode_echo_inline( 'Please wait', 'please-wait', $slug ) ?> + '...');
|
102 |
-
|
103 |
-
// Redirect to the "Account" page and sync the license.
|
104 |
-
window.location.href = resultObj.data.next_page;
|
105 |
-
} else {
|
106 |
-
$button.text(<?php fs_json_encode_echo( 'approve-start-trial', $slug ) ?>);
|
107 |
-
|
108 |
-
resetLoadingMode();
|
109 |
-
showError(resultObj.error);
|
110 |
-
}
|
111 |
-
}
|
112 |
-
});
|
113 |
-
});
|
114 |
-
}
|
115 |
-
|
116 |
-
window.openTrialConfirmationModal = function showModal(data) {
|
117 |
-
resetModal();
|
118 |
-
|
119 |
-
// Display the dialog box.
|
120 |
-
$modal.addClass('active');
|
121 |
-
|
122 |
-
trialData = data;
|
123 |
-
|
124 |
-
var $modalBody = $modal.find('.fs-modal-body'),
|
125 |
-
$var;
|
126 |
-
|
127 |
-
for (var key in data) {
|
128 |
-
if (data.hasOwnProperty(key)) {
|
129 |
-
$var = $modalBody.find('.var-' + key);
|
130 |
-
|
131 |
-
if ($var.length > 0)
|
132 |
-
$var.html(data[key]);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
$('body').addClass('has-fs-modal');
|
137 |
-
};
|
138 |
-
|
139 |
-
function closeModal() {
|
140 |
-
$modal.removeClass('active');
|
141 |
-
|
142 |
-
$('body').removeClass('has-fs-modal');
|
143 |
-
}
|
144 |
-
|
145 |
-
function resetModal() {
|
146 |
-
hideError();
|
147 |
-
}
|
148 |
-
|
149 |
-
function hideError() {
|
150 |
-
$errorNotice.hide();
|
151 |
-
}
|
152 |
-
|
153 |
-
function setLoadingMode() {
|
154 |
-
$modal.find('.button')
|
155 |
-
// Re-enable all buttons.
|
156 |
-
.prop('disabled', trialData)
|
157 |
-
// Stop loading cursor.
|
158 |
-
.css({'cursor': 'wait'});
|
159 |
-
|
160 |
-
// Stop loading cursor.
|
161 |
-
$(document.body).css({'cursor': 'wait'});
|
162 |
-
}
|
163 |
-
|
164 |
-
function resetLoadingMode() {
|
165 |
-
$modal.find('.button')
|
166 |
-
// Re-enable all buttons.
|
167 |
-
.prop('disabled', false)
|
168 |
-
// Stop loading cursor.
|
169 |
-
.css({'cursor': 'initial'});
|
170 |
-
|
171 |
-
// Stop loading cursor.
|
172 |
-
$(document.body).css({'cursor': 'initial'});
|
173 |
-
}
|
174 |
-
|
175 |
-
function showError(msg) {
|
176 |
-
$errorNotice.find(' > p').html(msg);
|
177 |
-
$errorNotice.show();
|
178 |
-
}
|
179 |
-
});
|
180 |
-
})(jQuery);
|
181 |
-
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
*/
|
17 |
+
$fs = freemius( $VARS['id'] );
|
18 |
+
$slug = $fs->get_slug();
|
19 |
+
|
20 |
+
$message_header = sprintf(
|
21 |
+
/* translators: %1$s: Number of trial days; %2$s: Plan name; */
|
22 |
+
fs_text_inline( 'You are 1-click away from starting your %1$s-day free trial of the %2$s plan.', 'start-trial-prompt-header', $slug ),
|
23 |
+
'<span class="var-trial_period"></span>',
|
24 |
+
'<span class="var-plan_title"></span>'
|
25 |
+
);
|
26 |
+
$message_content = sprintf(
|
27 |
+
/* translators: %s: Link to freemius.com */
|
28 |
+
fs_text_inline( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt in with your user and non-sensitive site information, allowing the %s to periodically send data to %s to check for version updates and to validate your trial.', 'start-trial-prompt-message', $slug ),
|
29 |
+
$fs->get_module_type(),
|
30 |
+
sprintf(
|
31 |
+
'<a href="%s" target="_blank" rel="noopener">%s</a>',
|
32 |
+
'https://freemius.com',
|
33 |
+
'freemius.com'
|
34 |
+
)
|
35 |
+
);
|
36 |
+
|
37 |
+
$modal_content_html = <<< HTML
|
38 |
+
<div class="notice notice-error inline"><p></p></div>
|
39 |
+
<h3>{$message_header}</h3>
|
40 |
+
<p>{$message_content}</p>
|
41 |
+
HTML;
|
42 |
+
|
43 |
+
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
|
44 |
+
?>
|
45 |
+
<script type="text/javascript">
|
46 |
+
(function ($) {
|
47 |
+
$(document).ready(function () {
|
48 |
+
var modalContentHtml = <?php echo json_encode( $modal_content_html ); ?>,
|
49 |
+
modalHtml =
|
50 |
+
'<div class="fs-modal fs-modal-license-key-resend">'
|
51 |
+
+ ' <div class="fs-modal-dialog">'
|
52 |
+
+ ' <div class="fs-modal-header">'
|
53 |
+
+ ' <h4><?php echo esc_js( fs_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial', $slug ) ) ?></h4>'
|
54 |
+
+ ' </div>'
|
55 |
+
+ ' <div class="fs-modal-body">' + modalContentHtml + '</div>'
|
56 |
+
+ ' <div class="fs-modal-footer">'
|
57 |
+
+ ' <button class="button button-secondary button-close">' + <?php fs_json_encode_echo_inline( 'Cancel', 'cancel', $slug ) ?> +'</button>'
|
58 |
+
+ ' <button class="button button-primary button-connect">' + <?php fs_json_encode_echo_inline( 'Approve & Start Trial', 'approve-start-trial', $slug ) ?> +'</button>'
|
59 |
+
+ ' </div>'
|
60 |
+
+ ' </div>'
|
61 |
+
+ '</div>',
|
62 |
+
$modal = $( modalHtml ),
|
63 |
+
trialData;
|
64 |
+
|
65 |
+
$modal.appendTo($('body'));
|
66 |
+
|
67 |
+
var $errorNotice = $modal.find('.notice-error');
|
68 |
+
|
69 |
+
registerEventHandlers();
|
70 |
+
|
71 |
+
function registerEventHandlers() {
|
72 |
+
$modal.on('click', '.button-close', function () {
|
73 |
+
closeModal();
|
74 |
+
return false;
|
75 |
+
});
|
76 |
+
|
77 |
+
$modal.on('click', '.button-connect', function (evt) {
|
78 |
+
evt.preventDefault();
|
79 |
+
|
80 |
+
var $button = $(this);
|
81 |
+
|
82 |
+
$.ajax({
|
83 |
+
url : ajaxurl,
|
84 |
+
method : 'POST',
|
85 |
+
data : {
|
86 |
+
action : '<?php echo $fs->get_ajax_action( 'start_trial' ) ?>',
|
87 |
+
security : '<?php echo $fs->get_ajax_security( 'start_trial' ) ?>',
|
88 |
+
module_id: '<?php echo $fs->get_id() ?>',
|
89 |
+
trial : trialData
|
90 |
+
},
|
91 |
+
beforeSend: function () {
|
92 |
+
// Disable all buttons during trial activation.
|
93 |
+
$modal.find('.button').prop('disabled', true);
|
94 |
+
|
95 |
+
$button.text(<?php fs_json_encode_echo_inline( 'Starting trial', 'starting-trial', $slug ) ?> + '...');
|
96 |
+
|
97 |
+
setLoadingMode();
|
98 |
+
},
|
99 |
+
success : function (resultObj) {
|
100 |
+
if (resultObj.success) {
|
101 |
+
$button.text(<?php fs_json_encode_echo_inline( 'Please wait', 'please-wait', $slug ) ?> + '...');
|
102 |
+
|
103 |
+
// Redirect to the "Account" page and sync the license.
|
104 |
+
window.location.href = resultObj.data.next_page;
|
105 |
+
} else {
|
106 |
+
$button.text(<?php fs_json_encode_echo( 'approve-start-trial', $slug ) ?>);
|
107 |
+
|
108 |
+
resetLoadingMode();
|
109 |
+
showError(resultObj.error);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
});
|
113 |
+
});
|
114 |
+
}
|
115 |
+
|
116 |
+
window.openTrialConfirmationModal = function showModal(data) {
|
117 |
+
resetModal();
|
118 |
+
|
119 |
+
// Display the dialog box.
|
120 |
+
$modal.addClass('active');
|
121 |
+
|
122 |
+
trialData = data;
|
123 |
+
|
124 |
+
var $modalBody = $modal.find('.fs-modal-body'),
|
125 |
+
$var;
|
126 |
+
|
127 |
+
for (var key in data) {
|
128 |
+
if (data.hasOwnProperty(key)) {
|
129 |
+
$var = $modalBody.find('.var-' + key);
|
130 |
+
|
131 |
+
if ($var.length > 0)
|
132 |
+
$var.html(data[key]);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
$('body').addClass('has-fs-modal');
|
137 |
+
};
|
138 |
+
|
139 |
+
function closeModal() {
|
140 |
+
$modal.removeClass('active');
|
141 |
+
|
142 |
+
$('body').removeClass('has-fs-modal');
|
143 |
+
}
|
144 |
+
|
145 |
+
function resetModal() {
|
146 |
+
hideError();
|
147 |
+
}
|
148 |
+
|
149 |
+
function hideError() {
|
150 |
+
$errorNotice.hide();
|
151 |
+
}
|
152 |
+
|
153 |
+
function setLoadingMode() {
|
154 |
+
$modal.find('.button')
|
155 |
+
// Re-enable all buttons.
|
156 |
+
.prop('disabled', trialData)
|
157 |
+
// Stop loading cursor.
|
158 |
+
.css({'cursor': 'wait'});
|
159 |
+
|
160 |
+
// Stop loading cursor.
|
161 |
+
$(document.body).css({'cursor': 'wait'});
|
162 |
+
}
|
163 |
+
|
164 |
+
function resetLoadingMode() {
|
165 |
+
$modal.find('.button')
|
166 |
+
// Re-enable all buttons.
|
167 |
+
.prop('disabled', false)
|
168 |
+
// Stop loading cursor.
|
169 |
+
.css({'cursor': 'initial'});
|
170 |
+
|
171 |
+
// Stop loading cursor.
|
172 |
+
$(document.body).css({'cursor': 'initial'});
|
173 |
+
}
|
174 |
+
|
175 |
+
function showError(msg) {
|
176 |
+
$errorNotice.find(' > p').html(msg);
|
177 |
+
$errorNotice.show();
|
178 |
+
}
|
179 |
+
});
|
180 |
+
})(jQuery);
|
181 |
+
</script>
|
lib/freemius/templates/gdpr-optin-js.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.1.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
?>
|
18 |
-
<script type="text/javascript">
|
19 |
-
(function( $ ) {
|
20 |
-
$( document ).ready(function() {
|
21 |
-
var $gdprOptinNotice = $( 'div[data-id^="gdpr_optin_actions"]' );
|
22 |
-
if ( 0 === $gdprOptinNotice.length ) {
|
23 |
-
return;
|
24 |
-
}
|
25 |
-
|
26 |
-
$gdprOptinNotice.on( 'click', '.button', function() {
|
27 |
-
var
|
28 |
-
$this = $( this ),
|
29 |
-
allowMarketing = $this.hasClass( 'allow-marketing' ),
|
30 |
-
cursor = $this.css( 'cursor' ),
|
31 |
-
$products = $gdprOptinNotice.find( 'span[data-plugin-id]' ),
|
32 |
-
pluginIDs = [];
|
33 |
-
|
34 |
-
if ( $products.length > 0 ) {
|
35 |
-
$products.each(function() {
|
36 |
-
pluginIDs.push( $( this ).data( 'plugin-id' ) );
|
37 |
-
});
|
38 |
-
}
|
39 |
-
|
40 |
-
$.ajax({
|
41 |
-
url : ajaxurl + '?' + $.param({
|
42 |
-
action : '<?php echo $fs->get_ajax_action( 'gdpr_optin_action' ) ?>',
|
43 |
-
security : '<?php echo $fs->get_ajax_security( 'gdpr_optin_action' ) ?>',
|
44 |
-
module_id: '<?php echo $fs->get_id() ?>'
|
45 |
-
}),
|
46 |
-
method : 'POST',
|
47 |
-
data : {
|
48 |
-
is_marketing_allowed: allowMarketing,
|
49 |
-
plugin_ids : pluginIDs
|
50 |
-
},
|
51 |
-
beforeSend: function() {
|
52 |
-
$this.text( <?php fs_json_encode_echo_inline( 'Thanks, please wait', 'thanks-please-wait', $fs->get_slug() ) ?> + '...' );
|
53 |
-
$this.css({'cursor': 'wait'});
|
54 |
-
|
55 |
-
$gdprOptinNotice.find( '.button' ).addClass( 'disabled' );
|
56 |
-
},
|
57 |
-
complete : function() {
|
58 |
-
$this.css({'cursor': cursor});
|
59 |
-
|
60 |
-
$gdprOptinNotice.remove();
|
61 |
-
}
|
62 |
-
});
|
63 |
-
});
|
64 |
-
});
|
65 |
-
})( jQuery );
|
66 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
?>
|
18 |
+
<script type="text/javascript">
|
19 |
+
(function( $ ) {
|
20 |
+
$( document ).ready(function() {
|
21 |
+
var $gdprOptinNotice = $( 'div[data-id^="gdpr_optin_actions"]' );
|
22 |
+
if ( 0 === $gdprOptinNotice.length ) {
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
|
26 |
+
$gdprOptinNotice.on( 'click', '.button', function() {
|
27 |
+
var
|
28 |
+
$this = $( this ),
|
29 |
+
allowMarketing = $this.hasClass( 'allow-marketing' ),
|
30 |
+
cursor = $this.css( 'cursor' ),
|
31 |
+
$products = $gdprOptinNotice.find( 'span[data-plugin-id]' ),
|
32 |
+
pluginIDs = [];
|
33 |
+
|
34 |
+
if ( $products.length > 0 ) {
|
35 |
+
$products.each(function() {
|
36 |
+
pluginIDs.push( $( this ).data( 'plugin-id' ) );
|
37 |
+
});
|
38 |
+
}
|
39 |
+
|
40 |
+
$.ajax({
|
41 |
+
url : ajaxurl + '?' + $.param({
|
42 |
+
action : '<?php echo $fs->get_ajax_action( 'gdpr_optin_action' ) ?>',
|
43 |
+
security : '<?php echo $fs->get_ajax_security( 'gdpr_optin_action' ) ?>',
|
44 |
+
module_id: '<?php echo $fs->get_id() ?>'
|
45 |
+
}),
|
46 |
+
method : 'POST',
|
47 |
+
data : {
|
48 |
+
is_marketing_allowed: allowMarketing,
|
49 |
+
plugin_ids : pluginIDs
|
50 |
+
},
|
51 |
+
beforeSend: function() {
|
52 |
+
$this.text( <?php fs_json_encode_echo_inline( 'Thanks, please wait', 'thanks-please-wait', $fs->get_slug() ) ?> + '...' );
|
53 |
+
$this.css({'cursor': 'wait'});
|
54 |
+
|
55 |
+
$gdprOptinNotice.find( '.button' ).addClass( 'disabled' );
|
56 |
+
},
|
57 |
+
complete : function() {
|
58 |
+
$this.css({'cursor': cursor});
|
59 |
+
|
60 |
+
$gdprOptinNotice.remove();
|
61 |
+
}
|
62 |
+
});
|
63 |
+
});
|
64 |
+
});
|
65 |
+
})( jQuery );
|
66 |
</script>
|
lib/freemius/templates/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/js/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/js/jquery.content-change.php
CHANGED
@@ -1,58 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.2.7
|
7 |
-
*/
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
?>
|
12 |
-
<script type="text/javascript">
|
13 |
-
(function ($) {
|
14 |
-
if ($.fn.contentChange)
|
15 |
-
return;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Content change event listener.
|
19 |
-
*
|
20 |
-
* @url http://stackoverflow.com/questions/3233991/jquery-watch-div/3234646#3234646
|
21 |
-
*
|
22 |
-
* @param {function} callback
|
23 |
-
*
|
24 |
-
* @returns {object[]}
|
25 |
-
*/
|
26 |
-
$.fn.contentChange = function (callback) {
|
27 |
-
var elements = $(this);
|
28 |
-
|
29 |
-
elements.each(function () {
|
30 |
-
var element = $(this);
|
31 |
-
|
32 |
-
element.data("lastContents", element.html());
|
33 |
-
|
34 |
-
window.watchContentChange = window.watchContentChange ?
|
35 |
-
window.watchContentChange :
|
36 |
-
[];
|
37 |
-
|
38 |
-
window.watchContentChange.push({
|
39 |
-
"element" : element,
|
40 |
-
"callback": callback
|
41 |
-
});
|
42 |
-
});
|
43 |
-
|
44 |
-
return elements;
|
45 |
-
};
|
46 |
-
|
47 |
-
setInterval(function() {
|
48 |
-
if ( window.watchContentChange ) {
|
49 |
-
for ( var i in window.watchContentChange ) {
|
50 |
-
if ( window.watchContentChange[ i ].element.data( 'lastContents' ) !== window.watchContentChange[ i ].element.html() ) {
|
51 |
-
window.watchContentChange[ i ].callback.apply( undefined, [ false ] );
|
52 |
-
window.watchContentChange[ i ].element.data( 'lastContents', window.watchContentChange[ i ].element.html() )
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
}, 500 );
|
57 |
-
})(jQuery);
|
58 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.2.7
|
7 |
+
*/
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
(function ($) {
|
14 |
+
if ($.fn.contentChange)
|
15 |
+
return;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Content change event listener.
|
19 |
+
*
|
20 |
+
* @url http://stackoverflow.com/questions/3233991/jquery-watch-div/3234646#3234646
|
21 |
+
*
|
22 |
+
* @param {function} callback
|
23 |
+
*
|
24 |
+
* @returns {object[]}
|
25 |
+
*/
|
26 |
+
$.fn.contentChange = function (callback) {
|
27 |
+
var elements = $(this);
|
28 |
+
|
29 |
+
elements.each(function () {
|
30 |
+
var element = $(this);
|
31 |
+
|
32 |
+
element.data("lastContents", element.html());
|
33 |
+
|
34 |
+
window.watchContentChange = window.watchContentChange ?
|
35 |
+
window.watchContentChange :
|
36 |
+
[];
|
37 |
+
|
38 |
+
window.watchContentChange.push({
|
39 |
+
"element" : element,
|
40 |
+
"callback": callback
|
41 |
+
});
|
42 |
+
});
|
43 |
+
|
44 |
+
return elements;
|
45 |
+
};
|
46 |
+
|
47 |
+
setInterval(function() {
|
48 |
+
if ( window.watchContentChange ) {
|
49 |
+
for ( var i in window.watchContentChange ) {
|
50 |
+
if ( window.watchContentChange[ i ].element.data( 'lastContents' ) !== window.watchContentChange[ i ].element.html() ) {
|
51 |
+
window.watchContentChange[ i ].callback.apply( undefined, [ false ] );
|
52 |
+
window.watchContentChange[ i ].element.data( 'lastContents', window.watchContentChange[ i ].element.html() )
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}, 500 );
|
57 |
+
})(jQuery);
|
58 |
</script>
|
lib/freemius/templates/js/open-license-activation.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 2.0.0
|
7 |
-
*/
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
-
$license_id = $VARS['license_id'];
|
13 |
-
?>
|
14 |
-
<script type="text/javascript">
|
15 |
-
(function ($) {
|
16 |
-
var prepareLicenseActivationDialog = function () {
|
17 |
-
var $dialog = $('.fs-modal-license-activation');
|
18 |
-
|
19 |
-
// Trigger the license activation dialog box.
|
20 |
-
$($('.activate-license-trigger')[0]).click();
|
21 |
-
|
22 |
-
// setTimeout(function(){
|
23 |
-
$dialog.find('select.fs-licenses option[data-id=<?php echo $license_id ?>]')
|
24 |
-
.prop('selected', true)
|
25 |
-
.change();
|
26 |
-
// }, 100);
|
27 |
-
|
28 |
-
};
|
29 |
-
if ($('.fs-modal-license-activation').length > 0) {
|
30 |
-
prepareLicenseActivationDialog();
|
31 |
-
} else {
|
32 |
-
$('body').on('licenseActivationLoaded', function () {
|
33 |
-
prepareLicenseActivationDialog();
|
34 |
-
});
|
35 |
-
}
|
36 |
-
})(jQuery);
|
37 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 2.0.0
|
7 |
+
*/
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
$license_id = $VARS['license_id'];
|
13 |
+
?>
|
14 |
+
<script type="text/javascript">
|
15 |
+
(function ($) {
|
16 |
+
var prepareLicenseActivationDialog = function () {
|
17 |
+
var $dialog = $('.fs-modal-license-activation');
|
18 |
+
|
19 |
+
// Trigger the license activation dialog box.
|
20 |
+
$($('.activate-license-trigger')[0]).click();
|
21 |
+
|
22 |
+
// setTimeout(function(){
|
23 |
+
$dialog.find('select.fs-licenses option[data-id=<?php echo $license_id ?>]')
|
24 |
+
.prop('selected', true)
|
25 |
+
.change();
|
26 |
+
// }, 100);
|
27 |
+
|
28 |
+
};
|
29 |
+
if ($('.fs-modal-license-activation').length > 0) {
|
30 |
+
prepareLicenseActivationDialog();
|
31 |
+
} else {
|
32 |
+
$('body').on('licenseActivationLoaded', function () {
|
33 |
+
prepareLicenseActivationDialog();
|
34 |
+
});
|
35 |
+
}
|
36 |
+
})(jQuery);
|
37 |
</script>
|
lib/freemius/templates/js/style-premium-theme.php
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.2.7
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @var array $VARS
|
16 |
-
* @var Freemius $fs
|
17 |
-
*/
|
18 |
-
$fs = freemius( $VARS['id'] );
|
19 |
-
|
20 |
-
$slug = $fs->get_slug();
|
21 |
-
|
22 |
-
?>
|
23 |
-
<script type="text/javascript">
|
24 |
-
(function ($) {
|
25 |
-
// Select the premium theme version.
|
26 |
-
var $theme = $('#<?php echo $slug ?>-premium-name').parents('.theme'),
|
27 |
-
addPremiumMetadata = function (firstCall) {
|
28 |
-
if (!firstCall) {
|
29 |
-
// Seems like the original theme element is removed from the DOM,
|
30 |
-
// so we need to reselect the updated one.
|
31 |
-
$theme = $('#<?php echo $slug ?>-premium-name').parents('.theme');
|
32 |
-
}
|
33 |
-
|
34 |
-
if (0 === $theme.find('.fs-premium-theme-badge-container').length) {
|
35 |
-
$theme.addClass('fs-premium');
|
36 |
-
|
37 |
-
var $themeBadgeContainer = $( '<div class="fs-premium-theme-badge-container"></div>' );
|
38 |
-
|
39 |
-
$themeBadgeContainer.append( '<div class="fs-badge fs-premium-theme-badge">' + <?php echo json_encode( $fs->get_text_inline( 'Premium', 'premium' ) ) ?> + '</div>' );
|
40 |
-
|
41 |
-
<?php if ( $fs->is_beta() ) : ?>
|
42 |
-
$themeBadgeContainer.append( '<div class="fs-badge fs-beta-theme-badge">' + <?php echo json_encode( $fs->get_text_inline( 'Beta', 'beta' ) ) ?> + '</div>' );
|
43 |
-
<?php endif ?>
|
44 |
-
|
45 |
-
$theme.append( $themeBadgeContainer );
|
46 |
-
}
|
47 |
-
};
|
48 |
-
|
49 |
-
addPremiumMetadata(true);
|
50 |
-
|
51 |
-
$theme.contentChange(addPremiumMetadata);
|
52 |
-
})(jQuery);
|
53 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.2.7
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var array $VARS
|
16 |
+
* @var Freemius $fs
|
17 |
+
*/
|
18 |
+
$fs = freemius( $VARS['id'] );
|
19 |
+
|
20 |
+
$slug = $fs->get_slug();
|
21 |
+
|
22 |
+
?>
|
23 |
+
<script type="text/javascript">
|
24 |
+
(function ($) {
|
25 |
+
// Select the premium theme version.
|
26 |
+
var $theme = $('#<?php echo $slug ?>-premium-name').parents('.theme'),
|
27 |
+
addPremiumMetadata = function (firstCall) {
|
28 |
+
if (!firstCall) {
|
29 |
+
// Seems like the original theme element is removed from the DOM,
|
30 |
+
// so we need to reselect the updated one.
|
31 |
+
$theme = $('#<?php echo $slug ?>-premium-name').parents('.theme');
|
32 |
+
}
|
33 |
+
|
34 |
+
if (0 === $theme.find('.fs-premium-theme-badge-container').length) {
|
35 |
+
$theme.addClass('fs-premium');
|
36 |
+
|
37 |
+
var $themeBadgeContainer = $( '<div class="fs-premium-theme-badge-container"></div>' );
|
38 |
+
|
39 |
+
$themeBadgeContainer.append( '<div class="fs-badge fs-premium-theme-badge">' + <?php echo json_encode( $fs->get_text_inline( 'Premium', 'premium' ) ) ?> + '</div>' );
|
40 |
+
|
41 |
+
<?php if ( $fs->is_beta() ) : ?>
|
42 |
+
$themeBadgeContainer.append( '<div class="fs-badge fs-beta-theme-badge">' + <?php echo json_encode( $fs->get_text_inline( 'Beta', 'beta' ) ) ?> + '</div>' );
|
43 |
+
<?php endif ?>
|
44 |
+
|
45 |
+
$theme.append( $themeBadgeContainer );
|
46 |
+
}
|
47 |
+
};
|
48 |
+
|
49 |
+
addPremiumMetadata(true);
|
50 |
+
|
51 |
+
$theme.contentChange(addPremiumMetadata);
|
52 |
+
})(jQuery);
|
53 |
</script>
|
lib/freemius/templates/partials/index.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<?php
|
2 |
-
//Silence is golden
|
1 |
+
<?php
|
2 |
+
//Silence is golden
|
lib/freemius/templates/partials/network-activation.php
CHANGED
@@ -1,94 +1,94 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @var array $VARS
|
9 |
-
* @var Freemius $fs
|
10 |
-
*/
|
11 |
-
$fs = freemius( $VARS['id'] );
|
12 |
-
|
13 |
-
$slug = $fs->get_slug();
|
14 |
-
|
15 |
-
$sites = $VARS['sites'];
|
16 |
-
$require_license_key = $VARS['require_license_key'];
|
17 |
-
|
18 |
-
$show_delegation_option = $fs->apply_filters( 'show_delegation_option', true );
|
19 |
-
$enable_per_site_activation = $fs->apply_filters( 'enable_per_site_activation', true );
|
20 |
-
?>
|
21 |
-
<?php $separator = '<td>|</td>' ?>
|
22 |
-
<div class="fs-multisite-options-container fs-apply-on-all-sites"<?php if ( ! $enable_per_site_activation )
|
23 |
-
echo ' style="display: none;"' ?>>
|
24 |
-
<table class="fs-all-sites-options">
|
25 |
-
<tbody>
|
26 |
-
<tr>
|
27 |
-
<td width="600">
|
28 |
-
<label>
|
29 |
-
<?php
|
30 |
-
if ( ! $fs->is_network_upgrade_mode() ) {
|
31 |
-
$apply_checkbox_label = $require_license_key ?
|
32 |
-
fs_text_inline( 'Activate license on all sites in the network.', 'activate-license-on-all-sites-in-the-network', $slug ) :
|
33 |
-
fs_text_inline( 'Apply on all sites in the network.', 'apply-on-all-sites-in-the-network', $slug );
|
34 |
-
} else {
|
35 |
-
$apply_checkbox_label = $require_license_key ?
|
36 |
-
fs_text_inline( 'Activate license on all pending sites.', 'activate-license-on-pending-sites-in-the-network', $slug ) :
|
37 |
-
fs_text_inline( 'Apply on all pending sites.', 'apply-on-pending-sites-in-the-network', $slug );
|
38 |
-
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
<input class="fs-apply-on-all-sites-checkbox" type="checkbox" value="true" checked><span><?php echo esc_html( $apply_checkbox_label ) ?></span>
|
42 |
-
</label>
|
43 |
-
</td>
|
44 |
-
<?php if ( ! $require_license_key ) : ?>
|
45 |
-
<td><a class="action action-allow" data-action-type="allow" href="#"><?php fs_esc_html_echo_inline( 'allow', 'allow', $slug ) ?></a></td>
|
46 |
-
<?php echo $separator ?>
|
47 |
-
<?php if ( $show_delegation_option ) : ?>
|
48 |
-
<td><a class="action action-delegate" data-action-type="delegate" href="#"><?php fs_esc_html_echo_inline( 'delegate', 'delegate', $slug ) ?></a></td>
|
49 |
-
<?php endif ?>
|
50 |
-
<?php if ( $fs->is_enable_anonymous() ) : ?>
|
51 |
-
<?php echo $separator ?>
|
52 |
-
<td><a class="action action-skip" data-action-type="skip" href="#"><?php echo strtolower( fs_esc_html_inline( 'skip', 'skip', $slug ) ) ?></a></td>
|
53 |
-
<?php endif ?>
|
54 |
-
<?php endif ?>
|
55 |
-
</tr>
|
56 |
-
</tbody>
|
57 |
-
</table>
|
58 |
-
<div class="fs-sites-list-container">
|
59 |
-
<table cellspacing="0">
|
60 |
-
<tbody>
|
61 |
-
<?php $site_props = array('uid', 'url', 'title', 'charset', 'language') ?>
|
62 |
-
<?php foreach ( $sites as $site ) : ?>
|
63 |
-
<tr<?php if ( ! empty( $site['license_id'] ) ) {
|
64 |
-
echo ' data-license-id="' . $site['license_id'] . '"';
|
65 |
-
} ?>>
|
66 |
-
<?php if ( $require_license_key ) : ?>
|
67 |
-
<td><input type="checkbox" value="true" /></td>
|
68 |
-
<?php endif ?>
|
69 |
-
<td class="blog-id"><span><?php echo $site['blog_id'] ?></span>.</td>
|
70 |
-
<td width="600"><span><?php
|
71 |
-
$url = str_replace( 'http://', '', str_replace( 'https://', '', $site['url'] ) );
|
72 |
-
echo $url;
|
73 |
-
?></span>
|
74 |
-
<?php foreach ($site_props as $prop) : ?>
|
75 |
-
<input class="<?php echo $prop ?>" type="hidden" value="<?php echo esc_attr($site[$prop]) ?>" />
|
76 |
-
<?php endforeach ?>
|
77 |
-
</td>
|
78 |
-
<?php if ( ! $require_license_key ) : ?>
|
79 |
-
<td><a class="action action-allow selected" data-action-type="allow" href="#"><?php fs_esc_html_echo_inline( 'allow', 'allow', $slug ) ?></a></td>
|
80 |
-
<?php echo $separator ?>
|
81 |
-
<?php if ( $show_delegation_option ) : ?>
|
82 |
-
<td><a class="action action-delegate" data-action-type="delegate" href="#"><?php fs_esc_html_echo_inline( 'delegate', 'delegate', $slug ) ?></a></td>
|
83 |
-
<?php endif ?>
|
84 |
-
<?php if ( $fs->is_enable_anonymous() ) : ?>
|
85 |
-
<?php echo $separator ?>
|
86 |
-
<td><a class="action action-skip" data-action-type="skip" href="#"><?php echo strtolower( fs_esc_html_inline( 'skip', 'skip', $slug ) ) ?></a></td>
|
87 |
-
<?php endif ?>
|
88 |
-
<?php endif ?>
|
89 |
-
</tr>
|
90 |
-
<?php endforeach ?>
|
91 |
-
</tbody>
|
92 |
-
</table>
|
93 |
-
</div>
|
94 |
-
</div>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @var array $VARS
|
9 |
+
* @var Freemius $fs
|
10 |
+
*/
|
11 |
+
$fs = freemius( $VARS['id'] );
|
12 |
+
|
13 |
+
$slug = $fs->get_slug();
|
14 |
+
|
15 |
+
$sites = $VARS['sites'];
|
16 |
+
$require_license_key = $VARS['require_license_key'];
|
17 |
+
|
18 |
+
$show_delegation_option = $fs->apply_filters( 'show_delegation_option', true );
|
19 |
+
$enable_per_site_activation = $fs->apply_filters( 'enable_per_site_activation', true );
|
20 |
+
?>
|
21 |
+
<?php $separator = '<td>|</td>' ?>
|
22 |
+
<div class="fs-multisite-options-container fs-apply-on-all-sites"<?php if ( ! $enable_per_site_activation )
|
23 |
+
echo ' style="display: none;"' ?>>
|
24 |
+
<table class="fs-all-sites-options">
|
25 |
+
<tbody>
|
26 |
+
<tr>
|
27 |
+
<td width="600">
|
28 |
+
<label>
|
29 |
+
<?php
|
30 |
+
if ( ! $fs->is_network_upgrade_mode() ) {
|
31 |
+
$apply_checkbox_label = $require_license_key ?
|
32 |
+
fs_text_inline( 'Activate license on all sites in the network.', 'activate-license-on-all-sites-in-the-network', $slug ) :
|
33 |
+
fs_text_inline( 'Apply on all sites in the network.', 'apply-on-all-sites-in-the-network', $slug );
|
34 |
+
} else {
|
35 |
+
$apply_checkbox_label = $require_license_key ?
|
36 |
+
fs_text_inline( 'Activate license on all pending sites.', 'activate-license-on-pending-sites-in-the-network', $slug ) :
|
37 |
+
fs_text_inline( 'Apply on all pending sites.', 'apply-on-pending-sites-in-the-network', $slug );
|
38 |
+
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
<input class="fs-apply-on-all-sites-checkbox" type="checkbox" value="true" checked><span><?php echo esc_html( $apply_checkbox_label ) ?></span>
|
42 |
+
</label>
|
43 |
+
</td>
|
44 |
+
<?php if ( ! $require_license_key ) : ?>
|
45 |
+
<td><a class="action action-allow" data-action-type="allow" href="#"><?php fs_esc_html_echo_inline( 'allow', 'allow', $slug ) ?></a></td>
|
46 |
+
<?php echo $separator ?>
|
47 |
+
<?php if ( $show_delegation_option ) : ?>
|
48 |
+
<td><a class="action action-delegate" data-action-type="delegate" href="#"><?php fs_esc_html_echo_inline( 'delegate', 'delegate', $slug ) ?></a></td>
|
49 |
+
<?php endif ?>
|
50 |
+
<?php if ( $fs->is_enable_anonymous() ) : ?>
|
51 |
+
<?php echo $separator ?>
|
52 |
+
<td><a class="action action-skip" data-action-type="skip" href="#"><?php echo strtolower( fs_esc_html_inline( 'skip', 'skip', $slug ) ) ?></a></td>
|
53 |
+
<?php endif ?>
|
54 |
+
<?php endif ?>
|
55 |
+
</tr>
|
56 |
+
</tbody>
|
57 |
+
</table>
|
58 |
+
<div class="fs-sites-list-container">
|
59 |
+
<table cellspacing="0">
|
60 |
+
<tbody>
|
61 |
+
<?php $site_props = array('uid', 'url', 'title', 'charset', 'language') ?>
|
62 |
+
<?php foreach ( $sites as $site ) : ?>
|
63 |
+
<tr<?php if ( ! empty( $site['license_id'] ) ) {
|
64 |
+
echo ' data-license-id="' . $site['license_id'] . '"';
|
65 |
+
} ?>>
|
66 |
+
<?php if ( $require_license_key ) : ?>
|
67 |
+
<td><input type="checkbox" value="true" /></td>
|
68 |
+
<?php endif ?>
|
69 |
+
<td class="blog-id"><span><?php echo $site['blog_id'] ?></span>.</td>
|
70 |
+
<td width="600"><span><?php
|
71 |
+
$url = str_replace( 'http://', '', str_replace( 'https://', '', $site['url'] ) );
|
72 |
+
echo $url;
|
73 |
+
?></span>
|
74 |
+
<?php foreach ($site_props as $prop) : ?>
|
75 |
+
<input class="<?php echo $prop ?>" type="hidden" value="<?php echo esc_attr($site[$prop]) ?>" />
|
76 |
+
<?php endforeach ?>
|
77 |
+
</td>
|
78 |
+
<?php if ( ! $require_license_key ) : ?>
|
79 |
+
<td><a class="action action-allow selected" data-action-type="allow" href="#"><?php fs_esc_html_echo_inline( 'allow', 'allow', $slug ) ?></a></td>
|
80 |
+
<?php echo $separator ?>
|
81 |
+
<?php if ( $show_delegation_option ) : ?>
|
82 |
+
<td><a class="action action-delegate" data-action-type="delegate" href="#"><?php fs_esc_html_echo_inline( 'delegate', 'delegate', $slug ) ?></a></td>
|
83 |
+
<?php endif ?>
|
84 |
+
<?php if ( $fs->is_enable_anonymous() ) : ?>
|
85 |
+
<?php echo $separator ?>
|
86 |
+
<td><a class="action action-skip" data-action-type="skip" href="#"><?php echo strtolower( fs_esc_html_inline( 'skip', 'skip', $slug ) ) ?></a></td>
|
87 |
+
<?php endif ?>
|
88 |
+
<?php endif ?>
|
89 |
+
</tr>
|
90 |
+
<?php endforeach ?>
|
91 |
+
</tbody>
|
92 |
+
</table>
|
93 |
+
</div>
|
94 |
+
</div>
|
lib/freemius/templates/plugin-icon.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.4
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*/
|
16 |
-
$fs = freemius( $VARS['id'] );
|
17 |
-
?>
|
18 |
-
<div class="fs-plugin-icon">
|
19 |
-
<img src="<?php echo $fs->get_local_icon_url() ?>" width="80" height="80"/>
|
20 |
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.4
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*/
|
16 |
+
$fs = freemius( $VARS['id'] );
|
17 |
+
?>
|
18 |
+
<div class="fs-plugin-icon">
|
19 |
+
<img src="<?php echo $fs->get_local_icon_url() ?>" width="80" height="80"/>
|
20 |
</div>
|
lib/freemius/templates/plugin-info/description.php
CHANGED
@@ -1,78 +1,78 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*
|
16 |
-
* @var FS_Plugin $plugin
|
17 |
-
*/
|
18 |
-
$plugin = $VARS['plugin'];
|
19 |
-
|
20 |
-
if ( ! empty( $plugin->info->selling_point_0 ) ||
|
21 |
-
! empty( $plugin->info->selling_point_1 ) ||
|
22 |
-
! empty( $plugin->info->selling_point_2 )
|
23 |
-
) : ?>
|
24 |
-
<div class="fs-selling-points">
|
25 |
-
<ul>
|
26 |
-
<?php for ( $i = 0; $i < 3; $i ++ ) : ?>
|
27 |
-
<?php if ( ! empty( $plugin->info->{'selling_point_' . $i} ) ) : ?>
|
28 |
-
<li><i class="dashicons dashicons-yes"></i>
|
29 |
-
|
30 |
-
<h3><?php echo esc_html( $plugin->info->{'selling_point_' . $i} ) ?></h3></li>
|
31 |
-
<?php endif ?>
|
32 |
-
<?php endfor ?>
|
33 |
-
</ul>
|
34 |
-
</div>
|
35 |
-
<?php endif ?>
|
36 |
-
<div>
|
37 |
-
<?php
|
38 |
-
echo wp_kses( $plugin->info->description, array(
|
39 |
-
'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
|
40 |
-
'b' => array(),
|
41 |
-
'i' => array(),
|
42 |
-
'p' => array(),
|
43 |
-
'blockquote' => array(),
|
44 |
-
'h2' => array(),
|
45 |
-
'h3' => array(),
|
46 |
-
'ul' => array(),
|
47 |
-
'ol' => array(),
|
48 |
-
'li' => array()
|
49 |
-
) );
|
50 |
-
?>
|
51 |
-
</div>
|
52 |
-
<?php if ( ! empty( $plugin->info->screenshots ) ) : ?>
|
53 |
-
<?php $screenshots = $plugin->info->screenshots ?>
|
54 |
-
<div class="fs-screenshots clearfix">
|
55 |
-
<h2><?php fs_esc_html_echo_inline( 'Screenshots', 'screenshots', $plugin->slug ) ?></h2>
|
56 |
-
<ul>
|
57 |
-
<?php $i = 0;
|
58 |
-
foreach ( $screenshots as $s => $url ) : ?>
|
59 |
-
<?php
|
60 |
-
// Relative URLs are replaced with WordPress.org base URL
|
61 |
-
// therefore we need to set absolute URLs.
|
62 |
-
$url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url;
|
63 |
-
?>
|
64 |
-
<li class="<?php echo ( 0 === $i % 2 ) ? 'odd' : 'even' ?>">
|
65 |
-
<style>
|
66 |
-
#section-description .fs-screenshots <?php echo ".fs-screenshot-{$i}" ?>
|
67 |
-
{
|
68 |
-
background-image: url('<?php echo $url ?>');
|
69 |
-
}
|
70 |
-
</style>
|
71 |
-
<a href="<?php echo $url ?>"
|
72 |
-
title="<?php echo esc_attr( sprintf( fs_text_inline( 'Click to view full-size screenshot %d', 'view-full-size-x', $plugin->slug ), $i ) ) ?>"
|
73 |
-
class="fs-screenshot-<?php echo $i ?>"></a>
|
74 |
-
</li>
|
75 |
-
<?php $i ++; endforeach ?>
|
76 |
-
</ul>
|
77 |
-
</div>
|
78 |
<?php endif ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*
|
16 |
+
* @var FS_Plugin $plugin
|
17 |
+
*/
|
18 |
+
$plugin = $VARS['plugin'];
|
19 |
+
|
20 |
+
if ( ! empty( $plugin->info->selling_point_0 ) ||
|
21 |
+
! empty( $plugin->info->selling_point_1 ) ||
|
22 |
+
! empty( $plugin->info->selling_point_2 )
|
23 |
+
) : ?>
|
24 |
+
<div class="fs-selling-points">
|
25 |
+
<ul>
|
26 |
+
<?php for ( $i = 0; $i < 3; $i ++ ) : ?>
|
27 |
+
<?php if ( ! empty( $plugin->info->{'selling_point_' . $i} ) ) : ?>
|
28 |
+
<li><i class="dashicons dashicons-yes"></i>
|
29 |
+
|
30 |
+
<h3><?php echo esc_html( $plugin->info->{'selling_point_' . $i} ) ?></h3></li>
|
31 |
+
<?php endif ?>
|
32 |
+
<?php endfor ?>
|
33 |
+
</ul>
|
34 |
+
</div>
|
35 |
+
<?php endif ?>
|
36 |
+
<div>
|
37 |
+
<?php
|
38 |
+
echo wp_kses( $plugin->info->description, array(
|
39 |
+
'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
|
40 |
+
'b' => array(),
|
41 |
+
'i' => array(),
|
42 |
+
'p' => array(),
|
43 |
+
'blockquote' => array(),
|
44 |
+
'h2' => array(),
|
45 |
+
'h3' => array(),
|
46 |
+
'ul' => array(),
|
47 |
+
'ol' => array(),
|
48 |
+
'li' => array()
|
49 |
+
) );
|
50 |
+
?>
|
51 |
+
</div>
|
52 |
+
<?php if ( ! empty( $plugin->info->screenshots ) ) : ?>
|
53 |
+
<?php $screenshots = $plugin->info->screenshots ?>
|
54 |
+
<div class="fs-screenshots clearfix">
|
55 |
+
<h2><?php fs_esc_html_echo_inline( 'Screenshots', 'screenshots', $plugin->slug ) ?></h2>
|
56 |
+
<ul>
|
57 |
+
<?php $i = 0;
|
58 |
+
foreach ( $screenshots as $s => $url ) : ?>
|
59 |
+
<?php
|
60 |
+
// Relative URLs are replaced with WordPress.org base URL
|
61 |
+
// therefore we need to set absolute URLs.
|
62 |
+
$url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url;
|
63 |
+
?>
|
64 |
+
<li class="<?php echo ( 0 === $i % 2 ) ? 'odd' : 'even' ?>">
|
65 |
+
<style>
|
66 |
+
#section-description .fs-screenshots <?php echo ".fs-screenshot-{$i}" ?>
|
67 |
+
{
|
68 |
+
background-image: url('<?php echo $url ?>');
|
69 |
+
}
|
70 |
+
</style>
|
71 |
+
<a href="<?php echo $url ?>"
|
72 |
+
title="<?php echo esc_attr( sprintf( fs_text_inline( 'Click to view full-size screenshot %d', 'view-full-size-x', $plugin->slug ), $i ) ) ?>"
|
73 |
+
class="fs-screenshot-<?php echo $i ?>"></a>
|
74 |
+
</li>
|
75 |
+
<?php $i ++; endforeach ?>
|
76 |
+
</ul>
|
77 |
+
</div>
|
78 |
<?php endif ?>
|
lib/freemius/templates/plugin-info/features.php
CHANGED
@@ -1,114 +1,114 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*
|
16 |
-
* @var FS_Plugin $plugin
|
17 |
-
*/
|
18 |
-
$plugin = $VARS['plugin'];
|
19 |
-
|
20 |
-
$plans = $VARS['plans'];
|
21 |
-
|
22 |
-
$features_plan_map = array();
|
23 |
-
foreach ( $plans as $plan ) {
|
24 |
-
if (!empty($plan->features) && is_array($plan->features)) {
|
25 |
-
foreach ( $plan->features as $feature ) {
|
26 |
-
if ( ! isset( $features_plan_map[ $feature->id ] ) ) {
|
27 |
-
$features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() );
|
28 |
-
}
|
29 |
-
|
30 |
-
$features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
// Add support as a feature.
|
35 |
-
if ( ! empty( $plan->support_email ) ||
|
36 |
-
! empty( $plan->support_skype ) ||
|
37 |
-
! empty( $plan->support_phone ) ||
|
38 |
-
true === $plan->is_success_manager
|
39 |
-
) {
|
40 |
-
if ( ! isset( $features_plan_map['support'] ) ) {
|
41 |
-
$support_feature = new stdClass();
|
42 |
-
$support_feature->id = 'support';
|
43 |
-
$support_feature->title = fs_text_inline( 'Support', $plugin->slug );
|
44 |
-
$features_plan_map[ $support_feature->id ] = array( 'feature' => $support_feature, 'plans' => array() );
|
45 |
-
} else {
|
46 |
-
$support_feature = $features_plan_map['support']['feature'];
|
47 |
-
}
|
48 |
-
|
49 |
-
$features_plan_map[ $support_feature->id ]['plans'][ $plan->id ] = $support_feature;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
// Add updates as a feature for all plans.
|
54 |
-
$updates_feature = new stdClass();
|
55 |
-
$updates_feature->id = 'updates';
|
56 |
-
$updates_feature->title = fs_text_inline( 'Unlimited Updates', 'unlimited-updates', $plugin->slug );
|
57 |
-
$features_plan_map[ $updates_feature->id ] = array( 'feature' => $updates_feature, 'plans' => array() );
|
58 |
-
foreach ( $plans as $plan ) {
|
59 |
-
$features_plan_map[ $updates_feature->id ]['plans'][ $plan->id ] = $updates_feature;
|
60 |
-
}
|
61 |
-
?>
|
62 |
-
<div class="fs-features">
|
63 |
-
<table>
|
64 |
-
<thead>
|
65 |
-
<tr>
|
66 |
-
<th></th>
|
67 |
-
<?php foreach ( $plans as $plan ) : ?>
|
68 |
-
<th>
|
69 |
-
<?php echo $plan->title ?>
|
70 |
-
<span class="fs-price"><?php
|
71 |
-
if ( empty( $plan->pricing ) ) {
|
72 |
-
fs_esc_html_echo_inline( 'Free', 'free', $plugin->slug );
|
73 |
-
} else {
|
74 |
-
foreach ( $plan->pricing as $pricing ) {
|
75 |
-
/**
|
76 |
-
* @var FS_Pricing $pricing
|
77 |
-
*/
|
78 |
-
if ( 1 == $pricing->licenses ) {
|
79 |
-
if ( $pricing->has_annual() ) {
|
80 |
-
echo "\${$pricing->annual_price} / " . fs_esc_html_x_inline( 'year', 'as annual period', 'year', $plugin->slug );
|
81 |
-
} else if ( $pricing->has_monthly() ) {
|
82 |
-
echo "\${$pricing->monthly_price} / " . fs_esc_html_x_inline( 'mo', 'as monthly period', 'mo', $plugin->slug );
|
83 |
-
} else {
|
84 |
-
echo "\${$pricing->lifetime_price}";
|
85 |
-
}
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
?></span>
|
90 |
-
</th>
|
91 |
-
<?php endforeach ?>
|
92 |
-
</tr>
|
93 |
-
</thead>
|
94 |
-
<tbody>
|
95 |
-
<?php $odd = true;
|
96 |
-
foreach ( $features_plan_map as $feature_id => $data ) : ?>
|
97 |
-
<tr class="fs-<?php echo $odd ? 'odd' : 'even' ?>">
|
98 |
-
<td><?php echo esc_html( ucfirst( $data['feature']->title ) ) ?></td>
|
99 |
-
<?php foreach ( $plans as $plan ) : ?>
|
100 |
-
<td>
|
101 |
-
<?php if ( isset( $data['plans'][ $plan->id ] ) ) : ?>
|
102 |
-
<?php if ( ! empty( $data['plans'][ $plan->id ]->value ) ) : ?>
|
103 |
-
<b><?php echo esc_html( $data['plans'][ $plan->id ]->value ) ?></b>
|
104 |
-
<?php else : ?>
|
105 |
-
<i class="dashicons dashicons-yes"></i>
|
106 |
-
<?php endif ?>
|
107 |
-
<?php endif ?>
|
108 |
-
</td>
|
109 |
-
<?php endforeach ?>
|
110 |
-
</tr>
|
111 |
-
<?php $odd = ! $odd; endforeach ?>
|
112 |
-
</tbody>
|
113 |
-
</table>
|
114 |
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*
|
16 |
+
* @var FS_Plugin $plugin
|
17 |
+
*/
|
18 |
+
$plugin = $VARS['plugin'];
|
19 |
+
|
20 |
+
$plans = $VARS['plans'];
|
21 |
+
|
22 |
+
$features_plan_map = array();
|
23 |
+
foreach ( $plans as $plan ) {
|
24 |
+
if (!empty($plan->features) && is_array($plan->features)) {
|
25 |
+
foreach ( $plan->features as $feature ) {
|
26 |
+
if ( ! isset( $features_plan_map[ $feature->id ] ) ) {
|
27 |
+
$features_plan_map[ $feature->id ] = array( 'feature' => $feature, 'plans' => array() );
|
28 |
+
}
|
29 |
+
|
30 |
+
$features_plan_map[ $feature->id ]['plans'][ $plan->id ] = $feature;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
// Add support as a feature.
|
35 |
+
if ( ! empty( $plan->support_email ) ||
|
36 |
+
! empty( $plan->support_skype ) ||
|
37 |
+
! empty( $plan->support_phone ) ||
|
38 |
+
true === $plan->is_success_manager
|
39 |
+
) {
|
40 |
+
if ( ! isset( $features_plan_map['support'] ) ) {
|
41 |
+
$support_feature = new stdClass();
|
42 |
+
$support_feature->id = 'support';
|
43 |
+
$support_feature->title = fs_text_inline( 'Support', $plugin->slug );
|
44 |
+
$features_plan_map[ $support_feature->id ] = array( 'feature' => $support_feature, 'plans' => array() );
|
45 |
+
} else {
|
46 |
+
$support_feature = $features_plan_map['support']['feature'];
|
47 |
+
}
|
48 |
+
|
49 |
+
$features_plan_map[ $support_feature->id ]['plans'][ $plan->id ] = $support_feature;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
// Add updates as a feature for all plans.
|
54 |
+
$updates_feature = new stdClass();
|
55 |
+
$updates_feature->id = 'updates';
|
56 |
+
$updates_feature->title = fs_text_inline( 'Unlimited Updates', 'unlimited-updates', $plugin->slug );
|
57 |
+
$features_plan_map[ $updates_feature->id ] = array( 'feature' => $updates_feature, 'plans' => array() );
|
58 |
+
foreach ( $plans as $plan ) {
|
59 |
+
$features_plan_map[ $updates_feature->id ]['plans'][ $plan->id ] = $updates_feature;
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
<div class="fs-features">
|
63 |
+
<table>
|
64 |
+
<thead>
|
65 |
+
<tr>
|
66 |
+
<th></th>
|
67 |
+
<?php foreach ( $plans as $plan ) : ?>
|
68 |
+
<th>
|
69 |
+
<?php echo $plan->title ?>
|
70 |
+
<span class="fs-price"><?php
|
71 |
+
if ( empty( $plan->pricing ) ) {
|
72 |
+
fs_esc_html_echo_inline( 'Free', 'free', $plugin->slug );
|
73 |
+
} else {
|
74 |
+
foreach ( $plan->pricing as $pricing ) {
|
75 |
+
/**
|
76 |
+
* @var FS_Pricing $pricing
|
77 |
+
*/
|
78 |
+
if ( 1 == $pricing->licenses ) {
|
79 |
+
if ( $pricing->has_annual() ) {
|
80 |
+
echo "\${$pricing->annual_price} / " . fs_esc_html_x_inline( 'year', 'as annual period', 'year', $plugin->slug );
|
81 |
+
} else if ( $pricing->has_monthly() ) {
|
82 |
+
echo "\${$pricing->monthly_price} / " . fs_esc_html_x_inline( 'mo', 'as monthly period', 'mo', $plugin->slug );
|
83 |
+
} else {
|
84 |
+
echo "\${$pricing->lifetime_price}";
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
?></span>
|
90 |
+
</th>
|
91 |
+
<?php endforeach ?>
|
92 |
+
</tr>
|
93 |
+
</thead>
|
94 |
+
<tbody>
|
95 |
+
<?php $odd = true;
|
96 |
+
foreach ( $features_plan_map as $feature_id => $data ) : ?>
|
97 |
+
<tr class="fs-<?php echo $odd ? 'odd' : 'even' ?>">
|
98 |
+
<td><?php echo esc_html( ucfirst( $data['feature']->title ) ) ?></td>
|
99 |
+
<?php foreach ( $plans as $plan ) : ?>
|
100 |
+
<td>
|
101 |
+
<?php if ( isset( $data['plans'][ $plan->id ] ) ) : ?>
|
102 |
+
<?php if ( ! empty( $data['plans'][ $plan->id ]->value ) ) : ?>
|
103 |
+
<b><?php echo esc_html( $data['plans'][ $plan->id ]->value ) ?></b>
|
104 |
+
<?php else : ?>
|
105 |
+
<i class="dashicons dashicons-yes"></i>
|
106 |
+
<?php endif ?>
|
107 |
+
<?php endif ?>
|
108 |
+
</td>
|
109 |
+
<?php endforeach ?>
|
110 |
+
</tr>
|
111 |
+
<?php $odd = ! $odd; endforeach ?>
|
112 |
+
</tbody>
|
113 |
+
</table>
|
114 |
</div>
|
lib/freemius/templates/plugin-info/index.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
1 |
+
<?php
|
2 |
+
// Silence is golden.
|
3 |
// Hide file structure from users on unprotected servers.
|
lib/freemius/templates/plugin-info/screenshots.php
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.6
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
*
|
16 |
-
* @var FS_Plugin $plugin
|
17 |
-
*/
|
18 |
-
$plugin = $VARS['plugin'];
|
19 |
-
|
20 |
-
$screenshots = $VARS['screenshots'];
|
21 |
-
?>
|
22 |
-
<ol>
|
23 |
-
<?php $i = 0;
|
24 |
-
foreach ( $screenshots as $s => $url ) : ?>
|
25 |
-
<?php
|
26 |
-
// Relative URLs are replaced with WordPress.org base URL
|
27 |
-
// therefore we need to set absolute URLs.
|
28 |
-
$url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url;
|
29 |
-
?>
|
30 |
-
<li>
|
31 |
-
<a href="<?php echo $url ?>" title="<?php echo esc_attr( sprintf( fs_text_inline( 'Click to view full-size screenshot %d', 'view-full-size-x', $plugin->slug ), $i ) ) ?>"><img src="<?php echo $url ?>"></a>
|
32 |
-
</li>
|
33 |
-
<?php $i ++; endforeach ?>
|
34 |
-
</ol>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.6
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
*
|
16 |
+
* @var FS_Plugin $plugin
|
17 |
+
*/
|
18 |
+
$plugin = $VARS['plugin'];
|
19 |
+
|
20 |
+
$screenshots = $VARS['screenshots'];
|
21 |
+
?>
|
22 |
+
<ol>
|
23 |
+
<?php $i = 0;
|
24 |
+
foreach ( $screenshots as $s => $url ) : ?>
|
25 |
+
<?php
|
26 |
+
// Relative URLs are replaced with WordPress.org base URL
|
27 |
+
// therefore we need to set absolute URLs.
|
28 |
+
$url = 'http' . ( WP_FS__IS_HTTPS ? 's' : '' ) . ':' . $url;
|
29 |
+
?>
|
30 |
+
<li>
|
31 |
+
<a href="<?php echo $url ?>" title="<?php echo esc_attr( sprintf( fs_text_inline( 'Click to view full-size screenshot %d', 'view-full-size-x', $plugin->slug ), $i ) ) ?>"><img src="<?php echo $url ?>"></a>
|
32 |
+
</li>
|
33 |
+
<?php $i ++; endforeach ?>
|
34 |
+
</ol>
|
lib/freemius/templates/powered-by.php
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.5
|
7 |
-
*/
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
-
* we only develop and maintain one code base.
|
14 |
-
*
|
15 |
-
* This code will not run for wp.org themes (only plugins)
|
16 |
-
* since theme admin settings/options are now only allowed in the customizer.
|
17 |
-
*
|
18 |
-
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
19 |
-
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
20 |
-
*
|
21 |
-
* If you have any questions or need clarifications, please don't hesitate
|
22 |
-
* pinging me on slack, my username is @svovaf.
|
23 |
-
*
|
24 |
-
* @author Vova Feldman (@svovaf)
|
25 |
-
* @since 1.2.2
|
26 |
-
*/
|
27 |
-
|
28 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
29 |
-
exit;
|
30 |
-
}
|
31 |
-
|
32 |
-
$VARS = isset($VARS) ? $VARS : array();
|
33 |
-
|
34 |
-
$fs = freemius( $VARS['module_id'] );
|
35 |
-
|
36 |
-
if ( ! $fs->is_whitelabeled() && ! $fs->apply_filters( 'hide_freemius_powered_by', false ) ) {
|
37 |
-
wp_enqueue_script( 'jquery' );
|
38 |
-
wp_enqueue_script( 'json2' );
|
39 |
-
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
40 |
-
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
41 |
-
?>
|
42 |
-
<div id="pframe"></div>
|
43 |
-
<script type="text/javascript">
|
44 |
-
(function ($) {
|
45 |
-
$(function () {
|
46 |
-
var
|
47 |
-
base_url = '<?php echo WP_FS__ADDRESS ?>',
|
48 |
-
pframe = $('<i' + 'frame id="fs_promo_tab" src="' + base_url + '/promotional-tab/?<?php echo http_build_query($VARS) ?>#' + encodeURIComponent(document.location.href) + '" height="350" width="60" frameborder="0" style=" background: transparent; position: fixed; top: 20%; right: 0;" scrolling="no"></i' + 'frame>')
|
49 |
-
.appendTo('#pframe');
|
50 |
-
|
51 |
-
FS.PostMessage.init(base_url);
|
52 |
-
FS.PostMessage.receive('state', function (state) {
|
53 |
-
if ('closed' === state)
|
54 |
-
$('#fs_promo_tab').css('width', '60px');
|
55 |
-
else
|
56 |
-
$('#fs_promo_tab').css('width', '345px');
|
57 |
-
});
|
58 |
-
});
|
59 |
-
})(jQuery);
|
60 |
-
</script>
|
61 |
-
<?php } ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.5
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Note for WordPress.org Theme/Plugin reviewer:
|
11 |
+
* Freemius is an SDK for plugin and theme developers. Since the core
|
12 |
+
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
13 |
+
* we only develop and maintain one code base.
|
14 |
+
*
|
15 |
+
* This code will not run for wp.org themes (only plugins)
|
16 |
+
* since theme admin settings/options are now only allowed in the customizer.
|
17 |
+
*
|
18 |
+
* In addition, this page loads an i-frame. We intentionally named it 'frame'
|
19 |
+
* so it will pass the "Theme Check" that is looking for the string "i" . "frame".
|
20 |
+
*
|
21 |
+
* If you have any questions or need clarifications, please don't hesitate
|
22 |
+
* pinging me on slack, my username is @svovaf.
|
23 |
+
*
|
24 |
+
* @author Vova Feldman (@svovaf)
|
25 |
+
* @since 1.2.2
|
26 |
+
*/
|
27 |
+
|
28 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
29 |
+
exit;
|
30 |
+
}
|
31 |
+
|
32 |
+
$VARS = isset($VARS) ? $VARS : array();
|
33 |
+
|
34 |
+
$fs = freemius( $VARS['module_id'] );
|
35 |
+
|
36 |
+
if ( ! $fs->is_whitelabeled() && ! $fs->apply_filters( 'hide_freemius_powered_by', false ) ) {
|
37 |
+
wp_enqueue_script( 'jquery' );
|
38 |
+
wp_enqueue_script( 'json2' );
|
39 |
+
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
40 |
+
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
41 |
+
?>
|
42 |
+
<div id="pframe"></div>
|
43 |
+
<script type="text/javascript">
|
44 |
+
(function ($) {
|
45 |
+
$(function () {
|
46 |
+
var
|
47 |
+
base_url = '<?php echo WP_FS__ADDRESS ?>',
|
48 |
+
pframe = $('<i' + 'frame id="fs_promo_tab" src="' + base_url + '/promotional-tab/?<?php echo http_build_query($VARS) ?>#' + encodeURIComponent(document.location.href) + '" height="350" width="60" frameborder="0" style=" background: transparent; position: fixed; top: 20%; right: 0;" scrolling="no"></i' + 'frame>')
|
49 |
+
.appendTo('#pframe');
|
50 |
+
|
51 |
+
FS.PostMessage.init(base_url);
|
52 |
+
FS.PostMessage.receive('state', function (state) {
|
53 |
+
if ('closed' === state)
|
54 |
+
$('#fs_promo_tab').css('width', '60px');
|
55 |
+
else
|
56 |
+
$('#fs_promo_tab').css('width', '345px');
|
57 |
+
});
|
58 |
+
});
|
59 |
+
})(jQuery);
|
60 |
+
</script>
|
61 |
+
<?php } ?>
|
lib/freemius/templates/secure-https-header.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.1.8
|
7 |
-
*
|
8 |
-
* @var array $VARS
|
9 |
-
*/
|
10 |
-
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
-
exit;
|
13 |
-
}
|
14 |
-
?>
|
15 |
-
<div class="fs-secure-notice">
|
16 |
-
<i class="dashicons dashicons-lock"></i>
|
17 |
-
<span><?php
|
18 |
-
if ( ! empty( $VARS['message'] ) ) {
|
19 |
-
echo esc_html( $VARS['message'] );
|
20 |
-
} else {
|
21 |
-
/**
|
22 |
-
* @var Freemius $fs
|
23 |
-
*/
|
24 |
-
$fs = freemius( $VARS['id'] );
|
25 |
-
|
26 |
-
echo esc_html( sprintf(
|
27 |
-
/* translators: %s: Page name */
|
28 |
-
$fs->get_text_inline( 'Secure HTTPS %s page, running from an external domain', 'secure-x-page-header' ),
|
29 |
-
$VARS['page']
|
30 |
-
) ) .
|
31 |
-
' - ' .
|
32 |
-
sprintf(
|
33 |
-
'<a class="fs-security-proof" href="%s" target="_blank" rel="noopener">%s</a>',
|
34 |
-
'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION,
|
35 |
-
'Freemius Inc. [US]'
|
36 |
-
);
|
37 |
-
}
|
38 |
-
?></span>
|
39 |
</div>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.1.8
|
7 |
+
*
|
8 |
+
* @var array $VARS
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
?>
|
15 |
+
<div class="fs-secure-notice">
|
16 |
+
<i class="dashicons dashicons-lock"></i>
|
17 |
+
<span><?php
|
18 |
+
if ( ! empty( $VARS['message'] ) ) {
|
19 |
+
echo esc_html( $VARS['message'] );
|
20 |
+
} else {
|
21 |
+
/**
|
22 |
+
* @var Freemius $fs
|
23 |
+
*/
|
24 |
+
$fs = freemius( $VARS['id'] );
|
25 |
+
|
26 |
+
echo esc_html( sprintf(
|
27 |
+
/* translators: %s: Page name */
|
28 |
+
$fs->get_text_inline( 'Secure HTTPS %s page, running from an external domain', 'secure-x-page-header' ),
|
29 |
+
$VARS['page']
|
30 |
+
) ) .
|
31 |
+
' - ' .
|
32 |
+
sprintf(
|
33 |
+
'<a class="fs-security-proof" href="%s" target="_blank" rel="noopener">%s</a>',
|
34 |
+
'https://www.mcafeesecure.com/verify?host=' . WP_FS__ROOT_DOMAIN_PRODUCTION,
|
35 |
+
'Freemius Inc. [US]'
|
36 |
+
);
|
37 |
+
}
|
38 |
+
?></span>
|
39 |
</div>
|
lib/freemius/templates/sticky-admin-notice-js.php
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Sticky admin notices JavaScript handler for dismissing notice messages
|
4 |
-
* by sending AJAX call to the server in order to remove the message from the Database.
|
5 |
-
*
|
6 |
-
* @package Freemius
|
7 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
8 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
9 |
-
* @since 1.0.7
|
10 |
-
*/
|
11 |
-
|
12 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
-
exit;
|
14 |
-
}
|
15 |
-
?>
|
16 |
-
<script type="text/javascript" >
|
17 |
-
jQuery( document ).ready(function( $ ) {
|
18 |
-
$( '.fs-notice.fs-sticky .fs-close' ).click(function() {
|
19 |
-
var
|
20 |
-
notice = $( this ).parents( '.fs-notice' ),
|
21 |
-
id = notice.attr( 'data-id' ),
|
22 |
-
ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
|
23 |
-
|
24 |
-
notice.fadeOut( 'fast', function() {
|
25 |
-
var data = {
|
26 |
-
action : 'fs_dismiss_notice_action_' + ajaxActionSuffix,
|
27 |
-
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
28 |
-
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_dismiss_notice_action' ) ); ?>,
|
29 |
-
message_id: id
|
30 |
-
};
|
31 |
-
|
32 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
33 |
-
$.post( ajaxurl, data, function( response ) {
|
34 |
-
|
35 |
-
});
|
36 |
-
|
37 |
-
notice.remove();
|
38 |
-
});
|
39 |
-
});
|
40 |
-
});
|
41 |
-
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Sticky admin notices JavaScript handler for dismissing notice messages
|
4 |
+
* by sending AJAX call to the server in order to remove the message from the Database.
|
5 |
+
*
|
6 |
+
* @package Freemius
|
7 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
8 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
9 |
+
* @since 1.0.7
|
10 |
+
*/
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
?>
|
16 |
+
<script type="text/javascript" >
|
17 |
+
jQuery( document ).ready(function( $ ) {
|
18 |
+
$( '.fs-notice.fs-sticky .fs-close' ).click(function() {
|
19 |
+
var
|
20 |
+
notice = $( this ).parents( '.fs-notice' ),
|
21 |
+
id = notice.attr( 'data-id' ),
|
22 |
+
ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' );
|
23 |
+
|
24 |
+
notice.fadeOut( 'fast', function() {
|
25 |
+
var data = {
|
26 |
+
action : 'fs_dismiss_notice_action_' + ajaxActionSuffix,
|
27 |
+
// As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline.
|
28 |
+
_wpnonce : <?php echo wp_json_encode( wp_create_nonce( 'fs_dismiss_notice_action' ) ); ?>,
|
29 |
+
message_id: id
|
30 |
+
};
|
31 |
+
|
32 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
33 |
+
$.post( ajaxurl, data, function( response ) {
|
34 |
+
|
35 |
+
});
|
36 |
+
|
37 |
+
notice.remove();
|
38 |
+
});
|
39 |
+
});
|
40 |
+
});
|
41 |
+
</script>
|
lib/freemius/templates/tabs-capture-js.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.2.2.7
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var array $VARS
|
15 |
-
* @var Freemius $fs
|
16 |
-
*/
|
17 |
-
$fs = freemius( $VARS['id'] );
|
18 |
-
$slug = $fs->get_slug();
|
19 |
-
?>
|
20 |
-
<script type="text/javascript">
|
21 |
-
(function ($) {
|
22 |
-
$(document).ready(function () {
|
23 |
-
var $wrap = $( '.wrap' );
|
24 |
-
if ( 0 === $wrap.length ) {
|
25 |
-
$wrap = $( '<div class="wrap">' );
|
26 |
-
$wrap.insertBefore( $( '#wpbody-content .clear' ) );
|
27 |
-
}
|
28 |
-
|
29 |
-
$wrap = $wrap.clone().wrap( '<div>' ).parent();
|
30 |
-
|
31 |
-
var
|
32 |
-
settingHtml = $wrap.html(),
|
33 |
-
tabsPosition = settingHtml.indexOf('nav-tab-wrapper'),
|
34 |
-
aboveTabsHtml = '';
|
35 |
-
|
36 |
-
if (-1 < tabsPosition) {
|
37 |
-
// Find the tabs HTML beginning exact position.
|
38 |
-
while ('<' !== settingHtml[tabsPosition] && 0 < tabsPosition) {
|
39 |
-
tabsPosition--;
|
40 |
-
}
|
41 |
-
|
42 |
-
if (-1 < tabsPosition) {
|
43 |
-
aboveTabsHtml = settingHtml.substr(0, tabsPosition);
|
44 |
-
|
45 |
-
var tabsHtml = $('.wrap .nav-tab-wrapper').clone().wrap('<div>').parent().html();
|
46 |
-
|
47 |
-
$.ajax({
|
48 |
-
url : ajaxurl + '?' + $.param({
|
49 |
-
action : '<?php echo $fs->get_ajax_action( 'store_tabs' ) ?>',
|
50 |
-
security : '<?php echo $fs->get_ajax_security( 'store_tabs' ) ?>',
|
51 |
-
module_id: '<?php echo $fs->get_id() ?>'
|
52 |
-
}),
|
53 |
-
method : 'POST',
|
54 |
-
data : aboveTabsHtml + "\n" + tabsHtml + '</div>',
|
55 |
-
dataType : 'html',
|
56 |
-
// Avoid escaping the HTML.
|
57 |
-
processData: false
|
58 |
-
});
|
59 |
-
}
|
60 |
-
}
|
61 |
-
});
|
62 |
-
})(jQuery);
|
63 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.2.2.7
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var array $VARS
|
15 |
+
* @var Freemius $fs
|
16 |
+
*/
|
17 |
+
$fs = freemius( $VARS['id'] );
|
18 |
+
$slug = $fs->get_slug();
|
19 |
+
?>
|
20 |
+
<script type="text/javascript">
|
21 |
+
(function ($) {
|
22 |
+
$(document).ready(function () {
|
23 |
+
var $wrap = $( '.wrap' );
|
24 |
+
if ( 0 === $wrap.length ) {
|
25 |
+
$wrap = $( '<div class="wrap">' );
|
26 |
+
$wrap.insertBefore( $( '#wpbody-content .clear' ) );
|
27 |
+
}
|
28 |
+
|
29 |
+
$wrap = $wrap.clone().wrap( '<div>' ).parent();
|
30 |
+
|
31 |
+
var
|
32 |
+
settingHtml = $wrap.html(),
|
33 |
+
tabsPosition = settingHtml.indexOf('nav-tab-wrapper'),
|
34 |
+
aboveTabsHtml = '';
|
35 |
+
|
36 |
+
if (-1 < tabsPosition) {
|
37 |
+
// Find the tabs HTML beginning exact position.
|
38 |
+
while ('<' !== settingHtml[tabsPosition] && 0 < tabsPosition) {
|
39 |
+
tabsPosition--;
|
40 |
+
}
|
41 |
+
|
42 |
+
if (-1 < tabsPosition) {
|
43 |
+
aboveTabsHtml = settingHtml.substr(0, tabsPosition);
|
44 |
+
|
45 |
+
var tabsHtml = $('.wrap .nav-tab-wrapper').clone().wrap('<div>').parent().html();
|
46 |
+
|
47 |
+
$.ajax({
|
48 |
+
url : ajaxurl + '?' + $.param({
|
49 |
+
action : '<?php echo $fs->get_ajax_action( 'store_tabs' ) ?>',
|
50 |
+
security : '<?php echo $fs->get_ajax_security( 'store_tabs' ) ?>',
|
51 |
+
module_id: '<?php echo $fs->get_id() ?>'
|
52 |
+
}),
|
53 |
+
method : 'POST',
|
54 |
+
data : aboveTabsHtml + "\n" + tabsHtml + '</div>',
|
55 |
+
dataType : 'html',
|
56 |
+
// Avoid escaping the HTML.
|
57 |
+
processData: false
|
58 |
+
});
|
59 |
+
}
|
60 |
+
}
|
61 |
+
});
|
62 |
+
})(jQuery);
|
63 |
</script>
|
lib/wp-content-aware-engine/assets/css/condition_groups.css
CHANGED
@@ -3,4 +3,4 @@
|
|
3 |
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
-
*/.cas-group-sep,.wpca-alert{color:#fff;font-weight:700}.wpca-pull-left{float:left}.rtl .wpca-pull-left,.wpca-pull-right{float:right}.rtl .wpca-pull-right{float:left}.wpca-alert{position:fixed;top:0;font-size:1.3em;width:100%}.wpca-alert .wpca-error,.wpca-alert .wpca-success{box-sizing:border-box;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.3),inset 0 0 0 3px rgba(0,0,0,.1);padding:18px 30px}.cas-group-body,.cas-group-icon,.cas-group-new{box-shadow:0 1px 1px 1px rgba(0,0,0,.04);box-sizing:border-box}.wpca-alert .wpca-success{background-color:#46b450}.wpca-alert .wpca-error{background-color:#ff7058}@media (min-width:601px){.wpca-alert{width:auto;top:auto;bottom:30px;right:30px}.wpca-error,.wpca-success{min-width:320px;position:relative;border-radius:40px}.rtl .wpca-alert{left:30px;right:auto}}#cas-groups{padding:6px 0 0}#cas-groups .button-small .dashicons{vertical-align:text-top}#cas-groups>ul{position:relative;margin:0;transition:all 1s ease;max-height:9999px;height:auto}.cas-group-body,.cas-group-new{border-width:1px;border-style:solid;border-color:#c3c4c7;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:4px}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #c3c4c7}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden;vertical-align:middle;color:#888}.cas-group-body .cas-group-actions .dashicons{vertical-align:middle}.cas-group-body .cas-group-actions .spinner{float:none}.cas-group-body .cas-group-options{overflow:hidden;margin:0}.cas-group-body .cas-group-options li{overflow:hidden;margin:0;padding:8px 5px;border-top:#ddd 1px solid}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{height:26px;font-size:11px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__arrow{height:26px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__rendered{line-height:26px}.wpca-conditions-add+.select2-container.select2-container--wpca.select2-container--open .select2-selection{border-color:#0a4b78;background-color:#dcdcde!important;box-shadow:inset 0 2px 5px -3px #0a4b78}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{background-color:#f6f7f7;border-color:#2271b1;padding:0 6px 1px;border-radius:3px;vertical-align:top}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection:hover{color:#0a4b78;border-color:#0a4b78;background-color:#f0f0f1}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__placeholder{color:#2271b1}.cas-group-single{margin:0}.cas-condition:first-of-type>.cas-group-sep,.cas-group-single:first-of-type>.cas-group-sep{display:none}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate{display:table}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate:before{display:none}.cas-group-sep{display:table;margin:0 auto;text-transform:uppercase;font-size:.8em;line-height:1;clear:both;direction:ltr}.cas-group-sep:after,.cas-group-sep:before{position:relative;display:block;content:'';width:1px;height:12px;margin:0 auto;border-left:1px dashed #777}.cas-group-sep span{background-color:#777;display:inline-block;padding:5px 7px;border-radius:15px;vertical-align:middle}.cas-group-body .cas-group-sep{display:block;overflow:hidden;text-align:center;margin:10px -10px 0}.cas-group-body .cas-group-sep:after,.cas-group-body .cas-group-sep:before{background-color:transparent;border-top:1px solid #e3e3e3;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.cas-group-body .cas-group-sep:before{right:0;margin-left:-50%}.cas-group-body .cas-group-sep:after{left:0;margin-right:-50%}.cas-group-label{font-weight:700;margin:0 0 10px}.wpca-condition-remove{cursor:pointer;color:#aaa;transition:color .3s ease;float:right}.wpca-condition-remove:hover{color:#b32d2e}.cas-group-new{background-color:#fff}.cas-group-new>div:first-of-type{background-color:#f1f1f1;border-right:#c3c4c7 1px solid}.cas-group-new>div{padding:5px;display:inline-block;vertical-align:middle}.cas-group-new a{padding:0 10px}.cas-group-icon{float:left;border:1px solid #e3e3e3;width:40px;height:40px;border-radius:6px;text-align:center;padding:3px;display:none}.cas-group-icon .dashicons{color:#2271b1;font-size:28px;width:100%;height:100%;line-height:34px}label.cae-toggle{vertical-align:top}label.cae-toggle input{display:none}label.cae-toggle .cae-toggle-bar{overflow:hidden;cursor:pointer;position:relative;padding-right:34px;height:22px;line-height:22px;display:inline-block;vertical-align:middle}label.cae-toggle .cae-toggle-bar:before{top:0;right:0;position:absolute;display:inline-block;width:34px;content:"";padding:0;height:inherit;line-height:inherit;border-radius:22px;background-color:#bbb;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}label.cae-toggle .cae-toggle-bar:after{content:"";display:block;width:18px;height:18px;margin:0;background:#FFF;position:absolute;top:2px;right:14px;border-radius:22px;transition:right .2s ease-in 0s;box-shadow:0 1px 2px rgba(0,0,0,.2)}label.cae-toggle input:checked+.cae-toggle-bar:before{background-color:#7ad03a}label.cae-toggle input:checked+.cae-toggle-bar:after{right:2px}label.cae-toggle input:disabled+.cae-toggle-bar:after{background:rgba(255,255,255,.5)}@media (min-width:783px){.cas-group-input,.cas-group-label{margin-left:50px}#cas-groups .button-small .dashicons{font-size:14px;height:14px;width:14px}.cas-group-icon{display:block}.cas-group-input{white-space:nowrap;overflow:hidden}.rtl .cas-group-input{margin-right:50px;margin-left:auto}.cas-group-body .cas-group-options input[type=number],.cas-group-body .cas-group-options input[type=text],.cas-group-body .cas-group-options select{font-size:.9em;min-height:24px}}@media (min-width:1041px){.cas-group-input,.cas-group-label{margin-left:50px}.wpca-group-description{float:left}.cas-group-input{white-space:nowrap;overflow:hidden}.cas-group-body .cas-group-options li{padding:8px 10%}}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:30px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;white-space:nowrap!important}.select2-container--wpca.select2-container .select2-selection--single{background-color:#fff;border:1px solid #8c8f94;border-radius:4px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single{border:1px solid #5b9dd9}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--wpca.select2-container .select2-selection--multiple{background-color:#fff;color:#444;border:1px solid #8c8f94;border-radius:4px;cursor:text;min-height:39px;line-height:1}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 6px 4px;width:100%}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice{background-color:#bfe7f1;color:#23282d;border:1px solid #5b9dd9;border-radius:4px;cursor:default;float:left;margin:5px 5px 0 0;padding:4px 8px;max-width:100%;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;box-shadow:0 1px 0 0 rgba(255,255,255,.9) inset,0 1px 1px rgba(0,0,0,.1)}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove{color:#5b9dd9;cursor:pointer;font-size:16px;display:inline-block;font-weight:700;margin:0 6px 2px 0}.select2-container--wpca .select2-results__option[aria-selected=true]:not([data-selected=false]),.select2-container--wpca .select2-results__option[data-selected=true],.select2-container--wpca.select2-container.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover{color:#444}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:6px;margin-right:auto}.select2-container--wpca.select2-container.select2-container--focus .select2-selection--multiple{border:1px solid #5b9dd9;background-color:#fafafa;outline:0}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--wpca.select2-container .select2-dropdown{overflow:hidden;border-color:#5b9dd9}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-1{padding-left:10px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-2{padding-left:20px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-3{padding-left:30px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-4{padding-left:40px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-5{padding-left:50px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-6{padding-left:60px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-7{padding-left:70px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-8{padding-left:80px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-9{padding-left:90px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-10{padding-left:100px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-1{padding-right:10px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-2{padding-right:20px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-3{padding-right:30px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-4{padding-right:40px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-5{padding-right:50px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-6{padding-right:60px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-7{padding-right:70px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-8{padding-right:80px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-9{padding-right:90px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-10{padding-right:100px}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--below{box-shadow:0 2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--above{box-shadow:0 -2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid #8c8f94}.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:1px solid #8c8f94}.select2-container--wpca .select2-search--dropdown .select2-search__field{border:1px solid #5b9dd9;line-height:normal}.select2-container--wpca .select2-search--inline{max-width:100%;width:auto;margin:0;z-index:1030}.select2-container--wpca .select2-search--inline .select2-search__field{font-family:inherit;padding:0;background:0 0!important;min-height:auto;max-width:100%;border:none;outline:0;box-shadow:none!important;-webkit-appearance:textfield;margin-top:10px!important;line-height:normal}.select2-container--wpca .select2-search--inline .select2-search__field:not([placeholder='']){width:100%!important;margin-right:9999px}.select2-container--wpca[dir=rtl] .select2-search--inline .select2-search__field:not([placeholder='']){margin-left:9999px;margin-right:auto}.select2-container--wpca .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--wpca .select2-results__option[role=group]{padding:0}.select2-container--wpca .select2-results__option[aria-disabled=true]{color:#999}.select2-container--wpca .select2-results__option .select2-results__option{padding-left:20px;margin:0}.select2-container--wpca .select2-results__option--highlighted[aria-selected]{background-color:#f2f2f2}.select2-container--wpca .select2-results__group{cursor:default;display:block;padding:6px}
|
3 |
* @author Joachim Jensen <joachim@dev.institute>
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
+
*/.wpca-pull-left{float:left}.rtl .wpca-pull-left,.wpca-pull-right{float:right}.rtl .wpca-pull-right{float:left}.wpca-alert{position:fixed;top:0;font-weight:700;color:#fff;font-size:1.3em;width:100%}.wpca-alert .wpca-error,.wpca-alert .wpca-success{box-sizing:border-box;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.3),inset 0 0 0 3px rgba(0,0,0,.1);padding:18px 30px}.wpca-alert .wpca-success{background-color:#46b450}.wpca-alert .wpca-error{background-color:#ff7058}@media (min-width:601px){.wpca-alert{width:auto;top:auto;bottom:30px;right:30px}.wpca-error,.wpca-success{min-width:320px;position:relative;border-radius:40px}.rtl .wpca-alert{left:30px;right:auto}}#cas-groups{padding:6px 0 0}#cas-groups .button-small .dashicons{vertical-align:text-top}#cas-groups>ul{position:relative;margin:0;transition:all 1s ease;max-height:9999px;height:auto}.cas-group-body,.cas-group-new{box-sizing:border-box;border-width:1px;border-style:solid;border-color:#c3c4c7;background-color:#f1f1f1;overflow:hidden;position:relative;margin-bottom:0;border-radius:4px;box-shadow:0 1px 1px 1px rgba(0,0,0,.04)}.cas-group-body input,.cas-group-body select{margin:0}.cas-group-body .cas-group-cell{padding:10px;background-color:#fff;border-top:1px solid #c3c4c7}.cas-group-body .cas-group-actions{padding:5px;overflow:hidden;vertical-align:middle;color:#888}.cas-group-body .cas-group-actions .dashicons{vertical-align:middle}.cas-group-body .cas-group-actions .spinner{float:none}.cas-group-body .cas-group-options{overflow:hidden;margin:0}.cas-group-body .cas-group-options li{overflow:hidden;margin:0;padding:8px 5px;border-top:#ddd 1px solid}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{height:26px;font-size:11px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__arrow{height:26px}.cas-group-actions .wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__rendered{line-height:26px}.wpca-conditions-add+.select2-container.select2-container--wpca.select2-container--open .select2-selection{border-color:#0a4b78;background-color:#dcdcde!important;box-shadow:inset 0 2px 5px -3px #0a4b78}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection{background-color:#f6f7f7;border-color:#2271b1;padding:0 6px 1px;border-radius:3px;vertical-align:top}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection:hover{color:#0a4b78;border-color:#0a4b78;background-color:#f0f0f1}.wpca-conditions-add+.select2-container.select2-container--wpca .select2-selection .select2-selection__placeholder{color:#2271b1}.cas-group-single{margin:0}.cas-condition:first-of-type>.cas-group-sep,.cas-group-single:first-of-type>.cas-group-sep{display:none}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate{display:table}.cas-group-single:first-of-type>.cas-group-sep.wpca-group-negate:before{display:none}.cas-group-sep{display:table;margin:0 auto;color:#fff;text-transform:uppercase;font-size:.8em;font-weight:700;line-height:1;clear:both;direction:ltr}.cas-group-sep:after,.cas-group-sep:before{position:relative;display:block;content:'';width:1px;height:12px;margin:0 auto;border-left:1px dashed #777}.cas-group-sep span{background-color:#777;display:inline-block;padding:5px 7px;border-radius:15px;vertical-align:middle}.cas-group-body .cas-group-sep{display:block;overflow:hidden;text-align:center;margin:10px -10px 0}.cas-group-body .cas-group-sep:after,.cas-group-body .cas-group-sep:before{background-color:transparent;border-top:1px solid #e3e3e3;content:"";display:inline-block;height:1px;position:relative;vertical-align:middle;width:50%}.cas-group-body .cas-group-sep:before{right:0;margin-left:-50%}.cas-group-body .cas-group-sep:after{left:0;margin-right:-50%}.cas-group-label{font-weight:700;margin:0 0 10px}.wpca-condition-remove{cursor:pointer;color:#aaa;transition:color .3s ease;float:right}.wpca-condition-remove:hover{color:#b32d2e}.cas-group-new{background-color:#fff}.cas-group-new>div:first-of-type{background-color:#f1f1f1;border-right:#c3c4c7 1px solid}.cas-group-new>div{padding:5px;display:inline-block;vertical-align:middle}.cas-group-new a{padding:0 10px}.cas-group-icon{float:left;border:1px solid #e3e3e3;width:40px;height:40px;border-radius:6px;text-align:center;padding:3px;box-sizing:border-box;box-shadow:0 1px 1px 1px rgba(0,0,0,.04);display:none}.cas-group-icon .dashicons{color:#2271b1;font-size:30px;width:auto;height:auto;line-height:34px}.cas-group-icon img{width:100%;height:auto;border-radius:3px}label.cae-toggle{vertical-align:top}label.cae-toggle input{display:none}label.cae-toggle .cae-toggle-bar{overflow:hidden;cursor:pointer;position:relative;padding-right:34px;height:22px;line-height:22px;display:inline-block;vertical-align:middle}label.cae-toggle .cae-toggle-bar:before{top:0;right:0;position:absolute;display:inline-block;width:34px;content:"";padding:0;height:inherit;line-height:inherit;border-radius:22px;background-color:#bbb;box-shadow:0 0 2px rgba(0,0,0,.2) inset;transition:background-color .2s ease-in}label.cae-toggle .cae-toggle-bar:after{content:"";display:block;width:18px;height:18px;margin:0;background:#FFF;position:absolute;top:2px;right:14px;border-radius:22px;transition:right .2s ease-in 0s;box-shadow:0 1px 2px rgba(0,0,0,.2)}label.cae-toggle input:checked+.cae-toggle-bar:before{background-color:#7ad03a}label.cae-toggle input:checked+.cae-toggle-bar:after{right:2px}label.cae-toggle input:disabled+.cae-toggle-bar:after{background:rgba(255,255,255,.5)}@media (min-width:783px){.cas-group-input,.cas-group-label{margin-left:50px}#cas-groups .button-small .dashicons{font-size:14px;height:14px;width:14px}.cas-group-icon{display:block}.cas-group-input{white-space:nowrap;overflow:hidden}.rtl .cas-group-input{margin-right:50px;margin-left:auto}.cas-group-body .cas-group-options input[type=number],.cas-group-body .cas-group-options input[type=text],.cas-group-body .cas-group-options select{font-size:.9em;min-height:24px}}@media (min-width:1041px){.cas-group-input,.cas-group-label{margin-left:50px}.wpca-group-description{float:left}.cas-group-input{white-space:nowrap;overflow:hidden}.cas-group-body .cas-group-options li{padding:8px 10%}}.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:30px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;white-space:nowrap!important}.select2-container--wpca.select2-container .select2-selection--single{background-color:#fff;border:1px solid #8c8f94;border-radius:4px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--wpca.select2-container .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent;border-style:solid;border-width:5px 4px 0;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single{border:1px solid #5b9dd9}.select2-container--wpca.select2-container.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888;border-width:0 4px 5px}.select2-container--wpca.select2-container .select2-selection--multiple{background-color:#fff;color:#444;border:1px solid #8c8f94;border-radius:4px;cursor:text;min-height:39px;line-height:1}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 6px 4px;width:100%}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice{background-color:#bfe7f1;color:#23282d;border:1px solid #5b9dd9;border-radius:4px;cursor:default;float:left;margin:5px 5px 0 0;padding:4px 8px;max-width:100%;overflow:hidden;text-overflow:ellipsis;box-sizing:border-box;box-shadow:0 1px 0 0 rgba(255,255,255,.9) inset,0 1px 1px rgba(0,0,0,.1)}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove{color:#5b9dd9;cursor:pointer;font-size:16px;display:inline-block;font-weight:700;margin:0 6px 2px 0}.select2-container--wpca .select2-results__option[aria-selected=true]:not([data-selected=false]),.select2-container--wpca .select2-results__option[data-selected=true],.select2-container--wpca.select2-container.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--wpca.select2-container .select2-selection--multiple .select2-selection__choice__remove:hover{color:#444}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin:5px 0 0 5px}.select2-container--wpca.select2-container[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:6px;margin-right:auto}.select2-container--wpca.select2-container.select2-container--focus .select2-selection--multiple{border:1px solid #5b9dd9;background-color:#fafafa;outline:0}.select2-container--wpca.select2-container.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--wpca.select2-container .select2-dropdown{overflow:hidden;border-color:#5b9dd9}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-1{padding-left:10px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-2{padding-left:20px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-3{padding-left:30px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-4{padding-left:40px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-5{padding-left:50px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-6{padding-left:60px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-7{padding-left:70px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-8{padding-left:80px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-9{padding-left:90px}.select2-container--wpca.select2-container .select2-dropdown .wpca-level-10{padding-left:100px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-1{padding-right:10px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-2{padding-right:20px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-3{padding-right:30px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-4{padding-right:40px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-5{padding-right:50px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-6{padding-right:60px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-7{padding-right:70px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-8{padding-right:80px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-9{padding-right:90px}.select2-container--wpca.select2-container .select2-dropdown[dir=rtl] .wpca-level-10{padding-right:100px}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--below{box-shadow:0 2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container .select2-dropdown.select2-dropdown--above{box-shadow:0 -2px 5px rgba(0,0,0,.15)}.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0;border-top:1px solid #8c8f94}.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--wpca.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom:1px solid #8c8f94}.select2-container--wpca .select2-search--dropdown .select2-search__field{border:1px solid #5b9dd9;line-height:normal}.select2-container--wpca .select2-search--inline{max-width:100%;width:auto;margin:0;z-index:1030}.select2-container--wpca .select2-search--inline .select2-search__field{font-family:inherit;padding:0;background:0 0!important;min-height:auto;max-width:100%;border:none;outline:0;box-shadow:none!important;-webkit-appearance:textfield;margin-top:10px!important;line-height:normal}.select2-container--wpca .select2-search--inline .select2-search__field:not([placeholder='']){width:100%!important;margin-right:9999px}.select2-container--wpca[dir=rtl] .select2-search--inline .select2-search__field:not([placeholder='']){margin-left:9999px;margin-right:auto}.select2-container--wpca .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--wpca .select2-results__option[role=group]{padding:0}.select2-container--wpca .select2-results__option[aria-disabled=true]{color:#999}.select2-container--wpca .select2-results__option .select2-results__option{padding-left:20px;margin:0}.select2-container--wpca .select2-results__option--highlighted[aria-selected]{background-color:#f2f2f2}.select2-container--wpca .select2-results__group{cursor:default;display:block;padding:6px}
|
lib/wp-content-aware-engine/assets/js/condition_groups.min.js
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
*/
|
7 |
-
var CAE=CAE||{};!function($,CAE,WPCA){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",icon:null,placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="wpca_or",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i,o=[],s=e.conditions[n];for(i in s.data)s.data.hasOwnProperty(i)&&o.push({text:"object"==typeof s.data[i]?s.data[i].text:s.data[i],id:i});delete s.data,s.module=n,s.values=o,t.push(s)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){var e;""!==this.model.get("text")&&(this.$el.fadeIn("slow"),e=this,setTimeout(function(){e.dismiss()},this.timer))}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},computeds:{getIcon:function(){var e=this.getBinding("icon");return"string"!=typeof e?"":e.startsWith("dashi")?'<span class="dashicons '+e+'"></span>':'<img src="'+e+'" />'}},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n,e,t,i=this.$el.find(".js-wpca-suggest");i.length&&(n=this.model,e=this.model.get("values"),t=$("<div></div>").html(n.get("placeholder")).text(),i.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:n.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){i.data("forceOpen",!0)}).on("select2:closing",function(e){i.data("forceOpen")&&(e.preventDefault(),i.data("forceOpen",!1))}),e.length&&i.val(_.map(e,function(e){return e.id})).trigger("change"),i.on("change",function(e){var t=i.select2("data");n.set("values",t)}))}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){return new(CAE.Views[e.model.get("module")]?CAE.Views[e.model.get("module")]:CAE.Views.Condition)(e)},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){this.setBinding("status",e?"negated":"wpca_or")}},statusExcept:{deps:["status"],get:function(e){return"wpca_except"==e},set:function(e){this.setBinding("status",e?"wpca_except":"wpca_or")}},statusLabel:function(){switch(this.getBinding("status")){case"wpca_except":return WPCA.condition_except;case"negated":return WPCA.condition_not;default:return WPCA.condition_or}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var t=this,n=$(".js-wpca-add-and",this.$el);n.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){e=e.params.data;t.model.conditions.findWhere({module:e.id})||(e=new CAE.Models.Condition({module:e.id,label:e.text,icon:e.icon,placeholder:e.placeholder,default_value:e.default_value}),t.model.conditions.add(e)),n.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.sidebarID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var n=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var i=$(".js-wpca-add-or",this.$el);i.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,e=new CAE.Models.Group,t=new CAE.Models.Condition({module:t.id,label:t.text,icon:t.icon,placeholder:t.placeholder,default_value:t.default_value});n.collection.add(e),e.conditions.add(t),i.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t,n,i=$(e.currentTarget).data("config"),o=new CAE.Models.Group;for(t in o.set(i.options),this.collection.add(o),i.modules)this.conditionsById.hasOwnProperty(i.modules[t])&&(n=this.conditionsById[i.modules[t]],n=new CAE.Models.Condition({module:n.id,label:n.text,icon:n.icon,placeholder:n.placeholder,default_value:n.default_value}),o.conditions.add(n))}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/wpca/conditionData",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,limit:20,action:"wpca/module/"+o.type,sidebar_id:l.sidebarID,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=20<=e.length;o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n}),$.fn.select2.amd.define("select2/wpca/moduleMatcher",["select2/diacritics"],function(t){function l(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}return function e(t,n){if(null==t.term||""===t.term.trim())return n;var i=l(n.text).toUpperCase(),o=l(t.term).toUpperCase();if(-1<i.indexOf(o))return n;if(n.children&&0<n.children.length){for(var s=$.extend(!0,{},n),a=n.children.length-1;0<=a;a--)null==e(t,n.children[a])&&s.children.splice(a,1);return 0<s.children.length?s:e(t,s)}return null}});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),sidebarID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/wpca/conditionData"),wpcaModuleMatcher:$.fn.select2.amd.require("select2/wpca/moduleMatcher"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(function(){l.init()})}(jQuery,CAE,WPCA);
|
4 |
* @license GPLv3
|
5 |
* @copyright 2022 by Joachim Jensen
|
6 |
*/
|
7 |
+
var CAE=CAE||{};!function($,CAE,WPCA){"use strict";CAE.settings={views:{}},CAE.Models={},CAE.Models.Alert=Backbone.Model.extend({defaults:{text:"",success:!0},sync:function(){return!1},url:"",reset:function(){this.set(this.defaults)}}),CAE.Models.Condition=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:{module:null,label:"",icon:null,placeholder:"",values:[],default_value:null},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this)},sync:function(){return!1},url:""}),CAE.Models.Group=Backbone.Model.extend({unsaved:{prompt:WPCA.unsaved,unloadWindowPrompt:!0},defaults:function(){var e=WPCA.meta_default;return e.id=null,e.status="wpca_or",e.exposure=1,e},initialize:function(){this.startTracking(),this.on("destroy",this.stopTracking,this),this.conditions||(this.conditions=new CAE.Models.ConditionCollection)},parse:function(e){var t=[];if(_.has(e,"conditions")){for(var n in e.conditions)if(e.conditions.hasOwnProperty(n)){var i,o=[],s=e.conditions[n];for(i in s.data)s.data.hasOwnProperty(i)&&o.push({text:"object"==typeof s.data[i]?s.data[i].text:s.data[i],id:i});delete s.data,s.module=n,s.values=o,t.push(s)}delete e.conditions}return this.conditions=new CAE.Models.ConditionCollection(t),e},sync:function(){return!1},url:""}),CAE.Models.GroupCollection=Backbone.Collection.extend({model:CAE.Models.Group,parse:function(e){return e}}),CAE.Models.ConditionCollection=Backbone.Collection.extend({model:CAE.Models.Condition}),CAE.Views={},CAE.Views.Alert=Backbone.Epoxy.View.extend({bindings:"data-vm",tagName:"div",className:"wpca-alert",template:"<div data-vm=\"classes:{'wpca-success':success,'wpca-error':not(success)},text:text\"></div>",timer:4e3,success:function(e){this.model.set({text:e,success:!0})},failure:function(e){this.model.set({text:e,success:!1})},dismiss:function(){var e=this;this.$el.fadeOut("slow",function(){e.model.reset()})},initialize:function(){this.listenTo(this.model,"change:text",this.show),this.$el.appendTo("body").hide().html(this.template)},show:function(){var e;""!==this.model.get("text")&&(this.$el.fadeIn("slow"),e=this,setTimeout(function(){e.dismiss()},this.timer))}}),CAE.Views.Condition=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Condition,tagName:"div",className:"cas-condition",templateName:"#wpca-template-condition",events:{"click .js-wpca-condition-remove":"removeModel"},computeds:{getIcon:function(){var e=this.getBinding("icon");if("string"!=typeof e)return"";if(e.startsWith("dashi")){var[t,n]=e.split(":");return'<span class="dashicons '+t+'"'+("string"==typeof n?' style="color:'+n+'"':"")+"></span>"}return'<img src="'+e+'" />'}},initialize:function(){this.listenTo(this.model,"destroy",this.remove);var e=$(this.templateName);e.length?(this.template=e.html(),this.$el.append(this.template),this.createSuggestInput()):this.model.destroy()},removeModel:function(e){var t=this;this.$el.slideUp(300,function(){t.model.destroy()})},createSuggestInput:function(){var n,e,t,i=this.$el.find(".js-wpca-suggest");i.length&&(n=this.model,e=this.model.get("values"),t=$("<div></div>").html(n.get("placeholder")).text(),i.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:n.get("module"),theme:"wpca",dir:WPCA.text_direction,placeholder:t,minimumInputLength:0,closeOnSelect:!0,width:"100%",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},nextSearchTerm:function(e,t){return t},templateResult:function(e){return e.level?$('<span class="wpca-level-'+e.level+'">'+e.text+"</span>"):e.text},data:e,dataAdapter:l.wpcaDataAdapter,ajax:{}}).on("select2:selecting",function(e){i.data("forceOpen",!0)}).on("select2:closing",function(e){i.data("forceOpen")&&(e.preventDefault(),i.data("forceOpen",!1))}),e.length&&i.val(_.map(e,function(e){return e.id})).trigger("change"),i.on("change",function(e){var t=i.select2("data");n.set("values",t)}))}}),CAE.Views.Group=Backbone.Epoxy.View.extend({bindings:"data-vm",model:CAE.Models.Group,tagName:"li",className:"cas-group-single",template:$("#wpca-template-group").html(),itemView:function(e){return new(CAE.Views[e.model.get("module")]?CAE.Views[e.model.get("module")]:CAE.Views.Condition)(e)},events:{"click .js-wpca-save-group":"saveGroup","click .js-wpca-options":"showOptions"},computeds:{statusNegated:{deps:["status"],get:function(e){return"negated"==e},set:function(e){this.setBinding("status",e?"negated":"wpca_or")}},statusExcept:{deps:["status"],get:function(e){return"wpca_except"==e},set:function(e){this.setBinding("status",e?"wpca_except":"wpca_or")}},statusLabel:function(){switch(this.getBinding("status")){case"wpca_except":return WPCA.condition_except;case"negated":return WPCA.condition_not;default:return WPCA.condition_or}}},bindingFilters:{int:{get:function(e){return e?1:0},set:function(e){return e?1:0}},binary:{get:function(e){return e?1:0},set:function(e){return e?1:0}},hasModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return e.filter(function(e){return t.hasOwnProperty(e.get("module"))}).length==arguments.length-1},hasAnyModule:function(e){for(var t={},n=1;n<arguments.length;n++)t[arguments[n]]=!0;return!!e.find(function(e){return t.hasOwnProperty(e.get("module"))})}},initialize:function(){this.collection=this.model.conditions,this.$el.hide().html(this.template).fadeIn(300),this.listenTo(this.model,"destroy",this.remove),this.listenTo(this.model,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"unsavedChanges",this.saveChanges),this.listenTo(this.model.conditions,"add remove",this.saveAddRemove);var t=this,n=$(".js-wpca-add-and",this.$el);n.select2({theme:"wpca",placeholder:"+ "+WPCA.newCondition,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"resolve",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){e=e.params.data;t.model.conditions.findWhere({module:e.id})||(e=new CAE.Models.Condition({module:e.id,label:e.text,icon:e.icon,placeholder:e.placeholder,default_value:e.default_value}),t.model.conditions.add(e)),n.val(null).trigger("change")})},showOptions:function(e){$(e.delegateTarget).find(".cas-group-options").slideToggle(200),$(e.currentTarget).toggleClass("active")},saveChanges:function(e,t){e&&i.start(this)},saveAddRemove:function(e,t,n){t.length?n.add?""!==e.get("default_value")&&i.start(this):this.model.get("id")&&i.start(this):(i.clear(this),this.model.get("id")?this.saveGroup():this.removeModel())},removeModel:function(){var e=this;this.$el.slideUp(400,function(){e.model.destroy()})},saveGroup:function(e){var i=this.$el.find(".spinner"),o=this.$el.find(".js-wpca-save-group"),t=this,n=_.clone(this.model.attributes);n.action="wpca/add-rule",n.token=l.nonce,n.current_id=l.postID,n.post_type=WPCA.post_type,n.conditions={},this.model.conditions.each(function(e){e.get("values").length?n.conditions[e.get("module")]=e.get("values").map(function(e){return e.id}):""!==e.get("default_value")&&(n.conditions[e.get("module")]=[e.get("default_value")])}),o.attr("disabled",!0),i.addClass("is-active"),$.ajax({url:ajaxurl,data:n,dataType:"JSON",type:"POST",success:function(e){l.alert.success(e.message),e.removed?t.removeModel():e.new_post_id&&t.model.set("id",e.new_post_id,{silent:!0}),e.removed||(o.hide(),i.removeClass("is-active"),t.model.restartTracking(),t.model.conditions.each(function(e){e.restartTracking()}))},error:function(e,t,n){o.attr("disabled",!1).show(),i.removeClass("is-active"),l.alert.failure(e.responseJSON.data)}})},slideRemove:function(){this.$el.slideUp(400,function(){this.remove()})}}),CAE.Views.GroupCollection=Backbone.Epoxy.View.extend({bindings:"data-vm",el:"#cas-groups",collection:CAE.Models.GroupCollection,events:{"click .js-wpca-add-quick":"addGroupQuick","click .js-wpca-save":"saveAll"},conditionsById:{},initialize:function(){var n=this;this.conditionsById=_.chain(WPCA.conditions).pluck(["children"]).flatten().indexBy("id").value();var i=$(".js-wpca-add-or",this.$el);i.select2({theme:"wpca",placeholder:"+ "+WPCA.newGroup,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"auto",matcher:l.wpcaModuleMatcher,nextSearchTerm:function(e,t){return t},data:WPCA.conditions}).on("select2:select",function(e){var t=e.params.data,e=new CAE.Models.Group,t=new CAE.Models.Condition({module:t.id,label:t.text,icon:t.icon,placeholder:t.placeholder,default_value:t.default_value});n.collection.add(e),e.conditions.add(t),i.val(null).trigger("change")})},itemView:function(e){return new CAE.Views.Group(e)},addGroupQuick:function(e){e.preventDefault();var t,n,i=$(e.currentTarget).data("config"),o=new CAE.Models.Group;for(t in o.set(i.options),this.collection.add(o),i.modules)this.conditionsById.hasOwnProperty(i.modules[t])&&(n=this.conditionsById[i.modules[t]],n=new CAE.Models.Condition({module:n.id,label:n.text,icon:n.icon,placeholder:n.placeholder,default_value:n.default_value}),o.conditions.add(n))}}),$.fn.select2.amd.require(["select2/selection/search"],function(e){e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(""),this.handleSearch()}},null,!0),$.fn.select2.amd.require(["select2/results"],function(e){e.prototype.ensureHighlightVisible=function(){this.$results.resize()}},null,!0),$.fn.select2.amd.define("select2/wpca/conditionData",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,i){n.term=n.term||"";var o=this.options.options,s=o.cachedResults[n.term],a=n.page||1;if(s&&s.page>=a){if(!(1<a))return void i({results:s.items,pagination:{more:s.more}});a=s.page}clearTimeout(o.searchTimer),o.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:a,limit:20,action:"wpca/module/"+o.type,current_id:l.postID,post_type:WPCA.post_type,nonce:l.nonce},dataType:"JSON",type:"POST",success:function(e){var t=20<=e.length;o.cachedResults[n.term]={page:a,more:t,items:s?o.cachedResults[n.term].items.concat(e):e},i({results:e,pagination:{more:t}})}})},o.quietMillis)},n}),$.fn.select2.amd.define("select2/wpca/moduleMatcher",["select2/diacritics"],function(t){function l(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}return function e(t,n){if(null==t.term||""===t.term.trim())return n;var i=l(n.text).toUpperCase(),o=l(t.term).toUpperCase();if(-1<i.indexOf(o))return n;if(n.children&&0<n.children.length){for(var s=$.extend(!0,{},n),a=n.children.length-1;0<=a;a--)null==e(t,n.children[a])&&s.children.splice(a,1);return 0<s.children.length?s:e(t,s)}return null}});var i={treshold:2e3,timerQueue:{},start:function(e){this.clear(e);var t=this;this.timerQueue[e.cid]=window.setTimeout(function(){t.set(e)},this.treshold)},set:function(e){e.saveGroup()},clear:function(e){e&&this.timerQueue[e.cid]&&window.clearInterval(this.timerQueue[e.cid])}},l={nonce:$("#_ca_nonce").val(),postID:$("#post_ID").val(),alert:null,wpcaDataAdapter:$.fn.select2.amd.require("select2/wpca/conditionData"),wpcaModuleMatcher:$.fn.select2.amd.require("select2/wpca/moduleMatcher"),init:function(){this.alert=new CAE.Views.Alert({model:new CAE.Models.Alert}),CAE.conditionGroups=new CAE.Views.GroupCollection({collection:new CAE.Models.GroupCollection(WPCA.groups,{parse:!0})})}};$(function(){l.init()})}(jQuery,CAE,WPCA);
|
lib/wp-content-aware-engine/bootstrap.php
CHANGED
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
|
|
12 |
* Version of this WPCA
|
13 |
* @var string
|
14 |
*/
|
15 |
-
$this_wpca_version = '
|
16 |
|
17 |
/**
|
18 |
* Class to make sure the latest
|
@@ -85,6 +85,10 @@ if (!class_exists('WPCALoader')) {
|
|
85 |
}
|
86 |
}
|
87 |
//Hook as early as possible after plugins are loaded
|
88 |
-
add_action(
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
WPCALoader::add(plugin_dir_path(__FILE__), $this_wpca_version);
|
12 |
* Version of this WPCA
|
13 |
* @var string
|
14 |
*/
|
15 |
+
$this_wpca_version = '12.0';
|
16 |
|
17 |
/**
|
18 |
* Class to make sure the latest
|
85 |
}
|
86 |
}
|
87 |
//Hook as early as possible after plugins are loaded
|
88 |
+
add_action(
|
89 |
+
'plugins_loaded',
|
90 |
+
['WPCALoader','load'],
|
91 |
+
defined('PHP_INT_MIN') ? PHP_INT_MIN : ~PHP_INT_MAX
|
92 |
+
);
|
93 |
}
|
94 |
WPCALoader::add(plugin_dir_path(__FILE__), $this_wpca_version);
|
lib/wp-content-aware-engine/module/base.php
CHANGED
@@ -325,12 +325,21 @@ abstract class WPCAModule_Base
|
|
325 |
*/
|
326 |
final public function ajax_print_content()
|
327 |
{
|
328 |
-
if (!isset(
|
329 |
-
|
|
|
|
|
|
|
|
|
330 |
wp_die();
|
331 |
}
|
332 |
|
333 |
-
if (!
|
|
|
|
|
|
|
|
|
|
|
334 |
wp_die();
|
335 |
}
|
336 |
|
325 |
*/
|
326 |
final public function ajax_print_content()
|
327 |
{
|
328 |
+
if (!isset(
|
329 |
+
$_POST['current_id'],
|
330 |
+
$_POST['action'],
|
331 |
+
$_POST['paged'],
|
332 |
+
$_POST['post_type']
|
333 |
+
)) {
|
334 |
wp_die();
|
335 |
}
|
336 |
|
337 |
+
if (!check_ajax_referer(WPCACore::PREFIX . $_POST['current_id'], 'nonce', false)) {
|
338 |
+
wp_die();
|
339 |
+
}
|
340 |
+
|
341 |
+
$parent_type = get_post_type_object($_POST['post_type']);
|
342 |
+
if (!current_user_can($parent_type->cap->edit_post, $_POST['current_id'])) {
|
343 |
wp_die();
|
344 |
}
|
345 |
|
lib/wp-content-aware-engine/module/bp_member.php
CHANGED
@@ -29,7 +29,7 @@ class WPCAModule_bp_member extends WPCAModule_Base
|
|
29 |
parent::__construct('bp_member', __('BuddyPress Profiles', WPCA_DOMAIN));
|
30 |
$this->default_value = 0;
|
31 |
$this->placeholder = __('All Sections', WPCA_DOMAIN);
|
32 |
-
$this->icon = 'dashicons-buddicons-buddypress-logo';
|
33 |
$this->query_name = 'cbp';
|
34 |
}
|
35 |
|
29 |
parent::__construct('bp_member', __('BuddyPress Profiles', WPCA_DOMAIN));
|
30 |
$this->default_value = 0;
|
31 |
$this->placeholder = __('All Sections', WPCA_DOMAIN);
|
32 |
+
$this->icon = 'dashicons-buddicons-buddypress-logo:#d84800';
|
33 |
$this->query_name = 'cbp';
|
34 |
}
|
35 |
|
lib/wp-content-aware-engine/module/post_type.php
CHANGED
@@ -200,6 +200,7 @@ class WPCAModule_post_type extends WPCAModule_Base
|
|
200 |
foreach (get_post_types(['public' => true], 'names') as $post_type) {
|
201 |
$this->_post_types[$post_type] = $post_type;
|
202 |
}
|
|
|
203 |
}
|
204 |
return $this->_post_types;
|
205 |
}
|
200 |
foreach (get_post_types(['public' => true], 'names') as $post_type) {
|
201 |
$this->_post_types[$post_type] = $post_type;
|
202 |
}
|
203 |
+
unset($this->_post_types['guest-author']);
|
204 |
}
|
205 |
return $this->_post_types;
|
206 |
}
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: #
|
|
4 |
Tags: custom sidebars, sidebar, classic widgets, widget, bbpress, buddypress, sidebar manager
|
5 |
Requires at least: 5.0
|
6 |
Requires PHP: 5.6
|
7 |
-
Tested up to:
|
8 |
-
Stable tag: 3.
|
9 |
License: GPLv3
|
10 |
|
11 |
Display new sidebars on any post, page, category etc. Works with Classic Widgets, Block Widgets, and all themes!
|
@@ -81,14 +81,16 @@ Without writing any code, you can **modify the HTML and CSS classes** of widget
|
|
81 |
|
82 |
###Highlighted Premium Features
|
83 |
|
|
|
|
|
84 |
* **Sticky Sidebars & Widget Areas**
|
85 |
-
Make any sidebar or widget area sticky without hurting site performance. No jQuery and no bloat
|
86 |
* **Widget Areas after Paragraphs**
|
87 |
Display a widget area after a specific number or percentage of paragraphs in your content
|
88 |
* **Even More Display Conditions**
|
89 |
* Advanced Custom Fields data
|
90 |
* Meta Box data
|
91 |
-
*
|
92 |
* Referrer URLs
|
93 |
* Date Archives & Content by publish date
|
94 |
* BuddyPress Groups
|
@@ -186,6 +188,17 @@ Of course! Check out the links below:
|
|
186 |
|
187 |
####Highlights
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
= 3.17.2 =
|
190 |
|
191 |
* [updated] freemius sdk
|
@@ -215,30 +228,4 @@ Of course! Check out the links below:
|
|
215 |
* [new] option to disable all widgets at once in widget cleaner
|
216 |
* [fixed] pagination in buddypress groups condition
|
217 |
|
218 |
-
= 3.16.2 =
|
219 |
-
|
220 |
-
* [fixed] compatibility improvements
|
221 |
-
* [updated] wp-content-aware-engine library
|
222 |
-
* [updated] freemius sdk
|
223 |
-
|
224 |
-
= 3.16.1 =
|
225 |
-
|
226 |
-
* [fixed] warning on admin dashboard
|
227 |
-
|
228 |
-
= 3.16 =
|
229 |
-
|
230 |
-
* [new] enable condition type cache in toolbar menu
|
231 |
-
* [new] performance improvements
|
232 |
-
* [new] taxonomy condition added to cache system (all condition types supported now)
|
233 |
-
* [new] wordpress 5.8 support
|
234 |
-
* [new] minimum wordpress version 5.0
|
235 |
-
* [fixed] multiple taxonomy conditions now use AND properly on singular pages (long-standing bug)
|
236 |
-
* [updated] wp-content-aware-engine library
|
237 |
-
|
238 |
-
**Pro Plan:**
|
239 |
-
|
240 |
-
* [new] totem - display widgets in floating button
|
241 |
-
* [new] option to display container widget only if conditions are met
|
242 |
-
* [new] sticky support for ajax powered themes such as woodmart
|
243 |
-
|
244 |
See changelog.txt for previous changes.
|
4 |
Tags: custom sidebars, sidebar, classic widgets, widget, bbpress, buddypress, sidebar manager
|
5 |
Requires at least: 5.0
|
6 |
Requires PHP: 5.6
|
7 |
+
Tested up to: 6.0
|
8 |
+
Stable tag: 3.18
|
9 |
License: GPLv3
|
10 |
|
11 |
Display new sidebars on any post, page, category etc. Works with Classic Widgets, Block Widgets, and all themes!
|
81 |
|
82 |
###Highlighted Premium Features
|
83 |
|
84 |
+
* **Totem - Smart Floating Button**
|
85 |
+
Like the button you may have seen by Intercom or Helpscout, only this is for all your widgets
|
86 |
* **Sticky Sidebars & Widget Areas**
|
87 |
+
Make any sidebar or widget area sticky without hurting site performance. No jQuery and no bloat
|
88 |
* **Widget Areas after Paragraphs**
|
89 |
Display a widget area after a specific number or percentage of paragraphs in your content
|
90 |
* **Even More Display Conditions**
|
91 |
* Advanced Custom Fields data
|
92 |
* Meta Box data
|
93 |
+
* URLs + wildcards
|
94 |
* Referrer URLs
|
95 |
* Date Archives & Content by publish date
|
96 |
* BuddyPress Groups
|
188 |
|
189 |
####Highlights
|
190 |
|
191 |
+
= 3.18 =
|
192 |
+
|
193 |
+
* [new] wordpress 6.0 support
|
194 |
+
* [updated] ui improvements
|
195 |
+
* [updated] wp-content-aware-engine library
|
196 |
+
|
197 |
+
**Pro Plan:**
|
198 |
+
|
199 |
+
* [new] display condition for guest author name premium by shoofly solutions
|
200 |
+
* [new] ability to control totem location and design
|
201 |
+
|
202 |
= 3.17.2 =
|
203 |
|
204 |
* [updated] freemius sdk
|
228 |
* [new] option to disable all widgets at once in widget cleaner
|
229 |
* [fixed] pagination in buddypress groups condition
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
See changelog.txt for previous changes.
|