Version Description
Download this release
Release Info
Developer | danieliser |
Plugin | Popup Maker – Popup Forms, Optins & More |
Version | 1.7.21 |
Comparing to | |
See all releases |
Code changes from version 1.7.20 to 1.7.21
- assets/js/jquery.cookie.js +0 -118
- assets/js/jquery.cookie.min.js +0 -1
- classes/Admin/Ajax.php +1 -1
- classes/Admin/Popups.php +1 -1
- classes/Admin/Settings.php +4 -2
- classes/Admin/Templates.php +2 -2
- classes/Ajax.php +1 -1
- classes/Analytics.php +1 -1
- classes/AssetCache.php +8 -7
- classes/ConditionCallbacks.php +1 -1
- classes/Extension/Updater.php +1 -1
- classes/ListTable.php +2 -2
- classes/Model/Popup.php +1 -1
- classes/Newsletters.php +1 -1
- classes/Privacy.php +4 -3
- classes/Shortcode/Subscribe.php +2 -2
- classes/Site/Assets.php +0 -1
- classes/Utils/Array.php +64 -16
- includes/admin/class-pum-admin-upgrades.php +2 -2
- includes/admin/upgrades/class-pum-admin-upgrade-routine.php +2 -2
- includes/ajax-calls.php +2 -2
- includes/class-pum.php +1 -1
- includes/general-functions.php +1 -1
- includes/integrations/class-pum-cf7.php +1 -1
- includes/integrations/class-pum-gravity-forms.php +1 -1
- includes/popup-functions.php +1 -1
- includes/pum-sdk/freemius/assets/css/admin/account.css +1 -1
- includes/pum-sdk/freemius/assets/css/admin/affiliation.css +1 -1
- includes/pum-sdk/freemius/assets/css/admin/connect.css +1 -1
- includes/pum-sdk/freemius/assets/css/admin/dialog-boxes.css +1 -1
- includes/pum-sdk/freemius/assets/img/popup-maker.png +0 -0
- includes/pum-sdk/freemius/assets/scss/_colors.scss +3 -0
- includes/pum-sdk/freemius/assets/scss/_load.scss +4 -4
- includes/pum-sdk/freemius/assets/scss/_start.scss +3 -3
- includes/pum-sdk/freemius/assets/scss/_vars.scss +5 -5
- includes/pum-sdk/freemius/assets/scss/admin/_license-activation.scss +40 -0
- includes/pum-sdk/freemius/assets/scss/admin/_modal-common.scss +8 -0
- includes/pum-sdk/freemius/assets/scss/admin/_multisite-options.scss +40 -0
- includes/pum-sdk/freemius/assets/scss/admin/_tooltip.scss +66 -0
- includes/pum-sdk/freemius/assets/scss/admin/account.scss +51 -5
- includes/pum-sdk/freemius/assets/scss/admin/common.scss +217 -217
- includes/pum-sdk/freemius/assets/scss/admin/connect.scss +547 -520
- includes/pum-sdk/freemius/assets/scss/admin/dialog-boxes.scss +1 -0
- includes/pum-sdk/freemius/composer.json +0 -10
- includes/pum-sdk/freemius/config.php +372 -322
- includes/pum-sdk/freemius/gulpfile.js +0 -167
- includes/pum-sdk/freemius/includes/class-freemius.php +12682 -14305
assets/js/jquery.cookie.js
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery Cookie Plugin v1.4.1
|
3 |
-
* https://github.com/carhartl/jquery-cookie
|
4 |
-
*
|
5 |
-
* Copyright 2013 Klaus Hartl
|
6 |
-
* Released under the MIT license
|
7 |
-
*/
|
8 |
-
(function (factory) {
|
9 |
-
if (typeof define === 'function' && define.amd) {
|
10 |
-
// AMD
|
11 |
-
define(['jquery'], factory);
|
12 |
-
} else if (typeof exports === 'object') {
|
13 |
-
// CommonJS
|
14 |
-
factory(require('jquery'));
|
15 |
-
} else {
|
16 |
-
// Browser globals
|
17 |
-
factory(jQuery);
|
18 |
-
}
|
19 |
-
}(function ($) {
|
20 |
-
|
21 |
-
var pluses = /\+/g;
|
22 |
-
|
23 |
-
function encode(s) {
|
24 |
-
return config.raw ? s : encodeURIComponent(s);
|
25 |
-
}
|
26 |
-
|
27 |
-
function decode(s) {
|
28 |
-
return config.raw ? s : decodeURIComponent(s);
|
29 |
-
}
|
30 |
-
|
31 |
-
function stringifyCookieValue(value) {
|
32 |
-
return encode(config.json ? JSON.stringify(value) : String(value));
|
33 |
-
}
|
34 |
-
|
35 |
-
function parseCookieValue(s) {
|
36 |
-
if (s.indexOf('"') === 0) {
|
37 |
-
// This is a quoted cookie as according to RFC2068, unescape...
|
38 |
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
39 |
-
}
|
40 |
-
|
41 |
-
try {
|
42 |
-
// Replace server-side written pluses with spaces.
|
43 |
-
// If we can't decode the cookie, ignore it, it's unusable.
|
44 |
-
// If we can't parse the cookie, ignore it, it's unusable.
|
45 |
-
s = decodeURIComponent(s.replace(pluses, ' '));
|
46 |
-
return config.json ? JSON.parse(s) : s;
|
47 |
-
} catch (e) {
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
function read(s, converter) {
|
52 |
-
var value = config.raw ? s : parseCookieValue(s);
|
53 |
-
return $.isFunction(converter) ? converter(value) : value;
|
54 |
-
}
|
55 |
-
|
56 |
-
var config = $.cookie = function (key, value, options) {
|
57 |
-
|
58 |
-
// Write
|
59 |
-
|
60 |
-
if (value !== undefined && !$.isFunction(value)) {
|
61 |
-
options = $.extend({}, config.defaults, options);
|
62 |
-
|
63 |
-
if (typeof options.expires === 'number') {
|
64 |
-
var days = options.expires, t = options.expires = new Date();
|
65 |
-
t.setTime(+t + days * 864e+5);
|
66 |
-
}
|
67 |
-
|
68 |
-
return (document.cookie = [
|
69 |
-
encode(key), '=', stringifyCookieValue(value),
|
70 |
-
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
71 |
-
options.path ? '; path=' + options.path : '',
|
72 |
-
options.domain ? '; domain=' + options.domain : '',
|
73 |
-
options.secure ? '; secure' : ''
|
74 |
-
].join(''));
|
75 |
-
}
|
76 |
-
|
77 |
-
// Read
|
78 |
-
|
79 |
-
var result = key ? undefined : {};
|
80 |
-
|
81 |
-
// To prevent the for loop in the first place assign an empty array
|
82 |
-
// in case there are no cookies at all. Also prevents odd result when
|
83 |
-
// calling $.cookie().
|
84 |
-
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
85 |
-
|
86 |
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
87 |
-
var parts = cookies[i].split('=');
|
88 |
-
var name = decode(parts.shift());
|
89 |
-
var cookie = parts.join('=');
|
90 |
-
|
91 |
-
if (key && key === name) {
|
92 |
-
// If second argument (value) is a function it's a converter...
|
93 |
-
result = read(cookie, value);
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
|
97 |
-
// Prevent storing a cookie that we couldn't decode.
|
98 |
-
if (!key && (cookie = read(cookie)) !== undefined) {
|
99 |
-
result[name] = cookie;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
return result;
|
104 |
-
};
|
105 |
-
|
106 |
-
config.defaults = {};
|
107 |
-
|
108 |
-
$.removeCookie = function (key, options) {
|
109 |
-
if ($.cookie(key) === undefined) {
|
110 |
-
return false;
|
111 |
-
}
|
112 |
-
|
113 |
-
// Must not alter options, thus extending a fresh object...
|
114 |
-
$.cookie(key, '', $.extend({}, options, {expires: -1}));
|
115 |
-
return !$.cookie(key);
|
116 |
-
};
|
117 |
-
|
118 |
-
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/jquery.cookie.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function n(e){return u.raw?e:encodeURIComponent(e)}function o(e){return u.raw?e:decodeURIComponent(e)}function i(e){return n(u.json?JSON.stringify(e):String(e))}function r(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(c," ")),u.json?JSON.parse(e):e}catch(n){}}function t(n,o){var i=u.raw?n:r(n);return e.isFunction(o)?o(i):i}var c=/\+/g,u=e.cookie=function(r,c,f){if(void 0!==c&&!e.isFunction(c)){if(f=e.extend({},u.defaults,f),"number"==typeof f.expires){var a=f.expires,d=f.expires=new Date;d.setTime(+d+864e5*a)}return document.cookie=[n(r),"=",i(c),f.expires?"; expires="+f.expires.toUTCString():"",f.path?"; path="+f.path:"",f.domain?"; domain="+f.domain:"",f.secure?"; secure":""].join("")}for(var p=r?void 0:{},s=document.cookie?document.cookie.split("; "):[],m=0,x=s.length;m<x;m++){var v=s[m].split("="),k=o(v.shift()),l=v.join("=");if(r&&r===k){p=t(l,c);break}r||void 0===(l=t(l))||(p[k]=l)}return p};u.defaults={},e.removeCookie=function(n,o){return void 0!==e.cookie(n)&&(e.cookie(n,"",e.extend({},o,{expires:-1})),!e.cookie(n))}});
|
|
classes/Admin/Ajax.php
CHANGED
@@ -109,7 +109,7 @@ class PUM_Admin_Ajax {
|
|
109 |
$results['total_count'] += $query['total_count'];
|
110 |
break;
|
111 |
}
|
112 |
-
echo
|
113 |
die();
|
114 |
}
|
115 |
|
109 |
$results['total_count'] += $query['total_count'];
|
110 |
break;
|
111 |
}
|
112 |
+
echo PUM_Utils_Array::safe_json_encode( $results );
|
113 |
die();
|
114 |
}
|
115 |
|
classes/Admin/Popups.php
CHANGED
@@ -147,7 +147,7 @@ class PUM_Admin_Popups {
|
|
147 |
wp_enqueue_script( 'popup-maker-admin' );
|
148 |
?>
|
149 |
<script type="text/javascript">
|
150 |
-
window.pum_popup_settings_editor = <?php echo
|
151 |
'form_args' => array(
|
152 |
'id' => 'pum-popup-settings',
|
153 |
'tabs' => self::tabs(),
|
147 |
wp_enqueue_script( 'popup-maker-admin' );
|
148 |
?>
|
149 |
<script type="text/javascript">
|
150 |
+
window.pum_popup_settings_editor = <?php echo PUM_Utils_Array::safe_json_encode( apply_filters( 'pum_popup_settings_editor_var', array(
|
151 |
'form_args' => array(
|
152 |
'id' => 'pum-popup-settings',
|
153 |
'tabs' => self::tabs(),
|
classes/Admin/Settings.php
CHANGED
@@ -79,6 +79,8 @@ class PUM_Admin_Settings {
|
|
79 |
'type' => 'success',
|
80 |
'message' => __( 'Settings saved successfully!', 'popup-maker' ),
|
81 |
);
|
|
|
|
|
82 |
} else {
|
83 |
self::$notices[] = array(
|
84 |
'type' => 'error',
|
@@ -429,7 +431,7 @@ class PUM_Admin_Settings {
|
|
429 |
'assets' => array(
|
430 |
'disable_google_font_loading' => array(
|
431 |
'type' => 'checkbox',
|
432 |
-
'label' => __( 'Don
|
433 |
'desc' => __( 'Check this disable loading of google fonts, useful if the fonts you chose are already loaded with your theme.', 'popup-maker' ),
|
434 |
),
|
435 |
'disable_popup_maker_core_styles' => array(
|
@@ -506,7 +508,7 @@ class PUM_Admin_Settings {
|
|
506 |
</div>
|
507 |
|
508 |
<script type="text/javascript">
|
509 |
-
window.pum_settings_editor = <?php echo
|
510 |
'form_args' => array(
|
511 |
'id' => 'pum-settings',
|
512 |
'tabs' => self::tabs(),
|
79 |
'type' => 'success',
|
80 |
'message' => __( 'Settings saved successfully!', 'popup-maker' ),
|
81 |
);
|
82 |
+
|
83 |
+
do_action( 'pum_save_settings', $settings );
|
84 |
} else {
|
85 |
self::$notices[] = array(
|
86 |
'type' => 'error',
|
431 |
'assets' => array(
|
432 |
'disable_google_font_loading' => array(
|
433 |
'type' => 'checkbox',
|
434 |
+
'label' => __( "'Don't Load Google Fonts", 'popup-maker' ),
|
435 |
'desc' => __( 'Check this disable loading of google fonts, useful if the fonts you chose are already loaded with your theme.', 'popup-maker' ),
|
436 |
),
|
437 |
'disable_popup_maker_core_styles' => array(
|
508 |
</div>
|
509 |
|
510 |
<script type="text/javascript">
|
511 |
+
window.pum_settings_editor = <?php echo PUM_Utils_Array::safe_json_encode( apply_filters( 'pum_settings_editor_args', array(
|
512 |
'form_args' => array(
|
513 |
'id' => 'pum-settings',
|
514 |
'tabs' => self::tabs(),
|
classes/Admin/Templates.php
CHANGED
@@ -43,7 +43,7 @@ class PUM_Admin_Templates {
|
|
43 |
?>
|
44 |
|
45 |
<script type="text/html" id="tmpl-pum-field-mc_api_key">
|
46 |
-
<# var valid = data.value !== '' && <?php echo
|
47 |
<input type="{{valid ? 'password' : 'text'}}" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}}/>
|
48 |
<button type="button" class="pum-mci-check-api-key">
|
49 |
<?php _e( 'Check', 'popup-maker' ); ?>
|
@@ -481,7 +481,7 @@ class PUM_Admin_Templates {
|
|
481 |
|
482 |
<script type="text/html" id="tmpl-pum-trigger-add-type">
|
483 |
<#
|
484 |
-
var form_args = <?php echo
|
485 |
'id' => 'pum-add-trigger',
|
486 |
'fields' => array(
|
487 |
'popup_trigger_add_type' => array(
|
43 |
?>
|
44 |
|
45 |
<script type="text/html" id="tmpl-pum-field-mc_api_key">
|
46 |
+
<# var valid = data.value !== '' && <?php echo PUM_Utils_Array::safe_json_encode( pum_get_option( 'mci_api_key_is_valid', false ) ); ?>; #>
|
47 |
<input type="{{valid ? 'password' : 'text'}}" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}}/>
|
48 |
<button type="button" class="pum-mci-check-api-key">
|
49 |
<?php _e( 'Check', 'popup-maker' ); ?>
|
481 |
|
482 |
<script type="text/html" id="tmpl-pum-trigger-add-type">
|
483 |
<#
|
484 |
+
var form_args = <?php echo PUM_Utils_Array::safe_json_encode( array(
|
485 |
'id' => 'pum-add-trigger',
|
486 |
'fields' => array(
|
487 |
'popup_trigger_add_type' => array(
|
classes/Ajax.php
CHANGED
@@ -62,7 +62,7 @@ class PUM_Ajax {
|
|
62 |
*/
|
63 |
public static function serve_json( $data = 0 ) {
|
64 |
header( 'Content-Type: application/json' );
|
65 |
-
echo
|
66 |
exit;
|
67 |
}
|
68 |
|
62 |
*/
|
63 |
public static function serve_json( $data = 0 ) {
|
64 |
header( 'Content-Type: application/json' );
|
65 |
+
echo PUM_Utils_Array::safe_json_encode( $data );
|
66 |
exit;
|
67 |
}
|
68 |
|
classes/Analytics.php
CHANGED
@@ -196,7 +196,7 @@ class PUM_Analytics {
|
|
196 |
*/
|
197 |
public static function serve_json( $data = 0 ) {
|
198 |
header( 'Content-Type: application/json' );
|
199 |
-
echo
|
200 |
exit;
|
201 |
}
|
202 |
|
196 |
*/
|
197 |
public static function serve_json( $data = 0 ) {
|
198 |
header( 'Content-Type: application/json' );
|
199 |
+
echo PUM_Utils_Array::safe_json_encode( $data );
|
200 |
exit;
|
201 |
}
|
202 |
|
classes/AssetCache.php
CHANGED
@@ -55,6 +55,7 @@ class PUM_AssetCache {
|
|
55 |
add_action( 'pum_extension_deactivated', array( __CLASS__, 'reset_cache' ) );
|
56 |
add_action( 'pum_extension_activated', array( __CLASS__, 'reset_cache' ) );
|
57 |
add_action( 'pum_regenerate_asset_cache', array( __CLASS__, 'reset_cache' ) );
|
|
|
58 |
add_action( 'pum_save_popup', array( __CLASS__, 'reset_cache' ) );
|
59 |
add_action( 'popmake_save_popup_theme', array( __CLASS__, 'reset_cache' ) );
|
60 |
add_action( 'pum_update_core_version', array( __CLASS__, 'reset_cache' ) );
|
@@ -228,7 +229,7 @@ class PUM_AssetCache {
|
|
228 |
/** @var WP_Filesystem_Base $wp_filesystem */
|
229 |
global $wp_filesystem;
|
230 |
|
231 |
-
return $wp_filesystem->put_contents( $file, $contents, defined('FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : false );
|
232 |
}
|
233 |
|
234 |
/**
|
@@ -248,22 +249,22 @@ class PUM_AssetCache {
|
|
248 |
*/
|
249 |
$css = array(
|
250 |
'imports' => array(
|
251 |
-
'content'
|
252 |
-
'priority' => -1,
|
253 |
),
|
254 |
-
'core'
|
255 |
'content' => $core_css,
|
256 |
'priority' => 0,
|
257 |
),
|
258 |
-
'themes'
|
259 |
'content' => self::generate_popup_theme_styles(),
|
260 |
'priority' => 1,
|
261 |
),
|
262 |
-
'popups'
|
263 |
'content' => self::generate_popup_styles(),
|
264 |
'priority' => 15,
|
265 |
),
|
266 |
-
'custom'
|
267 |
'content' => self::custom_css(),
|
268 |
'priority' => 20,
|
269 |
),
|
55 |
add_action( 'pum_extension_deactivated', array( __CLASS__, 'reset_cache' ) );
|
56 |
add_action( 'pum_extension_activated', array( __CLASS__, 'reset_cache' ) );
|
57 |
add_action( 'pum_regenerate_asset_cache', array( __CLASS__, 'reset_cache' ) );
|
58 |
+
add_action( 'pum_save_settings', array( __CLASS__, 'reset_cache' ) );
|
59 |
add_action( 'pum_save_popup', array( __CLASS__, 'reset_cache' ) );
|
60 |
add_action( 'popmake_save_popup_theme', array( __CLASS__, 'reset_cache' ) );
|
61 |
add_action( 'pum_update_core_version', array( __CLASS__, 'reset_cache' ) );
|
229 |
/** @var WP_Filesystem_Base $wp_filesystem */
|
230 |
global $wp_filesystem;
|
231 |
|
232 |
+
return $wp_filesystem->put_contents( $file, $contents, defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : false );
|
233 |
}
|
234 |
|
235 |
/**
|
249 |
*/
|
250 |
$css = array(
|
251 |
'imports' => array(
|
252 |
+
'content' => self::generate_font_imports(),
|
253 |
+
'priority' => - 1,
|
254 |
),
|
255 |
+
'core' => array(
|
256 |
'content' => $core_css,
|
257 |
'priority' => 0,
|
258 |
),
|
259 |
+
'themes' => array(
|
260 |
'content' => self::generate_popup_theme_styles(),
|
261 |
'priority' => 1,
|
262 |
),
|
263 |
+
'popups' => array(
|
264 |
'content' => self::generate_popup_styles(),
|
265 |
'priority' => 15,
|
266 |
),
|
267 |
+
'custom' => array(
|
268 |
'content' => self::custom_css(),
|
269 |
'priority' => 20,
|
270 |
),
|
classes/ConditionCallbacks.php
CHANGED
@@ -41,7 +41,7 @@ class PUM_ConditionCallbacks {
|
|
41 |
|
42 |
case 'ID':
|
43 |
case 'selected':
|
44 |
-
if ( self::is_post_type( $post_type ) && in_array( $post->ID, wp_parse_id_list( $selected ) ) ) {
|
45 |
return true;
|
46 |
}
|
47 |
break;
|
41 |
|
42 |
case 'ID':
|
43 |
case 'selected':
|
44 |
+
if ( self::is_post_type( $post_type ) && is_singular( $post_type ) && in_array( $post->ID, wp_parse_id_list( $selected ) ) ) {
|
45 |
return true;
|
46 |
}
|
47 |
break;
|
classes/Extension/Updater.php
CHANGED
@@ -472,7 +472,7 @@ class PUM_Extension_Updater {
|
|
472 |
|
473 |
$data = array(
|
474 |
'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
|
475 |
-
'value' =>
|
476 |
);
|
477 |
|
478 |
update_option( $cache_key, $data );
|
472 |
|
473 |
$data = array(
|
474 |
'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
|
475 |
+
'value' => PUM_Utils_Array::safe_json_encode( $value )
|
476 |
);
|
477 |
|
478 |
update_option( $cache_key, $data );
|
classes/ListTable.php
CHANGED
@@ -1307,7 +1307,7 @@ class PUM_ListTable {
|
|
1307 |
$response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
|
1308 |
}
|
1309 |
|
1310 |
-
die(
|
1311 |
}
|
1312 |
|
1313 |
/**
|
@@ -1323,6 +1323,6 @@ class PUM_ListTable {
|
|
1323 |
)
|
1324 |
);
|
1325 |
|
1326 |
-
printf( "<script type='text/javascript'>list_args = %s;</script>\n",
|
1327 |
}
|
1328 |
}
|
1307 |
$response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
|
1308 |
}
|
1309 |
|
1310 |
+
die( PUM_Utils_Array::safe_json_encode( $response ) );
|
1311 |
}
|
1312 |
|
1313 |
/**
|
1323 |
)
|
1324 |
);
|
1325 |
|
1326 |
+
printf( "<script type='text/javascript'>list_args = %s;</script>\n", PUM_Utils_Array::safe_json_encode( $args ) );
|
1327 |
}
|
1328 |
}
|
classes/Model/Popup.php
CHANGED
@@ -625,7 +625,7 @@ class PUM_Model_Popup extends PUM_Model_Post {
|
|
625 |
'js_only' => null,
|
626 |
) );
|
627 |
|
628 |
-
$cache_key = hash( 'md5',
|
629 |
|
630 |
// Check if these exclusion filters have already been applied and prevent extra processing.
|
631 |
$conditions = isset( $this->conditions_filtered[ $cache_key ] ) ? $this->conditions_filtered[ $cache_key ] : false;
|
625 |
'js_only' => null,
|
626 |
) );
|
627 |
|
628 |
+
$cache_key = hash( 'md5', PUM_Utils_Array::safe_json_encode( $filters ) );
|
629 |
|
630 |
// Check if these exclusion filters have already been applied and prevent extra processing.
|
631 |
$conditions = isset( $this->conditions_filtered[ $cache_key ] ) ? $this->conditions_filtered[ $cache_key ] : false;
|
classes/Newsletters.php
CHANGED
@@ -235,7 +235,7 @@ class PUM_Newsletters {
|
|
235 |
$values['name'] = '';
|
236 |
$values['fname'] = '';
|
237 |
$values['lname'] = '';
|
238 |
-
$values['email'] = wp_privacy_anonymize_data( 'email', $values['email'] );
|
239 |
}
|
240 |
|
241 |
// Split name into fname & lname or vice versa.
|
235 |
$values['name'] = '';
|
236 |
$values['fname'] = '';
|
237 |
$values['lname'] = '';
|
238 |
+
$values['email'] = function_exists( 'wp_privacy_anonymize_data' ) ? wp_privacy_anonymize_data( 'email', $values['email'] ) : 'deleted@site.invalid';
|
239 |
}
|
240 |
|
241 |
// Split name into fname & lname or vice versa.
|
classes/Privacy.php
CHANGED
@@ -50,9 +50,10 @@ class PUM_Privacy {
|
|
50 |
<h3><?php _e( 'Subscription forms', 'popup-maker' ); ?></h3>
|
51 |
<p class="privacy-policy-tutorial"><?php _e( 'Popup Maker subscription forms are not enabled by default.', 'popup-maker' ); ?></p>
|
52 |
<p class="privacy-policy-tutorial"><?php _e( 'If you have used them in your popups to collect email subscribers, use this subsection to note what personal data is captured when someone submits a subscription form, and how long you keep it.', 'popup-maker' ); ?></p>
|
53 |
-
<p class="privacy-policy-tutorial"><?php _e( 'For example, you may note that you keep form submissions for
|
54 |
-
<p><?php echo $suggested_text . __( 'If you submit
|
55 |
-
<p><?php _e( 'These subscriptions are
|
|
|
56 |
|
57 |
<h3><?php _e( 'Cookies', 'popup-maker' ); ?></h3>
|
58 |
<p class="privacy-policy-tutorial"><?php _e( 'Popup Maker uses cookies for most popups. The primary function is to prevent your users from being annoyed by seeing the same popup repeatedly.', 'popup-maker' ); ?></p>
|
50 |
<h3><?php _e( 'Subscription forms', 'popup-maker' ); ?></h3>
|
51 |
<p class="privacy-policy-tutorial"><?php _e( 'Popup Maker subscription forms are not enabled by default.', 'popup-maker' ); ?></p>
|
52 |
<p class="privacy-policy-tutorial"><?php _e( 'If you have used them in your popups to collect email subscribers, use this subsection to note what personal data is captured when someone submits a subscription form, and how long you keep it.', 'popup-maker' ); ?></p>
|
53 |
+
<p class="privacy-policy-tutorial"><?php _e( 'For example, you may note that you keep form submissions for ongoing marketing purposes.', 'popup-maker' ); ?></p>
|
54 |
+
<p><?php echo $suggested_text . __( 'If you submit a subscription form on our site you will be opting in for us to save your name, email address and other relevant information.', 'popup-maker' ); ?></p>
|
55 |
+
<p><?php _e( 'These subscriptions are used to notify you about related content, discounts & other special offers.', 'popup-maker' ); ?></p>
|
56 |
+
<p><?php _e( 'You can opt our or unsubscribe at any time in the future by clicking link in the bottom of any email.', 'popup-maker' ); ?></p>
|
57 |
|
58 |
<h3><?php _e( 'Cookies', 'popup-maker' ); ?></h3>
|
59 |
<p class="privacy-policy-tutorial"><?php _e( 'Popup Maker uses cookies for most popups. The primary function is to prevent your users from being annoyed by seeing the same popup repeatedly.', 'popup-maker' ); ?></p>
|
classes/Shortcode/Subscribe.php
CHANGED
@@ -492,7 +492,7 @@ class PUM_Shortcode_Subscribe extends PUM_Shortcode {
|
|
492 |
) ); ?>
|
493 |
|
494 |
|
495 |
-
<form class="<?php esc_attr_e( $classes ); ?>" data-settings="<?php esc_attr_e(
|
496 |
|
497 |
<?php do_action( 'pum_sub_form_before', $atts ); ?>
|
498 |
|
@@ -572,7 +572,7 @@ class PUM_Shortcode_Subscribe extends PUM_Shortcode {
|
|
572 |
);
|
573 |
?>
|
574 |
|
575 |
-
<input type="hidden" name="consent_args" value="<?php echo esc_attr(
|
576 |
|
577 |
<div class="pum-form__field pum-form__field--<?php echo esc_attr( $atts['privacy_consent_type'] ); ?> pum-form__field--consent pum-sub-form-field">
|
578 |
<?php switch ( $atts['privacy_consent_type'] ) {
|
492 |
) ); ?>
|
493 |
|
494 |
|
495 |
+
<form class="<?php esc_attr_e( $classes ); ?>" data-settings="<?php esc_attr_e( PUM_Utils_Array::safe_json_encode( $data_attr ) ); ?>">
|
496 |
|
497 |
<?php do_action( 'pum_sub_form_before', $atts ); ?>
|
498 |
|
572 |
);
|
573 |
?>
|
574 |
|
575 |
+
<input type="hidden" name="consent_args" value="<?php echo esc_attr( PUM_Utils_Array::safe_json_encode( $consent_args ) ); ?>" />
|
576 |
|
577 |
<div class="pum-form__field pum-form__field--<?php echo esc_attr( $atts['privacy_consent_type'] ); ?> pum-form__field--consent pum-sub-form-field">
|
578 |
<?php switch ( $atts['privacy_consent_type'] ) {
|
classes/Site/Assets.php
CHANGED
@@ -172,7 +172,6 @@ class PUM_Site_Assets {
|
|
172 |
self::$scripts_registered = true;
|
173 |
|
174 |
wp_register_script( 'mobile-detect', self::$js_url . 'mobile-detect' . self::$suffix . '.js', null, '1.3.3', true );
|
175 |
-
wp_register_script( 'jquery-cookie', self::$js_url . 'jquery.cookie' . self::$suffix . '.js', array('jquery'), '1.4.1', true );
|
176 |
wp_register_script( 'iframe-resizer', self::$js_url . 'iframeResizer' . self::$suffix . '.js', array( 'jquery' ) );
|
177 |
|
178 |
if ( PUM_AssetCache::writeable() ) {
|
172 |
self::$scripts_registered = true;
|
173 |
|
174 |
wp_register_script( 'mobile-detect', self::$js_url . 'mobile-detect' . self::$suffix . '.js', null, '1.3.3', true );
|
|
|
175 |
wp_register_script( 'iframe-resizer', self::$js_url . 'iframeResizer' . self::$suffix . '.js', array( 'jquery' ) );
|
176 |
|
177 |
if ( PUM_AssetCache::writeable() ) {
|
classes/Utils/Array.php
CHANGED
@@ -101,8 +101,8 @@ class PUM_Utils_Array {
|
|
101 |
/**
|
102 |
* Pluck all array keys beginning with string.
|
103 |
*
|
104 |
-
* @param array
|
105 |
-
* @param bool|string|array
|
106 |
*
|
107 |
* @return array
|
108 |
*/
|
@@ -115,8 +115,8 @@ class PUM_Utils_Array {
|
|
115 |
/**
|
116 |
* Pluck all array keys ending with string.
|
117 |
*
|
118 |
-
* @param array
|
119 |
-
* @param bool|string|array
|
120 |
*
|
121 |
* @return array
|
122 |
*/
|
@@ -129,8 +129,8 @@ class PUM_Utils_Array {
|
|
129 |
/**
|
130 |
* Pluck all array keys ending with string.
|
131 |
*
|
132 |
-
* @param array
|
133 |
-
* @param bool|string|array
|
134 |
*
|
135 |
* @return array
|
136 |
*/
|
@@ -143,8 +143,8 @@ class PUM_Utils_Array {
|
|
143 |
/**
|
144 |
* Remove all array keys beginning with string.
|
145 |
*
|
146 |
-
* @param array
|
147 |
-
* @param bool|string|array
|
148 |
*
|
149 |
* @return array
|
150 |
*/
|
@@ -158,7 +158,7 @@ class PUM_Utils_Array {
|
|
158 |
}
|
159 |
|
160 |
foreach ( $array as $key => $value ) {
|
161 |
-
foreach( $strings as $string ) {
|
162 |
if ( strpos( $key, $string ) === 0 ) {
|
163 |
unset( $array[ $key ] );
|
164 |
}
|
@@ -171,8 +171,8 @@ class PUM_Utils_Array {
|
|
171 |
/**
|
172 |
* Remove all array keys ending with string.
|
173 |
*
|
174 |
-
* @param array
|
175 |
-
* @param bool|string|array
|
176 |
*
|
177 |
* @return array
|
178 |
*/
|
@@ -186,10 +186,10 @@ class PUM_Utils_Array {
|
|
186 |
}
|
187 |
|
188 |
foreach ( $array as $key => $value ) {
|
189 |
-
foreach( $strings as $string ) {
|
190 |
$length = strlen( $string );
|
191 |
|
192 |
-
if ( substr( $key,
|
193 |
unset( $array[ $key ] );
|
194 |
}
|
195 |
}
|
@@ -201,8 +201,8 @@ class PUM_Utils_Array {
|
|
201 |
/**
|
202 |
* Remove all array keys containing string.
|
203 |
*
|
204 |
-
* @param array
|
205 |
-
* @param bool|string|array
|
206 |
*
|
207 |
* @return array
|
208 |
*/
|
@@ -217,7 +217,7 @@ class PUM_Utils_Array {
|
|
217 |
}
|
218 |
|
219 |
foreach ( $array as $key => $value ) {
|
220 |
-
foreach( $strings as $string ) {
|
221 |
if ( strpos( $key, $string ) !== false ) {
|
222 |
unset( $array[ $key ] );
|
223 |
}
|
@@ -325,5 +325,53 @@ class PUM_Utils_Array {
|
|
325 |
return $new;
|
326 |
}
|
327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
}
|
329 |
|
101 |
/**
|
102 |
* Pluck all array keys beginning with string.
|
103 |
*
|
104 |
+
* @param array $array
|
105 |
+
* @param bool|string|array $strings
|
106 |
*
|
107 |
* @return array
|
108 |
*/
|
115 |
/**
|
116 |
* Pluck all array keys ending with string.
|
117 |
*
|
118 |
+
* @param array $array
|
119 |
+
* @param bool|string|array $strings
|
120 |
*
|
121 |
* @return array
|
122 |
*/
|
129 |
/**
|
130 |
* Pluck all array keys ending with string.
|
131 |
*
|
132 |
+
* @param array $array
|
133 |
+
* @param bool|string|array $strings
|
134 |
*
|
135 |
* @return array
|
136 |
*/
|
143 |
/**
|
144 |
* Remove all array keys beginning with string.
|
145 |
*
|
146 |
+
* @param array $array
|
147 |
+
* @param bool|string|array $strings
|
148 |
*
|
149 |
* @return array
|
150 |
*/
|
158 |
}
|
159 |
|
160 |
foreach ( $array as $key => $value ) {
|
161 |
+
foreach ( $strings as $string ) {
|
162 |
if ( strpos( $key, $string ) === 0 ) {
|
163 |
unset( $array[ $key ] );
|
164 |
}
|
171 |
/**
|
172 |
* Remove all array keys ending with string.
|
173 |
*
|
174 |
+
* @param array $array
|
175 |
+
* @param bool|string|array $strings
|
176 |
*
|
177 |
* @return array
|
178 |
*/
|
186 |
}
|
187 |
|
188 |
foreach ( $array as $key => $value ) {
|
189 |
+
foreach ( $strings as $string ) {
|
190 |
$length = strlen( $string );
|
191 |
|
192 |
+
if ( substr( $key, - $length ) === $string ) {
|
193 |
unset( $array[ $key ] );
|
194 |
}
|
195 |
}
|
201 |
/**
|
202 |
* Remove all array keys containing string.
|
203 |
*
|
204 |
+
* @param array $array
|
205 |
+
* @param bool|string|array $strings
|
206 |
*
|
207 |
* @return array
|
208 |
*/
|
217 |
}
|
218 |
|
219 |
foreach ( $array as $key => $value ) {
|
220 |
+
foreach ( $strings as $string ) {
|
221 |
if ( strpos( $key, $string ) !== false ) {
|
222 |
unset( $array[ $key ] );
|
223 |
}
|
325 |
return $new;
|
326 |
}
|
327 |
|
328 |
+
/**
|
329 |
+
* Ensures proper encoding for strings before json_encode is used.
|
330 |
+
*
|
331 |
+
* @param array|string $data
|
332 |
+
*
|
333 |
+
* @return mixed|string
|
334 |
+
*/
|
335 |
+
public static function safe_json_encode( $data = array() ) {
|
336 |
+
return wp_json_encode( self:: make_safe_for_json_encode( $data ) );
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* json_encode only accepts valid UTF8 characters, thus we need to properly convert translations and other data to proper utf.
|
341 |
+
*
|
342 |
+
* This function does that recursively.
|
343 |
+
*
|
344 |
+
* @param array|string $data
|
345 |
+
*
|
346 |
+
* @return array|string
|
347 |
+
*/
|
348 |
+
public static function make_safe_for_json_encode( $data = array() ) {
|
349 |
+
if ( is_scalar( $data ) ) {
|
350 |
+
return html_entity_decode( (string) $data, ENT_QUOTES, 'UTF-8' );
|
351 |
+
}
|
352 |
+
|
353 |
+
foreach ( (array) $data as $key => $value ) {
|
354 |
+
if ( is_scalar( $value ) ) {
|
355 |
+
$data[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
|
356 |
+
} elseif ( is_array( $value ) ) {
|
357 |
+
$data[ $key ] = self::make_safe_for_json_encode( $value );
|
358 |
+
}
|
359 |
+
}
|
360 |
+
|
361 |
+
return $data;
|
362 |
+
}
|
363 |
+
|
364 |
+
|
365 |
+
public static function utf8_encode_recursive( $d ) {
|
366 |
+
if ( is_array( $d ) ) {
|
367 |
+
foreach ( $d as $k => $v ) {
|
368 |
+
$d[ $k ] = self::utf8_encode_recursive( $v );
|
369 |
+
}
|
370 |
+
} else if ( is_string( $d ) ) {
|
371 |
+
return utf8_encode( $d );
|
372 |
+
}
|
373 |
+
|
374 |
+
return $d;
|
375 |
+
}
|
376 |
}
|
377 |
|
includes/admin/class-pum-admin-upgrades.php
CHANGED
@@ -294,7 +294,7 @@ class PUM_Admin_Upgrades {
|
|
294 |
$this->process_upgrades();
|
295 |
|
296 |
if ( DOING_AJAX ) {
|
297 |
-
echo
|
298 |
'complete' => true,
|
299 |
'status' => sprintf(
|
300 |
'<strong>%s</strong><br/>%s',
|
@@ -659,7 +659,7 @@ class PUM_Admin_Upgrades {
|
|
659 |
|
660 |
$(document).ready(function () {
|
661 |
// Trigger upgrades on page load
|
662 |
-
next_step(<?php echo
|
663 |
update_status('<?php printf( '<strong>%s</strong>', $this->get_upgrade( $this->get_arg( 'pum-upgrade' ) ) ); ?>');
|
664 |
});
|
665 |
}(jQuery, document));
|
294 |
$this->process_upgrades();
|
295 |
|
296 |
if ( DOING_AJAX ) {
|
297 |
+
echo PUM_Utils_Array::safe_json_encode( array(
|
298 |
'complete' => true,
|
299 |
'status' => sprintf(
|
300 |
'<strong>%s</strong><br/>%s',
|
659 |
|
660 |
$(document).ready(function () {
|
661 |
// Trigger upgrades on page load
|
662 |
+
next_step(<?php echo PUM_Utils_Array::safe_json_encode( $this->get_args() ); ?>);
|
663 |
update_status('<?php printf( '<strong>%s</strong>', $this->get_upgrade( $this->get_arg( 'pum-upgrade' ) ) ); ?>');
|
664 |
});
|
665 |
}(jQuery, document));
|
includes/admin/upgrades/class-pum-admin-upgrade-routine.php
CHANGED
@@ -56,7 +56,7 @@ class PUM_Admin_Upgrade_Routine {
|
|
56 |
$upgrades->step_up();
|
57 |
|
58 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
59 |
-
echo
|
60 |
'status' => sprintf( __( 'Step %d of approximately %d running', 'popup-maker' ), $upgrades->get_arg( 'step' ), $upgrades->get_arg( 'steps' ) ),
|
61 |
'next' => $upgrades->get_args(),
|
62 |
) );
|
@@ -87,7 +87,7 @@ class PUM_Admin_Upgrade_Routine {
|
|
87 |
$upgrades->set_arg( 'completed', 0 );
|
88 |
$upgrades->set_arg( 'pum-upgrade', $next_routine );
|
89 |
|
90 |
-
echo
|
91 |
'status' => sprintf( '<strong>%s</strong>', $upgrades->get_upgrade( $next_routine ) ),
|
92 |
'next' => $upgrades->get_args(),
|
93 |
) );
|
56 |
$upgrades->step_up();
|
57 |
|
58 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
59 |
+
echo PUM_Utils_Array::safe_json_encode( array(
|
60 |
'status' => sprintf( __( 'Step %d of approximately %d running', 'popup-maker' ), $upgrades->get_arg( 'step' ), $upgrades->get_arg( 'steps' ) ),
|
61 |
'next' => $upgrades->get_args(),
|
62 |
) );
|
87 |
$upgrades->set_arg( 'completed', 0 );
|
88 |
$upgrades->set_arg( 'pum-upgrade', $next_routine );
|
89 |
|
90 |
+
echo PUM_Utils_Array::safe_json_encode( array(
|
91 |
'status' => sprintf( '<strong>%s</strong>', $upgrades->get_upgrade( $next_routine ) ),
|
92 |
'next' => $upgrades->get_args(),
|
93 |
) );
|
includes/ajax-calls.php
CHANGED
@@ -19,7 +19,7 @@ function popmake_optin_ajax_call() {
|
|
19 |
$response['success'] = true;
|
20 |
}
|
21 |
$response['new_nonce'] = wp_create_nonce( POPMAKE_NONCE );
|
22 |
-
echo
|
23 |
die();
|
24 |
}
|
25 |
|
@@ -41,7 +41,7 @@ function popmake_popup_preview_content_ajax_call() {
|
|
41 |
header( "Cache-Control: no-cache, must-revalidate" );
|
42 |
header( "Pragma: no-cache" );
|
43 |
header( "Content-type: text/x-json" );
|
44 |
-
echo
|
45 |
die();
|
46 |
}
|
47 |
|
19 |
$response['success'] = true;
|
20 |
}
|
21 |
$response['new_nonce'] = wp_create_nonce( POPMAKE_NONCE );
|
22 |
+
echo PUM_Utils_Array::safe_json_encode( $response );
|
23 |
die();
|
24 |
}
|
25 |
|
41 |
header( "Cache-Control: no-cache, must-revalidate" );
|
42 |
header( "Pragma: no-cache" );
|
43 |
header( "Content-type: text/x-json" );
|
44 |
+
echo PUM_Utils_Array::safe_json_encode( $response );
|
45 |
die();
|
46 |
}
|
47 |
|
includes/class-pum.php
CHANGED
@@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
7 |
|
8 |
class PUM {
|
9 |
|
10 |
-
const VER = '1.7.
|
11 |
|
12 |
const DB_VER = 8;
|
13 |
|
7 |
|
8 |
class PUM {
|
9 |
|
10 |
+
const VER = '1.7.21';
|
11 |
|
12 |
const DB_VER = 8;
|
13 |
|
includes/general-functions.php
CHANGED
@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
8 |
if ( ! function_exists( 'maybe_json_attr' ) ) {
|
9 |
function maybe_json_attr( $value, $encode = false ) {
|
10 |
if ( is_object( $value ) || is_array( $value ) ) {
|
11 |
-
return $encode ? htmlspecialchars(
|
12 |
}
|
13 |
return $value;
|
14 |
}
|
8 |
if ( ! function_exists( 'maybe_json_attr' ) ) {
|
9 |
function maybe_json_attr( $value, $encode = false ) {
|
10 |
if ( is_object( $value ) || is_array( $value ) ) {
|
11 |
+
return $encode ? htmlspecialchars( PUM_Utils_Array::safe_json_encode( $value ) ) : PUM_Utils_Array::safe_json_encode( $value );
|
12 |
}
|
13 |
return $value;
|
14 |
}
|
includes/integrations/class-pum-cf7.php
CHANGED
@@ -54,7 +54,7 @@ class PUM_CF7_Integration {
|
|
54 |
public static function form_elements( $elements ) {
|
55 |
$form = wpcf7_get_current_contact_form();
|
56 |
|
57 |
-
$settings =
|
58 |
|
59 |
return $elements . "<input type='hidden' class='wpcf7-pum' value='$settings' />";
|
60 |
}
|
54 |
public static function form_elements( $elements ) {
|
55 |
$form = wpcf7_get_current_contact_form();
|
56 |
|
57 |
+
$settings = PUM_Utils_Array::safe_json_encode( self::form_options( $form->id() ) );
|
58 |
|
59 |
return $elements . "<input type='hidden' class='wpcf7-pum' value='$settings' />";
|
60 |
}
|
includes/integrations/class-pum-gravity-forms.php
CHANGED
@@ -58,7 +58,7 @@ class PUM_Gravity_Forms_Integation {
|
|
58 |
|
59 |
|
60 |
public static function get_form( $form_string, $form ) {
|
61 |
-
$settings =
|
62 |
$field = "<input type='hidden' class='gforms-pum' value='$settings' />";
|
63 |
$form_string = preg_replace( '/(<form.*>)/', "$1 \r\n " . $field, $form_string );
|
64 |
|
58 |
|
59 |
|
60 |
public static function get_form( $form_string, $form ) {
|
61 |
+
$settings = PUM_Utils_Array::safe_json_encode( self::form_options( $form['id'] ) );
|
62 |
$field = "<input type='hidden' class='gforms-pum' value='$settings' />";
|
63 |
$form_string = preg_replace( '/(<form.*>)/', "$1 \r\n " . $field, $form_string );
|
64 |
|
includes/popup-functions.php
CHANGED
@@ -277,7 +277,7 @@ function popmake_clean_popup_data_attr( $data_attr ) {
|
|
277 |
* @param int $popup_id
|
278 |
*/
|
279 |
function popmake_the_popup_data_attr( $popup_id = null ) {
|
280 |
-
echo 'data-popmake="' . esc_attr(
|
281 |
}
|
282 |
|
283 |
/**
|
277 |
* @param int $popup_id
|
278 |
*/
|
279 |
function popmake_the_popup_data_attr( $popup_id = null ) {
|
280 |
+
echo 'data-popmake="' . esc_attr( PUM_Utils_Array::safe_json_encode( popmake_get_the_popup_data_attr( $popup_id ) ) ) . '"';
|
281 |
}
|
282 |
|
283 |
/**
|
includes/pum-sdk/freemius/assets/css/admin/account.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_account .postbox,#fs_account .widefat{max-width:700px}#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 .
|
1 |
+
#fs_account .postbox,#fs_account .widefat{max-width:700px}#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:0.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}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:grey;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%}
|
includes/pum-sdk/freemius/assets/css/admin/affiliation.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@charset "UTF-8";#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{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}
|
1 |
+
@charset "UTF-8";#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}
|
includes/pum-sdk/freemius/assets/css/admin/connect.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,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,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,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 .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:' \279C'}#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 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions .fs-trigger{font-size:0.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 div{margin-left:55px}#fs_connect .fs-permissions ul li div span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li div p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{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:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}.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:' \000bb'}.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 div{margin-right:55px;margin-left:0}.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,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:white;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,0.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}
|
1 |
+
#fs_connect{width:480px;-moz-box-shadow:0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:0px 1px 2px rgba(0,0,0,0.3);box-shadow:0px 1px 2px rgba(0,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,0.1);-webkit-box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 1px 0 rgba(0,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 #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:' \279C'}#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 0.5s ease;-o-transition:background 0.5s ease;-ms-transition:background 0.5s ease;-webkit-transition:background 0.5s ease;transition:background 0.5s ease}#fs_connect .fs-permissions .fs-license-sync-disclaimer{text-align:center;margin-top:0}#fs_connect .fs-permissions .fs-trigger{font-size:0.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 div{margin-left:55px}#fs_connect .fs-permissions ul li div span{font-weight:bold;text-transform:uppercase;color:#23282d}#fs_connect .fs-permissions ul li div p{margin:2px 0 0 0}#fs_connect .fs-permissions.fs-open{background:#fff}#fs_connect .fs-permissions.fs-open ul{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:0.85em;padding:5px;background:rgba(0,0,0,0.05)}#fs_connect .fs-terms,#fs_connect .fs-terms a{color:#999}#fs_connect .fs-terms a{text-decoration:none}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #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 0.3s ease-in-out;-o-transition:opacity 0.3s ease-in-out;-ms-transition:opacity 0.3s ease-in-out;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.3s ease-in-out;position:absolute;background:rgba(0,0,0,0.8);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,0.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.2);box-shadow:1px 1px 1px rgba(0,0,0,0.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right}.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,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}.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:' \000bb'}.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 div{margin-right:55px;margin-left:0}.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,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:white;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,0.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}
|
includes/pum-sdk/freemius/assets/css/admin/dialog-boxes.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.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:#eeeeee 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:0.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 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.fs-modal .fs-modal-header .fs-close:hover{color:#fff;background:#aaa}.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:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{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}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{float:left}.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-license-activation .fs-modal-body input.license_key{width:100%}.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}}
|
2 |
.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-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:0.3;-o-transform:0.3;-ms-transform:0.3;-webkit-transform:0.3;transform:0.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}
|
1 |
+
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.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:#eeeeee 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:0.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 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;-webkit-transition:all 0.2s ease-in-out;transition:all 0.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:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{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}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{float:left}.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-license-activation .fs-modal-body input.license_key{width:100%}#license_options_container table,#license_options_container table select,#license_options_container table #available_license_key{width:100%}#license_options_container table td:first-child{width:1%}#license_options_container table #other_license_key_container label{position:relative;top:6px;float:left;margin-right:5px}#license_options_container table #other_license_key_container div{overflow:hidden;width:auto;height:30px;display:block;top:2px;position:relative}#license_options_container table #other_license_key_container div input{margin:0}#sites_list_container td{cursor:pointer}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #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}}
|
2 |
.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-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:0.3;-o-transform:0.3;-ms-transform:0.3;-webkit-transform:0.3;transform:0.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}
|
includes/pum-sdk/freemius/assets/img/popup-maker.png
DELETED
Binary file
|
includes/pum-sdk/freemius/assets/scss/_colors.scss
CHANGED
@@ -63,3 +63,6 @@ $linkedin_color: #4875b4;
|
|
63 |
$youtube_color: #ff3333;
|
64 |
$gplus_color: #c63d2d;
|
65 |
|
|
|
|
|
|
63 |
$youtube_color: #ff3333;
|
64 |
$gplus_color: #c63d2d;
|
65 |
|
66 |
+
// Tooltip
|
67 |
+
$tooltip-color: #fff;
|
68 |
+
$tooltip-bkg-color: rgba(0,0,0,0.8);
|
includes/pum-sdk/freemius/assets/scss/_load.scss
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
@import 'mixins';
|
2 |
-
@import "vars";
|
3 |
-
@import "functions";
|
4 |
-
@import "colors";
|
1 |
+
@import 'mixins';
|
2 |
+
@import "vars";
|
3 |
+
@import "functions";
|
4 |
+
@import "colors";
|
includes/pum-sdk/freemius/assets/scss/_start.scss
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
@import "vars";
|
2 |
-
@import "colors";
|
3 |
-
@import "mixins";
|
4 |
@import "functions";
|
1 |
+
@import "vars";
|
2 |
+
@import "colors";
|
3 |
+
@import "mixins";
|
4 |
@import "functions";
|
includes/pum-sdk/freemius/assets/scss/_vars.scss
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
$is_production: true;
|
2 |
-
|
3 |
-
$img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
|
4 |
-
|
5 |
-
$layout_width: 960px;
|
6 |
$admin_mobile_max_width: 782px;
|
1 |
+
$is_production: true;
|
2 |
+
|
3 |
+
$img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
|
4 |
+
|
5 |
+
$layout_width: 960px;
|
6 |
$admin_mobile_max_width: 782px;
|
includes/pum-sdk/freemius/assets/scss/admin/_license-activation.scss
CHANGED
@@ -4,4 +4,44 @@
|
|
4 |
width: 100%;
|
5 |
}
|
6 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
}
|
4 |
width: 100%;
|
5 |
}
|
6 |
}
|
7 |
+
}
|
8 |
+
|
9 |
+
#license_options_container {
|
10 |
+
table {
|
11 |
+
&, select, #available_license_key {
|
12 |
+
width: 100%;
|
13 |
+
}
|
14 |
+
|
15 |
+
td:first-child {
|
16 |
+
width: 1%;
|
17 |
+
}
|
18 |
+
|
19 |
+
#other_license_key_container {
|
20 |
+
label {
|
21 |
+
position: relative;
|
22 |
+
top: 6px;
|
23 |
+
float: left;
|
24 |
+
margin-right: 5px;
|
25 |
+
}
|
26 |
+
|
27 |
+
div {
|
28 |
+
overflow: hidden;
|
29 |
+
width: auto;
|
30 |
+
height: 30px;
|
31 |
+
display: block;
|
32 |
+
top: 2px;
|
33 |
+
position: relative;
|
34 |
+
|
35 |
+
input {
|
36 |
+
margin: 0;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
#sites_list_container {
|
44 |
+
td {
|
45 |
+
cursor: pointer;
|
46 |
+
}
|
47 |
}
|
includes/pum-sdk/freemius/assets/scss/admin/_modal-common.scss
CHANGED
@@ -118,6 +118,14 @@
|
|
118 |
color: #fff;
|
119 |
background: #aaa;
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
}
|
123 |
|
118 |
color: #fff;
|
119 |
background: #aaa;
|
120 |
}
|
121 |
+
|
122 |
+
&, &:hover
|
123 |
+
{
|
124 |
+
.dashicons
|
125 |
+
{
|
126 |
+
text-decoration: none;
|
127 |
+
}
|
128 |
+
}
|
129 |
}
|
130 |
}
|
131 |
|
includes/pum-sdk/freemius/assets/scss/admin/_multisite-options.scss
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#multisite_options_container {
|
2 |
+
margin-top: 10px;
|
3 |
+
border: 1px solid #ccc;
|
4 |
+
padding: 5px;
|
5 |
+
|
6 |
+
a {
|
7 |
+
text-decoration: none;
|
8 |
+
|
9 |
+
&:focus {
|
10 |
+
box-shadow: none;
|
11 |
+
}
|
12 |
+
|
13 |
+
&.selected {
|
14 |
+
font-weight: bold;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
&.apply-on-all-sites {
|
19 |
+
border: 0 none;
|
20 |
+
padding: 0;
|
21 |
+
|
22 |
+
#all_sites_options {
|
23 |
+
border-spacing: 0;
|
24 |
+
|
25 |
+
td:not(:first-child) {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
#sites_list_container {
|
32 |
+
display: none;
|
33 |
+
overflow: auto;
|
34 |
+
|
35 |
+
table td {
|
36 |
+
border-top: 1px solid #ccc;
|
37 |
+
padding: 4px 2px;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
includes/pum-sdk/freemius/assets/scss/admin/_tooltip.scss
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.fs-tooltip-trigger
|
2 |
+
{
|
3 |
+
&:not(a)
|
4 |
+
{
|
5 |
+
cursor: help;
|
6 |
+
}
|
7 |
+
|
8 |
+
position: relative;
|
9 |
+
|
10 |
+
.fs-tooltip
|
11 |
+
{
|
12 |
+
opacity: 0;
|
13 |
+
visibility: hidden;
|
14 |
+
@include transition(opacity 0.3s ease-in-out);
|
15 |
+
position: absolute;
|
16 |
+
background: $tooltip-bkg-color;
|
17 |
+
color: $tooltip-color;
|
18 |
+
font-family: 'arial', serif;
|
19 |
+
font-size: 12px;
|
20 |
+
padding: 10px;
|
21 |
+
z-index: 999999;
|
22 |
+
bottom: 100%;
|
23 |
+
margin-bottom: 5px;
|
24 |
+
left: 0;
|
25 |
+
right: 0;
|
26 |
+
@include border-radius(5px);
|
27 |
+
@include box-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
|
28 |
+
line-height: 1.3em;
|
29 |
+
font-weight: bold;
|
30 |
+
text-align: left;
|
31 |
+
|
32 |
+
.rtl &
|
33 |
+
{
|
34 |
+
text-align: right;
|
35 |
+
}
|
36 |
+
|
37 |
+
&::after
|
38 |
+
{
|
39 |
+
content: ' ';
|
40 |
+
display: block;
|
41 |
+
width: 0;
|
42 |
+
height: 0;
|
43 |
+
border-style: solid;
|
44 |
+
border-width: 5px 5px 0 5px;
|
45 |
+
border-color: $tooltip-bkg-color transparent transparent transparent;
|
46 |
+
position: absolute;
|
47 |
+
top: 100%;
|
48 |
+
left: 21px;
|
49 |
+
|
50 |
+
.rtl &
|
51 |
+
{
|
52 |
+
right: 21px;
|
53 |
+
left: auto;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
&:hover
|
59 |
+
{
|
60 |
+
.fs-tooltip
|
61 |
+
{
|
62 |
+
visibility: visible;
|
63 |
+
opacity: 1;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
includes/pum-sdk/freemius/assets/scss/admin/account.scss
CHANGED
@@ -30,12 +30,9 @@
|
|
30 |
width: 1.2em;
|
31 |
}
|
32 |
|
33 |
-
.
|
34 |
{
|
35 |
-
|
36 |
-
{
|
37 |
-
vertical-align: middle;
|
38 |
-
}
|
39 |
}
|
40 |
|
41 |
.fs-header-actions
|
@@ -160,6 +157,55 @@ label.fs-tag
|
|
160 |
}
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
#fs_addons
|
164 |
{
|
165 |
h3
|
30 |
width: 1.2em;
|
31 |
}
|
32 |
|
33 |
+
.dashicons
|
34 |
{
|
35 |
+
vertical-align: middle;
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
.fs-header-actions
|
157 |
}
|
158 |
}
|
159 |
|
160 |
+
#fs_sites
|
161 |
+
{
|
162 |
+
.fs-scrollable-table
|
163 |
+
{
|
164 |
+
.fs-table-body {
|
165 |
+
max-height: 200px;
|
166 |
+
overflow: auto;
|
167 |
+
border: 1px solid #e5e5e5;
|
168 |
+
|
169 |
+
& > table.widefat {
|
170 |
+
border: none !important;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
.fs-main-column {
|
175 |
+
width: 100%;
|
176 |
+
}
|
177 |
+
|
178 |
+
.fs-site-details
|
179 |
+
{
|
180 |
+
td:first-of-type
|
181 |
+
{
|
182 |
+
text-align: right;
|
183 |
+
color: grey;
|
184 |
+
width: 1px;
|
185 |
+
}
|
186 |
+
|
187 |
+
td:last-of-type
|
188 |
+
{
|
189 |
+
text-align: right;
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
.fs-install-details table
|
194 |
+
{
|
195 |
+
tr td
|
196 |
+
{
|
197 |
+
width: 1px;
|
198 |
+
white-space: nowrap;
|
199 |
+
|
200 |
+
&:last-of-type
|
201 |
+
{
|
202 |
+
width: auto;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
#fs_addons
|
210 |
{
|
211 |
h3
|
includes/pum-sdk/freemius/assets/scss/admin/common.scss
CHANGED
@@ -1,218 +1,218 @@
|
|
1 |
-
@import "../start";
|
2 |
-
@import "themes";
|
3 |
-
|
4 |
-
#iframe
|
5 |
-
{
|
6 |
-
line-height: 0;
|
7 |
-
font-size: 0;
|
8 |
-
}
|
9 |
-
|
10 |
-
.fs-full-size-wrapper
|
11 |
-
{
|
12 |
-
margin: 40px 0 -65px -20px;
|
13 |
-
|
14 |
-
@media (max-width: 600px) {
|
15 |
-
margin: 0 0 -65px -10px;
|
16 |
-
}
|
17 |
-
}
|
18 |
-
|
19 |
-
.fs-notice
|
20 |
-
{
|
21 |
-
position: relative;
|
22 |
-
|
23 |
-
&.fs-has-title
|
24 |
-
{
|
25 |
-
margin-bottom: 30px !important;
|
26 |
-
}
|
27 |
-
|
28 |
-
&.success
|
29 |
-
{
|
30 |
-
color: green;
|
31 |
-
// font-weight: normal;
|
32 |
-
}
|
33 |
-
|
34 |
-
&.promotion
|
35 |
-
{
|
36 |
-
border-color: $fs-notice-promotion-border-color !important;
|
37 |
-
background-color: $fs-notice-promotion-bkg !important;
|
38 |
-
}
|
39 |
-
|
40 |
-
.fs-notice-body
|
41 |
-
{
|
42 |
-
margin: .5em 0;
|
43 |
-
padding: 2px;
|
44 |
-
}
|
45 |
-
|
46 |
-
.fs-close
|
47 |
-
{
|
48 |
-
// position: absolute;
|
49 |
-
// top: 2px;
|
50 |
-
// bottom: 2px;
|
51 |
-
// right: 2px;
|
52 |
-
// min-width: 100px;
|
53 |
-
// text-align: center;
|
54 |
-
// padding-right: 2px;
|
55 |
-
cursor: pointer;
|
56 |
-
color: #aaa;
|
57 |
-
float: right;
|
58 |
-
|
59 |
-
&:hover
|
60 |
-
{
|
61 |
-
color: #666;
|
62 |
-
// background: #A9A9A9;
|
63 |
-
}
|
64 |
-
|
65 |
-
> *
|
66 |
-
{
|
67 |
-
margin-top: 7px;
|
68 |
-
display: inline-block;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
label.fs-plugin-title
|
73 |
-
{
|
74 |
-
background: rgba(0, 0, 0, 0.3);
|
75 |
-
color: #fff;
|
76 |
-
padding: 2px 10px;
|
77 |
-
position: absolute;
|
78 |
-
top: 100%;
|
79 |
-
bottom: auto;
|
80 |
-
right: auto;
|
81 |
-
@include border-radius(0 0 3px 3px);
|
82 |
-
left: 10px;
|
83 |
-
font-size: 12px;
|
84 |
-
font-weight: bold;
|
85 |
-
cursor: auto;
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
div.fs-notice
|
90 |
-
{
|
91 |
-
&.updated,
|
92 |
-
&.success,
|
93 |
-
&.promotion
|
94 |
-
{
|
95 |
-
display: block !important;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
.rtl .fs-notice
|
100 |
-
{
|
101 |
-
.fs-close
|
102 |
-
{
|
103 |
-
// left: 2px;
|
104 |
-
// right: auto;
|
105 |
-
// padding-right: 0;
|
106 |
-
// padding-left: 2px;
|
107 |
-
float: left;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
.fs-secure-notice
|
112 |
-
{
|
113 |
-
position: fixed;
|
114 |
-
top: 32px;
|
115 |
-
left: 160px;
|
116 |
-
right: 0;
|
117 |
-
background: rgb(235, 253, 235);
|
118 |
-
padding: 10px 20px;
|
119 |
-
color: green;
|
120 |
-
z-index: 9999;
|
121 |
-
@include box-shadow(0 2px 2px rgba(6, 113, 6, 0.3));
|
122 |
-
@include opacity(0.95);
|
123 |
-
|
124 |
-
&:hover
|
125 |
-
{
|
126 |
-
@include opacity(1);
|
127 |
-
}
|
128 |
-
|
129 |
-
a.fs-security-proof
|
130 |
-
{
|
131 |
-
color: green;
|
132 |
-
text-decoration: none;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
@media screen and (max-width: 960px) {
|
137 |
-
.fs-secure-notice
|
138 |
-
{
|
139 |
-
left: 36px;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
@media screen and (max-width: 600px) {
|
144 |
-
.fs-secure-notice
|
145 |
-
{
|
146 |
-
display: none;
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
@media screen and (max-width: 500px) {
|
151 |
-
#fs_promo_tab
|
152 |
-
{
|
153 |
-
display: none;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
|
157 |
-
@media screen and (max-width: 782px) {
|
158 |
-
.fs-secure-notice
|
159 |
-
{
|
160 |
-
left: 0;
|
161 |
-
top: 46px;
|
162 |
-
text-align: center;
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
span.fs-submenu-item.fs-sub:before
|
167 |
-
{
|
168 |
-
// Add small arrow.
|
169 |
-
content: '\21B3';
|
170 |
-
padding: 0 5px;
|
171 |
-
}
|
172 |
-
|
173 |
-
.rtl
|
174 |
-
{
|
175 |
-
span.fs-submenu-item.fs-sub:before
|
176 |
-
{
|
177 |
-
// Add small RTL arrow.
|
178 |
-
content: '\21B2';
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
.fs-submenu-item
|
183 |
-
{
|
184 |
-
&.pricing
|
185 |
-
{
|
186 |
-
&.upgrade-mode
|
187 |
-
{
|
188 |
-
color: greenyellow;
|
189 |
-
}
|
190 |
-
|
191 |
-
&.trial-mode
|
192 |
-
{
|
193 |
-
color: #83e2ff;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
#adminmenu .update-plugins.fs-trial
|
199 |
-
{
|
200 |
-
background-color: #00b9eb;
|
201 |
-
}
|
202 |
-
.fs-ajax-spinner
|
203 |
-
{
|
204 |
-
border: 0;
|
205 |
-
width: 20px;
|
206 |
-
height: 20px;
|
207 |
-
margin-right: 5px;
|
208 |
-
vertical-align: sub;
|
209 |
-
display: inline-block;
|
210 |
-
background: url('../../../../../../../wp-admin/images/wpspin_light-2x.gif');
|
211 |
-
background-size: contain;
|
212 |
-
}
|
213 |
-
|
214 |
-
.wrap.fs-section {
|
215 |
-
h2 {
|
216 |
-
text-align: left;
|
217 |
-
}
|
218 |
}
|
1 |
+
@import "../start";
|
2 |
+
@import "themes";
|
3 |
+
|
4 |
+
#iframe
|
5 |
+
{
|
6 |
+
line-height: 0;
|
7 |
+
font-size: 0;
|
8 |
+
}
|
9 |
+
|
10 |
+
.fs-full-size-wrapper
|
11 |
+
{
|
12 |
+
margin: 40px 0 -65px -20px;
|
13 |
+
|
14 |
+
@media (max-width: 600px) {
|
15 |
+
margin: 0 0 -65px -10px;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
.fs-notice
|
20 |
+
{
|
21 |
+
position: relative;
|
22 |
+
|
23 |
+
&.fs-has-title
|
24 |
+
{
|
25 |
+
margin-bottom: 30px !important;
|
26 |
+
}
|
27 |
+
|
28 |
+
&.success
|
29 |
+
{
|
30 |
+
color: green;
|
31 |
+
// font-weight: normal;
|
32 |
+
}
|
33 |
+
|
34 |
+
&.promotion
|
35 |
+
{
|
36 |
+
border-color: $fs-notice-promotion-border-color !important;
|
37 |
+
background-color: $fs-notice-promotion-bkg !important;
|
38 |
+
}
|
39 |
+
|
40 |
+
.fs-notice-body
|
41 |
+
{
|
42 |
+
margin: .5em 0;
|
43 |
+
padding: 2px;
|
44 |
+
}
|
45 |
+
|
46 |
+
.fs-close
|
47 |
+
{
|
48 |
+
// position: absolute;
|
49 |
+
// top: 2px;
|
50 |
+
// bottom: 2px;
|
51 |
+
// right: 2px;
|
52 |
+
// min-width: 100px;
|
53 |
+
// text-align: center;
|
54 |
+
// padding-right: 2px;
|
55 |
+
cursor: pointer;
|
56 |
+
color: #aaa;
|
57 |
+
float: right;
|
58 |
+
|
59 |
+
&:hover
|
60 |
+
{
|
61 |
+
color: #666;
|
62 |
+
// background: #A9A9A9;
|
63 |
+
}
|
64 |
+
|
65 |
+
> *
|
66 |
+
{
|
67 |
+
margin-top: 7px;
|
68 |
+
display: inline-block;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
label.fs-plugin-title
|
73 |
+
{
|
74 |
+
background: rgba(0, 0, 0, 0.3);
|
75 |
+
color: #fff;
|
76 |
+
padding: 2px 10px;
|
77 |
+
position: absolute;
|
78 |
+
top: 100%;
|
79 |
+
bottom: auto;
|
80 |
+
right: auto;
|
81 |
+
@include border-radius(0 0 3px 3px);
|
82 |
+
left: 10px;
|
83 |
+
font-size: 12px;
|
84 |
+
font-weight: bold;
|
85 |
+
cursor: auto;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
div.fs-notice
|
90 |
+
{
|
91 |
+
&.updated,
|
92 |
+
&.success,
|
93 |
+
&.promotion
|
94 |
+
{
|
95 |
+
display: block !important;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
.rtl .fs-notice
|
100 |
+
{
|
101 |
+
.fs-close
|
102 |
+
{
|
103 |
+
// left: 2px;
|
104 |
+
// right: auto;
|
105 |
+
// padding-right: 0;
|
106 |
+
// padding-left: 2px;
|
107 |
+
float: left;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
.fs-secure-notice
|
112 |
+
{
|
113 |
+
position: fixed;
|
114 |
+
top: 32px;
|
115 |
+
left: 160px;
|
116 |
+
right: 0;
|
117 |
+
background: rgb(235, 253, 235);
|
118 |
+
padding: 10px 20px;
|
119 |
+
color: green;
|
120 |
+
z-index: 9999;
|
121 |
+
@include box-shadow(0 2px 2px rgba(6, 113, 6, 0.3));
|
122 |
+
@include opacity(0.95);
|
123 |
+
|
124 |
+
&:hover
|
125 |
+
{
|
126 |
+
@include opacity(1);
|
127 |
+
}
|
128 |
+
|
129 |
+
a.fs-security-proof
|
130 |
+
{
|
131 |
+
color: green;
|
132 |
+
text-decoration: none;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
@media screen and (max-width: 960px) {
|
137 |
+
.fs-secure-notice
|
138 |
+
{
|
139 |
+
left: 36px;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
@media screen and (max-width: 600px) {
|
144 |
+
.fs-secure-notice
|
145 |
+
{
|
146 |
+
display: none;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
@media screen and (max-width: 500px) {
|
151 |
+
#fs_promo_tab
|
152 |
+
{
|
153 |
+
display: none;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
@media screen and (max-width: 782px) {
|
158 |
+
.fs-secure-notice
|
159 |
+
{
|
160 |
+
left: 0;
|
161 |
+
top: 46px;
|
162 |
+
text-align: center;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
span.fs-submenu-item.fs-sub:before
|
167 |
+
{
|
168 |
+
// Add small arrow.
|
169 |
+
content: '\21B3';
|
170 |
+
padding: 0 5px;
|
171 |
+
}
|
172 |
+
|
173 |
+
.rtl
|
174 |
+
{
|
175 |
+
span.fs-submenu-item.fs-sub:before
|
176 |
+
{
|
177 |
+
// Add small RTL arrow.
|
178 |
+
content: '\21B2';
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
.fs-submenu-item
|
183 |
+
{
|
184 |
+
&.pricing
|
185 |
+
{
|
186 |
+
&.upgrade-mode
|
187 |
+
{
|
188 |
+
color: greenyellow;
|
189 |
+
}
|
190 |
+
|
191 |
+
&.trial-mode
|
192 |
+
{
|
193 |
+
color: #83e2ff;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
#adminmenu .update-plugins.fs-trial
|
199 |
+
{
|
200 |
+
background-color: #00b9eb;
|
201 |
+
}
|
202 |
+
.fs-ajax-spinner
|
203 |
+
{
|
204 |
+
border: 0;
|
205 |
+
width: 20px;
|
206 |
+
height: 20px;
|
207 |
+
margin-right: 5px;
|
208 |
+
vertical-align: sub;
|
209 |
+
display: inline-block;
|
210 |
+
background: url('../../../../../../../wp-admin/images/wpspin_light-2x.gif');
|
211 |
+
background-size: contain;
|
212 |
+
}
|
213 |
+
|
214 |
+
.wrap.fs-section {
|
215 |
+
h2 {
|
216 |
+
text-align: left;
|
217 |
+
}
|
218 |
}
|
includes/pum-sdk/freemius/assets/scss/admin/connect.scss
CHANGED
@@ -1,520 +1,547 @@
|
|
1 |
-
@import "../start";
|
2 |
-
|
3 |
-
$form_width: 480px;
|
4 |
-
|
5 |
-
#fs_connect
|
6 |
-
{
|
7 |
-
width: $form_width;
|
8 |
-
@include box-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));
|
9 |
-
margin: 20px 0;
|
10 |
-
|
11 |
-
@media screen and (max-width: ($form_width - 1)) {
|
12 |
-
@include box-shadow(none);
|
13 |
-
width: auto;
|
14 |
-
margin: 0 0 0 -10px;
|
15 |
-
}
|
16 |
-
|
17 |
-
.fs-content
|
18 |
-
{
|
19 |
-
background: #fff;
|
20 |
-
padding: 15px 20px;
|
21 |
-
|
22 |
-
.fs-error {
|
23 |
-
background: snow;
|
24 |
-
color: $fs-logo-magenta-color;
|
25 |
-
border: 1px solid $fs-logo-magenta-color;
|
26 |
-
@include box-shadow(0 1px 1px 0 rgba(0,0,0,.1));
|
27 |
-
text-align: center;
|
28 |
-
padding: 5px;
|
29 |
-
margin-bottom: 10px;
|
30 |
-
}
|
31 |
-
|
32 |
-
p
|
33 |
-
{
|
34 |
-
margin: 0;
|
35 |
-
padding: 0;
|
36 |
-
font-size: 1.2em;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
.fs-license-key-container {
|
41 |
-
position: relative;
|
42 |
-
width: 280px;
|
43 |
-
margin: 10px auto 0 auto;
|
44 |
-
|
45 |
-
input {
|
46 |
-
width: 100%;
|
47 |
-
}
|
48 |
-
|
49 |
-
.dashicons {
|
50 |
-
position: absolute;
|
51 |
-
top: 5px;
|
52 |
-
right: 5px;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
//
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
text-
|
130 |
-
margin-
|
131 |
-
}
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
{
|
235 |
-
padding:
|
236 |
-
|
237 |
-
background:
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
}
|
271 |
-
|
272 |
-
.
|
273 |
-
{
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
{
|
376 |
-
|
377 |
-
{
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
{
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import "../start";
|
2 |
+
|
3 |
+
$form_width: 480px;
|
4 |
+
|
5 |
+
#fs_connect
|
6 |
+
{
|
7 |
+
width: $form_width;
|
8 |
+
@include box-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));
|
9 |
+
margin: 20px 0;
|
10 |
+
|
11 |
+
@media screen and (max-width: ($form_width - 1)) {
|
12 |
+
@include box-shadow(none);
|
13 |
+
width: auto;
|
14 |
+
margin: 0 0 0 -10px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.fs-content
|
18 |
+
{
|
19 |
+
background: #fff;
|
20 |
+
padding: 15px 20px;
|
21 |
+
|
22 |
+
.fs-error {
|
23 |
+
background: snow;
|
24 |
+
color: $fs-logo-magenta-color;
|
25 |
+
border: 1px solid $fs-logo-magenta-color;
|
26 |
+
@include box-shadow(0 1px 1px 0 rgba(0,0,0,.1));
|
27 |
+
text-align: center;
|
28 |
+
padding: 5px;
|
29 |
+
margin-bottom: 10px;
|
30 |
+
}
|
31 |
+
|
32 |
+
p
|
33 |
+
{
|
34 |
+
margin: 0;
|
35 |
+
padding: 0;
|
36 |
+
font-size: 1.2em;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
.fs-license-key-container {
|
41 |
+
position: relative;
|
42 |
+
width: 280px;
|
43 |
+
margin: 10px auto 0 auto;
|
44 |
+
|
45 |
+
input {
|
46 |
+
width: 100%;
|
47 |
+
}
|
48 |
+
|
49 |
+
.dashicons {
|
50 |
+
position: absolute;
|
51 |
+
top: 5px;
|
52 |
+
right: 5px;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
&.require-license-key {
|
57 |
+
#sites_list_container {
|
58 |
+
td {
|
59 |
+
cursor: pointer;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
#delegate_to_site_admins {
|
65 |
+
margin-right: 15px;
|
66 |
+
float: right;
|
67 |
+
height: 26px;
|
68 |
+
vertical-align: middle;
|
69 |
+
line-height: 37px;
|
70 |
+
font-weight: bold;
|
71 |
+
border-bottom: 1px dashed;
|
72 |
+
text-decoration: none;
|
73 |
+
|
74 |
+
&.rtl {
|
75 |
+
margin-left: 15px;
|
76 |
+
margin-right: 0;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
.fs-actions
|
81 |
+
{
|
82 |
+
padding: 10px 20px;
|
83 |
+
background: #C0C7CA;
|
84 |
+
|
85 |
+
.button
|
86 |
+
{
|
87 |
+
padding: 0 10px 1px;
|
88 |
+
line-height: 35px;
|
89 |
+
height: 37px;
|
90 |
+
font-size: 16px;
|
91 |
+
margin-bottom: 0;
|
92 |
+
|
93 |
+
.dashicons
|
94 |
+
{
|
95 |
+
font-size: 37px;
|
96 |
+
margin-left: -8px;
|
97 |
+
margin-right: 12px;
|
98 |
+
}
|
99 |
+
|
100 |
+
&.button-primary
|
101 |
+
{
|
102 |
+
padding-right: 15px;
|
103 |
+
padding-left: 15px;
|
104 |
+
|
105 |
+
&:after
|
106 |
+
{
|
107 |
+
content: ' \279C';
|
108 |
+
}
|
109 |
+
|
110 |
+
&.fs-loading
|
111 |
+
{
|
112 |
+
&:after
|
113 |
+
{
|
114 |
+
content: '';
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
&.button-secondary
|
120 |
+
{
|
121 |
+
float: right;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
// .fs-skip
|
126 |
+
// {
|
127 |
+
// line-height: 38px;
|
128 |
+
// vertical-align: middle;
|
129 |
+
// text-decoration: none;
|
130 |
+
// margin-left: 10px;
|
131 |
+
// }
|
132 |
+
}
|
133 |
+
|
134 |
+
&.fs-anonymous-disabled
|
135 |
+
{
|
136 |
+
.fs-actions
|
137 |
+
{
|
138 |
+
.button.button-primary
|
139 |
+
{
|
140 |
+
width: 100%;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
.fs-permissions
|
146 |
+
{
|
147 |
+
padding: 10px 20px;
|
148 |
+
background: #FEFEFE;
|
149 |
+
// background: #F1F1F1;
|
150 |
+
@include transition(background 0.5s ease);
|
151 |
+
|
152 |
+
.fs-license-sync-disclaimer {
|
153 |
+
text-align: center;
|
154 |
+
margin-top: 0;
|
155 |
+
}
|
156 |
+
|
157 |
+
.fs-trigger
|
158 |
+
{
|
159 |
+
font-size: 0.9em;
|
160 |
+
text-decoration: none;
|
161 |
+
text-align: center;
|
162 |
+
display: block;
|
163 |
+
}
|
164 |
+
|
165 |
+
ul
|
166 |
+
{
|
167 |
+
height: 0;
|
168 |
+
overflow: hidden;
|
169 |
+
margin: 0;
|
170 |
+
|
171 |
+
li
|
172 |
+
{
|
173 |
+
margin-bottom: 12px;
|
174 |
+
|
175 |
+
&:last-child
|
176 |
+
{
|
177 |
+
margin-bottom: 0;
|
178 |
+
}
|
179 |
+
|
180 |
+
i.dashicons
|
181 |
+
{
|
182 |
+
float: left;
|
183 |
+
font-size: 40px;
|
184 |
+
width: 40px;
|
185 |
+
height: 40px;
|
186 |
+
}
|
187 |
+
|
188 |
+
div
|
189 |
+
{
|
190 |
+
margin-left: 55px;
|
191 |
+
|
192 |
+
span
|
193 |
+
{
|
194 |
+
font-weight: bold;
|
195 |
+
text-transform: uppercase;
|
196 |
+
color: #23282d;
|
197 |
+
}
|
198 |
+
|
199 |
+
p
|
200 |
+
{
|
201 |
+
margin: 2px 0 0 0;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
&.fs-open
|
208 |
+
{
|
209 |
+
background: #fff;
|
210 |
+
|
211 |
+
ul
|
212 |
+
{
|
213 |
+
height: auto;
|
214 |
+
margin: 20px 20px 10px 20px;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
@media screen and (max-width: ($form_width - 1)) {
|
219 |
+
background: #fff;
|
220 |
+
|
221 |
+
.fs-trigger
|
222 |
+
{
|
223 |
+
display: none;
|
224 |
+
}
|
225 |
+
|
226 |
+
ul
|
227 |
+
{
|
228 |
+
height: auto;
|
229 |
+
margin: 20px;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
.fs-freemium-licensing {
|
235 |
+
padding: 8px;
|
236 |
+
// background: #0085BA;
|
237 |
+
background: #777;
|
238 |
+
color: #fff;
|
239 |
+
|
240 |
+
p {
|
241 |
+
text-align: center;
|
242 |
+
display: block;
|
243 |
+
margin: 0;
|
244 |
+
padding: 0;
|
245 |
+
}
|
246 |
+
|
247 |
+
a {
|
248 |
+
color: #C2EEFF;
|
249 |
+
text-decoration: underline;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
$icon_size: 80px;
|
254 |
+
$wp_logo_padding: $icon_size / 10;
|
255 |
+
$icons_top: 10px;
|
256 |
+
|
257 |
+
.fs-visual
|
258 |
+
{
|
259 |
+
padding: 12px;
|
260 |
+
line-height: 0;
|
261 |
+
background: #fafafa;
|
262 |
+
height: $icon_size;
|
263 |
+
position: relative;
|
264 |
+
|
265 |
+
.fs-site-icon
|
266 |
+
{
|
267 |
+
position: absolute;
|
268 |
+
left: 20px;
|
269 |
+
top: $icons_top;
|
270 |
+
}
|
271 |
+
|
272 |
+
.fs-connect-logo
|
273 |
+
{
|
274 |
+
position: absolute;
|
275 |
+
right: 20px;
|
276 |
+
top: $icons_top;
|
277 |
+
}
|
278 |
+
|
279 |
+
.fs-plugin-icon
|
280 |
+
{
|
281 |
+
position: absolute;
|
282 |
+
top: $icons_top;
|
283 |
+
left: 50%;
|
284 |
+
margin-left: - ($icon_size / 2);
|
285 |
+
}
|
286 |
+
|
287 |
+
.fs-plugin-icon,
|
288 |
+
.fs-site-icon,
|
289 |
+
img,
|
290 |
+
object
|
291 |
+
{
|
292 |
+
width: $icon_size;
|
293 |
+
height: $icon_size;
|
294 |
+
}
|
295 |
+
|
296 |
+
.dashicons-wordpress
|
297 |
+
{
|
298 |
+
font-size: $icon_size - ($wp_logo_padding * 2);
|
299 |
+
background: $wordpress_color;
|
300 |
+
color: #fff;
|
301 |
+
width: $icon_size - ($wp_logo_padding * 2);
|
302 |
+
height: $icon_size - ($wp_logo_padding * 2);
|
303 |
+
padding: $wp_logo_padding;
|
304 |
+
}
|
305 |
+
|
306 |
+
.dashicons-plus
|
307 |
+
{
|
308 |
+
position: absolute;
|
309 |
+
top: 50%;
|
310 |
+
font-size: 30px;
|
311 |
+
margin-top: -10px;
|
312 |
+
color: #bbb;
|
313 |
+
|
314 |
+
&.fs-first
|
315 |
+
{
|
316 |
+
left: 28%;
|
317 |
+
}
|
318 |
+
&.fs-second
|
319 |
+
{
|
320 |
+
left: 65%;
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
.fs-plugin-icon,
|
325 |
+
.fs-connect-logo,
|
326 |
+
.fs-site-icon
|
327 |
+
{
|
328 |
+
border: 1px solid #ccc;
|
329 |
+
padding: 1px;
|
330 |
+
background: #fff;
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
.fs-terms
|
335 |
+
{
|
336 |
+
text-align: center;
|
337 |
+
font-size: 0.85em;
|
338 |
+
padding: 5px;
|
339 |
+
background: rgba(0, 0, 0, 0.05);
|
340 |
+
|
341 |
+
&, a
|
342 |
+
{
|
343 |
+
color: #999;
|
344 |
+
}
|
345 |
+
|
346 |
+
a
|
347 |
+
{
|
348 |
+
text-decoration: none;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
@import "multisite-options";
|
354 |
+
@import "tooltip";
|
355 |
+
|
356 |
+
.rtl
|
357 |
+
{
|
358 |
+
#fs_connect
|
359 |
+
{
|
360 |
+
.fs-actions
|
361 |
+
{
|
362 |
+
padding: 10px 20px;
|
363 |
+
background: #C0C7CA;
|
364 |
+
|
365 |
+
.button
|
366 |
+
{
|
367 |
+
.dashicons
|
368 |
+
{
|
369 |
+
font-size: 37px;
|
370 |
+
margin-left: -8px;
|
371 |
+
margin-right: 12px;
|
372 |
+
}
|
373 |
+
|
374 |
+
&.button-primary
|
375 |
+
{
|
376 |
+
&:after
|
377 |
+
{
|
378 |
+
content: ' \000bb';
|
379 |
+
}
|
380 |
+
|
381 |
+
&.fs-loading
|
382 |
+
{
|
383 |
+
&:after
|
384 |
+
{
|
385 |
+
content: '';
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
|
390 |
+
&.button-secondary
|
391 |
+
{
|
392 |
+
float: left;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
.fs-permissions
|
398 |
+
{
|
399 |
+
ul
|
400 |
+
{
|
401 |
+
li
|
402 |
+
{
|
403 |
+
div
|
404 |
+
{
|
405 |
+
margin-right: 55px;
|
406 |
+
margin-left: 0;
|
407 |
+
}
|
408 |
+
|
409 |
+
i.dashicons
|
410 |
+
{
|
411 |
+
float: right;
|
412 |
+
}
|
413 |
+
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
.fs-visual
|
419 |
+
{
|
420 |
+
.fs-site-icon
|
421 |
+
{
|
422 |
+
right: 20px;
|
423 |
+
left: auto;
|
424 |
+
}
|
425 |
+
|
426 |
+
.fs-connect-logo
|
427 |
+
{
|
428 |
+
right: auto;
|
429 |
+
left: 20px;
|
430 |
+
}
|
431 |
+
}
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
#fs_theme_connect_wrapper {
|
436 |
+
position: fixed;
|
437 |
+
top: 0;
|
438 |
+
height: 100%;
|
439 |
+
width: 100%;
|
440 |
+
z-index: 99990;
|
441 |
+
background: rgba(0, 0, 0, 0.75);
|
442 |
+
text-align: center;
|
443 |
+
overflow-y: auto;
|
444 |
+
|
445 |
+
&:before {
|
446 |
+
content: "";
|
447 |
+
display: inline-block;
|
448 |
+
vertical-align: middle;
|
449 |
+
height: 100%;
|
450 |
+
}
|
451 |
+
|
452 |
+
> button.close {
|
453 |
+
color: white;
|
454 |
+
cursor: pointer;
|
455 |
+
height: 40px;
|
456 |
+
width: 40px;
|
457 |
+
position: absolute;
|
458 |
+
right: 0;
|
459 |
+
border: 0;
|
460 |
+
background-color: transparent;
|
461 |
+
top: 32px;
|
462 |
+
}
|
463 |
+
|
464 |
+
#fs_connect {
|
465 |
+
top: 0;
|
466 |
+
text-align: left;
|
467 |
+
display: inline-block;
|
468 |
+
vertical-align: middle;
|
469 |
+
margin-top: 52px;
|
470 |
+
margin-bottom: 20px;
|
471 |
+
|
472 |
+
.fs-terms
|
473 |
+
{
|
474 |
+
background: rgba(140, 140, 140, 0.64);
|
475 |
+
|
476 |
+
&, a
|
477 |
+
{
|
478 |
+
color: #c5c5c5;
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
482 |
+
}
|
483 |
+
|
484 |
+
.wp-pointer-content
|
485 |
+
{
|
486 |
+
#fs_connect
|
487 |
+
{
|
488 |
+
margin: 0;
|
489 |
+
@include box-shadow(none);
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
.fs-opt-in-pointer
|
494 |
+
{
|
495 |
+
.wp-pointer-content
|
496 |
+
{
|
497 |
+
padding: 0;
|
498 |
+
}
|
499 |
+
|
500 |
+
&.wp-pointer-top
|
501 |
+
{
|
502 |
+
.wp-pointer-arrow
|
503 |
+
{
|
504 |
+
border-bottom-color: #dfdfdf;
|
505 |
+
}
|
506 |
+
.wp-pointer-arrow-inner
|
507 |
+
{
|
508 |
+
border-bottom-color: #fafafa;
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
&.wp-pointer-bottom
|
513 |
+
{
|
514 |
+
.wp-pointer-arrow
|
515 |
+
{
|
516 |
+
border-top-color: #dfdfdf;
|
517 |
+
}
|
518 |
+
.wp-pointer-arrow-inner
|
519 |
+
{
|
520 |
+
border-top-color: #fafafa;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
&.wp-pointer-left
|
525 |
+
{
|
526 |
+
.wp-pointer-arrow
|
527 |
+
{
|
528 |
+
border-right-color: #dfdfdf;
|
529 |
+
}
|
530 |
+
.wp-pointer-arrow-inner
|
531 |
+
{
|
532 |
+
border-right-color: #fafafa;
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
&.wp-pointer-right
|
537 |
+
{
|
538 |
+
.wp-pointer-arrow
|
539 |
+
{
|
540 |
+
border-left-color: #dfdfdf;
|
541 |
+
}
|
542 |
+
.wp-pointer-arrow-inner
|
543 |
+
{
|
544 |
+
border-left-color: #fafafa;
|
545 |
+
}
|
546 |
+
}
|
547 |
+
}
|
includes/pum-sdk/freemius/assets/scss/admin/dialog-boxes.scss
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
@import "modal-common";
|
3 |
@import "deactivation-feedback";
|
4 |
@import "license-activation";
|
|
|
5 |
@import "license-key-resend";
|
6 |
@import "ajax-loader";
|
7 |
@import "auto-install";
|
2 |
@import "modal-common";
|
3 |
@import "deactivation-feedback";
|
4 |
@import "license-activation";
|
5 |
+
@import "multisite-options";
|
6 |
@import "license-key-resend";
|
7 |
@import "ajax-loader";
|
8 |
@import "auto-install";
|
includes/pum-sdk/freemius/composer.json
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "freemius/wordpress-sdk",
|
3 |
-
"description": "Freemius WordPress SDK",
|
4 |
-
"keywords": ["freemius", "wordpress", "plugin", "sdk"],
|
5 |
-
"homepage": "https://freemius.com",
|
6 |
-
"license": "GPL-3.0",
|
7 |
-
"require": {
|
8 |
-
"php": ">=5.2"
|
9 |
-
}
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/pum-sdk/freemius/config.php
CHANGED
@@ -1,328 +1,378 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
// define( 'WP_FS__LOCALHOST_IP', WP_FS__VVV_DEFAULT_PUBLIC_IP );
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
#--------------------------------------------------------------------------------
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
#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 |
-
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Module types
|
255 |
-
*
|
256 |
-
* @since 1.2.2
|
257 |
-
*/
|
258 |
-
define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
|
259 |
-
define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
|
260 |
-
|
261 |
-
/**
|
262 |
-
* Billing Frequencies
|
263 |
-
*/
|
264 |
-
define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
|
265 |
-
define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
|
266 |
-
define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Plans
|
270 |
-
*/
|
271 |
-
define( 'WP_FS__PLAN_DEFAULT_PAID', false );
|
272 |
-
define( 'WP_FS__PLAN_FREE', 'free' );
|
273 |
-
define( 'WP_FS__PLAN_TRIAL', 'trial' );
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Times in seconds
|
277 |
-
*/
|
278 |
-
if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
|
279 |
-
define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
|
280 |
-
}
|
281 |
-
if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
|
282 |
-
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
|
283 |
-
}
|
284 |
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: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 |
+
define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Module types
|
255 |
+
*
|
256 |
+
* @since 1.2.2
|
257 |
+
*/
|
258 |
+
define( 'WP_FS__MODULE_TYPE_PLUGIN', 'plugin' );
|
259 |
+
define( 'WP_FS__MODULE_TYPE_THEME', 'theme' );
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Billing Frequencies
|
263 |
+
*/
|
264 |
+
define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
|
265 |
+
define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
|
266 |
+
define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Plans
|
270 |
+
*/
|
271 |
+
define( 'WP_FS__PLAN_DEFAULT_PAID', false );
|
272 |
+
define( 'WP_FS__PLAN_FREE', 'free' );
|
273 |
+
define( 'WP_FS__PLAN_TRIAL', 'trial' );
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Times in seconds
|
277 |
+
*/
|
278 |
+
if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
|
279 |
+
define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
|
280 |
+
}
|
281 |
+
if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
|
282 |
+
define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
|
283 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
// define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
|
285 |
+
if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
|
286 |
+
define( 'WP_FS__TIME_24_HOURS_IN_SEC', 86400 );
|
287 |
+
}
|
288 |
+
if ( ! defined( 'WP_FS__TIME_WEEK_IN_SEC' ) ) {
|
289 |
+
define( 'WP_FS__TIME_WEEK_IN_SEC', 7 * WP_FS__TIME_24_HOURS_IN_SEC );
|
290 |
+
}
|
291 |
+
|
292 |
+
#--------------------------------------------------------------------------------
|
293 |
+
#region Debugging
|
294 |
+
#--------------------------------------------------------------------------------
|
295 |
+
|
296 |
+
if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
|
297 |
+
$debug_mode = get_option( 'fs_debug_mode', null );
|
298 |
+
|
299 |
+
if ( $debug_mode === null ) {
|
300 |
+
$debug_mode = false;
|
301 |
+
add_option( 'fs_debug_mode', $debug_mode );
|
302 |
+
}
|
303 |
+
|
304 |
+
define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
|
308 |
+
define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
|
309 |
+
}
|
310 |
+
if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
|
311 |
+
define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
|
312 |
+
}
|
313 |
+
if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
|
314 |
+
define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
|
315 |
+
}
|
316 |
+
|
317 |
+
if ( WP_FS__ECHO_DEBUG_SDK ) {
|
318 |
+
error_reporting( E_ALL );
|
319 |
+
}
|
320 |
+
|
321 |
+
#endregion
|
322 |
+
|
323 |
+
if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
|
324 |
+
define( 'WP_FS__SCRIPT_START_TIME', time() );
|
325 |
+
}
|
326 |
+
if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
|
327 |
+
define( 'WP_FS__DEFAULT_PRIORITY', 10 );
|
328 |
+
}
|
329 |
+
if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
|
330 |
+
define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
|
331 |
+
}
|
332 |
+
|
333 |
+
#--------------------------------------------------------------------------------
|
334 |
+
#region Multisite Network
|
335 |
+
#--------------------------------------------------------------------------------
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Do not use this define directly, it will have the wrong value
|
339 |
+
* during plugin uninstall/deletion when the inclusion of the plugin
|
340 |
+
* is triggered due to registration with register_uninstall_hook().
|
341 |
+
*
|
342 |
+
* Instead, use fs_is_network_admin().
|
343 |
+
*
|
344 |
+
* @author Vova Feldman (@svovaf)
|
345 |
+
*/
|
346 |
+
if ( ! defined( 'WP_FS__IS_NETWORK_ADMIN' ) ) {
|
347 |
+
define( 'WP_FS__IS_NETWORK_ADMIN',
|
348 |
+
is_network_admin() ||
|
349 |
+
( is_multisite() &&
|
350 |
+
( ( defined( 'DOING_AJAX' ) && DOING_AJAX &&
|
351 |
+
( isset( $_REQUEST['_fs_network_admin'] ) /*||
|
352 |
+
( ! empty( $_REQUEST['action'] ) && 'delete-plugin' === $_REQUEST['action'] )*/ )
|
353 |
+
) ||
|
354 |
+
// Plugin uninstall.
|
355 |
+
defined( 'WP_UNINSTALL_PLUGIN' ) )
|
356 |
+
)
|
357 |
+
);
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Do not use this define directly, it will have the wrong value
|
362 |
+
* during plugin uninstall/deletion when the inclusion of the plugin
|
363 |
+
* is triggered due to registration with register_uninstall_hook().
|
364 |
+
*
|
365 |
+
* Instead, use fs_is_blog_admin().
|
366 |
+
*
|
367 |
+
* @author Vova Feldman (@svovaf)
|
368 |
+
*/
|
369 |
+
if ( ! defined( 'WP_FS__IS_BLOG_ADMIN' ) ) {
|
370 |
+
define( 'WP_FS__IS_BLOG_ADMIN', is_blog_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['_fs_blog_admin'] ) ) );
|
371 |
+
}
|
372 |
+
|
373 |
+
if ( ! defined( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED' ) ) {
|
374 |
+
// Set to true to show network level settings even if delegated to site admins.
|
375 |
+
define( 'WP_FS__SHOW_NETWORK_EVEN_WHEN_DELEGATED', false );
|
376 |
+
}
|
377 |
+
|
378 |
+
#endregion
|
includes/pum-sdk/freemius/gulpfile.js
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
var gulp = require('gulp');
|
2 |
-
var path = require('path');
|
3 |
-
var filesystem = require('fs');
|
4 |
-
var wpPot = require('gulp-wp-pot');
|
5 |
-
var gettext = require('gulp-gettext');
|
6 |
-
var sort = require('gulp-sort');
|
7 |
-
var pofill = require('gulp-pofill');
|
8 |
-
var rename = require('gulp-rename');
|
9 |
-
var clean = require('gulp-clean');
|
10 |
-
|
11 |
-
var languagesFolder = './languages/';
|
12 |
-
|
13 |
-
var options = require('./transifex-config.json');
|
14 |
-
|
15 |
-
function getFolders(dir) {
|
16 |
-
return filesystem.readdirSync(dir)
|
17 |
-
.filter(function (file) {
|
18 |
-
return filesystem.statSync(path.join(dir, file)).isDirectory();
|
19 |
-
});
|
20 |
-
}
|
21 |
-
|
22 |
-
var transifex = require('gulp-transifex').createClient(options);
|
23 |
-
|
24 |
-
// Create POT out of i18n.php.
|
25 |
-
gulp.task('prepare-source', function () {
|
26 |
-
gulp.src('**/*.php')
|
27 |
-
.pipe(sort())
|
28 |
-
.pipe(wpPot({
|
29 |
-
destFile : 'freemius.pot',
|
30 |
-
package : 'freemius',
|
31 |
-
bugReport : 'https://github.com/Freemius/wordpress-sdk/issues',
|
32 |
-
lastTranslator : 'Vova Feldman <vova@freemius.com>',
|
33 |
-
team : 'Freemius Team <admin@freemius.com>',
|
34 |
-
/*gettextMethods: {
|
35 |
-
instances: ['this', '_fs'],
|
36 |
-
methods: [
|
37 |
-
'get_text_inline'
|
38 |
-
]
|
39 |
-
},*/
|
40 |
-
gettextFunctions: [
|
41 |
-
{name: 'get_text_inline'},
|
42 |
-
|
43 |
-
{name: 'fs_text_inline'},
|
44 |
-
{name: 'fs_echo_inline'},
|
45 |
-
{name: 'fs_esc_js_inline'},
|
46 |
-
{name: 'fs_esc_attr_inline'},
|
47 |
-
{name: 'fs_esc_attr_echo_inline'},
|
48 |
-
{name: 'fs_esc_html_inline'},
|
49 |
-
{name: 'fs_esc_html_echo_inline'},
|
50 |
-
|
51 |
-
{name: 'get_text_x_inline', context: 2},
|
52 |
-
{name: 'fs_text_x_inline', context: 2},
|
53 |
-
{name: 'fs_echo_x_inline', context: 2},
|
54 |
-
{name: 'fs_esc_attr_x_inline', context: 2},
|
55 |
-
{name: 'fs_esc_js_x_inline', context: 2},
|
56 |
-
{name: 'fs_esc_js_echo_x_inline', context: 2},
|
57 |
-
{name: 'fs_esc_html_x_inline', context: 2},
|
58 |
-
{name: 'fs_esc_html_echo_x_inline', context: 2}
|
59 |
-
/*,
|
60 |
-
|
61 |
-
|
62 |
-
{name: '_fs_text'},
|
63 |
-
{name: '_fs_x', context: 2},
|
64 |
-
{name: '_fs_echo'},
|
65 |
-
{name: '_fs_esc_attr'},
|
66 |
-
{name: '_fs_esc_attr_echo'},
|
67 |
-
{name: '_fs_esc_html'},
|
68 |
-
{name: '_fs_esc_html_echo'},
|
69 |
-
{name: '_fs_ex', context: 2},
|
70 |
-
{name: '_fs_esc_attr_x', context: 2},
|
71 |
-
{name: '_fs_esc_html_x', context: 2},
|
72 |
-
|
73 |
-
{name: '_fs_n', plural: 2},
|
74 |
-
{name: '_fs_n_noop', plural: 2},
|
75 |
-
{name: '_fs_nx', plural: 2, context: 4},
|
76 |
-
{name: '_fs_nx_noop', plural: 2, context: 3}*/
|
77 |
-
]
|
78 |
-
}))
|
79 |
-
.pipe(gulp.dest(languagesFolder + 'freemius.pot'));
|
80 |
-
|
81 |
-
// Create English PO out of the POT.
|
82 |
-
return gulp.src(languagesFolder + 'freemius.pot')
|
83 |
-
.pipe(pofill({
|
84 |
-
items: function (item) {
|
85 |
-
// If msgstr is empty, use identity translation
|
86 |
-
if (!item.msgstr.length) {
|
87 |
-
item.msgstr = [''];
|
88 |
-
}
|
89 |
-
if (!item.msgstr[0]) {
|
90 |
-
item.msgstr[0] = item.msgid;
|
91 |
-
}
|
92 |
-
return item;
|
93 |
-
}
|
94 |
-
}))
|
95 |
-
.pipe(rename('freemius-en.po'))
|
96 |
-
.pipe(gulp.dest(languagesFolder));
|
97 |
-
});
|
98 |
-
|
99 |
-
// Push updated po resource to transifex.
|
100 |
-
gulp.task('update-transifex', ['prepare-source'], function () {
|
101 |
-
return gulp.src(languagesFolder + 'freemius-en.po')
|
102 |
-
.pipe(transifex.pushResource());
|
103 |
-
});
|
104 |
-
|
105 |
-
// Download latest *.po translations.
|
106 |
-
gulp.task('download-translations', ['update-transifex'], function () {
|
107 |
-
return gulp.src(languagesFolder + 'freemius-en.po')
|
108 |
-
.pipe(transifex.pullResource());
|
109 |
-
});
|
110 |
-
|
111 |
-
// Move translations to languages root.
|
112 |
-
gulp.task('prepare-translations', ['download-translations'], function () {
|
113 |
-
var folders = getFolders(languagesFolder);
|
114 |
-
|
115 |
-
return folders.map(function (folder) {
|
116 |
-
return gulp.src(path.join(languagesFolder, folder, 'freemius-en.po'))
|
117 |
-
.pipe(rename('freemius-' + folder + '.po'))
|
118 |
-
.pipe(gulp.dest(languagesFolder));
|
119 |
-
});
|
120 |
-
});
|
121 |
-
|
122 |
-
// Feel up empty translations with English.
|
123 |
-
gulp.task('translations-feelup', ['prepare-translations'], function () {
|
124 |
-
return gulp.src(languagesFolder + '*.po')
|
125 |
-
.pipe(pofill({
|
126 |
-
items: function (item) {
|
127 |
-
// If msgstr is empty, use identity translation
|
128 |
-
if (0 == item.msgstr.length) {
|
129 |
-
item.msgstr = [''];
|
130 |
-
}
|
131 |
-
if (0 == item.msgstr[0].length) {
|
132 |
-
// item.msgid[0] = item.msgid;
|
133 |
-
item.msgstr[0] = item.msgid;
|
134 |
-
}
|
135 |
-
return item;
|
136 |
-
}
|
137 |
-
}))
|
138 |
-
.pipe(gulp.dest(languagesFolder));
|
139 |
-
});
|
140 |
-
|
141 |
-
// Cleanup temporary translation folders.
|
142 |
-
gulp.task('cleanup', ['prepare-translations'], function () {
|
143 |
-
var folders = getFolders(languagesFolder);
|
144 |
-
|
145 |
-
return folders.map(function (folder) {
|
146 |
-
return gulp.src(path.join(languagesFolder, folder), {read: false})
|
147 |
-
.pipe(clean());
|
148 |
-
});
|
149 |
-
});
|
150 |
-
|
151 |
-
// Compile *.po to *.mo binaries for usage.
|
152 |
-
gulp.task('compile-translations', ['translations-feelup'], function () {
|
153 |
-
// Compile POs to MOs.
|
154 |
-
return gulp.src(languagesFolder + '*.po')
|
155 |
-
.pipe(gettext())
|
156 |
-
.pipe(gulp.dest(languagesFolder))
|
157 |
-
});
|
158 |
-
|
159 |
-
gulp.task('default', [], function () {
|
160 |
-
gulp.run('prepare-source');
|
161 |
-
gulp.run('update-transifex');
|
162 |
-
gulp.run('download-translations');
|
163 |
-
gulp.run('prepare-translations');
|
164 |
-
gulp.run('translations-feelup');
|
165 |
-
gulp.run('cleanup');
|
166 |
-
gulp.run('compile-translations');
|
167 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/pum-sdk/freemius/includes/class-freemius.php
CHANGED
@@ -1,14305 +1,19942 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
*
|
277 |
-
*
|
278 |
-
*
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
*
|
285 |
-
*
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
* @
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
if ( isset( $this->_storage->
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
$
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
|
2672 |
-
|
2673 |
-
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
-
|
2745 |
-
|
2746 |
-
|
2747 |
-
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
|
2754 |
-
|
2755 |
-
|
2756 |
-
|
2757 |
-
|
2758 |
-
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
2770 |
-
|
2771 |
-
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
|
2930 |
-
|
2931 |
-
|
2932 |
-
|
2933 |
-
|
2934 |
-
|
2935 |
-
|
2936 |
-
|
2937 |
-
|
2938 |
-
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
|
2975 |
-
|
2976 |
-
|
2977 |
-
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
}
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
|
3027 |
-
|
3028 |
-
|
3029 |
-
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
-
|
3037 |
-
|
3038 |
-
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
|
3046 |
-
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
3073 |
-
|
3074 |
-
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
-
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
|
3110 |
-
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
|
3133 |
-
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
3141 |
-
|
3142 |
-
|
3143 |
-
|
3144 |
-
|
3145 |
-
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
|
3150 |
-
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
-
|
3166 |
-
|
3167 |
-
|
3168 |
-
|
3169 |
-
|
3170 |
-
|
3171 |
-
|
3172 |
-
|
3173 |
-
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
|
3209 |
-
|
3210 |
-
|
3211 |
-
|
3212 |
-
|
3213 |
-
|
3214 |
-
|
3215 |
-
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
|
3240 |
-
|
3241 |
-
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
3293 |
-
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
|
3330 |
-
|
3331 |
-
|
3332 |
-
|
3333 |
-
|
3334 |
-
|
3335 |
-
|
3336 |
-
|
3337 |
-
|
3338 |
-
|
3339 |
-
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
|
3364 |
-
|
3365 |
-
|
3366 |
-
|
3367 |
-
|
3368 |
-
|
3369 |
-
|
3370 |
-
|
3371 |
-
|
3372 |
-
|
3373 |
-
|
3374 |
-
|
3375 |
-
|
3376 |
-
|
3377 |
-
|
3378 |
-
|
3379 |
-
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
|
3386 |
-
|
3387 |
-
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
//
|
3437 |
-
|
3438 |
-
|
3439 |
-
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
3459 |
-
|
3460 |
-
|
3461 |
-
|
3462 |
-
|
3463 |
-
|
3464 |
-
|
3465 |
-
|
3466 |
-
|
3467 |
-
|
3468 |
-
|
3469 |
-
|
3470 |
-
|
3471 |
-
|
3472 |
-
|
3473 |
-
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
3479 |
-
|
3480 |
-
|
3481 |
-
|
3482 |
-
|
3483 |
-
|
3484 |
-
|
3485 |
-
|
3486 |
-
|
3487 |
-
|
3488 |
-
|
3489 |
-
|
3490 |
-
|
3491 |
-
|
3492 |
-
|
3493 |
-
|
3494 |
-
|
3495 |
-
|
3496 |
-
|
3497 |
-
|
3498 |
-
|
3499 |
-
|
3500 |
-
|
3501 |
-
|
3502 |
-
|
3503 |
-
|
3504 |
-
|
3505 |
-
|
3506 |
-
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
3511 |
-
|
3512 |
-
|
3513 |
-
|
3514 |
-
|
3515 |
-
|
3516 |
-
|
3517 |
-
|
3518 |
-
|
3519 |
-
|
3520 |
-
|
3521 |
-
|
3522 |
-
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
3526 |
-
|
3527 |
-
|
3528 |
-
|
3529 |
-
|
3530 |
-
|
3531 |
-
|
3532 |
-
|
3533 |
-
|
3534 |
-
|
3535 |
-
|
3536 |
-
|
3537 |
-
|
3538 |
-
|
3539 |
-
|
3540 |
-
|
3541 |
-
|
3542 |
-
|
3543 |
-
|
3544 |
-
|
3545 |
-
|
3546 |
-
|
3547 |
-
|
3548 |
-
|
3549 |
-
|
3550 |
-
|
3551 |
-
|
3552 |
-
|
3553 |
-
|
3554 |
-
|
3555 |
-
|
3556 |
-
|
3557 |
-
|
3558 |
-
|
3559 |
-
|
3560 |
-
|
3561 |
-
|
3562 |
-
|
3563 |
-
|
3564 |
-
|
3565 |
-
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
3570 |
-
|
3571 |
-
|
3572 |
-
|
3573 |
-
|
3574 |
-
|
3575 |
-
|
3576 |
-
|
3577 |
-
|
3578 |
-
|
3579 |
-
|
3580 |
-
|
3581 |
-
|
3582 |
-
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
3588 |
-
|
3589 |
-
|
3590 |
-
|
3591 |
-
|
3592 |
-
|
3593 |
-
|
3594 |
-
|
3595 |
-
|
3596 |
-
|
3597 |
-
|
3598 |
-
|
3599 |
-
|
3600 |
-
|
3601 |
-
|
3602 |
-
|
3603 |
-
|
3604 |
-
|
3605 |
-
|
3606 |
-
|
3607 |
-
|
3608 |
-
|
3609 |
-
|
3610 |
-
|
3611 |
-
|
3612 |
-
|
3613 |
-
|
3614 |
-
|
3615 |
-
|
3616 |
-
|
3617 |
-
|
3618 |
-
|
3619 |
-
|
3620 |
-
|
3621 |
-
|
3622 |
-
|
3623 |
-
|
3624 |
-
|
3625 |
-
|
3626 |
-
|
3627 |
-
|
3628 |
-
|
3629 |
-
|
3630 |
-
|
3631 |
-
|
3632 |
-
|
3633 |
-
|
3634 |
-
|
3635 |
-
|
3636 |
-
|
3637 |
-
|
3638 |
-
|
3639 |
-
|
3640 |
-
|
3641 |
-
|
3642 |
-
|
3643 |
-
|
3644 |
-
|
3645 |
-
|
3646 |
-
|
3647 |
-
|
3648 |
-
|
3649 |
-
|
3650 |
-
|
3651 |
-
|
3652 |
-
|
3653 |
-
|
3654 |
-
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
3658 |
-
|
3659 |
-
|
3660 |
-
|
3661 |
-
|
3662 |
-
|
3663 |
-
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
3667 |
-
|
3668 |
-
|
3669 |
-
|
3670 |
-
|
3671 |
-
|
3672 |
-
|
3673 |
-
|
3674 |
-
|
3675 |
-
|
3676 |
-
|
3677 |
-
|
3678 |
-
|
3679 |
-
|
3680 |
-
|
3681 |
-
|
3682 |
-
|
3683 |
-
|
3684 |
-
|
3685 |
-
|
3686 |
-
|
3687 |
-
|
3688 |
-
|
3689 |
-
|
3690 |
-
|
3691 |
-
|
3692 |
-
|
3693 |
-
|
3694 |
-
|
3695 |
-
|
3696 |
-
|
3697 |
-
|
3698 |
-
|
3699 |
-
|
3700 |
-
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
3704 |
-
|
3705 |
-
|
3706 |
-
|
3707 |
-
|
3708 |
-
|
3709 |
-
|
3710 |
-
|
3711 |
-
|
3712 |
-
|
3713 |
-
|
3714 |
-
|
3715 |
-
|
3716 |
-
|
3717 |
-
|
3718 |
-
|
3719 |
-
|
3720 |
-
|
3721 |
-
|
3722 |
-
|
3723 |
-
|
3724 |
-
|
3725 |
-
|
3726 |
-
|
3727 |
-
|
3728 |
-
|
3729 |
-
|
3730 |
-
|
3731 |
-
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
-
|
3737 |
-
|
3738 |
-
|
3739 |
-
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
-
|
3744 |
-
|
3745 |
-
|
3746 |
-
|
3747 |
-
|
3748 |
-
|
3749 |
-
|
3750 |
-
|
3751 |
-
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
|
3757 |
-
|
3758 |
-
|
3759 |
-
|
3760 |
-
|
3761 |
-
|
3762 |
-
|
3763 |
-
|
3764 |
-
|
3765 |
-
|
3766 |
-
|
3767 |
-
|
3768 |
-
|
3769 |
-
|
3770 |
-
|
3771 |
-
|
3772 |
-
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
|
3777 |
-
|
3778 |
-
|
3779 |
-
|
3780 |
-
|
3781 |
-
|
3782 |
-
|
3783 |
-
|
3784 |
-
|
3785 |
-
|
3786 |
-
|
3787 |
-
|
3788 |
-
|
3789 |
-
|
3790 |
-
|
3791 |
-
|
3792 |
-
|
3793 |
-
|
3794 |
-
|
3795 |
-
|
3796 |
-
|
3797 |
-
|
3798 |
-
|
3799 |
-
|
3800 |
-
|
3801 |
-
|
3802 |
-
|
3803 |
-
|
3804 |
-
|
3805 |
-
|
3806 |
-
|
3807 |
-
|
3808 |
-
|
3809 |
-
|
3810 |
-
|
3811 |
-
|
3812 |
-
|
3813 |
-
|
3814 |
-
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
-
|
3820 |
-
|
3821 |
-
|
3822 |
-
|
3823 |
-
|
3824 |
-
|
3825 |
-
|
3826 |
-
|
3827 |
-
|
3828 |
-
|
3829 |
-
|
3830 |
-
|
3831 |
-
|
3832 |
-
|
3833 |
-
|
3834 |
-
|
3835 |
-
|
3836 |
-
|
3837 |
-
|
3838 |
-
|
3839 |
-
|
3840 |
-
|
3841 |
-
|
3842 |
-
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
3846 |
-
|
3847 |
-
|
3848 |
-
|
3849 |
-
|
3850 |
-
|
3851 |
-
|
3852 |
-
|
3853 |
-
|
3854 |
-
|
3855 |
-
|
3856 |
-
|
3857 |
-
|
3858 |
-
|
3859 |
-
|
3860 |
-
|
3861 |
-
|
3862 |
-
|
3863 |
-
|
3864 |
-
|
3865 |
-
|
3866 |
-
|
3867 |
-
|
3868 |
-
|
3869 |
-
|
3870 |
-
|
3871 |
-
|
3872 |
-
|
3873 |
-
|
3874 |
-
|
3875 |
-
|
3876 |
-
|
3877 |
-
|
3878 |
-
|
3879 |
-
|
3880 |
-
|
3881 |
-
|
3882 |
-
|
3883 |
-
|
3884 |
-
|
3885 |
-
|
3886 |
-
|
3887 |
-
|
3888 |
-
|
3889 |
-
|
3890 |
-
|
3891 |
-
|
3892 |
-
|
3893 |
-
|
3894 |
-
|
3895 |
-
|
3896 |
-
|
3897 |
-
|
3898 |
-
|
3899 |
-
|
3900 |
-
|
3901 |
-
|
3902 |
-
|
3903 |
-
|
3904 |
-
|
3905 |
-
|
3906 |
-
|
3907 |
-
|
3908 |
-
|
3909 |
-
|
3910 |
-
|
3911 |
-
|
3912 |
-
|
3913 |
-
|
3914 |
-
|
3915 |
-
|
3916 |
-
|
3917 |
-
|
3918 |
-
|
3919 |
-
|
3920 |
-
|
3921 |
-
|
3922 |
-
|
3923 |
-
|
3924 |
-
|
3925 |
-
|
3926 |
-
|
3927 |
-
|
3928 |
-
|
3929 |
-
|
3930 |
-
|
3931 |
-
|
3932 |
-
|
3933 |
-
|
3934 |
-
|
3935 |
-
|
3936 |
-
|
3937 |
-
|
3938 |
-
|
3939 |
-
|
3940 |
-
|
3941 |
-
|
3942 |
-
|
3943 |
-
|
3944 |
-
|
3945 |
-
|
3946 |
-
|
3947 |
-
|
3948 |
-
|
3949 |
-
|
3950 |
-
|
3951 |
-
|
3952 |
-
|
3953 |
-
|
3954 |
-
|
3955 |
-
|
3956 |
-
|
3957 |
-
|
3958 |
-
|
3959 |
-
|
3960 |
-
|
3961 |
-
|
3962 |
-
|
3963 |
-
|
3964 |
-
|
3965 |
-
|
3966 |
-
|
3967 |
-
|
3968 |
-
|
3969 |
-
|
3970 |
-
|
3971 |
-
|
3972 |
-
|
3973 |
-
|
3974 |
-
|
3975 |
-
|
3976 |
-
|
3977 |
-
|
3978 |
-
|
3979 |
-
|
3980 |
-
|
3981 |
-
|
3982 |
-
|
3983 |
-
|
3984 |
-
|
3985 |
-
|
3986 |
-
|
3987 |
-
|
3988 |
-
|
3989 |
-
|
3990 |
-
|
3991 |
-
|
3992 |
-
|
3993 |
-
|
3994 |
-
|
3995 |
-
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
3999 |
-
|
4000 |
-
|
4001 |
-
|
4002 |
-
|
4003 |
-
|
4004 |
-
|
4005 |
-
|
4006 |
-
|
4007 |
-
|
4008 |
-
|
4009 |
-
|
4010 |
-
|
4011 |
-
|
4012 |
-
|
4013 |
-
|
4014 |
-
|
4015 |
-
|
4016 |
-
|
4017 |
-
|
4018 |
-
|
4019 |
-
|
4020 |
-
|
4021 |
-
|
4022 |
-
|
4023 |
-
|
4024 |
-
|
4025 |
-
|
4026 |
-
|
4027 |
-
|
4028 |
-
|
4029 |
-
|
4030 |
-
|
4031 |
-
|
4032 |
-
|
4033 |
-
|
4034 |
-
|
4035 |
-
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
4039 |
-
|
4040 |
-
|
4041 |
-
|
4042 |
-
|
4043 |
-
|
4044 |
-
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
|
4049 |
-
|
4050 |
-
|
4051 |
-
|
4052 |
-
|
4053 |
-
|
4054 |
-
|
4055 |
-
|
4056 |
-
|
4057 |
-
|
4058 |
-
|
4059 |
-
|
4060 |
-
|
4061 |
-
|
4062 |
-
|
4063 |
-
|
4064 |
-
|
4065 |
-
|
4066 |
-
|
4067 |
-
|
4068 |
-
|
4069 |
-
|
4070 |
-
|
4071 |
-
|
4072 |
-
|
4073 |
-
|
4074 |
-
|
4075 |
-
|
4076 |
-
|
4077 |
-
|
4078 |
-
|
4079 |
-
|
4080 |
-
|
4081 |
-
|
4082 |
-
|
4083 |
-
|
4084 |
-
|
4085 |
-
|
4086 |
-
|
4087 |
-
|
4088 |
-
|
4089 |
-
|
4090 |
-
|
4091 |
-
|
4092 |
-
|
4093 |
-
|
4094 |
-
|
4095 |
-
|
4096 |
-
|
4097 |
-
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
4101 |
-
|
4102 |
-
|
4103 |
-
|
4104 |
-
|
4105 |
-
|
4106 |
-
|
4107 |
-
|
4108 |
-
|
4109 |
-
|
4110 |
-
|
4111 |
-
|
4112 |
-
|
4113 |
-
|
4114 |
-
|
4115 |
-
|
4116 |
-
|
4117 |
-
|
4118 |
-
|
4119 |
-
|
4120 |
-
|
4121 |
-
|
4122 |
-
|
4123 |
-
|
4124 |
-
|
4125 |
-
|
4126 |
-
|
4127 |
-
|
4128 |
-
|
4129 |
-
|
4130 |
-
|
4131 |
-
|
4132 |
-
|
4133 |
-
|
4134 |
-
|
4135 |
-
|
4136 |
-
|
4137 |
-
|
4138 |
-
|
4139 |
-
|
4140 |
-
|
4141 |
-
|
4142 |
-
|
4143 |
-
|
4144 |
-
|
4145 |
-
|
4146 |
-
|
4147 |
-
|
4148 |
-
|
4149 |
-
|
4150 |
-
|
4151 |
-
|
4152 |
-
|
4153 |
-
|
4154 |
-
|
4155 |
-
|
4156 |
-
|
4157 |
-
|
4158 |
-
|
4159 |
-
|
4160 |
-
|
4161 |
-
|
4162 |
-
|
4163 |
-
|
4164 |
-
|
4165 |
-
|
4166 |
-
|
4167 |
-
|
4168 |
-
|
4169 |
-
|
4170 |
-
|
4171 |
-
|
4172 |
-
|
4173 |
-
|
4174 |
-
|
4175 |
-
|
4176 |
-
|
4177 |
-
|
4178 |
-
|
4179 |
-
|
4180 |
-
|
4181 |
-
|
4182 |
-
|
4183 |
-
|
4184 |
-
|
4185 |
-
|
4186 |
-
|
4187 |
-
|
4188 |
-
|
4189 |
-
|
4190 |
-
|
4191 |
-
|
4192 |
-
|
4193 |
-
|
4194 |
-
|
4195 |
-
|
4196 |
-
|
4197 |
-
|
4198 |
-
|
4199 |
-
|
4200 |
-
|
4201 |
-
|
4202 |
-
|
4203 |
-
|
4204 |
-
|
4205 |
-
|
4206 |
-
|
4207 |
-
|
4208 |
-
|
4209 |
-
|
4210 |
-
|
4211 |
-
|
4212 |
-
|
4213 |
-
|
4214 |
-
|
4215 |
-
|
4216 |
-
|
4217 |
-
|
4218 |
-
|
4219 |
-
|
4220 |
-
|
4221 |
-
|
4222 |
-
|
4223 |
-
|
4224 |
-
|
4225 |
-
|
4226 |
-
|
4227 |
-
|
4228 |
-
|
4229 |
-
|
4230 |
-
|
4231 |
-
|
4232 |
-
|
4233 |
-
|
4234 |
-
|
4235 |
-
|
4236 |
-
|
4237 |
-
|
4238 |
-
|
4239 |
-
|
4240 |
-
|
4241 |
-
|
4242 |
-
|
4243 |
-
|
4244 |
-
|
4245 |
-
|
4246 |
-
|
4247 |
-
|
4248 |
-
|
4249 |
-
|
4250 |
-
|
4251 |
-
|
4252 |
-
|
4253 |
-
|
4254 |
-
|
4255 |
-
|
4256 |
-
|
4257 |
-
|
4258 |
-
|
4259 |
-
|
4260 |
-
|
4261 |
-
|
4262 |
-
|
4263 |
-
|
4264 |
-
|
4265 |
-
|
4266 |
-
|
4267 |
-
|
4268 |
-
|
4269 |
-
|
4270 |
-
|
4271 |
-
|
4272 |
-
|
4273 |
-
|
4274 |
-
|
4275 |
-
|
4276 |
-
|
4277 |
-
|
4278 |
-
|
4279 |
-
|
4280 |
-
|
4281 |
-
|
4282 |
-
|
4283 |
-
|
4284 |
-
|
4285 |
-
|
4286 |
-
|
4287 |
-
|
4288 |
-
|
4289 |
-
|
4290 |
-
|
4291 |
-
|
4292 |
-
|
4293 |
-
|
4294 |
-
|
4295 |
-
|
4296 |
-
|
4297 |
-
|
4298 |
-
|
4299 |
-
|
4300 |
-
|
4301 |
-
|
4302 |
-
|
4303 |
-
|
4304 |
-
|
4305 |
-
|
4306 |
-
|
4307 |
-
|
4308 |
-
|
4309 |
-
|
4310 |
-
|
4311 |
-
|
4312 |
-
|
4313 |
-
|
4314 |
-
|
4315 |
-
|
4316 |
-
|
4317 |
-
|
4318 |
-
|
4319 |
-
|
4320 |
-
|
4321 |
-
|
4322 |
-
|
4323 |
-
|
4324 |
-
|
4325 |
-
|
4326 |
-
|
4327 |
-
|
4328 |
-
|
4329 |
-
|
4330 |
-
|
4331 |
-
|
4332 |
-
|
4333 |
-
|
4334 |
-
|
4335 |
-
|
4336 |
-
|
4337 |
-
|
4338 |
-
|
4339 |
-
|
4340 |
-
|
4341 |
-
|
4342 |
-
|
4343 |
-
|
4344 |
-
|
4345 |
-
|
4346 |
-
|
4347 |
-
|
4348 |
-
|
4349 |
-
|
4350 |
-
|
4351 |
-
|
4352 |
-
|
4353 |
-
|
4354 |
-
|
4355 |
-
|
4356 |
-
|
4357 |
-
|
4358 |
-
|
4359 |
-
|
4360 |
-
|
4361 |
-
|
4362 |
-
|
4363 |
-
|
4364 |
-
|
4365 |
-
|
4366 |
-
|
4367 |
-
|
4368 |
-
|
4369 |
-
|
4370 |
-
|
4371 |
-
|
4372 |
-
|
4373 |
-
|
4374 |
-
|
4375 |
-
|
4376 |
-
|
4377 |
-
|
4378 |
-
|
4379 |
-
|
4380 |
-
|
4381 |
-
|
4382 |
-
|
4383 |
-
|
4384 |
-
|
4385 |
-
|
4386 |
-
|
4387 |
-
|
4388 |
-
|
4389 |
-
|
4390 |
-
|
4391 |
-
|
4392 |
-
|
4393 |
-
|
4394 |
-
|
4395 |
-
|
4396 |
-
|
4397 |
-
|
4398 |
-
|
4399 |
-
|
4400 |
-
|
4401 |
-
|
4402 |
-
|
4403 |
-
|
4404 |
-
|
4405 |
-
|
4406 |
-
|
4407 |
-
|
4408 |
-
|
4409 |
-
|
4410 |
-
|
4411 |
-
|
4412 |
-
|
4413 |
-
|
4414 |
-
|
4415 |
-
|
4416 |
-
|
4417 |
-
|
4418 |
-
|
4419 |
-
|
4420 |
-
|
4421 |
-
|
4422 |
-
|
4423 |
-
|
4424 |
-
|
4425 |
-
|
4426 |
-
|
4427 |
-
|
4428 |
-
|
4429 |
-
|
4430 |
-
|
4431 |
-
|
4432 |
-
|
4433 |
-
|
4434 |
-
|
4435 |
-
|
4436 |
-
|
4437 |
-
|
4438 |
-
|
4439 |
-
|
4440 |
-
|
4441 |
-
|
4442 |
-
|
4443 |
-
|
4444 |
-
|
4445 |
-
|
4446 |
-
|
4447 |
-
|
4448 |
-
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
|
4455 |
-
|
4456 |
-
|
4457 |
-
|
4458 |
-
|
4459 |
-
|
4460 |
-
|
4461 |
-
|
4462 |
-
|
4463 |
-
|
4464 |
-
|
4465 |
-
|
4466 |
-
|
4467 |
-
|
4468 |
-
|
4469 |
-
|
4470 |
-
|
4471 |
-
|
4472 |
-
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
-
|
4479 |
-
|
4480 |
-
|
4481 |
-
|
4482 |
-
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
4486 |
-
|
4487 |
-
|
4488 |
-
|
4489 |
-
|
4490 |
-
|
4491 |
-
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
|
4496 |
-
|
4497 |
-
|
4498 |
-
|
4499 |
-
|
4500 |
-
|
4501 |
-
|
4502 |
-
|
4503 |
-
|
4504 |
-
|
4505 |
-
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
-
|
4510 |
-
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
4517 |
-
|
4518 |
-
|
4519 |
-
|
4520 |
-
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
|
4526 |
-
|
4527 |
-
|
4528 |
-
|
4529 |
-
|
4530 |
-
|
4531 |
-
|
4532 |
-
|
4533 |
-
|
4534 |
-
|
4535 |
-
|
4536 |
-
|
4537 |
-
|
4538 |
-
|
4539 |
-
|
4540 |
-
|
4541 |
-
|
4542 |
-
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
|
4548 |
-
|
4549 |
-
|
4550 |
-
|
4551 |
-
|
4552 |
-
|
4553 |
-
|
4554 |
-
|
4555 |
-
|
4556 |
-
|
4557 |
-
|
4558 |
-
|
4559 |
-
|
4560 |
-
|
4561 |
-
|
4562 |
-
|
4563 |
-
|
4564 |
-
|
4565 |
-
|
4566 |
-
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
|
4575 |
-
|
4576 |
-
|
4577 |
-
|
4578 |
-
|
4579 |
-
|
4580 |
-
|
4581 |
-
|
4582 |
-
|
4583 |
-
|
4584 |
-
|
4585 |
-
|
4586 |
-
|
4587 |
-
|
4588 |
-
|
4589 |
-
|
4590 |
-
|
4591 |
-
|
4592 |
-
|
4593 |
-
|
4594 |
-
|
4595 |
-
|
4596 |
-
|
4597 |
-
|
4598 |
-
|
4599 |
-
|
4600 |
-
|
4601 |
-
|
4602 |
-
|
4603 |
-
|
4604 |
-
|
4605 |
-
|
4606 |
-
|
4607 |
-
|
4608 |
-
|
4609 |
-
|
4610 |
-
|
4611 |
-
|
4612 |
-
|
4613 |
-
|
4614 |
-
|
4615 |
-
|
4616 |
-
|
4617 |
-
|
4618 |
-
|
4619 |
-
|
4620 |
-
|
4621 |
-
|
4622 |
-
|
4623 |
-
|
4624 |
-
|
4625 |
-
|
4626 |
-
|
4627 |
-
|
4628 |
-
|
4629 |
-
|
4630 |
-
|
4631 |
-
|
4632 |
-
|
4633 |
-
|
4634 |
-
|
4635 |
-
|
4636 |
-
|
4637 |
-
|
4638 |
-
|
4639 |
-
|
4640 |
-
|
4641 |
-
|
4642 |
-
|
4643 |
-
|
4644 |
-
|
4645 |
-
|
4646 |
-
|
4647 |
-
|
4648 |
-
|
4649 |
-
|
4650 |
-
|
4651 |
-
|
4652 |
-
|
4653 |
-
|
4654 |
-
|
4655 |
-
|
4656 |
-
|
4657 |
-
|
4658 |
-
|
4659 |
-
|
4660 |
-
|
4661 |
-
|
4662 |
-
|
4663 |
-
|
4664 |
-
|
4665 |
-
|
4666 |
-
|
4667 |
-
|
4668 |
-
|
4669 |
-
|
4670 |
-
|
4671 |
-
|
4672 |
-
|
4673 |
-
|
4674 |
-
|
4675 |
-
|
4676 |
-
|
4677 |
-
|
4678 |
-
|
4679 |
-
|
4680 |
-
|
4681 |
-
|
4682 |
-
|
4683 |
-
|
4684 |
-
|
4685 |
-
|
4686 |
-
|
4687 |
-
|
4688 |
-
|
4689 |
-
|
4690 |
-
|
4691 |
-
|
4692 |
-
|
4693 |
-
|
4694 |
-
|
4695 |
-
|
4696 |
-
|
4697 |
-
|
4698 |
-
|
4699 |
-
|
4700 |
-
|
4701 |
-
|
4702 |
-
|
4703 |
-
|
4704 |
-
|
4705 |
-
|
4706 |
-
|
4707 |
-
|
4708 |
-
|
4709 |
-
|
4710 |
-
|
4711 |
-
|
4712 |
-
|
4713 |
-
|
4714 |
-
|
4715 |
-
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
|
4720 |
-
|
4721 |
-
|
4722 |
-
|
4723 |
-
|
4724 |
-
|
4725 |
-
|
4726 |
-
|
4727 |
-
|
4728 |
-
|
4729 |
-
|
4730 |
-
|
4731 |
-
|
4732 |
-
|
4733 |
-
|
4734 |
-
|
4735 |
-
|
4736 |
-
|
4737 |
-
|
4738 |
-
|
4739 |
-
|
4740 |
-
|
4741 |
-
|
4742 |
-
|
4743 |
-
|
4744 |
-
|
4745 |
-
|
4746 |
-
|
4747 |
-
|
4748 |
-
|
4749 |
-
|
4750 |
-
|
4751 |
-
|
4752 |
-
|
4753 |
-
|
4754 |
-
|
4755 |
-
|
4756 |
-
|
4757 |
-
|
4758 |
-
|
4759 |
-
|
4760 |
-
|
4761 |
-
|
4762 |
-
|
4763 |
-
|
4764 |
-
|
4765 |
-
|
4766 |
-
|
4767 |
-
|
4768 |
-
|
4769 |
-
|
4770 |
-
|
4771 |
-
|
4772 |
-
|
4773 |
-
|
4774 |
-
|
4775 |
-
|
4776 |
-
|
4777 |
-
|
4778 |
-
|
4779 |
-
|
4780 |
-
|
4781 |
-
|
4782 |
-
|
4783 |
-
|
4784 |
-
|
4785 |
-
|
4786 |
-
|
4787 |
-
|
4788 |
-
|
4789 |
-
|
4790 |
-
|
4791 |
-
|
4792 |
-
|
4793 |
-
|
4794 |
-
|
4795 |
-
|
4796 |
-
|
4797 |
-
|
4798 |
-
|
4799 |
-
|
4800 |
-
|
4801 |
-
|
4802 |
-
|
4803 |
-
|
4804 |
-
|
4805 |
-
|
4806 |
-
|
4807 |
-
|
4808 |
-
|
4809 |
-
|
4810 |
-
|
4811 |
-
|
4812 |
-
|
4813 |
-
|
4814 |
-
|
4815 |
-
|
4816 |
-
|
4817 |
-
|
4818 |
-
|
4819 |
-
|
4820 |
-
|
4821 |
-
|
4822 |
-
|
4823 |
-
|
4824 |
-
|
4825 |
-
|
4826 |
-
|
4827 |
-
|
4828 |
-
|
4829 |
-
|
4830 |
-
|
4831 |
-
|
4832 |
-
|
4833 |
-
|
4834 |
-
|
4835 |
-
|
4836 |
-
|
4837 |
-
|
4838 |
-
|
4839 |
-
|
4840 |
-
|
4841 |
-
|
4842 |
-
|
4843 |
-
|
4844 |
-
|
4845 |
-
|
4846 |
-
|
4847 |
-
|
4848 |
-
|
4849 |
-
|
4850 |
-
|
4851 |
-
|
4852 |
-
|
4853 |
-
|
4854 |
-
|
4855 |
-
|
4856 |
-
|
4857 |
-
|
4858 |
-
|
4859 |
-
|
4860 |
-
|
4861 |
-
|
4862 |
-
|
4863 |
-
|
4864 |
-
|
4865 |
-
|
4866 |
-
|
4867 |
-
|
4868 |
-
|
4869 |
-
|
4870 |
-
|
4871 |
-
|
4872 |
-
|
4873 |
-
|
4874 |
-
|
4875 |
-
|
4876 |
-
|
4877 |
-
|
4878 |
-
|
4879 |
-
|
4880 |
-
|
4881 |
-
|
4882 |
-
|
4883 |
-
|
4884 |
-
|
4885 |
-
|
4886 |
-
|
4887 |
-
|
4888 |
-
|
4889 |
-
|
4890 |
-
|
4891 |
-
|
4892 |
-
|
4893 |
-
|
4894 |
-
|
4895 |
-
|
4896 |
-
|
4897 |
-
|
4898 |
-
|
4899 |
-
|
4900 |
-
|
4901 |
-
|
4902 |
-
|
4903 |
-
|
4904 |
-
|
4905 |
-
|
4906 |
-
|
4907 |
-
|
4908 |
-
|
4909 |
-
|
4910 |
-
|
4911 |
-
|
4912 |
-
|
4913 |
-
|
4914 |
-
|
4915 |
-
|
4916 |
-
|
4917 |
-
|
4918 |
-
|
4919 |
-
|
4920 |
-
|
4921 |
-
|
4922 |
-
|
4923 |
-
|
4924 |
-
|
4925 |
-
|
4926 |
-
|
4927 |
-
|
4928 |
-
|
4929 |
-
|
4930 |
-
|
4931 |
-
|
4932 |
-
|
4933 |
-
|
4934 |
-
|
4935 |
-
|
4936 |
-
|
4937 |
-
|
4938 |
-
|
4939 |
-
|
4940 |
-
|
4941 |
-
|
4942 |
-
|
4943 |
-
|
4944 |
-
|
4945 |
-
|
4946 |
-
|
4947 |
-
|
4948 |
-
|
4949 |
-
|
4950 |
-
|
4951 |
-
|
4952 |
-
|
4953 |
-
|
4954 |
-
|
4955 |
-
|
4956 |
-
|
4957 |
-
|
4958 |
-
|
4959 |
-
|
4960 |
-
|
4961 |
-
|
4962 |
-
|
4963 |
-
|
4964 |
-
|
4965 |
-
|
4966 |
-
|
4967 |
-
|
4968 |
-
|
4969 |
-
|
4970 |
-
|
4971 |
-
|
4972 |
-
|
4973 |
-
|
4974 |
-
|
4975 |
-
|
4976 |
-
|
4977 |
-
|
4978 |
-
|
4979 |
-
|
4980 |
-
|
4981 |
-
|
4982 |
-
|
4983 |
-
|
4984 |
-
|
4985 |
-
|
4986 |
-
|
4987 |
-
|
4988 |
-
|
4989 |
-
|
4990 |
-
|
4991 |
-
|
4992 |
-
|
4993 |
-
|
4994 |
-
|
4995 |
-
|
4996 |
-
|
4997 |
-
|
4998 |
-
|
4999 |
-
|
5000 |
-
|
5001 |
-
|
5002 |
-
|
5003 |
-
|
5004 |
-
|
5005 |
-
|
5006 |
-
|
5007 |
-
|
5008 |
-
|
5009 |
-
|
5010 |
-
|
5011 |
-
|
5012 |
-
|
5013 |
-
|
5014 |
-
|
5015 |
-
|
5016 |
-
|
5017 |
-
|
5018 |
-
|
5019 |
-
|
5020 |
-
|
5021 |
-
|
5022 |
-
|
5023 |
-
|
5024 |
-
|
5025 |
-
|
5026 |
-
|
5027 |
-
|
5028 |
-
|
5029 |
-
|
5030 |
-
|
5031 |
-
|
5032 |
-
|
5033 |
-
|
5034 |
-
|
5035 |
-
|
5036 |
-
|
5037 |
-
|
5038 |
-
|
5039 |
-
|
5040 |
-
|
5041 |
-
|
5042 |
-
|
5043 |
-
|
5044 |
-
|
5045 |
-
|
5046 |
-
|
5047 |
-
|
5048 |
-
|
5049 |
-
|
5050 |
-
|
5051 |
-
|
5052 |
-
|
5053 |
-
|
5054 |
-
|
5055 |
-
|
5056 |
-
|
5057 |
-
|
5058 |
-
|
5059 |
-
|
5060 |
-
|
5061 |
-
|
5062 |
-
|
5063 |
-
|
5064 |
-
|
5065 |
-
|
5066 |
-
|
5067 |
-
|
5068 |
-
|
5069 |
-
|
5070 |
-
|
5071 |
-
|
5072 |
-
|
5073 |
-
|
5074 |
-
|
5075 |
-
|
5076 |
-
|
5077 |
-
|
5078 |
-
|
5079 |
-
|
5080 |
-
|
5081 |
-
|
5082 |
-
|
5083 |
-
|
5084 |
-
|
5085 |
-
|
5086 |
-
|
5087 |
-
|
5088 |
-
|
5089 |
-
|
5090 |
-
|
5091 |
-
|
5092 |
-
|
5093 |
-
|
5094 |
-
|
5095 |
-
|
5096 |
-
|
5097 |
-
|
5098 |
-
|
5099 |
-
|
5100 |
-
|
5101 |
-
|
5102 |
-
|
5103 |
-
|
5104 |
-
|
5105 |
-
|
5106 |
-
|
5107 |
-
|
5108 |
-
|
5109 |
-
|
5110 |
-
|
5111 |
-
|
5112 |
-
|
5113 |
-
|
5114 |
-
|
5115 |
-
|
5116 |
-
|
5117 |
-
|
5118 |
-
|
5119 |
-
|
5120 |
-
|
5121 |
-
|
5122 |
-
|
5123 |
-
|
5124 |
-
|
5125 |
-
|
5126 |
-
|
5127 |
-
|
5128 |
-
|
5129 |
-
|
5130 |
-
|
5131 |
-
|
5132 |
-
|
5133 |
-
|
5134 |
-
|
5135 |
-
|
5136 |
-
|
5137 |
-
|
5138 |
-
|
5139 |
-
|
5140 |
-
|
5141 |
-
|
5142 |
-
|
5143 |
-
|
5144 |
-
|
5145 |
-
|
5146 |
-
|
5147 |
-
|
5148 |
-
|
5149 |
-
|
5150 |
-
|
5151 |
-
|
5152 |
-
|
5153 |
-
|
5154 |
-
|
5155 |
-
|
5156 |
-
|
5157 |
-
|
5158 |
-
|
5159 |
-
|
5160 |
-
|
5161 |
-
|
5162 |
-
|
5163 |
-
|
5164 |
-
|
5165 |
-
|
5166 |
-
|
5167 |
-
|
5168 |
-
|
5169 |
-
|
5170 |
-
|
5171 |
-
|
5172 |
-
|
5173 |
-
|
5174 |
-
|
5175 |
-
|
5176 |
-
|
5177 |
-
|
5178 |
-
|
5179 |
-
|
5180 |
-
|
5181 |
-
|
5182 |
-
|
5183 |
-
|
5184 |
-
|
5185 |
-
|
5186 |
-
|
5187 |
-
|
5188 |
-
|
5189 |
-
|
5190 |
-
|
5191 |
-
|
5192 |
-
|
5193 |
-
|
5194 |
-
|
5195 |
-
|
5196 |
-
|
5197 |
-
|
5198 |
-
|
5199 |
-
|
5200 |
-
|
5201 |
-
|
5202 |
-
|
5203 |
-
|
5204 |
-
|
5205 |
-
|
5206 |
-
|
5207 |
-
|
5208 |
-
|
5209 |
-
|
5210 |
-
|
5211 |
-
|
5212 |
-
|
5213 |
-
|
5214 |
-
|
5215 |
-
|
5216 |
-
|
5217 |
-
|
5218 |
-
|
5219 |
-
|
5220 |
-
|
5221 |
-
|
5222 |
-
|
5223 |
-
|
5224 |
-
|
5225 |
-
|
5226 |
-
|
5227 |
-
|
5228 |
-
|
5229 |
-
|
5230 |
-
|
5231 |
-
|
5232 |
-
|
5233 |
-
|
5234 |
-
|
5235 |
-
|
5236 |
-
|
5237 |
-
|
5238 |
-
|
5239 |
-
|
5240 |
-
|
5241 |
-
|
5242 |
-
|
5243 |
-
|
5244 |
-
|
5245 |
-
|
5246 |
-
|
5247 |
-
|
5248 |
-
|
5249 |
-
|
5250 |
-
|
5251 |
-
|
5252 |
-
|
5253 |
-
|
5254 |
-
|
5255 |
-
|
5256 |
-
|
5257 |
-
|
5258 |
-
|
5259 |
-
|
5260 |
-
|
5261 |
-
|
5262 |
-
|
5263 |
-
|
5264 |
-
|
5265 |
-
|
5266 |
-
|
5267 |
-
|
5268 |
-
|
5269 |
-
|
5270 |
-
|
5271 |
-
|
5272 |
-
|
5273 |
-
|
5274 |
-
|
5275 |
-
|
5276 |
-
|
5277 |
-
|
5278 |
-
|
5279 |
-
|
5280 |
-
|
5281 |
-
|
5282 |
-
|
5283 |
-
|
5284 |
-
|
5285 |
-
|
5286 |
-
|
5287 |
-
|
5288 |
-
|
5289 |
-
|
5290 |
-
|
5291 |
-
|
5292 |
-
|
5293 |
-
|
5294 |
-
|
5295 |
-
|
5296 |
-
|
5297 |
-
|
5298 |
-
|
5299 |
-
|
5300 |
-
|
5301 |
-
|
5302 |
-
|
5303 |
-
|
5304 |
-
|
5305 |
-
|
5306 |
-
|
5307 |
-
|
5308 |
-
|
5309 |
-
|
5310 |
-
|
5311 |
-
|
5312 |
-
|
5313 |
-
|
5314 |
-
|
5315 |
-
|
5316 |
-
|
5317 |
-
|
5318 |
-
|
5319 |
-
|
5320 |
-
|
5321 |
-
|
5322 |
-
|
5323 |
-
|
5324 |
-
|
5325 |
-
|
5326 |
-
|
5327 |
-
|
5328 |
-
|
5329 |
-
|
5330 |
-
|
5331 |
-
|
5332 |
-
|
5333 |
-
|
5334 |
-
|
5335 |
-
|
5336 |
-
|
5337 |
-
|
5338 |
-
|
5339 |
-
|
5340 |
-
|
5341 |
-
|
5342 |
-
|
5343 |
-
|
5344 |
-
|
5345 |
-
|
5346 |
-
|
5347 |
-
|
5348 |
-
|
5349 |
-
|
5350 |
-
|
5351 |
-
|
5352 |
-
|
5353 |
-
|
5354 |
-
|
5355 |
-
|
5356 |
-
|
5357 |
-
|
5358 |
-
|
5359 |
-
|
5360 |
-
|
5361 |
-
|
5362 |
-
|
5363 |
-
|
5364 |
-
|
5365 |
-
|
5366 |
-
|
5367 |
-
|
5368 |
-
|
5369 |
-
|
5370 |
-
|
5371 |
-
|
5372 |
-
|
5373 |
-
|
5374 |
-
|
5375 |
-
|
5376 |
-
|
5377 |
-
|
5378 |
-
|
5379 |
-
|
5380 |
-
|
5381 |
-
|
5382 |
-
|
5383 |
-
|
5384 |
-
|
5385 |
-
|
5386 |
-
|
5387 |
-
|
5388 |
-
|
5389 |
-
|
5390 |
-
|
5391 |
-
|
5392 |
-
|
5393 |
-
|
5394 |
-
|
5395 |
-
|
5396 |
-
|
5397 |
-
|
5398 |
-
|
5399 |
-
|
5400 |
-
|
5401 |
-
|
5402 |
-
|
5403 |
-
|
5404 |
-
|
5405 |
-
|
5406 |
-
|
5407 |
-
|
5408 |
-
|
5409 |
-
|
5410 |
-
|
5411 |
-
|
5412 |
-
|
5413 |
-
|
5414 |
-
|
5415 |
-
|
5416 |
-
|
5417 |
-
|
5418 |
-
|
5419 |
-
|
5420 |
-
|
5421 |
-
|
5422 |
-
|
5423 |
-
|
5424 |
-
|
5425 |
-
|
5426 |
-
|
5427 |
-
|
5428 |
-
|
5429 |
-
|
5430 |
-
|
5431 |
-
|
5432 |
-
|
5433 |
-
|
5434 |
-
|
5435 |
-
|
5436 |
-
|
5437 |
-
|
5438 |
-
|
5439 |
-
|
5440 |
-
|
5441 |
-
|
5442 |
-
|
5443 |
-
|
5444 |
-
|
5445 |
-
|
5446 |
-
|
5447 |
-
|
5448 |
-
|
5449 |
-
|
5450 |
-
|
5451 |
-
|
5452 |
-
|
5453 |
-
|
5454 |
-
|
5455 |
-
|
5456 |
-
|
5457 |
-
|
5458 |
-
|
5459 |
-
|
5460 |
-
|
5461 |
-
|
5462 |
-
|
5463 |
-
|
5464 |
-
|
5465 |
-
|
5466 |
-
|
5467 |
-
|
5468 |
-
|
5469 |
-
|
5470 |
-
|
5471 |
-
|
5472 |
-
|
5473 |
-
|
5474 |
-
|
5475 |
-
|
5476 |
-
|
5477 |
-
|
5478 |
-
|
5479 |
-
|
5480 |
-
|
5481 |
-
|
5482 |
-
|
5483 |
-
|
5484 |
-
|
5485 |
-
|
5486 |
-
|
5487 |
-
|
5488 |
-
|
5489 |
-
|
5490 |
-
|
5491 |
-
|
5492 |
-
|
5493 |
-
|
5494 |
-
|
5495 |
-
|
5496 |
-
|
5497 |
-
|
5498 |
-
|
5499 |
-
|
5500 |
-
|
5501 |
-
|
5502 |
-
|
5503 |
-
|
5504 |
-
|
5505 |
-
|
5506 |
-
|
5507 |
-
|
5508 |
-
|
5509 |
-
|
5510 |
-
|
5511 |
-
|
5512 |
-
|
5513 |
-
|
5514 |
-
|
5515 |
-
|
5516 |
-
|
5517 |
-
|
5518 |
-
|
5519 |
-
|
5520 |
-
|
5521 |
-
|
5522 |
-
|
5523 |
-
|
5524 |
-
|
5525 |
-
|
5526 |
-
|
5527 |
-
|
5528 |
-
|
5529 |
-
|
5530 |
-
|
5531 |
-
|
5532 |
-
|
5533 |
-
|
5534 |
-
|
5535 |
-
|
5536 |
-
|
5537 |
-
|
5538 |
-
|
5539 |
-
|
5540 |
-
|
5541 |
-
|
5542 |
-
|
5543 |
-
|
5544 |
-
|
5545 |
-
|
5546 |
-
|
5547 |
-
|
5548 |
-
|
5549 |
-
|
5550 |
-
|
5551 |
-
|
5552 |
-
|
5553 |
-
|
5554 |
-
|
5555 |
-
|
5556 |
-
|
5557 |
-
|
5558 |
-
|
5559 |
-
|
5560 |
-
|
5561 |
-
|
5562 |
-
|
5563 |
-
|
5564 |
-
|
5565 |
-
|
5566 |
-
|
5567 |
-
|
5568 |
-
|
5569 |
-
|
5570 |
-
|
5571 |
-
|
5572 |
-
|
5573 |
-
|
5574 |
-
|
5575 |
-
|
5576 |
-
|
5577 |
-
|
5578 |
-
|
5579 |
-
|
5580 |
-
|
5581 |
-
|
5582 |
-
|
5583 |
-
|
5584 |
-
|
5585 |
-
|
5586 |
-
|
5587 |
-
|
5588 |
-
|
5589 |
-
|
5590 |
-
|
5591 |
-
|
5592 |
-
|
5593 |
-
|
5594 |
-
|
5595 |
-
|
5596 |
-
|
5597 |
-
|
5598 |
-
|
5599 |
-
|
5600 |
-
|
5601 |
-
|
5602 |
-
|
5603 |
-
|
5604 |
-
|
5605 |
-
|
5606 |
-
|
5607 |
-
|
5608 |
-
|
5609 |
-
|
5610 |
-
|
5611 |
-
|
5612 |
-
|
5613 |
-
|
5614 |
-
|
5615 |
-
|
5616 |
-
|
5617 |
-
|
5618 |
-
|
5619 |
-
|
5620 |
-
|
5621 |
-
|
5622 |
-
|
5623 |
-
|
5624 |
-
|
5625 |
-
|
5626 |
-
|
5627 |
-
|
5628 |
-
|
5629 |
-
|
5630 |
-
|
5631 |
-
|
5632 |
-
|
5633 |
-
|
5634 |
-
|
5635 |
-
|
5636 |
-
|
5637 |
-
|
5638 |
-
|
5639 |
-
|
5640 |
-
|
5641 |
-
|
5642 |
-
|
5643 |
-
|
5644 |
-
|
5645 |
-
|
5646 |
-
|
5647 |
-
|
5648 |
-
|
5649 |
-
|
5650 |
-
|
5651 |
-
|
5652 |
-
|
5653 |
-
|
5654 |
-
|
5655 |
-
|
5656 |
-
|
5657 |
-
|
5658 |
-
|
5659 |
-
|
5660 |
-
|
5661 |
-
|
5662 |
-
|
5663 |
-
|
5664 |
-
|
5665 |
-
|
5666 |
-
|
5667 |
-
|
5668 |
-
|
5669 |
-
|
5670 |
-
|
5671 |
-
|
5672 |
-
|
5673 |
-
|
5674 |
-
|
5675 |
-
|
5676 |
-
|
5677 |
-
|
5678 |
-
|
5679 |
-
|
5680 |
-
|
5681 |
-
|
5682 |
-
|
5683 |
-
|
5684 |
-
|
5685 |
-
|
5686 |
-
|
5687 |
-
|
5688 |
-
|
5689 |
-
|
5690 |
-
|
5691 |
-
|
5692 |
-
|
5693 |
-
|
5694 |
-
|
5695 |
-
|
5696 |
-
|
5697 |
-
|
5698 |
-
|
5699 |
-
|
5700 |
-
|
5701 |
-
|
5702 |
-
|
5703 |
-
|
5704 |
-
|
5705 |
-
|
5706 |
-
|
5707 |
-
|
5708 |
-
|
5709 |
-
|
5710 |
-
|
5711 |
-
|
5712 |
-
|
5713 |
-
|
5714 |
-
|
5715 |
-
|
5716 |
-
|
5717 |
-
|
5718 |
-
|
5719 |
-
|
5720 |
-
|
5721 |
-
|
5722 |
-
|
5723 |
-
|
5724 |
-
|
5725 |
-
|
5726 |
-
|
5727 |
-
|
5728 |
-
|
5729 |
-
|
5730 |
-
|
5731 |
-
|
5732 |
-
|
5733 |
-
|
5734 |
-
|
5735 |
-
|
5736 |
-
|
5737 |
-
|
5738 |
-
|
5739 |
-
|
5740 |
-
|
5741 |
-
|
5742 |
-
|
5743 |
-
|
5744 |
-
|
5745 |
-
|
5746 |
-
|
5747 |
-
|
5748 |
-
|
5749 |
-
|
5750 |
-
|
5751 |
-
|
5752 |
-
|
5753 |
-
|
5754 |
-
|
5755 |
-
|
5756 |
-
|
5757 |
-
|
5758 |
-
|
5759 |
-
|
5760 |
-
|
5761 |
-
|
5762 |
-
|
5763 |
-
|
5764 |
-
|
5765 |
-
|
5766 |
-
|
5767 |
-
|
5768 |
-
|
5769 |
-
|
5770 |
-
|
5771 |
-
|
5772 |
-
|
5773 |
-
|
5774 |
-
|
5775 |
-
|
5776 |
-
|
5777 |
-
|
5778 |
-
|
5779 |
-
|
5780 |
-
|
5781 |
-
|
5782 |
-
|
5783 |
-
|
5784 |
-
|
5785 |
-
|
5786 |
-
|
5787 |
-
|
5788 |
-
|
5789 |
-
|
5790 |
-
|
5791 |
-
|
5792 |
-
|
5793 |
-
|
5794 |
-
|
5795 |
-
|
5796 |
-
|
5797 |
-
|
5798 |
-
|
5799 |
-
|
5800 |
-
|
5801 |
-
|
5802 |
-
|
5803 |
-
|
5804 |
-
|
5805 |
-
|
5806 |
-
|
5807 |
-
|
5808 |
-
|
5809 |
-
|
5810 |
-
|
5811 |
-
|
5812 |
-
|
5813 |
-
|
5814 |
-
|
5815 |
-
|
5816 |
-
|
5817 |
-
|
5818 |
-
|
5819 |
-
|
5820 |
-
|
5821 |
-
|
5822 |
-
|
5823 |
-
|
5824 |
-
|
5825 |
-
|
5826 |
-
|
5827 |
-
|
5828 |
-
|
5829 |
-
|
5830 |
-
|
5831 |
-
|
5832 |
-
|
5833 |
-
|
5834 |
-
|
5835 |
-
|
5836 |
-
|
5837 |
-
|
5838 |
-
|
5839 |
-
|
5840 |
-
|
5841 |
-
|
5842 |
-
|
5843 |
-
|
5844 |
-
|
5845 |
-
|
5846 |
-
|
5847 |
-
|
5848 |
-
|
5849 |
-
|
5850 |
-
|
5851 |
-
|
5852 |
-
|
5853 |
-
|
5854 |
-
|
5855 |
-
|
5856 |
-
|
5857 |
-
|
5858 |
-
|
5859 |
-
|
5860 |
-
|
5861 |
-
|
5862 |
-
|
5863 |
-
|
5864 |
-
|
5865 |
-
|
5866 |
-
|
5867 |
-
|
5868 |
-
|
5869 |
-
|
5870 |
-
|
5871 |
-
|
5872 |
-
|
5873 |
-
|
5874 |
-
|
5875 |
-
|
5876 |
-
|
5877 |
-
|
5878 |
-
|
5879 |
-
|
5880 |
-
|
5881 |
-
|
5882 |
-
|
5883 |
-
|
5884 |
-
|
5885 |
-
|
5886 |
-
|
5887 |
-
|
5888 |
-
|
5889 |
-
|
5890 |
-
|
5891 |
-
|
5892 |
-
|
5893 |
-
|
5894 |
-
|
5895 |
-
|
5896 |
-
|
5897 |
-
|
5898 |
-
|
5899 |
-
|
5900 |
-
|
5901 |
-
|
5902 |
-
|
5903 |
-
|
5904 |
-
|
5905 |
-
|
5906 |
-
|
5907 |
-
|
5908 |
-
|
5909 |
-
|
5910 |
-
|
5911 |
-
|
5912 |
-
|
5913 |
-
|
5914 |
-
|
5915 |
-
|
5916 |
-
|
5917 |
-
|
5918 |
-
|
5919 |
-
|
5920 |
-
|
5921 |
-
|
5922 |
-
|
5923 |
-
|
5924 |
-
|
5925 |
-
|
5926 |
-
|
5927 |
-
|
5928 |
-
|
5929 |
-
|
5930 |
-
|
5931 |
-
|
5932 |
-
|
5933 |
-
|
5934 |
-
|
5935 |
-
|
5936 |
-
|
5937 |
-
|
5938 |
-
|
5939 |
-
|
5940 |
-
|
5941 |
-
|
5942 |
-
|
5943 |
-
|
5944 |
-
|
5945 |
-
|
5946 |
-
|
5947 |
-
|
5948 |
-
|
5949 |
-
|
5950 |
-
|
5951 |
-
|
5952 |
-
|
5953 |
-
|
5954 |
-
|
5955 |
-
|
5956 |
-
|
5957 |
-
|
5958 |
-
|
5959 |
-
|
5960 |
-
|
5961 |
-
|
5962 |
-
|
5963 |
-
|
5964 |
-
|
5965 |
-
|
5966 |
-
|
5967 |
-
|
5968 |
-
|
5969 |
-
|
5970 |
-
|
5971 |
-
|
5972 |
-
|
5973 |
-
|
5974 |
-
|
5975 |
-
|
5976 |
-
|
5977 |
-
|
5978 |
-
|
5979 |
-
|
5980 |
-
|
5981 |
-
|
5982 |
-
|
5983 |
-
|
5984 |
-
|
5985 |
-
|
5986 |
-
|
5987 |
-
|
5988 |
-
|
5989 |
-
|
5990 |
-
|
5991 |
-
|
5992 |
-
|
5993 |
-
|
5994 |
-
|
5995 |
-
|
5996 |
-
|
5997 |
-
|
5998 |
-
|
5999 |
-
|
6000 |
-
|
6001 |
-
|
6002 |
-
|
6003 |
-
|
6004 |
-
|
6005 |
-
|
6006 |
-
|
6007 |
-
|
6008 |
-
|
6009 |
-
|
6010 |
-
|
6011 |
-
|
6012 |
-
|
6013 |
-
|
6014 |
-
|
6015 |
-
|
6016 |
-
|
6017 |
-
|
6018 |
-
|
6019 |
-
|
6020 |
-
|
6021 |
-
|
6022 |
-
|
6023 |
-
|
6024 |
-
|
6025 |
-
|
6026 |
-
|
6027 |
-
|
6028 |
-
|
6029 |
-
|
6030 |
-
|
6031 |
-
|
6032 |
-
|
6033 |
-
|
6034 |
-
|
6035 |
-
|
6036 |
-
|
6037 |
-
|
6038 |
-
|
6039 |
-
|
6040 |
-
|
6041 |
-
|
6042 |
-
|
6043 |
-
|
6044 |
-
|
6045 |
-
|
6046 |
-
|
6047 |
-
|
6048 |
-
|
6049 |
-
|
6050 |
-
|
6051 |
-
|
6052 |
-
|
6053 |
-
|
6054 |
-
|
6055 |
-
|
6056 |
-
|
6057 |
-
|
6058 |
-
|
6059 |
-
|
6060 |
-
|
6061 |
-
|
6062 |
-
|
6063 |
-
|
6064 |
-
|
6065 |
-
|
6066 |
-
|
6067 |
-
|
6068 |
-
|
6069 |
-
|
6070 |
-
|
6071 |
-
|
6072 |
-
|
6073 |
-
|
6074 |
-
|
6075 |
-
|
6076 |
-
|
6077 |
-
|
6078 |
-
|
6079 |
-
|
6080 |
-
|
6081 |
-
|
6082 |
-
|
6083 |
-
|
6084 |
-
|
6085 |
-
|
6086 |
-
|
6087 |
-
|
6088 |
-
|
6089 |
-
|
6090 |
-
|
6091 |
-
|
6092 |
-
|
6093 |
-
|
6094 |
-
|
6095 |
-
|
6096 |
-
|
6097 |
-
|
6098 |
-
|
6099 |
-
|
6100 |
-
|
6101 |
-
|
6102 |
-
|
6103 |
-
|
6104 |
-
|
6105 |
-
|
6106 |
-
|
6107 |
-
|
6108 |
-
|
6109 |
-
|
6110 |
-
|
6111 |
-
|
6112 |
-
|
6113 |
-
|
6114 |
-
|
6115 |
-
|
6116 |
-
|
6117 |
-
|
6118 |
-
|
6119 |
-
|
6120 |
-
|
6121 |
-
|
6122 |
-
|
6123 |
-
|
6124 |
-
|
6125 |
-
|
6126 |
-
|
6127 |
-
|
6128 |
-
|
6129 |
-
|
6130 |
-
|
6131 |
-
|
6132 |
-
|
6133 |
-
|
6134 |
-
|
6135 |
-
|
6136 |
-
|
6137 |
-
|
6138 |
-
|
6139 |
-
|
6140 |
-
|
6141 |
-
|
6142 |
-
|
6143 |
-
|
6144 |
-
|
6145 |
-
|
6146 |
-
|
6147 |
-
|
6148 |
-
|
6149 |
-
|
6150 |
-
|
6151 |
-
|
6152 |
-
|
6153 |
-
|
6154 |
-
|
6155 |
-
|
6156 |
-
|
6157 |
-
|
6158 |
-
|
6159 |
-
|
6160 |
-
|
6161 |
-
|
6162 |
-
|
6163 |
-
|
6164 |
-
|
6165 |
-
|
6166 |
-
|
6167 |
-
|
6168 |
-
|
6169 |
-
|
6170 |
-
|
6171 |
-
|
6172 |
-
|
6173 |
-
|
6174 |
-
|
6175 |
-
|
6176 |
-
|
6177 |
-
|
6178 |
-
|
6179 |
-
|
6180 |
-
|
6181 |
-
|
6182 |
-
|
6183 |
-
|
6184 |
-
|
6185 |
-
|
6186 |
-
|
6187 |
-
|
6188 |
-
|
6189 |
-
|
6190 |
-
|
6191 |
-
|
6192 |
-
|
6193 |
-
|
6194 |
-
|
6195 |
-
|
6196 |
-
|
6197 |
-
|
6198 |
-
|
6199 |
-
|
6200 |
-
|
6201 |
-
|
6202 |
-
|
6203 |
-
|
6204 |
-
|
6205 |
-
|
6206 |
-
|
6207 |
-
|
6208 |
-
|
6209 |
-
|
6210 |
-
|
6211 |
-
|
6212 |
-
|
6213 |
-
|
6214 |
-
|
6215 |
-
|
6216 |
-
|
6217 |
-
|
6218 |
-
|
6219 |
-
|
6220 |
-
|
6221 |
-
|
6222 |
-
|
6223 |
-
|
6224 |
-
|
6225 |
-
|
6226 |
-
|
6227 |
-
|
6228 |
-
|
6229 |
-
|
6230 |
-
|
6231 |
-
|
6232 |
-
|
6233 |
-
|
6234 |
-
|
6235 |
-
|
6236 |
-
|
6237 |
-
|
6238 |
-
|
6239 |
-
|
6240 |
-
|
6241 |
-
|
6242 |
-
|
6243 |
-
|
6244 |
-
|
6245 |
-
|
6246 |
-
|
6247 |
-
|
6248 |
-
|
6249 |
-
|
6250 |
-
|
6251 |
-
|
6252 |
-
|
6253 |
-
|
6254 |
-
|
6255 |
-
|
6256 |
-
|
6257 |
-
|
6258 |
-
|
6259 |
-
|
6260 |
-
|
6261 |
-
|
6262 |
-
|
6263 |
-
|
6264 |
-
|
6265 |
-
|
6266 |
-
|
6267 |
-
|
6268 |
-
|
6269 |
-
|
6270 |
-
|
6271 |
-
|
6272 |
-
|
6273 |
-
|
6274 |
-
|
6275 |
-
|
6276 |
-
|
6277 |
-
|
6278 |
-
|
6279 |
-
|
6280 |
-
|
6281 |
-
|
6282 |
-
|
6283 |
-
|
6284 |
-
|
6285 |
-
|
6286 |
-
|
6287 |
-
|
6288 |
-
|
6289 |
-
|
6290 |
-
|
6291 |
-
|
6292 |
-
|
6293 |
-
|
6294 |
-
|
6295 |
-
|
6296 |
-
|
6297 |
-
|
6298 |
-
|
6299 |
-
|
6300 |
-
|
6301 |
-
|
6302 |
-
|
6303 |
-
|
6304 |
-
|
6305 |
-
|
6306 |
-
|
6307 |
-
|
6308 |
-
|
6309 |
-
|
6310 |
-
|
6311 |
-
|
6312 |
-
|
6313 |
-
|
6314 |
-
|
6315 |
-
|
6316 |
-
|
6317 |
-
|
6318 |
-
|
6319 |
-
|
6320 |
-
|
6321 |
-
|
6322 |
-
|
6323 |
-
|
6324 |
-
|
6325 |
-
|
6326 |
-
|
6327 |
-
|
6328 |
-
|
6329 |
-
|
6330 |
-
|
6331 |
-
|
6332 |
-
|
6333 |
-
|
6334 |
-
|
6335 |
-
|
6336 |
-
|
6337 |
-
|
6338 |
-
|
6339 |
-
|
6340 |
-
|
6341 |
-
|
6342 |
-
|
6343 |
-
|
6344 |
-
|
6345 |
-
|
6346 |
-
|
6347 |
-
|
6348 |
-
|
6349 |
-
|
6350 |
-
|
6351 |
-
|
6352 |
-
|
6353 |
-
|
6354 |
-
|
6355 |
-
|
6356 |
-
|
6357 |
-
|
6358 |
-
|
6359 |
-
|
6360 |
-
|
6361 |
-
|
6362 |
-
|
6363 |
-
|
6364 |
-
|
6365 |
-
|
6366 |
-
|
6367 |
-
|
6368 |
-
|
6369 |
-
|
6370 |
-
|
6371 |
-
|
6372 |
-
|
6373 |
-
|
6374 |
-
|
6375 |
-
|
6376 |
-
|
6377 |
-
|
6378 |
-
|
6379 |
-
|
6380 |
-
|
6381 |
-
|
6382 |
-
|
6383 |
-
|
6384 |
-
|
6385 |
-
|
6386 |
-
|
6387 |
-
|
6388 |
-
|
6389 |
-
|
6390 |
-
|
6391 |
-
|
6392 |
-
|
6393 |
-
|
6394 |
-
|
6395 |
-
|
6396 |
-
|
6397 |
-
|
6398 |
-
|
6399 |
-
|
6400 |
-
|
6401 |
-
|
6402 |
-
|
6403 |
-
|
6404 |
-
|
6405 |
-
|
6406 |
-
|
6407 |
-
|
6408 |
-
|
6409 |
-
|
6410 |
-
|
6411 |
-
|
6412 |
-
|
6413 |
-
|
6414 |
-
|
6415 |
-
|
6416 |
-
|
6417 |
-
|
6418 |
-
|
6419 |
-
|
6420 |
-
|
6421 |
-
|
6422 |
-
|
6423 |
-
|
6424 |
-
|
6425 |
-
|
6426 |
-
|
6427 |
-
|
6428 |
-
|
6429 |
-
|
6430 |
-
|
6431 |
-
|
6432 |
-
|
6433 |
-
|
6434 |
-
|
6435 |
-
|
6436 |
-
|
6437 |
-
|
6438 |
-
|
6439 |
-
|
6440 |
-
|
6441 |
-
|
6442 |
-
|
6443 |
-
|
6444 |
-
|
6445 |
-
|
6446 |
-
|
6447 |
-
|
6448 |
-
|
6449 |
-
|
6450 |
-
|
6451 |
-
|
6452 |
-
|
6453 |
-
|
6454 |
-
|
6455 |
-
|
6456 |
-
|
6457 |
-
|
6458 |
-
|
6459 |
-
|
6460 |
-
|
6461 |
-
|
6462 |
-
|
6463 |
-
|
6464 |
-
|
6465 |
-
|
6466 |
-
|
6467 |
-
|
6468 |
-
|
6469 |
-
|
6470 |
-
|
6471 |
-
|
6472 |
-
|
6473 |
-
|
6474 |
-
|
6475 |
-
|
6476 |
-
|
6477 |
-
|
6478 |
-
|
6479 |
-
|
6480 |
-
|
6481 |
-
|
6482 |
-
|
6483 |
-
|
6484 |
-
|
6485 |
-
|
6486 |
-
|
6487 |
-
|
6488 |
-
|
6489 |
-
|
6490 |
-
|
6491 |
-
|
6492 |
-
|
6493 |
-
|
6494 |
-
|
6495 |
-
|
6496 |
-
|
6497 |
-
|
6498 |
-
|
6499 |
-
|
6500 |
-
|
6501 |
-
|
6502 |
-
|
6503 |
-
|
6504 |
-
|
6505 |
-
|
6506 |
-
|
6507 |
-
|
6508 |
-
|
6509 |
-
|
6510 |
-
|
6511 |
-
|
6512 |
-
|
6513 |
-
|
6514 |
-
|
6515 |
-
|
6516 |
-
|
6517 |
-
|
6518 |
-
|
6519 |
-
|
6520 |
-
|
6521 |
-
|
6522 |
-
|
6523 |
-
|
6524 |
-
|
6525 |
-
|
6526 |
-
|
6527 |
-
|
6528 |
-
|
6529 |
-
|
6530 |
-
|
6531 |
-
|
6532 |
-
|
6533 |
-
|
6534 |
-
|
6535 |
-
|
6536 |
-
|
6537 |
-
|
6538 |
-
|
6539 |
-
|
6540 |
-
|
6541 |
-
|
6542 |
-
|
6543 |
-
|
6544 |
-
|
6545 |
-
|
6546 |
-
|
6547 |
-
|
6548 |
-
|
6549 |
-
|
6550 |
-
|
6551 |
-
|
6552 |
-
|
6553 |
-
|
6554 |
-
|
6555 |
-
|
6556 |
-
|
6557 |
-
|
6558 |
-
|
6559 |
-
|
6560 |
-
|
6561 |
-
|
6562 |
-
|
6563 |
-
|
6564 |
-
|
6565 |
-
|
6566 |
-
|
6567 |
-
|
6568 |
-
|
6569 |
-
|
6570 |
-
|
6571 |
-
|
6572 |
-
|
6573 |
-
|
6574 |
-
|
6575 |
-
|
6576 |
-
|
6577 |
-
|
6578 |
-
|
6579 |
-
|
6580 |
-
|
6581 |
-
|
6582 |
-
|
6583 |
-
|
6584 |
-
|
6585 |
-
|
6586 |
-
|
6587 |
-
|
6588 |
-
|
6589 |
-
|
6590 |
-
|
6591 |
-
|
6592 |
-
|
6593 |
-
|
6594 |
-
|
6595 |
-
|
6596 |
-
|
6597 |
-
|
6598 |
-
|
6599 |
-
|
6600 |
-
|
6601 |
-
|
6602 |
-
|
6603 |
-
|
6604 |
-
|
6605 |
-
|
6606 |
-
|
6607 |
-
|
6608 |
-
|
6609 |
-
|
6610 |
-
|
6611 |
-
|
6612 |
-
|
6613 |
-
|
6614 |
-
|
6615 |
-
|
6616 |
-
|
6617 |
-
|
6618 |
-
|
6619 |
-
|
6620 |
-
|
6621 |
-
|
6622 |
-
|
6623 |
-
|
6624 |
-
|
6625 |
-
|
6626 |
-
|
6627 |
-
|
6628 |
-
|
6629 |
-
|
6630 |
-
|
6631 |
-
|
6632 |
-
|
6633 |
-
|
6634 |
-
|
6635 |
-
|
6636 |
-
|
6637 |
-
|
6638 |
-
|
6639 |
-
|
6640 |
-
|
6641 |
-
|
6642 |
-
|
6643 |
-
|
6644 |
-
|
6645 |
-
|
6646 |
-
|
6647 |
-
|
6648 |
-
|
6649 |
-
|
6650 |
-
|
6651 |
-
|
6652 |
-
|
6653 |
-
|
6654 |
-
|
6655 |
-
|
6656 |
-
|
6657 |
-
|
6658 |
-
|
6659 |
-
|
6660 |
-
|
6661 |
-
|
6662 |
-
|
6663 |
-
|
6664 |
-
|
6665 |
-
|
6666 |
-
|
6667 |
-
|
6668 |
-
|
6669 |
-
|
6670 |
-
|
6671 |
-
|
6672 |
-
|
6673 |
-
|
6674 |
-
|
6675 |
-
|
6676 |
-
|
6677 |
-
|
6678 |
-
|
6679 |
-
|
6680 |
-
|
6681 |
-
|
6682 |
-
|
6683 |
-
|
6684 |
-
|
6685 |
-
|
6686 |
-
|
6687 |
-
|
6688 |
-
|
6689 |
-
|
6690 |
-
|
6691 |
-
|
6692 |
-
|
6693 |
-
|
6694 |
-
|
6695 |
-
|
6696 |
-
|
6697 |
-
|
6698 |
-
|
6699 |
-
|
6700 |
-
|
6701 |
-
|
6702 |
-
|
6703 |
-
|
6704 |
-
|
6705 |
-
|
6706 |
-
|
6707 |
-
|
6708 |
-
|
6709 |
-
|
6710 |
-
|
6711 |
-
|
6712 |
-
|
6713 |
-
|
6714 |
-
|
6715 |
-
|
6716 |
-
|
6717 |
-
|
6718 |
-
|
6719 |
-
|
6720 |
-
|
6721 |
-
|
6722 |
-
|
6723 |
-
|
6724 |
-
|
6725 |
-
|
6726 |
-
|
6727 |
-
|
6728 |
-
|
6729 |
-
|
6730 |
-
|
6731 |
-
|
6732 |
-
|
6733 |
-
|
6734 |
-
|
6735 |
-
|
6736 |
-
|
6737 |
-
|
6738 |
-
|
6739 |
-
|
6740 |
-
|
6741 |
-
|
6742 |
-
|
6743 |
-
|
6744 |
-
|
6745 |
-
|
6746 |
-
|
6747 |
-
|
6748 |
-
|
6749 |
-
|
6750 |
-
|
6751 |
-
|
6752 |
-
|
6753 |
-
|
6754 |
-
|
6755 |
-
|
6756 |
-
|
6757 |
-
|
6758 |
-
|
6759 |
-
|
6760 |
-
|
6761 |
-
|
6762 |
-
|
6763 |
-
|
6764 |
-
|
6765 |
-
|
6766 |
-
|
6767 |
-
|
6768 |
-
|
6769 |
-
|
6770 |
-
|
6771 |
-
|
6772 |
-
|
6773 |
-
|
6774 |
-
|
6775 |
-
|
6776 |
-
|
6777 |
-
|
6778 |
-
|
6779 |
-
|
6780 |
-
|
6781 |
-
|
6782 |
-
|
6783 |
-
|
6784 |
-
|
6785 |
-
|
6786 |
-
|
6787 |
-
|
6788 |
-
|
6789 |
-
|
6790 |
-
|
6791 |
-
|
6792 |
-
|
6793 |
-
|
6794 |
-
|
6795 |
-
|
6796 |
-
|
6797 |
-
|
6798 |
-
|
6799 |
-
|
6800 |
-
|
6801 |
-
|
6802 |
-
|
6803 |
-
|
6804 |
-
|
6805 |
-
|
6806 |
-
|
6807 |
-
|
6808 |
-
|
6809 |
-
|
6810 |
-
|
6811 |
-
|
6812 |
-
|
6813 |
-
|
6814 |
-
|
6815 |
-
|
6816 |
-
|
6817 |
-
|
6818 |
-
|
6819 |
-
|
6820 |
-
|
6821 |
-
|
6822 |
-
|
6823 |
-
|
6824 |
-
|
6825 |
-
|
6826 |
-
|
6827 |
-
|
6828 |
-
|
6829 |
-
|
6830 |
-
|
6831 |
-
|
6832 |
-
|
6833 |
-
|
6834 |
-
|
6835 |
-
|
6836 |
-
|
6837 |
-
|
6838 |
-
|
6839 |
-
|
6840 |
-
|
6841 |
-
|
6842 |
-
|
6843 |
-
|
6844 |
-
|
6845 |
-
|
6846 |
-
|
6847 |
-
|
6848 |
-
|
6849 |
-
|
6850 |
-
|
6851 |
-
|
6852 |
-
|
6853 |
-
|
6854 |
-
|
6855 |
-
|
6856 |
-
|
6857 |
-
|
6858 |
-
|
6859 |
-
|
6860 |
-
|
6861 |
-
|
6862 |
-
|
6863 |
-
|
6864 |
-
|
6865 |
-
|
6866 |
-
|
6867 |
-
|
6868 |
-
|
6869 |
-
|
6870 |
-
|
6871 |
-
|
6872 |
-
|
6873 |
-
|
6874 |
-
|
6875 |
-
|
6876 |
-
|
6877 |
-
|
6878 |
-
|
6879 |
-
|
6880 |
-
|
6881 |
-
|
6882 |
-
|
6883 |
-
|
6884 |
-
|
6885 |
-
|
6886 |
-
|
6887 |
-
|
6888 |
-
|
6889 |
-
|
6890 |
-
|
6891 |
-
|
6892 |
-
|
6893 |
-
|
6894 |
-
|
6895 |
-
|
6896 |
-
|
6897 |
-
|
6898 |
-
|
6899 |
-
|
6900 |
-
|
6901 |
-
|
6902 |
-
|
6903 |
-
|
6904 |
-
|
6905 |
-
|
6906 |
-
|
6907 |
-
|
6908 |
-
|
6909 |
-
|
6910 |
-
|
6911 |
-
|
6912 |
-
|
6913 |
-
|
6914 |
-
|
6915 |
-
|
6916 |
-
|
6917 |
-
|
6918 |
-
|
6919 |
-
|
6920 |
-
|
6921 |
-
|
6922 |
-
|
6923 |
-
|
6924 |
-
|
6925 |
-
|
6926 |
-
|
6927 |
-
|
6928 |
-
|
6929 |
-
|
6930 |
-
|
6931 |
-
|
6932 |
-
|
6933 |
-
|
6934 |
-
|
6935 |
-
|
6936 |
-
|
6937 |
-
|
6938 |
-
|
6939 |
-
|
6940 |
-
|
6941 |
-
|
6942 |
-
|
6943 |
-
|
6944 |
-
|
6945 |
-
|
6946 |
-
|
6947 |
-
|
6948 |
-
|
6949 |
-
|
6950 |
-
|
6951 |
-
|
6952 |
-
|
6953 |
-
|
6954 |
-
|
6955 |
-
|
6956 |
-
|
6957 |
-
|
6958 |
-
|
6959 |
-
|
6960 |
-
|
6961 |
-
|
6962 |
-
|
6963 |
-
|
6964 |
-
|
6965 |
-
|
6966 |
-
|
6967 |
-
|
6968 |
-
|
6969 |
-
|
6970 |
-
|
6971 |
-
|
6972 |
-
|
6973 |
-
|
6974 |
-
|
6975 |
-
|
6976 |
-
|
6977 |
-
|
6978 |
-
|
6979 |
-
|
6980 |
-
|
6981 |
-
|
6982 |
-
|
6983 |
-
|
6984 |
-
|
6985 |
-
|
6986 |
-
|
6987 |
-
|
6988 |
-
|
6989 |
-
|
6990 |
-
|
6991 |
-
|
6992 |
-
|
6993 |
-
|
6994 |
-
|
6995 |
-
|
6996 |
-
|
6997 |
-
|
6998 |
-
|
6999 |
-
|
7000 |
-
|
7001 |
-
|
7002 |
-
|
7003 |
-
|
7004 |
-
|
7005 |
-
|
7006 |
-
|
7007 |
-
|
7008 |
-
|
7009 |
-
|
7010 |
-
|
7011 |
-
|
7012 |
-
|
7013 |
-
|
7014 |
-
|
7015 |
-
|
7016 |
-
|
7017 |
-
|
7018 |
-
|
7019 |
-
|
7020 |
-
|
7021 |
-
|
7022 |
-
|
7023 |
-
|
7024 |
-
|
7025 |
-
|
7026 |
-
|
7027 |
-
|
7028 |
-
|
7029 |
-
|
7030 |
-
|
7031 |
-
|
7032 |
-
|
7033 |
-
|
7034 |
-
|
7035 |
-
|
7036 |
-
|
7037 |
-
|
7038 |
-
|
7039 |
-
|
7040 |
-
|
7041 |
-
|
7042 |
-
|
7043 |
-
|
7044 |
-
|
7045 |
-
|
7046 |
-
|
7047 |
-
|
7048 |
-
|
7049 |
-
|
7050 |
-
|
7051 |
-
|
7052 |
-
|
7053 |
-
|
7054 |
-
|
7055 |
-
|
7056 |
-
|
7057 |
-
|
7058 |
-
|
7059 |
-
|
7060 |
-
|
7061 |
-
|
7062 |
-
|
7063 |
-
|
7064 |
-
|
7065 |
-
|
7066 |
-
|
7067 |
-
|
7068 |
-
|
7069 |
-
|
7070 |
-
|
7071 |
-
|
7072 |
-
|
7073 |
-
|
7074 |
-
|
7075 |
-
|
7076 |
-
|
7077 |
-
|
7078 |
-
|
7079 |
-
|
7080 |
-
|
7081 |
-
|
7082 |
-
|
7083 |
-
|
7084 |
-
|
7085 |
-
|
7086 |
-
|
7087 |
-
|
7088 |
-
|
7089 |
-
|
7090 |
-
|
7091 |
-
|
7092 |
-
|
7093 |
-
|
7094 |
-
|
7095 |
-
|
7096 |
-
|
7097 |
-
|
7098 |
-
|
7099 |
-
|
7100 |
-
|
7101 |
-
|
7102 |
-
|
7103 |
-
|
7104 |
-
|
7105 |
-
|
7106 |
-
|
7107 |
-
|
7108 |
-
|
7109 |
-
|
7110 |
-
|
7111 |
-
|
7112 |
-
|
7113 |
-
|
7114 |
-
|
7115 |
-
|
7116 |
-
|
7117 |
-
|
7118 |
-
|
7119 |
-
|
7120 |
-
|
7121 |
-
|
7122 |
-
|
7123 |
-
|
7124 |
-
|
7125 |
-
|
7126 |
-
|
7127 |
-
|
7128 |
-
|
7129 |
-
|
7130 |
-
|
7131 |
-
|
7132 |
-
|
7133 |
-
|
7134 |
-
|
7135 |
-
|
7136 |
-
|
7137 |
-
|
7138 |
-
|
7139 |
-
|
7140 |
-
|
7141 |
-
|
7142 |
-
|
7143 |
-
|
7144 |
-
|
7145 |
-
|
7146 |
-
|
7147 |
-
|
7148 |
-
|
7149 |
-
|
7150 |
-
|
7151 |
-
|
7152 |
-
|
7153 |
-
|
7154 |
-
|
7155 |
-
|
7156 |
-
|
7157 |
-
|
7158 |
-
|
7159 |
-
|
7160 |
-
|
7161 |
-
|
7162 |
-
|
7163 |
-
|
7164 |
-
|
7165 |
-
|
7166 |
-
|
7167 |
-
|
7168 |
-
|
7169 |
-
|
7170 |
-
|
7171 |
-
|
7172 |
-
|
7173 |
-
|
7174 |
-
|
7175 |
-
|
7176 |
-
|
7177 |
-
|
7178 |
-
|
7179 |
-
|
7180 |
-
|
7181 |
-
|
7182 |
-
|
7183 |
-
|
7184 |
-
|
7185 |
-
|
7186 |
-
|
7187 |
-
|
7188 |
-
|
7189 |
-
|
7190 |
-
|
7191 |
-
|
7192 |
-
|
7193 |
-
|
7194 |
-
|
7195 |
-
|
7196 |
-
|
7197 |
-
|
7198 |
-
|
7199 |
-
|
7200 |
-
|
7201 |
-
|
7202 |
-
|
7203 |
-
|
7204 |
-
|
7205 |
-
|
7206 |
-
|
7207 |
-
|
7208 |
-
|
7209 |
-
|
7210 |
-
|
7211 |
-
|
7212 |
-
|
7213 |
-
|
7214 |
-
|
7215 |
-
|
7216 |
-
|
7217 |
-
|
7218 |
-
|
7219 |
-
|
7220 |
-
|
7221 |
-
|
7222 |
-
|
7223 |
-
|
7224 |
-
|
7225 |
-
|
7226 |
-
|
7227 |
-
|
7228 |
-
|
7229 |
-
|
7230 |
-
|
7231 |
-
|
7232 |
-
|
7233 |
-
|
7234 |
-
|
7235 |
-
|
7236 |
-
|
7237 |
-
|
7238 |
-
|
7239 |
-
|
7240 |
-
|
7241 |
-
|
7242 |
-
|
7243 |
-
|
7244 |
-
|
7245 |
-
|
7246 |
-
|
7247 |
-
|
7248 |
-
|
7249 |
-
|
7250 |
-
|
7251 |
-
|
7252 |
-
|
7253 |
-
|
7254 |
-
|
7255 |
-
|
7256 |
-
|
7257 |
-
|
7258 |
-
|
7259 |
-
|
7260 |
-
|
7261 |
-
|
7262 |
-
|
7263 |
-
|
7264 |
-
|
7265 |
-
|
7266 |
-
|
7267 |
-
|
7268 |
-
|
7269 |
-
|
7270 |
-
|
7271 |
-
|
7272 |
-
|
7273 |
-
|
7274 |
-
|
7275 |
-
|
7276 |
-
|
7277 |
-
|
7278 |
-
|
7279 |
-
|
7280 |
-
|
7281 |
-
|
7282 |
-
|
7283 |
-
|
7284 |
-
|
7285 |
-
|
7286 |
-
|
7287 |
-
|
7288 |
-
|
7289 |
-
|
7290 |
-
|
7291 |
-
|
7292 |
-
|
7293 |
-
|
7294 |
-
|
7295 |
-
|
7296 |
-
|
7297 |
-
|
7298 |
-
|
7299 |
-
|
7300 |
-
|
7301 |
-
|
7302 |
-
|
7303 |
-
|
7304 |
-
|
7305 |
-
|
7306 |
-
|
7307 |
-
|
7308 |
-
|
7309 |
-
|
7310 |
-
|
7311 |
-
|
7312 |
-
|
7313 |
-
|
7314 |
-
|
7315 |
-
|
7316 |
-
|
7317 |
-
|
7318 |
-
|
7319 |
-
|
7320 |
-
|
7321 |
-
|
7322 |
-
|
7323 |
-
|
7324 |
-
|
7325 |
-
|
7326 |
-
|
7327 |
-
|
7328 |
-
|
7329 |
-
|
7330 |
-
|
7331 |
-
|
7332 |
-
|
7333 |
-
|
7334 |
-
|
7335 |
-
|
7336 |
-
|
7337 |
-
|
7338 |
-
|
7339 |
-
|
7340 |
-
|
7341 |
-
|
7342 |
-
|
7343 |
-
|
7344 |
-
|
7345 |
-
|
7346 |
-
|
7347 |
-
|
7348 |
-
|
7349 |
-
|
7350 |
-
|
7351 |
-
|
7352 |
-
|
7353 |
-
}
|
7354 |
-
|
7355 |
-
|
7356 |
-
|
7357 |
-
|
7358 |
-
|
7359 |
-
|
7360 |
-
|
7361 |
-
|
7362 |
-
|
7363 |
-
|
7364 |
-
|
7365 |
-
|
7366 |
-
|
7367 |
-
|
7368 |
-
|
7369 |
-
|
7370 |
-
|
7371 |
-
|
7372 |
-
|
7373 |
-
|
7374 |
-
|
7375 |
-
|
7376 |
-
|
7377 |
-
|
7378 |
-
|
7379 |
-
|
7380 |
-
|
7381 |
-
|
7382 |
-
|
7383 |
-
|
7384 |
-
|
7385 |
-
|
7386 |
-
|
7387 |
-
|
7388 |
-
|
7389 |
-
|
7390 |
-
|
7391 |
-
|
7392 |
-
|
7393 |
-
|
7394 |
-
|
7395 |
-
|
7396 |
-
|
7397 |
-
|
7398 |
-
|
7399 |
-
|
7400 |
-
|
7401 |
-
|
7402 |
-
|
7403 |
-
|
7404 |
-
|
7405 |
-
|
7406 |
-
|
7407 |
-
|
7408 |
-
|
7409 |
-
|
7410 |
-
|
7411 |
-
|
7412 |
-
|
7413 |
-
|
7414 |
-
|
7415 |
-
|
7416 |
-
|
7417 |
-
|
7418 |
-
|
7419 |
-
|
7420 |
-
|
7421 |
-
|
7422 |
-
|
7423 |
-
|
7424 |
-
|
7425 |
-
|
7426 |
-
|
7427 |
-
|
7428 |
-
|
7429 |
-
|
7430 |
-
$
|
7431 |
-
|
7432 |
-
$
|
7433 |
-
|
7434 |
-
|
7435 |
-
|
7436 |
-
|
7437 |
-
|
7438 |
-
|
7439 |
-
$
|
7440 |
-
|
7441 |
-
|
7442 |
-
|
7443 |
-
|
7444 |
-
|
7445 |
-
|
7446 |
-
|
7447 |
-
|
7448 |
-
|
7449 |
-
|
7450 |
-
|
7451 |
-
|
7452 |
-
|
7453 |
-
|
7454 |
-
|
7455 |
-
|
7456 |
-
|
7457 |
-
|
7458 |
-
|
7459 |
-
|
7460 |
-
|
7461 |
-
|
7462 |
-
|
7463 |
-
|
7464 |
-
|
7465 |
-
|
7466 |
-
|
7467 |
-
|
7468 |
-
|
7469 |
-
|
7470 |
-
|
7471 |
-
|
7472 |
-
|
7473 |
-
|
7474 |
-
|
7475 |
-
|
7476 |
-
|
7477 |
-
|
7478 |
-
|
7479 |
-
|
7480 |
-
|
7481 |
-
|
7482 |
-
$
|
7483 |
-
|
7484 |
-
|
7485 |
-
|
7486 |
-
|
7487 |
-
|
7488 |
-
|
7489 |
-
|
7490 |
-
|
7491 |
-
|
7492 |
-
|
7493 |
-
|
7494 |
-
|
7495 |
-
|
7496 |
-
|
7497 |
-
|
7498 |
-
|
7499 |
-
|
7500 |
-
|
7501 |
-
|
7502 |
-
|
7503 |
-
|
7504 |
-
|
7505 |
-
|
7506 |
-
|
7507 |
-
|
7508 |
-
|
7509 |
-
|
7510 |
-
}
|
7511 |
-
|
7512 |
-
|
7513 |
-
|
7514 |
-
|
7515 |
-
|
7516 |
-
|
7517 |
-
|
7518 |
-
|
7519 |
-
* @
|
7520 |
-
*
|
7521 |
-
*
|
7522 |
-
* @
|
7523 |
-
|
7524 |
-
|
7525 |
-
|
7526 |
-
|
7527 |
-
|
7528 |
-
|
7529 |
-
|
7530 |
-
|
7531 |
-
|
7532 |
-
|
7533 |
-
|
7534 |
-
|
7535 |
-
|
7536 |
-
|
7537 |
-
|
7538 |
-
|
7539 |
-
|
7540 |
-
|
7541 |
-
|
7542 |
-
|
7543 |
-
|
7544 |
-
|
7545 |
-
|
7546 |
-
|
7547 |
-
|
7548 |
-
|
7549 |
-
|
7550 |
-
|
7551 |
-
|
7552 |
-
|
7553 |
-
|
7554 |
-
|
7555 |
-
|
7556 |
-
|
7557 |
-
|
7558 |
-
|
7559 |
-
|
7560 |
-
|
7561 |
-
|
7562 |
-
|
7563 |
-
|
7564 |
-
|
7565 |
-
|
7566 |
-
|
7567 |
-
|
7568 |
-
|
7569 |
-
|
7570 |
-
|
7571 |
-
|
7572 |
-
|
7573 |
-
|
7574 |
-
|
7575 |
-
|
7576 |
-
|
7577 |
-
|
7578 |
-
|
7579 |
-
|
7580 |
-
|
7581 |
-
|
7582 |
-
|
7583 |
-
|
7584 |
-
|
7585 |
-
|
7586 |
-
|
7587 |
-
|
7588 |
-
|
7589 |
-
|
7590 |
-
|
7591 |
-
|
7592 |
-
|
7593 |
-
|
7594 |
-
|
7595 |
-
|
7596 |
-
|
7597 |
-
|
7598 |
-
|
7599 |
-
|
7600 |
-
|
7601 |
-
|
7602 |
-
|
7603 |
-
|
7604 |
-
|
7605 |
-
|
7606 |
-
|
7607 |
-
|
7608 |
-
|
7609 |
-
|
7610 |
-
|
7611 |
-
|
7612 |
-
|
7613 |
-
|
7614 |
-
|
7615 |
-
|
7616 |
-
|
7617 |
-
|
7618 |
-
|
7619 |
-
|
7620 |
-
|
7621 |
-
|
7622 |
-
|
7623 |
-
|
7624 |
-
|
7625 |
-
|
7626 |
-
|
7627 |
-
|
7628 |
-
|
7629 |
-
|
7630 |
-
|
7631 |
-
|
7632 |
-
|
7633 |
-
|
7634 |
-
|
7635 |
-
|
7636 |
-
|
7637 |
-
|
7638 |
-
|
7639 |
-
|
7640 |
-
|
7641 |
-
|
7642 |
-
|
7643 |
-
|
7644 |
-
|
7645 |
-
|
7646 |
-
|
7647 |
-
|
7648 |
-
|
7649 |
-
|
7650 |
-
|
7651 |
-
|
7652 |
-
|
7653 |
-
|
7654 |
-
|
7655 |
-
|
7656 |
-
|
7657 |
-
|
7658 |
-
|
7659 |
-
|
7660 |
-
|
7661 |
-
|
7662 |
-
|
7663 |
-
|
7664 |
-
|
7665 |
-
|
7666 |
-
|
7667 |
-
|
7668 |
-
|
7669 |
-
|
7670 |
-
|
7671 |
-
|
7672 |
-
|
7673 |
-
|
7674 |
-
|
7675 |
-
|
7676 |
-
|
7677 |
-
|
7678 |
-
|
7679 |
-
|
7680 |
-
|
7681 |
-
|
7682 |
-
|
7683 |
-
|
7684 |
-
|
7685 |
-
|
7686 |
-
|
7687 |
-
|
7688 |
-
|
7689 |
-
|
7690 |
-
|
7691 |
-
|
7692 |
-
|
7693 |
-
|
7694 |
-
|
7695 |
-
|
7696 |
-
|
7697 |
-
|
7698 |
-
|
7699 |
-
|
7700 |
-
|
7701 |
-
|
7702 |
-
|
7703 |
-
|
7704 |
-
|
7705 |
-
|
7706 |
-
|
7707 |
-
|
7708 |
-
|
7709 |
-
|
7710 |
-
|
7711 |
-
|
7712 |
-
|
7713 |
-
|
7714 |
-
|
7715 |
-
|
7716 |
-
|
7717 |
-
|
7718 |
-
|
7719 |
-
|
7720 |
-
|
7721 |
-
|
7722 |
-
|
7723 |
-
|
7724 |
-
|
7725 |
-
|
7726 |
-
|
7727 |
-
|
7728 |
-
|
7729 |
-
|
7730 |
-
|
7731 |
-
|
7732 |
-
|
7733 |
-
|
7734 |
-
|
7735 |
-
|
7736 |
-
|
7737 |
-
|
7738 |
-
|
7739 |
-
|
7740 |
-
|
7741 |
-
|
7742 |
-
|
7743 |
-
|
7744 |
-
|
7745 |
-
|
7746 |
-
|
7747 |
-
|
7748 |
-
|
7749 |
-
|
7750 |
-
|
7751 |
-
|
7752 |
-
|
7753 |
-
|
7754 |
-
|
7755 |
-
|
7756 |
-
|
7757 |
-
|
7758 |
-
|
7759 |
-
|
7760 |
-
|
7761 |
-
|
7762 |
-
|
7763 |
-
|
7764 |
-
|
7765 |
-
|
7766 |
-
|
7767 |
-
|
7768 |
-
|
7769 |
-
|
7770 |
-
|
7771 |
-
|
7772 |
-
|
7773 |
-
|
7774 |
-
|
7775 |
-
|
7776 |
-
|
7777 |
-
|
7778 |
-
|
7779 |
-
|
7780 |
-
|
7781 |
-
|
7782 |
-
|
7783 |
-
|
7784 |
-
|
7785 |
-
|
7786 |
-
|
7787 |
-
|
7788 |
-
|
7789 |
-
|
7790 |
-
|
7791 |
-
|
7792 |
-
|
7793 |
-
|
7794 |
-
|
7795 |
-
|
7796 |
-
|
7797 |
-
|
7798 |
-
|
7799 |
-
|
7800 |
-
|
7801 |
-
|
7802 |
-
|
7803 |
-
|
7804 |
-
|
7805 |
-
|
7806 |
-
|
7807 |
-
|
7808 |
-
|
7809 |
-
|
7810 |
-
|
7811 |
-
|
7812 |
-
|
7813 |
-
|
7814 |
-
|
7815 |
-
|
7816 |
-
|
7817 |
-
|
7818 |
-
|
7819 |
-
|
7820 |
-
|
7821 |
-
|
7822 |
-
|
7823 |
-
|
7824 |
-
|
7825 |
-
|
7826 |
-
|
7827 |
-
|
7828 |
-
|
7829 |
-
|
7830 |
-
|
7831 |
-
|
7832 |
-
|
7833 |
-
|
7834 |
-
|
7835 |
-
|
7836 |
-
|
7837 |
-
|
7838 |
-
|
7839 |
-
|
7840 |
-
|
7841 |
-
|
7842 |
-
|
7843 |
-
|
7844 |
-
|
7845 |
-
|
7846 |
-
|
7847 |
-
|
7848 |
-
|
7849 |
-
|
7850 |
-
|
7851 |
-
|
7852 |
-
|
7853 |
-
|
7854 |
-
|
7855 |
-
|
7856 |
-
|
7857 |
-
|
7858 |
-
|
7859 |
-
|
7860 |
-
|
7861 |
-
|
7862 |
-
|
7863 |
-
|
7864 |
-
|
7865 |
-
|
7866 |
-
|
7867 |
-
|
7868 |
-
|
7869 |
-
|
7870 |
-
|
7871 |
-
|
7872 |
-
|
7873 |
-
|
7874 |
-
|
7875 |
-
|
7876 |
-
|
7877 |
-
|
7878 |
-
|
7879 |
-
|
7880 |
-
|
7881 |
-
|
7882 |
-
|
7883 |
-
|
7884 |
-
|
7885 |
-
|
7886 |
-
|
7887 |
-
|
7888 |
-
|
7889 |
-
|
7890 |
-
|
7891 |
-
|
7892 |
-
|
7893 |
-
|
7894 |
-
|
7895 |
-
|
7896 |
-
|
7897 |
-
|
7898 |
-
|
7899 |
-
|
7900 |
-
|
7901 |
-
|
7902 |
-
|
7903 |
-
|
7904 |
-
|
7905 |
-
|
7906 |
-
|
7907 |
-
|
7908 |
-
|
7909 |
-
|
7910 |
-
|
7911 |
-
|
7912 |
-
|
7913 |
-
|
7914 |
-
|
7915 |
-
|
7916 |
-
|
7917 |
-
|
7918 |
-
|
7919 |
-
|
7920 |
-
|
7921 |
-
|
7922 |
-
|
7923 |
-
|
7924 |
-
|
7925 |
-
|
7926 |
-
|
7927 |
-
|
7928 |
-
|
7929 |
-
|
7930 |
-
|
7931 |
-
|
7932 |
-
|
7933 |
-
|
7934 |
-
|
7935 |
-
|
7936 |
-
|
7937 |
-
|
7938 |
-
|
7939 |
-
|
7940 |
-
|
7941 |
-
|
7942 |
-
|
7943 |
-
|
7944 |
-
|
7945 |
-
|
7946 |
-
|
7947 |
-
|
7948 |
-
|
7949 |
-
|
7950 |
-
|
7951 |
-
|
7952 |
-
|
7953 |
-
|
7954 |
-
|
7955 |
-
|
7956 |
-
|
7957 |
-
|
7958 |
-
|
7959 |
-
|
7960 |
-
|
7961 |
-
|
7962 |
-
|
7963 |
-
|
7964 |
-
|
7965 |
-
|
7966 |
-
|
7967 |
-
|
7968 |
-
|
7969 |
-
|
7970 |
-
|
7971 |
-
|
7972 |
-
|
7973 |
-
|
7974 |
-
|
7975 |
-
|
7976 |
-
|
7977 |
-
|
7978 |
-
|
7979 |
-
|
7980 |
-
|
7981 |
-
|
7982 |
-
|
7983 |
-
|
7984 |
-
|
7985 |
-
|
7986 |
-
|
7987 |
-
|
7988 |
-
|
7989 |
-
|
7990 |
-
|
7991 |
-
|
7992 |
-
|
7993 |
-
|
7994 |
-
|
7995 |
-
|
7996 |
-
|
7997 |
-
|
7998 |
-
|
7999 |
-
|
8000 |
-
|
8001 |
-
|
8002 |
-
|
8003 |
-
|
8004 |
-
|
8005 |
-
|
8006 |
-
|
8007 |
-
|
8008 |
-
|
8009 |
-
|
8010 |
-
|
8011 |
-
|
8012 |
-
|
8013 |
-
|
8014 |
-
|
8015 |
-
|
8016 |
-
|
8017 |
-
|
8018 |
-
|
8019 |
-
|
8020 |
-
|
8021 |
-
|
8022 |
-
|
8023 |
-
|
8024 |
-
|
8025 |
-
|
8026 |
-
|
8027 |
-
|
8028 |
-
|
8029 |
-
|
8030 |
-
|
8031 |
-
|
8032 |
-
|
8033 |
-
|
8034 |
-
|
8035 |
-
|
8036 |
-
|
8037 |
-
|
8038 |
-
|
8039 |
-
|
8040 |
-
|
8041 |
-
|
8042 |
-
|
8043 |
-
|
8044 |
-
|
8045 |
-
|
8046 |
-
|
8047 |
-
|
8048 |
-
|
8049 |
-
|
8050 |
-
|
8051 |
-
|
8052 |
-
|
8053 |
-
|
8054 |
-
|
8055 |
-
|
8056 |
-
|
8057 |
-
|
8058 |
-
|
8059 |
-
|
8060 |
-
|
8061 |
-
|
8062 |
-
|
8063 |
-
|
8064 |
-
|
8065 |
-
|
8066 |
-
|
8067 |
-
|
8068 |
-
|
8069 |
-
|
8070 |
-
|
8071 |
-
|
8072 |
-
|
8073 |
-
|
8074 |
-
|
8075 |
-
|
8076 |
-
|
8077 |
-
|
8078 |
-
|
8079 |
-
|
8080 |
-
|
8081 |
-
|
8082 |
-
|
8083 |
-
|
8084 |
-
|
8085 |
-
|
8086 |
-
|
8087 |
-
|
8088 |
-
|
8089 |
-
|
8090 |
-
|
8091 |
-
|
8092 |
-
|
8093 |
-
|
8094 |
-
|
8095 |
-
|
8096 |
-
|
8097 |
-
|
8098 |
-
|
8099 |
-
|
8100 |
-
|
8101 |
-
|
8102 |
-
|
8103 |
-
|
8104 |
-
|
8105 |
-
|
8106 |
-
|
8107 |
-
|
8108 |
-
|
8109 |
-
|
8110 |
-
|
8111 |
-
|
8112 |
-
|
8113 |
-
|
8114 |
-
|
8115 |
-
|
8116 |
-
|
8117 |
-
|
8118 |
-
|
8119 |
-
|
8120 |
-
|
8121 |
-
|
8122 |
-
|
8123 |
-
|
8124 |
-
|
8125 |
-
|
8126 |
-
|
8127 |
-
|
8128 |
-
|
8129 |
-
|
8130 |
-
|
8131 |
-
|
8132 |
-
|
8133 |
-
|
8134 |
-
|
8135 |
-
|
8136 |
-
|
8137 |
-
|
8138 |
-
|
8139 |
-
|
8140 |
-
|
8141 |
-
|
8142 |
-
|
8143 |
-
|
8144 |
-
|
8145 |
-
|
8146 |
-
|
8147 |
-
|
8148 |
-
|
8149 |
-
|
8150 |
-
|
8151 |
-
|
8152 |
-
|
8153 |
-
|
8154 |
-
|
8155 |
-
|
8156 |
-
|
8157 |
-
|
8158 |
-
|
8159 |
-
|
8160 |
-
|
8161 |
-
|
8162 |
-
|
8163 |
-
|
8164 |
-
|
8165 |
-
|
8166 |
-
|
8167 |
-
|
8168 |
-
|
8169 |
-
|
8170 |
-
|
8171 |
-
|
8172 |
-
|
8173 |
-
|
8174 |
-
|
8175 |
-
|
8176 |
-
|
8177 |
-
|
8178 |
-
|
8179 |
-
|
8180 |
-
|
8181 |
-
|
8182 |
-
|
8183 |
-
|
8184 |
-
|
8185 |
-
|
8186 |
-
|
8187 |
-
|
8188 |
-
|
8189 |
-
|
8190 |
-
|
8191 |
-
|
8192 |
-
|
8193 |
-
|
8194 |
-
|
8195 |
-
|
8196 |
-
|
8197 |
-
|
8198 |
-
|
8199 |
-
|
8200 |
-
|
8201 |
-
|
8202 |
-
|
8203 |
-
|
8204 |
-
|
8205 |
-
|
8206 |
-
|
8207 |
-
|
8208 |
-
|
8209 |
-
|
8210 |
-
|
8211 |
-
|
8212 |
-
|
8213 |
-
|
8214 |
-
|
8215 |
-
|
8216 |
-
|
8217 |
-
|
8218 |
-
|
8219 |
-
|
8220 |
-
|
8221 |
-
|
8222 |
-
|
8223 |
-
|
8224 |
-
|
8225 |
-
|
8226 |
-
|
8227 |
-
|
8228 |
-
|
8229 |
-
|
8230 |
-
|
8231 |
-
|
8232 |
-
|
8233 |
-
|
8234 |
-
|
8235 |
-
|
8236 |
-
|
8237 |
-
|
8238 |
-
|
8239 |
-
|
8240 |
-
|
8241 |
-
|
8242 |
-
|
8243 |
-
|
8244 |
-
|
8245 |
-
|
8246 |
-
|
8247 |
-
|
8248 |
-
|
8249 |
-
|
8250 |
-
|
8251 |
-
|
8252 |
-
|
8253 |
-
|
8254 |
-
|
8255 |
-
|
8256 |
-
|
8257 |
-
|
8258 |
-
|
8259 |
-
|
8260 |
-
|
8261 |
-
|
8262 |
-
|
8263 |
-
|
8264 |
-
|
8265 |
-
|
8266 |
-
|
8267 |
-
|
8268 |
-
|
8269 |
-
|
8270 |
-
|
8271 |
-
|
8272 |
-
|
8273 |
-
|
8274 |
-
|
8275 |
-
|
8276 |
-
|
8277 |
-
|
8278 |
-
|
8279 |
-
|
8280 |
-
|
8281 |
-
|
8282 |
-
|
8283 |
-
|
8284 |
-
|
8285 |
-
|
8286 |
-
|
8287 |
-
|
8288 |
-
|
8289 |
-
|
8290 |
-
|
8291 |
-
|
8292 |
-
|
8293 |
-
|
8294 |
-
|
8295 |
-
|
8296 |
-
|
8297 |
-
|
8298 |
-
|
8299 |
-
|
8300 |
-
|
8301 |
-
|
8302 |
-
|
8303 |
-
|
8304 |
-
|
8305 |
-
|
8306 |
-
|
8307 |
-
|
8308 |
-
|
8309 |
-
|
8310 |
-
|
8311 |
-
|
8312 |
-
|
8313 |
-
|
8314 |
-
|
8315 |
-
|
8316 |
-
|
8317 |
-
|
8318 |
-
|
8319 |
-
|
8320 |
-
|
8321 |
-
|
8322 |
-
|
8323 |
-
|
8324 |
-
|
8325 |
-
|
8326 |
-
|
8327 |
-
|
8328 |
-
|
8329 |
-
|
8330 |
-
|
8331 |
-
|
8332 |
-
|
8333 |
-
|
8334 |
-
|
8335 |
-
|
8336 |
-
|
8337 |
-
|
8338 |
-
|
8339 |
-
|
8340 |
-
|
8341 |
-
|
8342 |
-
|
8343 |
-
|
8344 |
-
|
8345 |
-
|
8346 |
-
|
8347 |
-
|
8348 |
-
|
8349 |
-
|
8350 |
-
|
8351 |
-
|
8352 |
-
|
8353 |
-
|
8354 |
-
|
8355 |
-
|
8356 |
-
|
8357 |
-
|
8358 |
-
|
8359 |
-
|
8360 |
-
|
8361 |
-
|
8362 |
-
|
8363 |
-
|
8364 |
-
|
8365 |
-
|
8366 |
-
|
8367 |
-
|
8368 |
-
|
8369 |
-
|
8370 |
-
|
8371 |
-
|
8372 |
-
|
8373 |
-
|
8374 |
-
|
8375 |
-
|
8376 |
-
|
8377 |
-
|
8378 |
-
|
8379 |
-
|
8380 |
-
|
8381 |
-
|
8382 |
-
|
8383 |
-
|
8384 |
-
|
8385 |
-
|
8386 |
-
|
8387 |
-
|
8388 |
-
|
8389 |
-
|
8390 |
-
|
8391 |
-
|
8392 |
-
|
8393 |
-
|
8394 |
-
|
8395 |
-
|
8396 |
-
|
8397 |
-
|
8398 |
-
|
8399 |
-
|
8400 |
-
|
8401 |
-
|
8402 |
-
|
8403 |
-
|
8404 |
-
|
8405 |
-
|
8406 |
-
|
8407 |
-
|
8408 |
-
|
8409 |
-
|
8410 |
-
|
8411 |
-
|
8412 |
-
|
8413 |
-
|
8414 |
-
|
8415 |
-
|
8416 |
-
|
8417 |
-
|
8418 |
-
|
8419 |
-
|
8420 |
-
|
8421 |
-
|
8422 |
-
|
8423 |
-
|
8424 |
-
|
8425 |
-
|
8426 |
-
|
8427 |
-
|
8428 |
-
|
8429 |
-
|
8430 |
-
|
8431 |
-
|
8432 |
-
|
8433 |
-
|
8434 |
-
|
8435 |
-
|
8436 |
-
|
8437 |
-
|
8438 |
-
|
8439 |
-
|
8440 |
-
|
8441 |
-
|
8442 |
-
|
8443 |
-
|
8444 |
-
|
8445 |
-
|
8446 |
-
|
8447 |
-
|
8448 |
-
|
8449 |
-
|
8450 |
-
|
8451 |
-
|
8452 |
-
|
8453 |
-
|
8454 |
-
|
8455 |
-
|
8456 |
-
|
8457 |
-
|
8458 |
-
|
8459 |
-
|
8460 |
-
|
8461 |
-
|
8462 |
-
|
8463 |
-
|
8464 |
-
|
8465 |
-
|
8466 |
-
|
8467 |
-
|
8468 |
-
|
8469 |
-
|
8470 |
-
|
8471 |
-
|
8472 |
-
|
8473 |
-
|
8474 |
-
|
8475 |
-
|
8476 |
-
|
8477 |
-
|
8478 |
-
|
8479 |
-
|
8480 |
-
|
8481 |
-
|
8482 |
-
|
8483 |
-
|
8484 |
-
|
8485 |
-
|
8486 |
-
|
8487 |
-
|
8488 |
-
|
8489 |
-
|
8490 |
-
|
8491 |
-
|
8492 |
-
|
8493 |
-
|
8494 |
-
|
8495 |
-
|
8496 |
-
|
8497 |
-
|
8498 |
-
|
8499 |
-
|
8500 |
-
|
8501 |
-
|
8502 |
-
|
8503 |
-
|
8504 |
-
|
8505 |
-
|
8506 |
-
|
8507 |
-
|
8508 |
-
|
8509 |
-
|
8510 |
-
|
8511 |
-
|
8512 |
-
|
8513 |
-
|
8514 |
-
|
8515 |
-
|
8516 |
-
|
8517 |
-
|
8518 |
-
|
8519 |
-
|
8520 |
-
|
8521 |
-
|
8522 |
-
|
8523 |
-
|
8524 |
-
|
8525 |
-
|
8526 |
-
|
8527 |
-
|
8528 |
-
|
8529 |
-
|
8530 |
-
|
8531 |
-
|
8532 |
-
|
8533 |
-
|
8534 |
-
|
8535 |
-
|
8536 |
-
|
8537 |
-
|
8538 |
-
|
8539 |
-
|
8540 |
-
|
8541 |
-
|
8542 |
-
|
8543 |
-
|
8544 |
-
|
8545 |
-
|
8546 |
-
|
8547 |
-
|
8548 |
-
|
8549 |
-
|
8550 |
-
|
8551 |
-
|
8552 |
-
|
8553 |
-
|
8554 |
-
|
8555 |
-
|
8556 |
-
|
8557 |
-
|
8558 |
-
|
8559 |
-
|
8560 |
-
|
8561 |
-
|
8562 |
-
|
8563 |
-
|
8564 |
-
|
8565 |
-
|
8566 |
-
|
8567 |
-
|
8568 |
-
|
8569 |
-
|
8570 |
-
|
8571 |
-
|
8572 |
-
|
8573 |
-
|
8574 |
-
|
8575 |
-
|
8576 |
-
|
8577 |
-
|
8578 |
-
|
8579 |
-
|
8580 |
-
|
8581 |
-
|
8582 |
-
|
8583 |
-
|
8584 |
-
|
8585 |
-
|
8586 |
-
|
8587 |
-
|
8588 |
-
|
8589 |
-
|
8590 |
-
|
8591 |
-
|
8592 |
-
|
8593 |
-
|
8594 |
-
|
8595 |
-
|
8596 |
-
|
8597 |
-
|
8598 |
-
|
8599 |
-
|
8600 |
-
|
8601 |
-
|
8602 |
-
|
8603 |
-
|
8604 |
-
|
8605 |
-
|
8606 |
-
|
8607 |
-
|
8608 |
-
|
8609 |
-
|
8610 |
-
|
8611 |
-
|
8612 |
-
|
8613 |
-
|
8614 |
-
|
8615 |
-
|
8616 |
-
|
8617 |
-
|
8618 |
-
|
8619 |
-
|
8620 |
-
|
8621 |
-
|
8622 |
-
|
8623 |
-
|
8624 |
-
|
8625 |
-
|
8626 |
-
|
8627 |
-
|
8628 |
-
|
8629 |
-
|
8630 |
-
|
8631 |
-
|
8632 |
-
|
8633 |
-
|
8634 |
-
|
8635 |
-
|
8636 |
-
|
8637 |
-
|
8638 |
-
|
8639 |
-
|
8640 |
-
|
8641 |
-
|
8642 |
-
|
8643 |
-
|
8644 |
-
|
8645 |
-
|
8646 |
-
|
8647 |
-
|
8648 |
-
|
8649 |
-
|
8650 |
-
|
8651 |
-
|
8652 |
-
|
8653 |
-
|
8654 |
-
|
8655 |
-
|
8656 |
-
|
8657 |
-
|
8658 |
-
|
8659 |
-
|
8660 |
-
|
8661 |
-
|
8662 |
-
|
8663 |
-
|
8664 |
-
|
8665 |
-
|
8666 |
-
|
8667 |
-
|
8668 |
-
|
8669 |
-
|
8670 |
-
|
8671 |
-
|
8672 |
-
|
8673 |
-
|
8674 |
-
|
8675 |
-
|
8676 |
-
|
8677 |
-
|
8678 |
-
|
8679 |
-
|
8680 |
-
|
8681 |
-
|
8682 |
-
|
8683 |
-
|
8684 |
-
|
8685 |
-
|
8686 |
-
|
8687 |
-
|
8688 |
-
|
8689 |
-
|
8690 |
-
|
8691 |
-
|
8692 |
-
|
8693 |
-
|
8694 |
-
|
8695 |
-
|
8696 |
-
|
8697 |
-
|
8698 |
-
|
8699 |
-
|
8700 |
-
|
8701 |
-
|
8702 |
-
|
8703 |
-
|
8704 |
-
|
8705 |
-
|
8706 |
-
|
8707 |
-
|
8708 |
-
|
8709 |
-
|
8710 |
-
|
8711 |
-
|
8712 |
-
|
8713 |
-
|
8714 |
-
|
8715 |
-
|
8716 |
-
|
8717 |
-
|
8718 |
-
|
8719 |
-
|
8720 |
-
|
8721 |
-
|
8722 |
-
|
8723 |
-
|
8724 |
-
|
8725 |
-
|
8726 |
-
|
8727 |
-
|
8728 |
-
|
8729 |
-
|
8730 |
-
|
8731 |
-
|
8732 |
-
|
8733 |
-
|
8734 |
-
|
8735 |
-
|
8736 |
-
|
8737 |
-
|
8738 |
-
|
8739 |
-
|
8740 |
-
|
8741 |
-
|
8742 |
-
|
8743 |
-
|
8744 |
-
|
8745 |
-
|
8746 |
-
|
8747 |
-
|
8748 |
-
|
8749 |
-
|
8750 |
-
|
8751 |
-
|
8752 |
-
|
8753 |
-
|
8754 |
-
|
8755 |
-
|
8756 |
-
|
8757 |
-
|
8758 |
-
|
8759 |
-
|
8760 |
-
|
8761 |
-
|
8762 |
-
|
8763 |
-
|
8764 |
-
|
8765 |
-
|
8766 |
-
|
8767 |
-
|
8768 |
-
|
8769 |
-
|
8770 |
-
|
8771 |
-
|
8772 |
-
|
8773 |
-
|
8774 |
-
|
8775 |
-
|
8776 |
-
|
8777 |
-
|
8778 |
-
|
8779 |
-
|
8780 |
-
|
8781 |
-
|
8782 |
-
|
8783 |
-
|
8784 |
-
|
8785 |
-
|
8786 |
-
|
8787 |
-
|
8788 |
-
|
8789 |
-
|
8790 |
-
|
8791 |
-
|
8792 |
-
|
8793 |
-
|
8794 |
-
|
8795 |
-
|
8796 |
-
|
8797 |
-
|
8798 |
-
|
8799 |
-
|
8800 |
-
|
8801 |
-
|
8802 |
-
|
8803 |
-
|
8804 |
-
|
8805 |
-
|
8806 |
-
|
8807 |
-
|
8808 |
-
|
8809 |
-
|
8810 |
-
|
8811 |
-
|
8812 |
-
|
8813 |
-
|
8814 |
-
|
8815 |
-
|
8816 |
-
|
8817 |
-
|
8818 |
-
|
8819 |
-
|
8820 |
-
|
8821 |
-
|
8822 |
-
|
8823 |
-
|
8824 |
-
|
8825 |
-
|
8826 |
-
|
8827 |
-
|
8828 |
-
|
8829 |
-
|
8830 |
-
|
8831 |
-
|
8832 |
-
|
8833 |
-
|
8834 |
-
|
8835 |
-
|
8836 |
-
|
8837 |
-
|
8838 |
-
|
8839 |
-
|
8840 |
-
|
8841 |
-
|
8842 |
-
|
8843 |
-
|
8844 |
-
|
8845 |
-
|
8846 |
-
|
8847 |
-
|
8848 |
-
|
8849 |
-
|
8850 |
-
|
8851 |
-
|
8852 |
-
|
8853 |
-
|
8854 |
-
|
8855 |
-
|
8856 |
-
|
8857 |
-
|
8858 |
-
|
8859 |
-
|
8860 |
-
|
8861 |
-
|
8862 |
-
|
8863 |
-
|
8864 |
-
|
8865 |
-
|
8866 |
-
|
8867 |
-
|
8868 |
-
|
8869 |
-
|
8870 |
-
|
8871 |
-
|
8872 |
-
|
8873 |
-
|
8874 |
-
|
8875 |
-
|
8876 |
-
|
8877 |
-
|
8878 |
-
|
8879 |
-
|
8880 |
-
|
8881 |
-
|
8882 |
-
|
8883 |
-
|
8884 |
-
|
8885 |
-
|
8886 |
-
|
8887 |
-
|
8888 |
-
|
8889 |
-
|
8890 |
-
|
8891 |
-
|
8892 |
-
|
8893 |
-
|
8894 |
-
|
8895 |
-
|
8896 |
-
|
8897 |
-
|
8898 |
-
|
8899 |
-
|
8900 |
-
|
8901 |
-
|
8902 |
-
|
8903 |
-
|
8904 |
-
|
8905 |
-
|
8906 |
-
|
8907 |
-
|
8908 |
-
|
8909 |
-
|
8910 |
-
|
8911 |
-
|
8912 |
-
|
8913 |
-
|
8914 |
-
|
8915 |
-
|
8916 |
-
|
8917 |
-
|
8918 |
-
|
8919 |
-
|
8920 |
-
|
8921 |
-
|
8922 |
-
|
8923 |
-
|
8924 |
-
|
8925 |
-
|
8926 |
-
|
8927 |
-
|
8928 |
-
|
8929 |
-
|
8930 |
-
|
8931 |
-
|
8932 |
-
|
8933 |
-
|
8934 |
-
|
8935 |
-
|
8936 |
-
|
8937 |
-
|
8938 |
-
|
8939 |
-
|
8940 |
-
|
8941 |
-
|
8942 |
-
|
8943 |
-
|
8944 |
-
|
8945 |
-
|
8946 |
-
|
8947 |
-
|
8948 |
-
|
8949 |
-
|
8950 |
-
|
8951 |
-
|
8952 |
-
|
8953 |
-
|
8954 |
-
|
8955 |
-
|
8956 |
-
|
8957 |
-
|
8958 |
-
|
8959 |
-
|
8960 |
-
|
8961 |
-
|
8962 |
-
|
8963 |
-
|
8964 |
-
|
8965 |
-
|
8966 |
-
|
8967 |
-
|
8968 |
-
|
8969 |
-
|
8970 |
-
|
8971 |
-
|
8972 |
-
|
8973 |
-
|
8974 |
-
|
8975 |
-
|
8976 |
-
|
8977 |
-
|
8978 |
-
|
8979 |
-
|
8980 |
-
|
8981 |
-
|
8982 |
-
|
8983 |
-
|
8984 |
-
|
8985 |
-
|
8986 |
-
|
8987 |
-
|
8988 |
-
|
8989 |
-
|
8990 |
-
|
8991 |
-
|
8992 |
-
|
8993 |
-
|
8994 |
-
|
8995 |
-
|
8996 |
-
|
8997 |
-
|
8998 |
-
|
8999 |
-
|
9000 |
-
|
9001 |
-
|
9002 |
-
|
9003 |
-
|
9004 |
-
|
9005 |
-
|
9006 |
-
|
9007 |
-
|
9008 |
-
|
9009 |
-
|
9010 |
-
|
9011 |
-
|
9012 |
-
|
9013 |
-
|
9014 |
-
|
9015 |
-
|
9016 |
-
|
9017 |
-
|
9018 |
-
|
9019 |
-
|
9020 |
-
|
9021 |
-
|
9022 |
-
|
9023 |
-
|
9024 |
-
|
9025 |
-
|
9026 |
-
|
9027 |
-
|
9028 |
-
|
9029 |
-
|
9030 |
-
|
9031 |
-
|
9032 |
-
|
9033 |
-
|
9034 |
-
|
9035 |
-
|
9036 |
-
|
9037 |
-
|
9038 |
-
|
9039 |
-
|
9040 |
-
|
9041 |
-
|
9042 |
-
|
9043 |
-
|
9044 |
-
|
9045 |
-
|
9046 |
-
|
9047 |
-
|
9048 |
-
|
9049 |
-
|
9050 |
-
|
9051 |
-
|
9052 |
-
|
9053 |
-
|
9054 |
-
|
9055 |
-
|
9056 |
-
|
9057 |
-
|
9058 |
-
|
9059 |
-
|
9060 |
-
|
9061 |
-
|
9062 |
-
|
9063 |
-
|
9064 |
-
|
9065 |
-
|
9066 |
-
|
9067 |
-
|
9068 |
-
|
9069 |
-
|
9070 |
-
|
9071 |
-
|
9072 |
-
|
9073 |
-
|
9074 |
-
|
9075 |
-
|
9076 |
-
|
9077 |
-
|
9078 |
-
|
9079 |
-
|
9080 |
-
|
9081 |
-
|
9082 |
-
|
9083 |
-
|
9084 |
-
|
9085 |
-
|
9086 |
-
|
9087 |
-
|
9088 |
-
|
9089 |
-
|
9090 |
-
|
9091 |
-
|
9092 |
-
|
9093 |
-
|
9094 |
-
|
9095 |
-
|
9096 |
-
|
9097 |
-
|
9098 |
-
|
9099 |
-
|
9100 |
-
|
9101 |
-
|
9102 |
-
|
9103 |
-
|
9104 |
-
|
9105 |
-
|
9106 |
-
|
9107 |
-
|
9108 |
-
|
9109 |
-
|
9110 |
-
|
9111 |
-
|
9112 |
-
|
9113 |
-
|
9114 |
-
|
9115 |
-
|
9116 |
-
|
9117 |
-
|
9118 |
-
|
9119 |
-
|
9120 |
-
|
9121 |
-
|
9122 |
-
|
9123 |
-
|
9124 |
-
|
9125 |
-
|
9126 |
-
|
9127 |
-
|
9128 |
-
|
9129 |
-
|
9130 |
-
|
9131 |
-
|
9132 |
-
|
9133 |
-
|
9134 |
-
|
9135 |
-
|
9136 |
-
|
9137 |
-
|
9138 |
-
|
9139 |
-
|
9140 |
-
|
9141 |
-
|
9142 |
-
|
9143 |
-
|
9144 |
-
|
9145 |
-
|
9146 |
-
|
9147 |
-
|
9148 |
-
|
9149 |
-
|
9150 |
-
|
9151 |
-
|
9152 |
-
|
9153 |
-
|
9154 |
-
|
9155 |
-
|
9156 |
-
|
9157 |
-
|
9158 |
-
|
9159 |
-
|
9160 |
-
|
9161 |
-
|
9162 |
-
|
9163 |
-
|
9164 |
-
|
9165 |
-
|
9166 |
-
|
9167 |
-
|
9168 |
-
|
9169 |
-
|
9170 |
-
|
9171 |
-
|
9172 |
-
|
9173 |
-
|
9174 |
-
|
9175 |
-
|
9176 |
-
|
9177 |
-
|
9178 |
-
|
9179 |
-
|
9180 |
-
|
9181 |
-
|
9182 |
-
|
9183 |
-
|
9184 |
-
|
9185 |
-
|
9186 |
-
|
9187 |
-
|
9188 |
-
|
9189 |
-
|
9190 |
-
|
9191 |
-
|
9192 |
-
|
9193 |
-
|
9194 |
-
|
9195 |
-
|
9196 |
-
|
9197 |
-
|
9198 |
-
|
9199 |
-
|
9200 |
-
|
9201 |
-
|
9202 |
-
|
9203 |
-
|
9204 |
-
|
9205 |
-
|
9206 |
-
|
9207 |
-
|
9208 |
-
|
9209 |
-
|
9210 |
-
|
9211 |
-
|
9212 |
-
|
9213 |
-
|
9214 |
-
|
9215 |
-
|
9216 |
-
|
9217 |
-
|
9218 |
-
|
9219 |
-
|
9220 |
-
|
9221 |
-
|
9222 |
-
|
9223 |
-
|
9224 |
-
|
9225 |
-
|
9226 |
-
|
9227 |
-
|
9228 |
-
|
9229 |
-
|
9230 |
-
|
9231 |
-
|
9232 |
-
|
9233 |
-
|
9234 |
-
|
9235 |
-
|
9236 |
-
|
9237 |
-
|
9238 |
-
|
9239 |
-
|
9240 |
-
|
9241 |
-
|
9242 |
-
|
9243 |
-
|
9244 |
-
|
9245 |
-
|
9246 |
-
|
9247 |
-
|
9248 |
-
|
9249 |
-
|
9250 |
-
|
9251 |
-
|
9252 |
-
|
9253 |
-
|
9254 |
-
|
9255 |
-
|
9256 |
-
|
9257 |
-
|
9258 |
-
|
9259 |
-
|
9260 |
-
|
9261 |
-
|
9262 |
-
|
9263 |
-
|
9264 |
-
|
9265 |
-
|
9266 |
-
|
9267 |
-
|
9268 |
-
|
9269 |
-
|
9270 |
-
|
9271 |
-
|
9272 |
-
|
9273 |
-
|
9274 |
-
|
9275 |
-
|
9276 |
-
|
9277 |
-
|
9278 |
-
|
9279 |
-
|
9280 |
-
|
9281 |
-
|
9282 |
-
|
9283 |
-
|
9284 |
-
|
9285 |
-
|
9286 |
-
|
9287 |
-
|
9288 |
-
|
9289 |
-
|
9290 |
-
|
9291 |
-
|
9292 |
-
|
9293 |
-
|
9294 |
-
|
9295 |
-
|
9296 |
-
|
9297 |
-
|
9298 |
-
|
9299 |
-
|
9300 |
-
|
9301 |
-
|
9302 |
-
|
9303 |
-
|
9304 |
-
|
9305 |
-
|
9306 |
-
|
9307 |
-
|
9308 |
-
|
9309 |
-
|
9310 |
-
//
|
9311 |
-
|
9312 |
-
|
9313 |
-
|
9314 |
-
|
9315 |
-
|
9316 |
-
|
9317 |
-
|
9318 |
-
|
9319 |
-
|
9320 |
-
|
9321 |
-
|
9322 |
-
|
9323 |
-
|
9324 |
-
|
9325 |
-
|
9326 |
-
|
9327 |
-
|
9328 |
-
|
9329 |
-
|
9330 |
-
|
9331 |
-
|
9332 |
-
|
9333 |
-
|
9334 |
-
|
9335 |
-
|
9336 |
-
|
9337 |
-
|
9338 |
-
|
9339 |
-
|
9340 |
-
|
9341 |
-
|
9342 |
-
|
9343 |
-
|
9344 |
-
|
9345 |
-
|
9346 |
-
|
9347 |
-
|
9348 |
-
|
9349 |
-
|
9350 |
-
|
9351 |
-
|
9352 |
-
|
9353 |
-
|
9354 |
-
|
9355 |
-
|
9356 |
-
|
9357 |
-
|
9358 |
-
|
9359 |
-
|
9360 |
-
|
9361 |
-
|
9362 |
-
|
9363 |
-
|
9364 |
-
|
9365 |
-
|
9366 |
-
|
9367 |
-
|
9368 |
-
|
9369 |
-
|
9370 |
-
|
9371 |
-
|
9372 |
-
|
9373 |
-
|
9374 |
-
|
9375 |
-
|
9376 |
-
|
9377 |
-
|
9378 |
-
|
9379 |
-
|
9380 |
-
|
9381 |
-
|
9382 |
-
|
9383 |
-
|
9384 |
-
|
9385 |
-
|
9386 |
-
|
9387 |
-
|
9388 |
-
|
9389 |
-
|
9390 |
-
|
9391 |
-
|
9392 |
-
|
9393 |
-
|
9394 |
-
|
9395 |
-
|
9396 |
-
|
9397 |
-
|
9398 |
-
|
9399 |
-
|
9400 |
-
|
9401 |
-
|
9402 |
-
|
9403 |
-
|
9404 |
-
|
9405 |
-
|
9406 |
-
|
9407 |
-
|
9408 |
-
|
9409 |
-
|
9410 |
-
|
9411 |
-
|
9412 |
-
|
9413 |
-
|
9414 |
-
|
9415 |
-
|
9416 |
-
|
9417 |
-
|
9418 |
-
|
9419 |
-
|
9420 |
-
|
9421 |
-
|
9422 |
-
|
9423 |
-
|
9424 |
-
|
9425 |
-
|
9426 |
-
|
9427 |
-
|
9428 |
-
|
9429 |
-
|
9430 |
-
|
9431 |
-
|
9432 |
-
|
9433 |
-
|
9434 |
-
|
9435 |
-
|
9436 |
-
|
9437 |
-
|
9438 |
-
|
9439 |
-
|
9440 |
-
|
9441 |
-
|
9442 |
-
|
9443 |
-
|
9444 |
-
|
9445 |
-
|
9446 |
-
|
9447 |
-
|
9448 |
-
|
9449 |
-
|
9450 |
-
|
9451 |
-
|
9452 |
-
|
9453 |
-
|
9454 |
-
|
9455 |
-
|
9456 |
-
|
9457 |
-
|
9458 |
-
|
9459 |
-
|
9460 |
-
|
9461 |
-
|
9462 |
-
|
9463 |
-
|
9464 |
-
|
9465 |
-
|
9466 |
-
|
9467 |
-
|
9468 |
-
|
9469 |
-
|
9470 |
-
|
9471 |
-
|
9472 |
-
|
9473 |
-
|
9474 |
-
|
9475 |
-
|
9476 |
-
|
9477 |
-
|
9478 |
-
|
9479 |
-
|
9480 |
-
|
9481 |
-
|
9482 |
-
|
9483 |
-
|
9484 |
-
|
9485 |
-
|
9486 |
-
|
9487 |
-
|
9488 |
-
|
9489 |
-
|
9490 |
-
|
9491 |
-
|
9492 |
-
|
9493 |
-
|
9494 |
-
|
9495 |
-
|
9496 |
-
|
9497 |
-
|
9498 |
-
|
9499 |
-
|
9500 |
-
|
9501 |
-
|
9502 |
-
|
9503 |
-
|
9504 |
-
|
9505 |
-
|
9506 |
-
|
9507 |
-
|
9508 |
-
|
9509 |
-
|
9510 |
-
|
9511 |
-
|
9512 |
-
|
9513 |
-
|
9514 |
-
|
9515 |
-
|
9516 |
-
|
9517 |
-
|
9518 |
-
|
9519 |
-
|
9520 |
-
|
9521 |
-
|
9522 |
-
|
9523 |
-
|
9524 |
-
|
9525 |
-
|
9526 |
-
|
9527 |
-
|
9528 |
-
|
9529 |
-
|
9530 |
-
|
9531 |
-
|
9532 |
-
|
9533 |
-
|
9534 |
-
|
9535 |
-
|
9536 |
-
|
9537 |
-
|
9538 |
-
|
9539 |
-
|
9540 |
-
|
9541 |
-
|
9542 |
-
|
9543 |
-
|
9544 |
-
|
9545 |
-
|
9546 |
-
|
9547 |
-
|
9548 |
-
|
9549 |
-
|
9550 |
-
|
9551 |
-
|
9552 |
-
|
9553 |
-
|
9554 |
-
|
9555 |
-
|
9556 |
-
|
9557 |
-
|
9558 |
-
|
9559 |
-
|
9560 |
-
|
9561 |
-
|
9562 |
-
|
9563 |
-
|
9564 |
-
|
9565 |
-
|
9566 |
-
|
9567 |
-
|
9568 |
-
|
9569 |
-
|
9570 |
-
|
9571 |
-
|
9572 |
-
|
9573 |
-
|
9574 |
-
|
9575 |
-
|
9576 |
-
|
9577 |
-
|
9578 |
-
|
9579 |
-
|
9580 |
-
|
9581 |
-
|
9582 |
-
|
9583 |
-
|
9584 |
-
|
9585 |
-
|
9586 |
-
|
9587 |
-
|
9588 |
-
|
9589 |
-
|
9590 |
-
|
9591 |
-
|
9592 |
-
|
9593 |
-
|
9594 |
-
|
9595 |
-
|
9596 |
-
|
9597 |
-
|
9598 |
-
|
9599 |
-
|
9600 |
-
|
9601 |
-
|
9602 |
-
|
9603 |
-
|
9604 |
-
|
9605 |
-
|
9606 |
-
|
9607 |
-
|
9608 |
-
|
9609 |
-
|
9610 |
-
|
9611 |
-
|
9612 |
-
|
9613 |
-
|
9614 |
-
|
9615 |
-
|
9616 |
-
|
9617 |
-
|
9618 |
-
|
9619 |
-
|
9620 |
-
|
9621 |
-
|
9622 |
-
|
9623 |
-
|
9624 |
-
|
9625 |
-
|
9626 |
-
|
9627 |
-
|
9628 |
-
|
9629 |
-
|
9630 |
-
|
9631 |
-
|
9632 |
-
|
9633 |
-
|
9634 |
-
|
9635 |
-
|
9636 |
-
|
9637 |
-
|
9638 |
-
|
9639 |
-
|
9640 |
-
|
9641 |
-
|
9642 |
-
|
9643 |
-
|
9644 |
-
|
9645 |
-
|
9646 |
-
|
9647 |
-
|
9648 |
-
|
9649 |
-
|
9650 |
-
|
9651 |
-
|
9652 |
-
|
9653 |
-
|
9654 |
-
|
9655 |
-
|
9656 |
-
|
9657 |
-
|
9658 |
-
|
9659 |
-
|
9660 |
-
|
9661 |
-
|
9662 |
-
|
9663 |
-
|
9664 |
-
|
9665 |
-
|
9666 |
-
|
9667 |
-
|
9668 |
-
|
9669 |
-
|
9670 |
-
|
9671 |
-
|
9672 |
-
|
9673 |
-
|
9674 |
-
|
9675 |
-
|
9676 |
-
|
9677 |
-
|
9678 |
-
|
9679 |
-
|
9680 |
-
|
9681 |
-
|
9682 |
-
|
9683 |
-
|
9684 |
-
|
9685 |
-
|
9686 |
-
|
9687 |
-
|
9688 |
-
|
9689 |
-
|
9690 |
-
|
9691 |
-
|
9692 |
-
|
9693 |
-
|
9694 |
-
|
9695 |
-
|
9696 |
-
|
9697 |
-
|
9698 |
-
|
9699 |
-
|
9700 |
-
|
9701 |
-
|
9702 |
-
|
9703 |
-
|
9704 |
-
|
9705 |
-
|
9706 |
-
|
9707 |
-
|
9708 |
-
|
9709 |
-
|
9710 |
-
|
9711 |
-
|
9712 |
-
|
9713 |
-
|
9714 |
-
|
9715 |
-
|
9716 |
-
|
9717 |
-
|
9718 |
-
|
9719 |
-
|
9720 |
-
|
9721 |
-
|
9722 |
-
|
9723 |
-
|
9724 |
-
|
9725 |
-
|
9726 |
-
|
9727 |
-
|
9728 |
-
|
9729 |
-
|
9730 |
-
|
9731 |
-
|
9732 |
-
|
9733 |
-
|
9734 |
-
|
9735 |
-
|
9736 |
-
|
9737 |
-
|
9738 |
-
|
9739 |
-
|
9740 |
-
|
9741 |
-
|
9742 |
-
|
9743 |
-
|
9744 |
-
|
9745 |
-
|
9746 |
-
|
9747 |
-
|
9748 |
-
|
9749 |
-
|
9750 |
-
|
9751 |
-
|
9752 |
-
|
9753 |
-
|
9754 |
-
|
9755 |
-
|
9756 |
-
|
9757 |
-
|
9758 |
-
|
9759 |
-
|
9760 |
-
|
9761 |
-
|
9762 |
-
|
9763 |
-
|
9764 |
-
|
9765 |
-
|
9766 |
-
|
9767 |
-
|
9768 |
-
|
9769 |
-
|
9770 |
-
|
9771 |
-
|
9772 |
-
|
9773 |
-
|
9774 |
-
|
9775 |
-
|
9776 |
-
|
9777 |
-
|
9778 |
-
|
9779 |
-
|
9780 |
-
|
9781 |
-
|
9782 |
-
|
9783 |
-
|
9784 |
-
|
9785 |
-
|
9786 |
-
|
9787 |
-
|
9788 |
-
|
9789 |
-
|
9790 |
-
|
9791 |
-
|
9792 |
-
|
9793 |
-
|
9794 |
-
|
9795 |
-
|
9796 |
-
|
9797 |
-
|
9798 |
-
|
9799 |
-
|
9800 |
-
|
9801 |
-
|
9802 |
-
|
9803 |
-
|
9804 |
-
|
9805 |
-
|
9806 |
-
|
9807 |
-
|
9808 |
-
|
9809 |
-
|
9810 |
-
|
9811 |
-
|
9812 |
-
|
9813 |
-
|
9814 |
-
|
9815 |
-
|
9816 |
-
|
9817 |
-
|
9818 |
-
|
9819 |
-
|
9820 |
-
|
9821 |
-
|
9822 |
-
|
9823 |
-
|
9824 |
-
|
9825 |
-
|
9826 |
-
|
9827 |
-
|
9828 |
-
|
9829 |
-
|
9830 |
-
|
9831 |
-
|
9832 |
-
|
9833 |
-
|
9834 |
-
|
9835 |
-
|
9836 |
-
|
9837 |
-
|
9838 |
-
|
9839 |
-
|
9840 |
-
|
9841 |
-
|
9842 |
-
|
9843 |
-
|
9844 |
-
|
9845 |
-
|
9846 |
-
|
9847 |
-
|
9848 |
-
|
9849 |
-
|
9850 |
-
|
9851 |
-
|
9852 |
-
|
9853 |
-
|
9854 |
-
|
9855 |
-
|
9856 |
-
|
9857 |
-
|
9858 |
-
|
9859 |
-
|
9860 |
-
|
9861 |
-
|
9862 |
-
|
9863 |
-
|
9864 |
-
|
9865 |
-
|
9866 |
-
|
9867 |
-
|
9868 |
-
|
9869 |
-
|
9870 |
-
|
9871 |
-
|
9872 |
-
|
9873 |
-
|
9874 |
-
|
9875 |
-
|
9876 |
-
|
9877 |
-
|
9878 |
-
|
9879 |
-
|
9880 |
-
|
9881 |
-
|
9882 |
-
|
9883 |
-
|
9884 |
-
|
9885 |
-
|
9886 |
-
|
9887 |
-
|
9888 |
-
|
9889 |
-
|
9890 |
-
|
9891 |
-
|
9892 |
-
|
9893 |
-
|
9894 |
-
|
9895 |
-
|
9896 |
-
|
9897 |
-
|
9898 |
-
|
9899 |
-
|
9900 |
-
|
9901 |
-
|
9902 |
-
|
9903 |
-
|
9904 |
-
|
9905 |
-
|
9906 |
-
|
9907 |
-
|
9908 |
-
|
9909 |
-
|
9910 |
-
|
9911 |
-
|
9912 |
-
|
9913 |
-
|
9914 |
-
|
9915 |
-
|
9916 |
-
|
9917 |
-
|
9918 |
-
|
9919 |
-
|
9920 |
-
|
9921 |
-
|
9922 |
-
|
9923 |
-
|
9924 |
-
|
9925 |
-
|
9926 |
-
|
9927 |
-
|
9928 |
-
|
9929 |
-
|
9930 |
-
|
9931 |
-
|
9932 |
-
|
9933 |
-
|
9934 |
-
|
9935 |
-
|
9936 |
-
|
9937 |
-
|
9938 |
-
|
9939 |
-
|
9940 |
-
|
9941 |
-
|
9942 |
-
|
9943 |
-
|
9944 |
-
|
9945 |
-
|
9946 |
-
|
9947 |
-
|
9948 |
-
|
9949 |
-
|
9950 |
-
|
9951 |
-
|
9952 |
-
|
9953 |
-
|
9954 |
-
|
9955 |
-
|
9956 |
-
|
9957 |
-
|
9958 |
-
|
9959 |
-
|
9960 |
-
|
9961 |
-
|
9962 |
-
|
9963 |
-
|
9964 |
-
|
9965 |
-
|
9966 |
-
|
9967 |
-
|
9968 |
-
|
9969 |
-
|
9970 |
-
|
9971 |
-
|
9972 |
-
|
9973 |
-
|
9974 |
-
|
9975 |
-
|
9976 |
-
|
9977 |
-
|
9978 |
-
|
9979 |
-
|
9980 |
-
|
9981 |
-
|
9982 |
-
|
9983 |
-
|
9984 |
-
|
9985 |
-
|
9986 |
-
|
9987 |
-
|
9988 |
-
|
9989 |
-
|
9990 |
-
|
9991 |
-
|
9992 |
-
|
9993 |
-
|
9994 |
-
|
9995 |
-
|
9996 |
-
|
9997 |
-
|
9998 |
-
|
9999 |
-
|
10000 |
-
|
10001 |
-
|
10002 |
-
|
10003 |
-
|
10004 |
-
|
10005 |
-
|
10006 |
-
|
10007 |
-
|
10008 |
-
|
10009 |
-
|
10010 |
-
|
10011 |
-
|
10012 |
-
|
10013 |
-
|
10014 |
-
|
10015 |
-
|
10016 |
-
|
10017 |
-
|
10018 |
-
|
10019 |
-
|
10020 |
-
|
10021 |
-
|
10022 |
-
|
10023 |
-
|
10024 |
-
|
10025 |
-
|
10026 |
-
|
10027 |
-
|
10028 |
-
|
10029 |
-
|
10030 |
-
|
10031 |
-
|
10032 |
-
|
10033 |
-
|
10034 |
-
|
10035 |
-
|
10036 |
-
|
10037 |
-
|
10038 |
-
|
10039 |
-
|
10040 |
-
|
10041 |
-
|
10042 |
-
|
10043 |
-
|
10044 |
-
|
10045 |
-
|
10046 |
-
|
10047 |
-
|
10048 |
-
|
10049 |
-
|
10050 |
-
|
10051 |
-
|
10052 |
-
|
10053 |
-
|
10054 |
-
|
10055 |
-
|
10056 |
-
|
10057 |
-
|
10058 |
-
|
10059 |
-
|
10060 |
-
|
10061 |
-
|
10062 |
-
|
10063 |
-
|
10064 |
-
|
10065 |
-
|
10066 |
-
|
10067 |
-
|
10068 |
-
|
10069 |
-
|
10070 |
-
|
10071 |
-
|
10072 |
-
|
10073 |
-
|
10074 |
-
|
10075 |
-
|
10076 |
-
|
10077 |
-
|
10078 |
-
|
10079 |
-
|
10080 |
-
|
10081 |
-
|
10082 |
-
|
10083 |
-
|
10084 |
-
|
10085 |
-
|
10086 |
-
|
10087 |
-
|
10088 |
-
|
10089 |
-
|
10090 |
-
|
10091 |
-
|
10092 |
-
|
10093 |
-
|
10094 |
-
|
10095 |
-
|
10096 |
-
|
10097 |
-
|
10098 |
-
|
10099 |
-
|
10100 |
-
|
10101 |
-
|
10102 |
-
|
10103 |
-
|
10104 |
-
|
10105 |
-
|
10106 |
-
|
10107 |
-
|
10108 |
-
|
10109 |
-
|
10110 |
-
|
10111 |
-
|
10112 |
-
|
10113 |
-
|
10114 |
-
|
10115 |
-
|
10116 |
-
|
10117 |
-
|
10118 |
-
|
10119 |
-
|
10120 |
-
|
10121 |
-
|
10122 |
-
|
10123 |
-
|
10124 |
-
|
10125 |
-
|
10126 |
-
|
10127 |
-
|
10128 |
-
|
10129 |
-
|
10130 |
-
|
10131 |
-
|
10132 |
-
|
10133 |
-
|
10134 |
-
|
10135 |
-
|
10136 |
-
|
10137 |
-
|
10138 |
-
|
10139 |
-
|
10140 |
-
|
10141 |
-
|
10142 |
-
|
10143 |
-
|
10144 |
-
|
10145 |
-
|
10146 |
-
|
10147 |
-
|
10148 |
-
|
10149 |
-
|
10150 |
-
|
10151 |
-
|
10152 |
-
|
10153 |
-
|
10154 |
-
|
10155 |
-
|
10156 |
-
|
10157 |
-
|
10158 |
-
|
10159 |
-
|
10160 |
-
|
10161 |
-
|
10162 |
-
|
10163 |
-
|
10164 |
-
|
10165 |
-
|
10166 |
-
|
10167 |
-
|
10168 |
-
|
10169 |
-
|
10170 |
-
|
10171 |
-
|
10172 |
-
|
10173 |
-
|
10174 |
-
|
10175 |
-
|
10176 |
-
|
10177 |
-
|
10178 |
-
|
10179 |
-
|
10180 |
-
|
10181 |
-
|
10182 |
-
|
10183 |
-
|
10184 |
-
|
10185 |
-
|
10186 |
-
|
10187 |
-
|
10188 |
-
|
10189 |
-
|
10190 |
-
|
10191 |
-
|
10192 |
-
|
10193 |
-
|
10194 |
-
|
10195 |
-
|
10196 |
-
|
10197 |
-
|
10198 |
-
|
10199 |
-
|
10200 |
-
|
10201 |
-
|
10202 |
-
|
10203 |
-
|
10204 |
-
|
10205 |
-
|
10206 |
-
|
10207 |
-
|
10208 |
-
|
10209 |
-
|
10210 |
-
|
10211 |
-
|
10212 |
-
|
10213 |
-
|
10214 |
-
|
10215 |
-
|
10216 |
-
|
10217 |
-
|
10218 |
-
|
10219 |
-
|
10220 |
-
|
10221 |
-
|
10222 |
-
|
10223 |
-
|
10224 |
-
|
10225 |
-
|
10226 |
-
|
10227 |
-
|
10228 |
-
|
10229 |
-
|
10230 |
-
|
10231 |
-
|
10232 |
-
|
10233 |
-
|
10234 |
-
|
10235 |
-
|
10236 |
-
|
10237 |
-
|
10238 |
-
|
10239 |
-
|
10240 |
-
|
10241 |
-
|
10242 |
-
|
10243 |
-
|
10244 |
-
|
10245 |
-
|
10246 |
-
|
10247 |
-
|
10248 |
-
|
10249 |
-
|
10250 |
-
|
10251 |
-
|
10252 |
-
|
10253 |
-
|
10254 |
-
|
10255 |
-
|
10256 |
-
|
10257 |
-
|
10258 |
-
|
10259 |
-
|
10260 |
-
|
10261 |
-
|
10262 |
-
|
10263 |
-
|
10264 |
-
|
10265 |
-
|
10266 |
-
|
10267 |
-
|
10268 |
-
|
10269 |
-
|
10270 |
-
|
10271 |
-
|
10272 |
-
|
10273 |
-
|
10274 |
-
|
10275 |
-
|
10276 |
-
|
10277 |
-
|
10278 |
-
|
10279 |
-
|
10280 |
-
|
10281 |
-
|
10282 |
-
|
10283 |
-
|
10284 |
-
|
10285 |
-
|
10286 |
-
|
10287 |
-
|
10288 |
-
|
10289 |
-
|
10290 |
-
|
10291 |
-
|
10292 |
-
|
10293 |
-
|
10294 |
-
|
10295 |
-
|
10296 |
-
|
10297 |
-
|
10298 |
-
|
10299 |
-
|
10300 |
-
|
10301 |
-
|
10302 |
-
|
10303 |
-
|
10304 |
-
|
10305 |
-
|
10306 |
-
|
10307 |
-
|
10308 |
-
|
10309 |
-
|
10310 |
-
|
10311 |
-
|
10312 |
-
|
10313 |
-
|
10314 |
-
|
10315 |
-
|
10316 |
-
|
10317 |
-
|
10318 |
-
|
10319 |
-
|
10320 |
-
|
10321 |
-
|
10322 |
-
|
10323 |
-
|
10324 |
-
|
10325 |
-
|
10326 |
-
|
10327 |
-
|
10328 |
-
|
10329 |
-
|
10330 |
-
|
10331 |
-
|
10332 |
-
|
10333 |
-
|
10334 |
-
|
10335 |
-
|
10336 |
-
|
10337 |
-
|
10338 |
-
|
10339 |
-
|
10340 |
-
|
10341 |
-
|
10342 |
-
|
10343 |
-
|
10344 |
-
|
10345 |
-
|
10346 |
-
|
10347 |
-
|
10348 |
-
|
10349 |
-
|
10350 |
-
|
10351 |
-
|
10352 |
-
|
10353 |
-
|
10354 |
-
|
10355 |
-
|
10356 |
-
|
10357 |
-
|
10358 |
-
|
10359 |
-
|
10360 |
-
|
10361 |
-
|
10362 |
-
|
10363 |
-
|
10364 |
-
|
10365 |
-
|
10366 |
-
|
10367 |
-
|
10368 |
-
|
10369 |
-
|
10370 |
-
|
10371 |
-
|
10372 |
-
|
10373 |
-
|
10374 |
-
|
10375 |
-
|
10376 |
-
|
10377 |
-
|
10378 |
-
|
10379 |
-
|
10380 |
-
|
10381 |
-
|
10382 |
-
|
10383 |
-
|
10384 |
-
|
10385 |
-
|
10386 |
-
|
10387 |
-
|
10388 |
-
|
10389 |
-
|
10390 |
-
|
10391 |
-
|
10392 |
-
|
10393 |
-
|
10394 |
-
|
10395 |
-
|
10396 |
-
|
10397 |
-
|
10398 |
-
|
10399 |
-
|
10400 |
-
|
10401 |
-
|
10402 |
-
|
10403 |
-
|
10404 |
-
|
10405 |
-
|
10406 |
-
|
10407 |
-
|
10408 |
-
|
10409 |
-
|
10410 |
-
|
10411 |
-
|
10412 |
-
|
10413 |
-
|
10414 |
-
|
10415 |
-
|
10416 |
-
|
10417 |
-
|
10418 |
-
|
10419 |
-
|
10420 |
-
|
10421 |
-
|
10422 |
-
|
10423 |
-
|
10424 |
-
|
10425 |
-
|
10426 |
-
|
10427 |
-
|
10428 |
-
|
10429 |
-
|
10430 |
-
|
10431 |
-
|
10432 |
-
|
10433 |
-
|
10434 |
-
|
10435 |
-
|
10436 |
-
|
10437 |
-
|
10438 |
-
|
10439 |
-
|
10440 |
-
|
10441 |
-
|
10442 |
-
|
10443 |
-
|
10444 |
-
|
10445 |
-
|
10446 |
-
|
10447 |
-
|
10448 |
-
|
10449 |
-
|
10450 |
-
|
10451 |
-
|
10452 |
-
|
10453 |
-
|
10454 |
-
|
10455 |
-
|
10456 |
-
|
10457 |
-
|
10458 |
-
|
10459 |
-
|
10460 |
-
|
10461 |
-
|
10462 |
-
|
10463 |
-
|
10464 |
-
|
10465 |
-
|
10466 |
-
|
10467 |
-
|
10468 |
-
|
10469 |
-
|
10470 |
-
|
10471 |
-
|
10472 |
-
|
10473 |
-
|
10474 |
-
|
10475 |
-
|
10476 |
-
|
10477 |
-
|
10478 |
-
|
10479 |
-
|
10480 |
-
|
10481 |
-
|
10482 |
-
|
10483 |
-
|
10484 |
-
|
10485 |
-
|
10486 |
-
|
10487 |
-
|
10488 |
-
|
10489 |
-
|
10490 |
-
|
10491 |
-
|
10492 |
-
|
10493 |
-
|
10494 |
-
|
10495 |
-
|
10496 |
-
|
10497 |
-
|
10498 |
-
|
10499 |
-
|
10500 |
-
|
10501 |
-
|
10502 |
-
|
10503 |
-
|
10504 |
-
|
10505 |
-
|
10506 |
-
|
10507 |
-
|
10508 |
-
|
10509 |
-
|
10510 |
-
|
10511 |
-
|
10512 |
-
|
10513 |
-
|
10514 |
-
|
10515 |
-
|
10516 |
-
|
10517 |
-
|
10518 |
-
|
10519 |
-
|
10520 |
-
|
10521 |
-
|
10522 |
-
|
10523 |
-
|
10524 |
-
|
10525 |
-
|
10526 |
-
|
10527 |
-
|
10528 |
-
|
10529 |
-
|
10530 |
-
|
10531 |
-
|
10532 |
-
|
10533 |
-
|
10534 |
-
|
10535 |
-
|
10536 |
-
|
10537 |
-
|
10538 |
-
|
10539 |
-
|
10540 |
-
|
10541 |
-
|
10542 |
-
|
10543 |
-
|
10544 |
-
|
10545 |
-
|
10546 |
-
|
10547 |
-
|
10548 |
-
|
10549 |
-
|
10550 |
-
|
10551 |
-
|
10552 |
-
|
10553 |
-
|
10554 |
-
|
10555 |
-
|
10556 |
-
|
10557 |
-
|
10558 |
-
|
10559 |
-
|
10560 |
-
|
10561 |
-
|
10562 |
-
|
10563 |
-
|
10564 |
-
|
10565 |
-
|
10566 |
-
|
10567 |
-
|
10568 |
-
|
10569 |
-
|
10570 |
-
|
10571 |
-
|
10572 |
-
|
10573 |
-
|
10574 |
-
|
10575 |
-
|
10576 |
-
|
10577 |
-
|
10578 |
-
|
10579 |
-
|
10580 |
-
|
10581 |
-
|
10582 |
-
|
10583 |
-
|
10584 |
-
|
10585 |
-
|
10586 |
-
|
10587 |
-
|
10588 |
-
|
10589 |
-
|
10590 |
-
|
10591 |
-
|
10592 |
-
|
10593 |
-
|
10594 |
-
|
10595 |
-
|
10596 |
-
|
10597 |
-
|
10598 |
-
|
10599 |
-
|
10600 |
-
|
10601 |
-
|
10602 |
-
|
10603 |
-
|
10604 |
-
|
10605 |
-
|
10606 |
-
|
10607 |
-
|
10608 |
-
|
10609 |
-
|
10610 |
-
|
10611 |
-
|
10612 |
-
|
10613 |
-
|
10614 |
-
|
10615 |
-
|
10616 |
-
|
10617 |
-
|
10618 |
-
|
10619 |
-
|
10620 |
-
|
10621 |
-
|
10622 |
-
|
10623 |
-
|
10624 |
-
|
10625 |
-
|
10626 |
-
|
10627 |
-
|
10628 |
-
|
10629 |
-
|
10630 |
-
|
10631 |
-
|
10632 |
-
|
10633 |
-
|
10634 |
-
|
10635 |
-
|
10636 |
-
|
10637 |
-
|
10638 |
-
|
10639 |
-
|
10640 |
-
|
10641 |
-
|
10642 |
-
|
10643 |
-
|
10644 |
-
|
10645 |
-
|
10646 |
-
|
10647 |
-
|
10648 |
-
|
10649 |
-
|
10650 |
-
|
10651 |
-
|
10652 |
-
|
10653 |
-
|
10654 |
-
|
10655 |
-
|
10656 |
-
|
10657 |
-
|
10658 |
-
|
10659 |
-
|
10660 |
-
|
10661 |
-
|
10662 |
-
|
10663 |
-
|
10664 |
-
|
10665 |
-
|
10666 |
-
|
10667 |
-
|
10668 |
-
|
10669 |
-
|
10670 |
-
|
10671 |
-
|
10672 |
-
|
10673 |
-
|
10674 |
-
|
10675 |
-
|
10676 |
-
|
10677 |
-
|
10678 |
-
|
10679 |
-
|
10680 |
-
|
10681 |
-
|
10682 |
-
|
10683 |
-
|
10684 |
-
|
10685 |
-
|
10686 |
-
|
10687 |
-
|
10688 |
-
|
10689 |
-
|
10690 |
-
|
10691 |
-
|
10692 |
-
|
10693 |
-
|
10694 |
-
|
10695 |
-
|
10696 |
-
|
10697 |
-
|
10698 |
-
|
10699 |
-
|
10700 |
-
|
10701 |
-
|
10702 |
-
|
10703 |
-
|
10704 |
-
|
10705 |
-
|
10706 |
-
|
10707 |
-
|
10708 |
-
|
10709 |
-
|
10710 |
-
|
10711 |
-
|
10712 |
-
|
10713 |
-
|
10714 |
-
|
10715 |
-
|
10716 |
-
|
10717 |
-
|
10718 |
-
|
10719 |
-
|
10720 |
-
|
10721 |
-
|
10722 |
-
|
10723 |
-
|
10724 |
-
|
10725 |
-
|
10726 |
-
|
10727 |
-
|
10728 |
-
|
10729 |
-
|
10730 |
-
|
10731 |
-
|
10732 |
-
|
10733 |
-
|
10734 |
-
|
10735 |
-
|
10736 |
-
|
10737 |
-
|
10738 |
-
|
10739 |
-
|
10740 |
-
|
10741 |
-
|
10742 |
-
|
10743 |
-
|
10744 |
-
|
10745 |
-
|
10746 |
-
|
10747 |
-
|
10748 |
-
|
10749 |
-
|
10750 |
-
|
10751 |
-
|
10752 |
-
|
10753 |
-
|
10754 |
-
|
10755 |
-
|
10756 |
-
|
10757 |
-
|
10758 |
-
|
10759 |
-
|
10760 |
-
|
10761 |
-
|
10762 |
-
|
10763 |
-
|
10764 |
-
|
10765 |
-
|
10766 |
-
|
10767 |
-
|
10768 |
-
|
10769 |
-
|
10770 |
-
|
10771 |
-
|
10772 |
-
|
10773 |
-
|
10774 |
-
|
10775 |
-
|
10776 |
-
|
10777 |
-
|
10778 |
-
|
10779 |
-
|
10780 |
-
|
10781 |
-
|
10782 |
-
|
10783 |
-
|
10784 |
-
|
10785 |
-
|
10786 |
-
|
10787 |
-
|
10788 |
-
|
10789 |
-
|
10790 |
-
|
10791 |
-
|
10792 |
-
|
10793 |
-
|
10794 |
-
|
10795 |
-
|
10796 |
-
|
10797 |
-
|
10798 |
-
|
10799 |
-
|
10800 |
-
|
10801 |
-
|
10802 |
-
|
10803 |
-
|
10804 |
-
|
10805 |
-
|
10806 |
-
|
10807 |
-
|
10808 |
-
|
10809 |
-
|
10810 |
-
|
10811 |
-
|
10812 |
-
|
10813 |
-
|
10814 |
-
|
10815 |
-
|
10816 |
-
|
10817 |
-
|
10818 |
-
|
10819 |
-
|
10820 |
-
|
10821 |
-
|
10822 |
-
|
10823 |
-
|
10824 |
-
|
10825 |
-
|
10826 |
-
|
10827 |
-
|
10828 |
-
|
10829 |
-
|
10830 |
-
|
10831 |
-
|
10832 |
-
|
10833 |
-
|
10834 |
-
|
10835 |
-
|
10836 |
-
|
10837 |
-
|
10838 |
-
|
10839 |
-
|
10840 |
-
|
10841 |
-
|
10842 |
-
|
10843 |
-
|
10844 |
-
|
10845 |
-
|
10846 |
-
|
10847 |
-
|
10848 |
-
|
10849 |
-
|
10850 |
-
|
10851 |
-
|
10852 |
-
|
10853 |
-
|
10854 |
-
|
10855 |
-
|
10856 |
-
|
10857 |
-
|
10858 |
-
|
10859 |
-
|
10860 |
-
|
10861 |
-
|
10862 |
-
|
10863 |
-
|
10864 |
-
|
10865 |
-
|
10866 |
-
|
10867 |
-
|
10868 |
-
|
10869 |
-
|
10870 |
-
|
10871 |
-
|
10872 |
-
|
10873 |
-
|
10874 |
-
|
10875 |
-
|
10876 |
-
|
10877 |
-
|
10878 |
-
|
10879 |
-
|
10880 |
-
|
10881 |
-
|
10882 |
-
|
10883 |
-
|
10884 |
-
|
10885 |
-
|
10886 |
-
|
10887 |
-
|
10888 |
-
|
10889 |
-
|
10890 |
-
|
10891 |
-
|
10892 |
-
|
10893 |
-
|
10894 |
-
|
10895 |
-
|
10896 |
-
|
10897 |
-
|
10898 |
-
|
10899 |
-
|
10900 |
-
|
10901 |
-
|
10902 |
-
|
10903 |
-
|
10904 |
-
|
10905 |
-
|
10906 |
-
|
10907 |
-
|
10908 |
-
|
10909 |
-
|
10910 |
-
|
10911 |
-
|
10912 |
-
|
10913 |
-
|
10914 |
-
|
10915 |
-
|
10916 |
-
|
10917 |
-
|
10918 |
-
|
10919 |
-
|
10920 |
-
|
10921 |
-
|
10922 |
-
|
10923 |
-
|
10924 |
-
|
10925 |
-
|
10926 |
-
|
10927 |
-
|
10928 |
-
|
10929 |
-
|
10930 |
-
|
10931 |
-
|
10932 |
-
|
10933 |
-
|
10934 |
-
|
10935 |
-
|
10936 |
-
|
10937 |
-
|
10938 |
-
|
10939 |
-
|
10940 |
-
|
10941 |
-
|
10942 |
-
|
10943 |
-
|
10944 |
-
|
10945 |
-
|
10946 |
-
|
10947 |
-
|
10948 |
-
|
10949 |
-
|
10950 |
-
|
10951 |
-
|
10952 |
-
|
10953 |
-
|
10954 |
-
|
10955 |
-
|
10956 |
-
|
10957 |
-
|
10958 |
-
|
10959 |
-
|
10960 |
-
|
10961 |
-
|
10962 |
-
|
10963 |
-
|
10964 |
-
|
10965 |
-
|
10966 |
-
|
10967 |
-
|
10968 |
-
|
10969 |
-
|
10970 |
-
|
10971 |
-
|
10972 |
-
|
10973 |
-
|
10974 |
-
|
10975 |
-
|
10976 |
-
|
10977 |
-
|
10978 |
-
|
10979 |
-
|
10980 |
-
|
10981 |
-
|
10982 |
-
|
10983 |
-
|
10984 |
-
|
10985 |
-
|
10986 |
-
|
10987 |
-
|
10988 |
-
|
10989 |
-
|
10990 |
-
|
10991 |
-
|
10992 |
-
|
10993 |
-
|
10994 |
-
|
10995 |
-
|
10996 |
-
|
10997 |
-
|
10998 |
-
|
10999 |
-
|
11000 |
-
|
11001 |
-
|
11002 |
-
|
11003 |
-
|
11004 |
-
|
11005 |
-
|
11006 |
-
|
11007 |
-
|
11008 |
-
|
11009 |
-
|
11010 |
-
|
11011 |
-
|
11012 |
-
|
11013 |
-
|
11014 |
-
|
11015 |
-
|
11016 |
-
|
11017 |
-
|
11018 |
-
|
11019 |
-
|
11020 |
-
|
11021 |
-
|
11022 |
-
|
11023 |
-
|
11024 |
-
|
11025 |
-
|
11026 |
-
|
11027 |
-
|
11028 |
-
|
11029 |
-
|
11030 |
-
|
11031 |
-
|
11032 |
-
|
11033 |
-
|
11034 |
-
|
11035 |
-
|
11036 |
-
|
11037 |
-
|
11038 |
-
|
11039 |
-
|
11040 |
-
|
11041 |
-
|
11042 |
-
|
11043 |
-
|
11044 |
-
|
11045 |
-
|
11046 |
-
|
11047 |
-
|
11048 |
-
|
11049 |
-
|
11050 |
-
|
11051 |
-
|
11052 |
-
|
11053 |
-
|
11054 |
-
|
11055 |
-
|
11056 |
-
|
11057 |
-
|
11058 |
-
|
11059 |
-
|
11060 |
-
|
11061 |
-
|
11062 |
-
|
11063 |
-
|
11064 |
-
|
11065 |
-
|
11066 |
-
|
11067 |
-
|
11068 |
-
|
11069 |
-
|
11070 |
-
|
11071 |
-
|
11072 |
-
|
11073 |
-
|
11074 |
-
|
11075 |
-
|
11076 |
-
|
11077 |
-
|
11078 |
-
|
11079 |
-
|
11080 |
-
|
11081 |
-
|
11082 |
-
|
11083 |
-
|
11084 |
-
|
11085 |
-
|
11086 |
-
|
11087 |
-
|
11088 |
-
|
11089 |
-
|
11090 |
-
|
11091 |
-
|
11092 |
-
|
11093 |
-
|
11094 |
-
|
11095 |
-
|
11096 |
-
|
11097 |
-
|
11098 |
-
|
11099 |
-
|
11100 |
-
|
11101 |
-
|
11102 |
-
|
11103 |
-
|
11104 |
-
|
11105 |
-
|
11106 |
-
|
11107 |
-
|
11108 |
-
|
11109 |
-
|
11110 |
-
|
11111 |
-
|
11112 |
-
|
11113 |
-
|
11114 |
-
|
11115 |
-
|
11116 |
-
|
11117 |
-
|
11118 |
-
|
11119 |
-
|
11120 |
-
|
11121 |
-
|
11122 |
-
|
11123 |
-
|
11124 |
-
|
11125 |
-
|
11126 |
-
|
11127 |
-
|
11128 |
-
|
11129 |
-
|
11130 |
-
|
11131 |
-
|
11132 |
-
|
11133 |
-
|
11134 |
-
|
11135 |
-
|
11136 |
-
|
11137 |
-
|
11138 |
-
|
11139 |
-
|
11140 |
-
|
11141 |
-
|
11142 |
-
|
11143 |
-
|
11144 |
-
|
11145 |
-
|
11146 |
-
|
11147 |
-
|
11148 |
-
|
11149 |
-
|
11150 |
-
|
11151 |
-
|
11152 |
-
|
11153 |
-
|
11154 |
-
|
11155 |
-
|
11156 |
-
|
11157 |
-
|
11158 |
-
|
11159 |
-
|
11160 |
-
|
11161 |
-
|
11162 |
-
|
11163 |
-
|
11164 |
-
|
11165 |
-
|
11166 |
-
|
11167 |
-
|
11168 |
-
|
11169 |
-
|
11170 |
-
|
11171 |
-
|
11172 |
-
|
11173 |
-
|
11174 |
-
|
11175 |
-
|
11176 |
-
|
11177 |
-
|
11178 |
-
|
11179 |
-
|
11180 |
-
|
11181 |
-
|
11182 |
-
|
11183 |
-
|
11184 |
-
|
11185 |
-
|
11186 |
-
|
11187 |
-
|
11188 |
-
|
11189 |
-
|
11190 |
-
|
11191 |
-
|
11192 |
-
|
11193 |
-
|
11194 |
-
|
11195 |
-
|
11196 |
-
|
11197 |
-
|
11198 |
-
|
11199 |
-
|
11200 |
-
|
11201 |
-
|
11202 |
-
|
11203 |
-
|
11204 |
-
|
11205 |
-
|
11206 |
-
|
11207 |
-
|
11208 |
-
|
11209 |
-
|
11210 |
-
|
11211 |
-
|
11212 |
-
|
11213 |
-
|
11214 |
-
|
11215 |
-
|
11216 |
-
|
11217 |
-
|
11218 |
-
|
11219 |
-
|
11220 |
-
|
11221 |
-
|
11222 |
-
|
11223 |
-
|
11224 |
-
|
11225 |
-
|
11226 |
-
|
11227 |
-
|
11228 |
-
|
11229 |
-
|
11230 |
-
|
11231 |
-
|
11232 |
-
|
11233 |
-
|
11234 |
-
|
11235 |
-
|
11236 |
-
|
11237 |
-
|
11238 |
-
|
11239 |
-
|
11240 |
-
|
11241 |
-
|
11242 |
-
|
11243 |
-
|
11244 |
-
|
11245 |
-
|
11246 |
-
|
11247 |
-
|
11248 |
-
|
11249 |
-
|
11250 |
-
|
11251 |
-
|
11252 |
-
|
11253 |
-
|
11254 |
-
|
11255 |
-
|
11256 |
-
|
11257 |
-
|
11258 |
-
|
11259 |
-
|
11260 |
-
|
11261 |
-
|
11262 |
-
|
11263 |
-
|
11264 |
-
|
11265 |
-
|
11266 |
-
|
11267 |
-
|
11268 |
-
|
11269 |
-
|
11270 |
-
|
11271 |
-
|
11272 |
-
|
11273 |
-
|
11274 |
-
|
11275 |
-
|
11276 |
-
|
11277 |
-
|
11278 |
-
|
11279 |
-
|
11280 |
-
|
11281 |
-
|
11282 |
-
|
11283 |
-
|
11284 |
-
|
11285 |
-
|
11286 |
-
|
11287 |
-
|
11288 |
-
|
11289 |
-
|
11290 |
-
|
11291 |
-
|
11292 |
-
|
11293 |
-
|
11294 |
-
|
11295 |
-
|
11296 |
-
|
11297 |
-
|
11298 |
-
|
11299 |
-
|
11300 |
-
|
11301 |
-
|
11302 |
-
|
11303 |
-
|
11304 |
-
|
11305 |
-
|
11306 |
-
|
11307 |
-
|
11308 |
-
|
11309 |
-
|
11310 |
-
|
11311 |
-
|
11312 |
-
|
11313 |
-
|
11314 |
-
|
11315 |
-
|
11316 |
-
|
11317 |
-
|
11318 |
-
|
11319 |
-
|
11320 |
-
|
11321 |
-
|
11322 |
-
|
11323 |
-
|
11324 |
-
|
11325 |
-
|
11326 |
-
|
11327 |
-
|
11328 |
-
|
11329 |
-
|
11330 |
-
|
11331 |
-
|
11332 |
-
|
11333 |
-
|
11334 |
-
|
11335 |
-
|
11336 |
-
|
11337 |
-
|
11338 |
-
|
11339 |
-
|
11340 |
-
|
11341 |
-
|
11342 |
-
|
11343 |
-
|
11344 |
-
|
11345 |
-
|
11346 |
-
|
11347 |
-
|
11348 |
-
|
11349 |
-
|
11350 |
-
|
11351 |
-
|
11352 |
-
|
11353 |
-
|
11354 |
-
|
11355 |
-
|
11356 |
-
|
11357 |
-
|
11358 |
-
|
11359 |
-
|
11360 |
-
|
11361 |
-
|
11362 |
-
|
11363 |
-
|
11364 |
-
|
11365 |
-
|
11366 |
-
|
11367 |
-
|
11368 |
-
|
11369 |
-
|
11370 |
-
|
11371 |
-
|
11372 |
-
|
11373 |
-
|
11374 |
-
|
11375 |
-
|
11376 |
-
|
11377 |
-
|
11378 |
-
|
11379 |
-
|
11380 |
-
|
11381 |
-
|
11382 |
-
|
11383 |
-
|
11384 |
-
|
11385 |
-
|
11386 |
-
|
11387 |
-
|
11388 |
-
|
11389 |
-
|
11390 |
-
|
11391 |
-
|
11392 |
-
|
11393 |
-
|
11394 |
-
|
11395 |
-
|
11396 |
-
|
11397 |
-
|
11398 |
-
|
11399 |
-
|
11400 |
-
|
11401 |
-
|
11402 |
-
|
11403 |
-
|
11404 |
-
|
11405 |
-
|
11406 |
-
|
11407 |
-
|
11408 |
-
|
11409 |
-
|
11410 |
-
|
11411 |
-
|
11412 |
-
|
11413 |
-
|
11414 |
-
|
11415 |
-
|
11416 |
-
|
11417 |
-
|
11418 |
-
|
11419 |
-
|
11420 |
-
|
11421 |
-
|
11422 |
-
|
11423 |
-
|
11424 |
-
|
11425 |
-
|
11426 |
-
|
11427 |
-
|
11428 |
-
|
11429 |
-
|
11430 |
-
|
11431 |
-
|
11432 |
-
|
11433 |
-
|
11434 |
-
|
11435 |
-
|
11436 |
-
|
11437 |
-
|
11438 |
-
|
11439 |
-
|
11440 |
-
|
11441 |
-
|
11442 |
-
|
11443 |
-
|
11444 |
-
|
11445 |
-
|
11446 |
-
|
11447 |
-
|
11448 |
-
|
11449 |
-
|
11450 |
-
|
11451 |
-
|
11452 |
-
|
11453 |
-
|
11454 |
-
|
11455 |
-
|
11456 |
-
|
11457 |
-
|
11458 |
-
|
11459 |
-
|
11460 |
-
|
11461 |
-
|
11462 |
-
|
11463 |
-
|
11464 |
-
|
11465 |
-
|
11466 |
-
|
11467 |
-
|
11468 |
-
|
11469 |
-
|
11470 |
-
|
11471 |
-
|
11472 |
-
|
11473 |
-
|
11474 |
-
|
11475 |
-
|
11476 |
-
|
11477 |
-
|
11478 |
-
|
11479 |
-
|
11480 |
-
|
11481 |
-
|
11482 |
-
|
11483 |
-
|
11484 |
-
|
11485 |
-
|
11486 |
-
|
11487 |
-
|
11488 |
-
|
11489 |
-
|
11490 |
-
|
11491 |
-
|
11492 |
-
|
11493 |
-
|
11494 |
-
|
11495 |
-
|
11496 |
-
|
11497 |
-
|
11498 |
-
|
11499 |
-
|
11500 |
-
|
11501 |
-
|
11502 |
-
|
11503 |
-
|
11504 |
-
|
11505 |
-
|
11506 |
-
|
11507 |
-
|
11508 |
-
|
11509 |
-
|
11510 |
-
|
11511 |
-
|
11512 |
-
|
11513 |
-
|
11514 |
-
|
11515 |
-
|
11516 |
-
|
11517 |
-
|
11518 |
-
|
11519 |
-
|
11520 |
-
|
11521 |
-
|
11522 |
-
|
11523 |
-
|
11524 |
-
|
11525 |
-
|
11526 |
-
|
11527 |
-
|
11528 |
-
|
11529 |
-
|
11530 |
-
|
11531 |
-
|
11532 |
-
|
11533 |
-
|
11534 |
-
|
11535 |
-
|
11536 |
-
|
11537 |
-
|
11538 |
-
|
11539 |
-
|
11540 |
-
|
11541 |
-
|
11542 |
-
|
11543 |
-
|
11544 |
-
|
11545 |
-
|
11546 |
-
|
11547 |
-
|
11548 |
-
|
11549 |
-
|
11550 |
-
|
11551 |
-
|
11552 |
-
|
11553 |
-
|
11554 |
-
|
11555 |
-
|
11556 |
-
|
11557 |
-
|
11558 |
-
|
11559 |
-
|
11560 |
-
|
11561 |
-
|
11562 |
-
|
11563 |
-
|
11564 |
-
|
11565 |
-
|
11566 |
-
|
11567 |
-
|
11568 |
-
|
11569 |
-
|
11570 |
-
|
11571 |
-
|
11572 |
-
|
11573 |
-
|
11574 |
-
|
11575 |
-
|
11576 |
-
|
11577 |
-
|
11578 |
-
|
11579 |
-
|
11580 |
-
|
11581 |
-
|
11582 |
-
|
11583 |
-
|
11584 |
-
|
11585 |
-
|
11586 |
-
|
11587 |
-
|
11588 |
-
|
11589 |
-
|
11590 |
-
|
11591 |
-
|
11592 |
-
|
11593 |
-
|
11594 |
-
|
11595 |
-
|
11596 |
-
|
11597 |
-
|
11598 |
-
|
11599 |
-
|
11600 |
-
|
11601 |
-
|
11602 |
-
|
11603 |
-
|
11604 |
-
|
11605 |
-
|
11606 |
-
|
11607 |
-
|
11608 |
-
|
11609 |
-
|
11610 |
-
|
11611 |
-
|
11612 |
-
|
11613 |
-
|
11614 |
-
|
11615 |
-
|
11616 |
-
|
11617 |
-
|
11618 |
-
|
11619 |
-
|
11620 |
-
|
11621 |
-
|
11622 |
-
|
11623 |
-
|
11624 |
-
|
11625 |
-
|
11626 |
-
|
11627 |
-
|
11628 |
-
|
11629 |
-
|
11630 |
-
|
11631 |
-
|
11632 |
-
|
11633 |
-
|
11634 |
-
|
11635 |
-
|
11636 |
-
|
11637 |
-
|
11638 |
-
|
11639 |
-
|
11640 |
-
|
11641 |
-
|
11642 |
-
|
11643 |
-
|
11644 |
-
|
11645 |
-
|
11646 |
-
|
11647 |
-
|
11648 |
-
|
11649 |
-
|
11650 |
-
|
11651 |
-
|
11652 |
-
|
11653 |
-
|
11654 |
-
|
11655 |
-
|
11656 |
-
|
11657 |
-
|
11658 |
-
|
11659 |
-
|
11660 |
-
|
11661 |
-
|
11662 |
-
|
11663 |
-
|
11664 |
-
|
11665 |
-
|
11666 |
-
|
11667 |
-
|
11668 |
-
|
11669 |
-
|
11670 |
-
|
11671 |
-
|
11672 |
-
|
11673 |
-
|
11674 |
-
|
11675 |
-
|
11676 |
-
|
11677 |
-
|
11678 |
-
|
11679 |
-
|
11680 |
-
|
11681 |
-
|
11682 |
-
|
11683 |
-
|
11684 |
-
|
11685 |
-
|
11686 |
-
|
11687 |
-
|
11688 |
-
|
11689 |
-
|
11690 |
-
|
11691 |
-
|
11692 |
-
|
11693 |
-
|
11694 |
-
|
11695 |
-
|
11696 |
-
|
11697 |
-
|
11698 |
-
|
11699 |
-
|
11700 |
-
|
11701 |
-
|
11702 |
-
|
11703 |
-
|
11704 |
-
|
11705 |
-
|
11706 |
-
|
11707 |
-
|
11708 |
-
|
11709 |
-
|
11710 |
-
|
11711 |
-
|
11712 |
-
|
11713 |
-
|
11714 |
-
|
11715 |
-
|
11716 |
-
|
11717 |
-
|
11718 |
-
|
11719 |
-
|
11720 |
-
|
11721 |
-
|
11722 |
-
|
11723 |
-
|
11724 |
-
|
11725 |
-
|
11726 |
-
|
11727 |
-
|
11728 |
-
|
11729 |
-
|
11730 |
-
|
11731 |
-
|
11732 |
-
|
11733 |
-
|
11734 |
-
|
11735 |
-
|
11736 |
-
|
11737 |
-
|
11738 |
-
|
11739 |
-
|
11740 |
-
|
11741 |
-
|
11742 |
-
|
11743 |
-
|
11744 |
-
|
11745 |
-
|
11746 |
-
|
11747 |
-
|
11748 |
-
|
11749 |
-
|
11750 |
-
|
11751 |
-
|
11752 |
-
|
11753 |
-
|
11754 |
-
|
11755 |
-
|
11756 |
-
|
11757 |
-
|
11758 |
-
|
11759 |
-
|
11760 |
-
|
11761 |
-
|
11762 |
-
|
11763 |
-
|
11764 |
-
|
11765 |
-
|
11766 |
-
|
11767 |
-
|
11768 |
-
|
11769 |
-
|
11770 |
-
|
11771 |
-
|
11772 |
-
|
11773 |
-
|
11774 |
-
|
11775 |
-
|
11776 |
-
|
11777 |
-
|
11778 |
-
|
11779 |
-
|
11780 |
-
|
11781 |
-
|
11782 |
-
|
11783 |
-
|
11784 |
-
|
11785 |
-
|
11786 |
-
|
11787 |
-
|
11788 |
-
|
11789 |
-
|
11790 |
-
|
11791 |
-
|
11792 |
-
|
11793 |
-
|
11794 |
-
|
11795 |
-
|
11796 |
-
|
11797 |
-
|
11798 |
-
|
11799 |
-
|
11800 |
-
|
11801 |
-
|
11802 |
-
|
11803 |
-
|
11804 |
-
|
11805 |
-
|
11806 |
-
|
11807 |
-
|
11808 |
-
|
11809 |
-
|
11810 |
-
|
11811 |
-
|
11812 |
-
|
11813 |
-
|
11814 |
-
|
11815 |
-
|
11816 |
-
|
11817 |
-
|
11818 |
-
|
11819 |
-
|
11820 |
-
|
11821 |
-
|
11822 |
-
|
11823 |
-
|
11824 |
-
|
11825 |
-
|
11826 |
-
|
11827 |
-
|
11828 |
-
|
11829 |
-
|
11830 |
-
|
11831 |
-
|
11832 |
-
|
11833 |
-
|
11834 |
-
|
11835 |
-
|
11836 |
-
|
11837 |
-
|
11838 |
-
|
11839 |
-
|
11840 |
-
|
11841 |
-
|
11842 |
-
|
11843 |
-
|
11844 |
-
|
11845 |
-
|
11846 |
-
|
11847 |
-
|
11848 |
-
|
11849 |
-
|
11850 |
-
|
11851 |
-
|
11852 |
-
|
11853 |
-
|
11854 |
-
|
11855 |
-
|
11856 |
-
|
11857 |
-
|
11858 |
-
|
11859 |
-
|
11860 |
-
|
11861 |
-
|
11862 |
-
|
11863 |
-
|
11864 |
-
|
11865 |
-
|
11866 |
-
|
11867 |
-
|
11868 |
-
|
11869 |
-
|
11870 |
-
|
11871 |
-
|
11872 |
-
|
11873 |
-
|
11874 |
-
|
11875 |
-
|
11876 |
-
|
11877 |
-
|
11878 |
-
|
11879 |
-
|
11880 |
-
|
11881 |
-
|
11882 |
-
|
11883 |
-
|
11884 |
-
|
11885 |
-
|
11886 |
-
|
11887 |
-
|
11888 |
-
|
11889 |
-
|
11890 |
-
|
11891 |
-
|
11892 |
-
|
11893 |
-
|
11894 |
-
|
11895 |
-
|
11896 |
-
|
11897 |
-
|
11898 |
-
|
11899 |
-
|
11900 |
-
|
11901 |
-
|
11902 |
-
|
11903 |
-
|
11904 |
-
|
11905 |
-
|
11906 |
-
|
11907 |
-
|
11908 |
-
|
11909 |
-
|
11910 |
-
|
11911 |
-
|
11912 |
-
|
11913 |
-
|
11914 |
-
|
11915 |
-
|
11916 |
-
|
11917 |
-
|
11918 |
-
|
11919 |
-
|
11920 |
-
|
11921 |
-
|
11922 |
-
|
11923 |
-
|
11924 |
-
|
11925 |
-
|
11926 |
-
|
11927 |
-
|
11928 |
-
|
11929 |
-
|
11930 |
-
|
11931 |
-
|
11932 |
-
|
11933 |
-
|
11934 |
-
|
11935 |
-
|
11936 |
-
|
11937 |
-
|
11938 |
-
|
11939 |
-
|
11940 |
-
|
11941 |
-
|
11942 |
-
|
11943 |
-
|
11944 |
-
|
11945 |
-
|
11946 |
-
|
11947 |
-
|
11948 |
-
|
11949 |
-
|
11950 |
-
|
11951 |
-
|
11952 |
-
|
11953 |
-
|
11954 |
-
|
11955 |
-
|
11956 |
-
|
11957 |
-
|
11958 |
-
|
11959 |
-
|
11960 |
-
|
11961 |
-
|
11962 |
-
|
11963 |
-
|
11964 |
-
|
11965 |
-
|
11966 |
-
|
11967 |
-
|
11968 |
-
|
11969 |
-
|
11970 |
-
|
11971 |
-
|
11972 |
-
|
11973 |
-
|
11974 |
-
|
11975 |
-
|
11976 |
-
|
11977 |
-
|
11978 |
-
|
11979 |
-
|
11980 |
-
|
11981 |
-
|
11982 |
-
|
11983 |
-
|
11984 |
-
|
11985 |
-
|
11986 |
-
|
11987 |
-
|
11988 |
-
|
11989 |
-
|
11990 |
-
|
11991 |
-
|
11992 |
-
|
11993 |
-
|
11994 |
-
|
11995 |
-
|
11996 |
-
|
11997 |
-
|
11998 |
-
|
11999 |
-
|
12000 |
-
|
12001 |
-
|
12002 |
-
|
12003 |
-
|
12004 |
-
|
12005 |
-
|
12006 |
-
|
12007 |
-
|
12008 |
-
|
12009 |
-
|
12010 |
-
|
12011 |
-
|
12012 |
-
|
12013 |
-
|
12014 |
-
|
12015 |
-
|
12016 |
-
|
12017 |
-
|
12018 |
-
|
12019 |
-
|
12020 |
-
|
12021 |
-
|
12022 |
-
|
12023 |
-
|
12024 |
-
|
12025 |
-
|
12026 |
-
|
12027 |
-
|
12028 |
-
|
12029 |
-
|
12030 |
-
|
12031 |
-
|
12032 |
-
|
12033 |
-
|
12034 |
-
|
12035 |
-
|
12036 |
-
|
12037 |
-
|
12038 |
-
|
12039 |
-
|
12040 |
-
|
12041 |
-
|
12042 |
-
|
12043 |
-
|
12044 |
-
|
12045 |
-
|
12046 |
-
|
12047 |
-
|
12048 |
-
|
12049 |
-
|
12050 |
-
|
12051 |
-
|
12052 |
-
|
12053 |
-
|
12054 |
-
|
12055 |
-
|
12056 |
-
|
12057 |
-
|
12058 |
-
|
12059 |
-
|
12060 |
-
|
12061 |
-
|
12062 |
-
|
12063 |
-
|
12064 |
-
|
12065 |
-
|
12066 |
-
|
12067 |
-
|
12068 |
-
|
12069 |
-
|
12070 |
-
|
12071 |
-
|
12072 |
-
|
12073 |
-
|
12074 |
-
|
12075 |
-
|
12076 |
-
|
12077 |
-
|
12078 |
-
|
12079 |
-
|
12080 |
-
|
12081 |
-
|
12082 |
-
|
12083 |
-
|
12084 |
-
|
12085 |
-
|
12086 |
-
|
12087 |
-
|
12088 |
-
|
12089 |
-
|
12090 |
-
|
12091 |
-
|
12092 |
-
|
12093 |
-
|
12094 |
-
|
12095 |
-
|
12096 |
-
|
12097 |
-
|
12098 |
-
|
12099 |
-
|
12100 |
-
|
12101 |
-
|
12102 |
-
|
12103 |
-
|
12104 |
-
|
12105 |
-
|
12106 |
-
|
12107 |
-
|
12108 |
-
|
12109 |
-
|
12110 |
-
|
12111 |
-
|
12112 |
-
|
12113 |
-
|
12114 |
-
|
12115 |
-
|
12116 |
-
|
12117 |
-
|
12118 |
-
|
12119 |
-
|
12120 |
-
|
12121 |
-
|
12122 |
-
|
12123 |
-
|
12124 |
-
|
12125 |
-
|
12126 |
-
|
12127 |
-
|
12128 |
-
|
12129 |
-
|
12130 |
-
|
12131 |
-
|
12132 |
-
|
12133 |
-
|
12134 |
-
|
12135 |
-
|
12136 |
-
|
12137 |
-
|
12138 |
-
|
12139 |
-
|
12140 |
-
|
12141 |
-
|
12142 |
-
|
12143 |
-
|
12144 |
-
|
12145 |
-
|
12146 |
-
|
12147 |
-
|
12148 |
-
|
12149 |
-
|
12150 |
-
|
12151 |
-
|
12152 |
-
|
12153 |
-
|
12154 |
-
|
12155 |
-
|
12156 |
-
|
12157 |
-
|
12158 |
-
|
12159 |
-
|
12160 |
-
|
12161 |
-
|
12162 |
-
|
12163 |
-
|
12164 |
-
|
12165 |
-
|
12166 |
-
|
12167 |
-
|
12168 |
-
|
12169 |
-
|
12170 |
-
|
12171 |
-
|
12172 |
-
|
12173 |
-
|
12174 |
-
|
12175 |
-
|
12176 |
-
|
12177 |
-
|
12178 |
-
|
12179 |
-
|
12180 |
-
|
12181 |
-
|
12182 |
-
|
12183 |
-
|
12184 |
-
|
12185 |
-
|
12186 |
-
|
12187 |
-
|
12188 |
-
|
12189 |
-
|
12190 |
-
|
12191 |
-
|
12192 |
-
|
12193 |
-
|
12194 |
-
|
12195 |
-
|
12196 |
-
|
12197 |
-
|
12198 |
-
|
12199 |
-
|
12200 |
-
|
12201 |
-
|
12202 |
-
|
12203 |
-
|
12204 |
-
|
12205 |
-
|
12206 |
-
|
12207 |
-
|
12208 |
-
|
12209 |
-
|
12210 |
-
|
12211 |
-
|
12212 |
-
|
12213 |
-
|
12214 |
-
|
12215 |
-
|
12216 |
-
|
12217 |
-
|
12218 |
-
|
12219 |
-
|
12220 |
-
|
12221 |
-
|
12222 |
-
|
12223 |
-
|
12224 |
-
|
12225 |
-
|
12226 |
-
|
12227 |
-
|
12228 |
-
|
12229 |
-
|
12230 |
-
|
12231 |
-
|
12232 |
-
|
12233 |
-
|
12234 |
-
|
12235 |
-
|
12236 |
-
|
12237 |
-
|
12238 |
-
|
12239 |
-
|
12240 |
-
|
12241 |
-
|
12242 |
-
|
12243 |
-
|
12244 |
-
|
12245 |
-
|
12246 |
-
|
12247 |
-
|
12248 |
-
|
12249 |
-
|
12250 |
-
|
12251 |
-
|
12252 |
-
|
12253 |
-
|
12254 |
-
|
12255 |
-
|
12256 |
-
|
12257 |
-
|
12258 |
-
|
12259 |
-
|
12260 |
-
|
12261 |
-
|
12262 |
-
|
12263 |
-
|
12264 |
-
|
12265 |
-
|
12266 |
-
|
12267 |
-
|
12268 |
-
|
12269 |
-
|
12270 |
-
|
12271 |
-
|
12272 |
-
|
12273 |
-
|
12274 |
-
|
12275 |
-
|
12276 |
-
|
12277 |
-
|
12278 |
-
|
12279 |
-
|
12280 |
-
|
12281 |
-
|
12282 |
-
|
12283 |
-
|
12284 |
-
|
12285 |
-
|
12286 |
-
|
12287 |
-
|
12288 |
-
|
12289 |
-
|
12290 |
-
|
12291 |
-
|
12292 |
-
|
12293 |
-
|
12294 |
-
|
12295 |
-
|
12296 |
-
|
12297 |
-
|
12298 |
-
|
12299 |
-
|
12300 |
-
|
12301 |
-
|
12302 |
-
|
12303 |
-
|
12304 |
-
|
12305 |
-
|
12306 |
-
|
12307 |
-
|
12308 |
-
|
12309 |
-
|
12310 |
-
|
12311 |
-
|
12312 |
-
|
12313 |
-
|
12314 |
-
|
12315 |
-
|
12316 |
-
|
12317 |
-
|
12318 |
-
|
12319 |
-
|
12320 |
-
|
12321 |
-
|
12322 |
-
|
12323 |
-
|
12324 |
-
|
12325 |
-
|
12326 |
-
|
12327 |
-
|
12328 |
-
|
12329 |
-
|
12330 |
-
|
12331 |
-
|
12332 |
-
|
12333 |
-
|
12334 |
-
|
12335 |
-
|
12336 |
-
|
12337 |
-
|
12338 |
-
|
12339 |
-
|
12340 |
-
|
12341 |
-
|
12342 |
-
|
12343 |
-
|
12344 |
-
|
12345 |
-
|
12346 |
-
|
12347 |
-
|
12348 |
-
|
12349 |
-
|
12350 |
-
|
12351 |
-
|
12352 |
-
|
12353 |
-
|
12354 |
-
|
12355 |
-
|
12356 |
-
|
12357 |
-
|
12358 |
-
|
12359 |
-
|
12360 |
-
|
12361 |
-
|
12362 |
-
|
12363 |
-
|
12364 |
-
|
12365 |
-
|
12366 |
-
|
12367 |
-
|
12368 |
-
|
12369 |
-
|
12370 |
-
|
12371 |
-
|
12372 |
-
|
12373 |
-
|
12374 |
-
|
12375 |
-
|
12376 |
-
|
12377 |
-
|
12378 |
-
|
12379 |
-
|
12380 |
-
|
12381 |
-
|
12382 |
-
|
12383 |
-
|
12384 |
-
|
12385 |
-
|
12386 |
-
|
12387 |
-
|
12388 |
-
|
12389 |
-
|
12390 |
-
|
12391 |
-
|
12392 |
-
|
12393 |
-
|
12394 |
-
|
12395 |
-
|
12396 |
-
|
12397 |
-
|
12398 |
-
|
12399 |
-
|
12400 |
-
|
12401 |
-
|
12402 |
-
|
12403 |
-
|
12404 |
-
|
12405 |
-
|
12406 |
-
|
12407 |
-
|
12408 |
-
|
12409 |
-
|
12410 |
-
|
12411 |
-
|
12412 |
-
|
12413 |
-
|
12414 |
-
|
12415 |
-
|
12416 |
-
|
12417 |
-
|
12418 |
-
|
12419 |
-
|
12420 |
-
|
12421 |
-
|
12422 |
-
|
12423 |
-
|
12424 |
-
|
12425 |
-
|
12426 |
-
|
12427 |
-
|
12428 |
-
|
12429 |
-
|
12430 |
-
|
12431 |
-
|
12432 |
-
|
12433 |
-
|
12434 |
-
|
12435 |
-
|
12436 |
-
|
12437 |
-
|
12438 |
-
|
12439 |
-
|
12440 |
-
|
12441 |
-
|
12442 |
-
|
12443 |
-
|
12444 |
-
|
12445 |
-
|
12446 |
-
|
12447 |
-
|
12448 |
-
|
12449 |
-
|
12450 |
-
|
12451 |
-
|
12452 |
-
|
12453 |
-
|
12454 |
-
|
12455 |
-
|
12456 |
-
|
12457 |
-
|
12458 |
-
|
12459 |
-
|
12460 |
-
|
12461 |
-
|
12462 |
-
|
12463 |
-
|
12464 |
-
|
12465 |
-
|
12466 |
-
|
12467 |
-
|
12468 |
-
|
12469 |
-
|
12470 |
-
|
12471 |
-
|
12472 |
-
|
12473 |
-
|
12474 |
-
|
12475 |
-
|
12476 |
-
|
12477 |
-
|
12478 |
-
|
12479 |
-
|
12480 |
-
|
12481 |
-
|
12482 |
-
|
12483 |
-
|
12484 |
-
|
12485 |
-
|
12486 |
-
|
12487 |
-
|
12488 |
-
|
12489 |
-
|
12490 |
-
|
12491 |
-
|
12492 |
-
|
12493 |
-
|
12494 |
-
|
12495 |
-
|
12496 |
-
|
12497 |
-
|
12498 |
-
|
12499 |
-
|
12500 |
-
|
12501 |
-
|
12502 |
-
|
12503 |
-
|
12504 |
-
|
12505 |
-
|
12506 |
-
|
12507 |
-
|
12508 |
-
|
12509 |
-
|
12510 |
-
|
12511 |
-
|
12512 |
-
|
12513 |
-
|
12514 |
-
|
12515 |
-
|
12516 |
-
|
12517 |
-
|
12518 |
-
|
12519 |
-
|
12520 |
-
|
12521 |
-
|
12522 |
-
|
12523 |
-
|
12524 |
-
|
12525 |
-
|
12526 |
-
|
12527 |
-
|
12528 |
-
|
12529 |
-
|
12530 |
-
|
12531 |
-
|
12532 |
-
|
12533 |
-
|
12534 |
-
|
12535 |
-
|
12536 |
-
|
12537 |
-
|
12538 |
-
|
12539 |
-
|
12540 |
-
|
12541 |
-
|
12542 |
-
|
12543 |
-
|
12544 |
-
|
12545 |
-
|
12546 |
-
|
12547 |
-
|
12548 |
-
|
12549 |
-
|
12550 |
-
|
12551 |
-
|
12552 |
-
|
12553 |
-
|
12554 |
-
|
12555 |
-
|
12556 |
-
|
12557 |
-
|
12558 |
-
|
12559 |
-
|
12560 |
-
|
12561 |
-
|
12562 |
-
|
12563 |
-
|
12564 |
-
|
12565 |
-
|
12566 |
-
|
12567 |
-
|
12568 |
-
|
12569 |
-
|
12570 |
-
|
12571 |
-
|
12572 |
-
|
12573 |
-
|
12574 |
-
|
12575 |
-
|
12576 |
-
|
12577 |
-
|
12578 |
-
|
12579 |
-
|
12580 |
-
|
12581 |
-
|
12582 |
-
|
12583 |
-
|
12584 |
-
|
12585 |
-
|
12586 |
-
|
12587 |
-
|
12588 |
-
|
12589 |
-
|
12590 |
-
|
12591 |
-
|
12592 |
-
|
12593 |
-
|
12594 |
-
|
12595 |
-
|
12596 |
-
|
12597 |
-
|
12598 |
-
|
12599 |
-
|
12600 |
-
|
12601 |
-
|
12602 |
-
|
12603 |
-
|
12604 |
-
|
12605 |
-
|
12606 |
-
|
12607 |
-
|
12608 |
-
|
12609 |
-
|
12610 |
-
|
12611 |
-
|
12612 |
-
|
12613 |
-
|
12614 |
-
|
12615 |
-
|
12616 |
-
|
12617 |
-
|
12618 |
-
|
12619 |
-
|
12620 |
-
|
12621 |
-
|
12622 |
-
|
12623 |
-
|
12624 |
-
|
12625 |
-
|
12626 |
-
|
12627 |
-
|
12628 |
-
|
12629 |
-
|
12630 |
-
|
12631 |
-
|
12632 |
-
|
12633 |
-
|
12634 |
-
|
12635 |
-
|
12636 |
-
|
12637 |
-
|
12638 |
-
|
12639 |
-
|
12640 |
-
|
12641 |
-
|
12642 |
-
|
12643 |
-
|
12644 |
-
|
12645 |
-
|
12646 |
-
|
12647 |
-
|
12648 |
-
|
12649 |
-
|
12650 |
-
|
12651 |
-
|
12652 |
-
|
12653 |
-
|
12654 |
-
|
12655 |
-
|
12656 |
-
|
12657 |
-
|
12658 |
-
|
12659 |
-
|
12660 |
-
|
12661 |
-
|
12662 |
-
|
12663 |
-
|
12664 |
-
|
12665 |
-
|
12666 |
-
|
12667 |
-
|
12668 |
-
|
12669 |
-
|
12670 |
-
|
12671 |
-
|
12672 |
-
|
12673 |
-
|
12674 |
-
|
12675 |
-
|
12676 |
-
|
12677 |
-
|
12678 |
-
|
12679 |
-
|
12680 |
-
|
12681 |
-
|
12682 |
-
|
12683 |
-
*
|
12684 |
-
* @author Vova Feldman (@svovaf)
|
12685 |
-
* @since 1.0.0
|
12686 |
-
*/
|
12687 |
-
function _account_page_render() {
|
12688 |
-
$this->_logger->entrance();
|
12689 |
-
|
12690 |
-
$template = 'account.php';
|
12691 |
-
$vars = array( 'id' => $this->_module_id );
|
12692 |
-
|
12693 |
-
/**
|
12694 |
-
* Added filter to the template to allow developers wrapping the template
|
12695 |
-
* in custom HTML (e.g. within a wizard/tabs).
|
12696 |
-
*
|
12697 |
-
* @author Vova Feldman (@svovaf)
|
12698 |
-
* @since 1.2.1.6
|
12699 |
-
*/
|
12700 |
-
echo $this->apply_filters( "templates/{$template}", fs_get_template( $template, $vars ) );
|
12701 |
-
}
|
12702 |
-
|
12703 |
-
/**
|
12704 |
-
* Render account connect page.
|
12705 |
-
*
|
12706 |
-
* @author Vova Feldman (@svovaf)
|
12707 |
-
* @since 1.0.7
|
12708 |
-
*/
|
12709 |
-
function _connect_page_render() {
|
12710 |
-
$this->_logger->entrance();
|
12711 |
-
|
12712 |
-
$vars = array( 'id' => $this->_module_id );
|
12713 |
-
|
12714 |
-
/**
|
12715 |
-
* Added filter to the template to allow developers wrapping the template
|
12716 |
-
* in custom HTML (e.g. within a wizard/tabs).
|
12717 |
-
*
|
12718 |
-
* @author Vova Feldman (@svovaf)
|
12719 |
-
* @since 1.2.1.6
|
12720 |
-
*/
|
12721 |
-
echo $this->apply_filters( 'templates/connect.php', fs_get_template( 'connect.php', $vars ) );
|
12722 |
-
}
|
12723 |
-
|
12724 |
-
/**
|
12725 |
-
* Load required resources before add-ons page render.
|
12726 |
-
*
|
12727 |
-
* @author Vova Feldman (@svovaf)
|
12728 |
-
* @since 1.0.6
|
12729 |
-
*/
|
12730 |
-
function _addons_page_load() {
|
12731 |
-
$this->_logger->entrance();
|
12732 |
-
|
12733 |
-
fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
|
12734 |
-
|
12735 |
-
wp_enqueue_script( 'plugin-install' );
|
12736 |
-
add_thickbox();
|
12737 |
-
|
12738 |
-
function fs_addons_body_class( $classes ) {
|
12739 |
-
$classes .= ' plugins-php';
|
12740 |
-
|
12741 |
-
return $classes;
|
12742 |
-
}
|
12743 |
-
|
12744 |
-
add_filter( 'admin_body_class', 'fs_addons_body_class' );
|
12745 |
-
|
12746 |
-
if ( ! $this->is_registered() && $this->is_org_repo_compliant() ) {
|
12747 |
-
$this->_admin_notices->add(
|
12748 |
-
sprintf( $this->get_text_inline( 'Just letting you know that the add-ons information of %s is being pulled from an external server.', 'addons-info-external-message' ), '<b>' . $this->get_plugin_name() . '</b>' ),
|
12749 |
-
$this->get_text_x_inline( 'Heads up', 'advance notice of something that will need attention.', 'heads-up' ),
|
12750 |
-
'update-nag'
|
12751 |
-
);
|
12752 |
-
}
|
12753 |
-
}
|
12754 |
-
|
12755 |
-
/**
|
12756 |
-
* Render add-ons page.
|
12757 |
-
*
|
12758 |
-
* @author Vova Feldman (@svovaf)
|
12759 |
-
* @since 1.0.6
|
12760 |
-
*/
|
12761 |
-
function _addons_page_render() {
|
12762 |
-
$this->_logger->entrance();
|
12763 |
-
|
12764 |
-
$vars = array( 'id' => $this->_module_id );
|
12765 |
-
|
12766 |
-
/**
|
12767 |
-
* Added filter to the template to allow developers wrapping the template
|
12768 |
-
* in custom HTML (e.g. within a wizard/tabs).
|
12769 |
-
*
|
12770 |
-
* @author Vova Feldman (@svovaf)
|
12771 |
-
* @since 1.2.1.6
|
12772 |
-
*/
|
12773 |
-
echo $this->apply_filters( 'templates/add-ons.php', fs_get_template( 'add-ons.php', $vars ) );
|
12774 |
-
}
|
12775 |
-
|
12776 |
-
/* Pricing & Upgrade
|
12777 |
-
------------------------------------------------------------------------------------------------------------------*/
|
12778 |
-
/**
|
12779 |
-
* Render pricing page.
|
12780 |
-
*
|
12781 |
-
* @author Vova Feldman (@svovaf)
|
12782 |
-
* @since 1.0.0
|
12783 |
-
*/
|
12784 |
-
function _pricing_page_render() {
|
12785 |
-
$this->_logger->entrance();
|
12786 |
-
|
12787 |
-
$vars = array( 'id' => $this->_module_id );
|
12788 |
-
|
12789 |
-
if ( 'true' === fs_request_get( 'checkout', false ) ) {
|
12790 |
-
fs_require_once_template( 'checkout.php', $vars );
|
12791 |
-
} else {
|
12792 |
-
fs_require_once_template( 'pricing.php', $vars );
|
12793 |
-
}
|
12794 |
-
}
|
12795 |
-
|
12796 |
-
#----------------------------------------------------------------------------------
|
12797 |
-
#region Contact Us
|
12798 |
-
#----------------------------------------------------------------------------------
|
12799 |
-
|
12800 |
-
/**
|
12801 |
-
* Render contact-us page.
|
12802 |
-
*
|
12803 |
-
* @author Vova Feldman (@svovaf)
|
12804 |
-
* @since 1.0.3
|
12805 |
-
*/
|
12806 |
-
function _contact_page_render() {
|
12807 |
-
$this->_logger->entrance();
|
12808 |
-
|
12809 |
-
$vars = array( 'id' => $this->_module_id );
|
12810 |
-
fs_require_once_template( 'contact.php', $vars );
|
12811 |
-
}
|
12812 |
-
|
12813 |
-
#endregion ------------------------------------------------------------------------
|
12814 |
-
|
12815 |
-
/**
|
12816 |
-
* Hide all admin notices to prevent distractions.
|
12817 |
-
*
|
12818 |
-
* @author Vova Feldman (@svovaf)
|
12819 |
-
* @since 1.0.3
|
12820 |
-
*
|
12821 |
-
* @uses remove_all_actions()
|
12822 |
-
*/
|
12823 |
-
private static function _hide_admin_notices() {
|
12824 |
-
remove_all_actions( 'admin_notices' );
|
12825 |
-
remove_all_actions( 'network_admin_notices' );
|
12826 |
-
remove_all_actions( 'all_admin_notices' );
|
12827 |
-
remove_all_actions( 'user_admin_notices' );
|
12828 |
-
}
|
12829 |
-
|
12830 |
-
static function _clean_admin_content_section_hook() {
|
12831 |
-
self::_hide_admin_notices();
|
12832 |
-
|
12833 |
-
// Hide footer.
|
12834 |
-
echo '<style>#wpfooter { display: none !important; }</style>';
|
12835 |
-
}
|
12836 |
-
|
12837 |
-
/**
|
12838 |
-
* Attach to admin_head hook to hide all admin notices.
|
12839 |
-
*
|
12840 |
-
* @author Vova Feldman (@svovaf)
|
12841 |
-
* @since 1.0.3
|
12842 |
-
*/
|
12843 |
-
static function _clean_admin_content_section() {
|
12844 |
-
add_action( 'admin_head', 'Freemius::_clean_admin_content_section_hook' );
|
12845 |
-
}
|
12846 |
-
|
12847 |
-
/* CSS & JavaScript
|
12848 |
-
------------------------------------------------------------------------------------------------------------------*/
|
12849 |
-
/* function _enqueue_script($handle, $src) {
|
12850 |
-
$url = plugins_url( substr( WP_FS__DIR_JS, strlen( $this->_plugin_dir_path ) ) . '/assets/js/' . $src );
|
12851 |
-
|
12852 |
-
$this->_logger->entrance( 'script = ' . $url );
|
12853 |
-
|
12854 |
-
wp_enqueue_script( $handle, $url );
|
12855 |
-
}*/
|
12856 |
-
|
12857 |
-
/* SDK
|
12858 |
-
------------------------------------------------------------------------------------------------------------------*/
|
12859 |
-
private $_user_api;
|
12860 |
-
|
12861 |
-
/**
|
12862 |
-
*
|
12863 |
-
* @author Vova Feldman (@svovaf)
|
12864 |
-
* @since 1.0.2
|
12865 |
-
*
|
12866 |
-
* @param bool $flush
|
12867 |
-
*
|
12868 |
-
* @return FS_Api
|
12869 |
-
*/
|
12870 |
-
function get_api_user_scope( $flush = false ) {
|
12871 |
-
if ( ! isset( $this->_user_api ) || $flush ) {
|
12872 |
-
$this->_user_api = FS_Api::instance(
|
12873 |
-
$this->_module_id,
|
12874 |
-
'user',
|
12875 |
-
$this->_user->id,
|
12876 |
-
$this->_user->public_key,
|
12877 |
-
! $this->is_live(),
|
12878 |
-
$this->_user->secret_key
|
12879 |
-
);
|
12880 |
-
}
|
12881 |
-
|
12882 |
-
return $this->_user_api;
|
12883 |
-
}
|
12884 |
-
|
12885 |
-
private $_site_api;
|
12886 |
-
|
12887 |
-
/**
|
12888 |
-
*
|
12889 |
-
* @author Vova Feldman (@svovaf)
|
12890 |
-
* @since 1.0.2
|
12891 |
-
*
|
12892 |
-
* @param bool $flush
|
12893 |
-
*
|
12894 |
-
* @return FS_Api
|
12895 |
-
*/
|
12896 |
-
function get_api_site_scope( $flush = false ) {
|
12897 |
-
if ( ! isset( $this->_site_api ) || $flush ) {
|
12898 |
-
$this->_site_api = FS_Api::instance(
|
12899 |
-
$this->_module_id,
|
12900 |
-
'install',
|
12901 |
-
$this->_site->id,
|
12902 |
-
$this->_site->public_key,
|
12903 |
-
! $this->is_live(),
|
12904 |
-
$this->_site->secret_key
|
12905 |
-
);
|
12906 |
-
}
|
12907 |
-
|
12908 |
-
return $this->_site_api;
|
12909 |
-
}
|
12910 |
-
|
12911 |
-
private $_plugin_api;
|
12912 |
-
|
12913 |
-
/**
|
12914 |
-
* Get plugin public API scope.
|
12915 |
-
*
|
12916 |
-
* @author Vova Feldman (@svovaf)
|
12917 |
-
* @since 1.0.7
|
12918 |
-
*
|
12919 |
-
* @return FS_Api
|
12920 |
-
*/
|
12921 |
-
function get_api_plugin_scope() {
|
12922 |
-
if ( ! isset( $this->_plugin_api ) ) {
|
12923 |
-
$this->_plugin_api = FS_Api::instance(
|
12924 |
-
$this->_module_id,
|
12925 |
-
'plugin',
|
12926 |
-
$this->_plugin->id,
|
12927 |
-
$this->_plugin->public_key,
|
12928 |
-
! $this->is_live()
|
12929 |
-
);
|
12930 |
-
}
|
12931 |
-
|
12932 |
-
return $this->_plugin_api;
|
12933 |
-
}
|
12934 |
-
|
12935 |
-
/**
|
12936 |
-
* Get site API scope object (fallback to public plugin scope when not registered).
|
12937 |
-
*
|
12938 |
-
* @author Vova Feldman (@svovaf)
|
12939 |
-
* @since 1.0.7
|
12940 |
-
*
|
12941 |
-
* @return FS_Api
|
12942 |
-
*/
|
12943 |
-
function get_api_site_or_plugin_scope() {
|
12944 |
-
return $this->is_registered() ?
|
12945 |
-
$this->get_api_site_scope() :
|
12946 |
-
$this->get_api_plugin_scope();
|
12947 |
-
}
|
12948 |
-
|
12949 |
-
/**
|
12950 |
-
* Show trial promotional notice (if any trial exist).
|
12951 |
-
*
|
12952 |
-
* @author Vova Feldman (@svovaf)
|
12953 |
-
* @since 1.0.9
|
12954 |
-
*
|
12955 |
-
* @param $plans
|
12956 |
-
*/
|
12957 |
-
function _check_for_trial_plans( $plans ) {
|
12958 |
-
$this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
|
12959 |
-
}
|
12960 |
-
|
12961 |
-
/**
|
12962 |
-
* During trial promotion the "upgrade" submenu item turns to
|
12963 |
-
* "start trial" to encourage the trial. Since we want to keep
|
12964 |
-
* the same menu item handler and there's no robust way to
|
12965 |
-
* add new arguments to the menu item link's querystring,
|
12966 |
-
* use JavaScript to find the menu item and update the href of
|
12967 |
-
* the link.
|
12968 |
-
*
|
12969 |
-
* @author Vova Feldman (@svovaf)
|
12970 |
-
* @since 1.2.1.5
|
12971 |
-
*/
|
12972 |
-
function _fix_start_trial_menu_item_url() {
|
12973 |
-
$template_args = array( 'id' => $this->_module_id );
|
12974 |
-
fs_require_template( 'add-trial-to-pricing.php', $template_args );
|
12975 |
-
}
|
12976 |
-
|
12977 |
-
/**
|
12978 |
-
* Check if module is currently in a trial promotion mode.
|
12979 |
-
*
|
12980 |
-
* @author Vova Feldman (@svovaf)
|
12981 |
-
* @since 1.2.2.7
|
12982 |
-
*
|
12983 |
-
* @return bool
|
12984 |
-
*/
|
12985 |
-
function is_in_trial_promotion() {
|
12986 |
-
return $this->_admin_notices->has_sticky( 'trial_promotion' );
|
12987 |
-
}
|
12988 |
-
|
12989 |
-
/**
|
12990 |
-
* Show trial promotional notice (if any trial exist).
|
12991 |
-
*
|
12992 |
-
* @author Vova Feldman (@svovaf)
|
12993 |
-
* @since 1.0.9
|
12994 |
-
*
|
12995 |
-
* @return bool If trial notice added.
|
12996 |
-
*/
|
12997 |
-
function _add_trial_notice() {
|
12998 |
-
if ( ! $this->is_user_admin() ) {
|
12999 |
-
return false;
|
13000 |
-
}
|
13001 |
-
|
13002 |
-
if ( ! $this->is_user_in_admin() ) {
|
13003 |
-
return false;
|
13004 |
-
}
|
13005 |
-
|
13006 |
-
// Check if trial message is already shown.
|
13007 |
-
if ( $this->is_in_trial_promotion() ) {
|
13008 |
-
add_action( 'admin_footer', array( &$this, '_fix_start_trial_menu_item_url' ) );
|
13009 |
-
|
13010 |
-
$this->_menu->add_counter_to_menu_item( 1, 'fs-trial' );
|
13011 |
-
|
13012 |
-
return false;
|
13013 |
-
}
|
13014 |
-
|
13015 |
-
if ( $this->is_premium() && ! WP_FS__DEV_MODE ) {
|
13016 |
-
// Don't show trial if running the premium code, unless running in DEV mode.
|
13017 |
-
return false;
|
13018 |
-
}
|
13019 |
-
|
13020 |
-
if ( ! $this->has_trial_plan() ) {
|
13021 |
-
// No plans with trial.
|
13022 |
-
return false;
|
13023 |
-
}
|
13024 |
-
|
13025 |
-
if ( ! $this->apply_filters( 'show_trial', true ) ) {
|
13026 |
-
// Developer explicitly asked not to show the trial promo.
|
13027 |
-
return false;
|
13028 |
-
}
|
13029 |
-
|
13030 |
-
if ( $this->is_registered() ) {
|
13031 |
-
// Check if trial already utilized.
|
13032 |
-
if ( $this->_site->is_trial_utilized() ) {
|
13033 |
-
return false;
|
13034 |
-
}
|
13035 |
-
|
13036 |
-
if ( $this->is_paying_or_trial() ) {
|
13037 |
-
// Don't show trial if paying or already in trial.
|
13038 |
-
return false;
|
13039 |
-
}
|
13040 |
-
}
|
13041 |
-
|
13042 |
-
if ( $this->is_activation_mode() || $this->is_pending_activation() ) {
|
13043 |
-
// If not yet opted-in/skipped, or pending activation, don't show trial.
|
13044 |
-
return false;
|
13045 |
-
}
|
13046 |
-
|
13047 |
-
$last_time_trial_promotion_shown = $this->_storage->get( 'trial_promotion_shown', false );
|
13048 |
-
$was_promotion_shown_before = ( false !== $last_time_trial_promotion_shown );
|
13049 |
-
|
13050 |
-
// Show promotion if never shown before and 24 hours after initial activation with FS.
|
13051 |
-
if ( ! $was_promotion_shown_before &&
|
13052 |
-
$this->_storage->install_timestamp > ( time() - WP_FS__TIME_24_HOURS_IN_SEC )
|
13053 |
-
) {
|
13054 |
-
return false;
|
13055 |
-
}
|
13056 |
-
|
13057 |
-
// OR if promotion was shown before, try showing it every 30 days.
|
13058 |
-
if ( $was_promotion_shown_before &&
|
13059 |
-
30 * WP_FS__TIME_24_HOURS_IN_SEC > time() - $last_time_trial_promotion_shown
|
13060 |
-
) {
|
13061 |
-
return false;
|
13062 |
-
}
|
13063 |
-
|
13064 |
-
$trial_period = $this->_trial_days;
|
13065 |
-
$require_payment = $this->_is_trial_require_payment;
|
13066 |
-
$trial_url = $this->get_trial_url();
|
13067 |
-
$plans_string = strtolower( $this->get_text_inline( 'Awesome', 'awesome' ) );
|
13068 |
-
|
13069 |
-
if ( $this->is_registered() ) {
|
13070 |
-
// If opted-in, override trial with up to date data from API.
|
13071 |
-
$trial_plans = FS_Plan_Manager::instance()->get_trial_plans( $this->_plans );
|
13072 |
-
$trial_plans_count = count( $trial_plans );
|
13073 |
-
|
13074 |
-
if ( 0 === $trial_plans_count ) {
|
13075 |
-
// If there's no plans with a trial just exit.
|
13076 |
-
return false;
|
13077 |
-
}
|
13078 |
-
|
13079 |
-
/**
|
13080 |
-
* @var FS_Plugin_Plan $paid_plan
|
13081 |
-
*/
|
13082 |
-
$paid_plan = $trial_plans[0];
|
13083 |
-
$require_payment = $paid_plan->is_require_subscription;
|
13084 |
-
$trial_period = $paid_plan->trial_period;
|
13085 |
-
|
13086 |
-
$total_paid_plans = count( $this->_plans ) - ( FS_Plan_Manager::instance()->has_free_plan( $this->_plans ) ? 1 : 0 );
|
13087 |
-
|
13088 |
-
if ( $total_paid_plans !== $trial_plans_count ) {
|
13089 |
-
// Not all paid plans have a trial - generate a string of those that have it.
|
13090 |
-
for ( $i = 0; $i < $trial_plans_count; $i ++ ) {
|
13091 |
-
$plans_string .= sprintf(
|
13092 |
-
' <a href="%s">%s</a>',
|
13093 |
-
$trial_url,
|
13094 |
-
$trial_plans[ $i ]->title
|
13095 |
-
);
|
13096 |
-
|
13097 |
-
if ( $i < $trial_plans_count - 2 ) {
|
13098 |
-
$plans_string .= ', ';
|
13099 |
-
} else if ( $i == $trial_plans_count - 2 ) {
|
13100 |
-
$plans_string .= ' and ';
|
13101 |
-
}
|
13102 |
-
}
|
13103 |
-
}
|
13104 |
-
}
|
13105 |
-
|
13106 |
-
$message = sprintf(
|
13107 |
-
$this->get_text_x_inline( 'Hey', 'exclamation', 'hey' ) . '! ' . $this->get_text_inline( 'How do you like %s so far? Test all our %s premium features with a %d-day free trial.', 'trial-x-promotion-message' ),
|
13108 |
-
sprintf( '<b>%s</b>', $this->get_plugin_name() ),
|
13109 |
-
$plans_string,
|
13110 |
-
$trial_period
|
13111 |
-
);
|
13112 |
-
|
13113 |
-
// "No Credit-Card Required" or "No Commitment for N Days".
|
13114 |
-
$cc_string = $require_payment ?
|
13115 |
-
sprintf( $this->get_text_inline( 'No commitment for %s days - cancel anytime!', 'no-commitment-for-x-days' ), $trial_period ) :
|
13116 |
-
$this->get_text_inline( 'No credit card required', 'no-cc-required' ) . '!';
|
13117 |
-
|
13118 |
-
|
13119 |
-
// Start trial button.
|
13120 |
-
$button = ' ' . sprintf(
|
13121 |
-
'<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s ➜</button></a>',
|
13122 |
-
$trial_url,
|
13123 |
-
$this->get_text_x_inline( 'Start free trial', 'call to action', 'start-free-trial' )
|
13124 |
-
);
|
13125 |
-
|
13126 |
-
$this->_admin_notices->add_sticky(
|
13127 |
-
$this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
|
13128 |
-
'trial_promotion',
|
13129 |
-
'',
|
13130 |
-
'promotion'
|
13131 |
-
);
|
13132 |
-
|
13133 |
-
$this->_storage->trial_promotion_shown = WP_FS__SCRIPT_START_TIME;
|
13134 |
-
|
13135 |
-
return true;
|
13136 |
-
}
|
13137 |
-
|
13138 |
-
/**
|
13139 |
-
* Lets users/customers know that the product has an affiliate program.
|
13140 |
-
*
|
13141 |
-
* @author Leo Fajardo (@leorw)
|
13142 |
-
* @since 1.2.2.11
|
13143 |
-
*
|
13144 |
-
* @return bool Returns true if the notice has been added.
|
13145 |
-
*/
|
13146 |
-
function _add_affiliate_program_notice() {
|
13147 |
-
if ( ! $this->is_user_admin() ) {
|
13148 |
-
return false;
|
13149 |
-
}
|
13150 |
-
|
13151 |
-
if ( ! $this->is_user_in_admin() ) {
|
13152 |
-
return false;
|
13153 |
-
}
|
13154 |
-
|
13155 |
-
// Check if the notice is already shown.
|
13156 |
-
if ( $this->_admin_notices->has_sticky( 'affiliate_program' ) ) {
|
13157 |
-
return false;
|
13158 |
-
}
|
13159 |
-
|
13160 |
-
if (
|
13161 |
-
// Product has no affiliate program.
|
13162 |
-
! $this->has_affiliate_program() ||
|
13163 |
-
// User is already an affiliate.
|
13164 |
-
is_object( $this->affiliate ) ||
|
13165 |
-
// User has applied for an affiliate account.
|
13166 |
-
! empty( $this->_storage->affiliate_application_data ) ) {
|
13167 |
-
return false;
|
13168 |
-
}
|
13169 |
-
|
13170 |
-
if ( ! $this->apply_filters( 'show_affiliate_program_notice', true ) ) {
|
13171 |
-
// Developer explicitly asked not to show the notice about the affiliate program.
|
13172 |
-
return false;
|
13173 |
-
}
|
13174 |
-
|
13175 |
-
if ( $this->is_activation_mode() || $this->is_pending_activation() ) {
|
13176 |
-
// If not yet opted in/skipped, or pending activation, don't show the notice.
|
13177 |
-
return false;
|
13178 |
-
}
|
13179 |
-
|
13180 |
-
$last_time_notice_was_shown = $this->_storage->get( 'affiliate_program_notice_shown', false );
|
13181 |
-
$was_notice_shown_before = ( false !== $last_time_notice_was_shown );
|
13182 |
-
|
13183 |
-
/**
|
13184 |
-
* Do not show the notice if it was already shown before or less than 30 days have passed since the initial
|
13185 |
-
* activation with FS.
|
13186 |
-
*/
|
13187 |
-
if ( $was_notice_shown_before ||
|
13188 |
-
$this->_storage->install_timestamp > ( time() - ( WP_FS__TIME_24_HOURS_IN_SEC * 30 ) )
|
13189 |
-
) {
|
13190 |
-
return false;
|
13191 |
-
}
|
13192 |
-
|
13193 |
-
if ( ! $this->is_paying() &&
|
13194 |
-
FS_Plugin::AFFILIATE_MODERATION_CUSTOMERS == $this->_plugin->affiliate_moderation ) {
|
13195 |
-
// If the user is not a customer and the affiliate program is only for customers, don't show the notice.
|
13196 |
-
return false;
|
13197 |
-
}
|
13198 |
-
|
13199 |
-
$message = sprintf(
|
13200 |
-
$this->get_text_inline( 'Hey there, did you know that %s has an affiliate program? If you like the %s you can become our ambassador and earn some cash!', 'become-an-ambassador-admin-notice' ),
|
13201 |
-
sprintf( '<strong>%s</strong>', $this->get_plugin_name() ),
|
13202 |
-
$this->get_module_label( true )
|
13203 |
-
);
|
13204 |
-
|
13205 |
-
// HTML code for the "Learn more..." button.
|
13206 |
-
$button = ' ' . sprintf(
|
13207 |
-
'<a style="display: block; margin-top: 10px;" href="%s"><button class="button button-primary">%s ➜</button></a>',
|
13208 |
-
$this->_get_admin_page_url( 'affiliation' ),
|
13209 |
-
$this->get_text_inline( 'Learn more', 'learn-more' ) . '...'
|
13210 |
-
);
|
13211 |
-
|
13212 |
-
$this->_admin_notices->add_sticky(
|
13213 |
-
$this->apply_filters( 'affiliate_program_notice', "{$message} {$button}" ),
|
13214 |
-
'affiliate_program',
|
13215 |
-
'',
|
13216 |
-
'promotion'
|
13217 |
-
);
|
13218 |
-
|
13219 |
-
$this->_storage->affiliate_program_notice_shown = WP_FS__SCRIPT_START_TIME;
|
13220 |
-
|
13221 |
-
return true;
|
13222 |
-
}
|
13223 |
-
|
13224 |
-
/**
|
13225 |
-
* @author Vova Feldman (@svovaf)
|
13226 |
-
* @since 1.2.1.5
|
13227 |
-
*/
|
13228 |
-
function _enqueue_common_css() {
|
13229 |
-
if ( $this->has_paid_plan() && ! $this->is_paying() ) {
|
13230 |
-
// Add basic CSS for admin-notices and menu-item colors.
|
13231 |
-
fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
|
13232 |
-
}
|
13233 |
-
}
|
13234 |
-
|
13235 |
-
/**
|
13236 |
-
* @author Leo Fajardo (leorw)
|
13237 |
-
* @since 1.2.2
|
13238 |
-
*/
|
13239 |
-
function _show_theme_activation_optin_dialog() {
|
13240 |
-
fs_enqueue_local_style( 'fs_connect', '/admin/connect.css' );
|
13241 |
-
|
13242 |
-
add_action( 'admin_footer-themes.php', array( &$this, '_add_fs_theme_activation_dialog' ) );
|
13243 |
-
}
|
13244 |
-
|
13245 |
-
/**
|
13246 |
-
* @author Leo Fajardo (leorw)
|
13247 |
-
* @since 1.2.2
|
13248 |
-
*/
|
13249 |
-
function _add_fs_theme_activation_dialog() {
|
13250 |
-
$vars = array( 'id' => $this->_module_id );
|
13251 |
-
fs_require_once_template( 'connect.php', $vars );
|
13252 |
-
}
|
13253 |
-
|
13254 |
-
/* Action Links
|
13255 |
-
------------------------------------------------------------------------------------------------------------------*/
|
13256 |
-
private $_action_links_hooked = false;
|
13257 |
-
private $_action_links = array();
|
13258 |
-
|
13259 |
-
/**
|
13260 |
-
* Hook to plugin action links filter.
|
13261 |
-
*
|
13262 |
-
* @author Vova Feldman (@svovaf)
|
13263 |
-
* @since 1.0.0
|
13264 |
-
*/
|
13265 |
-
private function hook_plugin_action_links() {
|
13266 |
-
$this->_logger->entrance();
|
13267 |
-
|
13268 |
-
$this->_action_links_hooked = true;
|
13269 |
-
|
13270 |
-
$this->_logger->log( 'Adding action links hooks.' );
|
13271 |
-
|
13272 |
-
// Add action link to settings page.
|
13273 |
-
add_filter( 'plugin_action_links_' . $this->_plugin_basename, array(
|
13274 |
-
&$this,
|
13275 |
-
'_modify_plugin_action_links_hook'
|
13276 |
-
), WP_FS__DEFAULT_PRIORITY, 2 );
|
13277 |
-
add_filter( 'network_admin_plugin_action_links_' . $this->_plugin_basename, array(
|
13278 |
-
&$this,
|
13279 |
-
'_modify_plugin_action_links_hook'
|
13280 |
-
), WP_FS__DEFAULT_PRIORITY, 2 );
|
13281 |
-
}
|
13282 |
-
|
13283 |
-
/**
|
13284 |
-
* Add plugin action link.
|
13285 |
-
*
|
13286 |
-
* @author Vova Feldman (@svovaf)
|
13287 |
-
* @since 1.0.0
|
13288 |
-
*
|
13289 |
-
* @param $label
|
13290 |
-
* @param $url
|
13291 |
-
* @param bool $external
|
13292 |
-
* @param int $priority
|
13293 |
-
* @param bool $key
|
13294 |
-
*/
|
13295 |
-
function add_plugin_action_link( $label, $url, $external = false, $priority = WP_FS__DEFAULT_PRIORITY, $key = false ) {
|
13296 |
-
$this->_logger->entrance();
|
13297 |
-
|
13298 |
-
if ( ! isset( $this->_action_links[ $priority ] ) ) {
|
13299 |
-
$this->_action_links[ $priority ] = array();
|
13300 |
-
}
|
13301 |
-
|
13302 |
-
if ( false === $key ) {
|
13303 |
-
$key = preg_replace( "/[^A-Za-z0-9 ]/", '', strtolower( $label ) );
|
13304 |
-
}
|
13305 |
-
|
13306 |
-
$this->_action_links[ $priority ][] = array(
|
13307 |
-
'label' => $label,
|
13308 |
-
'href' => $url,
|
13309 |
-
'key' => $key,
|
13310 |
-
'external' => $external
|
13311 |
-
);
|
13312 |
-
}
|
13313 |
-
|
13314 |
-
/**
|
13315 |
-
* Adds Upgrade and Add-Ons links to the main Plugins page link actions collection.
|
13316 |
-
*
|
13317 |
-
* @author Vova Feldman (@svovaf)
|
13318 |
-
* @since 1.0.0
|
13319 |
-
*/
|
13320 |
-
function _add_upgrade_action_link() {
|
13321 |
-
$this->_logger->entrance();
|
13322 |
-
|
13323 |
-
if ( $this->is_registered() ) {
|
13324 |
-
if ( ! $this->is_paying() && $this->has_paid_plan() ) {
|
13325 |
-
$this->add_plugin_action_link(
|
13326 |
-
$this->get_text_inline( 'Upgrade', 'upgrade' ),
|
13327 |
-
$this->get_upgrade_url(),
|
13328 |
-
false,
|
13329 |
-
7,
|
13330 |
-
'upgrade'
|
13331 |
-
);
|
13332 |
-
}
|
13333 |
-
|
13334 |
-
if ( $this->has_addons() ) {
|
13335 |
-
$this->add_plugin_action_link(
|
13336 |
-
$this->get_text_inline( 'Add-Ons', 'add-ons' ),
|
13337 |
-
$this->_get_admin_page_url( 'addons' ),
|
13338 |
-
false,
|
13339 |
-
9,
|
13340 |
-
'addons'
|
13341 |
-
);
|
13342 |
-
}
|
13343 |
-
}
|
13344 |
-
}
|
13345 |
-
|
13346 |
-
/**
|
13347 |
-
* Adds "Activate License" or "Change License" link to the main Plugins page link actions collection.
|
13348 |
-
*
|
13349 |
-
* @author Leo Fajardo (@leorw)
|
13350 |
-
* @since 1.1.9
|
13351 |
-
*/
|
13352 |
-
function _add_license_action_link() {
|
13353 |
-
$this->_logger->entrance();
|
13354 |
-
|
13355 |
-
if ( $this->is_free_plan() && $this->is_addon() ) {
|
13356 |
-
return;
|
13357 |
-
}
|
13358 |
-
|
13359 |
-
if ( ! self::is_ajax() ) {
|
13360 |
-
// Inject license activation dialog UI and client side code.
|
13361 |
-
add_action( 'admin_footer', array( &$this, '_add_license_activation_dialog_box' ) );
|
13362 |
-
}
|
13363 |
-
|
13364 |
-
$link_text = $this->is_free_plan() ?
|
13365 |
-
$this->get_text_inline( 'Activate License', 'activate-license' ) :
|
13366 |
-
$this->get_text_inline( 'Change License', 'change-license' );
|
13367 |
-
|
13368 |
-
$this->add_plugin_action_link(
|
13369 |
-
$link_text,
|
13370 |
-
'#',
|
13371 |
-
false,
|
13372 |
-
11,
|
13373 |
-
( 'activate-license ' . $this->get_unique_affix() )
|
13374 |
-
);
|
13375 |
-
}
|
13376 |
-
|
13377 |
-
/**
|
13378 |
-
* Adds "Opt in" or "Opt out" link to the main "Plugins" page link actions collection.
|
13379 |
-
*
|
13380 |
-
* @author Leo Fajardo (@leorw)
|
13381 |
-
* @since 1.2.1.5
|
13382 |
-
*/
|
13383 |
-
function _add_tracking_links() {
|
13384 |
-
if ( ! current_user_can( 'activate_plugins' ) ) {
|
13385 |
-
return;
|
13386 |
-
}
|
13387 |
-
|
13388 |
-
$this->_logger->entrance();
|
13389 |
-
|
13390 |
-
if ( fs_request_is_action_secure( $this->get_unique_affix() . '_reconnect' ) ) {
|
13391 |
-
if ( ! $this->is_registered() && $this->is_anonymous() ) {
|
13392 |
-
$this->connect_again();
|
13393 |
-
|
13394 |
-
return;
|
13395 |
-
}
|
13396 |
-
}
|
13397 |
-
|
13398 |
-
if ( ( $this->is_plugin() && ! self::is_plugins_page() ) ||
|
13399 |
-
( $this->is_theme() && ! self::is_themes_page() )
|
13400 |
-
) {
|
13401 |
-
// Only show tracking links on the plugins and themes pages.
|
13402 |
-
return;
|
13403 |
-
}
|
13404 |
-
|
13405 |
-
if ( ! $this->is_enable_anonymous() ) {
|
13406 |
-
// Don't allow to opt-out if anonymous mode is disabled.
|
13407 |
-
return;
|
13408 |
-
}
|
13409 |
-
|
13410 |
-
if ( ! $this->is_free_plan() ) {
|
13411 |
-
// Don't allow to opt-out if running in paid plan.
|
13412 |
-
return;
|
13413 |
-
}
|
13414 |
-
|
13415 |
-
if ( $this->add_ajax_action( 'stop_tracking', array( &$this, '_stop_tracking_callback' ) ) ) {
|
13416 |
-
return;
|
13417 |
-
}
|
13418 |
-
|
13419 |
-
if ( $this->add_ajax_action( 'allow_tracking', array( &$this, '_allow_tracking_callback' ) ) ) {
|
13420 |
-
return;
|
13421 |
-
}
|
13422 |
-
|
13423 |
-
$url = '#';
|
13424 |
-
|
13425 |
-
if ( $this->is_registered() ) {
|
13426 |
-
if ( $this->is_tracking_allowed() ) {
|
13427 |
-
$link_text_id = $this->get_text_inline( 'Opt Out', 'opt-out' );
|
13428 |
-
} else {
|
13429 |
-
$link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );
|
13430 |
-
}
|
13431 |
-
|
13432 |
-
add_action( 'admin_footer', array( &$this, '_add_optout_dialog' ) );
|
13433 |
-
} else {
|
13434 |
-
$link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );
|
13435 |
-
|
13436 |
-
$params = ! $this->is_anonymous() ?
|
13437 |
-
array() :
|
13438 |
-
array(
|
13439 |
-
'nonce' => wp_create_nonce( $this->get_unique_affix() . '_reconnect' ),
|
13440 |
-
'fs_action' => ( $this->get_unique_affix() . '_reconnect' ),
|
13441 |
-
);
|
13442 |
-
|
13443 |
-
$url = $this->get_activation_url( $params );
|
13444 |
-
}
|
13445 |
-
|
13446 |
-
if ( $this->is_plugin() && self::is_plugins_page() ) {
|
13447 |
-
$this->add_plugin_action_link(
|
13448 |
-
$link_text_id,
|
13449 |
-
$url,
|
13450 |
-
false,
|
13451 |
-
13,
|
13452 |
-
"opt-in-or-opt-out {$this->_slug}"
|
13453 |
-
);
|
13454 |
-
}
|
13455 |
-
}
|
13456 |
-
|
13457 |
-
/**
|
13458 |
-
* Get the URL of the page that should be loaded right after the plugin activation.
|
13459 |
-
*
|
13460 |
-
* @author Vova Feldman (@svovaf)
|
13461 |
-
* @since 1.1.7.4
|
13462 |
-
*
|
13463 |
-
* @return string
|
13464 |
-
*/
|
13465 |
-
function get_after_plugin_activation_redirect_url() {
|
13466 |
-
$url = false;
|
13467 |
-
|
13468 |
-
if ( ! $this->is_addon() || ! $this->has_free_plan() ) {
|
13469 |
-
$first_time_path = $this->_menu->get_first_time_path();
|
13470 |
-
$url = $this->is_activation_mode() ?
|
13471 |
-
$this->get_activation_url() :
|
13472 |
-
( empty( $first_time_path ) ?
|
13473 |
-
$this->_get_admin_page_url() :
|
13474 |
-
$first_time_path );
|
13475 |
-
} else {
|
13476 |
-
$plugin_fs = false;
|
13477 |
-
|
13478 |
-
if ( $this->is_parent_plugin_installed() ) {
|
13479 |
-
$plugin_fs = self::get_parent_instance();
|
13480 |
-
}
|
13481 |
-
|
13482 |
-
if ( is_object( $plugin_fs ) ) {
|
13483 |
-
if ( ! $plugin_fs->is_registered() ) {
|
13484 |
-
// Forward to parent plugin connect when parent not registered.
|
13485 |
-
$url = $plugin_fs->get_activation_url();
|
13486 |
-
} else {
|
13487 |
-
// Forward to account page.
|
13488 |
-
$url = $plugin_fs->_get_admin_page_url( 'account' );
|
13489 |
-
}
|
13490 |
-
}
|
13491 |
-
}
|
13492 |
-
|
13493 |
-
return $url;
|
13494 |
-
}
|
13495 |
-
|
13496 |
-
/**
|
13497 |
-
* Forward page to activation page.
|
13498 |
-
*
|
13499 |
-
* @author Vova Feldman (@svovaf)
|
13500 |
-
* @since 1.0.3
|
13501 |
-
*/
|
13502 |
-
function _redirect_on_activation_hook() {
|
13503 |
-
$url = $this->get_after_plugin_activation_redirect_url();
|
13504 |
-
|
13505 |
-
if ( is_string( $url ) ) {
|
13506 |
-
fs_redirect( $url );
|
13507 |
-
}
|
13508 |
-
}
|
13509 |
-
|
13510 |
-
/**
|
13511 |
-
* Modify plugin's page action links collection.
|
13512 |
-
*
|
13513 |
-
* @author Vova Feldman (@svovaf)
|
13514 |
-
* @since 1.0.0
|
13515 |
-
*
|
13516 |
-
* @param array $links
|
13517 |
-
* @param $file
|
13518 |
-
*
|
13519 |
-
* @return array
|
13520 |
-
*/
|
13521 |
-
function _modify_plugin_action_links_hook( $links, $file ) {
|
13522 |
-
$this->_logger->entrance();
|
13523 |
-
|
13524 |
-
$passed_deactivate = false;
|
13525 |
-
$deactivate_link = '';
|
13526 |
-
$before_deactivate = array();
|
13527 |
-
$after_deactivate = array();
|
13528 |
-
foreach ( $links as $key => $link ) {
|
13529 |
-
if ( 'deactivate' === $key ) {
|
13530 |
-
$deactivate_link = $link;
|
13531 |
-
$passed_deactivate = true;
|
13532 |
-
continue;
|
13533 |
-
}
|
13534 |
-
|
13535 |
-
if ( ! $passed_deactivate ) {
|
13536 |
-
$before_deactivate[ $key ] = $link;
|
13537 |
-
} else {
|
13538 |
-
$after_deactivate[ $key ] = $link;
|
13539 |
-
}
|
13540 |
-
}
|
13541 |
-
|
13542 |
-
ksort( $this->_action_links );
|
13543 |
-
|
13544 |
-
foreach ( $this->_action_links as $new_links ) {
|
13545 |
-
foreach ( $new_links as $link ) {
|
13546 |
-
$before_deactivate[ $link['key'] ] = '<a href="' . $link['href'] . '"' . ( $link['external'] ? ' target="_blank"' : '' ) . '>' . $link['label'] . '</a>';
|
13547 |
-
}
|
13548 |
-
}
|
13549 |
-
|
13550 |
-
if ( ! empty( $deactivate_link ) ) {
|
13551 |
-
/**
|
13552 |
-
* This HTML element is used to identify the correct plugin when attaching an event to its Deactivate link.
|
13553 |
-
*
|
13554 |
-
* @since 1.2.1.6 Always show the deactivation feedback form since we added automatic free version deactivation upon premium code activation.
|
13555 |
-
*/
|
13556 |
-
$deactivate_link .= '<i class="fs-module-id" data-module-id="' . $this->_module_id . '"></i>';
|
13557 |
-
|
13558 |
-
// Append deactivation link.
|
13559 |
-
$before_deactivate['deactivate'] = $deactivate_link;
|
13560 |
-
}
|
13561 |
-
|
13562 |
-
return array_merge( $before_deactivate, $after_deactivate );
|
13563 |
-
}
|
13564 |
-
|
13565 |
-
/**
|
13566 |
-
* Adds admin message.
|
13567 |
-
*
|
13568 |
-
* @author Vova Feldman (@svovaf)
|
13569 |
-
* @since 1.0.4
|
13570 |
-
*
|
13571 |
-
* @param string $message
|
13572 |
-
* @param string $title
|
13573 |
-
* @param string $type
|
13574 |
-
*/
|
13575 |
-
function add_admin_message( $message, $title = '', $type = 'success' ) {
|
13576 |
-
$this->_admin_notices->add( $message, $title, $type );
|
13577 |
-
}
|
13578 |
-
|
13579 |
-
/**
|
13580 |
-
* Adds sticky admin message.
|
13581 |
-
*
|
13582 |
-
* @author Vova Feldman (@svovaf)
|
13583 |
-
* @since 1.1.0
|
13584 |
-
*
|
13585 |
-
* @param string $message
|
13586 |
-
* @param string $id
|
13587 |
-
* @param string $title
|
13588 |
-
* @param string $type
|
13589 |
-
*/
|
13590 |
-
function add_sticky_admin_message( $message, $id, $title = '', $type = 'success' ) {
|
13591 |
-
$this->_admin_notices->add_sticky( $message, $id, $title, $type );
|
13592 |
-
}
|
13593 |
-
|
13594 |
-
/**
|
13595 |
-
* Helper function that returns the final steps for the upgrade completion.
|
13596 |
-
*
|
13597 |
-
* If the module is already running the premium code, returns an empty string.
|
13598 |
-
*
|
13599 |
-
* @author Vova Feldman (@svovaf)
|
13600 |
-
* @since 1.2.1
|
13601 |
-
*
|
13602 |
-
* @param string $plan_title
|
13603 |
-
*
|
13604 |
-
* @return string
|
13605 |
-
*/
|
13606 |
-
private function get_complete_upgrade_instructions( $plan_title = '' ) {
|
13607 |
-
if ( ! $this->has_premium_version() || $this->is_premium() ) {
|
13608 |
-
return '';
|
13609 |
-
}
|
13610 |
-
|
13611 |
-
if ( empty( $plan_title ) ) {
|
13612 |
-
$plan_title = $this->_site->plan->title;
|
13613 |
-
}
|
13614 |
-
|
13615 |
-
// @since 1.2.1.5 The free version is auto deactivated.
|
13616 |
-
$deactivation_step = version_compare( $this->version, '1.2.1.5', '<' ) ?
|
13617 |
-
( '<li>' . $this->esc_html_inline( 'Deactivate the free version', 'deactivate-free-version' ) . '.</li>' ) :
|
13618 |
-
'';
|
13619 |
-
|
13620 |
-
return sprintf(
|
13621 |
-
' %s: <ol><li>%s.</li>%s<li>%s (<a href="%s" target="_blank">%s</a>).</li></ol>',
|
13622 |
-
$this->get_text_inline( 'Please follow these steps to complete the upgrade', 'follow-steps-to-complete-upgrade' ),
|
13623 |
-
$this->get_latest_download_link( sprintf(
|
13624 |
-
/* translators: %s: Plan title */
|
13625 |
-
$this->get_text_inline( 'Download the latest %s version', 'download-latest-x-version' ),
|
13626 |
-
$plan_title
|
13627 |
-
) ),
|
13628 |
-
$deactivation_step,
|
13629 |
-
$this->get_text_inline( 'Upload and activate the downloaded version', 'upload-and-activate' ),
|
13630 |
-
'//bit.ly/upload-wp-' . $this->_module_type . 's',
|
13631 |
-
$this->get_text_inline( 'How to upload and activate?', 'howto-upload-activate' )
|
13632 |
-
);
|
13633 |
-
}
|
13634 |
-
|
13635 |
-
/**
|
13636 |
-
* @author Vova Feldman (@svovaf)
|
13637 |
-
* @since 1.2.1.7
|
13638 |
-
*
|
13639 |
-
* @param string $key
|
13640 |
-
*
|
13641 |
-
* @return string
|
13642 |
-
*/
|
13643 |
-
function get_text( $key ) {
|
13644 |
-
return fs_text( $key, $this->_slug );
|
13645 |
-
}
|
13646 |
-
|
13647 |
-
/**
|
13648 |
-
* @author Vova Feldman (@svovaf)
|
13649 |
-
* @since 1.2.3
|
13650 |
-
*
|
13651 |
-
* @param string $text Translatable string.
|
13652 |
-
* @param string $key String key for overrides.
|
13653 |
-
*
|
13654 |
-
* @return string
|
13655 |
-
*/
|
13656 |
-
function get_text_inline( $text, $key = '' ) {
|
13657 |
-
return _fs_text_inline( $text, $key, $this->_slug );
|
13658 |
-
}
|
13659 |
-
|
13660 |
-
/**
|
13661 |
-
* @author Vova Feldman (@svovaf)
|
13662 |
-
* @since 1.2.3
|
13663 |
-
*
|
13664 |
-
* @param string $text Translatable string.
|
13665 |
-
* @param string $context Context information for the translators.
|
13666 |
-
* @param string $key String key for overrides.
|
13667 |
-
*
|
13668 |
-
* @return string
|
13669 |
-
*/
|
13670 |
-
function get_text_x_inline( $text, $context, $key ) {
|
13671 |
-
return _fs_text_x_inline( $text, $context, $key, $this->_slug );
|
13672 |
-
}
|
13673 |
-
|
13674 |
-
/**
|
13675 |
-
* @author Vova Feldman (@svovaf)
|
13676 |
-
* @since 1.2.3
|
13677 |
-
*
|
13678 |
-
* @param string $text Translatable string.
|
13679 |
-
* @param string $key String key for overrides.
|
13680 |
-
*
|
13681 |
-
* @return string
|
13682 |
-
*/
|
13683 |
-
function esc_html_inline( $text, $key ) {
|
13684 |
-
return esc_html( _fs_text_inline( $text, $key, $this->_slug ) );
|
13685 |
-
}
|
13686 |
-
|
13687 |
-
#----------------------------------------------------------------------------------
|
13688 |
-
#region Versioning
|
13689 |
-
#----------------------------------------------------------------------------------
|
13690 |
-
|
13691 |
-
/**
|
13692 |
-
* Check if Freemius in SDK upgrade mode.
|
13693 |
-
*
|
13694 |
-
* @author Vova Feldman (@svovaf)
|
13695 |
-
* @since 1.0.9
|
13696 |
-
*
|
13697 |
-
* @return bool
|
13698 |
-
*/
|
13699 |
-
function is_sdk_upgrade_mode() {
|
13700 |
-
return isset( $this->_storage->sdk_upgrade_mode ) ?
|
13701 |
-
$this->_storage->sdk_upgrade_mode :
|
13702 |
-
false;
|
13703 |
-
}
|
13704 |
-
|
13705 |
-
/**
|
13706 |
-
* Turn SDK upgrade mode off.
|
13707 |
-
*
|
13708 |
-
* @author Vova Feldman (@svovaf)
|
13709 |
-
* @since 1.0.9
|
13710 |
-
*/
|
13711 |
-
function set_sdk_upgrade_complete() {
|
13712 |
-
$this->_storage->sdk_upgrade_mode = false;
|
13713 |
-
}
|
13714 |
-
|
13715 |
-
/**
|
13716 |
-
* Check if plugin upgrade mode.
|
13717 |
-
*
|
13718 |
-
* @author Vova Feldman (@svovaf)
|
13719 |
-
* @since 1.0.9
|
13720 |
-
*
|
13721 |
-
* @return bool
|
13722 |
-
*/
|
13723 |
-
function is_plugin_upgrade_mode() {
|
13724 |
-
return isset( $this->_storage->plugin_upgrade_mode ) ?
|
13725 |
-
$this->_storage->plugin_upgrade_mode :
|
13726 |
-
false;
|
13727 |
-
}
|
13728 |
-
|
13729 |
-
/**
|
13730 |
-
* Turn plugin upgrade mode off.
|
13731 |
-
*
|
13732 |
-
* @author Vova Feldman (@svovaf)
|
13733 |
-
* @since 1.0.9
|
13734 |
-
*/
|
13735 |
-
function set_plugin_upgrade_complete() {
|
13736 |
-
$this->_storage->plugin_upgrade_mode = false;
|
13737 |
-
}
|
13738 |
-
|
13739 |
-
#endregion
|
13740 |
-
|
13741 |
-
#----------------------------------------------------------------------------------
|
13742 |
-
#region Permissions
|
13743 |
-
#----------------------------------------------------------------------------------
|
13744 |
-
|
13745 |
-
/**
|
13746 |
-
* Check if specific permission requested.
|
13747 |
-
*
|
13748 |
-
* @author Vova Feldman (@svovaf)
|
13749 |
-
* @since 1.1.6
|
13750 |
-
*
|
13751 |
-
* @param string $permission
|
13752 |
-
*
|
13753 |
-
* @return bool
|
13754 |
-
*/
|
13755 |
-
function is_permission_requested( $permission ) {
|
13756 |
-
return isset( $this->_permissions[ $permission ] ) && ( true === $this->_permissions[ $permission ] );
|
13757 |
-
}
|
13758 |
-
|
13759 |
-
#endregion
|
13760 |
-
|
13761 |
-
#----------------------------------------------------------------------------------
|
13762 |
-
#region Auto Activation
|
13763 |
-
#----------------------------------------------------------------------------------
|
13764 |
-
|
13765 |
-
/**
|
13766 |
-
* Hints the SDK if running an auto-installation.
|
13767 |
-
*
|
13768 |
-
* @var bool
|
13769 |
-
*/
|
13770 |
-
private $_isAutoInstall = false;
|
13771 |
-
|
13772 |
-
/**
|
13773 |
-
* After upgrade callback to install and auto activate a plugin.
|
13774 |
-
* This code will only be executed on explicit request from the user,
|
13775 |
-
* following the practice Jetpack are using with their theme installations.
|
13776 |
-
*
|
13777 |
-
* @link https://make.wordpress.org/plugins/2017/03/16/clarification-of-guideline-8-executable-code-and-installs/
|
13778 |
-
*
|
13779 |
-
* @author Vova Feldman (@svovaf)
|
13780 |
-
* @since 1.2.1.7
|
13781 |
-
*/
|
13782 |
-
function _install_premium_version_ajax_action() {
|
13783 |
-
$this->_logger->entrance();
|
13784 |
-
|
13785 |
-
$this->check_ajax_referer( 'install_premium_version' );
|
13786 |
-
|
13787 |
-
if ( ! $this->is_registered() ) {
|
13788 |
-
// Not registered.
|
13789 |
-
self::shoot_ajax_failure( array(
|
13790 |
-
'message' => $this->get_text_inline( 'Auto installation only works for opted-in users.', 'auto-install-error-not-opted-in' ),
|
13791 |
-
'code' => 'premium_installed',
|
13792 |
-
) );
|
13793 |
-
}
|
13794 |
-
|
13795 |
-
$plugin_id = fs_request_get( 'target_module_id', $this->get_id() );
|
13796 |
-
|
13797 |
-
if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
|
13798 |
-
// Invalid ID.
|
13799 |
-
self::shoot_ajax_failure( array(
|
13800 |
-
'message' => $this->get_text_inline( 'Invalid module ID.', 'auto-install-error-invalid-id' ),
|
13801 |
-
'code' => 'invalid_module_id',
|
13802 |
-
) );
|
13803 |
-
}
|
13804 |
-
|
13805 |
-
if ( $plugin_id == $this->get_id() ) {
|
13806 |
-
if ( $this->is_premium() ) {
|
13807 |
-
// Already using the premium code version.
|
13808 |
-
self::shoot_ajax_failure( array(
|
13809 |
-
'message' => $this->get_text_inline( 'Premium version already active.', 'auto-install-error-premium-activated' ),
|
13810 |
-
'code' => 'premium_installed',
|
13811 |
-
) );
|
13812 |
-
}
|
13813 |
-
if ( ! $this->can_use_premium_code() ) {
|
13814 |
-
// Don't have access to the premium code.
|
13815 |
-
self::shoot_ajax_failure( array(
|
13816 |
-
'message' => $this->get_text_inline( 'You do not have a valid license to access the premium version.', 'auto-install-error-invalid-license' ),
|
13817 |
-
'code' => 'invalid_license',
|
13818 |
-
) );
|
13819 |
-
}
|
13820 |
-
if ( ! $this->has_release_on_freemius() ) {
|
13821 |
-
// Plugin is a serviceware, no premium code version.
|
13822 |
-
self::shoot_ajax_failure( array(
|
13823 |
-
'message' => $this->get_text_inline( 'Plugin is a "Serviceware" which means it does not have a premium code version.', 'auto-install-error-serviceware' ),
|
13824 |
-
'code' => 'premium_version_missing',
|
13825 |
-
) );
|
13826 |
-
}
|
13827 |
-
} else {
|
13828 |
-
$addon = $this->get_addon( $plugin_id );
|
13829 |
-
|
13830 |
-
if ( ! is_object( $addon ) ) {
|
13831 |
-
// Invalid add-on ID.
|
13832 |
-
self::shoot_ajax_failure( array(
|
13833 |
-
'message' => $this->get_text_inline( 'Invalid module ID.', 'auto-install-error-invalid-id' ),
|
13834 |
-
'code' => 'invalid_module_id',
|
13835 |
-
) );
|
13836 |
-
}
|
13837 |
-
|
13838 |
-
if ( $this->is_addon_activated( $plugin_id, true ) ) {
|
13839 |
-
// Premium add-on version is already activated.
|
13840 |
-
self::shoot_ajax_failure( array(
|
13841 |
-
'message' => $this->get_text_inline( 'Premium add-on version already installed.', 'auto-install-error-premium-addon-activated' ),
|
13842 |
-
'code' => 'premium_installed',
|
13843 |
-
) );
|
13844 |
-
}
|
13845 |
-
}
|
13846 |
-
|
13847 |
-
$this->_isAutoInstall = true;
|
13848 |
-
|
13849 |
-
// Try to install and activate.
|
13850 |
-
$updater = new FS_Plugin_Updater( $this );
|
13851 |
-
$result = $updater->install_and_activate_plugin( $plugin_id );
|
13852 |
-
|
13853 |
-
if ( is_array( $result ) && ! empty( $result['message'] ) ) {
|
13854 |
-
self::shoot_ajax_failure( array(
|
13855 |
-
'message' => $result['message'],
|
13856 |
-
'code' => $result['code'],
|
13857 |
-
) );
|
13858 |
-
}
|
13859 |
-
|
13860 |
-
self::shoot_ajax_success( $result );
|
13861 |
-
}
|
13862 |
-
|
13863 |
-
/**
|
13864 |
-
* Displays module activation dialog box after a successful upgrade
|
13865 |
-
* where the user explicitly requested to auto download and install
|
13866 |
-
* the premium version.
|
13867 |
-
*
|
13868 |
-
* @author Vova Feldman (@svovaf)
|
13869 |
-
* @since 1.2.1.7
|
13870 |
-
*/
|
13871 |
-
function _add_auto_installation_dialog_box() {
|
13872 |
-
$this->_logger->entrance();
|
13873 |
-
|
13874 |
-
if ( ! $this->is_registered() ) {
|
13875 |
-
// Not registered.
|
13876 |
-
return;
|
13877 |
-
}
|
13878 |
-
|
13879 |
-
$plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
|
13880 |
-
|
13881 |
-
if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
|
13882 |
-
// Invalid module ID.
|
13883 |
-
return;
|
13884 |
-
}
|
13885 |
-
|
13886 |
-
if ( $plugin_id == $this->get_id() ) {
|
13887 |
-
if ( $this->is_premium() ) {
|
13888 |
-
// Already using the premium code version.
|
13889 |
-
return;
|
13890 |
-
}
|
13891 |
-
if ( ! $this->can_use_premium_code() ) {
|
13892 |
-
// Don't have access to the premium code.
|
13893 |
-
return;
|
13894 |
-
}
|
13895 |
-
if ( ! $this->has_release_on_freemius() ) {
|
13896 |
-
// Plugin is a serviceware, no premium code version.
|
13897 |
-
return;
|
13898 |
-
}
|
13899 |
-
} else {
|
13900 |
-
$addon = $this->get_addon( $plugin_id );
|
13901 |
-
|
13902 |
-
if ( ! is_object( $addon ) ) {
|
13903 |
-
// Invalid add-on ID.
|
13904 |
-
return;
|
13905 |
-
}
|
13906 |
-
|
13907 |
-
if ( $this->is_addon_activated( $plugin_id, true ) ) {
|
13908 |
-
// Premium add-on version is already activated.
|
13909 |
-
return;
|
13910 |
-
}
|
13911 |
-
}
|
13912 |
-
|
13913 |
-
$vars = array(
|
13914 |
-
'id' => $this->_module_id,
|
13915 |
-
'target_module_id' => $plugin_id,
|
13916 |
-
'slug' => $this->_slug,
|
13917 |
-
);
|
13918 |
-
|
13919 |
-
fs_require_template( 'auto-installation.php', $vars );
|
13920 |
-
}
|
13921 |
-
|
13922 |
-
#endregion
|
13923 |
-
|
13924 |
-
#--------------------------------------------------------------------------------
|
13925 |
-
#region Tabs Integration
|
13926 |
-
#--------------------------------------------------------------------------------
|
13927 |
-
|
13928 |
-
#region Module's Original Tabs
|
13929 |
-
|
13930 |
-
/**
|
13931 |
-
* Inject a JavaScript logic to capture the theme tabs HTML.
|
13932 |
-
*
|
13933 |
-
* @author Vova Feldman (@svovaf)
|
13934 |
-
* @since 1.2.2.7
|
13935 |
-
*/
|
13936 |
-
function _tabs_capture() {
|
13937 |
-
$this->_logger->entrance();
|
13938 |
-
|
13939 |
-
if ( ! $this->is_theme_settings_page() ||
|
13940 |
-
! $this->is_matching_url( $this->main_menu_url() )
|
13941 |
-
) {
|
13942 |
-
return;
|
13943 |
-
}
|
13944 |
-
|
13945 |
-
$params = array(
|
13946 |
-
'id' => $this->_module_id,
|
13947 |
-
);
|
13948 |
-
|
13949 |
-
fs_require_once_template( 'tabs-capture-js.php', $params );
|
13950 |
-
}
|
13951 |
-
|
13952 |
-
/**
|
13953 |
-
* Cache theme's tabs HTML for a week. The cache will also be set as expired
|
13954 |
-
* after version and type (free/premium) changes, in addition to the week period.
|
13955 |
-
*
|
13956 |
-
* @author Vova Feldman (@svovaf)
|
13957 |
-
* @since 1.2.2.7
|
13958 |
-
*/
|
13959 |
-
function _store_tabs_ajax_action() {
|
13960 |
-
$this->_logger->entrance();
|
13961 |
-
|
13962 |
-
$this->check_ajax_referer( 'store_tabs' );
|
13963 |
-
|
13964 |
-
// Init filesystem if not yet initiated.
|
13965 |
-
WP_Filesystem();
|
13966 |
-
|
13967 |
-
// Get POST body HTML data.
|
13968 |
-
global $wp_filesystem;
|
13969 |
-
$tabs_html = $wp_filesystem->get_contents( "php://input" );
|
13970 |
-
|
13971 |
-
if ( is_string( $tabs_html ) ) {
|
13972 |
-
$tabs_html = trim( $tabs_html );
|
13973 |
-
}
|
13974 |
-
|
13975 |
-
if ( ! is_string( $tabs_html ) || empty( $tabs_html ) ) {
|
13976 |
-
self::shoot_ajax_failure();
|
13977 |
-
}
|
13978 |
-
|
13979 |
-
$this->_cache->set( 'tabs', $tabs_html, 7 * WP_FS__TIME_24_HOURS_IN_SEC );
|
13980 |
-
|
13981 |
-
self::shoot_ajax_success();
|
13982 |
-
}
|
13983 |
-
|
13984 |
-
/**
|
13985 |
-
* Cache theme's settings page custom styles. The cache will also be set as expired
|
13986 |
-
* after version and type (free/premium) changes, in addition to the week period.
|
13987 |
-
*
|
13988 |
-
* @author Vova Feldman (@svovaf)
|
13989 |
-
* @since 1.2.2.7
|
13990 |
-
*/
|
13991 |
-
function _store_tabs_styles() {
|
13992 |
-
$this->_logger->entrance();
|
13993 |
-
|
13994 |
-
if ( ! $this->is_theme_settings_page() ||
|
13995 |
-
! $this->is_matching_url( $this->main_menu_url() )
|
13996 |
-
) {
|
13997 |
-
return;
|
13998 |
-
}
|
13999 |
-
|
14000 |
-
$wp_styles = wp_styles();
|
14001 |
-
|
14002 |
-
$theme_styles_url = get_template_directory_uri();
|
14003 |
-
|
14004 |
-
$stylesheets = array();
|
14005 |
-
foreach ( $wp_styles->queue as $handler ) {
|
14006 |
-
if ( fs_starts_with( $handler, 'fs_' ) ) {
|
14007 |
-
// Assume that stylesheets that their handler starts with "fs_" belong to the SDK.
|
14008 |
-
continue;
|
14009 |
-
}
|
14010 |
-
|
14011 |
-
/**
|
14012 |
-
* @var _WP_Dependency $stylesheet
|
14013 |
-
*/
|
14014 |
-
$stylesheet = $wp_styles->registered[ $handler ];
|
14015 |
-
|
14016 |
-
if ( fs_starts_with( $stylesheet->src, $theme_styles_url ) ) {
|
14017 |
-
$stylesheets[] = $stylesheet->src;
|
14018 |
-
}
|
14019 |
-
}
|
14020 |
-
|
14021 |
-
if ( ! empty( $stylesheets ) ) {
|
14022 |
-
$this->_cache->set( 'tabs_stylesheets', $stylesheets, 7 * WP_FS__TIME_24_HOURS_IN_SEC );
|
14023 |
-
}
|
14024 |
-
}
|
14025 |
-
|
14026 |
-
/**
|
14027 |
-
* Check if module's original settings page has any tabs.
|
14028 |
-
*
|
14029 |
-
* @author Vova Feldman (@svovaf)
|
14030 |
-
* @since 1.2.2.7
|
14031 |
-
*
|
14032 |
-
* @return bool
|
14033 |
-
*/
|
14034 |
-
private function has_tabs() {
|
14035 |
-
return $this->_cache->has( 'tabs' );
|
14036 |
-
}
|
14037 |
-
|
14038 |
-
/**
|
14039 |
-
* Get module's settings page HTML content, starting
|
14040 |
-
* from the beginning of the <div class="wrap"> element,
|
14041 |
-
* until the tabs HTML (including).
|
14042 |
-
*
|
14043 |
-
* @author Vova Feldman (@svovaf)
|
14044 |
-
* @since 1.2.2.7
|
14045 |
-
*
|
14046 |
-
* @return string
|
14047 |
-
*/
|
14048 |
-
private function get_tabs_html() {
|
14049 |
-
$this->_logger->entrance();
|
14050 |
-
|
14051 |
-
return $this->_cache->get( 'tabs' );
|
14052 |
-
}
|
14053 |
-
|
14054 |
-
/**
|
14055 |
-
* Check if page should include tabs.
|
14056 |
-
*
|
14057 |
-
* @author Vova Feldman (@svovaf)
|
14058 |
-
* @since 1.2.2.7
|
14059 |
-
*
|
14060 |
-
* @return bool
|
14061 |
-
*/
|
14062 |
-
private function should_page_include_tabs()
|
14063 |
-
{
|
14064 |
-
if ( ! $this->has_settings_menu() ) {
|
14065 |
-
// Don't add tabs if no settings at all.
|
14066 |
-
return false;
|
14067 |
-
}
|
14068 |
-
|
14069 |
-
if ( ! $this->is_theme() ) {
|
14070 |
-
// Only add tabs to themes for now.
|
14071 |
-
return false;
|
14072 |
-
}
|
14073 |
-
|
14074 |
-
if ( ! $this->has_paid_plan() && ! $this->has_addons() ) {
|
14075 |
-
// Only add tabs to monetizing themes.
|
14076 |
-
return false;
|
14077 |
-
}
|
14078 |
-
|
14079 |
-
if ( ! $this->is_theme_settings_page() ) {
|
14080 |
-
// Only add tabs if browsing one of the theme's setting pages.
|
14081 |
-
return false;
|
14082 |
-
}
|
14083 |
-
|
14084 |
-
if ( $this->is_admin_page( 'pricing' ) && fs_request_get_bool( 'checkout' ) ) {
|
14085 |
-
// Don't add tabs on checkout page, we want to reduce distractions
|
14086 |
-
// as much as possible.
|
14087 |
-
return false;
|
14088 |
-
}
|
14089 |
-
|
14090 |
-
return true;
|
14091 |
-
}
|
14092 |
-
|
14093 |
-
/**
|
14094 |
-
* Add the tabs HTML before the setting's page content and
|
14095 |
-
* enqueue any required stylesheets.
|
14096 |
-
*
|
14097 |
-
* @author Vova Feldman (@svovaf)
|
14098 |
-
* @since 1.2.2.7
|
14099 |
-
*
|
14100 |
-
* @return bool If tabs were included.
|
14101 |
-
*/
|
14102 |
-
function _add_tabs_before_content() {
|
14103 |
-
$this->_logger->entrance();
|
14104 |
-
|
14105 |
-
if ( ! $this->should_page_include_tabs() ) {
|
14106 |
-
return false;
|
14107 |
-
}
|
14108 |
-
|
14109 |
-
/**
|
14110 |
-
* Enqueue the original stylesheets that are included in the
|
14111 |
-
* theme settings page. That way, if the theme settings has
|
14112 |
-
* some custom _styled_ content above the tabs UI, this
|
14113 |
-
* will make sure that the styling is preserved.
|
14114 |
-
*/
|
14115 |
-
$stylesheets = $this->_cache->get( 'tabs_stylesheets', array() );
|
14116 |
-
if ( is_array( $stylesheets ) ) {
|
14117 |
-
for ( $i = 0, $len = count( $stylesheets ); $i < $len; $i ++ ) {
|
14118 |
-
wp_enqueue_style( "fs_{$this->_module_id}_tabs_{$i}", $stylesheets[ $i ] );
|
14119 |
-
}
|
14120 |
-
}
|
14121 |
-
|
14122 |
-
// Cut closing </div> tag.
|
14123 |
-
echo substr( trim( $this->get_tabs_html() ), 0, - 6 );
|
14124 |
-
|
14125 |
-
return true;
|
14126 |
-
}
|
14127 |
-
|
14128 |
-
/**
|
14129 |
-
* Add the tabs closing HTML after the setting's page content.
|
14130 |
-
*
|
14131 |
-
* @author Vova Feldman (@svovaf)
|
14132 |
-
* @since 1.2.2.7
|
14133 |
-
*
|
14134 |
-
* @return bool If tabs closing HTML was included.
|
14135 |
-
*/
|
14136 |
-
function _add_tabs_after_content() {
|
14137 |
-
$this->_logger->entrance();
|
14138 |
-
|
14139 |
-
if ( ! $this->should_page_include_tabs() ) {
|
14140 |
-
return false;
|
14141 |
-
}
|
14142 |
-
|
14143 |
-
echo '</div>';
|
14144 |
-
|
14145 |
-
return true;
|
14146 |
-
}
|
14147 |
-
|
14148 |
-
#endregion
|
14149 |
-
|
14150 |
-
/**
|
14151 |
-
* Add in-page JavaScript to inject the Freemius tabs into
|
14152 |
-
* the module's setting tabs section.
|
14153 |
-
*
|
14154 |
-
* @author Vova Feldman (@svovaf)
|
14155 |
-
* @since 1.2.2.7
|
14156 |
-
*/
|
14157 |
-
function _add_freemius_tabs() {
|
14158 |
-
$this->_logger->entrance();
|
14159 |
-
|
14160 |
-
if ( ! $this->should_page_include_tabs() ) {
|
14161 |
-
return;
|
14162 |
-
}
|
14163 |
-
|
14164 |
-
$params = array( 'id' => $this->_module_id );
|
14165 |
-
fs_require_once_template( 'tabs.php', $params );
|
14166 |
-
}
|
14167 |
-
|
14168 |
-
#endregion
|
14169 |
-
|
14170 |
-
#--------------------------------------------------------------------------------
|
14171 |
-
#region Customizer Integration for Themes
|
14172 |
-
#--------------------------------------------------------------------------------
|
14173 |
-
|
14174 |
-
/**
|
14175 |
-
* @author Vova Feldman (@svovaf)
|
14176 |
-
* @since 1.2.2.7
|
14177 |
-
*
|
14178 |
-
* @param WP_Customize_Manager $customizer
|
14179 |
-
*/
|
14180 |
-
function _customizer_register($customizer) {
|
14181 |
-
$this->_logger->entrance();
|
14182 |
-
|
14183 |
-
if ( $this->is_pricing_page_visible() ) {
|
14184 |
-
require_once WP_FS__DIR_INCLUDES . '/customizer/class-fs-customizer-upsell-control.php';
|
14185 |
-
|
14186 |
-
$customizer->add_section( 'freemius_upsell', array(
|
14187 |
-
'title' => '★ ' . $this->get_text_inline( 'View paid features', 'view-paid-features' ),
|
14188 |
-
'priority' => 1,
|
14189 |
-
) );
|
14190 |
-
$customizer->add_setting( 'freemius_upsell', array(
|
14191 |
-
'sanitize_callback' => 'esc_html',
|
14192 |
-
) );
|
14193 |
-
|
14194 |
-
$customizer->add_control( new FS_Customizer_Upsell_Control( $customizer, 'freemius_upsell', array(
|
14195 |
-
'fs' => $this,
|
14196 |
-
'section' => 'freemius_upsell',
|
14197 |
-
'priority' => 100,
|
14198 |
-
) ) );
|
14199 |
-
}
|
14200 |
-
|
14201 |
-
if ( $this->is_page_visible( 'contact' ) || $this->is_page_visible( 'support' ) ) {
|
14202 |
-
require_once WP_FS__DIR_INCLUDES . '/customizer/class-fs-customizer-support-section.php';
|
14203 |
-
|
14204 |
-
// Main Documentation Link In Customizer Root.
|
14205 |
-
$customizer->add_section( new FS_Customizer_Support_Section( $customizer, 'freemius_support', array(
|
14206 |
-
'fs' => $this,
|
14207 |
-
'priority' => 1000,
|
14208 |
-
) ) );
|
14209 |
-
}
|
14210 |
-
}
|
14211 |
-
|
14212 |
-
#endregion
|
14213 |
-
|
14214 |
-
/**
|
14215 |
-
* If the theme has a paid version, add some custom
|
14216 |
-
* styling to the theme's premium version (if exists)
|
14217 |
-
* to highlight that it's the premium version of the
|
14218 |
-
* same theme, making it easier for identification
|
14219 |
-
* after the user upgrades and upload it to the site.
|
14220 |
-
*
|
14221 |
-
* @author Vova Feldman (@svovaf)
|
14222 |
-
* @since 1.2.2.7
|
14223 |
-
*/
|
14224 |
-
function _style_premium_theme() {
|
14225 |
-
$this->_logger->entrance();
|
14226 |
-
|
14227 |
-
if ( ! self::is_themes_page() ) {
|
14228 |
-
// Only include in the themes page.
|
14229 |
-
return;
|
14230 |
-
}
|
14231 |
-
|
14232 |
-
if ( ! $this->has_paid_plan() ) {
|
14233 |
-
// Only include if has any paid plans.
|
14234 |
-
return;
|
14235 |
-
}
|
14236 |
-
|
14237 |
-
$params = null;
|
14238 |
-
fs_require_once_template( '/js/jquery.content-change.php', $params );
|
14239 |
-
|
14240 |
-
$params = array(
|
14241 |
-
'slug' => $this->_slug,
|
14242 |
-
'id' => $this->_module_id,
|
14243 |
-
);
|
14244 |
-
|
14245 |
-
fs_require_template( '/js/style-premium-theme.php', $params );
|
14246 |
-
}
|
14247 |
-
|
14248 |
-
#----------------------------------------------------------------------------------
|
14249 |
-
#region Marketing
|
14250 |
-
#----------------------------------------------------------------------------------
|
14251 |
-
|
14252 |
-
/**
|
14253 |
-
* Check if current user purchased any other plugins before.
|
14254 |
-
*
|
14255 |
-
* @author Vova Feldman (@svovaf)
|
14256 |
-
* @since 1.0.9
|
14257 |
-
*
|
14258 |
-
* @return bool
|
14259 |
-
*/
|
14260 |
-
function has_purchased_before() {
|
14261 |
-
// TODO: Implement has_purchased_before() method.
|
14262 |
-
throw new Exception( 'not implemented' );
|
14263 |
-
}
|
14264 |
-
|
14265 |
-
/**
|
14266 |
-
* Check if current user classified as an agency.
|
14267 |
-
*
|
14268 |
-
* @author Vova Feldman (@svovaf)
|
14269 |
-
* @since 1.0.9
|
14270 |
-
*
|
14271 |
-
* @return bool
|
14272 |
-
*/
|
14273 |
-
function is_agency() {
|
14274 |
-
// TODO: Implement is_agency() method.
|
14275 |
-
throw new Exception( 'not implemented' );
|
14276 |
-
}
|
14277 |
-
|
14278 |
-
/**
|
14279 |
-
* Check if current user classified as a developer.
|
14280 |
-
*
|
14281 |
-
* @author Vova Feldman (@svovaf)
|
14282 |
-
* @since 1.0.9
|
14283 |
-
*
|
14284 |
-
* @return bool
|
14285 |
-
*/
|
14286 |
-
function is_developer() {
|
14287 |
-
// TODO: Implement is_developer() method.
|
14288 |
-
throw new Exception( 'not implemented' );
|
14289 |
-
}
|
14290 |
-
|
14291 |
-
/**
|
14292 |
-
* Check if current user classified as a business.
|
14293 |
-
*
|
14294 |
-
* @author Vova Feldman (@svovaf)
|
14295 |
-
* @since 1.0.9
|
14296 |
-
*
|
14297 |
-
* @return bool
|
14298 |
-
*/
|
14299 |
-
function is_business() {
|
14300 |
-
// TODO: Implement is_business() method.
|
14301 |
-
throw new Exception( 'not implemented' );
|
14302 |
-
}
|
14303 |
-
|
14304 |
-
#endregion
|
14305 |
-
}
|
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 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit;
|
10 |
+
}
|
11 |
+
|
12 |
+
// "final class"
|
13 |
+
class Freemius extends Freemius_Abstract {
|
14 |
+
/**
|
15 |
+
* SDK Version
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
public $version = WP_FS__SDK_VERSION;
|
20 |
+
|
21 |
+
#region Plugin Info
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @since 1.0.1
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
private $_slug;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @since 1.0.0
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
private $_plugin_basename;
|
36 |
+
/**
|
37 |
+
* @since 1.0.0
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
private $_free_plugin_basename;
|
42 |
+
/**
|
43 |
+
* @since 1.0.0
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
private $_plugin_dir_path;
|
48 |
+
/**
|
49 |
+
* @since 1.0.0
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
private $_plugin_dir_name;
|
54 |
+
/**
|
55 |
+
* @since 1.0.0
|
56 |
+
*
|
57 |
+
* @var string
|
58 |
+
*/
|
59 |
+
private $_plugin_main_file_path;
|
60 |
+
/**
|
61 |
+
* @var string[]
|
62 |
+
*/
|
63 |
+
private $_plugin_data;
|
64 |
+
/**
|
65 |
+
* @since 1.0.9
|
66 |
+
*
|
67 |
+
* @var string
|
68 |
+
*/
|
69 |
+
private $_plugin_name;
|
70 |
+
/**
|
71 |
+
* @since 1.2.2
|
72 |
+
*
|
73 |
+
* @var string
|
74 |
+
*/
|
75 |
+
private $_module_type;
|
76 |
+
|
77 |
+
#endregion Plugin Info
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @since 1.0.9
|
81 |
+
*
|
82 |
+
* @var bool If false, don't turn Freemius on.
|
83 |
+
*/
|
84 |
+
private $_is_on;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @since 1.1.3
|
88 |
+
*
|
89 |
+
* @var bool If false, don't turn Freemius on.
|
90 |
+
*/
|
91 |
+
private $_is_anonymous;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @since 1.0.9
|
95 |
+
* @var bool If false, issues with connectivity to Freemius API.
|
96 |
+
*/
|
97 |
+
private $_has_api_connection;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @since 1.0.9
|
101 |
+
* @since 2.0.0 Default to true since we need the property during the instance construction, prior to the dynamic_init() execution.
|
102 |
+
* @var bool Hints the SDK if plugin can support anonymous mode (if skip connect is visible).
|
103 |
+
*/
|
104 |
+
private $_enable_anonymous = true;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @since 1.1.7.5
|
108 |
+
* @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
|
109 |
+
*/
|
110 |
+
private $_anonymous_mode;
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @since 1.1.9
|
114 |
+
* @var bool Hints the SDK if plugin have any free plans.
|
115 |
+
*/
|
116 |
+
private $_is_premium_only;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @since 1.2.1.6
|
120 |
+
* @var bool Hints the SDK if plugin have premium code version at all.
|
121 |
+
*/
|
122 |
+
private $_has_premium_version;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @since 1.2.1.6
|
126 |
+
* @var bool Hints the SDK if plugin should ignore pending mode by simulating a skip.
|
127 |
+
*/
|
128 |
+
private $_ignore_pending_mode;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @since 1.0.8
|
132 |
+
* @var bool Hints the SDK if the plugin has any paid plans.
|
133 |
+
*/
|
134 |
+
private $_has_paid_plans;
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @since 1.2.1.5
|
138 |
+
* @var int Hints the SDK if the plugin offers a trial period. If negative, no trial, if zero - has a trial but
|
139 |
+
* without a specified period, if positive - the number of trial days.
|
140 |
+
*/
|
141 |
+
private $_trial_days = - 1;
|
142 |
+
|
143 |
+
/**
|
144 |
+
* @since 1.2.1.5
|
145 |
+
* @var bool Hints the SDK if the trial requires a payment method or not.
|
146 |
+
*/
|
147 |
+
private $_is_trial_require_payment = false;
|
148 |
+
|
149 |
+
/**
|
150 |
+
* @since 1.0.7
|
151 |
+
* @var bool Hints the SDK if the plugin is WordPress.org compliant.
|
152 |
+
*/
|
153 |
+
private $_is_org_compliant;
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @since 1.0.7
|
157 |
+
* @var bool Hints the SDK if the plugin is has add-ons.
|
158 |
+
*/
|
159 |
+
private $_has_addons;
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @since 1.1.6
|
163 |
+
* @var string[]bool.
|
164 |
+
*/
|
165 |
+
private $_permissions;
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @var FS_Storage
|
169 |
+
*/
|
170 |
+
private $_storage;
|
171 |
+
|
172 |
+
/**
|
173 |
+
* @since 1.2.2.7
|
174 |
+
* @var FS_Cache_Manager
|
175 |
+
*/
|
176 |
+
private $_cache;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @since 1.0.0
|
180 |
+
*
|
181 |
+
* @var FS_Logger
|
182 |
+
*/
|
183 |
+
private $_logger;
|
184 |
+
/**
|
185 |
+
* @since 1.0.4
|
186 |
+
*
|
187 |
+
* @var FS_Plugin
|
188 |
+
*/
|
189 |
+
private $_plugin = false;
|
190 |
+
/**
|
191 |
+
* @since 1.0.4
|
192 |
+
*
|
193 |
+
* @var FS_Plugin|false
|
194 |
+
*/
|
195 |
+
private $_parent_plugin = false;
|
196 |
+
/**
|
197 |
+
* @since 1.1.1
|
198 |
+
*
|
199 |
+
* @var Freemius
|
200 |
+
*/
|
201 |
+
private $_parent = false;
|
202 |
+
/**
|
203 |
+
* @since 1.0.1
|
204 |
+
*
|
205 |
+
* @var FS_User
|
206 |
+
*/
|
207 |
+
private $_user = false;
|
208 |
+
/**
|
209 |
+
* @since 1.0.1
|
210 |
+
*
|
211 |
+
* @var FS_Site
|
212 |
+
*/
|
213 |
+
private $_site = false;
|
214 |
+
/**
|
215 |
+
* @since 1.0.1
|
216 |
+
*
|
217 |
+
* @var FS_Plugin_License
|
218 |
+
*/
|
219 |
+
private $_license;
|
220 |
+
/**
|
221 |
+
* @since 1.0.2
|
222 |
+
*
|
223 |
+
* @var FS_Plugin_Plan[]
|
224 |
+
*/
|
225 |
+
private $_plans = false;
|
226 |
+
/**
|
227 |
+
* @var FS_Plugin_License[]
|
228 |
+
* @since 1.0.5
|
229 |
+
*/
|
230 |
+
private $_licenses = false;
|
231 |
+
|
232 |
+
/**
|
233 |
+
* @since 1.0.1
|
234 |
+
*
|
235 |
+
* @var FS_Admin_Menu_Manager
|
236 |
+
*/
|
237 |
+
private $_menu;
|
238 |
+
|
239 |
+
/**
|
240 |
+
* @var FS_Admin_Notices
|
241 |
+
*/
|
242 |
+
private $_admin_notices;
|
243 |
+
|
244 |
+
/**
|
245 |
+
* @since 1.1.6
|
246 |
+
*
|
247 |
+
* @var FS_Admin_Notices
|
248 |
+
*/
|
249 |
+
private static $_global_admin_notices;
|
250 |
+
|
251 |
+
/**
|
252 |
+
* @var FS_Logger
|
253 |
+
* @since 1.0.0
|
254 |
+
*/
|
255 |
+
private static $_static_logger;
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @var FS_Options
|
259 |
+
* @since 1.0.2
|
260 |
+
*/
|
261 |
+
private static $_accounts;
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @since 1.2.2
|
265 |
+
*
|
266 |
+
* @var number
|
267 |
+
*/
|
268 |
+
private $_module_id;
|
269 |
+
|
270 |
+
/**
|
271 |
+
* @var Freemius[]
|
272 |
+
*/
|
273 |
+
private static $_instances = array();
|
274 |
+
|
275 |
+
/**
|
276 |
+
* @since 1.2.3
|
277 |
+
*
|
278 |
+
* @var FS_Affiliate
|
279 |
+
*/
|
280 |
+
private $affiliate = null;
|
281 |
+
|
282 |
+
/**
|
283 |
+
* @since 1.2.3
|
284 |
+
*
|
285 |
+
* @var FS_AffiliateTerms
|
286 |
+
*/
|
287 |
+
private $plugin_affiliate_terms = null;
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @since 1.2.3
|
291 |
+
*
|
292 |
+
* @var FS_AffiliateTerms
|
293 |
+
*/
|
294 |
+
private $custom_affiliate_terms = null;
|
295 |
+
|
296 |
+
/**
|
297 |
+
* @since 2.0.0
|
298 |
+
*
|
299 |
+
* @var bool
|
300 |
+
*/
|
301 |
+
private $_is_multisite_integrated;
|
302 |
+
|
303 |
+
/**
|
304 |
+
* @since 2.0.0
|
305 |
+
*
|
306 |
+
* @var bool True if the current request is for a network admin screen and the plugin is network active.
|
307 |
+
*/
|
308 |
+
private $_is_network_active;
|
309 |
+
|
310 |
+
/**
|
311 |
+
* @since 2.0.0
|
312 |
+
*
|
313 |
+
* @var int|null The original blog ID the plugin was loaded with.
|
314 |
+
*/
|
315 |
+
private $_blog_id = null;
|
316 |
+
|
317 |
+
/**
|
318 |
+
* @since 2.0.0
|
319 |
+
*
|
320 |
+
* @var int|null The current execution context. When true, run on network context. When int, run on the specified blog context.
|
321 |
+
*/
|
322 |
+
private $_context_is_network_or_blog_id = null;
|
323 |
+
|
324 |
+
/**
|
325 |
+
* @since 2.0.0
|
326 |
+
*
|
327 |
+
* @var string
|
328 |
+
*/
|
329 |
+
private $_dynamically_added_top_level_page_hook_name = '';
|
330 |
+
|
331 |
+
#region Uninstall Reasons IDs
|
332 |
+
|
333 |
+
const REASON_NO_LONGER_NEEDED = 1;
|
334 |
+
const REASON_FOUND_A_BETTER_PLUGIN = 2;
|
335 |
+
const REASON_NEEDED_FOR_A_SHORT_PERIOD = 3;
|
336 |
+
const REASON_BROKE_MY_SITE = 4;
|
337 |
+
const REASON_SUDDENLY_STOPPED_WORKING = 5;
|
338 |
+
const REASON_CANT_PAY_ANYMORE = 6;
|
339 |
+
const REASON_OTHER = 7;
|
340 |
+
const REASON_DIDNT_WORK = 8;
|
341 |
+
const REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION = 9;
|
342 |
+
const REASON_COULDNT_MAKE_IT_WORK = 10;
|
343 |
+
const REASON_GREAT_BUT_NEED_SPECIFIC_FEATURE = 11;
|
344 |
+
const REASON_NOT_WORKING = 12;
|
345 |
+
const REASON_NOT_WHAT_I_WAS_LOOKING_FOR = 13;
|
346 |
+
const REASON_DIDNT_WORK_AS_EXPECTED = 14;
|
347 |
+
const REASON_TEMPORARY_DEACTIVATION = 15;
|
348 |
+
|
349 |
+
#endregion
|
350 |
+
|
351 |
+
/* Ctor
|
352 |
+
------------------------------------------------------------------------------------------------------------------*/
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Main singleton instance.
|
356 |
+
*
|
357 |
+
* @author Vova Feldman (@svovaf)
|
358 |
+
* @since 1.0.0
|
359 |
+
*
|
360 |
+
* @param number $module_id
|
361 |
+
* @param string|bool $slug
|
362 |
+
* @param bool $is_init Since 1.2.1 Is initiation sequence.
|
363 |
+
*/
|
364 |
+
private function __construct( $module_id, $slug = false, $is_init = false ) {
|
365 |
+
if ( $is_init && is_numeric( $module_id ) && is_string( $slug ) ) {
|
366 |
+
$this->store_id_slug_type_path_map( $module_id, $slug );
|
367 |
+
}
|
368 |
+
|
369 |
+
$this->_module_id = $module_id;
|
370 |
+
$this->_slug = $this->get_slug();
|
371 |
+
$this->_module_type = $this->get_module_type();
|
372 |
+
|
373 |
+
$this->_blog_id = is_multisite() ? get_current_blog_id() : null;
|
374 |
+
|
375 |
+
$this->_storage = FS_Storage::instance( $this->_module_type, $this->_slug );
|
376 |
+
|
377 |
+
$this->_cache = FS_Cache_Manager::get_manager( WP_FS___OPTION_PREFIX . "cache_{$module_id}" );
|
378 |
+
|
379 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $this->get_unique_affix(), WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
380 |
+
|
381 |
+
$this->_plugin_main_file_path = $this->_find_caller_plugin_file( $is_init );
|
382 |
+
$this->_plugin_dir_path = plugin_dir_path( $this->_plugin_main_file_path );
|
383 |
+
$this->_plugin_basename = $this->get_plugin_basename();
|
384 |
+
$this->_free_plugin_basename = str_replace( '-premium/', '/', $this->_plugin_basename );
|
385 |
+
|
386 |
+
$this->_is_multisite_integrated = (
|
387 |
+
defined( "WP_FS__PRODUCT_{$module_id}_MULTISITE" ) &&
|
388 |
+
( true === constant( "WP_FS__PRODUCT_{$module_id}_MULTISITE" ) )
|
389 |
+
);
|
390 |
+
|
391 |
+
$this->_is_network_active = (
|
392 |
+
is_multisite() &&
|
393 |
+
$this->_is_multisite_integrated &&
|
394 |
+
// Themes are always network activated, but the ACTUAL activation is per site.
|
395 |
+
$this->is_plugin() &&
|
396 |
+
( is_plugin_active_for_network( $this->_plugin_basename ) ||
|
397 |
+
// Plugin network level activation or uninstall.
|
398 |
+
is_plugin_inactive( $this->_plugin_basename ) )
|
399 |
+
);
|
400 |
+
|
401 |
+
$this->_storage->set_network_active(
|
402 |
+
$this->_is_network_active,
|
403 |
+
$this->is_delegated_connection()
|
404 |
+
);
|
405 |
+
|
406 |
+
#region Migration
|
407 |
+
|
408 |
+
if ( is_multisite() ) {
|
409 |
+
/**
|
410 |
+
* If the install_timestamp exists on the site level but doesn't exist on the
|
411 |
+
* network level storage, it means that we need to process the storage with migration.
|
412 |
+
*
|
413 |
+
* The code in this `if` scope will only be executed once and only for the first site that will execute it because once we migrate the storage data, install_timestamp will be already set in the network level storage.
|
414 |
+
*
|
415 |
+
* @author Vova Feldman (@svovaf)
|
416 |
+
* @since 2.0.0
|
417 |
+
*/
|
418 |
+
if ( false === $this->_storage->get( 'install_timestamp', false, true ) &&
|
419 |
+
false !== $this->_storage->get( 'install_timestamp', false, false )
|
420 |
+
) {
|
421 |
+
// Initiate storage migration.
|
422 |
+
$this->_storage->migrate_to_network();
|
423 |
+
|
424 |
+
// Migrate module cache to network level storage.
|
425 |
+
$this->_cache->migrate_to_network();
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
#endregion
|
430 |
+
|
431 |
+
$base_name_split = explode( '/', $this->_plugin_basename );
|
432 |
+
$this->_plugin_dir_name = $base_name_split[0];
|
433 |
+
|
434 |
+
if ( $this->_logger->is_on() ) {
|
435 |
+
$this->_logger->info( 'plugin_main_file_path = ' . $this->_plugin_main_file_path );
|
436 |
+
$this->_logger->info( 'plugin_dir_path = ' . $this->_plugin_dir_path );
|
437 |
+
$this->_logger->info( 'plugin_basename = ' . $this->_plugin_basename );
|
438 |
+
$this->_logger->info( 'free_plugin_basename = ' . $this->_free_plugin_basename );
|
439 |
+
$this->_logger->info( 'plugin_dir_name = ' . $this->_plugin_dir_name );
|
440 |
+
}
|
441 |
+
|
442 |
+
// Remember link between file to slug.
|
443 |
+
$this->store_file_slug_map();
|
444 |
+
|
445 |
+
// Store plugin's initial install timestamp.
|
446 |
+
if ( ! isset( $this->_storage->install_timestamp ) ) {
|
447 |
+
$this->_storage->install_timestamp = WP_FS__SCRIPT_START_TIME;
|
448 |
+
}
|
449 |
+
|
450 |
+
if ( ! is_object( $this->_plugin ) ) {
|
451 |
+
$this->_plugin = FS_Plugin_Manager::instance( $this->_module_id )->get();
|
452 |
+
}
|
453 |
+
|
454 |
+
$this->_admin_notices = FS_Admin_Notices::instance(
|
455 |
+
$this->_slug . ( $this->is_theme() ? ':theme' : '' ),
|
456 |
+
/**
|
457 |
+
* Ensure that the admin notice will always have a title by using the stored plugin title if available and
|
458 |
+
* retrieving the title via the "get_plugin_name" method if there is no stored plugin title available.
|
459 |
+
*
|
460 |
+
* @author Leo Fajardo (@leorw)
|
461 |
+
* @since 1.2.2
|
462 |
+
*/
|
463 |
+
( is_object( $this->_plugin ) ? $this->_plugin->title : $this->get_plugin_name() ),
|
464 |
+
$this->get_unique_affix()
|
465 |
+
);
|
466 |
+
|
467 |
+
if ( 'true' === fs_request_get( 'fs_clear_api_cache' ) ||
|
468 |
+
'true' === fs_request_is_action( 'restart_freemius' )
|
469 |
+
) {
|
470 |
+
FS_Api::clear_cache();
|
471 |
+
$this->_cache->clear();
|
472 |
+
}
|
473 |
+
|
474 |
+
$this->_register_hooks();
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Starting from version 2.0.0, `FS_Site` entities no longer have the `plan` property and have `plan_id`
|
478 |
+
* instead. This should be called before calling `_load_account()`, otherwise, `$this->_site` will not be
|
479 |
+
* loaded in `_load_account` for versions of SDK starting from 2.0.0.
|
480 |
+
*
|
481 |
+
* @author Leo Fajardo (@leorw)
|
482 |
+
*/
|
483 |
+
self::migrate_install_plan_to_plan_id( $this->_storage );
|
484 |
+
|
485 |
+
$this->_load_account();
|
486 |
+
|
487 |
+
$this->_version_updates_handler();
|
488 |
+
}
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Checks whether this module has a settings menu.
|
492 |
+
*
|
493 |
+
* @author Leo Fajardo (@leorw)
|
494 |
+
* @since 1.2.2
|
495 |
+
*
|
496 |
+
* @return bool
|
497 |
+
*/
|
498 |
+
function has_settings_menu() {
|
499 |
+
return ( $this->_is_network_active && fs_is_network_admin() ) ?
|
500 |
+
$this->_menu->has_network_menu() :
|
501 |
+
$this->_menu->has_menu();
|
502 |
+
}
|
503 |
+
|
504 |
+
/**
|
505 |
+
* Check if the context module is free wp.org theme.
|
506 |
+
*
|
507 |
+
* This method is helpful because:
|
508 |
+
* 1. wp.org themes are limited to a single submenu item,
|
509 |
+
* and sub-submenu items are most likely not allowed (never verified).
|
510 |
+
* 2. wp.org themes are not allowed to redirect the user
|
511 |
+
* after the theme activation, therefore, the agreed UX
|
512 |
+
* is showing the opt-in as a modal dialog box after
|
513 |
+
* activation (approved by @otto42, @emiluzelac, @greenshady, @grapplerulrich).
|
514 |
+
*
|
515 |
+
* @author Vova Feldman (@svovaf)
|
516 |
+
* @since 1.2.2.7
|
517 |
+
*
|
518 |
+
* @return bool
|
519 |
+
*/
|
520 |
+
function is_free_wp_org_theme() {
|
521 |
+
return (
|
522 |
+
$this->is_theme() &&
|
523 |
+
$this->is_org_repo_compliant() &&
|
524 |
+
! $this->is_premium()
|
525 |
+
);
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Checks whether this a submenu item is visible.
|
530 |
+
*
|
531 |
+
* @author Vova Feldman (@svovaf)
|
532 |
+
* @since 1.2.2.6
|
533 |
+
* @since 1.2.2.7 Even if the menu item was specified to be hidden, when it is the context page, then show the submenu item so the user will have the right context page.
|
534 |
+
*
|
535 |
+
* @param string $slug
|
536 |
+
*
|
537 |
+
* @return bool
|
538 |
+
*/
|
539 |
+
function is_submenu_item_visible( $slug ) {
|
540 |
+
if ( $this->is_admin_page( $slug ) ) {
|
541 |
+
/**
|
542 |
+
* It is the current context page, so show the submenu item
|
543 |
+
* so the user will have the right context page, even if it
|
544 |
+
* was set to hidden.
|
545 |
+
*/
|
546 |
+
return true;
|
547 |
+
}
|
548 |
+
|
549 |
+
if ( ! $this->has_settings_menu() ) {
|
550 |
+
// No menu settings at all.
|
551 |
+
return false;
|
552 |
+
}
|
553 |
+
|
554 |
+
if ( $this->is_free_wp_org_theme() ) {
|
555 |
+
/**
|
556 |
+
* wp.org themes are limited to a single submenu item, and
|
557 |
+
* sub-submenu items are most likely not allowed (never verified).
|
558 |
+
*/
|
559 |
+
return false;
|
560 |
+
}
|
561 |
+
|
562 |
+
return $this->_menu->is_submenu_item_visible( $slug );
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Check if a Freemius page should be accessible via the UI.
|
567 |
+
*
|
568 |
+
* @author Vova Feldman (@svovaf)
|
569 |
+
* @since 1.2.2.7
|
570 |
+
*
|
571 |
+
* @param string $slug
|
572 |
+
*
|
573 |
+
* @return bool
|
574 |
+
*/
|
575 |
+
function is_page_visible( $slug ) {
|
576 |
+
if ( $this->is_admin_page( $slug ) ) {
|
577 |
+
return true;
|
578 |
+
}
|
579 |
+
|
580 |
+
return $this->_menu->is_submenu_item_visible( $slug, true, true );
|
581 |
+
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* @author Vova Feldman (@svovaf)
|
585 |
+
* @since 1.0.9
|
586 |
+
*/
|
587 |
+
private function _version_updates_handler() {
|
588 |
+
if ( ! isset( $this->_storage->sdk_version ) || $this->_storage->sdk_version != $this->version ) {
|
589 |
+
// Freemius version upgrade mode.
|
590 |
+
$this->_storage->sdk_last_version = $this->_storage->sdk_version;
|
591 |
+
$this->_storage->sdk_version = $this->version;
|
592 |
+
|
593 |
+
if ( empty( $this->_storage->sdk_last_version ) ||
|
594 |
+
version_compare( $this->_storage->sdk_last_version, $this->version, '<' )
|
595 |
+
) {
|
596 |
+
$this->_storage->sdk_upgrade_mode = true;
|
597 |
+
$this->_storage->sdk_downgrade_mode = false;
|
598 |
+
} else {
|
599 |
+
$this->_storage->sdk_downgrade_mode = true;
|
600 |
+
$this->_storage->sdk_upgrade_mode = false;
|
601 |
+
|
602 |
+
}
|
603 |
+
|
604 |
+
$this->do_action( 'sdk_version_update', $this->_storage->sdk_last_version, $this->version );
|
605 |
+
}
|
606 |
+
|
607 |
+
$plugin_version = $this->get_plugin_version();
|
608 |
+
if ( ! isset( $this->_storage->plugin_version ) || $this->_storage->plugin_version != $plugin_version ) {
|
609 |
+
// Plugin version upgrade mode.
|
610 |
+
$this->_storage->plugin_last_version = $this->_storage->plugin_version;
|
611 |
+
$this->_storage->plugin_version = $plugin_version;
|
612 |
+
|
613 |
+
if ( empty( $this->_storage->plugin_last_version ) ||
|
614 |
+
version_compare( $this->_storage->plugin_last_version, $plugin_version, '<' )
|
615 |
+
) {
|
616 |
+
$this->_storage->plugin_upgrade_mode = true;
|
617 |
+
$this->_storage->plugin_downgrade_mode = false;
|
618 |
+
} else {
|
619 |
+
$this->_storage->plugin_downgrade_mode = true;
|
620 |
+
$this->_storage->plugin_upgrade_mode = false;
|
621 |
+
}
|
622 |
+
|
623 |
+
if ( ! empty( $this->_storage->plugin_last_version ) ) {
|
624 |
+
// Different version of the plugin was installed before, therefore it's an update.
|
625 |
+
$this->_storage->is_plugin_new_install = false;
|
626 |
+
}
|
627 |
+
|
628 |
+
$this->do_action( 'plugin_version_update', $this->_storage->plugin_last_version, $plugin_version );
|
629 |
+
}
|
630 |
+
}
|
631 |
+
|
632 |
+
#--------------------------------------------------------------------------------
|
633 |
+
#region Data Migration on SDK Update
|
634 |
+
#--------------------------------------------------------------------------------
|
635 |
+
|
636 |
+
/**
|
637 |
+
* @author Vova Feldman (@svovaf)
|
638 |
+
* @since 1.1.5
|
639 |
+
*
|
640 |
+
* @param string $sdk_prev_version
|
641 |
+
* @param string $sdk_version
|
642 |
+
*/
|
643 |
+
function _data_migration( $sdk_prev_version, $sdk_version ) {
|
644 |
+
/**
|
645 |
+
* @since 1.1.7.3 Fixed unwanted connectivity test cleanup.
|
646 |
+
*/
|
647 |
+
if ( empty( $sdk_prev_version ) ) {
|
648 |
+
return;
|
649 |
+
}
|
650 |
+
|
651 |
+
if ( version_compare( $sdk_prev_version, '2.0.0', '<' ) &&
|
652 |
+
version_compare( $sdk_version, '2.0.0', '>=' )
|
653 |
+
) {
|
654 |
+
$this->migrate_to_subscriptions_collection();
|
655 |
+
|
656 |
+
$this->consolidate_licenses();
|
657 |
+
|
658 |
+
// Clear trial_plan since it's now loaded from the plans collection when needed.
|
659 |
+
$this->_storage->remove( 'trial_plan', true, false );
|
660 |
+
}
|
661 |
+
|
662 |
+
if ( version_compare( $sdk_prev_version, '1.2.3', '<' ) &&
|
663 |
+
version_compare( $sdk_version, '1.2.3', '>=' )
|
664 |
+
) {
|
665 |
+
/**
|
666 |
+
* Starting from version 1.2.3, paths are stored as relative paths and not absolute paths; so when upgrading to 1.2.3, make paths relative.
|
667 |
+
*
|
668 |
+
* @author Leo Fajardo (@leorw)
|
669 |
+
*/
|
670 |
+
$this->make_paths_relative();
|
671 |
+
}
|
672 |
+
|
673 |
+
if ( version_compare( $sdk_prev_version, '1.1.5', '<' ) &&
|
674 |
+
version_compare( $sdk_version, '1.1.5', '>=' )
|
675 |
+
) {
|
676 |
+
// On version 1.1.5 merged connectivity and is_on data.
|
677 |
+
if ( isset( $this->_storage->connectivity_test ) ) {
|
678 |
+
if ( ! isset( $this->_storage->is_on ) ) {
|
679 |
+
unset( $this->_storage->connectivity_test );
|
680 |
+
} else {
|
681 |
+
$connectivity_data = $this->_storage->connectivity_test;
|
682 |
+
$connectivity_data['is_active'] = $this->_storage->is_on['is_active'];
|
683 |
+
$connectivity_data['timestamp'] = $this->_storage->is_on['timestamp'];
|
684 |
+
|
685 |
+
// Override.
|
686 |
+
$this->_storage->connectivity_test = $connectivity_data;
|
687 |
+
|
688 |
+
// Remove previous structure.
|
689 |
+
unset( $this->_storage->is_on );
|
690 |
+
}
|
691 |
+
|
692 |
+
}
|
693 |
+
}
|
694 |
+
}
|
695 |
+
|
696 |
+
/**
|
697 |
+
* @author Leo Fajardo (@leorw)
|
698 |
+
* @since 2.0.0
|
699 |
+
*
|
700 |
+
* @param \FS_Storage $storage
|
701 |
+
* @param bool|int|null $blog_id
|
702 |
+
*/
|
703 |
+
private static function migrate_install_plan_to_plan_id( FS_Storage $storage, $blog_id = null ) {
|
704 |
+
if ( empty( $storage->sdk_version ) ) {
|
705 |
+
// New installation of the plugin, no need to upgrade.
|
706 |
+
return;
|
707 |
+
}
|
708 |
+
|
709 |
+
if ( ! version_compare( $storage->sdk_version, '2.0.0', '<' ) ) {
|
710 |
+
// Previous version is >= 2.0.0, so no need to migrate.
|
711 |
+
return;
|
712 |
+
}
|
713 |
+
|
714 |
+
// Alias.
|
715 |
+
$module_type = $storage->get_module_type();
|
716 |
+
$module_slug = $storage->get_module_slug();
|
717 |
+
|
718 |
+
$installs = self::get_all_sites( $module_type, $blog_id );
|
719 |
+
$install = isset( $installs[ $module_slug ] ) ? $installs[ $module_slug ] : null;
|
720 |
+
|
721 |
+
if ( ! is_object( $install ) ) {
|
722 |
+
return;
|
723 |
+
}
|
724 |
+
|
725 |
+
if ( isset( $install->plan ) && is_object( $install->plan ) ) {
|
726 |
+
if ( isset( $install->plan->id ) && ! empty( $install->plan->id ) ) {
|
727 |
+
$install->plan_id = self::_decrypt( $install->plan->id );
|
728 |
+
}
|
729 |
+
|
730 |
+
unset( $install->plan );
|
731 |
+
|
732 |
+
$installs[ $module_slug ] = clone $install;
|
733 |
+
|
734 |
+
self::set_account_option_by_module(
|
735 |
+
$module_type,
|
736 |
+
'sites',
|
737 |
+
$installs,
|
738 |
+
true,
|
739 |
+
$blog_id
|
740 |
+
);
|
741 |
+
}
|
742 |
+
}
|
743 |
+
|
744 |
+
/**
|
745 |
+
* @author Leo Fajardo (@leorw)
|
746 |
+
* @since 2.0.0
|
747 |
+
*/
|
748 |
+
private function migrate_to_subscriptions_collection() {
|
749 |
+
if ( ! is_object( $this->_site ) ) {
|
750 |
+
return;
|
751 |
+
}
|
752 |
+
|
753 |
+
if ( isset( $this->_storage->subscription ) && is_object( $this->_storage->subscription ) ) {
|
754 |
+
$this->_storage->subscriptions = array( $this->_storage->subscription );
|
755 |
+
}
|
756 |
+
}
|
757 |
+
|
758 |
+
/**
|
759 |
+
* @author Leo Fajardo (@leorw)
|
760 |
+
* @since 2.0.0
|
761 |
+
*/
|
762 |
+
private function consolidate_licenses() {
|
763 |
+
$plugin_licenses = self::get_account_option( 'licenses', WP_FS__MODULE_TYPE_PLUGIN );
|
764 |
+
if ( isset( $plugin_licenses[ $this->_slug ] ) ) {
|
765 |
+
$plugin_licenses = $plugin_licenses[ $this->_slug ];
|
766 |
+
} else {
|
767 |
+
$plugin_licenses = array();
|
768 |
+
}
|
769 |
+
|
770 |
+
$theme_licenses = self::get_account_option( 'licenses', WP_FS__MODULE_TYPE_THEME );
|
771 |
+
if ( isset( $theme_licenses[ $this->_slug ] ) ) {
|
772 |
+
$theme_licenses = $theme_licenses[ $this->_slug ];
|
773 |
+
} else {
|
774 |
+
$theme_licenses = array();
|
775 |
+
}
|
776 |
+
|
777 |
+
if ( empty( $plugin_licenses ) && empty( $theme_licenses ) ) {
|
778 |
+
return;
|
779 |
+
}
|
780 |
+
|
781 |
+
$all_licenses = array();
|
782 |
+
$user_id_license_ids_map = array();
|
783 |
+
|
784 |
+
foreach ( $plugin_licenses as $user_id => $user_licenses ) {
|
785 |
+
if ( is_array( $user_licenses ) ) {
|
786 |
+
if ( ! isset( $user_license_ids[ $user_id ] ) ) {
|
787 |
+
$user_id_license_ids_map[ $user_id ] = array();
|
788 |
+
}
|
789 |
+
|
790 |
+
foreach ( $user_licenses as $user_license ) {
|
791 |
+
$all_licenses[] = $user_license;
|
792 |
+
$user_id_license_ids_map[ $user_id ][] = $user_license->id;
|
793 |
+
}
|
794 |
+
}
|
795 |
+
}
|
796 |
+
|
797 |
+
foreach ( $theme_licenses as $user_id => $user_licenses ) {
|
798 |
+
if ( is_array( $user_licenses ) ) {
|
799 |
+
if ( ! isset( $user_license_ids[ $user_id ] ) ) {
|
800 |
+
$user_id_license_ids_map[ $user_id ] = array();
|
801 |
+
}
|
802 |
+
|
803 |
+
foreach ( $user_licenses as $user_license ) {
|
804 |
+
$all_licenses[] = $user_license;
|
805 |
+
$user_id_license_ids_map[ $user_id ][] = $user_license->id;
|
806 |
+
}
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
self::store_user_id_license_ids_map(
|
811 |
+
$user_id_license_ids_map,
|
812 |
+
$this->_module_id
|
813 |
+
);
|
814 |
+
|
815 |
+
$this->_store_licenses( true, $this->_module_id, $all_licenses );
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Makes paths relative.
|
820 |
+
*
|
821 |
+
* @author Leo Fajardo (@leorw)
|
822 |
+
* @since 1.2.3
|
823 |
+
*/
|
824 |
+
private function make_paths_relative() {
|
825 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
|
826 |
+
|
827 |
+
if ( isset( $id_slug_type_path_map[ $this->_module_id ]['path'] ) ) {
|
828 |
+
$id_slug_type_path_map[ $this->_module_id ]['path'] = $this->get_relative_path( $id_slug_type_path_map[ $this->_module_id ]['path'] );
|
829 |
+
|
830 |
+
self::$_accounts->set_option( 'id_slug_type_path_map', $id_slug_type_path_map, true );
|
831 |
+
}
|
832 |
+
|
833 |
+
if ( isset( $this->_storage->plugin_main_file ) ) {
|
834 |
+
$plugin_main_file = $this->_storage->plugin_main_file;
|
835 |
+
|
836 |
+
if ( isset( $plugin_main_file->path ) ) {
|
837 |
+
$this->_storage->plugin_main_file->path = $this->get_relative_path( $this->_storage->plugin_main_file->path );
|
838 |
+
} else if ( isset( $plugin_main_file->prev_path ) ) {
|
839 |
+
$this->_storage->plugin_main_file->prev_path = $this->get_relative_path( $this->_storage->plugin_main_file->prev_path );
|
840 |
+
}
|
841 |
+
}
|
842 |
+
|
843 |
+
// Remove invalid path that is still associated with the current slug if there's any.
|
844 |
+
$file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
|
845 |
+
foreach ( $file_slug_map as $plugin_basename => $slug ) {
|
846 |
+
if ( $slug === $this->_slug &&
|
847 |
+
$plugin_basename !== $this->_plugin_basename &&
|
848 |
+
! file_exists( $this->get_absolute_path( $plugin_basename ) )
|
849 |
+
) {
|
850 |
+
unset( $file_slug_map[ $plugin_basename ] );
|
851 |
+
self::$_accounts->set_option( 'file_slug_map', $file_slug_map, true );
|
852 |
+
|
853 |
+
break;
|
854 |
+
}
|
855 |
+
}
|
856 |
+
}
|
857 |
+
|
858 |
+
/**
|
859 |
+
* @author Vova Feldman (@svovaf)
|
860 |
+
* @since 1.2.2.7
|
861 |
+
*
|
862 |
+
* @param string $plugin_prev_version
|
863 |
+
* @param string $plugin_version
|
864 |
+
*/
|
865 |
+
function _after_version_update( $plugin_prev_version, $plugin_version ) {
|
866 |
+
if ( $this->is_theme() ) {
|
867 |
+
// Expire the cache of the previous tabs since the theme may
|
868 |
+
// have setting updates.
|
869 |
+
$this->_cache->expire( 'tabs' );
|
870 |
+
$this->_cache->expire( 'tabs_stylesheets' );
|
871 |
+
}
|
872 |
+
}
|
873 |
+
|
874 |
+
/**
|
875 |
+
* A special migration logic for the $_accounts, executed for all the plugins in the system:
|
876 |
+
* - Moves some data to the network level storage.
|
877 |
+
* - If the plugin's connection was skipped for all sites, set the plugin as if it was network skipped.
|
878 |
+
* - If the plugin's connection was ignored for all sites, don't do anything in terms of the network connection.
|
879 |
+
* - If the plugin was connected to all sites by the same super-admin, set the plugin as if was network opted-in for all sites.
|
880 |
+
* - If there's at least one site that was connected by a super-admin, find the "main super-admin" (the one that installed the majority of the plugin installs) and set the plugin as if was network activated with the main super-admin, set all the sites that were skipped or opted-in with a different user to delegated mode. Then, prompt the currently logged super-admin to choose what to do with the ignored sites.
|
881 |
+
* - If there are any sites in the network which the connection decision was not yet taken for, set this plugin into network activation mode so a super-admin can choose what to do with the rest of the sites.
|
882 |
+
*
|
883 |
+
* @author Vova Feldman (@svovaf)
|
884 |
+
* @since 2.0.0
|
885 |
+
*/
|
886 |
+
private static function migrate_accounts_to_network() {
|
887 |
+
$sites = self::get_sites();
|
888 |
+
$sites_count = count( $sites );
|
889 |
+
$connection_status = array();
|
890 |
+
$plugin_slugs = array();
|
891 |
+
foreach ( $sites as $site ) {
|
892 |
+
$blog_id = self::get_site_blog_id( $site );
|
893 |
+
|
894 |
+
self::$_accounts->migrate_to_network( $blog_id );
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Build a list of all Freemius powered plugins slugs.
|
898 |
+
*/
|
899 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array(), $blog_id );
|
900 |
+
foreach ( $id_slug_type_path_map as $module_id => $data ) {
|
901 |
+
if ( WP_FS__MODULE_TYPE_PLUGIN === $data['type'] ) {
|
902 |
+
$plugin_slugs[ $data['slug'] ] = true;
|
903 |
+
}
|
904 |
+
}
|
905 |
+
|
906 |
+
$installs = self::get_account_option( 'sites', WP_FS__MODULE_TYPE_PLUGIN, $blog_id );
|
907 |
+
|
908 |
+
if ( is_array( $installs ) ) {
|
909 |
+
foreach ( $installs as $slug => $install ) {
|
910 |
+
if ( ! isset( $connection_status[ $slug ] ) ) {
|
911 |
+
$connection_status[ $slug ] = array();
|
912 |
+
}
|
913 |
+
|
914 |
+
if ( is_object( $install ) &&
|
915 |
+
FS_Site::is_valid_id( $install->id ) &&
|
916 |
+
FS_User::is_valid_id( $install->user_id )
|
917 |
+
) {
|
918 |
+
$connection_status[ $slug ][ $blog_id ] = $install->user_id;
|
919 |
+
}
|
920 |
+
}
|
921 |
+
}
|
922 |
+
}
|
923 |
+
|
924 |
+
foreach ( $plugin_slugs as $slug => $true ) {
|
925 |
+
if ( ! isset( $connection_status[ $slug ] ) ) {
|
926 |
+
$connection_status[ $slug ] = array();
|
927 |
+
}
|
928 |
+
|
929 |
+
foreach ( $sites as $site ) {
|
930 |
+
$blog_id = self::get_site_blog_id( $site );
|
931 |
+
|
932 |
+
if ( isset( $connection_status[ $slug ][ $blog_id ] ) ) {
|
933 |
+
continue;
|
934 |
+
}
|
935 |
+
|
936 |
+
$storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
|
937 |
+
|
938 |
+
$is_anonymous = $storage->get( 'is_anonymous', null, $blog_id );
|
939 |
+
|
940 |
+
if ( ! is_null( $is_anonymous ) ) {
|
941 |
+
// Since 1.1.3 is_anonymous is an array.
|
942 |
+
if ( is_array( $is_anonymous ) && isset( $is_anonymous['is'] ) ) {
|
943 |
+
$is_anonymous = $is_anonymous['is'];
|
944 |
+
}
|
945 |
+
|
946 |
+
if ( is_bool( $is_anonymous ) && true === $is_anonymous ) {
|
947 |
+
$connection_status[ $slug ][ $blog_id ] = 'skipped';
|
948 |
+
}
|
949 |
+
}
|
950 |
+
|
951 |
+
if ( ! isset( $connection_status[ $slug ][ $blog_id ] ) ) {
|
952 |
+
$connection_status[ $slug ][ $blog_id ] = 'ignored';
|
953 |
+
}
|
954 |
+
}
|
955 |
+
}
|
956 |
+
|
957 |
+
$super_admins = array();
|
958 |
+
|
959 |
+
foreach ( $connection_status as $slug => $blogs_status ) {
|
960 |
+
$skips = 0;
|
961 |
+
$ignores = 0;
|
962 |
+
$connections = 0;
|
963 |
+
$opted_in_users = array();
|
964 |
+
$opted_in_super_admins = array();
|
965 |
+
|
966 |
+
$storage = FS_Storage::instance( WP_FS__MODULE_TYPE_PLUGIN, $slug );
|
967 |
+
|
968 |
+
foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
|
969 |
+
if ( 'skipped' === $status_or_user_id ) {
|
970 |
+
$skips ++;
|
971 |
+
} else if ( 'ignored' === $status_or_user_id ) {
|
972 |
+
$ignores ++;
|
973 |
+
} else if ( FS_User::is_valid_id( $status_or_user_id ) ) {
|
974 |
+
$connections ++;
|
975 |
+
|
976 |
+
if ( ! isset( $opted_in_users[ $status_or_user_id ] ) ) {
|
977 |
+
$opted_in_users[ $status_or_user_id ] = array();
|
978 |
+
}
|
979 |
+
|
980 |
+
$opted_in_users[ $status_or_user_id ][] = $blog_id;
|
981 |
+
|
982 |
+
if ( isset( $super_admins[ $status_or_user_id ] ) ||
|
983 |
+
self::is_super_admin( $status_or_user_id )
|
984 |
+
) {
|
985 |
+
// Cache super-admin data.
|
986 |
+
$super_admins[ $status_or_user_id ] = true;
|
987 |
+
|
988 |
+
// Remember opted-in super-admins for the plugin.
|
989 |
+
$opted_in_super_admins[ $status_or_user_id ] = true;
|
990 |
+
}
|
991 |
+
}
|
992 |
+
}
|
993 |
+
|
994 |
+
$main_super_admin_user_id = null;
|
995 |
+
$all_migrated = false;
|
996 |
+
if ( $sites_count == $skips ) {
|
997 |
+
// All sites were skipped -> network skip by copying the anonymous mode from any of the sites.
|
998 |
+
$storage->is_anonymous_ms = $storage->is_anonymous;
|
999 |
+
|
1000 |
+
$all_migrated = true;
|
1001 |
+
} else if ( $sites_count == $ignores ) {
|
1002 |
+
// Don't do anything, still in activation mode.
|
1003 |
+
|
1004 |
+
$all_migrated = true;
|
1005 |
+
} else if ( 0 < count( $opted_in_super_admins ) ) {
|
1006 |
+
// Find the super-admin with the majority of installs.
|
1007 |
+
$max_installs_by_super_admin = 0;
|
1008 |
+
foreach ( $opted_in_super_admins as $user_id => $true ) {
|
1009 |
+
$installs_count = count( $opted_in_users[ $user_id ] );
|
1010 |
+
|
1011 |
+
if ( $installs_count > $max_installs_by_super_admin ) {
|
1012 |
+
$max_installs_by_super_admin = $installs_count;
|
1013 |
+
$main_super_admin_user_id = $user_id;
|
1014 |
+
}
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
if ( $sites_count == $connections && 1 == count( $opted_in_super_admins ) ) {
|
1018 |
+
// Super-admin opted-in for all sites in the network.
|
1019 |
+
$storage->is_network_connected = true;
|
1020 |
+
|
1021 |
+
$all_migrated = true;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
// Store network user.
|
1025 |
+
$storage->network_user_id = $main_super_admin_user_id;
|
1026 |
+
|
1027 |
+
$storage->network_install_blog_id = ( $sites_count == $connections ) ?
|
1028 |
+
// Since all sites are opted-in, associating with the main site.
|
1029 |
+
get_current_blog_id() :
|
1030 |
+
// Associating with the 1st found opted-in site.
|
1031 |
+
$opted_in_users[ $main_super_admin_user_id ][0];
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* Make sure we migrate the plan ID of the network install, otherwise, if after the migration
|
1035 |
+
* the 1st page that will be loaded is the network level WP Admin and $storage->network_install_blog_id
|
1036 |
+
* is different than the main site of the network, the $this->_site will not be set since the plan_id
|
1037 |
+
* will be empty.
|
1038 |
+
*/
|
1039 |
+
$storage->migrate_to_network();
|
1040 |
+
self::migrate_install_plan_to_plan_id( $storage, $storage->network_install_blog_id );
|
1041 |
+
} else {
|
1042 |
+
// At least one opt-in. All the opt-in were created by a non-super-admin.
|
1043 |
+
if ( 0 == $ignores ) {
|
1044 |
+
// All sites were opted-in or skipped, all by non-super-admin. So delegate all.
|
1045 |
+
$storage->store( 'is_delegated_connection', true, true );
|
1046 |
+
|
1047 |
+
$all_migrated = true;
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
if ( ! $all_migrated ) {
|
1052 |
+
/**
|
1053 |
+
* Delegate all sites that were:
|
1054 |
+
* 1) Opted-in by a user that is NOT the main-super-admin.
|
1055 |
+
* 2) Skipped and non of the sites was opted-in by a super-admin. If any site was opted-in by a super-admin, there will be a main-super-admin, and we consider the skip as if it was done by that user.
|
1056 |
+
*/
|
1057 |
+
foreach ( $blogs_status as $blog_id => $status_or_user_id ) {
|
1058 |
+
if ( $status_or_user_id == $main_super_admin_user_id ) {
|
1059 |
+
continue;
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
if ( FS_User::is_valid_id( $status_or_user_id ) ||
|
1063 |
+
( 'skipped' === $status_or_user_id && is_null( $main_super_admin_user_id ) )
|
1064 |
+
) {
|
1065 |
+
$storage->store( 'is_delegated_connection', true, $blog_id );
|
1066 |
+
}
|
1067 |
+
}
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
|
1071 |
+
if ( ( $connections + $skips > 0 ) ) {
|
1072 |
+
if ( $ignores > 0 ) {
|
1073 |
+
/**
|
1074 |
+
* If admin already opted-in or skipped in any of the network sites, and also
|
1075 |
+
* have sites which the connection decision was not yet taken, set this plugin
|
1076 |
+
* into network activation mode so the super-admin can choose what to do with
|
1077 |
+
* the rest of the sites.
|
1078 |
+
*/
|
1079 |
+
self::set_network_upgrade_mode( $storage );
|
1080 |
+
}
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* Set a module into network upgrade mode.
|
1087 |
+
*
|
1088 |
+
* @author Vova Feldman (@svovaf)
|
1089 |
+
* @since 2.0.0
|
1090 |
+
*
|
1091 |
+
* @param \FS_Storage $storage
|
1092 |
+
*
|
1093 |
+
* @return bool
|
1094 |
+
*/
|
1095 |
+
private static function set_network_upgrade_mode( FS_Storage $storage ) {
|
1096 |
+
return $storage->is_network_activation = true;
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
/**
|
1100 |
+
* Will return true after upgrading to the SDK with the network level integration,
|
1101 |
+
* when the super-admin involvement is required regarding the rest of the sites.
|
1102 |
+
*
|
1103 |
+
* @author Vova Feldman (@svovaf)
|
1104 |
+
* @since 2.0.0
|
1105 |
+
*
|
1106 |
+
* @return bool
|
1107 |
+
*/
|
1108 |
+
function is_network_upgrade_mode() {
|
1109 |
+
return $this->_storage->get( 'is_network_activation' );
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Clear flag after the upgrade mode completion.
|
1114 |
+
*
|
1115 |
+
* @author Vova Feldman (@svovaf)
|
1116 |
+
* @since 2.0.0
|
1117 |
+
*
|
1118 |
+
* @return bool True if network activation was on and now completed.
|
1119 |
+
*/
|
1120 |
+
private function network_upgrade_mode_completed() {
|
1121 |
+
if ( fs_is_network_admin() && $this->is_network_upgrade_mode() ) {
|
1122 |
+
$this->_storage->remove( 'is_network_activation' );
|
1123 |
+
|
1124 |
+
return true;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
return false;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
#endregion
|
1131 |
+
|
1132 |
+
/**
|
1133 |
+
* This action is connected to the 'plugins_loaded' hook and helps to determine
|
1134 |
+
* if this is a new plugin installation or a plugin update.
|
1135 |
+
*
|
1136 |
+
* There are 3 different use-cases:
|
1137 |
+
* 1) New plugin installation right with Freemius:
|
1138 |
+
* 1.1 _activate_plugin_event_hook() will be executed first
|
1139 |
+
* 1.2 Since $this->_storage->is_plugin_new_install is not set,
|
1140 |
+
* and $this->_storage->plugin_last_version is not set,
|
1141 |
+
* $this->_storage->is_plugin_new_install will be set to TRUE.
|
1142 |
+
* 1.3 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
|
1143 |
+
* be already set to TRUE.
|
1144 |
+
*
|
1145 |
+
* 2) Plugin update, didn't have Freemius before, and now have the SDK:
|
1146 |
+
* 2.1 _activate_plugin_event_hook() will not be executed, because
|
1147 |
+
* the activation hook do NOT fires on updates since WP 3.1.
|
1148 |
+
* 2.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
|
1149 |
+
* be empty, therefore, it will be set to FALSE.
|
1150 |
+
*
|
1151 |
+
* 3) Plugin update, had Freemius in prev version as well:
|
1152 |
+
* 3.1 _version_updates_handler() will be executed 1st, since FS was installed
|
1153 |
+
* before, $this->_storage->plugin_last_version will NOT be empty,
|
1154 |
+
* therefore, $this->_storage->is_plugin_new_install will be set to FALSE.
|
1155 |
+
* 3.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install is
|
1156 |
+
* already set, therefore, it will not be modified.
|
1157 |
+
*
|
1158 |
+
* Use-case #3 is backward compatible, #3.1 will be executed since 1.0.9.
|
1159 |
+
*
|
1160 |
+
* NOTE:
|
1161 |
+
* The only fallback of this mechanism is if an admin updates a plugin based on use-case #2,
|
1162 |
+
* and then, the next immediate PageView is the plugin's main settings page, it will not
|
1163 |
+
* show the opt-in right away. The reason it will happen is because Freemius execution
|
1164 |
+
* will be turned off till the plugin is fully loaded at least once
|
1165 |
+
* (till $this->_storage->was_plugin_loaded is TRUE).
|
1166 |
+
*
|
1167 |
+
* @author Vova Feldman (@svovaf)
|
1168 |
+
* @since 1.1.9
|
1169 |
+
*
|
1170 |
+
*/
|
1171 |
+
function _plugins_loaded() {
|
1172 |
+
// Update flag that plugin was loaded with Freemius at least once.
|
1173 |
+
$this->_storage->was_plugin_loaded = true;
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Bug fix - only set to false when it's a plugin, due to the
|
1177 |
+
* execution sequence of the theme hooks and our methods, if
|
1178 |
+
* this will be set for themes, Freemius will always assume
|
1179 |
+
* it's a theme update.
|
1180 |
+
*
|
1181 |
+
* @author Vova Feldman (@svovaf)
|
1182 |
+
* @since 1.2.2.2
|
1183 |
+
*/
|
1184 |
+
if ( $this->is_plugin() &&
|
1185 |
+
! isset( $this->_storage->is_plugin_new_install )
|
1186 |
+
) {
|
1187 |
+
$this->_storage->is_plugin_new_install = false;
|
1188 |
+
}
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
/**
|
1192 |
+
* Add special parameter to WP admin AJAX calls so when we
|
1193 |
+
* process AJAX calls we can identify its source properly.
|
1194 |
+
*
|
1195 |
+
* @author Leo Fajardo (@leorw)
|
1196 |
+
* @since 2.0.0
|
1197 |
+
*/
|
1198 |
+
static function _enrich_ajax_url() {
|
1199 |
+
$admin_param = is_network_admin() ?
|
1200 |
+
'_fs_network_admin' :
|
1201 |
+
'_fs_blog_admin';
|
1202 |
+
?>
|
1203 |
+
<script type="text/javascript">
|
1204 |
+
(function ($) {
|
1205 |
+
$(document).ajaxSend(function (event, jqxhr, settings) {
|
1206 |
+
if (settings.url &&
|
1207 |
+
-1 < settings.url.indexOf('admin-ajax.php') &&
|
1208 |
+
! ( settings.url.indexOf( '<?php echo $admin_param ?>' ) > 0 )
|
1209 |
+
) {
|
1210 |
+
if (settings.url.indexOf('?') > 0) {
|
1211 |
+
settings.url += '&';
|
1212 |
+
} else {
|
1213 |
+
settings.url += '?';
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
settings.url += '<?php echo $admin_param ?>=true';
|
1217 |
+
|
1218 |
+
}
|
1219 |
+
});
|
1220 |
+
})(jQuery);
|
1221 |
+
</script>
|
1222 |
+
<?php
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
/**
|
1226 |
+
* @author Vova Feldman (@svovaf)
|
1227 |
+
* @since 1.0.9
|
1228 |
+
*/
|
1229 |
+
private function _register_hooks() {
|
1230 |
+
$this->_logger->entrance();
|
1231 |
+
|
1232 |
+
if ( is_admin() ) {
|
1233 |
+
add_action( 'plugins_loaded', array( &$this, '_hook_action_links_and_register_account_hooks' ) );
|
1234 |
+
|
1235 |
+
if ( $this->is_plugin() ) {
|
1236 |
+
$plugin_dir = dirname( $this->_plugin_dir_path ) . '/';
|
1237 |
+
|
1238 |
+
/**
|
1239 |
+
* @since 1.2.2
|
1240 |
+
*
|
1241 |
+
* Hook to both free and premium version activations to support
|
1242 |
+
* auto deactivation on the other version activation.
|
1243 |
+
*/
|
1244 |
+
register_activation_hook(
|
1245 |
+
$plugin_dir . $this->_free_plugin_basename,
|
1246 |
+
array( &$this, '_activate_plugin_event_hook' )
|
1247 |
+
);
|
1248 |
+
|
1249 |
+
register_activation_hook(
|
1250 |
+
$plugin_dir . $this->premium_plugin_basename(),
|
1251 |
+
array( &$this, '_activate_plugin_event_hook' )
|
1252 |
+
);
|
1253 |
+
} else {
|
1254 |
+
add_action( 'after_switch_theme', array( &$this, '_activate_theme_event_hook' ), 10, 2 );
|
1255 |
+
|
1256 |
+
/**
|
1257 |
+
* Include the required hooks to capture the theme settings' page tabs
|
1258 |
+
* and cache them.
|
1259 |
+
*
|
1260 |
+
* @author Vova Feldman (@svovaf)
|
1261 |
+
* @since 1.2.2.7
|
1262 |
+
*/
|
1263 |
+
if ( ! $this->_cache->has_valid( 'tabs' ) ) {
|
1264 |
+
add_action( 'admin_footer', array( &$this, '_tabs_capture' ) );
|
1265 |
+
// Add license activation AJAX callback.
|
1266 |
+
$this->add_ajax_action( 'store_tabs', array( &$this, '_store_tabs_ajax_action' ) );
|
1267 |
+
|
1268 |
+
add_action( 'admin_enqueue_scripts', array( &$this, '_store_tabs_styles' ), 9999999 );
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
add_action(
|
1272 |
+
'admin_footer',
|
1273 |
+
array( &$this, '_add_freemius_tabs' ),
|
1274 |
+
/**
|
1275 |
+
* The tabs JS code must be executed after the tabs capture logic (_tabs_capture()).
|
1276 |
+
* That's why the priority is 11 while the tabs capture logic is added
|
1277 |
+
* with priority 10.
|
1278 |
+
*
|
1279 |
+
* @author Vova Feldman (@svovaf)
|
1280 |
+
*/
|
1281 |
+
11
|
1282 |
+
);
|
1283 |
+
|
1284 |
+
add_action( 'admin_footer', array( &$this, '_style_premium_theme' ) );
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
/**
|
1288 |
+
* Part of the mechanism to identify new plugin install vs. plugin update.
|
1289 |
+
*
|
1290 |
+
* @author Vova Feldman (@svovaf)
|
1291 |
+
* @since 1.1.9
|
1292 |
+
*/
|
1293 |
+
if ( empty( $this->_storage->was_plugin_loaded ) ) {
|
1294 |
+
/**
|
1295 |
+
* During the plugin activation (not theme), 'plugins_loaded' will be already executed
|
1296 |
+
* when the logic gets here since the activation logic first add the activate plugins,
|
1297 |
+
* then triggers 'plugins_loaded', and only then include the code of the plugin that
|
1298 |
+
* is activated. Which means that _plugins_loaded() will NOT be executed during the
|
1299 |
+
* plugin activation, and that IS intentional.
|
1300 |
+
*
|
1301 |
+
* @author Vova Feldman (@svovaf)
|
1302 |
+
*/
|
1303 |
+
if ( $this->is_plugin() && $this->is_activation_mode( false ) ) {
|
1304 |
+
add_action( 'plugins_loaded', array( &$this, '_plugins_loaded' ) );
|
1305 |
+
} else {
|
1306 |
+
// If was activated before, then it was already loaded before.
|
1307 |
+
$this->_plugins_loaded();
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
if ( ! self::is_ajax() ) {
|
1312 |
+
if ( ! $this->is_addon() ) {
|
1313 |
+
add_action( 'init', array( &$this, '_add_default_submenu_items' ), WP_FS__LOWEST_PRIORITY );
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
if ( $this->is_plugin() ) {
|
1319 |
+
if ( $this->_is_network_active ) {
|
1320 |
+
add_action( 'wpmu_new_blog', array( $this, '_after_new_blog_callback' ), 10, 6 );
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
register_deactivation_hook( $this->_plugin_main_file_path, array( &$this, '_deactivate_plugin_hook' ) );
|
1324 |
+
}
|
1325 |
+
|
1326 |
+
if ( is_multisite() ) {
|
1327 |
+
add_action( 'deactivate_blog', array( &$this, '_after_site_deactivated_callback' ) );
|
1328 |
+
add_action( 'archive_blog', array( &$this, '_after_site_deactivated_callback' ) );
|
1329 |
+
add_action( 'make_spam_blog', array( &$this, '_after_site_deactivated_callback' ) );
|
1330 |
+
add_action( 'deleted_blog', array( &$this, '_after_site_deleted_callback' ), 10, 2 );
|
1331 |
+
|
1332 |
+
add_action( 'activate_blog', array( &$this, '_after_site_reactivated_callback' ) );
|
1333 |
+
add_action( 'unarchive_blog', array( &$this, '_after_site_reactivated_callback' ) );
|
1334 |
+
add_action( 'make_ham_blog', array( &$this, '_after_site_reactivated_callback' ) );
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
if ( $this->is_theme() && self::is_customizer() ) {
|
1338 |
+
// Register customizer upsell.
|
1339 |
+
add_action( 'customize_register', array( &$this, '_customizer_register' ) );
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
add_action( 'init', array( &$this, '_redirect_on_clicked_menu_link' ), WP_FS__LOWEST_PRIORITY );
|
1343 |
+
|
1344 |
+
if ( $this->is_theme() ) {
|
1345 |
+
add_action( 'admin_init', array( &$this, '_add_tracking_links' ) );
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
add_action( 'admin_init', array( &$this, '_add_license_activation' ) );
|
1349 |
+
$this->add_ajax_action( 'update_billing', array( &$this, '_update_billing_ajax_action' ) );
|
1350 |
+
$this->add_ajax_action( 'start_trial', array( &$this, '_start_trial_ajax_action' ) );
|
1351 |
+
|
1352 |
+
if ( $this->_is_network_active && fs_is_network_admin() ) {
|
1353 |
+
$this->add_ajax_action( 'network_activate', array( &$this, '_network_activate_ajax_action' ) );
|
1354 |
+
}
|
1355 |
+
|
1356 |
+
$this->add_ajax_action( 'install_premium_version', array(
|
1357 |
+
&$this,
|
1358 |
+
'_install_premium_version_ajax_action'
|
1359 |
+
) );
|
1360 |
+
|
1361 |
+
$this->add_ajax_action( 'submit_affiliate_application', array( &$this, '_submit_affiliate_application' ) );
|
1362 |
+
|
1363 |
+
$this->add_action( 'after_plans_sync', array( &$this, '_check_for_trial_plans' ) );
|
1364 |
+
|
1365 |
+
$this->add_action( 'sdk_version_update', array( &$this, '_data_migration' ), WP_FS__DEFAULT_PRIORITY, 2 );
|
1366 |
+
$this->add_action(
|
1367 |
+
'plugin_version_update',
|
1368 |
+
array( &$this, '_after_version_update' ),
|
1369 |
+
WP_FS__DEFAULT_PRIORITY,
|
1370 |
+
2
|
1371 |
+
);
|
1372 |
+
$this->add_filter( 'after_code_type_change', array( &$this, '_after_code_type_change' ) );
|
1373 |
+
|
1374 |
+
add_action( 'admin_init', array( &$this, '_add_trial_notice' ) );
|
1375 |
+
add_action( 'admin_init', array( &$this, '_add_affiliate_program_notice' ) );
|
1376 |
+
add_action( 'admin_init', array( &$this, '_enqueue_common_css' ) );
|
1377 |
+
|
1378 |
+
/**
|
1379 |
+
* Handle request to reset anonymous mode for `get_reconnect_url()`.
|
1380 |
+
*
|
1381 |
+
* @author Vova Feldman (@svovaf)
|
1382 |
+
* @since 1.2.1.5
|
1383 |
+
*/
|
1384 |
+
if ( fs_request_is_action( 'reset_anonymous_mode' ) &&
|
1385 |
+
$this->get_unique_affix() === fs_request_get( 'fs_unique_affix' )
|
1386 |
+
) {
|
1387 |
+
add_action( 'admin_init', array( &$this, 'connect_again' ) );
|
1388 |
+
}
|
1389 |
+
}
|
1390 |
+
|
1391 |
+
/**
|
1392 |
+
* Keeping the uninstall hook registered for free or premium plugin version may result to a fatal error that
|
1393 |
+
* could happen when a user tries to uninstall either version while one of them is still active. Uninstalling a
|
1394 |
+
* plugin will trigger inclusion of the free or premium version and if one of them is active during the
|
1395 |
+
* uninstallation, a fatal error may occur in case the plugin's class or functions are already defined.
|
1396 |
+
*
|
1397 |
+
* @author Leo Fajardo (@leorw)
|
1398 |
+
*
|
1399 |
+
* @since 1.2.0
|
1400 |
+
*/
|
1401 |
+
private function unregister_uninstall_hook() {
|
1402 |
+
$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
|
1403 |
+
unset( $uninstallable_plugins[ $this->_free_plugin_basename ] );
|
1404 |
+
unset( $uninstallable_plugins[ $this->premium_plugin_basename() ] );
|
1405 |
+
|
1406 |
+
update_option( 'uninstall_plugins', $uninstallable_plugins );
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
/**
|
1410 |
+
* @since 1.2.0 Invalidate module's main file cache, otherwise, FS_Plugin_Updater will not fetch updates.
|
1411 |
+
*/
|
1412 |
+
private function clear_module_main_file_cache() {
|
1413 |
+
if ( ! isset( $this->_storage->plugin_main_file ) ||
|
1414 |
+
empty( $this->_storage->plugin_main_file->path )
|
1415 |
+
) {
|
1416 |
+
return;
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
$plugin_main_file = clone $this->_storage->plugin_main_file;
|
1420 |
+
|
1421 |
+
// Store cached path (2nd layer cache).
|
1422 |
+
$plugin_main_file->prev_path = $plugin_main_file->path;
|
1423 |
+
|
1424 |
+
// Clear cached path.
|
1425 |
+
unset( $plugin_main_file->path );
|
1426 |
+
|
1427 |
+
$this->_storage->plugin_main_file = $plugin_main_file;
|
1428 |
+
|
1429 |
+
/**
|
1430 |
+
* Clear global cached path.
|
1431 |
+
*
|
1432 |
+
* @author Leo Fajardo (@leorw)
|
1433 |
+
* @since 1.2.2
|
1434 |
+
*/
|
1435 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map' );
|
1436 |
+
unset( $id_slug_type_path_map[ $this->_module_id ]['path'] );
|
1437 |
+
self::$_accounts->set_option( 'id_slug_type_path_map', $id_slug_type_path_map, true );
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
/**
|
1441 |
+
* @author Leo Fajardo (@leorw)
|
1442 |
+
* @since 2.0.0
|
1443 |
+
*/
|
1444 |
+
function _hook_action_links_and_register_account_hooks() {
|
1445 |
+
add_action( 'admin_init', array( &$this, '_add_tracking_links' ) );
|
1446 |
+
|
1447 |
+
if ( self::is_plugins_page() && $this->is_plugin() ) {
|
1448 |
+
$this->hook_plugin_action_links();
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
$this->_register_account_hooks();
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
/**
|
1455 |
+
* @author Vova Feldman (@svovaf)
|
1456 |
+
* @since 1.0.9
|
1457 |
+
*/
|
1458 |
+
private function _register_account_hooks() {
|
1459 |
+
if ( ! is_admin() ) {
|
1460 |
+
return;
|
1461 |
+
}
|
1462 |
+
|
1463 |
+
/**
|
1464 |
+
* Always show the deactivation feedback form since we added
|
1465 |
+
* automatic free version deactivation upon premium code activation.
|
1466 |
+
*
|
1467 |
+
* @since 1.2.1.6
|
1468 |
+
*/
|
1469 |
+
$this->add_ajax_action(
|
1470 |
+
'submit_uninstall_reason',
|
1471 |
+
array( &$this, '_submit_uninstall_reason_action' )
|
1472 |
+
);
|
1473 |
+
|
1474 |
+
if ( ! $this->is_addon() || $this->is_parent_plugin_installed() ) {
|
1475 |
+
if ( ( $this->is_plugin() && self::is_plugins_page() ) ||
|
1476 |
+
( $this->is_theme() && self::is_themes_page() )
|
1477 |
+
) {
|
1478 |
+
add_action( 'admin_footer', array( &$this, '_add_deactivation_feedback_dialog_box' ) );
|
1479 |
+
}
|
1480 |
+
}
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* Leverage backtrace to find caller plugin file path.
|
1485 |
+
*
|
1486 |
+
* @author Vova Feldman (@svovaf)
|
1487 |
+
* @since 1.0.6
|
1488 |
+
*
|
1489 |
+
* @param bool $is_init Is initiation sequence.
|
1490 |
+
*
|
1491 |
+
* @return string
|
1492 |
+
*/
|
1493 |
+
private function _find_caller_plugin_file( $is_init = false ) {
|
1494 |
+
// Try to load the cached value of the file path.
|
1495 |
+
if ( isset( $this->_storage->plugin_main_file ) ) {
|
1496 |
+
$plugin_main_file = $this->_storage->plugin_main_file;
|
1497 |
+
if ( isset( $plugin_main_file->path ) ) {
|
1498 |
+
$absolute_path = $this->get_absolute_path( $plugin_main_file->path );
|
1499 |
+
if ( file_exists( $absolute_path ) ) {
|
1500 |
+
return $absolute_path;
|
1501 |
+
}
|
1502 |
+
}
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
/**
|
1506 |
+
* @since 1.2.1
|
1507 |
+
*
|
1508 |
+
* `clear_module_main_file_cache()` is clearing the plugin's cached path on
|
1509 |
+
* deactivation. Therefore, if any plugin/theme was initiating `Freemius`
|
1510 |
+
* with that plugin's slug, it was overriding the empty plugin path with a wrong path.
|
1511 |
+
*
|
1512 |
+
* So, we've added a special mechanism with a 2nd layer of cache that uses `prev_path`
|
1513 |
+
* when the class instantiator isn't the module.
|
1514 |
+
*/
|
1515 |
+
if ( ! $is_init ) {
|
1516 |
+
// Fetch prev path cache.
|
1517 |
+
if ( isset( $this->_storage->plugin_main_file ) &&
|
1518 |
+
isset( $this->_storage->plugin_main_file->prev_path )
|
1519 |
+
) {
|
1520 |
+
$absolute_path = $this->get_absolute_path( $this->_storage->plugin_main_file->prev_path );
|
1521 |
+
if ( file_exists( $absolute_path ) ) {
|
1522 |
+
return $absolute_path;
|
1523 |
+
}
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
wp_die(
|
1527 |
+
$this->get_text_inline( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.', 'failed-finding-main-path' ) .
|
1528 |
+
" Module: {$this->_slug}; SDK: " . WP_FS__SDK_VERSION . ";",
|
1529 |
+
$this->get_text_inline( 'Error', 'error' ),
|
1530 |
+
array( 'back_link' => true )
|
1531 |
+
);
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
/**
|
1535 |
+
* @since 1.2.1
|
1536 |
+
*
|
1537 |
+
* Only the original instantiator that calls dynamic_init can modify the module's path.
|
1538 |
+
*/
|
1539 |
+
// Find caller module.
|
1540 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
|
1541 |
+
$this->_storage->plugin_main_file = (object) array(
|
1542 |
+
'path' => $id_slug_type_path_map[ $this->_module_id ]['path'],
|
1543 |
+
);
|
1544 |
+
|
1545 |
+
return $this->get_absolute_path( $id_slug_type_path_map[ $this->_module_id ]['path'] );
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
/**
|
1549 |
+
* @author Leo Fajardo (@leorw)
|
1550 |
+
* @since 1.2.3
|
1551 |
+
*
|
1552 |
+
* @param string $path
|
1553 |
+
*
|
1554 |
+
* @return string
|
1555 |
+
*/
|
1556 |
+
private function get_relative_path( $path ) {
|
1557 |
+
$module_root_dir = $this->get_module_root_dir_path();
|
1558 |
+
if ( 0 === strpos( $path, $module_root_dir ) ) {
|
1559 |
+
$path = substr( $path, strlen( $module_root_dir ) );
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
return $path;
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
/**
|
1566 |
+
* @author Leo Fajardo (@leorw)
|
1567 |
+
* @since 1.2.3
|
1568 |
+
*
|
1569 |
+
* @param string $path
|
1570 |
+
* @param string|bool $module_type
|
1571 |
+
*
|
1572 |
+
* @return string
|
1573 |
+
*/
|
1574 |
+
private function get_absolute_path( $path, $module_type = false ) {
|
1575 |
+
$module_root_dir = $this->get_module_root_dir_path( $module_type );
|
1576 |
+
if ( 0 !== strpos( $path, $module_root_dir ) ) {
|
1577 |
+
$path = fs_normalize_path( $module_root_dir . $path );
|
1578 |
+
}
|
1579 |
+
|
1580 |
+
return $path;
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
/**
|
1584 |
+
* @author Leo Fajardo (@leorw)
|
1585 |
+
* @since 1.2.3
|
1586 |
+
*
|
1587 |
+
* @param string|bool $module_type
|
1588 |
+
*
|
1589 |
+
* @return string
|
1590 |
+
*/
|
1591 |
+
private function get_module_root_dir_path( $module_type = false ) {
|
1592 |
+
$is_plugin = empty( $module_type ) ?
|
1593 |
+
$this->is_plugin() :
|
1594 |
+
( WP_FS__MODULE_TYPE_PLUGIN === $module_type );
|
1595 |
+
|
1596 |
+
return fs_normalize_path( trailingslashit( $is_plugin ?
|
1597 |
+
WP_PLUGIN_DIR :
|
1598 |
+
get_theme_root() ) );
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
/**
|
1602 |
+
* @author Leo Fajardo (@leorw)
|
1603 |
+
*
|
1604 |
+
* @param number $module_id
|
1605 |
+
* @param string $slug
|
1606 |
+
*
|
1607 |
+
* @since 1.2.2
|
1608 |
+
*/
|
1609 |
+
private function store_id_slug_type_path_map( $module_id, $slug ) {
|
1610 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
|
1611 |
+
|
1612 |
+
$store_option = false;
|
1613 |
+
|
1614 |
+
if ( ! isset( $id_slug_type_path_map[ $module_id ] ) ) {
|
1615 |
+
$id_slug_type_path_map[ $module_id ] = array(
|
1616 |
+
'slug' => $slug
|
1617 |
+
);
|
1618 |
+
|
1619 |
+
$store_option = true;
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
if ( ! isset( $id_slug_type_path_map[ $module_id ]['path'] ) ||
|
1623 |
+
/**
|
1624 |
+
* This verification is for cases when suddenly the same module
|
1625 |
+
* is installed but with a different folder name.
|
1626 |
+
*
|
1627 |
+
* @author Vova Feldman (@svovaf)
|
1628 |
+
* @since 1.2.3
|
1629 |
+
*/
|
1630 |
+
! file_exists( $this->get_absolute_path(
|
1631 |
+
$id_slug_type_path_map[ $module_id ]['path'],
|
1632 |
+
$id_slug_type_path_map[ $module_id ]['type']
|
1633 |
+
) )
|
1634 |
+
) {
|
1635 |
+
$caller_main_file_and_type = $this->get_caller_main_file_and_type();
|
1636 |
+
|
1637 |
+
$id_slug_type_path_map[ $module_id ]['type'] = $caller_main_file_and_type->module_type;
|
1638 |
+
$id_slug_type_path_map[ $module_id ]['path'] = $caller_main_file_and_type->path;
|
1639 |
+
|
1640 |
+
$store_option = true;
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
if ( $store_option ) {
|
1644 |
+
self::$_accounts->set_option( 'id_slug_type_path_map', $id_slug_type_path_map, true );
|
1645 |
+
}
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
/**
|
1649 |
+
* Identifies the caller type: plugin or theme.
|
1650 |
+
*
|
1651 |
+
* @author Leo Fajardo (@leorw)
|
1652 |
+
* @since 1.2.2
|
1653 |
+
*
|
1654 |
+
* @author Vova Feldman (@svovaf)
|
1655 |
+
* @since 1.2.2.3 Find the earliest module in the call stack that calls to the SDK. This fix is for cases when
|
1656 |
+
* add-ons are relying on loading the SDK from the parent module, and also allows themes including the
|
1657 |
+
* SDK an internal file instead of directly from functions.php.
|
1658 |
+
* @since 1.2.1.7 Knows how to handle cases when an add-on includes the parent module logic.
|
1659 |
+
*/
|
1660 |
+
private function get_caller_main_file_and_type() {
|
1661 |
+
self::require_plugin_essentials();
|
1662 |
+
|
1663 |
+
$all_plugins = get_plugins();
|
1664 |
+
$all_plugins_paths = array();
|
1665 |
+
|
1666 |
+
// Get active plugin's main files real full names (might be symlinks).
|
1667 |
+
foreach ( $all_plugins as $relative_path => &$data ) {
|
1668 |
+
if ( false === strpos( fs_normalize_path( $relative_path ), '/' ) ) {
|
1669 |
+
/**
|
1670 |
+
* Ignore plugins that don't have a folder (e.g. Hello Dolly) since they
|
1671 |
+
* can't really include the SDK.
|
1672 |
+
*
|
1673 |
+
* @author Vova Feldman
|
1674 |
+
* @since 1.2.1.7
|
1675 |
+
*/
|
1676 |
+
continue;
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
$all_plugins_paths[] = fs_normalize_path( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) );
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
$caller_file_candidate = false;
|
1683 |
+
$caller_map = array();
|
1684 |
+
$module_type = WP_FS__MODULE_TYPE_PLUGIN;
|
1685 |
+
$themes_dir = fs_normalize_path( get_theme_root() );
|
1686 |
+
|
1687 |
+
for ( $i = 1, $bt = debug_backtrace(), $len = count( $bt ); $i < $len; $i ++ ) {
|
1688 |
+
if ( empty( $bt[ $i ]['file'] ) ) {
|
1689 |
+
continue;
|
1690 |
+
}
|
1691 |
+
|
1692 |
+
if ( $i > 1 && ! empty( $bt[ $i - 1 ]['file'] ) && $bt[ $i ]['file'] === $bt[ $i - 1 ]['file'] ) {
|
1693 |
+
// If file same as the prev file in the stack, skip it.
|
1694 |
+
continue;
|
1695 |
+
}
|
1696 |
+
|
1697 |
+
if ( ! empty( $bt[ $i ]['function'] ) && in_array( $bt[ $i ]['function'], array(
|
1698 |
+
'do_action',
|
1699 |
+
'apply_filter',
|
1700 |
+
// The string split is stupid, but otherwise, theme check
|
1701 |
+
// throws info notices.
|
1702 |
+
'requir' . 'e_once',
|
1703 |
+
'requir' . 'e',
|
1704 |
+
'includ' . 'e_once',
|
1705 |
+
'includ' . 'e'
|
1706 |
+
) )
|
1707 |
+
) {
|
1708 |
+
// Ignore call stack hooks and files inclusion.
|
1709 |
+
continue;
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
$caller_file_path = fs_normalize_path( $bt[ $i ]['file'] );
|
1713 |
+
|
1714 |
+
if ( 'functions.php' === basename( $caller_file_path ) ) {
|
1715 |
+
/**
|
1716 |
+
* 1. Assumes that theme's starting execution file is functions.php.
|
1717 |
+
* 2. This complex logic fixes symlink issues (e.g. with Vargant).
|
1718 |
+
*
|
1719 |
+
* @author Vova Feldman (@svovaf)
|
1720 |
+
* @since 1.2.2.5
|
1721 |
+
*/
|
1722 |
+
|
1723 |
+
if ( $caller_file_path == fs_normalize_path( realpath( trailingslashit( $themes_dir ) . basename( dirname( $caller_file_path ) ) . '/' . basename( $caller_file_path ) ) ) ) {
|
1724 |
+
$module_type = WP_FS__MODULE_TYPE_THEME;
|
1725 |
+
|
1726 |
+
/**
|
1727 |
+
* Relative path of the theme, e.g.:
|
1728 |
+
* `my-theme/functions.php`
|
1729 |
+
*
|
1730 |
+
* @author Leo Fajardo (@leorw)
|
1731 |
+
*/
|
1732 |
+
$caller_file_candidate = basename( dirname( $caller_file_path ) ) .
|
1733 |
+
'/' .
|
1734 |
+
basename( $caller_file_path );
|
1735 |
+
|
1736 |
+
continue;
|
1737 |
+
}
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
$caller_file_hash = md5( $caller_file_path );
|
1741 |
+
|
1742 |
+
if ( ! isset( $caller_map[ $caller_file_hash ] ) ) {
|
1743 |
+
foreach ( $all_plugins_paths as $plugin_path ) {
|
1744 |
+
if ( false !== strpos( $caller_file_path, fs_normalize_path( dirname( $plugin_path ) . '/' ) ) ) {
|
1745 |
+
$caller_map[ $caller_file_hash ] = fs_normalize_path( $plugin_path );
|
1746 |
+
break;
|
1747 |
+
}
|
1748 |
+
}
|
1749 |
+
}
|
1750 |
+
|
1751 |
+
if ( isset( $caller_map[ $caller_file_hash ] ) ) {
|
1752 |
+
$module_type = WP_FS__MODULE_TYPE_PLUGIN;
|
1753 |
+
$caller_file_candidate = plugin_basename( $caller_map[ $caller_file_hash ] );
|
1754 |
+
}
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
return (object) array(
|
1758 |
+
'module_type' => $module_type,
|
1759 |
+
'path' => $caller_file_candidate
|
1760 |
+
);
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
#----------------------------------------------------------------------------------
|
1764 |
+
#region Deactivation Feedback Form
|
1765 |
+
#----------------------------------------------------------------------------------
|
1766 |
+
|
1767 |
+
/**
|
1768 |
+
* Displays a confirmation and feedback dialog box when the user clicks on the "Deactivate" link on the plugins
|
1769 |
+
* page.
|
1770 |
+
*
|
1771 |
+
* @author Vova Feldman (@svovaf)
|
1772 |
+
* @author Leo Fajardo (@leorw)
|
1773 |
+
* @since 1.1.2
|
1774 |
+
*/
|
1775 |
+
function _add_deactivation_feedback_dialog_box() {
|
1776 |
+
/* Check the type of user:
|
1777 |
+
* 1. Long-term (long-term)
|
1778 |
+
* 2. Non-registered and non-anonymous short-term (non-registered-and-non-anonymous-short-term).
|
1779 |
+
* 3. Short-term (short-term)
|
1780 |
+
*/
|
1781 |
+
$is_long_term_user = true;
|
1782 |
+
|
1783 |
+
// Check if the site is at least 2 days old.
|
1784 |
+
$time_installed = $this->_storage->install_timestamp;
|
1785 |
+
|
1786 |
+
// Difference in seconds.
|
1787 |
+
$date_diff = time() - $time_installed;
|
1788 |
+
|
1789 |
+
// Convert seconds to days.
|
1790 |
+
$date_diff_days = floor( $date_diff / ( 60 * 60 * 24 ) );
|
1791 |
+
|
1792 |
+
if ( $date_diff_days < 2 ) {
|
1793 |
+
$is_long_term_user = false;
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
$is_long_term_user = $this->apply_filters( 'is_long_term_user', $is_long_term_user );
|
1797 |
+
|
1798 |
+
if ( $is_long_term_user ) {
|
1799 |
+
$user_type = 'long-term';
|
1800 |
+
} else {
|
1801 |
+
if ( ! $this->is_registered() && ! $this->is_anonymous() ) {
|
1802 |
+
$user_type = 'non-registered-and-non-anonymous-short-term';
|
1803 |
+
} else {
|
1804 |
+
$user_type = 'short-term';
|
1805 |
+
}
|
1806 |
+
}
|
1807 |
+
|
1808 |
+
$uninstall_reasons = $this->_get_uninstall_reasons( $user_type );
|
1809 |
+
|
1810 |
+
// Load the HTML template for the deactivation feedback dialog box.
|
1811 |
+
$vars = array(
|
1812 |
+
'reasons' => $uninstall_reasons,
|
1813 |
+
'id' => $this->_module_id
|
1814 |
+
);
|
1815 |
+
|
1816 |
+
/**
|
1817 |
+
* @todo Deactivation form core functions should be loaded only once! Otherwise, when there are multiple Freemius powered plugins the same code is loaded multiple times. The only thing that should be loaded differently is the various deactivation reasons object based on the state of the plugin.
|
1818 |
+
*/
|
1819 |
+
fs_require_template( 'forms/deactivation/form.php', $vars );
|
1820 |
+
}
|
1821 |
+
|
1822 |
+
/**
|
1823 |
+
* @author Leo Fajardo (@leorw)
|
1824 |
+
* @since 1.1.2
|
1825 |
+
*
|
1826 |
+
* @param string $user_type
|
1827 |
+
*
|
1828 |
+
* @return array The uninstall reasons for the specified user type.
|
1829 |
+
*/
|
1830 |
+
function _get_uninstall_reasons( $user_type = 'long-term' ) {
|
1831 |
+
$module_type = $this->_module_type;
|
1832 |
+
|
1833 |
+
$internal_message_template_var = array(
|
1834 |
+
'id' => $this->_module_id
|
1835 |
+
);
|
1836 |
+
|
1837 |
+
$plan = $this->get_plan();
|
1838 |
+
|
1839 |
+
if ( $this->is_registered() && is_object( $plan ) && $plan->has_technical_support() ) {
|
1840 |
+
$contact_support_template = fs_get_template( 'forms/deactivation/contact.php', $internal_message_template_var );
|
1841 |
+
} else {
|
1842 |
+
$contact_support_template = '';
|
1843 |
+
}
|
1844 |
+
|
1845 |
+
$reason_found_better_plugin = array(
|
1846 |
+
'id' => self::REASON_FOUND_A_BETTER_PLUGIN,
|
1847 |
+
'text' => sprintf( $this->get_text_inline( 'I found a better %s', 'reason-found-a-better-plugin' ), $module_type ),
|
1848 |
+
'input_type' => 'textfield',
|
1849 |
+
'input_placeholder' => sprintf( $this->get_text_inline( "What's the %s's name?", 'placeholder-plugin-name' ), $module_type ),
|
1850 |
+
);
|
1851 |
+
|
1852 |
+
$reason_temporary_deactivation = array(
|
1853 |
+
'id' => self::REASON_TEMPORARY_DEACTIVATION,
|
1854 |
+
'text' => sprintf(
|
1855 |
+
$this->get_text_inline( "It's a temporary %s. I'm just debugging an issue.", 'reason-temporary-x' ),
|
1856 |
+
strtolower( $this->is_plugin() ?
|
1857 |
+
$this->get_text_inline( 'Deactivation', 'deactivation' ) :
|
1858 |
+
$this->get_text_inline( 'Theme Switch', 'theme-switch' )
|
1859 |
+
)
|
1860 |
+
),
|
1861 |
+
'input_type' => '',
|
1862 |
+
'input_placeholder' => ''
|
1863 |
+
);
|
1864 |
+
|
1865 |
+
$reason_other = array(
|
1866 |
+
'id' => self::REASON_OTHER,
|
1867 |
+
'text' => $this->get_text_inline( 'Other', 'reason-other' ),
|
1868 |
+
'input_type' => 'textfield',
|
1869 |
+
'input_placeholder' => ''
|
1870 |
+
);
|
1871 |
+
|
1872 |
+
$long_term_user_reasons = array(
|
1873 |
+
array(
|
1874 |
+
'id' => self::REASON_NO_LONGER_NEEDED,
|
1875 |
+
'text' => sprintf( $this->get_text_inline( 'I no longer need the %s', 'reason-no-longer-needed' ), $module_type ),
|
1876 |
+
'input_type' => '',
|
1877 |
+
'input_placeholder' => ''
|
1878 |
+
),
|
1879 |
+
$reason_found_better_plugin,
|
1880 |
+
array(
|
1881 |
+
'id' => self::REASON_NEEDED_FOR_A_SHORT_PERIOD,
|
1882 |
+
'text' => sprintf( $this->get_text_inline( 'I only needed the %s for a short period', 'reason-needed-for-a-short-period' ), $module_type ),
|
1883 |
+
'input_type' => '',
|
1884 |
+
'input_placeholder' => ''
|
1885 |
+
),
|
1886 |
+
array(
|
1887 |
+
'id' => self::REASON_BROKE_MY_SITE,
|
1888 |
+
'text' => sprintf( $this->get_text_inline( 'The %s broke my site', 'reason-broke-my-site' ), $module_type ),
|
1889 |
+
'input_type' => '',
|
1890 |
+
'input_placeholder' => '',
|
1891 |
+
'internal_message' => $contact_support_template
|
1892 |
+
),
|
1893 |
+
array(
|
1894 |
+
'id' => self::REASON_SUDDENLY_STOPPED_WORKING,
|
1895 |
+
'text' => sprintf( $this->get_text_inline( 'The %s suddenly stopped working', 'reason-suddenly-stopped-working' ), $module_type ),
|
1896 |
+
'input_type' => '',
|
1897 |
+
'input_placeholder' => '',
|
1898 |
+
'internal_message' => $contact_support_template
|
1899 |
+
)
|
1900 |
+
);
|
1901 |
+
|
1902 |
+
if ( $this->is_paying() ) {
|
1903 |
+
$long_term_user_reasons[] = array(
|
1904 |
+
'id' => self::REASON_CANT_PAY_ANYMORE,
|
1905 |
+
'text' => $this->get_text_inline( "I can't pay for it anymore", 'reason-cant-pay-anymore' ),
|
1906 |
+
'input_type' => 'textfield',
|
1907 |
+
'input_placeholder' => $this->get_text_inline( 'What price would you feel comfortable paying?', 'placeholder-comfortable-price' )
|
1908 |
+
);
|
1909 |
+
}
|
1910 |
+
|
1911 |
+
$reason_dont_share_info = array(
|
1912 |
+
'id' => self::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION,
|
1913 |
+
'text' => $this->get_text_inline( "I don't like to share my information with you", 'reason-dont-like-to-share-my-information' ),
|
1914 |
+
'input_type' => '',
|
1915 |
+
'input_placeholder' => ''
|
1916 |
+
);
|
1917 |
+
|
1918 |
+
/**
|
1919 |
+
* If the current user has selected the "don't share data" reason in the deactivation feedback modal, inform the
|
1920 |
+
* user by showing additional message that he doesn't have to share data and can just choose to skip the opt-in
|
1921 |
+
* (the Skip button is included in the message to show). This message will only be shown if anonymous mode is
|
1922 |
+
* enabled and the user's account is currently not in pending activation state (similar to the way the Skip
|
1923 |
+
* button in the opt-in form is shown/hidden).
|
1924 |
+
*/
|
1925 |
+
if ( $this->is_enable_anonymous() && ! $this->is_pending_activation() ) {
|
1926 |
+
$reason_dont_share_info['internal_message'] = fs_get_template( 'forms/deactivation/retry-skip.php', $internal_message_template_var );
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
$uninstall_reasons = array(
|
1930 |
+
'long-term' => $long_term_user_reasons,
|
1931 |
+
'non-registered-and-non-anonymous-short-term' => array(
|
1932 |
+
array(
|
1933 |
+
'id' => self::REASON_DIDNT_WORK,
|
1934 |
+
'text' => sprintf( $this->get_text_inline( "The %s didn't work", 'reason-didnt-work' ), $module_type ),
|
1935 |
+
'input_type' => '',
|
1936 |
+
'input_placeholder' => ''
|
1937 |
+
),
|
1938 |
+
$reason_dont_share_info,
|
1939 |
+
$reason_found_better_plugin
|
1940 |
+
),
|
1941 |
+
'short-term' => array(
|
1942 |
+
array(
|
1943 |
+
'id' => self::REASON_COULDNT_MAKE_IT_WORK,
|
1944 |
+
'text' => $this->get_text_inline( "I couldn't understand how to make it work", 'reason-couldnt-make-it-work' ),
|
1945 |
+
'input_type' => '',
|
1946 |
+
'input_placeholder' => '',
|
1947 |
+
'internal_message' => $contact_support_template
|
1948 |
+
),
|
1949 |
+
$reason_found_better_plugin,
|
1950 |
+
array(
|
1951 |
+
'id' => self::REASON_GREAT_BUT_NEED_SPECIFIC_FEATURE,
|
1952 |
+
'text' => sprintf( $this->get_text_inline( "The %s is great, but I need specific feature that you don't support", 'reason-great-but-need-specific-feature' ), $module_type ),
|
1953 |
+
'input_type' => 'textarea',
|
1954 |
+
'input_placeholder' => $this->get_text_inline( 'What feature?', 'placeholder-feature' )
|
1955 |
+
),
|
1956 |
+
array(
|
1957 |
+
'id' => self::REASON_NOT_WORKING,
|
1958 |
+
'text' => sprintf( $this->get_text_inline( 'The %s is not working', 'reason-not-working' ), $module_type ),
|
1959 |
+
'input_type' => 'textarea',
|
1960 |
+
'input_placeholder' => $this->get_text_inline( "Kindly share what didn't work so we can fix it for future users...", 'placeholder-share-what-didnt-work' )
|
1961 |
+
),
|
1962 |
+
array(
|
1963 |
+
'id' => self::REASON_NOT_WHAT_I_WAS_LOOKING_FOR,
|
1964 |
+
'text' => $this->get_text_inline( "It's not what I was looking for", 'reason-not-what-i-was-looking-for' ),
|
1965 |
+
'input_type' => 'textarea',
|
1966 |
+
'input_placeholder' => $this->get_text_inline( "What you've been looking for?", 'placeholder-what-youve-been-looking-for' )
|
1967 |
+
),
|
1968 |
+
array(
|
1969 |
+
'id' => self::REASON_DIDNT_WORK_AS_EXPECTED,
|
1970 |
+
'text' => sprintf( $this->get_text_inline( "The %s didn't work as expected", 'reason-didnt-work-as-expected' ), $module_type ),
|
1971 |
+
'input_type' => 'textarea',
|
1972 |
+
'input_placeholder' => $this->get_text_inline( 'What did you expect?', 'placeholder-what-did-you-expect' )
|
1973 |
+
)
|
1974 |
+
)
|
1975 |
+
);
|
1976 |
+
|
1977 |
+
// Randomize the reasons for the current user type.
|
1978 |
+
shuffle( $uninstall_reasons[ $user_type ] );
|
1979 |
+
|
1980 |
+
// Keep the following reasons as the last items in the list.
|
1981 |
+
$uninstall_reasons[ $user_type ][] = $reason_temporary_deactivation;
|
1982 |
+
$uninstall_reasons[ $user_type ][] = $reason_other;
|
1983 |
+
|
1984 |
+
$uninstall_reasons = $this->apply_filters( 'uninstall_reasons', $uninstall_reasons );
|
1985 |
+
|
1986 |
+
return $uninstall_reasons[ $user_type ];
|
1987 |
+
}
|
1988 |
+
|
1989 |
+
/**
|
1990 |
+
* Called after the user has submitted his reason for deactivating the plugin.
|
1991 |
+
*
|
1992 |
+
* @author Leo Fajardo (@leorw)
|
1993 |
+
* @since 1.1.2
|
1994 |
+
*/
|
1995 |
+
function _submit_uninstall_reason_action() {
|
1996 |
+
$this->_logger->entrance();
|
1997 |
+
|
1998 |
+
$this->check_ajax_referer( 'submit_uninstall_reason' );
|
1999 |
+
|
2000 |
+
$reason_id = fs_request_get( 'reason_id' );
|
2001 |
+
|
2002 |
+
// Check if the given reason ID is an unsigned integer.
|
2003 |
+
if ( ! ctype_digit( $reason_id ) ) {
|
2004 |
+
exit;
|
2005 |
+
}
|
2006 |
+
|
2007 |
+
$reason_info = trim( fs_request_get( 'reason_info', '' ) );
|
2008 |
+
if ( ! empty( $reason_info ) ) {
|
2009 |
+
$reason_info = substr( $reason_info, 0, 128 );
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
$reason = (object) array(
|
2013 |
+
'id' => $reason_id,
|
2014 |
+
'info' => $reason_info,
|
2015 |
+
'is_anonymous' => fs_request_get_bool( 'is_anonymous' )
|
2016 |
+
);
|
2017 |
+
|
2018 |
+
$this->_storage->store( 'uninstall_reason', $reason );
|
2019 |
+
|
2020 |
+
/**
|
2021 |
+
* If the module type is "theme", trigger the uninstall event here (on theme deactivation) since themes do
|
2022 |
+
* not support uninstall hook.
|
2023 |
+
*
|
2024 |
+
* @author Leo Fajardo (@leorw)
|
2025 |
+
* @since 1.2.2
|
2026 |
+
*/
|
2027 |
+
if ( $this->is_theme() ) {
|
2028 |
+
$this->_uninstall_plugin_event( false );
|
2029 |
+
$this->remove_sdk_reference();
|
2030 |
+
}
|
2031 |
+
|
2032 |
+
// Print '1' for successful operation.
|
2033 |
+
echo 1;
|
2034 |
+
exit;
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
#endregion
|
2038 |
+
|
2039 |
+
#----------------------------------------------------------------------------------
|
2040 |
+
#region Instance
|
2041 |
+
#----------------------------------------------------------------------------------
|
2042 |
+
|
2043 |
+
/**
|
2044 |
+
* Main singleton instance.
|
2045 |
+
*
|
2046 |
+
* @author Vova Feldman (@svovaf)
|
2047 |
+
* @since 1.0.0
|
2048 |
+
*
|
2049 |
+
* @param number $module_id
|
2050 |
+
* @param string|bool $slug
|
2051 |
+
* @param bool $is_init Is initiation sequence.
|
2052 |
+
*
|
2053 |
+
* @return Freemius|false
|
2054 |
+
*/
|
2055 |
+
static function instance( $module_id, $slug = false, $is_init = false ) {
|
2056 |
+
if ( empty( $module_id ) ) {
|
2057 |
+
return false;
|
2058 |
+
}
|
2059 |
+
|
2060 |
+
/**
|
2061 |
+
* Load the essential static data prior to initiating FS_Plugin_Manager since there's an essential MS network migration logic that needs to be executed prior to the initiation.
|
2062 |
+
*/
|
2063 |
+
self::_load_required_static();
|
2064 |
+
|
2065 |
+
if ( ! is_numeric( $module_id ) ) {
|
2066 |
+
if ( ! $is_init && true === $slug ) {
|
2067 |
+
$is_init = true;
|
2068 |
+
}
|
2069 |
+
|
2070 |
+
$slug = $module_id;
|
2071 |
+
|
2072 |
+
$module = FS_Plugin_Manager::instance( $slug )->get();
|
2073 |
+
|
2074 |
+
if ( is_object( $module ) ) {
|
2075 |
+
$module_id = $module->id;
|
2076 |
+
}
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
$key = 'm_' . $module_id;
|
2080 |
+
|
2081 |
+
if ( ! isset( self::$_instances[ $key ] ) ) {
|
2082 |
+
self::$_instances[ $key ] = new Freemius( $module_id, $slug, $is_init );
|
2083 |
+
}
|
2084 |
+
|
2085 |
+
return self::$_instances[ $key ];
|
2086 |
+
}
|
2087 |
+
|
2088 |
+
/**
|
2089 |
+
* @author Vova Feldman (@svovaf)
|
2090 |
+
* @since 1.0.6
|
2091 |
+
*
|
2092 |
+
* @param number $addon_id
|
2093 |
+
*
|
2094 |
+
* @return bool
|
2095 |
+
*/
|
2096 |
+
private static function has_instance( $addon_id ) {
|
2097 |
+
return isset( self::$_instances[ 'm_' . $addon_id ] );
|
2098 |
+
}
|
2099 |
+
|
2100 |
+
/**
|
2101 |
+
* @author Leo Fajardo (@leorw)
|
2102 |
+
* @since 1.2.2
|
2103 |
+
*
|
2104 |
+
* @param string|number $id_or_slug
|
2105 |
+
*
|
2106 |
+
* @return number|false
|
2107 |
+
*/
|
2108 |
+
private static function get_module_id( $id_or_slug ) {
|
2109 |
+
if ( is_numeric( $id_or_slug ) ) {
|
2110 |
+
return $id_or_slug;
|
2111 |
+
}
|
2112 |
+
|
2113 |
+
foreach ( self::$_instances as $instance ) {
|
2114 |
+
if ( $instance->is_plugin() && ( $id_or_slug === $instance->get_slug() ) ) {
|
2115 |
+
return $instance->get_id();
|
2116 |
+
}
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
return false;
|
2120 |
+
}
|
2121 |
+
|
2122 |
+
/**
|
2123 |
+
* @author Vova Feldman (@svovaf)
|
2124 |
+
* @since 1.0.6
|
2125 |
+
*
|
2126 |
+
* @param number $id
|
2127 |
+
*
|
2128 |
+
* @return false|Freemius
|
2129 |
+
*/
|
2130 |
+
static function get_instance_by_id( $id ) {
|
2131 |
+
return isset ( self::$_instances[ 'm_' . $id ] ) ?
|
2132 |
+
self::$_instances[ 'm_' . $id ] :
|
2133 |
+
false;
|
2134 |
+
}
|
2135 |
+
|
2136 |
+
/**
|
2137 |
+
*
|
2138 |
+
* @author Vova Feldman (@svovaf)
|
2139 |
+
* @since 1.0.1
|
2140 |
+
*
|
2141 |
+
* @param $plugin_file
|
2142 |
+
*
|
2143 |
+
* @return false|Freemius
|
2144 |
+
*/
|
2145 |
+
static function get_instance_by_file( $plugin_file ) {
|
2146 |
+
$slug = self::find_slug_by_basename( $plugin_file );
|
2147 |
+
|
2148 |
+
return ( false !== $slug ) ?
|
2149 |
+
self::instance( self::get_module_id( $slug ) ) :
|
2150 |
+
false;
|
2151 |
+
}
|
2152 |
+
|
2153 |
+
/**
|
2154 |
+
* @author Vova Feldman (@svovaf)
|
2155 |
+
* @since 1.0.6
|
2156 |
+
*
|
2157 |
+
* @return false|Freemius
|
2158 |
+
*/
|
2159 |
+
function get_parent_instance() {
|
2160 |
+
return self::get_instance_by_id( $this->_plugin->parent_plugin_id );
|
2161 |
+
}
|
2162 |
+
|
2163 |
+
/**
|
2164 |
+
* @author Vova Feldman (@svovaf)
|
2165 |
+
* @since 1.0.6
|
2166 |
+
*
|
2167 |
+
* @param string|number $id_or_slug
|
2168 |
+
*
|
2169 |
+
* @return false|Freemius
|
2170 |
+
*/
|
2171 |
+
function get_addon_instance( $id_or_slug ) {
|
2172 |
+
$addon_id = self::get_module_id( $id_or_slug );
|
2173 |
+
|
2174 |
+
return self::instance( $addon_id );
|
2175 |
+
}
|
2176 |
+
|
2177 |
+
#endregion ------------------------------------------------------------------
|
2178 |
+
|
2179 |
+
/**
|
2180 |
+
* @author Vova Feldman (@svovaf)
|
2181 |
+
* @since 1.0.6
|
2182 |
+
*
|
2183 |
+
* @return bool
|
2184 |
+
*/
|
2185 |
+
function is_parent_plugin_installed() {
|
2186 |
+
$is_active = self::has_instance( $this->_plugin->parent_plugin_id );
|
2187 |
+
|
2188 |
+
if ( $is_active ) {
|
2189 |
+
return true;
|
2190 |
+
}
|
2191 |
+
|
2192 |
+
/**
|
2193 |
+
* Parent module might be a theme. If that's the case, the add-on's FS
|
2194 |
+
* instance will be loaded prior to the theme's FS instance, therefore,
|
2195 |
+
* we need to check if it's active with a "look ahead".
|
2196 |
+
*
|
2197 |
+
* @author Vova Feldman
|
2198 |
+
* @since 1.2.2.3
|
2199 |
+
*/
|
2200 |
+
global $fs_active_plugins;
|
2201 |
+
if ( is_object( $fs_active_plugins ) && is_array( $fs_active_plugins->plugins ) ) {
|
2202 |
+
$active_theme = wp_get_theme();
|
2203 |
+
|
2204 |
+
foreach ( $fs_active_plugins->plugins as $sdk => $module ) {
|
2205 |
+
if ( WP_FS__MODULE_TYPE_THEME === $module->type ) {
|
2206 |
+
if ( $module->plugin_path == $active_theme->get_stylesheet() ) {
|
2207 |
+
// Parent module is a theme and it's currently active.
|
2208 |
+
return true;
|
2209 |
+
}
|
2210 |
+
}
|
2211 |
+
}
|
2212 |
+
}
|
2213 |
+
|
2214 |
+
return false;
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
/**
|
2218 |
+
* Check if add-on parent plugin in activation mode.
|
2219 |
+
*
|
2220 |
+
* @author Vova Feldman (@svovaf)
|
2221 |
+
* @since 1.0.7
|
2222 |
+
*
|
2223 |
+
* @return bool
|
2224 |
+
*/
|
2225 |
+
function is_parent_in_activation() {
|
2226 |
+
$parent_fs = $this->get_parent_instance();
|
2227 |
+
if ( ! is_object( $parent_fs ) ) {
|
2228 |
+
return false;
|
2229 |
+
}
|
2230 |
+
|
2231 |
+
return ( $parent_fs->is_activation_mode() );
|
2232 |
+
}
|
2233 |
+
|
2234 |
+
/**
|
2235 |
+
* Is plugin in activation mode.
|
2236 |
+
*
|
2237 |
+
* @author Vova Feldman (@svovaf)
|
2238 |
+
* @since 1.0.7
|
2239 |
+
*
|
2240 |
+
* @param bool $and_on
|
2241 |
+
*
|
2242 |
+
* @return bool
|
2243 |
+
*/
|
2244 |
+
function is_activation_mode( $and_on = true ) {
|
2245 |
+
return fs_is_network_admin() ?
|
2246 |
+
$this->is_network_activation_mode( $and_on ) :
|
2247 |
+
$this->is_site_activation_mode( $and_on );
|
2248 |
+
}
|
2249 |
+
|
2250 |
+
/**
|
2251 |
+
* Is plugin in activation mode.
|
2252 |
+
*
|
2253 |
+
* @author Vova Feldman (@svovaf)
|
2254 |
+
* @since 1.0.7
|
2255 |
+
*
|
2256 |
+
* @param bool $and_on
|
2257 |
+
*
|
2258 |
+
* @return bool
|
2259 |
+
*/
|
2260 |
+
function is_site_activation_mode( $and_on = true ) {
|
2261 |
+
return (
|
2262 |
+
( $this->is_on() || ! $and_on ) &&
|
2263 |
+
( ! $this->is_registered() ||
|
2264 |
+
( $this->is_only_premium() && ! $this->has_features_enabled_license() ) ) &&
|
2265 |
+
( ! $this->is_enable_anonymous() ||
|
2266 |
+
( ! $this->is_anonymous() && ! $this->is_pending_activation() ) )
|
2267 |
+
);
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
/**
|
2271 |
+
* Checks if the SDK in network activation mode.
|
2272 |
+
*
|
2273 |
+
* @author Leo Fajardo (@leorw)
|
2274 |
+
* @since 2.0.0
|
2275 |
+
*
|
2276 |
+
* @param bool $and_on
|
2277 |
+
*
|
2278 |
+
* @return bool
|
2279 |
+
*/
|
2280 |
+
private function is_network_activation_mode( $and_on = true ) {
|
2281 |
+
if ( ! $this->_is_network_active ) {
|
2282 |
+
// Not network activated.
|
2283 |
+
return false;
|
2284 |
+
}
|
2285 |
+
|
2286 |
+
if ( $this->is_network_upgrade_mode() ) {
|
2287 |
+
// Special flag to enforce network activation mode to decide what to do with the sites that are not yet opted-in nor skipped.
|
2288 |
+
return true;
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
if ( ! $this->is_site_activation_mode( $and_on ) ) {
|
2292 |
+
// Whether the context is single site or the network, if the plugin is no longer in activation mode then it is not in network activation mode as well.
|
2293 |
+
return false;
|
2294 |
+
}
|
2295 |
+
|
2296 |
+
if ( $this->is_network_delegated_connection() ) {
|
2297 |
+
// Super-admin delegated the connection to the site admins -> not activation mode.
|
2298 |
+
return false;
|
2299 |
+
}
|
2300 |
+
|
2301 |
+
if ( $this->is_network_anonymous() ) {
|
2302 |
+
// Super-admin skipped the connection network wide -> not activation mode.
|
2303 |
+
return false;
|
2304 |
+
}
|
2305 |
+
|
2306 |
+
if ( $this->is_network_registered() ) {
|
2307 |
+
// Super-admin connected at least one site -> not activation mode.
|
2308 |
+
return false;
|
2309 |
+
}
|
2310 |
+
|
2311 |
+
return true;
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
/**
|
2315 |
+
* Check if current page is the opt-in/pending-activation page.
|
2316 |
+
*
|
2317 |
+
* @author Vova Feldman (@svovaf)
|
2318 |
+
* @since 1.2.1.7
|
2319 |
+
*
|
2320 |
+
* @return bool
|
2321 |
+
*/
|
2322 |
+
function is_activation_page() {
|
2323 |
+
if ( $this->_menu->is_main_settings_page() ) {
|
2324 |
+
return true;
|
2325 |
+
}
|
2326 |
+
|
2327 |
+
if ( ! $this->is_activation_mode() ) {
|
2328 |
+
return false;
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
// Check if current page is matching the activation page.
|
2332 |
+
return $this->is_matching_url( $this->get_activation_url() );
|
2333 |
+
}
|
2334 |
+
|
2335 |
+
/**
|
2336 |
+
* Check if URL path's are matching and that all querystring
|
2337 |
+
* arguments of the $sub_url exist in the $url with the same values.
|
2338 |
+
*
|
2339 |
+
* WARNING:
|
2340 |
+
* 1. This method doesn't check if the sub/domain are matching.
|
2341 |
+
* 2. Ignore case sensitivity.
|
2342 |
+
*
|
2343 |
+
* @author Vova Feldman (@svovaf)
|
2344 |
+
* @since 1.2.1.7
|
2345 |
+
*
|
2346 |
+
* @param string $sub_url
|
2347 |
+
* @param string $url If argument is not set, check if the sub_url matching the current's page URL.
|
2348 |
+
*
|
2349 |
+
* @return bool
|
2350 |
+
*/
|
2351 |
+
private function is_matching_url( $sub_url, $url = '' ) {
|
2352 |
+
if ( empty( $url ) ) {
|
2353 |
+
$url = $_SERVER['REQUEST_URI'];
|
2354 |
+
}
|
2355 |
+
|
2356 |
+
$url = strtolower( $url );
|
2357 |
+
$sub_url = strtolower( $sub_url );
|
2358 |
+
|
2359 |
+
if ( parse_url( $sub_url, PHP_URL_PATH ) !== parse_url( $url, PHP_URL_PATH ) ) {
|
2360 |
+
// Different path - DO NOT OVERRIDE PAGE.
|
2361 |
+
return false;
|
2362 |
+
}
|
2363 |
+
|
2364 |
+
$url_params = array();
|
2365 |
+
parse_str( parse_url( $url, PHP_URL_QUERY ), $url_params );
|
2366 |
+
|
2367 |
+
$sub_url_params = array();
|
2368 |
+
parse_str( parse_url( $sub_url, PHP_URL_QUERY ), $sub_url_params );
|
2369 |
+
|
2370 |
+
foreach ( $sub_url_params as $key => $val ) {
|
2371 |
+
if ( ! isset( $url_params[ $key ] ) || $val != $url_params[ $key ] ) {
|
2372 |
+
// Not matching query string - DO NOT OVERRIDE PAGE.
|
2373 |
+
return false;
|
2374 |
+
}
|
2375 |
+
}
|
2376 |
+
|
2377 |
+
return true;
|
2378 |
+
}
|
2379 |
+
|
2380 |
+
/**
|
2381 |
+
* Get the basenames of all active plugins for specific blog. Including network activated plugins.
|
2382 |
+
*
|
2383 |
+
* @author Vova Feldman (@svovaf)
|
2384 |
+
* @since 2.0.0
|
2385 |
+
*
|
2386 |
+
* @param int $blog_id
|
2387 |
+
*
|
2388 |
+
* @return string[]
|
2389 |
+
*/
|
2390 |
+
private static function get_active_plugins_basenames( $blog_id = 0 ) {
|
2391 |
+
if ( is_multisite() && $blog_id > 0 ) {
|
2392 |
+
$active_basenames = get_blog_option( $blog_id, 'active_plugins' );
|
2393 |
+
} else {
|
2394 |
+
$active_basenames = get_option( 'active_plugins' );
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
if ( is_multisite() ) {
|
2398 |
+
$network_active_basenames = get_site_option( 'active_sitewide_plugins' );
|
2399 |
+
|
2400 |
+
if ( is_array( $network_active_basenames ) && ! empty( $network_active_basenames ) ) {
|
2401 |
+
$active_basenames = array_merge( $active_basenames, $network_active_basenames );
|
2402 |
+
}
|
2403 |
+
}
|
2404 |
+
|
2405 |
+
return $active_basenames;
|
2406 |
+
}
|
2407 |
+
|
2408 |
+
/**
|
2409 |
+
* Get collection of all active plugins. Including network activated plugins.
|
2410 |
+
*
|
2411 |
+
* @author Vova Feldman (@svovaf)
|
2412 |
+
* @since 1.0.9
|
2413 |
+
*
|
2414 |
+
* @param int $blog_id Since 2.0.0
|
2415 |
+
*
|
2416 |
+
* @return array[string]array
|
2417 |
+
*/
|
2418 |
+
private static function get_active_plugins( $blog_id = 0 ) {
|
2419 |
+
self::require_plugin_essentials();
|
2420 |
+
|
2421 |
+
$active_plugin = array();
|
2422 |
+
$all_plugins = get_plugins();
|
2423 |
+
$active_plugins_basenames = self::get_active_plugins_basenames( $blog_id );
|
2424 |
+
|
2425 |
+
foreach ( $active_plugins_basenames as $plugin_basename ) {
|
2426 |
+
$active_plugin[ $plugin_basename ] = $all_plugins[ $plugin_basename ];
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
return $active_plugin;
|
2430 |
+
}
|
2431 |
+
|
2432 |
+
/**
|
2433 |
+
* Get collection of all site active plugins for a specified blog.
|
2434 |
+
*
|
2435 |
+
* @author Vova Feldman (@svovaf)
|
2436 |
+
* @since 2.0.0
|
2437 |
+
*
|
2438 |
+
* @param int $blog_id
|
2439 |
+
*
|
2440 |
+
* @return array[string]array
|
2441 |
+
*/
|
2442 |
+
private static function get_site_active_plugins( $blog_id = 0 ) {
|
2443 |
+
$active_basenames = ( is_multisite() && $blog_id > 0 ) ?
|
2444 |
+
get_blog_option( $blog_id, 'active_plugins' ) :
|
2445 |
+
get_option( 'active_plugins' );
|
2446 |
+
|
2447 |
+
$active = array();
|
2448 |
+
foreach ( $active_basenames as $basename ) {
|
2449 |
+
$active[ $basename ] = array(
|
2450 |
+
'is_active' => true,
|
2451 |
+
'Version' => '1.0', // Dummy version.
|
2452 |
+
'slug' => self::get_plugin_slug( $basename ),
|
2453 |
+
);
|
2454 |
+
}
|
2455 |
+
|
2456 |
+
return $active;
|
2457 |
+
}
|
2458 |
+
|
2459 |
+
/**
|
2460 |
+
* Get collection of all plugins with their activation status for a specified blog.
|
2461 |
+
*
|
2462 |
+
* @author Vova Feldman (@svovaf)
|
2463 |
+
* @since 1.1.8
|
2464 |
+
*
|
2465 |
+
* @param int $blog_id Since 2.0.0
|
2466 |
+
*
|
2467 |
+
* @return array Key is the plugin file path and the value is an array of the plugin data.
|
2468 |
+
*/
|
2469 |
+
private static function get_all_plugins( $blog_id = 0 ) {
|
2470 |
+
self::require_plugin_essentials();
|
2471 |
+
|
2472 |
+
$all_plugins = get_plugins();
|
2473 |
+
|
2474 |
+
$active_plugins_basenames = self::get_active_plugins_basenames( $blog_id );
|
2475 |
+
|
2476 |
+
foreach ( $all_plugins as $basename => &$data ) {
|
2477 |
+
// By default set to inactive (next foreach update the active plugins).
|
2478 |
+
$data['is_active'] = false;
|
2479 |
+
// Enrich with plugin slug.
|
2480 |
+
$data['slug'] = self::get_plugin_slug( $basename );
|
2481 |
+
}
|
2482 |
+
|
2483 |
+
// Flag active plugins.
|
2484 |
+
foreach ( $active_plugins_basenames as $basename ) {
|
2485 |
+
if ( isset( $all_plugins[ $basename ] ) ) {
|
2486 |
+
$all_plugins[ $basename ]['is_active'] = true;
|
2487 |
+
}
|
2488 |
+
}
|
2489 |
+
|
2490 |
+
return $all_plugins;
|
2491 |
+
}
|
2492 |
+
|
2493 |
+
/**
|
2494 |
+
* Get collection of all plugins and if they are network level activated.
|
2495 |
+
*
|
2496 |
+
* @author Vova Feldman (@svovaf)
|
2497 |
+
* @since 2.0.0
|
2498 |
+
*
|
2499 |
+
* @return array Key is the plugin basename and the value is an array of the plugin data.
|
2500 |
+
*/
|
2501 |
+
private static function get_network_plugins() {
|
2502 |
+
self::require_plugin_essentials();
|
2503 |
+
|
2504 |
+
$all_plugins = get_plugins();
|
2505 |
+
|
2506 |
+
$network_active_basenames = is_multisite() ?
|
2507 |
+
get_site_option( 'active_sitewide_plugins' ) :
|
2508 |
+
array();
|
2509 |
+
|
2510 |
+
foreach ( $all_plugins as $basename => &$data ) {
|
2511 |
+
// By default set to inactive (next foreach update the active plugins).
|
2512 |
+
$data['is_active'] = false;
|
2513 |
+
// Enrich with plugin slug.
|
2514 |
+
$data['slug'] = self::get_plugin_slug( $basename );
|
2515 |
+
}
|
2516 |
+
|
2517 |
+
// Flag active plugins.
|
2518 |
+
foreach ( $network_active_basenames as $basename ) {
|
2519 |
+
if ( isset( $all_plugins[ $basename ] ) ) {
|
2520 |
+
$all_plugins[ $basename ]['is_active'] = true;
|
2521 |
+
}
|
2522 |
+
}
|
2523 |
+
|
2524 |
+
return $all_plugins;
|
2525 |
+
}
|
2526 |
+
|
2527 |
+
/**
|
2528 |
+
* Cached result of get_site_transient( 'update_plugins' )
|
2529 |
+
*
|
2530 |
+
* @author Vova Feldman (@svovaf)
|
2531 |
+
* @since 1.1.8
|
2532 |
+
*
|
2533 |
+
* @var object
|
2534 |
+
*/
|
2535 |
+
private static $_plugins_info;
|
2536 |
+
|
2537 |
+
/**
|
2538 |
+
* Helper function to get specified plugin's slug.
|
2539 |
+
*
|
2540 |
+
* @author Vova Feldman (@svovaf)
|
2541 |
+
* @since 1.1.8
|
2542 |
+
*
|
2543 |
+
* @param $basename
|
2544 |
+
*
|
2545 |
+
* @return string
|
2546 |
+
*/
|
2547 |
+
private static function get_plugin_slug( $basename ) {
|
2548 |
+
if ( ! isset( self::$_plugins_info ) ) {
|
2549 |
+
self::$_plugins_info = get_site_transient( 'update_plugins' );
|
2550 |
+
}
|
2551 |
+
|
2552 |
+
$slug = '';
|
2553 |
+
|
2554 |
+
if ( is_object( self::$_plugins_info ) ) {
|
2555 |
+
if ( isset( self::$_plugins_info->no_update ) &&
|
2556 |
+
isset( self::$_plugins_info->no_update[ $basename ] ) &&
|
2557 |
+
! empty( self::$_plugins_info->no_update[ $basename ]->slug )
|
2558 |
+
) {
|
2559 |
+
$slug = self::$_plugins_info->no_update[ $basename ]->slug;
|
2560 |
+
} else if ( isset( self::$_plugins_info->response ) &&
|
2561 |
+
isset( self::$_plugins_info->response[ $basename ] ) &&
|
2562 |
+
! empty( self::$_plugins_info->response[ $basename ]->slug )
|
2563 |
+
) {
|
2564 |
+
$slug = self::$_plugins_info->response[ $basename ]->slug;
|
2565 |
+
}
|
2566 |
+
}
|
2567 |
+
|
2568 |
+
if ( empty( $slug ) ) {
|
2569 |
+
// Try to find slug from FS data.
|
2570 |
+
$slug = self::find_slug_by_basename( $basename );
|
2571 |
+
}
|
2572 |
+
|
2573 |
+
if ( empty( $slug ) ) {
|
2574 |
+
// Fallback to plugin's folder name.
|
2575 |
+
$slug = dirname( $basename );
|
2576 |
+
}
|
2577 |
+
|
2578 |
+
return $slug;
|
2579 |
+
}
|
2580 |
+
|
2581 |
+
private static $_statics_loaded = false;
|
2582 |
+
|
2583 |
+
/**
|
2584 |
+
* Load static resources.
|
2585 |
+
*
|
2586 |
+
* @author Vova Feldman (@svovaf)
|
2587 |
+
* @since 1.0.1
|
2588 |
+
*/
|
2589 |
+
private static function _load_required_static() {
|
2590 |
+
if ( self::$_statics_loaded ) {
|
2591 |
+
return;
|
2592 |
+
}
|
2593 |
+
|
2594 |
+
self::$_static_logger = FS_Logger::get_logger( WP_FS__SLUG, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
2595 |
+
|
2596 |
+
self::$_static_logger->entrance();
|
2597 |
+
|
2598 |
+
self::$_accounts = FS_Options::instance( WP_FS__ACCOUNTS_OPTION_NAME, true );
|
2599 |
+
|
2600 |
+
if ( is_multisite() ) {
|
2601 |
+
/**
|
2602 |
+
* If the id_slug_type_path_map exists on the site level but doesn't exist on the
|
2603 |
+
* network level storage, it means that we need to process the storage with migration.
|
2604 |
+
*
|
2605 |
+
* The code in this `if` scope will only be executed once and only for the first site that will execute it because once we migrate the storage data, id_slug_type_path_map will be already set in the network level storage.
|
2606 |
+
*
|
2607 |
+
* @author Vova Feldman (@svovaf)
|
2608 |
+
* @since 2.0.0
|
2609 |
+
*/
|
2610 |
+
if ( null === self::$_accounts->get_option( 'id_slug_type_path_map', null, true ) &&
|
2611 |
+
null !== self::$_accounts->get_option( 'id_slug_type_path_map', null, false )
|
2612 |
+
) {
|
2613 |
+
self::migrate_accounts_to_network();
|
2614 |
+
|
2615 |
+
// Migrate API options from site level to network level.
|
2616 |
+
$api_network_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true, true );
|
2617 |
+
$api_network_options->migrate_to_network();
|
2618 |
+
|
2619 |
+
// Migrate API cache to network level storage.
|
2620 |
+
FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME )->migrate_to_network();
|
2621 |
+
}
|
2622 |
+
}
|
2623 |
+
|
2624 |
+
self::$_global_admin_notices = FS_Admin_Notices::instance( 'global' );
|
2625 |
+
|
2626 |
+
add_action( ( fs_is_network_admin() ? 'network_' : '' ) . 'admin_menu', array(
|
2627 |
+
'Freemius',
|
2628 |
+
'_add_debug_section'
|
2629 |
+
) );
|
2630 |
+
|
2631 |
+
add_action( "wp_ajax_fs_toggle_debug_mode", array( 'Freemius', '_toggle_debug_mode' ) );
|
2632 |
+
|
2633 |
+
self::add_ajax_action_static( 'get_debug_log', array( 'Freemius', '_get_debug_log' ) );
|
2634 |
+
|
2635 |
+
self::add_ajax_action_static( 'get_db_option', array( 'Freemius', '_get_db_option' ) );
|
2636 |
+
|
2637 |
+
self::add_ajax_action_static( 'set_db_option', array( 'Freemius', '_set_db_option' ) );
|
2638 |
+
|
2639 |
+
if ( 0 == did_action( 'plugins_loaded' ) ) {
|
2640 |
+
add_action( 'plugins_loaded', array( 'Freemius', '_load_textdomain' ), 1 );
|
2641 |
+
}
|
2642 |
+
|
2643 |
+
add_action( 'admin_footer', array( 'Freemius', '_enrich_ajax_url' ) );
|
2644 |
+
|
2645 |
+
self::$_statics_loaded = true;
|
2646 |
+
}
|
2647 |
+
|
2648 |
+
#----------------------------------------------------------------------------------
|
2649 |
+
#region Localization
|
2650 |
+
#----------------------------------------------------------------------------------
|
2651 |
+
|
2652 |
+
/**
|
2653 |
+
* Load framework's text domain.
|
2654 |
+
*
|
2655 |
+
* @author Vova Feldman (@svovaf)
|
2656 |
+
* @since 1.2.1
|
2657 |
+
*/
|
2658 |
+
static function _load_textdomain() {
|
2659 |
+
if ( ! is_admin() ) {
|
2660 |
+
return;
|
2661 |
+
}
|
2662 |
+
|
2663 |
+
global $fs_active_plugins;
|
2664 |
+
|
2665 |
+
// Works both for plugins and themes.
|
2666 |
+
load_plugin_textdomain(
|
2667 |
+
'freemius',
|
2668 |
+
false,
|
2669 |
+
$fs_active_plugins->newest->sdk_path . '/languages/'
|
2670 |
+
);
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
#endregion
|
2674 |
+
|
2675 |
+
#----------------------------------------------------------------------------------
|
2676 |
+
#region Debugging
|
2677 |
+
#----------------------------------------------------------------------------------
|
2678 |
+
|
2679 |
+
/**
|
2680 |
+
* @author Vova Feldman (@svovaf)
|
2681 |
+
* @since 1.0.8
|
2682 |
+
*/
|
2683 |
+
static function _add_debug_section() {
|
2684 |
+
if ( ! is_super_admin() ) {
|
2685 |
+
// Add debug page only for super-admins.
|
2686 |
+
return;
|
2687 |
+
}
|
2688 |
+
|
2689 |
+
self::$_static_logger->entrance();
|
2690 |
+
|
2691 |
+
$title = sprintf( '%s [v.%s]', fs_text_inline( 'Freemius Debug' ), WP_FS__SDK_VERSION );
|
2692 |
+
|
2693 |
+
if ( WP_FS__DEV_MODE ) {
|
2694 |
+
// Add top-level debug menu item.
|
2695 |
+
$hook = FS_Admin_Menu_Manager::add_page(
|
2696 |
+
$title,
|
2697 |
+
$title,
|
2698 |
+
'manage_options',
|
2699 |
+
'freemius',
|
2700 |
+
array( 'Freemius', '_debug_page_render' )
|
2701 |
+
);
|
2702 |
+
} else {
|
2703 |
+
// Add hidden debug page.
|
2704 |
+
$hook = FS_Admin_Menu_Manager::add_subpage(
|
2705 |
+
null,
|
2706 |
+
$title,
|
2707 |
+
$title,
|
2708 |
+
'manage_options',
|
2709 |
+
'freemius',
|
2710 |
+
array( 'Freemius', '_debug_page_render' )
|
2711 |
+
);
|
2712 |
+
}
|
2713 |
+
|
2714 |
+
if ( ! empty( $hook ) ) {
|
2715 |
+
add_action( "load-$hook", array( 'Freemius', '_debug_page_actions' ) );
|
2716 |
+
}
|
2717 |
+
}
|
2718 |
+
|
2719 |
+
/**
|
2720 |
+
* @author Vova Feldman (@svovaf)
|
2721 |
+
* @since 1.1.7.3
|
2722 |
+
*/
|
2723 |
+
static function _toggle_debug_mode() {
|
2724 |
+
$is_on = fs_request_get( 'is_on', false, 'post' );
|
2725 |
+
|
2726 |
+
if ( fs_request_is_post() && in_array( $is_on, array( 0, 1 ) ) ) {
|
2727 |
+
update_option( 'fs_debug_mode', $is_on );
|
2728 |
+
|
2729 |
+
// Turn on/off storage logging.
|
2730 |
+
FS_Logger::_set_storage_logging( ( 1 == $is_on ) );
|
2731 |
+
}
|
2732 |
+
|
2733 |
+
exit;
|
2734 |
+
}
|
2735 |
+
|
2736 |
+
/**
|
2737 |
+
* @author Vova Feldman (@svovaf)
|
2738 |
+
* @since 1.2.1.6
|
2739 |
+
*/
|
2740 |
+
static function _get_debug_log() {
|
2741 |
+
$logs = FS_Logger::load_db_logs(
|
2742 |
+
fs_request_get( 'filters', false, 'post' ),
|
2743 |
+
! empty( $_POST['limit'] ) && is_numeric( $_POST['limit'] ) ? $_POST['limit'] : 200,
|
2744 |
+
! empty( $_POST['offset'] ) && is_numeric( $_POST['offset'] ) ? $_POST['offset'] : 0
|
2745 |
+
);
|
2746 |
+
|
2747 |
+
self::shoot_ajax_success( $logs );
|
2748 |
+
}
|
2749 |
+
|
2750 |
+
/**
|
2751 |
+
* @author Vova Feldman (@svovaf)
|
2752 |
+
* @since 1.2.1.7
|
2753 |
+
*/
|
2754 |
+
static function _get_db_option() {
|
2755 |
+
$option_name = fs_request_get( 'option_name' );
|
2756 |
+
|
2757 |
+
$value = get_option( $option_name );
|
2758 |
+
|
2759 |
+
$result = array(
|
2760 |
+
'name' => $option_name,
|
2761 |
+
);
|
2762 |
+
|
2763 |
+
if ( false !== $value ) {
|
2764 |
+
if ( ! is_string( $value ) ) {
|
2765 |
+
$value = json_encode( $value );
|
2766 |
+
}
|
2767 |
+
|
2768 |
+
$result['value'] = $value;
|
2769 |
+
}
|
2770 |
+
|
2771 |
+
self::shoot_ajax_success( $result );
|
2772 |
+
}
|
2773 |
+
|
2774 |
+
/**
|
2775 |
+
* @author Vova Feldman (@svovaf)
|
2776 |
+
* @since 1.2.1.7
|
2777 |
+
*/
|
2778 |
+
static function _set_db_option() {
|
2779 |
+
$option_name = fs_request_get( 'option_name' );
|
2780 |
+
$option_value = fs_request_get( 'option_value' );
|
2781 |
+
|
2782 |
+
if ( ! empty( $option_value ) ) {
|
2783 |
+
update_option( $option_name, $option_value );
|
2784 |
+
}
|
2785 |
+
|
2786 |
+
self::shoot_ajax_success();
|
2787 |
+
}
|
2788 |
+
|
2789 |
+
/**
|
2790 |
+
* @author Vova Feldman (@svovaf)
|
2791 |
+
* @since 1.0.8
|
2792 |
+
*/
|
2793 |
+
static function _debug_page_actions() {
|
2794 |
+
self::_clean_admin_content_section();
|
2795 |
+
|
2796 |
+
if ( fs_request_is_action( 'restart_freemius' ) ) {
|
2797 |
+
check_admin_referer( 'restart_freemius' );
|
2798 |
+
|
2799 |
+
if ( ! is_multisite() ) {
|
2800 |
+
// Clear accounts data.
|
2801 |
+
self::$_accounts->clear( null, true );
|
2802 |
+
} else {
|
2803 |
+
$sites = self::get_sites();
|
2804 |
+
foreach ( $sites as $site ) {
|
2805 |
+
$blog_id = self::get_site_blog_id( $site );
|
2806 |
+
self::$_accounts->clear( $blog_id, true );
|
2807 |
+
}
|
2808 |
+
|
2809 |
+
// Clear network level storage.
|
2810 |
+
self::$_accounts->clear( true, true );
|
2811 |
+
}
|
2812 |
+
|
2813 |
+
// Clear SDK reference cache.
|
2814 |
+
delete_option( 'fs_active_plugins' );
|
2815 |
+
} else if ( fs_request_is_action( 'clear_updates_data' ) ) {
|
2816 |
+
check_admin_referer( 'clear_updates_data' );
|
2817 |
+
|
2818 |
+
if ( ! is_multisite() ) {
|
2819 |
+
set_site_transient( 'update_plugins', null );
|
2820 |
+
set_site_transient( 'update_themes', null );
|
2821 |
+
} else {
|
2822 |
+
$current_blog_id = get_current_blog_id();
|
2823 |
+
|
2824 |
+
$sites = self::get_sites();
|
2825 |
+
foreach ( $sites as $site ) {
|
2826 |
+
switch_to_blog( self::get_site_blog_id( $site ) );
|
2827 |
+
|
2828 |
+
set_site_transient( 'update_plugins', null );
|
2829 |
+
set_site_transient( 'update_themes', null );
|
2830 |
+
}
|
2831 |
+
|
2832 |
+
switch_to_blog( $current_blog_id );
|
2833 |
+
}
|
2834 |
+
} else if ( fs_request_is_action( 'simulate_trial' ) ) {
|
2835 |
+
check_admin_referer( 'simulate_trial' );
|
2836 |
+
|
2837 |
+
$fs = freemius( fs_request_get( 'module_id' ) );
|
2838 |
+
|
2839 |
+
// Update SDK install to at least 24 hours before.
|
2840 |
+
$fs->_storage->install_timestamp = ( time() - WP_FS__TIME_24_HOURS_IN_SEC );
|
2841 |
+
// Unset the trial shown timestamp.
|
2842 |
+
unset( $fs->_storage->trial_promotion_shown );
|
2843 |
+
} else if ( fs_request_is_action( 'simulate_network_upgrade' ) ) {
|
2844 |
+
check_admin_referer( 'simulate_network_upgrade' );
|
2845 |
+
|
2846 |
+
$fs = freemius( fs_request_get( 'module_id' ) );
|
2847 |
+
|
2848 |
+
self::set_network_upgrade_mode( $fs->_storage );
|
2849 |
+
} else if ( fs_request_is_action( 'delete_install' ) ) {
|
2850 |
+
check_admin_referer( 'delete_install' );
|
2851 |
+
|
2852 |
+
self::_delete_site_by_slug(
|
2853 |
+
fs_request_get( 'slug' ),
|
2854 |
+
fs_request_get( 'module_type' ),
|
2855 |
+
true,
|
2856 |
+
fs_request_get( 'blog_id', null )
|
2857 |
+
);
|
2858 |
+
} else if ( fs_request_is_action( 'delete_user' ) ) {
|
2859 |
+
check_admin_referer( 'delete_user' );
|
2860 |
+
|
2861 |
+
self::delete_user( fs_request_get( 'user_id' ) );
|
2862 |
+
} else if ( fs_request_is_action( 'download_logs' ) ) {
|
2863 |
+
check_admin_referer( 'download_logs' );
|
2864 |
+
|
2865 |
+
$download_url = FS_Logger::download_db_logs(
|
2866 |
+
fs_request_get( 'filters', false, 'post' )
|
2867 |
+
);
|
2868 |
+
|
2869 |
+
if ( false === $download_url ) {
|
2870 |
+
wp_die( 'Oops... there was an error while generating the logs download file. Please try again and if it doesn\'t work contact support@freemius.com.' );
|
2871 |
+
}
|
2872 |
+
|
2873 |
+
fs_redirect( $download_url );
|
2874 |
+
}
|
2875 |
+
}
|
2876 |
+
|
2877 |
+
/**
|
2878 |
+
* @author Vova Feldman (@svovaf)
|
2879 |
+
* @since 1.0.8
|
2880 |
+
*/
|
2881 |
+
static function _debug_page_render() {
|
2882 |
+
self::$_static_logger->entrance();
|
2883 |
+
|
2884 |
+
if ( ! is_multisite() ) {
|
2885 |
+
$all_plugins_installs = self::get_all_sites( WP_FS__MODULE_TYPE_PLUGIN );
|
2886 |
+
$all_themes_installs = self::get_all_sites( WP_FS__MODULE_TYPE_THEME );
|
2887 |
+
} else {
|
2888 |
+
$sites = self::get_sites();
|
2889 |
+
|
2890 |
+
$all_plugins_installs = array();
|
2891 |
+
$all_themes_installs = array();
|
2892 |
+
|
2893 |
+
foreach ( $sites as $site ) {
|
2894 |
+
$blog_id = self::get_site_blog_id( $site );
|
2895 |
+
|
2896 |
+
$plugins_installs = self::get_all_sites( WP_FS__MODULE_TYPE_PLUGIN, $blog_id );
|
2897 |
+
|
2898 |
+
foreach ( $plugins_installs as $slug => $install ) {
|
2899 |
+
if ( ! isset( $all_plugins_installs[ $slug ] ) ) {
|
2900 |
+
$all_plugins_installs[ $slug ] = array();
|
2901 |
+
}
|
2902 |
+
|
2903 |
+
$install->blog_id = $blog_id;
|
2904 |
+
|
2905 |
+
$all_plugins_installs[ $slug ][] = $install;
|
2906 |
+
}
|
2907 |
+
|
2908 |
+
$themes_installs = self::get_all_sites( WP_FS__MODULE_TYPE_THEME, $blog_id );
|
2909 |
+
|
2910 |
+
foreach ( $themes_installs as $slug => $install ) {
|
2911 |
+
if ( ! isset( $all_themes_installs[ $slug ] ) ) {
|
2912 |
+
$all_themes_installs[ $slug ] = array();
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
$install->blog_id = $blog_id;
|
2916 |
+
|
2917 |
+
$all_themes_installs[ $slug ][] = $install;
|
2918 |
+
}
|
2919 |
+
}
|
2920 |
+
}
|
2921 |
+
|
2922 |
+
$licenses_by_module_type = self::get_all_licenses_by_module_type();
|
2923 |
+
|
2924 |
+
$vars = array(
|
2925 |
+
'plugin_sites' => $all_plugins_installs,
|
2926 |
+
'theme_sites' => $all_themes_installs,
|
2927 |
+
'users' => self::get_all_users(),
|
2928 |
+
'addons' => self::get_all_addons(),
|
2929 |
+
'account_addons' => self::get_all_account_addons(),
|
2930 |
+
'plugin_licenses' => $licenses_by_module_type[ WP_FS__MODULE_TYPE_PLUGIN ],
|
2931 |
+
'theme_licenses' => $licenses_by_module_type[ WP_FS__MODULE_TYPE_THEME ]
|
2932 |
+
);
|
2933 |
+
|
2934 |
+
fs_enqueue_local_style( 'fs_debug', '/admin/debug.css' );
|
2935 |
+
fs_require_once_template( 'debug.php', $vars );
|
2936 |
+
}
|
2937 |
+
|
2938 |
+
#endregion
|
2939 |
+
|
2940 |
+
#----------------------------------------------------------------------------------
|
2941 |
+
#region Connectivity Issues
|
2942 |
+
#----------------------------------------------------------------------------------
|
2943 |
+
|
2944 |
+
/**
|
2945 |
+
* Check if Freemius should be turned on for the current plugin install.
|
2946 |
+
*
|
2947 |
+
* Note:
|
2948 |
+
* $this->_is_on is updated in has_api_connectivity()
|
2949 |
+
*
|
2950 |
+
* @author Vova Feldman (@svovaf)
|
2951 |
+
* @since 1.0.9
|
2952 |
+
*
|
2953 |
+
* @return bool
|
2954 |
+
*/
|
2955 |
+
function is_on() {
|
2956 |
+
self::$_static_logger->entrance();
|
2957 |
+
|
2958 |
+
if ( isset( $this->_is_on ) ) {
|
2959 |
+
return $this->_is_on;
|
2960 |
+
}
|
2961 |
+
|
2962 |
+
// If already installed or pending then sure it's on :)
|
2963 |
+
if ( $this->is_registered() || $this->is_pending_activation() ) {
|
2964 |
+
$this->_is_on = true;
|
2965 |
+
|
2966 |
+
return true;
|
2967 |
+
}
|
2968 |
+
|
2969 |
+
return false;
|
2970 |
+
}
|
2971 |
+
|
2972 |
+
/**
|
2973 |
+
* @author Vova Feldman (@svovaf)
|
2974 |
+
* @since 1.1.7.3
|
2975 |
+
*
|
2976 |
+
* @param bool $flush_if_no_connectivity
|
2977 |
+
*
|
2978 |
+
* @return bool
|
2979 |
+
*/
|
2980 |
+
private function should_run_connectivity_test( $flush_if_no_connectivity = false ) {
|
2981 |
+
if ( ! isset( $this->_storage->connectivity_test ) ) {
|
2982 |
+
// Connectivity test was never executed, or cache was cleared.
|
2983 |
+
return true;
|
2984 |
+
}
|
2985 |
+
|
2986 |
+
if ( WP_FS__PING_API_ON_IP_OR_HOST_CHANGES ) {
|
2987 |
+
if ( WP_FS__IS_HTTP_REQUEST ) {
|
2988 |
+
if ( $_SERVER['HTTP_HOST'] != $this->_storage->connectivity_test['host'] ) {
|
2989 |
+
// Domain changed.
|
2990 |
+
return true;
|
2991 |
+
}
|
2992 |
+
|
2993 |
+
if ( WP_FS__REMOTE_ADDR != $this->_storage->connectivity_test['server_ip'] ) {
|
2994 |
+
// Server IP changed.
|
2995 |
+
return true;
|
2996 |
+
}
|
2997 |
+
}
|
2998 |
+
}
|
2999 |
+
|
3000 |
+
if ( $this->_storage->connectivity_test['is_connected'] &&
|
3001 |
+
$this->_storage->connectivity_test['is_active']
|
3002 |
+
) {
|
3003 |
+
// API connected and Freemius is active - no need to run connectivity check.
|
3004 |
+
return false;
|
3005 |
+
}
|
3006 |
+
|
3007 |
+
if ( $flush_if_no_connectivity ) {
|
3008 |
+
/**
|
3009 |
+
* If explicitly asked to flush when no connectivity - do it only
|
3010 |
+
* if at least 10 sec passed from the last API connectivity test.
|
3011 |
+
*/
|
3012 |
+
return ( isset( $this->_storage->connectivity_test['timestamp'] ) &&
|
3013 |
+
( WP_FS__SCRIPT_START_TIME - $this->_storage->connectivity_test['timestamp'] ) > 10 );
|
3014 |
+
}
|
3015 |
+
|
3016 |
+
/**
|
3017 |
+
* @since 1.1.7 Don't check for connectivity on plugin downgrade.
|
3018 |
+
*/
|
3019 |
+
$version = $this->get_plugin_version();
|
3020 |
+
if ( version_compare( $version, $this->_storage->connectivity_test['version'], '>' ) ) {
|
3021 |
+
// If it's a plugin version upgrade and Freemius is off or no connectivity, run connectivity test.
|
3022 |
+
return true;
|
3023 |
+
}
|
3024 |
+
|
3025 |
+
return false;
|
3026 |
+
}
|
3027 |
+
|
3028 |
+
/**
|
3029 |
+
* @author Vova Feldman (@svovaf)
|
3030 |
+
* @since 1.1.7.4
|
3031 |
+
*
|
3032 |
+
* @param int|null $blog_id Since 2.0.0.
|
3033 |
+
*
|
3034 |
+
* @return object|false
|
3035 |
+
*/
|
3036 |
+
private function ping( $blog_id = null ) {
|
3037 |
+
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY ) {
|
3038 |
+
return false;
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
$version = $this->get_plugin_version();
|
3042 |
+
|
3043 |
+
$is_update = $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() );
|
3044 |
+
|
3045 |
+
return $this->get_api_plugin_scope()->ping(
|
3046 |
+
$this->get_anonymous_id( $blog_id ),
|
3047 |
+
array(
|
3048 |
+
'is_update' => json_encode( $is_update ),
|
3049 |
+
'version' => $version,
|
3050 |
+
'sdk' => $this->version,
|
3051 |
+
'is_admin' => json_encode( is_admin() ),
|
3052 |
+
'is_ajax' => json_encode( self::is_ajax() ),
|
3053 |
+
'is_cron' => json_encode( self::is_cron() ),
|
3054 |
+
'is_http' => json_encode( WP_FS__IS_HTTP_REQUEST ),
|
3055 |
+
)
|
3056 |
+
);
|
3057 |
+
}
|
3058 |
+
|
3059 |
+
/**
|
3060 |
+
* Check if there's any connectivity issue to Freemius API.
|
3061 |
+
*
|
3062 |
+
* @author Vova Feldman (@svovaf)
|
3063 |
+
* @since 1.0.9
|
3064 |
+
*
|
3065 |
+
* @param bool $flush_if_no_connectivity
|
3066 |
+
*
|
3067 |
+
* @return bool
|
3068 |
+
*/
|
3069 |
+
function has_api_connectivity( $flush_if_no_connectivity = false ) {
|
3070 |
+
$this->_logger->entrance();
|
3071 |
+
|
3072 |
+
if ( isset( $this->_has_api_connection ) && ( $this->_has_api_connection || ! $flush_if_no_connectivity ) ) {
|
3073 |
+
return $this->_has_api_connection;
|
3074 |
+
}
|
3075 |
+
|
3076 |
+
if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY &&
|
3077 |
+
isset( $this->_storage->connectivity_test ) &&
|
3078 |
+
true === $this->_storage->connectivity_test['is_connected']
|
3079 |
+
) {
|
3080 |
+
unset( $this->_storage->connectivity_test );
|
3081 |
+
}
|
3082 |
+
|
3083 |
+
if ( ! $this->should_run_connectivity_test( $flush_if_no_connectivity ) ) {
|
3084 |
+
$this->_has_api_connection = $this->_storage->connectivity_test['is_connected'];
|
3085 |
+
/**
|
3086 |
+
* @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
|
3087 |
+
*
|
3088 |
+
* @since 1.2.1.5 If the user running the premium version then ignore the 'is_active' flag and turn Freemius on to enable license key activation.
|
3089 |
+
*/
|
3090 |
+
$this->_is_on = $this->_storage->connectivity_test['is_active'] ||
|
3091 |
+
$this->is_premium() ||
|
3092 |
+
( WP_FS__DEV_MODE && $this->_has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF );
|
3093 |
+
|
3094 |
+
return $this->_has_api_connection;
|
3095 |
+
}
|
3096 |
+
|
3097 |
+
$pong = $this->ping();
|
3098 |
+
$is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
|
3099 |
+
|
3100 |
+
if ( ! $is_connected ) {
|
3101 |
+
// API failure.
|
3102 |
+
$this->_add_connectivity_issue_message( $pong );
|
3103 |
+
}
|
3104 |
+
|
3105 |
+
$this->store_connectivity_info( $pong, $is_connected );
|
3106 |
+
|
3107 |
+
return $this->_has_api_connection;
|
3108 |
+
}
|
3109 |
+
|
3110 |
+
/**
|
3111 |
+
* @author Vova Feldman (@svovaf)
|
3112 |
+
* @since 1.1.7.4
|
3113 |
+
*
|
3114 |
+
* @param object $pong
|
3115 |
+
* @param bool $is_connected
|
3116 |
+
*/
|
3117 |
+
private function store_connectivity_info( $pong, $is_connected ) {
|
3118 |
+
$this->_logger->entrance();
|
3119 |
+
|
3120 |
+
$version = $this->get_plugin_version();
|
3121 |
+
|
3122 |
+
if ( ! $is_connected || WP_FS__SIMULATE_FREEMIUS_OFF ) {
|
3123 |
+
$is_active = false;
|
3124 |
+
} else {
|
3125 |
+
$is_active = ( isset( $pong->is_active ) && true == $pong->is_active );
|
3126 |
+
}
|
3127 |
+
|
3128 |
+
$is_active = $this->apply_filters(
|
3129 |
+
'is_on',
|
3130 |
+
$is_active,
|
3131 |
+
$this->is_plugin_update(),
|
3132 |
+
$version
|
3133 |
+
);
|
3134 |
+
|
3135 |
+
$this->_storage->connectivity_test = array(
|
3136 |
+
'is_connected' => $is_connected,
|
3137 |
+
'host' => $_SERVER['HTTP_HOST'],
|
3138 |
+
'server_ip' => WP_FS__REMOTE_ADDR,
|
3139 |
+
'is_active' => $is_active,
|
3140 |
+
'timestamp' => WP_FS__SCRIPT_START_TIME,
|
3141 |
+
// Last version with connectivity attempt.
|
3142 |
+
'version' => $version,
|
3143 |
+
);
|
3144 |
+
|
3145 |
+
$this->_has_api_connection = $is_connected;
|
3146 |
+
$this->_is_on = $is_active || ( WP_FS__DEV_MODE && $is_connected && ! WP_FS__SIMULATE_FREEMIUS_OFF );
|
3147 |
+
}
|
3148 |
+
|
3149 |
+
/**
|
3150 |
+
* Force turning Freemius on.
|
3151 |
+
*
|
3152 |
+
* @author Vova Feldman (@svovaf)
|
3153 |
+
* @since 1.1.8.1
|
3154 |
+
*
|
3155 |
+
* @return bool TRUE if successfully turned on.
|
3156 |
+
*/
|
3157 |
+
private function turn_on() {
|
3158 |
+
$this->_logger->entrance();
|
3159 |
+
|
3160 |
+
if ( $this->is_on() || ! isset( $this->_storage->connectivity_test['is_active'] ) ) {
|
3161 |
+
return false;
|
3162 |
+
}
|
3163 |
+
|
3164 |
+
$updated_connectivity = $this->_storage->connectivity_test;
|
3165 |
+
$updated_connectivity['is_active'] = true;
|
3166 |
+
$updated_connectivity['timestamp'] = WP_FS__SCRIPT_START_TIME;
|
3167 |
+
$this->_storage->connectivity_test = $updated_connectivity;
|
3168 |
+
|
3169 |
+
$this->_is_on = true;
|
3170 |
+
|
3171 |
+
return true;
|
3172 |
+
}
|
3173 |
+
|
3174 |
+
/**
|
3175 |
+
* Anonymous and unique site identifier (Hash).
|
3176 |
+
*
|
3177 |
+
* @author Vova Feldman (@svovaf)
|
3178 |
+
* @since 1.1.0
|
3179 |
+
*
|
3180 |
+
* @param null|int $blog_id Since 2.0.0
|
3181 |
+
*
|
3182 |
+
* @return string
|
3183 |
+
*/
|
3184 |
+
function get_anonymous_id( $blog_id = null ) {
|
3185 |
+
$unique_id = self::$_accounts->get_option( 'unique_id', null, $blog_id );
|
3186 |
+
|
3187 |
+
if ( empty( $unique_id ) || ! is_string( $unique_id ) ) {
|
3188 |
+
$key = fs_strip_url_protocol( get_site_url( $blog_id ) );
|
3189 |
+
|
3190 |
+
$secure_auth = SECURE_AUTH_KEY;
|
3191 |
+
if ( empty( $secure_auth ) || false !== strpos( $secure_auth, ' ' ) ) {
|
3192 |
+
// Protect against default auth key.
|
3193 |
+
$secure_auth = md5( microtime() );
|
3194 |
+
}
|
3195 |
+
|
3196 |
+
/**
|
3197 |
+
* Base the unique identifier on the WP secure authentication key. Which
|
3198 |
+
* turns the key into a secret anonymous identifier. This will help us
|
3199 |
+
* to avoid duplicate installs generation on the backend upon opt-in.
|
3200 |
+
*
|
3201 |
+
* @author Vova Feldman (@svovaf)
|
3202 |
+
* @since 1.2.3
|
3203 |
+
*/
|
3204 |
+
$unique_id = md5( $key . $secure_auth );
|
3205 |
+
|
3206 |
+
self::$_accounts->set_option( 'unique_id', $unique_id, true, $blog_id );
|
3207 |
+
}
|
3208 |
+
|
3209 |
+
$this->_logger->departure( $unique_id );
|
3210 |
+
|
3211 |
+
return $unique_id;
|
3212 |
+
}
|
3213 |
+
|
3214 |
+
/**
|
3215 |
+
* @author Vova Feldman (@svovaf)
|
3216 |
+
* @since 1.1.7.4
|
3217 |
+
*
|
3218 |
+
* @return \WP_User
|
3219 |
+
*/
|
3220 |
+
static function _get_current_wp_user() {
|
3221 |
+
self::require_pluggable_essentials();
|
3222 |
+
|
3223 |
+
return wp_get_current_user();
|
3224 |
+
}
|
3225 |
+
|
3226 |
+
/**
|
3227 |
+
* @author Vova Feldman (@svovaf)
|
3228 |
+
* @since 1.2.1.7
|
3229 |
+
*
|
3230 |
+
* @param string $email
|
3231 |
+
*
|
3232 |
+
* @return bool
|
3233 |
+
*/
|
3234 |
+
static function is_valid_email( $email ) {
|
3235 |
+
if ( false === filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
|
3236 |
+
return false;
|
3237 |
+
}
|
3238 |
+
|
3239 |
+
$parts = explode( '@', $email );
|
3240 |
+
|
3241 |
+
if ( 2 !== count( $parts ) || empty( $parts[1] ) ) {
|
3242 |
+
return false;
|
3243 |
+
}
|
3244 |
+
|
3245 |
+
$blacklist = array(
|
3246 |
+
'admin.',
|
3247 |
+
'webmaster.',
|
3248 |
+
'localhost.',
|
3249 |
+
'dev.',
|
3250 |
+
'development.',
|
3251 |
+
'test.',
|
3252 |
+
'stage.',
|
3253 |
+
'staging.',
|
3254 |
+
);
|
3255 |
+
|
3256 |
+
// Make sure domain is not one of the blacklisted.
|
3257 |
+
foreach ( $blacklist as $invalid ) {
|
3258 |
+
if ( 0 === strpos( $parts[1], $invalid ) ) {
|
3259 |
+
return false;
|
3260 |
+
}
|
3261 |
+
}
|
3262 |
+
|
3263 |
+
// Get the UTF encoded domain name.
|
3264 |
+
$domain = idn_to_ascii( $parts[1] ) . '.';
|
3265 |
+
|
3266 |
+
return ( checkdnsrr( $domain, 'MX' ) || checkdnsrr( $domain, 'A' ) );
|
3267 |
+
}
|
3268 |
+
|
3269 |
+
/**
|
3270 |
+
* Generate API connectivity issue message.
|
3271 |
+
*
|
3272 |
+
* @author Vova Feldman (@svovaf)
|
3273 |
+
* @since 1.0.9
|
3274 |
+
*
|
3275 |
+
* @param mixed $api_result
|
3276 |
+
* @param bool $is_first_failure
|
3277 |
+
*/
|
3278 |
+
function _add_connectivity_issue_message( $api_result, $is_first_failure = true ) {
|
3279 |
+
if ( ! $this->is_premium() && $this->_enable_anonymous ) {
|
3280 |
+
// Don't add message if it's the free version and can run anonymously.
|
3281 |
+
return;
|
3282 |
+
}
|
3283 |
+
|
3284 |
+
if ( ! function_exists( 'wp_nonce_url' ) ) {
|
3285 |
+
require_once ABSPATH . 'wp-includes/functions.php';
|
3286 |
+
}
|
3287 |
+
|
3288 |
+
$current_user = self::_get_current_wp_user();
|
3289 |
+
// $admin_email = get_option( 'admin_email' );
|
3290 |
+
$admin_email = $current_user->user_email;
|
3291 |
+
|
3292 |
+
// Aliases.
|
3293 |
+
$deactivate_plugin_title = $this->esc_html_inline( 'That\'s exhausting, please deactivate', 'deactivate-plugin-title' );
|
3294 |
+
$deactivate_plugin_desc = $this->esc_html_inline( 'We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future.', 'deactivate-plugin-desc' );
|
3295 |
+
$install_previous_title = $this->esc_html_inline( 'Let\'s try your previous version', 'install-previous-title' );
|
3296 |
+
$install_previous_desc = $this->esc_html_inline( 'Uninstall this version and install the previous one.', 'install-previous-desc' );
|
3297 |
+
$fix_issue_title = $this->esc_html_inline( 'Yes - I\'m giving you a chance to fix it', 'fix-issue-title' );
|
3298 |
+
$fix_issue_desc = $this->esc_html_inline( 'We will do our best to whitelist your server and resolve this issue ASAP. You will get a follow-up email to %s once we have an update.', 'fix-issue-desc' );
|
3299 |
+
/* translators: %s: product title (e.g. "Awesome Plugin" requires an access to...) */
|
3300 |
+
$x_requires_access_to_api = $this->esc_html_inline( '%s requires an access to our API.', 'x-requires-access-to-api' );
|
3301 |
+
$sysadmin_title = $this->esc_html_inline( 'I\'m a system administrator', 'sysadmin-title' );
|
3302 |
+
$happy_to_resolve_issue_asap = $this->esc_html_inline( 'We are sure it\'s an issue on our side and more than happy to resolve it for you ASAP if you give us a chance.', 'happy-to-resolve-issue-asap' );
|
3303 |
+
|
3304 |
+
$message = false;
|
3305 |
+
if ( is_object( $api_result ) &&
|
3306 |
+
isset( $api_result->error ) &&
|
3307 |
+
isset( $api_result->error->code )
|
3308 |
+
) {
|
3309 |
+
switch ( $api_result->error->code ) {
|
3310 |
+
case 'curl_missing':
|
3311 |
+
$missing_methods = '';
|
3312 |
+
if ( is_array( $api_result->missing_methods ) &&
|
3313 |
+
! empty( $api_result->missing_methods )
|
3314 |
+
) {
|
3315 |
+
foreach ( $api_result->missing_methods as $m ) {
|
3316 |
+
if ( 'curl_version' === $m ) {
|
3317 |
+
continue;
|
3318 |
+
}
|
3319 |
+
|
3320 |
+
if ( ! empty( $missing_methods ) ) {
|
3321 |
+
$missing_methods .= ', ';
|
3322 |
+
}
|
3323 |
+
|
3324 |
+
$missing_methods .= sprintf( '<code>%s</code>', $m );
|
3325 |
+
}
|
3326 |
+
|
3327 |
+
if ( ! empty( $missing_methods ) ) {
|
3328 |
+
$missing_methods = sprintf(
|
3329 |
+
'<br><br><b>%s</b> %s',
|
3330 |
+
$this->esc_html_inline( 'Disabled method(s):', 'curl-disabled-methods' ),
|
3331 |
+
$missing_methods
|
3332 |
+
);
|
3333 |
+
}
|
3334 |
+
}
|
3335 |
+
|
3336 |
+
$message = sprintf(
|
3337 |
+
$x_requires_access_to_api . ' ' .
|
3338 |
+
$this->esc_html_inline( 'We use PHP cURL library for the API calls, which is a very common library and usually installed and activated out of the box. Unfortunately, cURL is not activated (or disabled) on your server.', 'curl-missing-message' ) . ' ' .
|
3339 |
+
$missing_methods .
|
3340 |
+
' %s',
|
3341 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
3342 |
+
sprintf(
|
3343 |
+
'<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
|
3344 |
+
sprintf(
|
3345 |
+
'<a class="fs-resolve" data-type="curl" href="#"><b>%s</b></a>%s',
|
3346 |
+
$this->get_text_inline( 'I don\'t know what is cURL or how to install it, help me!', 'curl-missing-no-clue-title' ),
|
3347 |
+
' - ' . sprintf(
|
3348 |
+
$this->get_text_inline( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'curl-missing-no-clue-desc' ),
|
3349 |
+
'<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
|
3350 |
+
)
|
3351 |
+
),
|
3352 |
+
sprintf(
|
3353 |
+
'<b>%s</b> - %s',
|
3354 |
+
$sysadmin_title,
|
3355 |
+
esc_html( sprintf( $this->get_text_inline( 'Great, please install cURL and enable it in your php.ini file. In addition, search for the \'disable_functions\' directive in your php.ini file and remove any disabled methods starting with \'curl_\'. To make sure it was successfully activated, use \'phpinfo()\'. Once activated, deactivate the %s and reactivate it back again.', 'curl-missing-sysadmin-desc' ), $this->get_module_label( true ) ) )
|
3356 |
+
),
|
3357 |
+
sprintf(
|
3358 |
+
'<a href="%s"><b>%s</b></a> - %s',
|
3359 |
+
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this->_plugin_basename . '&plugin_status=all&paged=1&s=', 'deactivate-plugin_' . $this->_plugin_basename ),
|
3360 |
+
$deactivate_plugin_title,
|
3361 |
+
$deactivate_plugin_desc
|
3362 |
+
)
|
3363 |
+
)
|
3364 |
+
);
|
3365 |
+
break;
|
3366 |
+
case 'cloudflare_ddos_protection':
|
3367 |
+
$message = sprintf(
|
3368 |
+
$x_requires_access_to_api . ' ' .
|
3369 |
+
$this->esc_html_inline( 'From unknown reason, CloudFlare, the firewall we use, blocks the connection.', 'cloudflare-blocks-connection-message' ) . ' ' .
|
3370 |
+
$happy_to_resolve_issue_asap .
|
3371 |
+
' %s',
|
3372 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
3373 |
+
sprintf(
|
3374 |
+
'<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
|
3375 |
+
sprintf(
|
3376 |
+
'<a class="fs-resolve" data-type="cloudflare" href="#"><b>%s</b></a>%s',
|
3377 |
+
$fix_issue_title,
|
3378 |
+
' - ' . sprintf(
|
3379 |
+
$fix_issue_desc,
|
3380 |
+
'<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
|
3381 |
+
)
|
3382 |
+
),
|
3383 |
+
sprintf(
|
3384 |
+
'<a href="%s" target="_blank"><b>%s</b></a> - %s',
|
3385 |
+
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
3386 |
+
$install_previous_title,
|
3387 |
+
$install_previous_desc
|
3388 |
+
),
|
3389 |
+
sprintf(
|
3390 |
+
'<a href="%s"><b>%s</b></a> - %s',
|
3391 |
+
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this->_plugin_basename . '&plugin_status=all&paged=1&s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
|
3392 |
+
$deactivate_plugin_title,
|
3393 |
+
$deactivate_plugin_desc
|
3394 |
+
)
|
3395 |
+
)
|
3396 |
+
);
|
3397 |
+
break;
|
3398 |
+
case 'squid_cache_block':
|
3399 |
+
$message = sprintf(
|
3400 |
+
$x_requires_access_to_api . ' ' .
|
3401 |
+
$this->esc_html_inline( 'It looks like your server is using Squid ACL (access control lists), which blocks the connection.', 'squid-blocks-connection-message' ) .
|
3402 |
+
' %s',
|
3403 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
3404 |
+
sprintf(
|
3405 |
+
'<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
|
3406 |
+
sprintf(
|
3407 |
+
'<a class="fs-resolve" data-type="squid" href="#"><b>%s</b></a> - %s',
|
3408 |
+
$this->esc_html_inline( 'I don\'t know what is Squid or ACL, help me!', 'squid-no-clue-title' ),
|
3409 |
+
sprintf(
|
3410 |
+
$this->esc_html_inline( 'We\'ll make sure to contact your hosting company and resolve the issue. You will get a follow-up email to %s once we have an update.', 'squid-no-clue-desc' ),
|
3411 |
+
'<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
|
3412 |
+
)
|
3413 |
+
),
|
3414 |
+
sprintf(
|
3415 |
+
'<b>%s</b> - %s',
|
3416 |
+
$sysadmin_title,
|
3417 |
+
sprintf(
|
3418 |
+
$this->esc_html_inline( 'Great, please whitelist the following domains: %s. Once you are done, deactivate the %s and activate it again.', 'squid-sysadmin-desc' ),
|
3419 |
+
// We use a filter since the plugin might require additional API connectivity.
|
3420 |
+
'<b>' . implode( ', ', $this->apply_filters( 'api_domains', array(
|
3421 |
+
'api.freemius.com',
|
3422 |
+
'wp.freemius.com'
|
3423 |
+
) ) ) . '</b>',
|
3424 |
+
$this->_module_type
|
3425 |
+
)
|
3426 |
+
),
|
3427 |
+
sprintf(
|
3428 |
+
'<a href="%s"><b>%s</b></a> - %s',
|
3429 |
+
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this->_plugin_basename . '&plugin_status=all&paged=1&s=', 'deactivate-plugin_' . $this->_plugin_basename ),
|
3430 |
+
$deactivate_plugin_title,
|
3431 |
+
$deactivate_plugin_desc
|
3432 |
+
)
|
3433 |
+
)
|
3434 |
+
);
|
3435 |
+
break;
|
3436 |
+
// default:
|
3437 |
+
// $message = $this->get_text_inline( 'connectivity-test-fails-message' );
|
3438 |
+
// break;
|
3439 |
+
}
|
3440 |
+
}
|
3441 |
+
|
3442 |
+
$message_id = 'failed_connect_api';
|
3443 |
+
$type = 'error';
|
3444 |
+
|
3445 |
+
$connectivity_test_fails_message = $this->esc_html_inline( 'From unknown reason, the API connectivity test failed.', 'connectivity-test-fails-message' );
|
3446 |
+
|
3447 |
+
if ( false === $message ) {
|
3448 |
+
if ( $is_first_failure ) {
|
3449 |
+
// First attempt failed.
|
3450 |
+
$message = sprintf(
|
3451 |
+
$x_requires_access_to_api . ' ' .
|
3452 |
+
$connectivity_test_fails_message . ' ' .
|
3453 |
+
$this->esc_html_inline( 'It\'s probably a temporary issue on our end. Just to be sure, with your permission, would it be o.k to run another connectivity test?', 'connectivity-test-maybe-temporary' ) . '<br><br>' .
|
3454 |
+
'%s',
|
3455 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
3456 |
+
sprintf(
|
3457 |
+
'<div id="fs_firewall_issue_options">%s %s</div>',
|
3458 |
+
sprintf(
|
3459 |
+
'<a class="button button-primary fs-resolve" data-type="retry_ping" href="#">%s</a>',
|
3460 |
+
$this->get_text_inline( 'Yes - do your thing', 'yes-do-your-thing' )
|
3461 |
+
),
|
3462 |
+
sprintf(
|
3463 |
+
'<a href="%s" class="button">%s</a>',
|
3464 |
+
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this->_plugin_basename . '&plugin_status=all&paged=1&s=', 'deactivate-plugin_' . $this->_plugin_basename ),
|
3465 |
+
$this->get_text_inline( 'No - just deactivate', 'no-deactivate' )
|
3466 |
+
)
|
3467 |
+
)
|
3468 |
+
);
|
3469 |
+
|
3470 |
+
$message_id = 'failed_connect_api_first';
|
3471 |
+
$type = 'promotion';
|
3472 |
+
} else {
|
3473 |
+
// Second connectivity attempt failed.
|
3474 |
+
$message = sprintf(
|
3475 |
+
$x_requires_access_to_api . ' ' .
|
3476 |
+
$connectivity_test_fails_message . ' ' .
|
3477 |
+
$happy_to_resolve_issue_asap .
|
3478 |
+
' %s',
|
3479 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
3480 |
+
sprintf(
|
3481 |
+
'<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
|
3482 |
+
sprintf(
|
3483 |
+
'<a class="fs-resolve" data-type="general" href="#"><b>%s</b></a>%s',
|
3484 |
+
$fix_issue_title,
|
3485 |
+
' - ' . sprintf(
|
3486 |
+
$fix_issue_desc,
|
3487 |
+
'<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
|
3488 |
+
)
|
3489 |
+
),
|
3490 |
+
sprintf(
|
3491 |
+
'<a href="%s" target="_blank"><b>%s</b></a> - %s',
|
3492 |
+
sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
|
3493 |
+
$install_previous_title,
|
3494 |
+
$install_previous_desc
|
3495 |
+
),
|
3496 |
+
sprintf(
|
3497 |
+
'<a href="%s"><b>%s</b></a> - %s',
|
3498 |
+
wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $this->_plugin_basename . '&plugin_status=all&paged=1&s=', 'deactivate-plugin_' . $this->_plugin_basename ),
|
3499 |
+
$deactivate_plugin_title,
|
3500 |
+
$deactivate_plugin_desc
|
3501 |
+
)
|
3502 |
+
)
|
3503 |
+
);
|
3504 |
+
}
|
3505 |
+
}
|
3506 |
+
|
3507 |
+
$this->_admin_notices->add_sticky(
|
3508 |
+
$message,
|
3509 |
+
$message_id,
|
3510 |
+
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
|
3511 |
+
$type
|
3512 |
+
);
|
3513 |
+
}
|
3514 |
+
|
3515 |
+
/**
|
3516 |
+
* Handle user request to resolve connectivity issue.
|
3517 |
+
* This method will send an email to Freemius API technical staff for resolution.
|
3518 |
+
* The email will contain server's info and installed plugins (might be caching issue).
|
3519 |
+
*
|
3520 |
+
* @author Vova Feldman (@svovaf)
|
3521 |
+
* @since 1.0.9
|
3522 |
+
*/
|
3523 |
+
function _email_about_firewall_issue() {
|
3524 |
+
$this->_admin_notices->remove_sticky( 'failed_connect_api' );
|
3525 |
+
|
3526 |
+
$pong = $this->ping();
|
3527 |
+
|
3528 |
+
$is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
|
3529 |
+
|
3530 |
+
if ( $is_connected ) {
|
3531 |
+
$this->store_connectivity_info( $pong, $is_connected );
|
3532 |
+
|
3533 |
+
echo $this->get_after_plugin_activation_redirect_url();
|
3534 |
+
exit;
|
3535 |
+
}
|
3536 |
+
|
3537 |
+
$current_user = self::_get_current_wp_user();
|
3538 |
+
$admin_email = $current_user->user_email;
|
3539 |
+
|
3540 |
+
$error_type = fs_request_get( 'error_type', 'general' );
|
3541 |
+
|
3542 |
+
switch ( $error_type ) {
|
3543 |
+
case 'squid':
|
3544 |
+
$title = 'Squid ACL Blocking Issue';
|
3545 |
+
break;
|
3546 |
+
case 'cloudflare':
|
3547 |
+
$title = 'CloudFlare Blocking Issue';
|
3548 |
+
break;
|
3549 |
+
default:
|
3550 |
+
$title = 'API Connectivity Issue';
|
3551 |
+
break;
|
3552 |
+
}
|
3553 |
+
|
3554 |
+
$custom_email_sections = array();
|
3555 |
+
|
3556 |
+
// Add 'API Error' custom email section.
|
3557 |
+
$custom_email_sections['api_error'] = array(
|
3558 |
+
'title' => 'API Error',
|
3559 |
+
'rows' => array(
|
3560 |
+
'ping' => array(
|
3561 |
+
'API Error',
|
3562 |
+
is_string( $pong ) ? htmlentities( $pong ) : json_encode( $pong )
|
3563 |
+
),
|
3564 |
+
)
|
3565 |
+
);
|
3566 |
+
|
3567 |
+
// Send email with technical details to resolve API connectivity issues.
|
3568 |
+
$this->send_email(
|
3569 |
+
'api@freemius.com', // recipient
|
3570 |
+
$title . ' [' . $this->get_plugin_name() . ']', // subject
|
3571 |
+
$custom_email_sections,
|
3572 |
+
array( "Reply-To: $admin_email <$admin_email>" ) // headers
|
3573 |
+
);
|
3574 |
+
|
3575 |
+
$this->_admin_notices->add_sticky(
|
3576 |
+
sprintf(
|
3577 |
+
$this->get_text_inline( 'Thank for giving us the chance to fix it! A message was just sent to our technical staff. We will get back to you as soon as we have an update to %s. Appreciate your patience.', 'fix-request-sent-message' ),
|
3578 |
+
'<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
|
3579 |
+
),
|
3580 |
+
'server_details_sent'
|
3581 |
+
);
|
3582 |
+
|
3583 |
+
// Action was taken, tell that API connectivity troubleshooting should be off now.
|
3584 |
+
|
3585 |
+
echo "1";
|
3586 |
+
exit;
|
3587 |
+
}
|
3588 |
+
|
3589 |
+
/**
|
3590 |
+
* Handle connectivity test retry approved by the user.
|
3591 |
+
*
|
3592 |
+
* @author Vova Feldman (@svovaf)
|
3593 |
+
* @since 1.1.7.4
|
3594 |
+
*/
|
3595 |
+
function _retry_connectivity_test() {
|
3596 |
+
$this->_admin_notices->remove_sticky( 'failed_connect_api_first' );
|
3597 |
+
|
3598 |
+
$pong = $this->ping();
|
3599 |
+
|
3600 |
+
$is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
|
3601 |
+
|
3602 |
+
if ( $is_connected ) {
|
3603 |
+
$this->store_connectivity_info( $pong, $is_connected );
|
3604 |
+
|
3605 |
+
echo $this->get_after_plugin_activation_redirect_url();
|
3606 |
+
} else {
|
3607 |
+
// Add connectivity issue message after 2nd failed attempt.
|
3608 |
+
$this->_add_connectivity_issue_message( $pong, false );
|
3609 |
+
|
3610 |
+
echo "1";
|
3611 |
+
}
|
3612 |
+
|
3613 |
+
exit;
|
3614 |
+
}
|
3615 |
+
|
3616 |
+
static function _add_firewall_issues_javascript() {
|
3617 |
+
$params = array();
|
3618 |
+
fs_require_once_template( 'firewall-issues-js.php', $params );
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
#endregion
|
3622 |
+
|
3623 |
+
#----------------------------------------------------------------------------------
|
3624 |
+
#region Email
|
3625 |
+
#----------------------------------------------------------------------------------
|
3626 |
+
|
3627 |
+
/**
|
3628 |
+
* Generates and sends an HTML email with customizable sections.
|
3629 |
+
*
|
3630 |
+
* @author Leo Fajardo (@leorw)
|
3631 |
+
* @since 1.1.2
|
3632 |
+
*
|
3633 |
+
* @param string $to_address
|
3634 |
+
* @param string $subject
|
3635 |
+
* @param array $sections
|
3636 |
+
* @param array $headers
|
3637 |
+
*
|
3638 |
+
* @return bool Whether the email contents were sent successfully.
|
3639 |
+
*/
|
3640 |
+
private function send_email(
|
3641 |
+
$to_address,
|
3642 |
+
$subject,
|
3643 |
+
$sections = array(),
|
3644 |
+
$headers = array()
|
3645 |
+
) {
|
3646 |
+
$default_sections = $this->get_email_sections();
|
3647 |
+
|
3648 |
+
// Insert new sections or replace the default email sections.
|
3649 |
+
if ( is_array( $sections ) && ! empty( $sections ) ) {
|
3650 |
+
foreach ( $sections as $section_id => $custom_section ) {
|
3651 |
+
if ( ! isset( $default_sections[ $section_id ] ) ) {
|
3652 |
+
// If the section does not exist, add it.
|
3653 |
+
$default_sections[ $section_id ] = $custom_section;
|
3654 |
+
} else {
|
3655 |
+
// If the section already exists, override it.
|
3656 |
+
$current_section = $default_sections[ $section_id ];
|
3657 |
+
|
3658 |
+
// Replace the current section's title if a custom section title exists.
|
3659 |
+
if ( isset( $custom_section['title'] ) ) {
|
3660 |
+
$current_section['title'] = $custom_section['title'];
|
3661 |
+
}
|
3662 |
+
|
3663 |
+
// Insert new rows under the current section or replace the default rows.
|
3664 |
+
if ( isset( $custom_section['rows'] ) && is_array( $custom_section['rows'] ) && ! empty( $custom_section['rows'] ) ) {
|
3665 |
+
foreach ( $custom_section['rows'] as $row_id => $row ) {
|
3666 |
+
$current_section['rows'][ $row_id ] = $row;
|
3667 |
+
}
|
3668 |
+
}
|
3669 |
+
|
3670 |
+
$default_sections[ $section_id ] = $current_section;
|
3671 |
+
}
|
3672 |
+
}
|
3673 |
+
}
|
3674 |
+
|
3675 |
+
$vars = array( 'sections' => $default_sections );
|
3676 |
+
$message = fs_get_template( 'email.php', $vars );
|
3677 |
+
|
3678 |
+
// Set the type of email to HTML.
|
3679 |
+
$headers[] = 'Content-type: text/html; charset=UTF-8';
|
3680 |
+
|
3681 |
+
$header_string = implode( "\r\n", $headers );
|
3682 |
+
|
3683 |
+
return wp_mail(
|
3684 |
+
$to_address,
|
3685 |
+
$subject,
|
3686 |
+
$message,
|
3687 |
+
$header_string
|
3688 |
+
);
|
3689 |
+
}
|
3690 |
+
|
3691 |
+
/**
|
3692 |
+
* Generates the data for the sections of the email content.
|
3693 |
+
*
|
3694 |
+
* @author Leo Fajardo (@leorw)
|
3695 |
+
* @since 1.1.2
|
3696 |
+
*
|
3697 |
+
* @return array
|
3698 |
+
*/
|
3699 |
+
private function get_email_sections() {
|
3700 |
+
// Retrieve the current user's information so that we can get the user's email, first name, and last name below.
|
3701 |
+
$current_user = self::_get_current_wp_user();
|
3702 |
+
|
3703 |
+
// Retrieve the cURL version information so that we can get the version number below.
|
3704 |
+
$curl_version_information = curl_version();
|
3705 |
+
|
3706 |
+
$active_plugin = self::get_active_plugins();
|
3707 |
+
|
3708 |
+
// Generate the list of active plugins separated by new line.
|
3709 |
+
$active_plugin_string = '';
|
3710 |
+
foreach ( $active_plugin as $plugin ) {
|
3711 |
+
$active_plugin_string .= sprintf(
|
3712 |
+
'<a href="%s">%s</a> [v%s]<br>',
|
3713 |
+
$plugin['PluginURI'],
|
3714 |
+
$plugin['Name'],
|
3715 |
+
$plugin['Version']
|
3716 |
+
);
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
$server_ip = WP_FS__REMOTE_ADDR;
|
3720 |
+
|
3721 |
+
// Add PHP info for deeper investigation.
|
3722 |
+
ob_start();
|
3723 |
+
phpinfo();
|
3724 |
+
$php_info = ob_get_clean();
|
3725 |
+
|
3726 |
+
$api_domain = substr( FS_API__ADDRESS, strpos( FS_API__ADDRESS, ':' ) + 3 );
|
3727 |
+
|
3728 |
+
// Generate the default email sections.
|
3729 |
+
$sections = array(
|
3730 |
+
'sdk' => array(
|
3731 |
+
'title' => 'SDK',
|
3732 |
+
'rows' => array(
|
3733 |
+
'fs_version' => array( 'FS Version', $this->version ),
|
3734 |
+
'curl_version' => array( 'cURL Version', $curl_version_information['version'] )
|
3735 |
+
)
|
3736 |
+
),
|
3737 |
+
'plugin' => array(
|
3738 |
+
'title' => ucfirst( $this->get_module_type() ),
|
3739 |
+
'rows' => array(
|
3740 |
+
'name' => array( 'Name', $this->get_plugin_name() ),
|
3741 |
+
'version' => array( 'Version', $this->get_plugin_version() )
|
3742 |
+
)
|
3743 |
+
),
|
3744 |
+
'api' => array(
|
3745 |
+
'title' => 'API Subdomain',
|
3746 |
+
'rows' => array(
|
3747 |
+
'dns' => array(
|
3748 |
+
'DNS_CNAME',
|
3749 |
+
function_exists( 'dns_get_record' ) ?
|
3750 |
+
var_export( dns_get_record( $api_domain, DNS_CNAME ), true ) :
|
3751 |
+
'dns_get_record() disabled/blocked'
|
3752 |
+
),
|
3753 |
+
'ip' => array(
|
3754 |
+
'IP',
|
3755 |
+
function_exists( 'gethostbyname' ) ?
|
3756 |
+
gethostbyname( $api_domain ) :
|
3757 |
+
'gethostbyname() disabled/blocked'
|
3758 |
+
),
|
3759 |
+
),
|
3760 |
+
),
|
3761 |
+
'site' => array(
|
3762 |
+
'title' => 'Site',
|
3763 |
+
'rows' => array(
|
3764 |
+
'unique_id' => array( 'Unique ID', $this->get_anonymous_id() ),
|
3765 |
+
'address' => array( 'Address', site_url() ),
|
3766 |
+
'host' => array(
|
3767 |
+
'HTTP_HOST',
|
3768 |
+
( ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '' )
|
3769 |
+
),
|
3770 |
+
'hosting' => array(
|
3771 |
+
'Hosting Company' => fs_request_has( 'hosting_company' ) ?
|
3772 |
+
fs_request_get( 'hosting_company' ) :
|
3773 |
+
'Unknown',
|
3774 |
+
),
|
3775 |
+
'server_addr' => array(
|
3776 |
+
'SERVER_ADDR',
|
3777 |
+
'<a href="http://www.projecthoneypot.org/ip_' . $server_ip . '">' . $server_ip . '</a>'
|
3778 |
+
)
|
3779 |
+
)
|
3780 |
+
),
|
3781 |
+
'user' => array(
|
3782 |
+
'title' => 'User',
|
3783 |
+
'rows' => array(
|
3784 |
+
'email' => array( 'Email', $current_user->user_email ),
|
3785 |
+
'first' => array( 'First', $current_user->user_firstname ),
|
3786 |
+
'last' => array( 'Last', $current_user->user_lastname )
|
3787 |
+
)
|
3788 |
+
),
|
3789 |
+
'plugins' => array(
|
3790 |
+
'title' => 'Plugins',
|
3791 |
+
'rows' => array(
|
3792 |
+
'active_plugins' => array( 'Active Plugins', $active_plugin_string )
|
3793 |
+
)
|
3794 |
+
),
|
3795 |
+
'php_info' => array(
|
3796 |
+
'title' => 'PHP Info',
|
3797 |
+
'rows' => array(
|
3798 |
+
'info' => array( $php_info )
|
3799 |
+
),
|
3800 |
+
)
|
3801 |
+
);
|
3802 |
+
|
3803 |
+
// Allow the sections to be modified by other code.
|
3804 |
+
$sections = $this->apply_filters( 'email_template_sections', $sections );
|
3805 |
+
|
3806 |
+
return $sections;
|
3807 |
+
}
|
3808 |
+
|
3809 |
+
#endregion
|
3810 |
+
|
3811 |
+
#----------------------------------------------------------------------------------
|
3812 |
+
#region Initialization
|
3813 |
+
#----------------------------------------------------------------------------------
|
3814 |
+
|
3815 |
+
/**
|
3816 |
+
* Init plugin's Freemius instance.
|
3817 |
+
*
|
3818 |
+
* @author Vova Feldman (@svovaf)
|
3819 |
+
* @since 1.0.1
|
3820 |
+
*
|
3821 |
+
* @param number $id
|
3822 |
+
* @param string $public_key
|
3823 |
+
* @param bool $is_live
|
3824 |
+
* @param bool $is_premium
|
3825 |
+
*/
|
3826 |
+
function init( $id, $public_key, $is_live = true, $is_premium = true ) {
|
3827 |
+
$this->_logger->entrance();
|
3828 |
+
|
3829 |
+
$this->dynamic_init( array(
|
3830 |
+
'id' => $id,
|
3831 |
+
'public_key' => $public_key,
|
3832 |
+
'is_live' => $is_live,
|
3833 |
+
'is_premium' => $is_premium,
|
3834 |
+
) );
|
3835 |
+
}
|
3836 |
+
|
3837 |
+
/**
|
3838 |
+
* Dynamic initiator, originally created to support initiation
|
3839 |
+
* with parent_id for add-ons.
|
3840 |
+
*
|
3841 |
+
* @author Vova Feldman (@svovaf)
|
3842 |
+
* @since 1.0.6
|
3843 |
+
*
|
3844 |
+
* @param array $plugin_info
|
3845 |
+
*
|
3846 |
+
* @throws Freemius_Exception
|
3847 |
+
*/
|
3848 |
+
function dynamic_init( array $plugin_info ) {
|
3849 |
+
$this->_logger->entrance();
|
3850 |
+
|
3851 |
+
$this->parse_settings( $plugin_info );
|
3852 |
+
|
3853 |
+
if ( ! self::is_ajax() ) {
|
3854 |
+
if ( ! $this->is_addon() || $this->is_only_premium() ) {
|
3855 |
+
add_action(
|
3856 |
+
( $this->_is_network_active && fs_is_network_admin() ? 'network_' : '' ) . 'admin_menu',
|
3857 |
+
array( &$this, '_prepare_admin_menu' ),
|
3858 |
+
WP_FS__LOWEST_PRIORITY
|
3859 |
+
);
|
3860 |
+
}
|
3861 |
+
}
|
3862 |
+
|
3863 |
+
if ( $this->should_stop_execution() ) {
|
3864 |
+
return;
|
3865 |
+
}
|
3866 |
+
|
3867 |
+
if ( ! $this->is_registered() ) {
|
3868 |
+
if ( $this->is_anonymous() ) {
|
3869 |
+
// If user skipped, no need to test connectivity.
|
3870 |
+
$this->_has_api_connection = true;
|
3871 |
+
$this->_is_on = true;
|
3872 |
+
} else {
|
3873 |
+
if ( ! $this->has_api_connectivity() ) {
|
3874 |
+
if ( $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) ||
|
3875 |
+
$this->_admin_notices->has_sticky( 'failed_connect_api' )
|
3876 |
+
) {
|
3877 |
+
if ( ! $this->_enable_anonymous || $this->is_premium() ) {
|
3878 |
+
// If anonymous mode is disabled, add firewall admin-notice message.
|
3879 |
+
add_action( 'admin_footer', array( 'Freemius', '_add_firewall_issues_javascript' ) );
|
3880 |
+
|
3881 |
+
$ajax_action_suffix = $this->_slug . ( $this->is_theme() ? ':theme' : '' );
|
3882 |
+
add_action( "wp_ajax_fs_resolve_firewall_issues_{$ajax_action_suffix}", array(
|
3883 |
+
&$this,
|
3884 |
+
'_email_about_firewall_issue'
|
3885 |
+
) );
|
3886 |
+
|
3887 |
+
add_action( "wp_ajax_fs_retry_connectivity_test_{$ajax_action_suffix}", array(
|
3888 |
+
&$this,
|
3889 |
+
'_retry_connectivity_test'
|
3890 |
+
) );
|
3891 |
+
|
3892 |
+
/**
|
3893 |
+
* Currently the admin notice manager relies on the module's type and slug. The new AJAX actions manager uses module IDs, hence, consider to replace the if block above with the commented code below after adjusting the admin notices manager to work with module IDs.
|
3894 |
+
*
|
3895 |
+
* @author Vova Feldman (@svovaf)
|
3896 |
+
* @since 2.0.0
|
3897 |
+
*/
|
3898 |
+
/*$this->add_ajax_action( 'resolve_firewall_issues', array(
|
3899 |
+
&$this,
|
3900 |
+
'_email_about_firewall_issue'
|
3901 |
+
) );
|
3902 |
+
|
3903 |
+
$this->add_ajax_action( 'retry_connectivity_test', array(
|
3904 |
+
&$this,
|
3905 |
+
'_retry_connectivity_test'
|
3906 |
+
) );*/
|
3907 |
+
}
|
3908 |
+
}
|
3909 |
+
|
3910 |
+
return;
|
3911 |
+
} else {
|
3912 |
+
$this->_admin_notices->remove_sticky( array(
|
3913 |
+
'failed_connect_api_first',
|
3914 |
+
'failed_connect_api',
|
3915 |
+
) );
|
3916 |
+
|
3917 |
+
if ( $this->_anonymous_mode ) {
|
3918 |
+
// Simulate anonymous mode.
|
3919 |
+
$this->_is_anonymous = true;
|
3920 |
+
}
|
3921 |
+
}
|
3922 |
+
}
|
3923 |
+
}
|
3924 |
+
|
3925 |
+
/**
|
3926 |
+
* This should be executed even if Freemius is off for the core module,
|
3927 |
+
* otherwise, the add-ons dialogbox won't work properly. This is esepcially
|
3928 |
+
* relevant when the developer decided to turn FS off for existing users.
|
3929 |
+
*
|
3930 |
+
* @author Vova Feldman (@svovaf)
|
3931 |
+
*/
|
3932 |
+
if ( $this->is_user_in_admin() &&
|
3933 |
+
! $this->is_addon() &&
|
3934 |
+
$this->has_addons() &&
|
3935 |
+
'plugin-information' === fs_request_get( 'tab', false ) &&
|
3936 |
+
$this->get_id() == fs_request_get( 'parent_plugin_id', false )
|
3937 |
+
) {
|
3938 |
+
require_once WP_FS__DIR_INCLUDES . '/fs-plugin-info-dialog.php';
|
3939 |
+
|
3940 |
+
new FS_Plugin_Info_Dialog( $this );
|
3941 |
+
}
|
3942 |
+
|
3943 |
+
// Check if Freemius is on for the current plugin.
|
3944 |
+
// This MUST be executed after all the plugin variables has been loaded.
|
3945 |
+
if ( ! $this->is_registered() && ! $this->is_on() ) {
|
3946 |
+
return;
|
3947 |
+
}
|
3948 |
+
|
3949 |
+
if ( $this->has_api_connectivity() ) {
|
3950 |
+
if ( self::is_cron() ) {
|
3951 |
+
$this->hook_callback_to_sync_cron();
|
3952 |
+
} else if ( $this->is_user_in_admin() ) {
|
3953 |
+
/**
|
3954 |
+
* Schedule daily data sync cron if:
|
3955 |
+
*
|
3956 |
+
* 1. User opted-in (for tracking).
|
3957 |
+
* 2. If skipped, but later upgraded (opted-in via upgrade).
|
3958 |
+
*
|
3959 |
+
* @author Vova Feldman (@svovaf)
|
3960 |
+
* @since 1.1.7.3
|
3961 |
+
*
|
3962 |
+
*/
|
3963 |
+
if ( $this->is_registered() ) {
|
3964 |
+
if ( ! $this->is_sync_cron_on() && $this->is_tracking_allowed() ) {
|
3965 |
+
$this->schedule_sync_cron();
|
3966 |
+
}
|
3967 |
+
}
|
3968 |
+
|
3969 |
+
/**
|
3970 |
+
* Check if requested for manual blocking background sync.
|
3971 |
+
*/
|
3972 |
+
if ( fs_request_has( 'background_sync' ) ) {
|
3973 |
+
$this->run_manual_sync();
|
3974 |
+
}
|
3975 |
+
}
|
3976 |
+
}
|
3977 |
+
|
3978 |
+
if ( $this->is_registered() ) {
|
3979 |
+
$this->hook_callback_to_install_sync();
|
3980 |
+
}
|
3981 |
+
|
3982 |
+
if ( $this->is_addon() ) {
|
3983 |
+
if ( $this->is_parent_plugin_installed() ) {
|
3984 |
+
// Link to parent FS.
|
3985 |
+
$this->_parent = self::get_instance_by_id( $this->_plugin->parent_plugin_id );
|
3986 |
+
|
3987 |
+
// Get parent plugin reference.
|
3988 |
+
$this->_parent_plugin = $this->_parent->get_plugin();
|
3989 |
+
}
|
3990 |
+
}
|
3991 |
+
|
3992 |
+
if ( $this->is_user_in_admin() ) {
|
3993 |
+
if ( $this->is_addon() ) {
|
3994 |
+
if ( ! $this->is_parent_plugin_installed() ) {
|
3995 |
+
$parent_name = $this->get_option( $plugin_info, 'parent_name', null );
|
3996 |
+
|
3997 |
+
if ( isset( $plugin_info['parent'] ) ) {
|
3998 |
+
$parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
|
3999 |
+
}
|
4000 |
+
|
4001 |
+
$this->_admin_notices->add(
|
4002 |
+
( ! empty( $parent_name ) ?
|
4003 |
+
sprintf( $this->get_text_x_inline( '%s cannot run without %s.', 'addonX cannot run without pluginY', 'addon-x-cannot-run-without-y' ), $this->get_plugin_name(), $parent_name ) :
|
4004 |
+
sprintf( $this->get_text_x_inline( '%s cannot run without the plugin.', 'addonX cannot run...', 'addon-x-cannot-run-without-parent' ), $this->get_plugin_name() )
|
4005 |
+
),
|
4006 |
+
$this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...',
|
4007 |
+
'error'
|
4008 |
+
);
|
4009 |
+
|
4010 |
+
return;
|
4011 |
+
} else {
|
4012 |
+
if ( $this->_parent->is_registered() && ! $this->is_registered() ) {
|
4013 |
+
// If parent plugin activated, automatically install add-on for the user.
|
4014 |
+
$this->_activate_addon_account( $this->_parent );
|
4015 |
+
} else if ( ! $this->_parent->is_registered() && $this->is_registered() ) {
|
4016 |
+
// If add-on activated and parent not, automatically install parent for the user.
|
4017 |
+
$this->activate_parent_account( $this->_parent );
|
4018 |
+
}
|
4019 |
+
|
4020 |
+
// @todo This should be only executed on activation. It should be migrated to register_activation_hook() together with other activation related logic.
|
4021 |
+
if ( $this->is_premium() ) {
|
4022 |
+
// Remove add-on download admin-notice.
|
4023 |
+
$this->_parent->_admin_notices->remove_sticky( array(
|
4024 |
+
'addon_plan_upgraded_' . $this->_slug,
|
4025 |
+
'no_addon_license_' . $this->_slug,
|
4026 |
+
) );
|
4027 |
+
}
|
4028 |
+
|
4029 |
+
// $this->deactivate_premium_only_addon_without_license();
|
4030 |
+
}
|
4031 |
+
}
|
4032 |
+
|
4033 |
+
add_action( 'admin_init', array( &$this, '_admin_init_action' ) );
|
4034 |
+
|
4035 |
+
// if ( $this->is_registered() ||
|
4036 |
+
// $this->is_anonymous() ||
|
4037 |
+
// $this->is_pending_activation()
|
4038 |
+
// ) {
|
4039 |
+
// $this->_init_admin();
|
4040 |
+
// }
|
4041 |
+
}
|
4042 |
+
|
4043 |
+
/**
|
4044 |
+
* Should be called outside `$this->is_user_in_admin()` scope
|
4045 |
+
* because the updater has some logic that needs to be executed
|
4046 |
+
* during AJAX calls.
|
4047 |
+
*
|
4048 |
+
* Currently we need to hook to the `http_request_host_is_external` filter.
|
4049 |
+
* In the future, there might be additional logic added.
|
4050 |
+
*
|
4051 |
+
* @author Vova Feldman
|
4052 |
+
* @since 1.2.1.6
|
4053 |
+
*/
|
4054 |
+
if ( $this->is_premium() && $this->has_release_on_freemius() ) {
|
4055 |
+
FS_Plugin_Updater::instance( $this );
|
4056 |
+
}
|
4057 |
+
|
4058 |
+
$this->do_action( 'initiated' );
|
4059 |
+
|
4060 |
+
if ( $this->_storage->prev_is_premium !== $this->_plugin->is_premium ) {
|
4061 |
+
if ( isset( $this->_storage->prev_is_premium ) ) {
|
4062 |
+
$this->apply_filters(
|
4063 |
+
'after_code_type_change',
|
4064 |
+
// New code type.
|
4065 |
+
$this->_plugin->is_premium
|
4066 |
+
);
|
4067 |
+
} else {
|
4068 |
+
// Set for code type for the first time.
|
4069 |
+
$this->_storage->prev_is_premium = $this->_plugin->is_premium;
|
4070 |
+
}
|
4071 |
+
}
|
4072 |
+
|
4073 |
+
if ( ! $this->is_addon() ) {
|
4074 |
+
if ( $this->is_registered() ) {
|
4075 |
+
// Fix for upgrade from versions < 1.0.9.
|
4076 |
+
if ( ! isset( $this->_storage->activation_timestamp ) ) {
|
4077 |
+
$this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
|
4078 |
+
}
|
4079 |
+
|
4080 |
+
$this->do_action( 'after_init_plugin_registered' );
|
4081 |
+
} else if ( $this->is_anonymous() ) {
|
4082 |
+
$this->do_action( 'after_init_plugin_anonymous' );
|
4083 |
+
} else if ( $this->is_pending_activation() ) {
|
4084 |
+
$this->do_action( 'after_init_plugin_pending_activations' );
|
4085 |
+
}
|
4086 |
+
} else {
|
4087 |
+
if ( $this->is_registered() ) {
|
4088 |
+
$this->do_action( 'after_init_addon_registered' );
|
4089 |
+
} else if ( $this->is_anonymous() ) {
|
4090 |
+
$this->do_action( 'after_init_addon_anonymous' );
|
4091 |
+
} else if ( $this->is_pending_activation() ) {
|
4092 |
+
$this->do_action( 'after_init_addon_pending_activations' );
|
4093 |
+
}
|
4094 |
+
}
|
4095 |
+
}
|
4096 |
+
|
4097 |
+
/**
|
4098 |
+
* @author Leo Fajardo (@leorw)
|
4099 |
+
*
|
4100 |
+
* @since 1.2.1.5
|
4101 |
+
*/
|
4102 |
+
function _stop_tracking_callback() {
|
4103 |
+
$this->_logger->entrance();
|
4104 |
+
|
4105 |
+
$this->check_ajax_referer( 'stop_tracking' );
|
4106 |
+
|
4107 |
+
$result = $this->stop_tracking( fs_is_network_admin() );
|
4108 |
+
|
4109 |
+
if ( true === $result ) {
|
4110 |
+
self::shoot_ajax_success();
|
4111 |
+
}
|
4112 |
+
|
4113 |
+
$this->_logger->api_error( $result );
|
4114 |
+
|
4115 |
+
self::shoot_ajax_failure(
|
4116 |
+
sprintf( $this->get_text_inline( 'Unexpected API error. Please contact the %s\'s author with the following error.', 'unexpected-api-error' ), $this->_module_type ) .
|
4117 |
+
( $this->is_api_error( $result ) && isset( $result->error ) ?
|
4118 |
+
$result->error->message :
|
4119 |
+
var_export( $result, true ) )
|
4120 |
+
);
|
4121 |
+
}
|
4122 |
+
|
4123 |
+
/**
|
4124 |
+
* @author Leo Fajardo (@leorw)
|
4125 |
+
* @since 1.2.1.5
|
4126 |
+
*/
|
4127 |
+
function _allow_tracking_callback() {
|
4128 |
+
$this->_logger->entrance();
|
4129 |
+
|
4130 |
+
$this->check_ajax_referer( 'allow_tracking' );
|
4131 |
+
|
4132 |
+
$result = $this->allow_tracking( fs_is_network_admin() );
|
4133 |
+
|
4134 |
+
if ( true === $result ) {
|
4135 |
+
self::shoot_ajax_success();
|
4136 |
+
}
|
4137 |
+
|
4138 |
+
$this->_logger->api_error( $result );
|
4139 |
+
|
4140 |
+
self::shoot_ajax_failure(
|
4141 |
+
sprintf( $this->get_text_inline( 'Unexpected API error. Please contact the %s\'s author with the following error.', 'unexpected-api-error' ), $this->_module_type ) .
|
4142 |
+
( $this->is_api_error( $result ) && isset( $result->error ) ?
|
4143 |
+
$result->error->message :
|
4144 |
+
var_export( $result, true ) )
|
4145 |
+
);
|
4146 |
+
}
|
4147 |
+
|
4148 |
+
/**
|
4149 |
+
* Opt-out from usage tracking.
|
4150 |
+
*
|
4151 |
+
* Note: This will not delete the account information but will stop all tracking.
|
4152 |
+
*
|
4153 |
+
* Returns:
|
4154 |
+
* 1. FALSE - If the user never opted-in.
|
4155 |
+
* 2. TRUE - If successfully opted-out.
|
4156 |
+
* 3. object - API result on failure.
|
4157 |
+
*
|
4158 |
+
* @author Leo Fajardo (@leorw)
|
4159 |
+
* @since 1.2.1.5
|
4160 |
+
*
|
4161 |
+
* @return bool|object
|
4162 |
+
*/
|
4163 |
+
function stop_site_tracking() {
|
4164 |
+
$this->_logger->entrance();
|
4165 |
+
|
4166 |
+
if ( ! $this->is_registered() ) {
|
4167 |
+
// User never opted-in.
|
4168 |
+
return false;
|
4169 |
+
}
|
4170 |
+
|
4171 |
+
if ( $this->is_tracking_prohibited() ) {
|
4172 |
+
// Already disconnected.
|
4173 |
+
return true;
|
4174 |
+
}
|
4175 |
+
|
4176 |
+
// Send update to FS.
|
4177 |
+
$result = $this->get_api_site_scope()->call( '/?fields=is_disconnected', 'put', array(
|
4178 |
+
'is_disconnected' => true
|
4179 |
+
) );
|
4180 |
+
|
4181 |
+
if ( ! $this->is_api_result_entity( $result ) ||
|
4182 |
+
! isset( $result->is_disconnected ) ||
|
4183 |
+
! $result->is_disconnected
|
4184 |
+
) {
|
4185 |
+
$this->_logger->api_error( $result );
|
4186 |
+
|
4187 |
+
return $result;
|
4188 |
+
}
|
4189 |
+
|
4190 |
+
$this->_site->is_disconnected = $result->is_disconnected;
|
4191 |
+
$this->_store_site();
|
4192 |
+
|
4193 |
+
$this->clear_sync_cron();
|
4194 |
+
|
4195 |
+
// Successfully disconnected.
|
4196 |
+
return true;
|
4197 |
+
}
|
4198 |
+
|
4199 |
+
/**
|
4200 |
+
* Opt-out network from usage tracking.
|
4201 |
+
*
|
4202 |
+
* Note: This will not delete the account information but will stop all tracking.
|
4203 |
+
*
|
4204 |
+
* Returns:
|
4205 |
+
* 1. FALSE - If the user never opted-in.
|
4206 |
+
* 2. TRUE - If successfully opted-out.
|
4207 |
+
* 3. object - API result on failure.
|
4208 |
+
*
|
4209 |
+
* @author Leo Fajardo (@leorw)
|
4210 |
+
* @since 1.2.1.5
|
4211 |
+
*
|
4212 |
+
* @return bool|object
|
4213 |
+
*/
|
4214 |
+
function stop_network_tracking() {
|
4215 |
+
$this->_logger->entrance();
|
4216 |
+
|
4217 |
+
if ( ! $this->is_registered() ) {
|
4218 |
+
// User never opted-in.
|
4219 |
+
return false;
|
4220 |
+
}
|
4221 |
+
|
4222 |
+
$install_id_2_blog_id = array();
|
4223 |
+
$installs_map = $this->get_blog_install_map();
|
4224 |
+
|
4225 |
+
$opt_out_all = true;
|
4226 |
+
|
4227 |
+
$params = array();
|
4228 |
+
foreach ( $installs_map as $blog_id => $install ) {
|
4229 |
+
if ( $install->is_tracking_prohibited() ) {
|
4230 |
+
// Already opted-out.
|
4231 |
+
continue;
|
4232 |
+
}
|
4233 |
+
|
4234 |
+
if ( $this->is_site_delegated_connection( $blog_id ) ) {
|
4235 |
+
// Opt-out only from non-delegated installs.
|
4236 |
+
$opt_out_all = false;
|
4237 |
+
continue;
|
4238 |
+
}
|
4239 |
+
|
4240 |
+
$params[] = array( 'id' => $install->id );
|
4241 |
+
|
4242 |
+
$install_id_2_blog_id[ $install->id ] = $blog_id;
|
4243 |
+
}
|
4244 |
+
|
4245 |
+
if ( empty( $install_id_2_blog_id ) ) {
|
4246 |
+
return true;
|
4247 |
+
}
|
4248 |
+
|
4249 |
+
$params[] = array( 'is_disconnected' => true );
|
4250 |
+
|
4251 |
+
// Send update to FS.
|
4252 |
+
$result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json", 'put', $params );
|
4253 |
+
|
4254 |
+
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
4255 |
+
$this->_logger->api_error( $result );
|
4256 |
+
|
4257 |
+
return $result;
|
4258 |
+
}
|
4259 |
+
|
4260 |
+
foreach ( $result->installs as $r_install ) {
|
4261 |
+
$blog_id = $install_id_2_blog_id[ $r_install->id ];
|
4262 |
+
$install = $installs_map[ $blog_id ];
|
4263 |
+
$install->is_disconnected = $r_install->is_disconnected;
|
4264 |
+
$this->_store_site( true, $blog_id, $install );
|
4265 |
+
}
|
4266 |
+
|
4267 |
+
$this->clear_sync_cron( $opt_out_all );
|
4268 |
+
|
4269 |
+
// Successfully disconnected.
|
4270 |
+
return true;
|
4271 |
+
}
|
4272 |
+
|
4273 |
+
/**
|
4274 |
+
* Opt-out from usage tracking.
|
4275 |
+
*
|
4276 |
+
* Note: This will not delete the account information but will stop all tracking.
|
4277 |
+
*
|
4278 |
+
* Returns:
|
4279 |
+
* 1. FALSE - If the user never opted-in.
|
4280 |
+
* 2. TRUE - If successfully opted-out.
|
4281 |
+
* 3. object - API result on failure.
|
4282 |
+
*
|
4283 |
+
* @author Leo Fajardo (@leorw)
|
4284 |
+
* @since 1.2.1.5
|
4285 |
+
*
|
4286 |
+
* @param bool $is_network_action
|
4287 |
+
*
|
4288 |
+
* @return bool|object
|
4289 |
+
*/
|
4290 |
+
function stop_tracking( $is_network_action = false ) {
|
4291 |
+
$this->_logger->entrance();
|
4292 |
+
|
4293 |
+
return $is_network_action ?
|
4294 |
+
$this->stop_network_tracking() :
|
4295 |
+
$this->stop_site_tracking();
|
4296 |
+
}
|
4297 |
+
|
4298 |
+
/**
|
4299 |
+
* Opt-in back into usage tracking.
|
4300 |
+
*
|
4301 |
+
* Note: This will only work if the user opted-in previously.
|
4302 |
+
*
|
4303 |
+
* Returns:
|
4304 |
+
* 1. FALSE - If the user never opted-in.
|
4305 |
+
* 2. TRUE - If successfully opted-in back to usage tracking.
|
4306 |
+
* 3. object - API result on failure.
|
4307 |
+
*
|
4308 |
+
* @author Leo Fajardo (@leorw)
|
4309 |
+
* @since 1.2.1.5
|
4310 |
+
*
|
4311 |
+
* @return bool|object
|
4312 |
+
*/
|
4313 |
+
function allow_site_tracking() {
|
4314 |
+
$this->_logger->entrance();
|
4315 |
+
|
4316 |
+
if ( ! $this->is_registered() ) {
|
4317 |
+
// User never opted-in.
|
4318 |
+
return false;
|
4319 |
+
}
|
4320 |
+
|
4321 |
+
if ( $this->is_tracking_allowed() ) {
|
4322 |
+
// Tracking already allowed.
|
4323 |
+
return true;
|
4324 |
+
}
|
4325 |
+
|
4326 |
+
$result = $this->get_api_site_scope()->call( '/?is_disconnected', 'put', array(
|
4327 |
+
'is_disconnected' => false
|
4328 |
+
) );
|
4329 |
+
|
4330 |
+
if ( ! $this->is_api_result_entity( $result ) ||
|
4331 |
+
! isset( $result->is_disconnected ) ||
|
4332 |
+
$result->is_disconnected
|
4333 |
+
) {
|
4334 |
+
$this->_logger->api_error( $result );
|
4335 |
+
|
4336 |
+
return $result;
|
4337 |
+
}
|
4338 |
+
|
4339 |
+
$this->_site->is_disconnected = $result->is_disconnected;
|
4340 |
+
$this->_store_site();
|
4341 |
+
|
4342 |
+
$this->schedule_sync_cron();
|
4343 |
+
|
4344 |
+
// Successfully reconnected.
|
4345 |
+
return true;
|
4346 |
+
}
|
4347 |
+
|
4348 |
+
/**
|
4349 |
+
* Opt-in network back into usage tracking.
|
4350 |
+
*
|
4351 |
+
* Note: This will only work if the user opted-in previously.
|
4352 |
+
*
|
4353 |
+
* Returns:
|
4354 |
+
* 1. FALSE - If the user never opted-in.
|
4355 |
+
* 2. TRUE - If successfully opted-in back to usage tracking.
|
4356 |
+
* 3. object - API result on failure.
|
4357 |
+
*
|
4358 |
+
* @author Leo Fajardo (@leorw)
|
4359 |
+
* @since 1.2.1.5
|
4360 |
+
*
|
4361 |
+
* @return bool|object
|
4362 |
+
*/
|
4363 |
+
function allow_network_tracking() {
|
4364 |
+
$this->_logger->entrance();
|
4365 |
+
|
4366 |
+
if ( ! $this->is_registered() ) {
|
4367 |
+
// User never opted-in.
|
4368 |
+
return false;
|
4369 |
+
}
|
4370 |
+
|
4371 |
+
$install_id_2_blog_id = array();
|
4372 |
+
$installs_map = $this->get_blog_install_map();
|
4373 |
+
|
4374 |
+
$params = array();
|
4375 |
+
foreach ( $installs_map as $blog_id => $install ) {
|
4376 |
+
if ( $install->is_tracking_allowed() ) {
|
4377 |
+
continue;
|
4378 |
+
}
|
4379 |
+
|
4380 |
+
$params[] = array( 'id' => $install->id );
|
4381 |
+
|
4382 |
+
$install_id_2_blog_id[ $install->id ] = $blog_id;
|
4383 |
+
}
|
4384 |
+
|
4385 |
+
if ( empty( $install_id_2_blog_id ) ) {
|
4386 |
+
return true;
|
4387 |
+
}
|
4388 |
+
|
4389 |
+
$params[] = array( 'is_disconnected' => false );
|
4390 |
+
|
4391 |
+
// Send update to FS.
|
4392 |
+
$result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json", 'put', $params );
|
4393 |
+
|
4394 |
+
|
4395 |
+
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
4396 |
+
$this->_logger->api_error( $result );
|
4397 |
+
|
4398 |
+
return $result;
|
4399 |
+
}
|
4400 |
+
|
4401 |
+
foreach ( $result->installs as $r_install ) {
|
4402 |
+
$blog_id = $install_id_2_blog_id[ $r_install->id ];
|
4403 |
+
$install = $installs_map[ $blog_id ];
|
4404 |
+
$install->is_disconnected = $r_install->is_disconnected;
|
4405 |
+
$this->_store_site( true, $blog_id, $install );
|
4406 |
+
}
|
4407 |
+
|
4408 |
+
$this->schedule_sync_cron();
|
4409 |
+
|
4410 |
+
// Successfully reconnected.
|
4411 |
+
return true;
|
4412 |
+
}
|
4413 |
+
|
4414 |
+
/**
|
4415 |
+
* Opt-in back into usage tracking.
|
4416 |
+
*
|
4417 |
+
* Note: This will only work if the user opted-in previously.
|
4418 |
+
*
|
4419 |
+
* Returns:
|
4420 |
+
* 1. FALSE - If the user never opted-in.
|
4421 |
+
* 2. TRUE - If successfully opted-in back to usage tracking.
|
4422 |
+
* 3. object - API result on failure.
|
4423 |
+
*
|
4424 |
+
* @author Leo Fajardo (@leorw)
|
4425 |
+
* @since 1.2.1.5
|
4426 |
+
*
|
4427 |
+
* @param bool $is_network_action
|
4428 |
+
*
|
4429 |
+
* @return bool|object
|
4430 |
+
*/
|
4431 |
+
function allow_tracking( $is_network_action = false ) {
|
4432 |
+
$this->_logger->entrance();
|
4433 |
+
|
4434 |
+
return $is_network_action ?
|
4435 |
+
$this->allow_network_tracking() :
|
4436 |
+
$this->allow_site_tracking();
|
4437 |
+
}
|
4438 |
+
|
4439 |
+
/**
|
4440 |
+
* If user opted-in and later disabled usage-tracking,
|
4441 |
+
* re-allow tracking for licensing and updates.
|
4442 |
+
*
|
4443 |
+
* @author Leo Fajardo (@leorw)
|
4444 |
+
* @since 1.2.1.5
|
4445 |
+
*
|
4446 |
+
* @param bool $is_context_single_site
|
4447 |
+
*/
|
4448 |
+
private function reconnect_locally( $is_context_single_site = false ) {
|
4449 |
+
$this->_logger->entrance();
|
4450 |
+
|
4451 |
+
if ( ! $this->is_registered() ) {
|
4452 |
+
return;
|
4453 |
+
}
|
4454 |
+
|
4455 |
+
if ( ! fs_is_network_admin() || $is_context_single_site ) {
|
4456 |
+
if ( $this->is_tracking_prohibited() ) {
|
4457 |
+
$this->_site->is_disconnected = false;
|
4458 |
+
$this->_store_site();
|
4459 |
+
}
|
4460 |
+
} else {
|
4461 |
+
$installs_map = $this->get_blog_install_map();
|
4462 |
+
foreach ( $installs_map as $blog_id => $install ) {
|
4463 |
+
/**
|
4464 |
+
* @var FS_Site $install
|
4465 |
+
*/
|
4466 |
+
if ( $install->is_tracking_prohibited() ) {
|
4467 |
+
$install->is_disconnected = false;
|
4468 |
+
$this->_store_site( true, $blog_id, $install );
|
4469 |
+
}
|
4470 |
+
}
|
4471 |
+
}
|
4472 |
+
}
|
4473 |
+
|
4474 |
+
/**
|
4475 |
+
* Parse plugin's settings (as defined by the plugin dev).
|
4476 |
+
*
|
4477 |
+
* @author Vova Feldman (@svovaf)
|
4478 |
+
* @since 1.1.7.3
|
4479 |
+
*
|
4480 |
+
* @param array $plugin_info
|
4481 |
+
*
|
4482 |
+
* @throws \Freemius_Exception
|
4483 |
+
*/
|
4484 |
+
private function parse_settings( &$plugin_info ) {
|
4485 |
+
$this->_logger->entrance();
|
4486 |
+
|
4487 |
+
$id = $this->get_numeric_option( $plugin_info, 'id', false );
|
4488 |
+
$public_key = $this->get_option( $plugin_info, 'public_key', false );
|
4489 |
+
$secret_key = $this->get_option( $plugin_info, 'secret_key', null );
|
4490 |
+
$parent_id = $this->get_numeric_option( $plugin_info, 'parent_id', null );
|
4491 |
+
$parent_name = $this->get_option( $plugin_info, 'parent_name', null );
|
4492 |
+
|
4493 |
+
/**
|
4494 |
+
* @author Vova Feldman (@svovaf)
|
4495 |
+
* @since 1.1.9 Try to pull secret key from external config.
|
4496 |
+
*/
|
4497 |
+
if ( is_null( $secret_key ) && defined( "WP_FS__{$this->_slug}_SECRET_KEY" ) ) {
|
4498 |
+
$secret_key = constant( "WP_FS__{$this->_slug}_SECRET_KEY" );
|
4499 |
+
}
|
4500 |
+
|
4501 |
+
if ( isset( $plugin_info['parent'] ) ) {
|
4502 |
+
$parent_id = $this->get_numeric_option( $plugin_info['parent'], 'id', null );
|
4503 |
+
// $parent_slug = $this->get_option( $plugin_info['parent'], 'slug', null );
|
4504 |
+
// $parent_public_key = $this->get_option( $plugin_info['parent'], 'public_key', null );
|
4505 |
+
// $parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
|
4506 |
+
}
|
4507 |
+
|
4508 |
+
if ( false === $id ) {
|
4509 |
+
throw new Freemius_Exception( array(
|
4510 |
+
'error' => array(
|
4511 |
+
'type' => 'ParameterNotSet',
|
4512 |
+
'message' => 'Plugin id parameter is not set.',
|
4513 |
+
'code' => 'plugin_id_not_set',
|
4514 |
+
'http' => 500,
|
4515 |
+
)
|
4516 |
+
) );
|
4517 |
+
}
|
4518 |
+
if ( false === $public_key ) {
|
4519 |
+
throw new Freemius_Exception( array(
|
4520 |
+
'error' => array(
|
4521 |
+
'type' => 'ParameterNotSet',
|
4522 |
+
'message' => 'Plugin public_key parameter is not set.',
|
4523 |
+
'code' => 'plugin_public_key_not_set',
|
4524 |
+
'http' => 500,
|
4525 |
+
)
|
4526 |
+
) );
|
4527 |
+
}
|
4528 |
+
|
4529 |
+
$plugin = ( $this->_plugin instanceof FS_Plugin ) ?
|
4530 |
+
$this->_plugin :
|
4531 |
+
new FS_Plugin();
|
4532 |
+
|
4533 |
+
$plugin->update( array(
|
4534 |
+
'id' => $id,
|
4535 |
+
'type' => $this->get_option( $plugin_info, 'type', $this->_module_type ),
|
4536 |
+
'public_key' => $public_key,
|
4537 |
+
'slug' => $this->_slug,
|
4538 |
+
'parent_plugin_id' => $parent_id,
|
4539 |
+
'version' => $this->get_plugin_version(),
|
4540 |
+
'title' => $this->get_plugin_name(),
|
4541 |
+
'file' => $this->_plugin_basename,
|
4542 |
+
'is_premium' => $this->get_bool_option( $plugin_info, 'is_premium', true ),
|
4543 |
+
'is_live' => $this->get_bool_option( $plugin_info, 'is_live', true ),
|
4544 |
+
'affiliate_moderation' => $this->get_option( $plugin_info, 'has_affiliation' ),
|
4545 |
+
) );
|
4546 |
+
|
4547 |
+
if ( $plugin->is_updated() ) {
|
4548 |
+
// Update plugin details.
|
4549 |
+
$this->_plugin = FS_Plugin_Manager::instance( $this->_module_id )->store( $plugin );
|
4550 |
+
}
|
4551 |
+
// Set the secret key after storing the plugin, we don't want to store the key in the storage.
|
4552 |
+
$this->_plugin->secret_key = $secret_key;
|
4553 |
+
|
4554 |
+
if ( ! isset( $plugin_info['menu'] ) ) {
|
4555 |
+
$plugin_info['menu'] = array();
|
4556 |
+
|
4557 |
+
if ( ! empty( $this->_storage->sdk_last_version ) &&
|
4558 |
+
version_compare( $this->_storage->sdk_last_version, '1.1.2', '<=' )
|
4559 |
+
) {
|
4560 |
+
// Backward compatibility to 1.1.2
|
4561 |
+
$plugin_info['menu']['slug'] = isset( $plugin_info['menu_slug'] ) ?
|
4562 |
+
$plugin_info['menu_slug'] :
|
4563 |
+
$this->_slug;
|
4564 |
+
}
|
4565 |
+
}
|
4566 |
+
|
4567 |
+
$this->_menu = FS_Admin_Menu_Manager::instance(
|
4568 |
+
$this->_module_id,
|
4569 |
+
$this->_module_type,
|
4570 |
+
$this->get_unique_affix()
|
4571 |
+
);
|
4572 |
+
|
4573 |
+
$this->_menu->init( $plugin_info['menu'], $this->is_addon() );
|
4574 |
+
|
4575 |
+
$this->_has_addons = $this->get_bool_option( $plugin_info, 'has_addons', false );
|
4576 |
+
$this->_has_paid_plans = $this->get_bool_option( $plugin_info, 'has_paid_plans', true );
|
4577 |
+
$this->_has_premium_version = $this->get_bool_option( $plugin_info, 'has_premium_version', $this->_has_paid_plans );
|
4578 |
+
$this->_ignore_pending_mode = $this->get_bool_option( $plugin_info, 'ignore_pending_mode', false );
|
4579 |
+
$this->_is_org_compliant = $this->get_bool_option( $plugin_info, 'is_org_compliant', true );
|
4580 |
+
$this->_is_premium_only = $this->get_bool_option( $plugin_info, 'is_premium_only', false );
|
4581 |
+
if ( $this->_is_premium_only ) {
|
4582 |
+
// If premium only plugin, disable anonymous mode.
|
4583 |
+
$this->_enable_anonymous = false;
|
4584 |
+
$this->_anonymous_mode = false;
|
4585 |
+
} else {
|
4586 |
+
$this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
|
4587 |
+
$this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
|
4588 |
+
}
|
4589 |
+
$this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
|
4590 |
+
|
4591 |
+
if ( ! empty( $plugin_info['trial'] ) ) {
|
4592 |
+
$this->_trial_days = $this->get_numeric_option(
|
4593 |
+
$plugin_info['trial'],
|
4594 |
+
'days',
|
4595 |
+
// Default to 0 - trial without days specification.
|
4596 |
+
0
|
4597 |
+
);
|
4598 |
+
|
4599 |
+
$this->_is_trial_require_payment = $this->get_bool_option( $plugin_info['trial'], 'is_require_payment', false );
|
4600 |
+
}
|
4601 |
+
}
|
4602 |
+
|
4603 |
+
/**
|
4604 |
+
* @param string[] $options
|
4605 |
+
* @param string $key
|
4606 |
+
* @param mixed $default
|
4607 |
+
*
|
4608 |
+
* @return bool
|
4609 |
+
*/
|
4610 |
+
private function get_option( &$options, $key, $default = false ) {
|
4611 |
+
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
|
4612 |
+
}
|
4613 |
+
|
4614 |
+
private function get_bool_option( &$options, $key, $default = false ) {
|
4615 |
+
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
|
4616 |
+
}
|
4617 |
+
|
4618 |
+
private function get_numeric_option( &$options, $key, $default = false ) {
|
4619 |
+
return isset( $options[ $key ] ) && is_numeric( $options[ $key ] ) ? $options[ $key ] : $default;
|
4620 |
+
}
|
4621 |
+
|
4622 |
+
/**
|
4623 |
+
* Gate keeper.
|
4624 |
+
*
|
4625 |
+
* @author Vova Feldman (@svovaf)
|
4626 |
+
* @since 1.1.7.3
|
4627 |
+
*
|
4628 |
+
* @return bool
|
4629 |
+
*/
|
4630 |
+
private function should_stop_execution() {
|
4631 |
+
if ( empty( $this->_storage->was_plugin_loaded ) ) {
|
4632 |
+
/**
|
4633 |
+
* Don't execute Freemius until plugin was fully loaded at least once,
|
4634 |
+
* to give the opportunity for the activation hook to run before pinging
|
4635 |
+
* the API for connectivity test. This logic is relevant for the
|
4636 |
+
* identification of new plugin install vs. plugin update.
|
4637 |
+
*
|
4638 |
+
* @author Vova Feldman (@svovaf)
|
4639 |
+
* @since 1.1.9
|
4640 |
+
*/
|
4641 |
+
return true;
|
4642 |
+
}
|
4643 |
+
|
4644 |
+
if ( $this->is_activation_mode() ) {
|
4645 |
+
if ( ! is_admin() ) {
|
4646 |
+
/**
|
4647 |
+
* If in activation mode, don't execute Freemius outside of the
|
4648 |
+
* admin dashboard.
|
4649 |
+
*
|
4650 |
+
* @author Vova Feldman (@svovaf)
|
4651 |
+
* @since 1.1.7.3
|
4652 |
+
*/
|
4653 |
+
return true;
|
4654 |
+
}
|
4655 |
+
|
4656 |
+
if ( ! WP_FS__IS_HTTP_REQUEST ) {
|
4657 |
+
/**
|
4658 |
+
* If in activation and executed without HTTP context (e.g. CLI, Cronjob),
|
4659 |
+
* then don't start Freemius.
|
4660 |
+
*
|
4661 |
+
* @author Vova Feldman (@svovaf)
|
4662 |
+
* @since 1.1.6.3
|
4663 |
+
*
|
4664 |
+
* @link https://wordpress.org/support/topic/errors-in-the-freemius-class-when-running-in-wordpress-in-cli
|
4665 |
+
*/
|
4666 |
+
return true;
|
4667 |
+
}
|
4668 |
+
|
4669 |
+
if ( self::is_cron() ) {
|
4670 |
+
/**
|
4671 |
+
* If in activation mode, don't execute Freemius during wp crons
|
4672 |
+
* (wp crons have HTTP context - called as HTTP request).
|
4673 |
+
*
|
4674 |
+
* @author Vova Feldman (@svovaf)
|
4675 |
+
* @since 1.1.7.3
|
4676 |
+
*/
|
4677 |
+
return true;
|
4678 |
+
}
|
4679 |
+
|
4680 |
+
if ( self::is_ajax() &&
|
4681 |
+
! $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) &&
|
4682 |
+
! $this->_admin_notices->has_sticky( 'failed_connect_api' )
|
4683 |
+
) {
|
4684 |
+
/**
|
4685 |
+
* During activation, if running in AJAX mode, unless there's a sticky
|
4686 |
+
* connectivity issue notice, don't run Freemius.
|
4687 |
+
*
|
4688 |
+
* @author Vova Feldman (@svovaf)
|
4689 |
+
* @since 1.1.7.3
|
4690 |
+
*/
|
4691 |
+
return true;
|
4692 |
+
}
|
4693 |
+
}
|
4694 |
+
|
4695 |
+
return false;
|
4696 |
+
}
|
4697 |
+
|
4698 |
+
/**
|
4699 |
+
* Triggered after code type has changed.
|
4700 |
+
*
|
4701 |
+
* @author Vova Feldman (@svovaf)
|
4702 |
+
* @since 1.1.9.1
|
4703 |
+
*/
|
4704 |
+
function _after_code_type_change() {
|
4705 |
+
$this->_logger->entrance();
|
4706 |
+
|
4707 |
+
if ( $this->is_theme() ) {
|
4708 |
+
// Expire the cache of the previous tabs since the theme may
|
4709 |
+
// have setting updates after code type has changed.
|
4710 |
+
$this->_cache->expire( 'tabs' );
|
4711 |
+
$this->_cache->expire( 'tabs_stylesheets' );
|
4712 |
+
}
|
4713 |
+
|
4714 |
+
if ( $this->is_registered() ) {
|
4715 |
+
if ( ! $this->is_addon() ) {
|
4716 |
+
add_action(
|
4717 |
+
is_admin() ? 'admin_init' : 'init',
|
4718 |
+
array( &$this, '_plugin_code_type_changed' )
|
4719 |
+
);
|
4720 |
+
}
|
4721 |
+
|
4722 |
+
if ( $this->is_premium() ) {
|
4723 |
+
// Purge cached payments after switching to the premium version.
|
4724 |
+
// @todo This logic doesn't handle purging the cache for serviceware module upgrade.
|
4725 |
+
$this->get_api_user_scope()->purge_cache( "/plugins/{$this->_module_id}/payments.json?include_addons=true" );
|
4726 |
+
}
|
4727 |
+
}
|
4728 |
+
}
|
4729 |
+
|
4730 |
+
/**
|
4731 |
+
* Handles plugin's code type change (free <--> premium).
|
4732 |
+
*
|
4733 |
+
* @author Vova Feldman (@svovaf)
|
4734 |
+
* @since 1.0.9
|
4735 |
+
*/
|
4736 |
+
function _plugin_code_type_changed() {
|
4737 |
+
$this->_logger->entrance();
|
4738 |
+
|
4739 |
+
if ( $this->is_premium() ) {
|
4740 |
+
$this->reconnect_locally();
|
4741 |
+
|
4742 |
+
// Activated premium code.
|
4743 |
+
$this->do_action( 'after_premium_version_activation' );
|
4744 |
+
|
4745 |
+
// Remove all sticky messages related to download of the premium version.
|
4746 |
+
$this->_admin_notices->remove_sticky( array(
|
4747 |
+
'trial_started',
|
4748 |
+
'plan_upgraded',
|
4749 |
+
'plan_changed',
|
4750 |
+
'license_activated',
|
4751 |
+
) );
|
4752 |
+
|
4753 |
+
$notice = '';
|
4754 |
+
if ( ! $this->is_only_premium() ) {
|
4755 |
+
$notice = sprintf( $this->get_text_inline( 'Premium %s version was successfully activated.', 'premium-activated-message' ), $this->_module_type );
|
4756 |
+
}
|
4757 |
+
|
4758 |
+
$license_notice = $this->get_license_network_activation_notice();
|
4759 |
+
if ( ! empty( $license_notice ) ) {
|
4760 |
+
$notice .= ' ' . $license_notice;
|
4761 |
+
}
|
4762 |
+
|
4763 |
+
if ( ! empty( $notice ) ) {
|
4764 |
+
$this->_admin_notices->add_sticky(
|
4765 |
+
trim( $notice ),
|
4766 |
+
'premium_activated',
|
4767 |
+
$this->get_text_x_inline( 'W00t',
|
4768 |
+
'Used to express elation, enthusiasm, or triumph (especially in electronic communication).', 'woot' ) . '!'
|
4769 |
+
);
|
4770 |
+
}
|
4771 |
+
} else {
|
4772 |
+
// Remove sticky message related to premium code activation.
|
4773 |
+
$this->_admin_notices->remove_sticky( 'premium_activated' );
|
4774 |
+
|
4775 |
+
// Activated free code (after had the premium before).
|
4776 |
+
$this->do_action( 'after_free_version_reactivation' );
|
4777 |
+
|
4778 |
+
if ( $this->is_paying() && ! $this->is_premium() ) {
|
4779 |
+
$this->_admin_notices->add_sticky(
|
4780 |
+
sprintf(
|
4781 |
+
/* translators: %s: License type (e.g. you have a professional license) */
|
4782 |
+
$this->get_text_inline( 'You have a %s license.', 'you-have-x-license' ),
|
4783 |
+
$this->get_plan_title()
|
4784 |
+
) . $this->get_complete_upgrade_instructions(),
|
4785 |
+
'plan_upgraded',
|
4786 |
+
$this->get_text_x_inline( 'Yee-haw', 'interjection expressing joy or exuberance', 'yee-haw' ) . '!'
|
4787 |
+
);
|
4788 |
+
}
|
4789 |
+
}
|
4790 |
+
|
4791 |
+
// Schedule code type changes event.
|
4792 |
+
$this->schedule_install_sync();
|
4793 |
+
|
4794 |
+
/**
|
4795 |
+
* Unregister the uninstall hook for the other version of the plugin (with different code type) to avoid
|
4796 |
+
* triggering a fatal error when uninstalling that plugin. For example, after deactivating the "free" version
|
4797 |
+
* of a specific plugin, its uninstall hook should be unregistered after the "premium" version has been
|
4798 |
+
* activated. If we don't do that, a fatal error will occur when we try to uninstall the "free" version since
|
4799 |
+
* the main file of the "free" version will be loaded first before calling the hooked callback. Since the
|
4800 |
+
* free and premium versions are almost identical (same class or have same functions), a fatal error like
|
4801 |
+
* "Cannot redeclare class MyClass" or "Cannot redeclare my_function()" will occur.
|
4802 |
+
*/
|
4803 |
+
$this->unregister_uninstall_hook();
|
4804 |
+
|
4805 |
+
$this->clear_module_main_file_cache();
|
4806 |
+
|
4807 |
+
// Update is_premium of latest version.
|
4808 |
+
$this->_storage->prev_is_premium = $this->_plugin->is_premium;
|
4809 |
+
}
|
4810 |
+
|
4811 |
+
#endregion
|
4812 |
+
|
4813 |
+
#----------------------------------------------------------------------------------
|
4814 |
+
#region Add-ons
|
4815 |
+
#----------------------------------------------------------------------------------
|
4816 |
+
|
4817 |
+
/**
|
4818 |
+
* Check if add-on installed and activated on site.
|
4819 |
+
*
|
4820 |
+
* @author Vova Feldman (@svovaf)
|
4821 |
+
* @since 1.0.6
|
4822 |
+
*
|
4823 |
+
* @param string|number $id_or_slug
|
4824 |
+
* @param bool|null $is_premium Since 1.2.1.7 can check for specified add-on version.
|
4825 |
+
*
|
4826 |
+
* @return bool
|
4827 |
+
*/
|
4828 |
+
function is_addon_activated( $id_or_slug, $is_premium = null ) {
|
4829 |
+
$this->_logger->entrance();
|
4830 |
+
|
4831 |
+
$addon_id = self::get_module_id( $id_or_slug );
|
4832 |
+
$is_activated = self::has_instance( $addon_id );
|
4833 |
+
|
4834 |
+
if ( ! $is_activated ) {
|
4835 |
+
return false;
|
4836 |
+
}
|
4837 |
+
|
4838 |
+
if ( is_bool( $is_premium ) ) {
|
4839 |
+
// Check if the specified code version is activate.
|
4840 |
+
$addon = $this->get_addon_instance( $addon_id );
|
4841 |
+
$is_activated = ( $is_premium === $addon->is_premium() );
|
4842 |
+
}
|
4843 |
+
|
4844 |
+
return $is_activated;
|
4845 |
+
}
|
4846 |
+
|
4847 |
+
/**
|
4848 |
+
* Check if add-on was connected to install
|
4849 |
+
*
|
4850 |
+
* @author Vova Feldman (@svovaf)
|
4851 |
+
* @since 1.1.7
|
4852 |
+
*
|
4853 |
+
* @param string|number $id_or_slug
|
4854 |
+
*
|
4855 |
+
* @return bool
|
4856 |
+
*/
|
4857 |
+
function is_addon_connected( $id_or_slug ) {
|
4858 |
+
$this->_logger->entrance();
|
4859 |
+
|
4860 |
+
$sites = self::get_all_sites( WP_FS__MODULE_TYPE_PLUGIN );
|
4861 |
+
|
4862 |
+
$addon_id = self::get_module_id( $id_or_slug );
|
4863 |
+
$addon = $this->get_addon( $addon_id );
|
4864 |
+
$slug = $addon->slug;
|
4865 |
+
if ( ! isset( $sites[ $slug ] ) ) {
|
4866 |
+
return false;
|
4867 |
+
}
|
4868 |
+
|
4869 |
+
$site = $sites[ $slug ];
|
4870 |
+
|
4871 |
+
$plugin = FS_Plugin_Manager::instance( $addon_id )->get();
|
4872 |
+
|
4873 |
+
if ( $plugin->parent_plugin_id != $this->_plugin->id ) {
|
4874 |
+
// The given slug do NOT belong to any of the plugin's add-ons.
|
4875 |
+
return false;
|
4876 |
+
}
|
4877 |
+
|
4878 |
+
return ( is_object( $site ) &&
|
4879 |
+
is_numeric( $site->id ) &&
|
4880 |
+
is_numeric( $site->user_id ) &&
|
4881 |
+
FS_Plugin_Plan::is_valid_id( $site->plan_id )
|
4882 |
+
);
|
4883 |
+
}
|
4884 |
+
|
4885 |
+
/**
|
4886 |
+
* Determines if add-on installed.
|
4887 |
+
*
|
4888 |
+
* NOTE: This is a heuristic and only works if the folder/file named as the slug.
|
4889 |
+
*
|
4890 |
+
* @author Vova Feldman (@svovaf)
|
4891 |
+
* @since 1.0.6
|
4892 |
+
*
|
4893 |
+
* @param string|number $id_or_slug
|
4894 |
+
*
|
4895 |
+
* @return bool
|
4896 |
+
*/
|
4897 |
+
function is_addon_installed( $id_or_slug ) {
|
4898 |
+
$this->_logger->entrance();
|
4899 |
+
|
4900 |
+
$addon_id = self::get_module_id( $id_or_slug );
|
4901 |
+
|
4902 |
+
return file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this->get_addon_basename( $addon_id ) ) );
|
4903 |
+
}
|
4904 |
+
|
4905 |
+
/**
|
4906 |
+
* Get add-on basename.
|
4907 |
+
*
|
4908 |
+
* @author Vova Feldman (@svovaf)
|
4909 |
+
* @since 1.0.6
|
4910 |
+
*
|
4911 |
+
* @param string|number $id_or_slug
|
4912 |
+
*
|
4913 |
+
* @return string
|
4914 |
+
*/
|
4915 |
+
function get_addon_basename( $id_or_slug ) {
|
4916 |
+
$addon_id = self::get_module_id( $id_or_slug );
|
4917 |
+
|
4918 |
+
if ( $this->is_addon_activated( $addon_id ) ) {
|
4919 |
+
return self::instance( $addon_id )->get_plugin_basename();
|
4920 |
+
}
|
4921 |
+
|
4922 |
+
$addon = $this->get_addon( $addon_id );
|
4923 |
+
$premium_basename = "{$addon->slug}-premium/{$addon->slug}.php";
|
4924 |
+
|
4925 |
+
if ( file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $premium_basename ) ) ) {
|
4926 |
+
return $premium_basename;
|
4927 |
+
}
|
4928 |
+
|
4929 |
+
$all_plugins = $this->get_all_plugins();
|
4930 |
+
|
4931 |
+
foreach ( $all_plugins as $basename => &$data ) {
|
4932 |
+
if ( $addon->slug === $data['slug'] ||
|
4933 |
+
$addon->slug . '-premium' === $data['slug']
|
4934 |
+
) {
|
4935 |
+
return $basename;
|
4936 |
+
}
|
4937 |
+
}
|
4938 |
+
|
4939 |
+
$free_basename = "{$addon->slug}/{$addon->slug}.php";
|
4940 |
+
|
4941 |
+
return $free_basename;
|
4942 |
+
}
|
4943 |
+
|
4944 |
+
/**
|
4945 |
+
* Get installed add-ons instances.
|
4946 |
+
*
|
4947 |
+
* @author Vova Feldman (@svovaf)
|
4948 |
+
* @since 1.0.6
|
4949 |
+
*
|
4950 |
+
* @return Freemius[]
|
4951 |
+
*/
|
4952 |
+
function get_installed_addons() {
|
4953 |
+
$installed_addons = array();
|
4954 |
+
foreach ( self::$_instances as $instance ) {
|
4955 |
+
if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
|
4956 |
+
if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
|
4957 |
+
$installed_addons[] = $instance;
|
4958 |
+
}
|
4959 |
+
}
|
4960 |
+
}
|
4961 |
+
|
4962 |
+
return $installed_addons;
|
4963 |
+
}
|
4964 |
+
|
4965 |
+
/**
|
4966 |
+
* Check if any add-ons of the plugin are installed.
|
4967 |
+
*
|
4968 |
+
* @author Leo Fajardo (@leorw)
|
4969 |
+
* @since 1.1.1
|
4970 |
+
*
|
4971 |
+
* @return bool
|
4972 |
+
*/
|
4973 |
+
function has_installed_addons() {
|
4974 |
+
if ( ! $this->has_addons() ) {
|
4975 |
+
return false;
|
4976 |
+
}
|
4977 |
+
|
4978 |
+
foreach ( self::$_instances as $instance ) {
|
4979 |
+
if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
|
4980 |
+
if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
|
4981 |
+
return true;
|
4982 |
+
}
|
4983 |
+
}
|
4984 |
+
}
|
4985 |
+
|
4986 |
+
return false;
|
4987 |
+
}
|
4988 |
+
|
4989 |
+
/**
|
4990 |
+
* Tell Freemius that the current plugin is an add-on.
|
4991 |
+
*
|
4992 |
+
* @author Vova Feldman (@svovaf)
|
4993 |
+
* @since 1.0.6
|
4994 |
+
*
|
4995 |
+
* @param number $parent_plugin_id The parent plugin ID
|
4996 |
+
*/
|
4997 |
+
function init_addon( $parent_plugin_id ) {
|
4998 |
+
$this->_plugin->parent_plugin_id = $parent_plugin_id;
|
4999 |
+
}
|
5000 |
+
|
5001 |
+
/**
|
5002 |
+
* @author Vova Feldman (@svovaf)
|
5003 |
+
* @since 1.0.6
|
5004 |
+
*
|
5005 |
+
* @return bool
|
5006 |
+
*/
|
5007 |
+
function is_addon() {
|
5008 |
+
return isset( $this->_plugin->parent_plugin_id ) && is_numeric( $this->_plugin->parent_plugin_id );
|
5009 |
+
}
|
5010 |
+
|
5011 |
+
/**
|
5012 |
+
* Deactivate add-on if it's premium only and the user does't have a valid license.
|
5013 |
+
*
|
5014 |
+
* @param bool $is_after_trial_cancel
|
5015 |
+
*
|
5016 |
+
* @return bool If add-on was deactivated.
|
5017 |
+
*/
|
5018 |
+
private function deactivate_premium_only_addon_without_license( $is_after_trial_cancel = false ) {
|
5019 |
+
if ( ! $this->has_free_plan() &&
|
5020 |
+
! $this->has_features_enabled_license() &&
|
5021 |
+
! $this->_has_premium_license()
|
5022 |
+
) {
|
5023 |
+
if ( $this->is_registered() ) {
|
5024 |
+
// IF wrapper is turned off because activation_timestamp is currently only stored for plugins (not addons).
|
5025 |
+
// if (empty($this->_storage->activation_timestamp) ||
|
5026 |
+
// (WP_FS__SCRIPT_START_TIME - $this->_storage->activation_timestamp) > 30
|
5027 |
+
// ) {
|
5028 |
+
/**
|
5029 |
+
* @todo When it's first fail, there's no reason to try and re-sync because the licenses were just synced after initial activation.
|
5030 |
+
*
|
5031 |
+
* Retry syncing the user add-on licenses.
|
5032 |
+
*/
|
5033 |
+
// Sync licenses.
|
5034 |
+
$this->_sync_licenses();
|
5035 |
+
// }
|
5036 |
+
|
5037 |
+
// Try to activate premium license.
|
5038 |
+
$this->_activate_license( true );
|
5039 |
+
}
|
5040 |
+
|
5041 |
+
if ( ! $this->has_free_plan() &&
|
5042 |
+
! $this->has_features_enabled_license() &&
|
5043 |
+
! $this->_has_premium_license()
|
5044 |
+
) {
|
5045 |
+
// @todo Check if deactivate plugins also call the deactivation hook.
|
5046 |
+
|
5047 |
+
$this->_parent->_admin_notices->add_sticky(
|
5048 |
+
sprintf(
|
5049 |
+
( $is_after_trial_cancel ?
|
5050 |
+
$this->_parent->get_text_inline(
|
5051 |
+
'%s free trial was successfully cancelled. Since the add-on is premium only it was automatically deactivated. If you like to use it in the future, you\'ll have to purchase a license.',
|
5052 |
+
'addon-trial-cancelled-message'
|
5053 |
+
) :
|
5054 |
+
$this->_parent->get_text_inline(
|
5055 |
+
'%s is a premium only add-on. You have to purchase a license first before activating the plugin.',
|
5056 |
+
'addon-no-license-message'
|
5057 |
+
)
|
5058 |
+
),
|
5059 |
+
'<b>' . $this->_plugin->title . '</b>'
|
5060 |
+
) . ' ' . sprintf(
|
5061 |
+
'<a href="%s" aria-label="%s" class="button button-primary" style="margin-left: 10px; vertical-align: middle;">%s ➜</a>',
|
5062 |
+
$this->_parent->addon_url( $this->_slug ),
|
5063 |
+
esc_attr( sprintf( $this->_parent->get_text_inline( 'More information about %s', 'more-information-about-x' ), $this->_plugin->title ) ),
|
5064 |
+
$this->_parent->get_text_inline( 'Purchase License', 'purchase-license' )
|
5065 |
+
),
|
5066 |
+
'no_addon_license_' . $this->_slug,
|
5067 |
+
( $is_after_trial_cancel ? '' : $this->_parent->get_text_x_inline( 'Oops', 'exclamation', 'oops' ) . '...' ),
|
5068 |
+
( $is_after_trial_cancel ? 'success' : 'error' )
|
5069 |
+
);
|
5070 |
+
|
5071 |
+
deactivate_plugins( array( $this->_plugin_basename ), true );
|
5072 |
+
|
5073 |
+
return true;
|
5074 |
+
}
|
5075 |
+
}
|
5076 |
+
|
5077 |
+
return false;
|
5078 |
+
}
|
5079 |
+
|
5080 |
+
#endregion
|
5081 |
+
|
5082 |
+
#----------------------------------------------------------------------------------
|
5083 |
+
#region Sandbox
|
5084 |
+
#----------------------------------------------------------------------------------
|
5085 |
+
|
5086 |
+
/**
|
5087 |
+
* Set Freemius into sandbox mode for debugging.
|
5088 |
+
*
|
5089 |
+
* @author Vova Feldman (@svovaf)
|
5090 |
+
* @since 1.0.4
|
5091 |
+
*
|
5092 |
+
* @param string $secret_key
|
5093 |
+
*/
|
5094 |
+
function init_sandbox( $secret_key ) {
|
5095 |
+
$this->_plugin->secret_key = $secret_key;
|
5096 |
+
|
5097 |
+
// Update plugin details.
|
5098 |
+
FS_Plugin_Manager::instance( $this->_module_id )->update( $this->_plugin, true );
|
5099 |
+
}
|
5100 |
+
|
5101 |
+
/**
|
5102 |
+
* Check if running payments in sandbox mode.
|
5103 |
+
*
|
5104 |
+
* @author Vova Feldman (@svovaf)
|
5105 |
+
* @since 1.0.4
|
5106 |
+
*
|
5107 |
+
* @return bool
|
5108 |
+
*/
|
5109 |
+
function is_payments_sandbox() {
|
5110 |
+
return ( ! $this->is_live() ) || isset( $this->_plugin->secret_key );
|
5111 |
+
}
|
5112 |
+
|
5113 |
+
#endregion
|
5114 |
+
|
5115 |
+
/**
|
5116 |
+
* Check if running test vs. live plugin.
|
5117 |
+
*
|
5118 |
+
* @author Vova Feldman (@svovaf)
|
5119 |
+
* @since 1.0.5
|
5120 |
+
*
|
5121 |
+
* @return bool
|
5122 |
+
*/
|
5123 |
+
function is_live() {
|
5124 |
+
return $this->_plugin->is_live;
|
5125 |
+
}
|
5126 |
+
|
5127 |
+
/**
|
5128 |
+
* Check if super-admin skipped connection for all sites in the network.
|
5129 |
+
*
|
5130 |
+
* @author Vova Feldman (@svovaf)
|
5131 |
+
* @since 2.0.0
|
5132 |
+
*/
|
5133 |
+
function is_network_anonymous() {
|
5134 |
+
if ( ! $this->_is_network_active ) {
|
5135 |
+
return false;
|
5136 |
+
}
|
5137 |
+
|
5138 |
+
$is_anonymous_ms = $this->_storage->get( 'is_anonymous_ms' );
|
5139 |
+
|
5140 |
+
if ( empty( $is_anonymous_ms ) ) {
|
5141 |
+
return false;
|
5142 |
+
}
|
5143 |
+
|
5144 |
+
return $is_anonymous_ms['is'];
|
5145 |
+
}
|
5146 |
+
|
5147 |
+
/**
|
5148 |
+
* Check if super-admin opted-in for all sites in the network.
|
5149 |
+
*
|
5150 |
+
* @author Vova Feldman (@svovaf)
|
5151 |
+
* @since 2.0.0
|
5152 |
+
*/
|
5153 |
+
function is_network_connected() {
|
5154 |
+
if ( ! $this->_is_network_active ) {
|
5155 |
+
return false;
|
5156 |
+
}
|
5157 |
+
|
5158 |
+
return $this->_storage->get( 'is_network_connected' );
|
5159 |
+
}
|
5160 |
+
|
5161 |
+
/**
|
5162 |
+
* Check if the user skipped connecting the account with Freemius.
|
5163 |
+
*
|
5164 |
+
* @author Vova Feldman (@svovaf)
|
5165 |
+
* @since 1.0.7
|
5166 |
+
*
|
5167 |
+
* @return bool
|
5168 |
+
*/
|
5169 |
+
function is_anonymous() {
|
5170 |
+
if ( ! isset( $this->_is_anonymous ) ) {
|
5171 |
+
if ( $this->is_network_anonymous() ) {
|
5172 |
+
$this->_is_anonymous = true;
|
5173 |
+
} else {
|
5174 |
+
if ( ! isset( $this->_storage->is_anonymous ) ) {
|
5175 |
+
// Not skipped.
|
5176 |
+
$this->_is_anonymous = false;
|
5177 |
+
} else if ( is_bool( $this->_storage->is_anonymous ) ) {
|
5178 |
+
// For back compatibility, since the variable was boolean before.
|
5179 |
+
$this->_is_anonymous = $this->_storage->is_anonymous;
|
5180 |
+
|
5181 |
+
// Upgrade stored data format to 1.1.3 format.
|
5182 |
+
$this->set_anonymous_mode( $this->_storage->is_anonymous );
|
5183 |
+
} else {
|
5184 |
+
// Version 1.1.3 and later.
|
5185 |
+
$this->_is_anonymous = $this->_storage->is_anonymous['is'];
|
5186 |
+
}
|
5187 |
+
}
|
5188 |
+
}
|
5189 |
+
|
5190 |
+
return $this->_is_anonymous;
|
5191 |
+
}
|
5192 |
+
|
5193 |
+
/**
|
5194 |
+
* Check if the user skipped the connection of a specified site.
|
5195 |
+
*
|
5196 |
+
* @author Vova Feldman (@svovaf)
|
5197 |
+
* @since 2.0.0
|
5198 |
+
*
|
5199 |
+
* @param int $blog_id
|
5200 |
+
*
|
5201 |
+
* @return bool
|
5202 |
+
*/
|
5203 |
+
function is_anonymous_site( $blog_id = 0 ) {
|
5204 |
+
if ( $this->is_network_anonymous() ) {
|
5205 |
+
return true;
|
5206 |
+
}
|
5207 |
+
|
5208 |
+
$is_anonymous = $this->_storage->get( 'is_anonymous', false, $blog_id );
|
5209 |
+
|
5210 |
+
if ( empty( $is_anonymous ) ) {
|
5211 |
+
return false;
|
5212 |
+
}
|
5213 |
+
|
5214 |
+
return $is_anonymous['is'];
|
5215 |
+
}
|
5216 |
+
|
5217 |
+
/**
|
5218 |
+
* Check if user connected his account and install pending email activation.
|
5219 |
+
*
|
5220 |
+
* @author Vova Feldman (@svovaf)
|
5221 |
+
* @since 1.0.7
|
5222 |
+
*
|
5223 |
+
* @return bool
|
5224 |
+
*/
|
5225 |
+
function is_pending_activation() {
|
5226 |
+
return $this->_storage->get( 'is_pending_activation', false );
|
5227 |
+
}
|
5228 |
+
|
5229 |
+
/**
|
5230 |
+
* Check if plugin must be WordPress.org compliant.
|
5231 |
+
*
|
5232 |
+
* @since 1.0.7
|
5233 |
+
*
|
5234 |
+
* @return bool
|
5235 |
+
*/
|
5236 |
+
function is_org_repo_compliant() {
|
5237 |
+
return $this->_is_org_compliant;
|
5238 |
+
}
|
5239 |
+
|
5240 |
+
#--------------------------------------------------------------------------------
|
5241 |
+
#region WP Cron Common
|
5242 |
+
#--------------------------------------------------------------------------------
|
5243 |
+
|
5244 |
+
/**
|
5245 |
+
* @author Vova Feldman (@svovaf)
|
5246 |
+
* @since 2.0.0
|
5247 |
+
*
|
5248 |
+
* @param string $name Cron name.
|
5249 |
+
*
|
5250 |
+
* @return object
|
5251 |
+
*/
|
5252 |
+
private function get_cron_data( $name ) {
|
5253 |
+
$this->_logger->entrance( $name );
|
5254 |
+
|
5255 |
+
/**
|
5256 |
+
* @var object $cron_data
|
5257 |
+
*/
|
5258 |
+
return $this->_storage->get( "{$name}_cron", null );
|
5259 |
+
}
|
5260 |
+
|
5261 |
+
/**
|
5262 |
+
* @author Vova Feldman (@svovaf)
|
5263 |
+
* @since 2.0.0
|
5264 |
+
*
|
5265 |
+
* @param string $name Cron name.
|
5266 |
+
*/
|
5267 |
+
private function clear_cron_data( $name ) {
|
5268 |
+
$this->_logger->entrance( $name );
|
5269 |
+
|
5270 |
+
$this->_storage->remove( "{$name}_cron" );
|
5271 |
+
}
|
5272 |
+
|
5273 |
+
/**
|
5274 |
+
* @author Vova Feldman (@svovaf)
|
5275 |
+
* @since 2.0.0
|
5276 |
+
*
|
5277 |
+
* @param string $name Cron name.
|
5278 |
+
* @param int $cron_blog_id The cron executing blog ID.
|
5279 |
+
*/
|
5280 |
+
private function set_cron_data( $name, $cron_blog_id = 0 ) {
|
5281 |
+
$this->_logger->entrance( $name );
|
5282 |
+
|
5283 |
+
$this->_storage->store( "{$name}_cron", (object) array(
|
5284 |
+
'version' => $this->get_plugin_version(),
|
5285 |
+
'blog_id' => $cron_blog_id,
|
5286 |
+
'sdk_version' => $this->version,
|
5287 |
+
'timestamp' => WP_FS__SCRIPT_START_TIME,
|
5288 |
+
'on' => true,
|
5289 |
+
) );
|
5290 |
+
}
|
5291 |
+
|
5292 |
+
/**
|
5293 |
+
* Get the cron's executing blog ID.
|
5294 |
+
*
|
5295 |
+
* @author Vova Feldman (@svovaf)
|
5296 |
+
* @since 2.0.0
|
5297 |
+
*
|
5298 |
+
* @param string $name Cron name.
|
5299 |
+
*
|
5300 |
+
* @return int
|
5301 |
+
*/
|
5302 |
+
private function get_cron_blog_id( $name ) {
|
5303 |
+
$this->_logger->entrance( $name );
|
5304 |
+
|
5305 |
+
/**
|
5306 |
+
* @var object $cron_data
|
5307 |
+
*/
|
5308 |
+
$cron_data = $this->get_cron_data( $name );
|
5309 |
+
|
5310 |
+
return ( is_object( $cron_data ) && is_numeric( $cron_data->blog_id ) ) ?
|
5311 |
+
$cron_data->blog_id :
|
5312 |
+
0;
|
5313 |
+
}
|
5314 |
+
|
5315 |
+
/**
|
5316 |
+
* @author Vova Feldman (@svovaf)
|
5317 |
+
* @since 2.0.0
|
5318 |
+
*
|
5319 |
+
* @param string $name Cron name.
|
5320 |
+
*
|
5321 |
+
* @return bool
|
5322 |
+
*/
|
5323 |
+
private function is_cron_on( $name ) {
|
5324 |
+
$this->_logger->entrance( $name );
|
5325 |
+
|
5326 |
+
/**
|
5327 |
+
* @var object $cron_data
|
5328 |
+
*/
|
5329 |
+
$cron_data = $this->get_cron_data( $name );
|
5330 |
+
|
5331 |
+
return ( ! is_null( $cron_data ) && true === $cron_data->on );
|
5332 |
+
}
|
5333 |
+
|
5334 |
+
/**
|
5335 |
+
* Unix timestamp for previous cron execution or false if never executed.
|
5336 |
+
*
|
5337 |
+
* @author Vova Feldman (@svovaf)
|
5338 |
+
* @since 2.0.0
|
5339 |
+
*
|
5340 |
+
* @param string $name Cron name.
|
5341 |
+
*
|
5342 |
+
* @return int|false
|
5343 |
+
*/
|
5344 |
+
private function cron_last_execution( $name ) {
|
5345 |
+
$this->_logger->entrance( $name );
|
5346 |
+
|
5347 |
+
return $this->_storage->get( "{$name}_timestamp" );
|
5348 |
+
}
|
5349 |
+
|
5350 |
+
/**
|
5351 |
+
* Set cron execution time to now.
|
5352 |
+
*
|
5353 |
+
* @author Vova Feldman (@svovaf)
|
5354 |
+
* @since 2.0.0
|
5355 |
+
*
|
5356 |
+
* @param string $name Cron name.
|
5357 |
+
*/
|
5358 |
+
private function set_cron_execution_timestamp( $name ) {
|
5359 |
+
$this->_logger->entrance( $name );
|
5360 |
+
|
5361 |
+
$this->_storage->store( "{$name}_timestamp", time() );
|
5362 |
+
}
|
5363 |
+
|
5364 |
+
/**
|
5365 |
+
* Check if cron was executed in the last $period of seconds.
|
5366 |
+
*
|
5367 |
+
* @author Vova Feldman (@svovaf)
|
5368 |
+
* @since 2.0.0
|
5369 |
+
*
|
5370 |
+
* @param string $name Cron name.
|
5371 |
+
* @param int $period In seconds
|
5372 |
+
*
|
5373 |
+
* @return bool
|
5374 |
+
*/
|
5375 |
+
private function is_cron_executed( $name, $period = WP_FS__TIME_24_HOURS_IN_SEC ) {
|
5376 |
+
$this->_logger->entrance( $name );
|
5377 |
+
|
5378 |
+
$last_execution = $this->set_cron_execution_timestamp( $name );
|
5379 |
+
|
5380 |
+
if ( ! is_numeric( $last_execution ) ) {
|
5381 |
+
return false;
|
5382 |
+
}
|
5383 |
+
|
5384 |
+
return ( $last_execution > ( WP_FS__SCRIPT_START_TIME - $period ) );
|
5385 |
+
}
|
5386 |
+
|
5387 |
+
/**
|
5388 |
+
* WP Cron is executed on a site level. When running in a multisite network environment
|
5389 |
+
* with the network integration activated, for optimization reasons, we are consolidating
|
5390 |
+
* the installs data sync cron to be executed only from a single site.
|
5391 |
+
*
|
5392 |
+
* @author Vova Feldman (@svovaf)
|
5393 |
+
* @since 2.0.0
|
5394 |
+
*
|
5395 |
+
* @param int $except_blog_id Target any except the excluded blog ID.
|
5396 |
+
*
|
5397 |
+
* @return int
|
5398 |
+
*/
|
5399 |
+
private function get_cron_target_blog_id( $except_blog_id = 0 ) {
|
5400 |
+
if ( ! is_multisite() ) {
|
5401 |
+
return 0;
|
5402 |
+
}
|
5403 |
+
|
5404 |
+
if ( $this->_is_network_active &&
|
5405 |
+
is_numeric( $this->_storage->network_install_blog_id ) &&
|
5406 |
+
$except_blog_id != $this->_storage->network_install_blog_id &&
|
5407 |
+
self::is_site_active( $this->_storage->network_install_blog_id )
|
5408 |
+
) {
|
5409 |
+
// Try to run cron from the main network blog.
|
5410 |
+
$install = $this->get_install_by_blog_id( $this->_storage->network_install_blog_id );
|
5411 |
+
|
5412 |
+
if ( is_object( $install ) &&
|
5413 |
+
( $this->is_premium() || $install->is_tracking_allowed() )
|
5414 |
+
) {
|
5415 |
+
return $this->_storage->network_install_blog_id;
|
5416 |
+
}
|
5417 |
+
}
|
5418 |
+
|
5419 |
+
// Get first opted-in blog ID with active tracking.
|
5420 |
+
$installs = $this->get_blog_install_map();
|
5421 |
+
foreach ( $installs as $blog_id => $install ) {
|
5422 |
+
if ( $except_blog_id != $blog_id &&
|
5423 |
+
self::is_site_active( $blog_id ) &&
|
5424 |
+
( $this->is_premium() || $install->is_tracking_allowed() )
|
5425 |
+
) {
|
5426 |
+
return $blog_id;
|
5427 |
+
}
|
5428 |
+
}
|
5429 |
+
|
5430 |
+
return 0;
|
5431 |
+
}
|
5432 |
+
|
5433 |
+
/**
|
5434 |
+
* @author Vova Feldman (@svovaf)
|
5435 |
+
* @since 2.0.0
|
5436 |
+
*
|
5437 |
+
* @param string $name Cron name.
|
5438 |
+
* @param string $action_tag Callback action tag.
|
5439 |
+
* @param bool $is_network_clear If set to TRUE, clear sync cron even if there are installs that are still connected.
|
5440 |
+
*/
|
5441 |
+
private function clear_cron( $name, $action_tag = '', $is_network_clear = false ) {
|
5442 |
+
$this->_logger->entrance( $name );
|
5443 |
+
|
5444 |
+
if ( ! $this->is_cron_on( $name ) ) {
|
5445 |
+
return;
|
5446 |
+
}
|
5447 |
+
|
5448 |
+
$clear_cron = true;
|
5449 |
+
if ( ! $is_network_clear && $this->_is_network_active ) {
|
5450 |
+
$installs = $this->get_blog_install_map();
|
5451 |
+
|
5452 |
+
foreach ( $installs as $blog_id => $install ) {
|
5453 |
+
/**
|
5454 |
+
* @var FS_Site $install
|
5455 |
+
*/
|
5456 |
+
if ( $install->is_tracking_allowed() ) {
|
5457 |
+
$clear_cron = false;
|
5458 |
+
break;
|
5459 |
+
}
|
5460 |
+
}
|
5461 |
+
}
|
5462 |
+
|
5463 |
+
if ( ! $clear_cron ) {
|
5464 |
+
return;
|
5465 |
+
}
|
5466 |
+
|
5467 |
+
/**
|
5468 |
+
* @var object $cron_data
|
5469 |
+
*/
|
5470 |
+
$cron_data = $this->get_cron_data( $name );
|
5471 |
+
|
5472 |
+
$cron_blog_id = is_object( $cron_data ) && isset( $cron_data->blog_id ) ?
|
5473 |
+
$cron_data->blog_id :
|
5474 |
+
0;
|
5475 |
+
|
5476 |
+
$this->clear_cron_data( $name );
|
5477 |
+
|
5478 |
+
if ( 0 < $cron_blog_id ) {
|
5479 |
+
switch_to_blog( $cron_blog_id );
|
5480 |
+
}
|
5481 |
+
|
5482 |
+
if ( empty( $action_tag ) ) {
|
5483 |
+
$action_tag = $name;
|
5484 |
+
}
|
5485 |
+
|
5486 |
+
wp_clear_scheduled_hook( $this->get_action_tag( $action_tag ) );
|
5487 |
+
|
5488 |
+
if ( 0 < $cron_blog_id ) {
|
5489 |
+
restore_current_blog();
|
5490 |
+
}
|
5491 |
+
}
|
5492 |
+
|
5493 |
+
/**
|
5494 |
+
* Unix timestamp for next cron execution or false if not scheduled.
|
5495 |
+
*
|
5496 |
+
* @author Vova Feldman (@svovaf)
|
5497 |
+
* @since 2.0.0
|
5498 |
+
*
|
5499 |
+
* @param string $name Cron name.
|
5500 |
+
* @param string $action_tag Callback action tag.
|
5501 |
+
*
|
5502 |
+
* @return int|false
|
5503 |
+
*/
|
5504 |
+
private function get_next_scheduled_cron( $name, $action_tag = '' ) {
|
5505 |
+
$this->_logger->entrance( $name );
|
5506 |
+
|
5507 |
+
if ( ! $this->is_cron_on( $name ) ) {
|
5508 |
+
return false;
|
5509 |
+
}
|
5510 |
+
|
5511 |
+
/**
|
5512 |
+
* @var object $cron_data
|
5513 |
+
*/
|
5514 |
+
$cron_data = $this->get_cron_data( $name );
|
5515 |
+
|
5516 |
+
$cron_blog_id = is_object( $cron_data ) && isset( $cron_data->blog_id ) ?
|
5517 |
+
$cron_data->blog_id :
|
5518 |
+
0;
|
5519 |
+
|
5520 |
+
if ( 0 < $cron_blog_id ) {
|
5521 |
+
switch_to_blog( $cron_blog_id );
|
5522 |
+
}
|
5523 |
+
|
5524 |
+
if ( empty( $action_tag ) ) {
|
5525 |
+
$action_tag = $name;
|
5526 |
+
}
|
5527 |
+
|
5528 |
+
$next_scheduled = wp_next_scheduled( $this->get_action_tag( $action_tag ) );
|
5529 |
+
|
5530 |
+
if ( 0 < $cron_blog_id ) {
|
5531 |
+
restore_current_blog();
|
5532 |
+
}
|
5533 |
+
|
5534 |
+
return $next_scheduled;
|
5535 |
+
}
|
5536 |
+
|
5537 |
+
/**
|
5538 |
+
* @author Vova Feldman (@svovaf)
|
5539 |
+
* @since 2.0.0
|
5540 |
+
*
|
5541 |
+
* @param string $name Cron name.
|
5542 |
+
* @param string $action_tag Callback action tag.
|
5543 |
+
* @param string $recurrence 'single' or 'daily'.
|
5544 |
+
* @param int $start_at Defaults to now.
|
5545 |
+
* @param bool $randomize_start If true, schedule first job randomly during the next 12 hours. Otherwise, schedule job to start right away.
|
5546 |
+
* @param int $except_blog_id Target any except the excluded blog ID.
|
5547 |
+
*/
|
5548 |
+
private function schedule_cron(
|
5549 |
+
$name,
|
5550 |
+
$action_tag = '',
|
5551 |
+
$recurrence = 'single',
|
5552 |
+
$start_at = WP_FS__SCRIPT_START_TIME,
|
5553 |
+
$randomize_start = true,
|
5554 |
+
$except_blog_id = 0
|
5555 |
+
) {
|
5556 |
+
$this->_logger->entrance( $name );
|
5557 |
+
|
5558 |
+
$this->clear_cron( $name, $action_tag, true );
|
5559 |
+
|
5560 |
+
$cron_blog_id = $this->get_cron_target_blog_id( $except_blog_id );
|
5561 |
+
|
5562 |
+
if ( is_multisite() && 0 == $cron_blog_id ) {
|
5563 |
+
// Don't schedule cron since couldn't find a target blog.
|
5564 |
+
return;
|
5565 |
+
}
|
5566 |
+
|
5567 |
+
if ( 0 < $cron_blog_id ) {
|
5568 |
+
switch_to_blog( $cron_blog_id );
|
5569 |
+
}
|
5570 |
+
|
5571 |
+
if ( 'daily' === $recurrence ) {
|
5572 |
+
if ( $randomize_start ) {
|
5573 |
+
// Schedule first sync with a random 12 hour time range from now.
|
5574 |
+
$start_at += rand( 0, ( WP_FS__TIME_24_HOURS_IN_SEC / 2 ) );
|
5575 |
+
}
|
5576 |
+
|
5577 |
+
// Schedule daily WP cron.
|
5578 |
+
wp_schedule_event(
|
5579 |
+
$start_at,
|
5580 |
+
'daily',
|
5581 |
+
$this->get_action_tag( $action_tag )
|
5582 |
+
);
|
5583 |
+
} else if ( 'single' === $recurrence ) {
|
5584 |
+
// Schedule single cron.
|
5585 |
+
wp_schedule_single_event(
|
5586 |
+
$start_at,
|
5587 |
+
$this->get_action_tag( $action_tag )
|
5588 |
+
);
|
5589 |
+
}
|
5590 |
+
|
5591 |
+
$this->set_cron_data( $name, $cron_blog_id );
|
5592 |
+
|
5593 |
+
if ( 0 < $cron_blog_id ) {
|
5594 |
+
restore_current_blog();
|
5595 |
+
}
|
5596 |
+
}
|
5597 |
+
|
5598 |
+
/**
|
5599 |
+
* Consolidated cron execution for performance optimization. The max number of API requests is based on the number of unique opted-in users.
|
5600 |
+
* that doesn't halt page loading.
|
5601 |
+
*
|
5602 |
+
* @author Vova Feldman (@svovaf)
|
5603 |
+
* @since 2.0.0
|
5604 |
+
*
|
5605 |
+
* @param string $name Cron name.
|
5606 |
+
* @param callable $callable The function that should be executed.
|
5607 |
+
*/
|
5608 |
+
private function execute_cron( $name, $callable ) {
|
5609 |
+
$this->_logger->entrance( $name );
|
5610 |
+
|
5611 |
+
// Store the last time data sync was executed.
|
5612 |
+
$this->set_cron_execution_timestamp( $name );
|
5613 |
+
|
5614 |
+
// Check if API is temporary down.
|
5615 |
+
if ( FS_Api::is_temporary_down() ) {
|
5616 |
+
return;
|
5617 |
+
}
|
5618 |
+
|
5619 |
+
// @todo Add logic that identifies API latency, and reschedule the next background sync randomly between 8-16 hours.
|
5620 |
+
|
5621 |
+
$users_2_blog_ids = array();
|
5622 |
+
|
5623 |
+
if ( ! is_multisite() ) {
|
5624 |
+
// Add dummy blog.
|
5625 |
+
$users_2_blog_ids[0] = array( 0 );
|
5626 |
+
} else {
|
5627 |
+
$installs = $this->get_blog_install_map();
|
5628 |
+
foreach ( $installs as $blog_id => $install ) {
|
5629 |
+
if ( $this->is_premium() || $install->is_tracking_allowed() ) {
|
5630 |
+
if ( ! isset( $users_2_blog_ids[ $install->user_id ] ) ) {
|
5631 |
+
$users_2_blog_ids[ $install->user_id ] = array();
|
5632 |
+
}
|
5633 |
+
|
5634 |
+
$users_2_blog_ids[ $install->user_id ][] = $blog_id;
|
5635 |
+
}
|
5636 |
+
}
|
5637 |
+
}
|
5638 |
+
|
5639 |
+
foreach ( $users_2_blog_ids as $user_id => $blog_ids ) {
|
5640 |
+
if ( 0 < $blog_ids[0] ) {
|
5641 |
+
$this->switch_to_blog( $blog_ids[0] );
|
5642 |
+
}
|
5643 |
+
|
5644 |
+
call_user_func_array( $callable, array( $blog_ids ) );
|
5645 |
+
|
5646 |
+
foreach ( $blog_ids as $blog_id ) {
|
5647 |
+
$this->do_action( "after_{$name}_cron", $blog_id );
|
5648 |
+
}
|
5649 |
+
}
|
5650 |
+
|
5651 |
+
if ( is_multisite() ) {
|
5652 |
+
$this->do_action( "after_{$name}_cron_multisite" );
|
5653 |
+
}
|
5654 |
+
}
|
5655 |
+
|
5656 |
+
#endregion
|
5657 |
+
|
5658 |
+
#----------------------------------------------------------------------------------
|
5659 |
+
#region Daily Sync Cron
|
5660 |
+
#----------------------------------------------------------------------------------
|
5661 |
+
|
5662 |
+
|
5663 |
+
/**
|
5664 |
+
* @author Vova Feldman (@svovaf)
|
5665 |
+
* @since 2.0.0
|
5666 |
+
*
|
5667 |
+
* @return bool
|
5668 |
+
*/
|
5669 |
+
private function is_sync_cron_scheduled() {
|
5670 |
+
return $this->is_cron_on( 'sync' );
|
5671 |
+
}
|
5672 |
+
|
5673 |
+
/**
|
5674 |
+
* Get the sync cron's executing blog ID.
|
5675 |
+
*
|
5676 |
+
* @author Vova Feldman (@svovaf)
|
5677 |
+
* @since 2.0.0
|
5678 |
+
*
|
5679 |
+
* @return int
|
5680 |
+
*/
|
5681 |
+
private function get_sync_cron_blog_id() {
|
5682 |
+
return $this->get_cron_blog_id( 'sync' );
|
5683 |
+
}
|
5684 |
+
|
5685 |
+
/**
|
5686 |
+
* @author Vova Feldman (@svovaf)
|
5687 |
+
* @since 1.1.7.3
|
5688 |
+
*/
|
5689 |
+
private function run_manual_sync() {
|
5690 |
+
self::require_pluggable_essentials();
|
5691 |
+
|
5692 |
+
if ( ! $this->is_user_admin() ) {
|
5693 |
+
return;
|
5694 |
+
}
|
5695 |
+
|
5696 |
+
// Run manual sync.
|
5697 |
+
$this->_sync_cron();
|
5698 |
+
|
5699 |
+
// Reschedule next cron to run 24 hours from now (performance optimization).
|
5700 |
+
$this->schedule_sync_cron( time() + WP_FS__TIME_24_HOURS_IN_SEC, false );
|
5701 |
+
}
|
5702 |
+
|
5703 |
+
/**
|
5704 |
+
* Data sync cron job. Replaces the background sync non blocking HTTP request
|
5705 |
+
* that doesn't halt page loading.
|
5706 |
+
*
|
5707 |
+
* @author Vova Feldman (@svovaf)
|
5708 |
+
* @since 1.1.7.3
|
5709 |
+
* @since 2.0.0 Consolidate all the data sync into the same cron for performance optimization. The max number of API requests is based on the number of unique opted-in users.
|
5710 |
+
*/
|
5711 |
+
function _sync_cron() {
|
5712 |
+
$this->_logger->entrance();
|
5713 |
+
|
5714 |
+
$this->execute_cron( 'sync', array( &$this, '_sync_cron_method' ) );
|
5715 |
+
}
|
5716 |
+
|
5717 |
+
/**
|
5718 |
+
* The actual data sync cron logic.
|
5719 |
+
*
|
5720 |
+
* @author Vova Feldman (@svovaf)
|
5721 |
+
* @since 2.0.0
|
5722 |
+
*
|
5723 |
+
* @param int[] $blog_ids
|
5724 |
+
*/
|
5725 |
+
function _sync_cron_method( array $blog_ids ) {
|
5726 |
+
if ( $this->is_registered() ) {
|
5727 |
+
if ( $this->has_paid_plan() ) {
|
5728 |
+
// Initiate background plan sync.
|
5729 |
+
$this->_sync_license( true );
|
5730 |
+
|
5731 |
+
if ( $this->is_paying() ) {
|
5732 |
+
// Check for premium plugin updates.
|
5733 |
+
$this->check_updates( true );
|
5734 |
+
}
|
5735 |
+
} else {
|
5736 |
+
// Sync install(s) (only if something changed locally).
|
5737 |
+
if ( 1 < count( $blog_ids ) ) {
|
5738 |
+
$this->sync_installs();
|
5739 |
+
} else {
|
5740 |
+
$this->sync_install();
|
5741 |
+
}
|
5742 |
+
}
|
5743 |
+
}
|
5744 |
+
}
|
5745 |
+
|
5746 |
+
/**
|
5747 |
+
* Check if sync was executed in the last $period of seconds.
|
5748 |
+
*
|
5749 |
+
* @author Vova Feldman (@svovaf)
|
5750 |
+
* @since 1.1.7.3
|
5751 |
+
*
|
5752 |
+
* @param int $period In seconds
|
5753 |
+
*
|
5754 |
+
* @return bool
|
5755 |
+
*/
|
5756 |
+
private function is_sync_executed( $period = WP_FS__TIME_24_HOURS_IN_SEC ) {
|
5757 |
+
return $this->is_cron_executed( 'sync', $period );
|
5758 |
+
}
|
5759 |
+
|
5760 |
+
/**
|
5761 |
+
* @author Vova Feldman (@svovaf)
|
5762 |
+
* @since 1.1.7.3
|
5763 |
+
*
|
5764 |
+
* @return bool
|
5765 |
+
*/
|
5766 |
+
private function is_sync_cron_on() {
|
5767 |
+
return $this->is_cron_on( 'sync' );
|
5768 |
+
}
|
5769 |
+
|
5770 |
+
/**
|
5771 |
+
* @author Vova Feldman (@svovaf)
|
5772 |
+
* @since 1.1.7.3
|
5773 |
+
*
|
5774 |
+
* @param int $start_at Defaults to now.
|
5775 |
+
* @param bool $randomize_start If true, schedule first job randomly during the next 12 hours. Otherwise, schedule job to start right away.
|
5776 |
+
* @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
|
5777 |
+
*/
|
5778 |
+
private function schedule_sync_cron(
|
5779 |
+
$start_at = WP_FS__SCRIPT_START_TIME,
|
5780 |
+
$randomize_start = true,
|
5781 |
+
$except_blog_id = 0
|
5782 |
+
) {
|
5783 |
+
$this->schedule_cron(
|
5784 |
+
'sync',
|
5785 |
+
'data_sync',
|
5786 |
+
'daily',
|
5787 |
+
$start_at,
|
5788 |
+
$randomize_start,
|
5789 |
+
$except_blog_id
|
5790 |
+
);
|
5791 |
+
}
|
5792 |
+
|
5793 |
+
/**
|
5794 |
+
* Add the actual sync function to the cron job hook.
|
5795 |
+
*
|
5796 |
+
* @author Vova Feldman (@svovaf)
|
5797 |
+
* @since 1.1.7.3
|
5798 |
+
*/
|
5799 |
+
private function hook_callback_to_sync_cron() {
|
5800 |
+
$this->add_action( 'data_sync', array( &$this, '_sync_cron' ) );
|
5801 |
+
}
|
5802 |
+
|
5803 |
+
/**
|
5804 |
+
* @author Vova Feldman (@svovaf)
|
5805 |
+
* @since 1.1.7.3
|
5806 |
+
*
|
5807 |
+
* @param bool $is_network_clear Since 2.0.0 If set to TRUE, clear sync cron even if there are installs that are still connected.
|
5808 |
+
*/
|
5809 |
+
private function clear_sync_cron( $is_network_clear = false ) {
|
5810 |
+
$this->_logger->entrance();
|
5811 |
+
|
5812 |
+
$this->clear_cron( 'sync', 'data_sync', $is_network_clear );
|
5813 |
+
}
|
5814 |
+
|
5815 |
+
/**
|
5816 |
+
* Unix timestamp for next sync cron execution or false if not scheduled.
|
5817 |
+
*
|
5818 |
+
* @author Vova Feldman (@svovaf)
|
5819 |
+
* @since 1.1.7.3
|
5820 |
+
*
|
5821 |
+
* @return int|false
|
5822 |
+
*/
|
5823 |
+
function next_sync_cron() {
|
5824 |
+
return $this->get_next_scheduled_cron( 'sync', 'data_sync' );
|
5825 |
+
}
|
5826 |
+
|
5827 |
+
/**
|
5828 |
+
* Unix timestamp for previous sync cron execution or false if never executed.
|
5829 |
+
*
|
5830 |
+
* @author Vova Feldman (@svovaf)
|
5831 |
+
* @since 1.1.7.3
|
5832 |
+
*
|
5833 |
+
* @return int|false
|
5834 |
+
*/
|
5835 |
+
function last_sync_cron() {
|
5836 |
+
return $this->cron_last_execution( 'sync' );
|
5837 |
+
}
|
5838 |
+
|
5839 |
+
#endregion Daily Sync Cron ------------------------------------------------------------------
|
5840 |
+
|
5841 |
+
#----------------------------------------------------------------------------------
|
5842 |
+
#region Async Install Sync
|
5843 |
+
#----------------------------------------------------------------------------------
|
5844 |
+
|
5845 |
+
/**
|
5846 |
+
* @author Vova Feldman (@svovaf)
|
5847 |
+
* @since 1.1.7.3
|
5848 |
+
*
|
5849 |
+
* @return bool
|
5850 |
+
*/
|
5851 |
+
private function is_install_sync_scheduled() {
|
5852 |
+
return $this->is_cron_on( 'install_sync' );
|
5853 |
+
}
|
5854 |
+
|
5855 |
+
/**
|
5856 |
+
* Get the sync cron's executing blog ID.
|
5857 |
+
*
|
5858 |
+
* @author Vova Feldman (@svovaf)
|
5859 |
+
* @since 2.0.0
|
5860 |
+
*
|
5861 |
+
* @return int
|
5862 |
+
*/
|
5863 |
+
private function get_install_sync_cron_blog_id() {
|
5864 |
+
return $this->get_cron_blog_id( 'install_sync' );
|
5865 |
+
}
|
5866 |
+
|
5867 |
+
/**
|
5868 |
+
* Instead of running blocking install sync event, execute non blocking scheduled wp-cron.
|
5869 |
+
*
|
5870 |
+
* @author Vova Feldman (@svovaf)
|
5871 |
+
* @since 1.1.7.3
|
5872 |
+
*
|
5873 |
+
* @param int $except_blog_id Since 2.0.0 when running in a multisite network environment, the cron execution is consolidated. This param allows excluding excluded specified blog ID from being the cron executor.
|
5874 |
+
*/
|
5875 |
+
private function schedule_install_sync( $except_blog_id = 0 ) {
|
5876 |
+
$this->schedule_cron( 'install_sync', 'install_sync', 'single', 0, false, $except_blog_id );
|
5877 |
+
}
|
5878 |
+
|
5879 |
+
/**
|
5880 |
+
* Unix timestamp for previous install sync cron execution or false if never executed.
|
5881 |
+
*
|
5882 |
+
* @todo There's some very strange bug that $this->_storage->install_sync_timestamp value is not being updated. But for sure the sync event is working.
|
5883 |
+
*
|
5884 |
+
* @author Vova Feldman (@svovaf)
|
5885 |
+
* @since 1.1.7.3
|
5886 |
+
*
|
5887 |
+
* @return int|false
|
5888 |
+
*/
|
5889 |
+
function last_install_sync() {
|
5890 |
+
return $this->cron_last_execution( 'install_sync' );
|
5891 |
+
}
|
5892 |
+
|
5893 |
+
/**
|
5894 |
+
* Unix timestamp for next install sync cron execution or false if not scheduled.
|
5895 |
+
*
|
5896 |
+
* @author Vova Feldman (@svovaf)
|
5897 |
+
* @since 1.1.7.3
|
5898 |
+
*
|
5899 |
+
* @return int|false
|
5900 |
+
*/
|
5901 |
+
function next_install_sync() {
|
5902 |
+
return $this->get_next_scheduled_cron( 'install_sync', 'install_sync' );
|
5903 |
+
}
|
5904 |
+
|
5905 |
+
/**
|
5906 |
+
* Add the actual install sync function to the cron job hook.
|
5907 |
+
*
|
5908 |
+
* @author Vova Feldman (@svovaf)
|
5909 |
+
* @since 1.1.7.3
|
5910 |
+
*/
|
5911 |
+
private function hook_callback_to_install_sync() {
|
5912 |
+
$this->add_action( 'install_sync', array( &$this, '_run_sync_install' ) );
|
5913 |
+
}
|
5914 |
+
|
5915 |
+
/**
|
5916 |
+
* @author Vova Feldman (@svovaf)
|
5917 |
+
* @since 1.1.7.3
|
5918 |
+
*
|
5919 |
+
* @param bool $is_network_clear Since 2.0.0 If set to TRUE, clear sync cron even if there are installs that are still connected.
|
5920 |
+
*/
|
5921 |
+
private function clear_install_sync_cron( $is_network_clear = false ) {
|
5922 |
+
$this->_logger->entrance();
|
5923 |
+
|
5924 |
+
$this->clear_cron( 'install_sync', 'install_sync', $is_network_clear );
|
5925 |
+
}
|
5926 |
+
|
5927 |
+
/**
|
5928 |
+
* @author Vova Feldman (@svovaf)
|
5929 |
+
* @since 1.1.7.3
|
5930 |
+
* @since 2.0.0 Consolidate all the data sync into the same cron for performance optimization. The max number of API requests is based on the number of unique opted-in users.
|
5931 |
+
*/
|
5932 |
+
public function _run_sync_install() {
|
5933 |
+
$this->_logger->entrance();
|
5934 |
+
|
5935 |
+
$this->execute_cron( 'sync', array( &$this, '_sync_install_cron_method' ) );
|
5936 |
+
}
|
5937 |
+
|
5938 |
+
/**
|
5939 |
+
* The actual install(s) sync cron logic.
|
5940 |
+
*
|
5941 |
+
* @author Vova Feldman (@svovaf)
|
5942 |
+
* @since 2.0.0
|
5943 |
+
*
|
5944 |
+
* @param int[] $blog_ids
|
5945 |
+
*/
|
5946 |
+
function _sync_install_cron_method( array $blog_ids ) {
|
5947 |
+
if ( $this->is_registered() ) {
|
5948 |
+
if ( 1 < count( $blog_ids ) ) {
|
5949 |
+
$this->sync_installs( array(), true );
|
5950 |
+
} else {
|
5951 |
+
$this->sync_install( array(), true );
|
5952 |
+
}
|
5953 |
+
}
|
5954 |
+
}
|
5955 |
+
|
5956 |
+
#endregion Async Install Sync ------------------------------------------------------------------
|
5957 |
+
|
5958 |
+
/**
|
5959 |
+
* Show a notice that activation is currently pending.
|
5960 |
+
*
|
5961 |
+
* @author Vova Feldman (@svovaf)
|
5962 |
+
* @since 1.0.7
|
5963 |
+
*
|
5964 |
+
* @param bool|string $email
|
5965 |
+
* @param bool $is_pending_trial Since 1.2.1.5
|
5966 |
+
*/
|
5967 |
+
function _add_pending_activation_notice( $email = false, $is_pending_trial = false ) {
|
5968 |
+
if ( ! is_string( $email ) ) {
|
5969 |
+
$current_user = self::_get_current_wp_user();
|
5970 |
+
$email = $current_user->user_email;
|
5971 |
+
}
|
5972 |
+
|
5973 |
+
$this->_admin_notices->add_sticky(
|
5974 |
+
sprintf(
|
5975 |
+
$this->get_text_inline( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s.', 'pending-activation-message' ),
|
5976 |
+
'<b>' . $this->get_plugin_name() . '</b>',
|
5977 |
+
'<b>' . $email . '</b>',
|
5978 |
+
( $is_pending_trial ?
|
5979 |
+
$this->get_text_inline( 'start the trial', 'start-the-trial' ) :
|
5980 |
+
$this->get_text_inline( 'complete the install', 'complete-the-install' ) )
|
5981 |
+
),
|
5982 |
+
'activation_pending',
|
5983 |
+
'Thanks!'
|
5984 |
+
);
|
5985 |
+
}
|
5986 |
+
|
5987 |
+
/**
|
5988 |
+
* Check if currently in plugin activation.
|
5989 |
+
*
|
5990 |
+
* @author Vova Feldman (@svovaf)
|
5991 |
+
* @since 1.1.4
|
5992 |
+
*
|
5993 |
+
* @return bool
|
5994 |
+
*/
|
5995 |
+
function is_plugin_activation() {
|
5996 |
+
return get_option( 'fs_'
|
5997 |
+
. ( $this->is_plugin() ? '' : $this->_module_type . '_' )
|
5998 |
+
. "{$this->_slug}_activated", false );
|
5999 |
+
}
|
6000 |
+
|
6001 |
+
/**
|
6002 |
+
*
|
6003 |
+
* NOTE: admin_menu action executed before admin_init.
|
6004 |
+
*
|
6005 |
+
* @author Vova Feldman (@svovaf)
|
6006 |
+
* @since 1.0.7
|
6007 |
+
*/
|
6008 |
+
function _admin_init_action() {
|
6009 |
+
/**
|
6010 |
+
* Automatically redirect to connect/activation page after plugin activation.
|
6011 |
+
*
|
6012 |
+
* @since 1.1.7 Do NOT redirect to opt-in when running in network admin mode.
|
6013 |
+
*/
|
6014 |
+
if ( $this->is_plugin_activation() ) {
|
6015 |
+
delete_option( 'fs_'
|
6016 |
+
. ( $this->is_plugin() ? '' : $this->_module_type . '_' )
|
6017 |
+
. "{$this->_slug}_activated" );
|
6018 |
+
|
6019 |
+
$this->_redirect_on_activation_hook();
|
6020 |
+
|
6021 |
+
return;
|
6022 |
+
}
|
6023 |
+
|
6024 |
+
if ( fs_request_is_action( $this->get_unique_affix() . '_skip_activation' ) ) {
|
6025 |
+
check_admin_referer( $this->get_unique_affix() . '_skip_activation' );
|
6026 |
+
|
6027 |
+
$this->skip_connection( null, fs_is_network_admin() );
|
6028 |
+
|
6029 |
+
fs_redirect( $this->get_after_activation_url( 'after_skip_url' ) );
|
6030 |
+
}
|
6031 |
+
|
6032 |
+
if ( $this->is_network_activation_mode() &&
|
6033 |
+
fs_request_is_action( $this->get_unique_affix() . '_delegate_activation' )
|
6034 |
+
) {
|
6035 |
+
check_admin_referer( $this->get_unique_affix() . '_delegate_activation' );
|
6036 |
+
|
6037 |
+
$this->delegate_connection();
|
6038 |
+
|
6039 |
+
fs_redirect( $this->get_after_activation_url( 'after_delegation_url' ) );
|
6040 |
+
}
|
6041 |
+
|
6042 |
+
if ( ! $this->is_addon() &&
|
6043 |
+
(
|
6044 |
+
// Not registered nor anonymous.
|
6045 |
+
( ! $this->is_registered() && ! $this->is_anonymous() ) ||
|
6046 |
+
// OR, network level and in network upgrade mode.
|
6047 |
+
( fs_is_network_admin() && $this->_is_network_active && $this->is_network_upgrade_mode() )
|
6048 |
+
)
|
6049 |
+
) {
|
6050 |
+
if ( ! $this->is_pending_activation() ) {
|
6051 |
+
if ( ! $this->_menu->is_main_settings_page() ) {
|
6052 |
+
/**
|
6053 |
+
* If a user visits any other admin page before activating the premium-only theme with a valid
|
6054 |
+
* license, reactivate the previous theme.
|
6055 |
+
*
|
6056 |
+
* @author Leo Fajardo (@leorw)
|
6057 |
+
* @since 1.2.2
|
6058 |
+
*/
|
6059 |
+
if ( $this->is_theme()
|
6060 |
+
&& $this->is_only_premium()
|
6061 |
+
&& ! $this->has_settings_menu()
|
6062 |
+
&& ! isset( $_REQUEST['fs_action'] )
|
6063 |
+
&& $this->can_activate_previous_theme()
|
6064 |
+
) {
|
6065 |
+
$this->activate_previous_theme();
|
6066 |
+
|
6067 |
+
return;
|
6068 |
+
}
|
6069 |
+
|
6070 |
+
if ( ! fs_is_network_admin() &&
|
6071 |
+
$this->is_network_activation_mode() &&
|
6072 |
+
! $this->is_delegated_connection()
|
6073 |
+
) {
|
6074 |
+
return;
|
6075 |
+
}
|
6076 |
+
|
6077 |
+
if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
|
6078 |
+
// Show notice for new plugin installations.
|
6079 |
+
$this->_admin_notices->add(
|
6080 |
+
sprintf(
|
6081 |
+
$this->get_text_inline( 'You are just one step away - %s', 'you-are-step-away' ),
|
6082 |
+
sprintf( '<b><a href="%s">%s</a></b>',
|
6083 |
+
$this->get_activation_url( array(), ! $this->is_delegated_connection() ),
|
6084 |
+
sprintf( $this->get_text_x_inline( 'Complete "%s" Activation Now',
|
6085 |
+
'%s - plugin name. As complete "PluginX" activation now', 'activate-x-now' ), $this->get_plugin_name() )
|
6086 |
+
)
|
6087 |
+
),
|
6088 |
+
'',
|
6089 |
+
'update-nag'
|
6090 |
+
);
|
6091 |
+
} else {
|
6092 |
+
if ( $this->should_add_sticky_optin_notice() ) {
|
6093 |
+
$this->add_sticky_optin_admin_notice();
|
6094 |
+
}
|
6095 |
+
|
6096 |
+
if ( $this->has_filter( 'optin_pointer_element' ) ) {
|
6097 |
+
// Don't show admin nag if plugin update.
|
6098 |
+
wp_enqueue_script( 'wp-pointer' );
|
6099 |
+
wp_enqueue_style( 'wp-pointer' );
|
6100 |
+
|
6101 |
+
$this->_enqueue_connect_essentials();
|
6102 |
+
|
6103 |
+
add_action( 'admin_print_footer_scripts', array(
|
6104 |
+
$this,
|
6105 |
+
'_add_connect_pointer_script'
|
6106 |
+
) );
|
6107 |
+
}
|
6108 |
+
}
|
6109 |
+
}
|
6110 |
+
}
|
6111 |
+
|
6112 |
+
if ( $this->is_theme() &&
|
6113 |
+
$this->_menu->is_main_settings_page()
|
6114 |
+
) {
|
6115 |
+
$this->_show_theme_activation_optin_dialog();
|
6116 |
+
}
|
6117 |
+
}
|
6118 |
+
|
6119 |
+
$this->_add_upgrade_action_link();
|
6120 |
+
}
|
6121 |
+
|
6122 |
+
/**
|
6123 |
+
* @author Vova Feldman (@svovaf)
|
6124 |
+
* @since 2.0.0
|
6125 |
+
*
|
6126 |
+
* @return bool
|
6127 |
+
*/
|
6128 |
+
private function should_add_sticky_optin_notice() {
|
6129 |
+
if ( fs_is_network_admin() ) {
|
6130 |
+
if ( ! $this->_is_network_active ) {
|
6131 |
+
return false;
|
6132 |
+
}
|
6133 |
+
|
6134 |
+
if ( ! $this->is_network_activation_mode() ) {
|
6135 |
+
return false;
|
6136 |
+
}
|
6137 |
+
|
6138 |
+
return ! isset( $this->_storage->sticky_optin_added_ms );
|
6139 |
+
}
|
6140 |
+
|
6141 |
+
if ( ! $this->is_activation_mode() ) {
|
6142 |
+
return false;
|
6143 |
+
}
|
6144 |
+
|
6145 |
+
// If running from a blog admin and delegated the connection.
|
6146 |
+
return ! isset( $this->_storage->sticky_optin_added );
|
6147 |
+
}
|
6148 |
+
|
6149 |
+
/**
|
6150 |
+
* @author Leo Fajardo (@leorw)
|
6151 |
+
* @since 2.0.0
|
6152 |
+
*/
|
6153 |
+
private function add_sticky_optin_admin_notice() {
|
6154 |
+
if ( ! $this->_is_network_active || ! fs_is_network_admin() ) {
|
6155 |
+
$this->_storage->sticky_optin_added = true;
|
6156 |
+
} else {
|
6157 |
+
$this->_storage->sticky_optin_added_ms = true;
|
6158 |
+
}
|
6159 |
+
|
6160 |
+
// Show notice for new plugin installations.
|
6161 |
+
$this->_admin_notices->add_sticky(
|
6162 |
+
sprintf(
|
6163 |
+
$this->get_text_inline( 'We made a few tweaks to the %s, %s', 'few-plugin-tweaks' ),
|
6164 |
+
$this->_module_type,
|
6165 |
+
sprintf( '<b><a href="%s">%s</a></b>',
|
6166 |
+
$this->get_activation_url(),
|
6167 |
+
sprintf( $this->get_text_inline( 'Opt in to make "%s" Better!', 'optin-x-now' ), $this->get_plugin_name() )
|
6168 |
+
)
|
6169 |
+
),
|
6170 |
+
'connect_account',
|
6171 |
+
'',
|
6172 |
+
'update-nag'
|
6173 |
+
);
|
6174 |
+
}
|
6175 |
+
|
6176 |
+
/**
|
6177 |
+
* Enqueue connect requires scripts and styles.
|
6178 |
+
*
|
6179 |
+
* @author Vova Feldman (@svovaf)
|
6180 |
+
* @since 1.1.4
|
6181 |
+
*/
|
6182 |
+
function _enqueue_connect_essentials() {
|
6183 |
+
wp_enqueue_script( 'jquery' );
|
6184 |
+
wp_enqueue_script( 'json2' );
|
6185 |
+
|
6186 |
+
fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
|
6187 |
+
fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
|
6188 |
+
|
6189 |
+
fs_enqueue_local_style( 'fs_connect', '/admin/connect.css' );
|
6190 |
+
}
|
6191 |
+
|
6192 |
+
/**
|
6193 |
+
* Add connect / opt-in pointer.
|
6194 |
+
*
|
6195 |
+
* @author Vova Feldman (@svovaf)
|
6196 |
+
* @since 1.1.4
|
6197 |
+
*/
|
6198 |
+
function _add_connect_pointer_script() {
|
6199 |
+
$vars = array( 'id' => $this->_module_id );
|
6200 |
+
$pointer_content = fs_get_template( 'connect.php', $vars );
|
6201 |
+
?>
|
6202 |
+
<script type="text/javascript">// <![CDATA[
|
6203 |
+
jQuery(document).ready(function ($) {
|
6204 |
+
if ('undefined' !== typeof(jQuery().pointer)) {
|
6205 |
+
|
6206 |
+
var element = <?php echo $this->apply_filters( 'optin_pointer_element', '$("#non_existing_element");' ) ?>;
|
6207 |
+
|
6208 |
+
if (element.length > 0) {
|
6209 |
+
var optin = $(element).pointer($.extend(true, {}, {
|
6210 |
+
content : <?php echo json_encode( $pointer_content ) ?>,
|
6211 |
+
position : {
|
6212 |
+
edge : 'left',
|
6213 |
+
align: 'center'
|
6214 |
+
},
|
6215 |
+
buttons : function () {
|
6216 |
+
// Don't show pointer buttons.
|
6217 |
+
return '';
|
6218 |
+
},
|
6219 |
+
pointerWidth: 482
|
6220 |
+
}, <?php echo $this->apply_filters( 'optin_pointer_options_json', '{}' ) ?>));
|
6221 |
+
|
6222 |
+
<?php
|
6223 |
+
echo $this->apply_filters( 'optin_pointer_execute', "
|
6224 |
+
|
6225 |
+
optin.pointer('open');
|
6226 |
+
|
6227 |
+
// Tag the opt-in pointer with custom class.
|
6228 |
+
$('.wp-pointer #fs_connect')
|
6229 |
+
.parents('.wp-pointer.wp-pointer-top')
|
6230 |
+
.addClass('fs-opt-in-pointer');
|
6231 |
+
|
6232 |
+
", 'element', 'optin' ) ?>
|
6233 |
+
}
|
6234 |
+
}
|
6235 |
+
});
|
6236 |
+
// ]]></script>
|
6237 |
+
<?php
|
6238 |
+
}
|
6239 |
+
|
6240 |
+
/**
|
6241 |
+
* Return current page's URL.
|
6242 |
+
*
|
6243 |
+
* @author Vova Feldman (@svovaf)
|
6244 |
+
* @since 1.0.7
|
6245 |
+
*
|
6246 |
+
* @return string
|
6247 |
+
*/
|
6248 |
+
function current_page_url() {
|
6249 |
+
$url = 'http';
|
6250 |
+
|
6251 |
+
if ( isset( $_SERVER["HTTPS"] ) ) {
|
6252 |
+
if ( $_SERVER["HTTPS"] == "on" ) {
|
6253 |
+
$url .= "s";
|
6254 |
+
}
|
6255 |
+
}
|
6256 |
+
$url .= "://";
|
6257 |
+
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
6258 |
+
$url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
|
6259 |
+
} else {
|
6260 |
+
$url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
|
6261 |
+
}
|
6262 |
+
|
6263 |
+
return esc_url( $url );
|
6264 |
+
}
|
6265 |
+
|
6266 |
+
/**
|
6267 |
+
* Check if the current page is the plugin's main admin settings page.
|
6268 |
+
*
|
6269 |
+
* @author Vova Feldman (@svovaf)
|
6270 |
+
* @since 1.0.7
|
6271 |
+
*
|
6272 |
+
* @return bool
|
6273 |
+
*/
|
6274 |
+
function _is_plugin_page() {
|
6275 |
+
return fs_is_plugin_page( $this->_menu->get_raw_slug() ) ||
|
6276 |
+
fs_is_plugin_page( $this->_slug );
|
6277 |
+
}
|
6278 |
+
|
6279 |
+
/* Events
|
6280 |
+
------------------------------------------------------------------------------------------------------------------*/
|
6281 |
+
/**
|
6282 |
+
* Delete site install from Database.
|
6283 |
+
*
|
6284 |
+
* @author Vova Feldman (@svovaf)
|
6285 |
+
* @since 1.0.1
|
6286 |
+
*
|
6287 |
+
* @param bool $store
|
6288 |
+
* @param int|null $blog_id Since 2.0.0
|
6289 |
+
*
|
6290 |
+
* @return false|int The install ID if deleted. Otherwise, FALSE (when install not exist).
|
6291 |
+
*/
|
6292 |
+
function _delete_site( $store = true, $blog_id = null ) {
|
6293 |
+
return self::_delete_site_by_slug( $this->_slug, $this->_module_type, $store, $blog_id );
|
6294 |
+
}
|
6295 |
+
|
6296 |
+
/**
|
6297 |
+
* Delete site install from Database.
|
6298 |
+
*
|
6299 |
+
* @author Vova Feldman (@svovaf)
|
6300 |
+
* @since 1.2.2.7
|
6301 |
+
*
|
6302 |
+
* @param string $slug
|
6303 |
+
* @param string $module_type
|
6304 |
+
* @param bool $store
|
6305 |
+
* @param int|null $blog_id Since 2.0.0
|
6306 |
+
*
|
6307 |
+
* @return false|int The install ID if deleted. Otherwise, FALSE (when install not exist).
|
6308 |
+
*/
|
6309 |
+
static function _delete_site_by_slug( $slug, $module_type, $store = true, $blog_id = null ) {
|
6310 |
+
$sites = self::get_all_sites( $module_type, $blog_id );
|
6311 |
+
|
6312 |
+
$install_id = false;
|
6313 |
+
|
6314 |
+
if ( isset( $sites[ $slug ] ) ) {
|
6315 |
+
if ( is_object( $sites[ $slug ] ) ) {
|
6316 |
+
$install_id = $sites[ $slug ]->id;
|
6317 |
+
}
|
6318 |
+
|
6319 |
+
unset( $sites[ $slug ] );
|
6320 |
+
|
6321 |
+
self::set_account_option_by_module( $module_type, 'sites', $sites, $store, $blog_id );
|
6322 |
+
}
|
6323 |
+
|
6324 |
+
return $install_id;
|
6325 |
+
}
|
6326 |
+
|
6327 |
+
/**
|
6328 |
+
* Delete user.
|
6329 |
+
*
|
6330 |
+
* @author Vova Feldman (@svovaf)
|
6331 |
+
* @since 2.0.0
|
6332 |
+
*
|
6333 |
+
* @param number $user_id
|
6334 |
+
* @param bool $store
|
6335 |
+
*
|
6336 |
+
* @return false|int The user ID if deleted. Otherwise, FALSE (when install not exist).
|
6337 |
+
*/
|
6338 |
+
private static function delete_user( $user_id, $store = true ) {
|
6339 |
+
$users = self::get_all_users();
|
6340 |
+
|
6341 |
+
if ( ! is_array( $users ) || ! isset( $users[ $user_id ] ) ) {
|
6342 |
+
return false;
|
6343 |
+
}
|
6344 |
+
|
6345 |
+
unset( $users[ $user_id ] );
|
6346 |
+
|
6347 |
+
self::$_accounts->set_option( 'users', $users, $store );
|
6348 |
+
|
6349 |
+
return $user_id;
|
6350 |
+
}
|
6351 |
+
|
6352 |
+
/**
|
6353 |
+
* Delete plugin's plans information.
|
6354 |
+
*
|
6355 |
+
* @param bool $store Flush to Database if true.
|
6356 |
+
* @param bool $keep_associated_plans If set to false, delete all plans, even if a plan is associated with an install.
|
6357 |
+
*
|
6358 |
+
* @author Vova Feldman (@svovaf)
|
6359 |
+
* @since 1.0.9
|
6360 |
+
*/
|
6361 |
+
private function _delete_plans( $store = true, $keep_associated_plans = true ) {
|
6362 |
+
$this->_logger->entrance();
|
6363 |
+
|
6364 |
+
$plans = self::get_all_plans( $this->_module_type );
|
6365 |
+
|
6366 |
+
$plans_to_keep = array();
|
6367 |
+
|
6368 |
+
if ( $keep_associated_plans ) {
|
6369 |
+
$plans_ids_to_keep = $this->get_plans_ids_associated_with_installs();
|
6370 |
+
foreach ( $plans_ids_to_keep as $plan_id ) {
|
6371 |
+
$plan = self::_get_plan_by_id( $plan_id );
|
6372 |
+
if ( is_object( $plan ) ) {
|
6373 |
+
$plans_to_keep[] = $plan;
|
6374 |
+
}
|
6375 |
+
}
|
6376 |
+
}
|
6377 |
+
|
6378 |
+
if ( ! empty( $plans_to_keep ) ) {
|
6379 |
+
$plans[ $this->_slug ] = $plans_to_keep;
|
6380 |
+
} else {
|
6381 |
+
unset( $plans[ $this->_slug ] );
|
6382 |
+
}
|
6383 |
+
|
6384 |
+
$this->set_account_option( 'plans', $plans, $store );
|
6385 |
+
}
|
6386 |
+
|
6387 |
+
/**
|
6388 |
+
* Delete all plugin licenses.
|
6389 |
+
*
|
6390 |
+
* @author Vova Feldman (@svovaf)
|
6391 |
+
* @since 1.0.9
|
6392 |
+
*
|
6393 |
+
* @param bool $store
|
6394 |
+
*/
|
6395 |
+
private function _delete_licenses( $store = true ) {
|
6396 |
+
$this->_logger->entrance();
|
6397 |
+
|
6398 |
+
$all_licenses = self::get_all_licenses();
|
6399 |
+
|
6400 |
+
unset( $all_licenses[ $this->_module_id ] );
|
6401 |
+
|
6402 |
+
self::$_accounts->set_option( 'all_licenses', $all_licenses, $store );
|
6403 |
+
}
|
6404 |
+
|
6405 |
+
/**
|
6406 |
+
* Check if Freemius was added on new plugin installation.
|
6407 |
+
*
|
6408 |
+
* @author Vova Feldman (@svovaf)
|
6409 |
+
* @since 1.1.5
|
6410 |
+
*
|
6411 |
+
* @return bool
|
6412 |
+
*/
|
6413 |
+
function is_plugin_new_install() {
|
6414 |
+
return isset( $this->_storage->is_plugin_new_install ) &&
|
6415 |
+
$this->_storage->is_plugin_new_install;
|
6416 |
+
}
|
6417 |
+
|
6418 |
+
/**
|
6419 |
+
* Check if it's the first plugin release that is running Freemius.
|
6420 |
+
*
|
6421 |
+
* @author Vova Feldman (@svovaf)
|
6422 |
+
* @since 1.2.1.5
|
6423 |
+
*
|
6424 |
+
* @return bool
|
6425 |
+
*/
|
6426 |
+
function is_first_freemius_powered_version() {
|
6427 |
+
return empty( $this->_storage->plugin_last_version );
|
6428 |
+
}
|
6429 |
+
|
6430 |
+
/**
|
6431 |
+
* @author Leo Fajardo (@leorw)
|
6432 |
+
* @since 1.2.2
|
6433 |
+
*
|
6434 |
+
* @return bool|string
|
6435 |
+
*/
|
6436 |
+
private function get_previous_theme_slug() {
|
6437 |
+
return isset( $this->_storage->previous_theme ) ?
|
6438 |
+
$this->_storage->previous_theme :
|
6439 |
+
false;
|
6440 |
+
}
|
6441 |
+
|
6442 |
+
/**
|
6443 |
+
* @author Leo Fajardo (@leorw)
|
6444 |
+
* @since 1.2.2
|
6445 |
+
*
|
6446 |
+
* @return string
|
6447 |
+
*/
|
6448 |
+
private function can_activate_previous_theme() {
|
6449 |
+
$slug = $this->get_previous_theme_slug();
|
6450 |
+
if ( false !== $slug && current_user_can( 'switch_themes' ) ) {
|
6451 |
+
$theme_instance = wp_get_theme( $slug );
|
6452 |
+
|
6453 |
+
return $theme_instance->exists();
|
6454 |
+
}
|
6455 |
+
|
6456 |
+
return false;
|
6457 |
+
}
|
6458 |
+
|
6459 |
+
/**
|
6460 |
+
* @author Leo Fajardo (@leorw)
|
6461 |
+
* @since 1.2.2
|
6462 |
+
*
|
6463 |
+
* @return string
|
6464 |
+
*/
|
6465 |
+
private function activate_previous_theme() {
|
6466 |
+
switch_theme( $this->get_previous_theme_slug() );
|
6467 |
+
unset( $this->_storage->previous_theme );
|
6468 |
+
|
6469 |
+
global $pagenow;
|
6470 |
+
if ( 'themes.php' === $pagenow ) {
|
6471 |
+
/**
|
6472 |
+
* Refresh the active theme information.
|
6473 |
+
*
|
6474 |
+
* @author Leo Fajardo (@leorw)
|
6475 |
+
* @since 1.2.2
|
6476 |
+
*/
|
6477 |
+
fs_redirect( $this->admin_url( $pagenow ) );
|
6478 |
+
}
|
6479 |
+
}
|
6480 |
+
|
6481 |
+
/**
|
6482 |
+
* @author Leo Fajardo (@leorw)
|
6483 |
+
* @since 1.2.2
|
6484 |
+
*
|
6485 |
+
* @return string
|
6486 |
+
*/
|
6487 |
+
function get_previous_theme_activation_url() {
|
6488 |
+
if ( ! $this->can_activate_previous_theme() ) {
|
6489 |
+
return '';
|
6490 |
+
}
|
6491 |
+
|
6492 |
+
/**
|
6493 |
+
* Activation URL
|
6494 |
+
*
|
6495 |
+
* @author Leo Fajardo (@leorw)
|
6496 |
+
* @since 1.2.2
|
6497 |
+
*/
|
6498 |
+
return wp_nonce_url(
|
6499 |
+
$this->admin_url( 'themes.php?action=activate&stylesheet=' . urlencode( $this->get_previous_theme_slug() ) ),
|
6500 |
+
'switch-theme_' . $this->get_previous_theme_slug()
|
6501 |
+
);
|
6502 |
+
}
|
6503 |
+
|
6504 |
+
/**
|
6505 |
+
* Saves the slug of the previous theme if it still exists so that it can be used by the logic in the opt-in
|
6506 |
+
* form that decides whether to add a close button to the opt-in dialog or not. So after a premium-only theme is
|
6507 |
+
* activated, the close button will appear and will reactivate the previous theme if clicked. If the previous
|
6508 |
+
* theme doesn't exist, then there will be no close button.
|
6509 |
+
*
|
6510 |
+
* @author Leo Fajardo (@leorw)
|
6511 |
+
* @since 1.2.2
|
6512 |
+
*
|
6513 |
+
* @param string $slug_or_name Old theme's slug or name.
|
6514 |
+
* @param bool|WP_Theme $old_theme WP_Theme instance of the old theme if it still exists.
|
6515 |
+
*/
|
6516 |
+
function _activate_theme_event_hook( $slug_or_name, $old_theme = false ) {
|
6517 |
+
$this->_storage->previous_theme = ( false !== $old_theme ) ?
|
6518 |
+
$old_theme->get_stylesheet() :
|
6519 |
+
$slug_or_name;
|
6520 |
+
|
6521 |
+
$this->_activate_plugin_event_hook();
|
6522 |
+
}
|
6523 |
+
|
6524 |
+
/**
|
6525 |
+
* Plugin activated hook.
|
6526 |
+
*
|
6527 |
+
* @author Vova Feldman (@svovaf)
|
6528 |
+
* @since 1.0.1
|
6529 |
+
*
|
6530 |
+
* @uses FS_Api
|
6531 |
+
*/
|
6532 |
+
function _activate_plugin_event_hook() {
|
6533 |
+
$this->_logger->entrance( 'slug = ' . $this->_slug );
|
6534 |
+
|
6535 |
+
if ( ! $this->is_user_admin() ) {
|
6536 |
+
return;
|
6537 |
+
}
|
6538 |
+
|
6539 |
+
$this->unregister_uninstall_hook();
|
6540 |
+
|
6541 |
+
// Clear API cache on activation.
|
6542 |
+
FS_Api::clear_cache();
|
6543 |
+
|
6544 |
+
$is_premium_version_activation = ( current_filter() !== ( 'activate_' . $this->_free_plugin_basename ) );
|
6545 |
+
|
6546 |
+
$this->_logger->info( 'Activating ' . ( $is_premium_version_activation ? 'premium' : 'free' ) . ' plugin version.' );
|
6547 |
+
|
6548 |
+
// 1. If running in the activation of the FREE module, get the basename of the PREMIUM.
|
6549 |
+
// 2. If running in the activation of the PREMIUM module, get the basename of the FREE.
|
6550 |
+
$other_version_basename = $is_premium_version_activation ?
|
6551 |
+
$this->_free_plugin_basename :
|
6552 |
+
$this->premium_plugin_basename();
|
6553 |
+
|
6554 |
+
if ( ! $this->_is_network_active ) {
|
6555 |
+
/**
|
6556 |
+
* During the activation, the plugin isn't yet active, therefore,
|
6557 |
+
* _is_network_active will be set to false even if it's a network level
|
6558 |
+
* activation. So we need to fix that by looking at the is_network_admin() value.
|
6559 |
+
*
|
6560 |
+
* @author Vova Feldman
|
6561 |
+
*/
|
6562 |
+
$this->_is_network_active = (
|
6563 |
+
$this->_is_multisite_integrated &&
|
6564 |
+
// Themes are always network activated, but the ACTUAL activation is per site.
|
6565 |
+
$this->is_plugin() &&
|
6566 |
+
fs_is_network_admin()
|
6567 |
+
);
|
6568 |
+
}
|
6569 |
+
|
6570 |
+
/**
|
6571 |
+
* If the other module version is activate, deactivate it.
|
6572 |
+
*
|
6573 |
+
* is_plugin_active() checks if the plugin active on the site or the network level
|
6574 |
+
* and deactivate_plugins() deactivates the plugin whether its activated on the site
|
6575 |
+
* or network level.
|
6576 |
+
*
|
6577 |
+
* @author Leo Fajardo (@leorw)
|
6578 |
+
* @since 1.2.2
|
6579 |
+
*/
|
6580 |
+
if ( is_plugin_active( $other_version_basename ) ) {
|
6581 |
+
deactivate_plugins( $other_version_basename );
|
6582 |
+
}
|
6583 |
+
|
6584 |
+
if ( $this->is_registered() ) {
|
6585 |
+
if ( $is_premium_version_activation ) {
|
6586 |
+
$this->reconnect_locally();
|
6587 |
+
}
|
6588 |
+
|
6589 |
+
|
6590 |
+
// Schedule re-activation event and sync.
|
6591 |
+
// $this->sync_install( array(), true );
|
6592 |
+
$this->schedule_install_sync();
|
6593 |
+
|
6594 |
+
// If activating the premium module version, add an admin notice to congratulate for an upgrade completion.
|
6595 |
+
if ( $is_premium_version_activation ) {
|
6596 |
+
$this->_admin_notices->add(
|
6597 |
+
sprintf( $this->get_text_inline( 'The upgrade of %s was successfully completed.', 'successful-version-upgrade-message' ), sprintf( '<b>%s</b>', $this->_plugin->title ) ),
|
6598 |
+
$this->get_text_x_inline( 'W00t',
|
6599 |
+
'Used to express elation, enthusiasm, or triumph (especially in electronic communication).', 'woot' ) . '!'
|
6600 |
+
);
|
6601 |
+
}
|
6602 |
+
} else if ( $this->is_anonymous() ) {
|
6603 |
+
if ( isset( $this->_storage->is_anonymous_ms ) && $this->_storage->is_anonymous_ms['is'] ) {
|
6604 |
+
$plugin_version = $this->_storage->is_anonymous_ms['version'];
|
6605 |
+
$network = true;
|
6606 |
+
} else {
|
6607 |
+
$plugin_version = $this->_storage->is_anonymous['version'];
|
6608 |
+
$network = false;
|
6609 |
+
}
|
6610 |
+
|
6611 |
+
/**
|
6612 |
+
* Reset "skipped" click cache on the following:
|
6613 |
+
* 1. Freemius DEV mode.
|
6614 |
+
* 2. WordPress DEBUG mode.
|
6615 |
+
* 3. If a plugin and the user skipped the exact same version before.
|
6616 |
+
*
|
6617 |
+
* @since 1.2.2.7 Ulrich Pogson (@grapplerulrich) asked to not reset the SKIPPED flag if the exact same THEME version was activated before unless the developer is running with WP_DEBUG on, or Freemius debug mode on (WP_FS__DEV_MODE).
|
6618 |
+
*
|
6619 |
+
* @todo 4. If explicitly asked to retry after every activation.
|
6620 |
+
*/
|
6621 |
+
if ( WP_FS__DEV_MODE ||
|
6622 |
+
(
|
6623 |
+
( $this->is_plugin() || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) &&
|
6624 |
+
$this->get_plugin_version() == $plugin_version
|
6625 |
+
)
|
6626 |
+
) {
|
6627 |
+
$this->reset_anonymous_mode( $network );
|
6628 |
+
}
|
6629 |
+
}
|
6630 |
+
|
6631 |
+
if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
|
6632 |
+
/**
|
6633 |
+
* If no previous version of plugin's version exist, it means that it's either
|
6634 |
+
* the first time that the plugin installed on the site, or the plugin was installed
|
6635 |
+
* before but didn't have Freemius integrated.
|
6636 |
+
*
|
6637 |
+
* Since register_activation_hook() do NOT fires on updates since 3.1, and only fires
|
6638 |
+
* on manual activation via the dashboard, is_plugin_activation() is TRUE
|
6639 |
+
* only after immediate activation.
|
6640 |
+
*
|
6641 |
+
* @since 1.1.4
|
6642 |
+
* @link https://make.wordpress.org/core/2010/10/27/plugin-activation-hooks-no-longer-fire-for-updates/
|
6643 |
+
*/
|
6644 |
+
$this->_storage->is_plugin_new_install = empty( $this->_storage->plugin_last_version );
|
6645 |
+
}
|
6646 |
+
|
6647 |
+
if ( ! $this->_anonymous_mode &&
|
6648 |
+
$this->has_api_connectivity( WP_FS__DEV_MODE ) &&
|
6649 |
+
! $this->_isAutoInstall
|
6650 |
+
) {
|
6651 |
+
// Store hint that the plugin was just activated to enable auto-redirection to settings.
|
6652 |
+
add_option( 'fs_'
|
6653 |
+
. ( $this->is_plugin() ? '' : $this->_module_type . '_' )
|
6654 |
+
. "{$this->_slug}_activated", true );
|
6655 |
+
}
|
6656 |
+
|
6657 |
+
/**
|
6658 |
+
* Activation hook is executed after the plugin's main file is loaded, therefore,
|
6659 |
+
* after the plugin was loaded. The logic is located at activate_plugin()
|
6660 |
+
* ./wp-admin/includes/plugin.php.
|
6661 |
+
*
|
6662 |
+
* @author Vova Feldman (@svovaf)
|
6663 |
+
* @since 1.1.9
|
6664 |
+
*/
|
6665 |
+
$this->_storage->was_plugin_loaded = true;
|
6666 |
+
}
|
6667 |
+
|
6668 |
+
/**
|
6669 |
+
* Delete account.
|
6670 |
+
*
|
6671 |
+
* @author Vova Feldman (@svovaf)
|
6672 |
+
* @since 1.0.3
|
6673 |
+
*
|
6674 |
+
* @param bool $check_user Enforce checking if user have plugins activation privileges.
|
6675 |
+
*/
|
6676 |
+
function delete_account_event( $check_user = true ) {
|
6677 |
+
$this->_logger->entrance( 'slug = ' . $this->_slug );
|
6678 |
+
|
6679 |
+
if ( $check_user && ! $this->is_user_admin() ) {
|
6680 |
+
return;
|
6681 |
+
}
|
6682 |
+
|
6683 |
+
$this->do_action( 'before_account_delete' );
|
6684 |
+
|
6685 |
+
// Clear all admin notices.
|
6686 |
+
$this->_admin_notices->clear_all_sticky( false );
|
6687 |
+
|
6688 |
+
$this->_delete_site( false );
|
6689 |
+
|
6690 |
+
$delete_network_common_data = true;
|
6691 |
+
|
6692 |
+
if ( $this->_is_network_active ) {
|
6693 |
+
$installs = $this->get_blog_install_map();
|
6694 |
+
|
6695 |
+
// Don't delete common network data unless no other installs left.
|
6696 |
+
$delete_network_common_data = empty( $installs );
|
6697 |
+
}
|
6698 |
+
|
6699 |
+
if ( $delete_network_common_data ) {
|
6700 |
+
$this->_delete_plans( false );
|
6701 |
+
|
6702 |
+
$this->_delete_licenses( false );
|
6703 |
+
|
6704 |
+
// Delete add-ons related to plugin's account.
|
6705 |
+
$this->_delete_account_addons( false );
|
6706 |
+
}
|
6707 |
+
|
6708 |
+
// @todo Delete plans and licenses of add-ons.
|
6709 |
+
|
6710 |
+
self::$_accounts->store();
|
6711 |
+
|
6712 |
+
/**
|
6713 |
+
* IMPORTANT:
|
6714 |
+
* Clear crons must be executed before clearing all storage.
|
6715 |
+
* Otherwise, the cron will not be cleared.
|
6716 |
+
*/
|
6717 |
+
if ( $delete_network_common_data ) {
|
6718 |
+
$this->clear_sync_cron();
|
6719 |
+
}
|
6720 |
+
|
6721 |
+
$this->clear_install_sync_cron();
|
6722 |
+
|
6723 |
+
// Clear all storage data.
|
6724 |
+
$this->_storage->clear_all( true, array(
|
6725 |
+
'connectivity_test',
|
6726 |
+
'is_on',
|
6727 |
+
), false );
|
6728 |
+
|
6729 |
+
// Send delete event.
|
6730 |
+
$this->get_api_site_scope()->call( '/', 'delete' );
|
6731 |
+
|
6732 |
+
$this->do_action( 'after_account_delete' );
|
6733 |
+
}
|
6734 |
+
|
6735 |
+
/**
|
6736 |
+
* Delete network level account.
|
6737 |
+
*
|
6738 |
+
* @author Vova Feldman (@svovaf)
|
6739 |
+
* @since 2.0.0
|
6740 |
+
*
|
6741 |
+
* @param bool $check_user Enforce checking if user have plugins activation privileges.
|
6742 |
+
*/
|
6743 |
+
function delete_network_account_event( $check_user = true ) {
|
6744 |
+
$this->_logger->entrance( 'slug = ' . $this->_slug );
|
6745 |
+
|
6746 |
+
if ( $check_user && ! $this->is_user_admin() ) {
|
6747 |
+
return;
|
6748 |
+
}
|
6749 |
+
|
6750 |
+
$this->do_action( 'before_network_account_delete' );
|
6751 |
+
|
6752 |
+
// Clear all admin notices.
|
6753 |
+
$this->_admin_notices->clear_all_sticky();
|
6754 |
+
|
6755 |
+
$this->_delete_plans( false, false );
|
6756 |
+
|
6757 |
+
$this->_delete_licenses( false );
|
6758 |
+
|
6759 |
+
// Delete add-ons related to plugin's account.
|
6760 |
+
$this->_delete_account_addons( false );
|
6761 |
+
|
6762 |
+
// @todo Delete plans and licenses of add-ons.
|
6763 |
+
|
6764 |
+
self::$_accounts->store( true );
|
6765 |
+
|
6766 |
+
/**
|
6767 |
+
* IMPORTANT:
|
6768 |
+
* Clear crons must be executed before clearing all storage.
|
6769 |
+
* Otherwise, the cron will not be cleared.
|
6770 |
+
*/
|
6771 |
+
$this->clear_sync_cron( true );
|
6772 |
+
$this->clear_install_sync_cron( true );
|
6773 |
+
|
6774 |
+
$sites = self::get_sites();
|
6775 |
+
|
6776 |
+
$install_ids = array();
|
6777 |
+
foreach ( $sites as $site ) {
|
6778 |
+
$blog_id = self::get_site_blog_id( $site );
|
6779 |
+
|
6780 |
+
$install_id = $this->_delete_site( true, $blog_id );
|
6781 |
+
|
6782 |
+
// Clear all storage data.
|
6783 |
+
$this->_storage->clear_all( true, array( 'connectivity_test' ), $blog_id );
|
6784 |
+
|
6785 |
+
if ( FS_Site::is_valid_id( $install_id ) ) {
|
6786 |
+
$install_ids[] = $install_id;
|
6787 |
+
}
|
6788 |
+
|
6789 |
+
switch_to_blog( $blog_id );
|
6790 |
+
|
6791 |
+
$this->do_action( 'after_account_delete' );
|
6792 |
+
|
6793 |
+
restore_current_blog();
|
6794 |
+
}
|
6795 |
+
|
6796 |
+
$this->_storage->clear_all( true, array(
|
6797 |
+
'connectivity_test',
|
6798 |
+
'is_on',
|
6799 |
+
), true );
|
6800 |
+
|
6801 |
+
// Send delete event.
|
6802 |
+
if ( ! empty( $install_ids ) ) {
|
6803 |
+
$result = $this->get_current_or_network_user_api_scope()->call( "/plugins/{$this->_module_id}/installs.json?ids=" . implode( ',', $install_ids ), 'delete' );
|
6804 |
+
}
|
6805 |
+
|
6806 |
+
$this->do_action( 'after_network_account_delete' );
|
6807 |
+
}
|
6808 |
+
|
6809 |
+
/**
|
6810 |
+
* Plugin deactivation hook.
|
6811 |
+
*
|
6812 |
+
* @author Vova Feldman (@svovaf)
|
6813 |
+
* @since 1.0.1
|
6814 |
+
*/
|
6815 |
+
function _deactivate_plugin_hook() {
|
6816 |
+
$this->_logger->entrance( 'slug = ' . $this->_slug );
|
6817 |
+
|
6818 |
+
if ( ! $this->is_user_admin() ) {
|
6819 |
+
return;
|
6820 |
+
}
|
6821 |
+
|
6822 |
+
$is_network_deactivation = fs_is_network_admin();
|
6823 |
+
$storage_keys_for_removal = array();
|
6824 |
+
|
6825 |
+
$this->_admin_notices->clear_all_sticky();
|
6826 |
+
|
6827 |
+
$storage_keys_for_removal[] = 'sticky_optin_added';
|
6828 |
+
if ( isset( $this->_storage->sticky_optin_added ) ) {
|
6829 |
+
unset( $this->_storage->sticky_optin_added );
|
6830 |
+
}
|
6831 |
+
|
6832 |
+
if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
|
6833 |
+
// Remember that plugin was already installed.
|
6834 |
+
$this->_storage->is_plugin_new_install = false;
|
6835 |
+
}
|
6836 |
+
|
6837 |
+
// Hook to plugin uninstall.
|
6838 |
+
register_uninstall_hook( $this->_plugin_main_file_path, array( 'Freemius', '_uninstall_plugin_hook' ) );
|
6839 |
+
|
6840 |
+
$this->clear_module_main_file_cache();
|
6841 |
+
$this->clear_sync_cron( $this->_is_network_active );
|
6842 |
+
$this->clear_install_sync_cron();
|
6843 |
+
|
6844 |
+
if ( $this->is_registered() ) {
|
6845 |
+
if ( $is_network_deactivation ) {
|
6846 |
+
// Send deactivation event.
|
6847 |
+
$this->sync_installs( array(
|
6848 |
+
'is_active' => false,
|
6849 |
+
) );
|
6850 |
+
} else {
|
6851 |
+
// Send deactivation event.
|
6852 |
+
$this->sync_install( array(
|
6853 |
+
'is_active' => false,
|
6854 |
+
) );
|
6855 |
+
}
|
6856 |
+
} else {
|
6857 |
+
if ( ! $this->has_api_connectivity() ) {
|
6858 |
+
// Reset connectivity test cache.
|
6859 |
+
unset( $this->_storage->connectivity_test );
|
6860 |
+
|
6861 |
+
$storage_keys_for_removal[] = 'connectivity_test';
|
6862 |
+
}
|
6863 |
+
}
|
6864 |
+
|
6865 |
+
if ( $is_network_deactivation ) {
|
6866 |
+
if ( isset( $this->_storage->sticky_optin_added_ms ) ) {
|
6867 |
+
unset( $this->_storage->sticky_optin_added_ms );
|
6868 |
+
}
|
6869 |
+
|
6870 |
+
if ( ! empty( $storage_keys_for_removal ) ) {
|
6871 |
+
$sites = self::get_sites();
|
6872 |
+
|
6873 |
+
foreach ( $sites as $site ) {
|
6874 |
+
$blog_id = self::get_site_blog_id( $site );
|
6875 |
+
|
6876 |
+
foreach ( $storage_keys_for_removal as $key ) {
|
6877 |
+
$this->_storage->remove( $key, false, $blog_id );
|
6878 |
+
}
|
6879 |
+
|
6880 |
+
$this->_storage->save( $blog_id );
|
6881 |
+
}
|
6882 |
+
}
|
6883 |
+
}
|
6884 |
+
|
6885 |
+
// Clear API cache on deactivation.
|
6886 |
+
FS_Api::clear_cache();
|
6887 |
+
|
6888 |
+
$this->remove_sdk_reference();
|
6889 |
+
}
|
6890 |
+
|
6891 |
+
/**
|
6892 |
+
* @author Vova Feldman (@svovaf)
|
6893 |
+
* @since 1.1.6
|
6894 |
+
*/
|
6895 |
+
private function remove_sdk_reference() {
|
6896 |
+
global $fs_active_plugins;
|
6897 |
+
|
6898 |
+
foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
|
6899 |
+
if ( $this->_plugin_basename == $data->plugin_path ) {
|
6900 |
+
unset( $fs_active_plugins->plugins[ $sdk_path ] );
|
6901 |
+
break;
|
6902 |
+
}
|
6903 |
+
}
|
6904 |
+
|
6905 |
+
fs_fallback_to_newest_active_sdk();
|
6906 |
+
}
|
6907 |
+
|
6908 |
+
/**
|
6909 |
+
* @author Vova Feldman (@svovaf)
|
6910 |
+
* @since 1.1.3
|
6911 |
+
*
|
6912 |
+
* @param bool $is_anonymous
|
6913 |
+
* @param bool|int $network_or_blog_id Since 2.0.0
|
6914 |
+
*/
|
6915 |
+
private function set_anonymous_mode( $is_anonymous = true, $network_or_blog_id = 0 ) {
|
6916 |
+
// Store information regarding skip to try and opt-in the user
|
6917 |
+
// again in the future.
|
6918 |
+
$skip_info = array(
|
6919 |
+
'is' => $is_anonymous,
|
6920 |
+
'timestamp' => WP_FS__SCRIPT_START_TIME,
|
6921 |
+
'version' => $this->get_plugin_version(),
|
6922 |
+
);
|
6923 |
+
|
6924 |
+
if ( true === $network_or_blog_id ) {
|
6925 |
+
$this->_storage->is_anonymous_ms = $skip_info;
|
6926 |
+
} else {
|
6927 |
+
$this->_storage->store( 'is_anonymous', $skip_info, $network_or_blog_id );
|
6928 |
+
}
|
6929 |
+
|
6930 |
+
$this->network_upgrade_mode_completed();
|
6931 |
+
|
6932 |
+
// Update anonymous mode cache.
|
6933 |
+
$this->_is_anonymous = $is_anonymous;
|
6934 |
+
}
|
6935 |
+
|
6936 |
+
/**
|
6937 |
+
* @author Vova Feldman (@svovaf)
|
6938 |
+
* @since 2.0.0
|
6939 |
+
*
|
6940 |
+
* @param int $blog_id Site ID.
|
6941 |
+
* @param int $user_id User ID.
|
6942 |
+
* @param string $domain Site domain.
|
6943 |
+
* @param string $path Site path.
|
6944 |
+
* @param int $network_id Network ID. Only relevant on multi-network installations.
|
6945 |
+
* @param array $meta Metadata. Used to set initial site options.
|
6946 |
+
*
|
6947 |
+
* @uses Freemius::is_license_network_active() to check if the context license was network activated by the super-admin.
|
6948 |
+
* @uses Freemius::is_network_connected() to check if the super-admin network opted-in.
|
6949 |
+
* @uses Freemius::is_network_anonymous() to check if the super-admin network skipped.
|
6950 |
+
* @uses Freemius::is_network_delegated_connection() to check if the super-admin network delegated the connection to the site admins.
|
6951 |
+
*/
|
6952 |
+
function _after_new_blog_callback( $blog_id, $user_id, $domain, $path, $network_id, $meta ) {
|
6953 |
+
$this->_logger->entrance();
|
6954 |
+
|
6955 |
+
if ( $this->is_premium() &&
|
6956 |
+
$this->is_network_connected() &&
|
6957 |
+
is_object( $this->_license ) &&
|
6958 |
+
$this->_license->can_activate( FS_Site::is_localhost_by_address( $domain ) ) &&
|
6959 |
+
$this->is_license_network_active( $blog_id )
|
6960 |
+
) {
|
6961 |
+
/**
|
6962 |
+
* Running the premium version, the license was network activated, and the license can also be activated on the current site -> so try to opt-in with the license key.
|
6963 |
+
*/
|
6964 |
+
$current_blog_id = get_current_blog_id();
|
6965 |
+
$license = clone $this->_license;
|
6966 |
+
|
6967 |
+
$this->switch_to_blog( $blog_id );
|
6968 |
+
|
6969 |
+
// Opt-in with network user.
|
6970 |
+
$this->install_with_user(
|
6971 |
+
$this->get_network_user(),
|
6972 |
+
$license->secret_key,
|
6973 |
+
false,
|
6974 |
+
false,
|
6975 |
+
false
|
6976 |
+
);
|
6977 |
+
|
6978 |
+
if ( is_object( $this->_site ) ) {
|
6979 |
+
if ( $this->_site->license_id == $license->id ) {
|
6980 |
+
/**
|
6981 |
+
* If the license was activated successfully, sync the license data from the remote server.
|
6982 |
+
*/
|
6983 |
+
$this->_license = $license;
|
6984 |
+
$this->sync_site_license();
|
6985 |
+
}
|
6986 |
+
}
|
6987 |
+
|
6988 |
+
$this->switch_to_blog( $current_blog_id );
|
6989 |
+
|
6990 |
+
if ( is_object( $this->_site ) ) {
|
6991 |
+
// Already connected (with or without a license), so no need to continue.
|
6992 |
+
return;
|
6993 |
+
}
|
6994 |
+
}
|
6995 |
+
|
6996 |
+
if ( $this->is_network_anonymous() ) {
|
6997 |
+
/**
|
6998 |
+
* Opt-in was network skipped so automatically skip the opt-in for the new site.
|
6999 |
+
*/
|
7000 |
+
$this->skip_site_connection( $blog_id );
|
7001 |
+
} else if ( $this->is_network_delegated_connection() ) {
|
7002 |
+
/**
|
7003 |
+
* Opt-in was network delegated so automatically delegate the opt-in for the new site's admin.
|
7004 |
+
*/
|
7005 |
+
$this->delegate_site_connection( $blog_id );
|
7006 |
+
} else if ( $this->is_network_connected() ) {
|
7007 |
+
/**
|
7008 |
+
* Opt-in was network activated so automatically opt-in with the network user and new site admin.
|
7009 |
+
*/
|
7010 |
+
$current_blog_id = get_current_blog_id();
|
7011 |
+
|
7012 |
+
$this->switch_to_blog( $blog_id );
|
7013 |
+
|
7014 |
+
// Opt-in with network user.
|
7015 |
+
$this->install_with_user(
|
7016 |
+
$this->get_network_user(),
|
7017 |
+
false,
|
7018 |
+
false,
|
7019 |
+
false,
|
7020 |
+
false
|
7021 |
+
);
|
7022 |
+
|
7023 |
+
$this->switch_to_blog( $current_blog_id );
|
7024 |
+
} else {
|
7025 |
+
/**
|
7026 |
+
* If the super-admin mixed different options (connect, skip, delegated):
|
7027 |
+
* a) If at least one site connection was delegated, then automatically delegate connection.
|
7028 |
+
* b) Otherwise, it means that at least one site was skipped and at least one site was connected. For a simplified UX in the initial release of the multisite network integration, skip the connection for the newly created site. If the super-admin will want to opt-in they can still do that from the network level Account page.
|
7029 |
+
*/
|
7030 |
+
$has_delegated_site = false;
|
7031 |
+
|
7032 |
+
$sites = self::get_sites();
|
7033 |
+
foreach ( $sites as $site ) {
|
7034 |
+
$blog_id = self::get_site_blog_id( $site );
|
7035 |
+
|
7036 |
+
if ( $this->is_site_delegated_connection( $blog_id ) ) {
|
7037 |
+
$has_delegated_site = true;
|
7038 |
+
break;
|
7039 |
+
}
|
7040 |
+
}
|
7041 |
+
|
7042 |
+
if ( $has_delegated_site ) {
|
7043 |
+
$this->delegate_site_connection( $blog_id );
|
7044 |
+
} else {
|
7045 |
+
$this->skip_site_connection( $blog_id );
|
7046 |
+
}
|
7047 |
+
}
|
7048 |
+
}
|
7049 |
+
|
7050 |
+
/**
|
7051 |
+
* @author Vova Feldman (@svovaf)
|
7052 |
+
* @since 1.1.3
|
7053 |
+
*
|
7054 |
+
* @param bool|int $network_or_blog_id Since 2.0.0.
|
7055 |
+
*/
|
7056 |
+
private function reset_anonymous_mode( $network_or_blog_id = 0 ) {
|
7057 |
+
if ( true === $network_or_blog_id ) {
|
7058 |
+
unset( $this->_storage->is_anonymous_ms );
|
7059 |
+
} else {
|
7060 |
+
$this->_storage->remove( 'is_anonymous', true, $network_or_blog_id );
|
7061 |
+
}
|
7062 |
+
|
7063 |
+
/**
|
7064 |
+
* Ensure that this field is also "false", otherwise, if the current module's type is "theme" and the module
|
7065 |
+
* has no menus, the opt-in popup will not be shown immediately (in this case, the user will have to click
|
7066 |
+
* on the admin notice that contains the opt-in link in order to trigger the opt-in popup).
|
7067 |
+
*
|
7068 |
+
* @author Leo Fajardo (@leorw)
|
7069 |
+
* @since 1.2.2
|
7070 |
+
*/
|
7071 |
+
if ( ! $this->_is_network_active ||
|
7072 |
+
0 === $network_or_blog_id ||
|
7073 |
+
get_current_blog_id() == $network_or_blog_id ||
|
7074 |
+
( true === $network_or_blog_id && fs_is_network_admin() )
|
7075 |
+
) {
|
7076 |
+
unset( $this->_is_anonymous );
|
7077 |
+
}
|
7078 |
+
}
|
7079 |
+
|
7080 |
+
/**
|
7081 |
+
* Clears the anonymous mode and redirects to the opt-in screen.
|
7082 |
+
*
|
7083 |
+
* @author Vova Feldman (@svovaf)
|
7084 |
+
* @since 1.1.7
|
7085 |
+
*/
|
7086 |
+
function connect_again() {
|
7087 |
+
if ( ! $this->is_anonymous() ) {
|
7088 |
+
return;
|
7089 |
+
}
|
7090 |
+
|
7091 |
+
$this->reset_anonymous_mode( fs_is_network_admin() );
|
7092 |
+
|
7093 |
+
fs_redirect( $this->get_activation_url() );
|
7094 |
+
}
|
7095 |
+
|
7096 |
+
/**
|
7097 |
+
* Skip account connect, and set anonymous mode.
|
7098 |
+
*
|
7099 |
+
* @author Vova Feldman (@svovaf)
|
7100 |
+
* @since 1.1.1
|
7101 |
+
*
|
7102 |
+
* @param array|null $sites Since 2.0.0. Specific sites.
|
7103 |
+
* @param bool $skip_all_network Since 2.0.0. If true, skip connection for all sites.
|
7104 |
+
*/
|
7105 |
+
private function skip_connection( $sites = null, $skip_all_network = false ) {
|
7106 |
+
$this->_logger->entrance();
|
7107 |
+
|
7108 |
+
$this->_admin_notices->remove_sticky( 'connect_account' );
|
7109 |
+
|
7110 |
+
if ( $skip_all_network ) {
|
7111 |
+
$this->set_anonymous_mode( true, true );
|
7112 |
+
}
|
7113 |
+
|
7114 |
+
if ( ! $skip_all_network && empty( $sites ) ) {
|
7115 |
+
$this->skip_site_connection();
|
7116 |
+
} else {
|
7117 |
+
$uids = array();
|
7118 |
+
|
7119 |
+
if ( $skip_all_network ) {
|
7120 |
+
$this->set_anonymous_mode( true, true );
|
7121 |
+
|
7122 |
+
$sites = self::get_sites();
|
7123 |
+
foreach ( $sites as $site ) {
|
7124 |
+
$blog_id = self::get_site_blog_id( $site );
|
7125 |
+
$this->skip_site_connection( $blog_id, false );
|
7126 |
+
$uids[] = $this->get_anonymous_id( $blog_id );
|
7127 |
+
}
|
7128 |
+
} else if ( ! empty( $sites ) ) {
|
7129 |
+
foreach ( $sites as $site ) {
|
7130 |
+
$uids[] = $site['uid'];
|
7131 |
+
$this->skip_site_connection( $site['blog_id'], false );
|
7132 |
+
}
|
7133 |
+
}
|
7134 |
+
|
7135 |
+
// Send anonymous skip event.
|
7136 |
+
// No user identified info nor any tracking will be sent after the user skips the opt-in.
|
7137 |
+
$this->get_api_plugin_scope()->call( 'skip.json', 'put', array(
|
7138 |
+
'uids' => $uids,
|
7139 |
+
) );
|
7140 |
+
}
|
7141 |
+
|
7142 |
+
$this->network_upgrade_mode_completed();
|
7143 |
+
}
|
7144 |
+
|
7145 |
+
/**
|
7146 |
+
* Skip connection for specific site in the network.
|
7147 |
+
*
|
7148 |
+
* @author Vova Feldman (@svovaf)
|
7149 |
+
* @since 2.0.0
|
7150 |
+
*
|
7151 |
+
* @param int|null $blog_id
|
7152 |
+
* @param bool $send_skip
|
7153 |
+
*/
|
7154 |
+
private function skip_site_connection( $blog_id = null, $send_skip = true ) {
|
7155 |
+
$this->_logger->entrance();
|
7156 |
+
|
7157 |
+
$this->_admin_notices->remove_sticky( 'connect_account', $blog_id );
|
7158 |
+
|
7159 |
+
$this->set_anonymous_mode( true, $blog_id );
|
7160 |
+
|
7161 |
+
if ( $send_skip ) {
|
7162 |
+
$this->get_api_plugin_scope()->call( 'skip.json', 'put', array(
|
7163 |
+
'uids' => array( $this->get_anonymous_id( $blog_id ) ),
|
7164 |
+
) );
|
7165 |
+
}
|
7166 |
+
}
|
7167 |
+
|
7168 |
+
/**
|
7169 |
+
* Plugin version update hook.
|
7170 |
+
*
|
7171 |
+
* @author Vova Feldman (@svovaf)
|
7172 |
+
* @since 1.0.4
|
7173 |
+
*/
|
7174 |
+
private function update_plugin_version_event() {
|
7175 |
+
$this->_logger->entrance();
|
7176 |
+
|
7177 |
+
if ( ! $this->is_registered() ) {
|
7178 |
+
return;
|
7179 |
+
}
|
7180 |
+
|
7181 |
+
$this->schedule_install_sync();
|
7182 |
+
// $this->sync_install( array(), true );
|
7183 |
+
}
|
7184 |
+
|
7185 |
+
/**
|
7186 |
+
* Generate an MD5 signature of a plugins collection.
|
7187 |
+
* This helper methods used to identify changes in a plugins collection.
|
7188 |
+
*
|
7189 |
+
* @author Vova Feldman (@svovaf)
|
7190 |
+
* @since 2.0.0
|
7191 |
+
*
|
7192 |
+
* @param array [string]array $plugins
|
7193 |
+
*
|
7194 |
+
* @return string
|
7195 |
+
*/
|
7196 |
+
private function get_plugins_thumbprint( $plugins ) {
|
7197 |
+
ksort( $plugins );
|
7198 |
+
|
7199 |
+
$thumbprint = '';
|
7200 |
+
foreach ( $plugins as $basename => $data ) {
|
7201 |
+
$thumbprint .= $data['slug'] . ',' .
|
7202 |
+
$data['Version'] . ',' .
|
7203 |
+
( $data['is_active'] ? '1' : '0' ) . ';';
|
7204 |
+
}
|
7205 |
+
|
7206 |
+
return md5( $thumbprint );
|
7207 |
+
}
|
7208 |
+
|
7209 |
+
/**
|
7210 |
+
* Return a list of modified plugins since the last sync.
|
7211 |
+
*
|
7212 |
+
* Note:
|
7213 |
+
* There's no point to store a plugins counter since even if the number of
|
7214 |
+
* plugins didn't change, we still need to check if the versions are all the
|
7215 |
+
* same and the activity state is similar.
|
7216 |
+
*
|
7217 |
+
* @author Vova Feldman (@svovaf)
|
7218 |
+
* @since 1.1.8
|
7219 |
+
*
|
7220 |
+
* @return array|false
|
7221 |
+
*/
|
7222 |
+
private function get_plugins_data_for_api() {
|
7223 |
+
// Alias.
|
7224 |
+
$site_active_plugins_option_name = 'active_plugins';
|
7225 |
+
$network_plugins_option_name = 'all_plugins';
|
7226 |
+
|
7227 |
+
/**
|
7228 |
+
* Collection of all site level active plugins.
|
7229 |
+
*/
|
7230 |
+
$site_active_plugins_cache = self::$_accounts->get_option( $site_active_plugins_option_name );
|
7231 |
+
|
7232 |
+
if ( ! is_object( $site_active_plugins_cache ) ) {
|
7233 |
+
$site_active_plugins_cache = (object) array(
|
7234 |
+
'timestamp' => '',
|
7235 |
+
'md5' => '',
|
7236 |
+
'plugins' => array(),
|
7237 |
+
);
|
7238 |
+
}
|
7239 |
+
|
7240 |
+
$time = time();
|
7241 |
+
|
7242 |
+
if ( ! empty( $site_active_plugins_cache->timestamp ) &&
|
7243 |
+
( $time - $site_active_plugins_cache->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
|
7244 |
+
) {
|
7245 |
+
// Don't send plugin updates if last update was in the past 5 min.
|
7246 |
+
return false;
|
7247 |
+
}
|
7248 |
+
|
7249 |
+
// Write timestamp to lock the logic.
|
7250 |
+
$site_active_plugins_cache->timestamp = $time;
|
7251 |
+
self::$_accounts->set_option( $site_active_plugins_option_name, $site_active_plugins_cache, true );
|
7252 |
+
|
7253 |
+
// Reload options from DB.
|
7254 |
+
self::$_accounts->load( true );
|
7255 |
+
$site_active_plugins_cache = self::$_accounts->get_option( $site_active_plugins_option_name );
|
7256 |
+
|
7257 |
+
if ( $time != $site_active_plugins_cache->timestamp ) {
|
7258 |
+
// If timestamp is different, then another thread captured the lock.
|
7259 |
+
return false;
|
7260 |
+
}
|
7261 |
+
|
7262 |
+
/**
|
7263 |
+
* Collection of all plugins (network level).
|
7264 |
+
*/
|
7265 |
+
$network_plugins_cache = self::$_accounts->get_option( $network_plugins_option_name );
|
7266 |
+
|
7267 |
+
if ( ! is_object( $network_plugins_cache ) ) {
|
7268 |
+
$network_plugins_cache = (object) array(
|
7269 |
+
'timestamp' => '',
|
7270 |
+
'md5' => '',
|
7271 |
+
'plugins' => array(),
|
7272 |
+
);
|
7273 |
+
}
|
7274 |
+
|
7275 |
+
// Check if there's a change in plugins.
|
7276 |
+
$network_plugins = self::get_network_plugins();
|
7277 |
+
$site_active_plugins = self::get_site_active_plugins();
|
7278 |
+
|
7279 |
+
$network_plugins_thumbprint = $this->get_plugins_thumbprint( $network_plugins );
|
7280 |
+
$site_active_plugins_thumbprint = $this->get_plugins_thumbprint( $site_active_plugins );
|
7281 |
+
|
7282 |
+
// Check if plugins status changed (version or active/inactive).
|
7283 |
+
$network_plugins_changed = ( $network_plugins_cache->md5 !== $network_plugins_thumbprint );
|
7284 |
+
$site_active_plugins_changed = ( $site_active_plugins_cache->md5 !== $site_active_plugins_thumbprint );
|
7285 |
+
|
7286 |
+
if ( ! $network_plugins_changed &&
|
7287 |
+
! $site_active_plugins_changed
|
7288 |
+
) {
|
7289 |
+
// No changes.
|
7290 |
+
return array();
|
7291 |
+
}
|
7292 |
+
|
7293 |
+
$plugins_update_data = array();
|
7294 |
+
|
7295 |
+
foreach ( $network_plugins_cache->plugins as $basename => $data ) {
|
7296 |
+
if ( ! isset( $network_plugins[ $basename ] ) ) {
|
7297 |
+
// Plugin uninstalled.
|
7298 |
+
$uninstalled_plugin_data = $data;
|
7299 |
+
$uninstalled_plugin_data['is_active'] = false;
|
7300 |
+
$uninstalled_plugin_data['is_uninstalled'] = true;
|
7301 |
+
$plugins_update_data[] = $uninstalled_plugin_data;
|
7302 |
+
|
7303 |
+
unset( $network_plugins[ $basename ] );
|
7304 |
+
|
7305 |
+
unset( $network_plugins_cache->plugins[ $basename ] );
|
7306 |
+
unset( $site_active_plugins_cache->plugins[ $basename ] );
|
7307 |
+
|
7308 |
+
continue;
|
7309 |
+
}
|
7310 |
+
|
7311 |
+
$was_active = $data['is_active'] ||
|
7312 |
+
( isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
|
7313 |
+
true === $site_active_plugins_cache->plugins[ $basename ]['is_active'] );
|
7314 |
+
$is_active = $network_plugins[ $basename ]['is_active'] ||
|
7315 |
+
( isset( $site_active_plugins[ $basename ] ) &&
|
7316 |
+
$site_active_plugins[ $basename ]['is_active'] );
|
7317 |
+
|
7318 |
+
if ( ! isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
|
7319 |
+
isset( $site_active_plugins[ $basename ] )
|
7320 |
+
) {
|
7321 |
+
// Plugin was site level activated.
|
7322 |
+
$site_active_plugins_cache->plugins[ $basename ] = $network_plugins[ $basename ];
|
7323 |
+
$site_active_plugins_cache->plugins[ $basename ]['is_active'] = true;
|
7324 |
+
} else if ( isset( $site_active_plugins_cache->plugins[ $basename ] ) &&
|
7325 |
+
! isset( $site_active_plugins[ $basename ] )
|
7326 |
+
) {
|
7327 |
+
// Plugin was site level deactivated.
|
7328 |
+
unset( $site_active_plugins_cache->plugins[ $basename ] );
|
7329 |
+
}
|
7330 |
+
|
7331 |
+
$prev_version = $data['version'];
|
7332 |
+
$current_version = $network_plugins[ $basename ]['Version'];
|
7333 |
+
|
7334 |
+
if ( $was_active !== $is_active || $prev_version !== $current_version ) {
|
7335 |
+
// Plugin activated or deactivated, or version changed.
|
7336 |
+
|
7337 |
+
if ( $was_active !== $is_active ) {
|
7338 |
+
if ( $data['is_active'] != $network_plugins[ $basename ]['is_active'] ) {
|
7339 |
+
$network_plugins_cache->plugins[ $basename ]['is_active'] = $data['is_active'];
|
7340 |
+
}
|
7341 |
+
}
|
7342 |
+
|
7343 |
+
if ( $prev_version !== $current_version ) {
|
7344 |
+
$network_plugins_cache->plugins[ $basename ]['Version'] = $current_version;
|
7345 |
+
}
|
7346 |
+
|
7347 |
+
$updated_plugin_data = $data;
|
7348 |
+
$updated_plugin_data['is_active'] = $is_active;
|
7349 |
+
$updated_plugin_data['version'] = $current_version;
|
7350 |
+
$updated_plugin_data['title'] = $network_plugins[ $basename ]['Name'];
|
7351 |
+
$plugins_update_data[] = $updated_plugin_data;
|
7352 |
+
}
|
7353 |
+
}
|
7354 |
+
|
7355 |
+
// Find new plugins that weren't yet seen before.
|
7356 |
+
foreach ( $network_plugins as $basename => $data ) {
|
7357 |
+
if ( ! isset( $network_plugins_cache->plugins[ $basename ] ) ) {
|
7358 |
+
// New plugin.
|
7359 |
+
$new_plugin = array(
|
7360 |
+
'slug' => $data['slug'],
|
7361 |
+
'version' => $data['Version'],
|
7362 |
+
'title' => $data['Name'],
|
7363 |
+
'is_active' => $data['is_active'],
|
7364 |
+
'is_uninstalled' => false,
|
7365 |
+
);
|
7366 |
+
|
7367 |
+
$plugins_update_data[] = $new_plugin;
|
7368 |
+
$network_plugins_cache->plugins[ $basename ] = $new_plugin;
|
7369 |
+
|
7370 |
+
if ( isset( $site_active_plugins[ $basename ] ) ) {
|
7371 |
+
$site_active_plugins_cache->plugins[ $basename ] = $new_plugin;
|
7372 |
+
$site_active_plugins_cache->plugins[ $basename ]['is_active'] = true;
|
7373 |
+
}
|
7374 |
+
}
|
7375 |
+
}
|
7376 |
+
|
7377 |
+
$site_active_plugins_cache->md5 = $site_active_plugins_thumbprint;
|
7378 |
+
$site_active_plugins_cache->timestamp = $time;
|
7379 |
+
self::$_accounts->set_option( $site_active_plugins_option_name, $site_active_plugins_cache, true );
|
7380 |
+
|
7381 |
+
$network_plugins_cache->md5 = $network_plugins_thumbprint;
|
7382 |
+
$network_plugins_cache->timestamp = $time;
|
7383 |
+
self::$_accounts->set_option( $network_plugins_option_name, $network_plugins_cache, true );
|
7384 |
+
|
7385 |
+
return $plugins_update_data;
|
7386 |
+
}
|
7387 |
+
|
7388 |
+
/**
|
7389 |
+
* Return a list of modified themes since the last sync.
|
7390 |
+
*
|
7391 |
+
* Note:
|
7392 |
+
* There's no point to store a themes counter since even if the number of
|
7393 |
+
* themes didn't change, we still need to check if the versions are all the
|
7394 |
+
* same and the activity state is similar.
|
7395 |
+
*
|
7396 |
+
* @author Vova Feldman (@svovaf)
|
7397 |
+
* @since 1.1.8
|
7398 |
+
*
|
7399 |
+
* @return array|false
|
7400 |
+
*/
|
7401 |
+
private function get_themes_data_for_api() {
|
7402 |
+
// Alias.
|
7403 |
+
$option_name = 'all_themes';
|
7404 |
+
|
7405 |
+
$all_cached_themes = self::$_accounts->get_option( $option_name );
|
7406 |
+
|
7407 |
+
if ( ! is_object( $all_cached_themes ) ) {
|
7408 |
+
$all_cached_themes = (object) array(
|
7409 |
+
'timestamp' => '',
|
7410 |
+
'md5' => '',
|
7411 |
+
'themes' => array(),
|
7412 |
+
);
|
7413 |
+
}
|
7414 |
+
|
7415 |
+
$time = time();
|
7416 |
+
|
7417 |
+
if ( ! empty( $all_cached_themes->timestamp ) &&
|
7418 |
+
( $time - $all_cached_themes->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
|
7419 |
+
) {
|
7420 |
+
// Don't send theme updates if last update was in the past 5 min.
|
7421 |
+
return false;
|
7422 |
+
}
|
7423 |
+
|
7424 |
+
// Write timestamp to lock the logic.
|
7425 |
+
$all_cached_themes->timestamp = $time;
|
7426 |
+
self::$_accounts->set_option( $option_name, $all_cached_themes, true );
|
7427 |
+
|
7428 |
+
// Reload options from DB.
|
7429 |
+
self::$_accounts->load( true );
|
7430 |
+
$all_cached_themes = self::$_accounts->get_option( $option_name );
|
7431 |
+
|
7432 |
+
if ( $time != $all_cached_themes->timestamp ) {
|
7433 |
+
// If timestamp is different, then another thread captured the lock.
|
7434 |
+
return false;
|
7435 |
+
}
|
7436 |
+
|
7437 |
+
// Get active theme.
|
7438 |
+
$active_theme = wp_get_theme();
|
7439 |
+
$active_theme_stylesheet = $active_theme->get_stylesheet();
|
7440 |
+
|
7441 |
+
// Check if there's a change in themes.
|
7442 |
+
$all_themes = wp_get_themes();
|
7443 |
+
|
7444 |
+
// Check if themes changed.
|
7445 |
+
ksort( $all_themes );
|
7446 |
+
|
7447 |
+
$themes_signature = '';
|
7448 |
+
foreach ( $all_themes as $slug => $data ) {
|
7449 |
+
$is_active = ( $slug === $active_theme_stylesheet );
|
7450 |
+
$themes_signature .= $slug . ',' .
|
7451 |
+
$data->version . ',' .
|
7452 |
+
( $is_active ? '1' : '0' ) . ';';
|
7453 |
+
}
|
7454 |
+
|
7455 |
+
// Check if themes status changed (version or active/inactive).
|
7456 |
+
$themes_changed = ( $all_cached_themes->md5 !== md5( $themes_signature ) );
|
7457 |
+
|
7458 |
+
$themes_update_data = array();
|
7459 |
+
|
7460 |
+
if ( $themes_changed ) {
|
7461 |
+
// Change in themes, report changes.
|
7462 |
+
|
7463 |
+
// Update existing themes info.
|
7464 |
+
foreach ( $all_cached_themes->themes as $slug => $data ) {
|
7465 |
+
$is_active = ( $slug === $active_theme_stylesheet );
|
7466 |
+
|
7467 |
+
if ( ! isset( $all_themes[ $slug ] ) ) {
|
7468 |
+
// Plugin uninstalled.
|
7469 |
+
$uninstalled_theme_data = $data;
|
7470 |
+
$uninstalled_theme_data['is_active'] = false;
|
7471 |
+
$uninstalled_theme_data['is_uninstalled'] = true;
|
7472 |
+
$themes_update_data[] = $uninstalled_theme_data;
|
7473 |
+
|
7474 |
+
unset( $all_themes[ $slug ] );
|
7475 |
+
unset( $all_cached_themes->themes[ $slug ] );
|
7476 |
+
} else if ( $data['is_active'] !== $is_active ||
|
7477 |
+
$data['version'] !== $all_themes[ $slug ]->version
|
7478 |
+
) {
|
7479 |
+
// Plugin activated or deactivated, or version changed.
|
7480 |
+
|
7481 |
+
$all_cached_themes->themes[ $slug ]['is_active'] = $is_active;
|
7482 |
+
$all_cached_themes->themes[ $slug ]['version'] = $all_themes[ $slug ]->version;
|
7483 |
+
|
7484 |
+
$themes_update_data[] = $all_cached_themes->themes[ $slug ];
|
7485 |
+
}
|
7486 |
+
}
|
7487 |
+
|
7488 |
+
// Find new themes that weren't yet seen before.
|
7489 |
+
foreach ( $all_themes as $slug => $data ) {
|
7490 |
+
if ( ! isset( $all_cached_themes->themes[ $slug ] ) ) {
|
7491 |
+
$is_active = ( $slug === $active_theme_stylesheet );
|
7492 |
+
|
7493 |
+
// New plugin.
|
7494 |
+
$new_plugin = array(
|
7495 |
+
'slug' => $slug,
|
7496 |
+
'version' => $data->version,
|
7497 |
+
'title' => $data->name,
|
7498 |
+
'is_active' => $is_active,
|
7499 |
+
'is_uninstalled' => false,
|
7500 |
+
);
|
7501 |
+
|
7502 |
+
$themes_update_data[] = $new_plugin;
|
7503 |
+
$all_cached_themes->themes[ $slug ] = $new_plugin;
|
7504 |
+
}
|
7505 |
+
}
|
7506 |
+
|
7507 |
+
$all_cached_themes->md5 = md5( $themes_signature );
|
7508 |
+
$all_cached_themes->timestamp = time();
|
7509 |
+
self::$_accounts->set_option( $option_name, $all_cached_themes, true );
|
7510 |
+
}
|
7511 |
+
|
7512 |
+
return $themes_update_data;
|
7513 |
+
}
|
7514 |
+
|
7515 |
+
/**
|
7516 |
+
* Get site data for API install request.
|
7517 |
+
*
|
7518 |
+
* @author Vova Feldman (@svovaf)
|
7519 |
+
* @since 1.1.2
|
7520 |
+
*
|
7521 |
+
* @param string[] string $override
|
7522 |
+
* @param bool $include_plugins Since 1.1.8 by default include plugin changes.
|
7523 |
+
* @param bool $include_themes Since 1.1.8 by default include plugin changes.
|
7524 |
+
*
|
7525 |
+
* @return array
|
7526 |
+
*/
|
7527 |
+
private function get_install_data_for_api(
|
7528 |
+
array $override,
|
7529 |
+
$include_plugins = true,
|
7530 |
+
$include_themes = true
|
7531 |
+
) {
|
7532 |
+
/**
|
7533 |
+
* @since 1.1.8 Also send plugin updates.
|
7534 |
+
*/
|
7535 |
+
if ( $include_plugins && ! isset( $override['plugins'] ) ) {
|
7536 |
+
$plugins = $this->get_plugins_data_for_api();
|
7537 |
+
if ( ! empty( $plugins ) ) {
|
7538 |
+
$override['plugins'] = $plugins;
|
7539 |
+
}
|
7540 |
+
}
|
7541 |
+
/**
|
7542 |
+
* @since 1.1.8 Also send themes updates.
|
7543 |
+
*/
|
7544 |
+
if ( $include_themes && ! isset( $override['themes'] ) ) {
|
7545 |
+
$themes = $this->get_themes_data_for_api();
|
7546 |
+
if ( ! empty( $themes ) ) {
|
7547 |
+
$override['themes'] = $themes;
|
7548 |
+
}
|
7549 |
+
}
|
7550 |
+
|
7551 |
+
return array_merge( array(
|
7552 |
+
'version' => $this->get_plugin_version(),
|
7553 |
+
'is_premium' => $this->is_premium(),
|
7554 |
+
'language' => get_bloginfo( 'language' ),
|
7555 |
+
'charset' => get_bloginfo( 'charset' ),
|
7556 |
+
'platform_version' => get_bloginfo( 'version' ),
|
7557 |
+
'sdk_version' => $this->version,
|
7558 |
+
'programming_language_version' => phpversion(),
|
7559 |
+
'title' => get_bloginfo( 'name' ),
|
7560 |
+
'url' => get_site_url(),
|
7561 |
+
// Special params.
|
7562 |
+
'is_active' => true,
|
7563 |
+
'is_disconnected' => $this->is_tracking_prohibited(),
|
7564 |
+
'is_uninstalled' => false,
|
7565 |
+
), $override );
|
7566 |
+
}
|
7567 |
+
|
7568 |
+
/**
|
7569 |
+
* Update installs details.
|
7570 |
+
*
|
7571 |
+
* @todo V1 of multiste network support doesn't support plugin and theme data sending.
|
7572 |
+
*
|
7573 |
+
* @author Vova Feldman (@svovaf)
|
7574 |
+
* @since 2.0.0
|
7575 |
+
*
|
7576 |
+
* @param string[] string $override
|
7577 |
+
* @param bool $only_diff
|
7578 |
+
* @param bool $include_plugins Since 1.1.8 by default include plugin changes.
|
7579 |
+
* @param bool $include_themes Since 1.1.8 by default include plugin changes.
|
7580 |
+
*
|
7581 |
+
* @return array
|
7582 |
+
*/
|
7583 |
+
private function get_installs_data_for_api(
|
7584 |
+
array $override,
|
7585 |
+
$only_diff = false,
|
7586 |
+
$include_plugins = true,
|
7587 |
+
$include_themes = true
|
7588 |
+
) {
|
7589 |
+
/**
|
7590 |
+
* @since 1.1.8 Also send plugin updates.
|
7591 |
+
*/
|
7592 |
+
// if ( $include_plugins && ! isset( $override['plugins'] ) ) {
|
7593 |
+
// $plugins = $this->get_plugins_data_for_api();
|
7594 |
+
// if ( ! empty( $plugins ) ) {
|
7595 |
+
// $override['plugins'] = $plugins;
|
7596 |
+
// }
|
7597 |
+
// }
|
7598 |
+
/**
|
7599 |
+
* @since 1.1.8 Also send themes updates.
|
7600 |
+
*/
|
7601 |
+
// if ( $include_themes && ! isset( $override['themes'] ) ) {
|
7602 |
+
// $themes = $this->get_themes_data_for_api();
|
7603 |
+
// if ( ! empty( $themes ) ) {
|
7604 |
+
// $override['themes'] = $themes;
|
7605 |
+
// }
|
7606 |
+
// }
|
7607 |
+
|
7608 |
+
// Common properties.
|
7609 |
+
$common = array_merge( array(
|
7610 |
+
'version' => $this->get_plugin_version(),
|
7611 |
+
'is_premium' => $this->is_premium(),
|
7612 |
+
'sdk_version' => $this->version,
|
7613 |
+
'programming_language_version' => phpversion(),
|
7614 |
+
'platform_version' => get_bloginfo( 'version' ),
|
7615 |
+
), $override );
|
7616 |
+
|
7617 |
+
|
7618 |
+
$is_common_diff_for_any_site = false;
|
7619 |
+
$common_diff_union = array();
|
7620 |
+
|
7621 |
+
$installs_data = array();
|
7622 |
+
|
7623 |
+
$sites = self::get_sites();
|
7624 |
+
|
7625 |
+
foreach ( $sites as $site ) {
|
7626 |
+
$blog_id = self::get_site_blog_id( $site );
|
7627 |
+
|
7628 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
7629 |
+
|
7630 |
+
if ( is_object( $install ) ) {
|
7631 |
+
if ( $install->user_id != $this->_user->id ) {
|
7632 |
+
// Install belongs to a different owner.
|
7633 |
+
continue;
|
7634 |
+
}
|
7635 |
+
|
7636 |
+
if ( ! $this->is_premium() && $install->is_tracking_prohibited() ) {
|
7637 |
+
// Don't send updates regarding opted-out installs.
|
7638 |
+
continue;
|
7639 |
+
}
|
7640 |
+
|
7641 |
+
$install_data = $this->get_site_info( $site );
|
7642 |
+
|
7643 |
+
$uid = $install_data['uid'];
|
7644 |
+
|
7645 |
+
unset( $install_data['blog_id'] );
|
7646 |
+
unset( $install_data['uid'] );
|
7647 |
+
|
7648 |
+
$install_data['is_disconnected'] = $install->is_disconnected;
|
7649 |
+
$install_data['is_active'] = $this->is_active_for_site( $blog_id );
|
7650 |
+
$install_data['is_uninstalled'] = $install->is_uninstalled;
|
7651 |
+
|
7652 |
+
$common_diff = null;
|
7653 |
+
$is_common_diff = false;
|
7654 |
+
if ( $only_diff ) {
|
7655 |
+
$install_data = $this->get_install_diff_for_api( $install_data, $install, $override );
|
7656 |
+
$common_diff = $this->get_install_diff_for_api( $common, $install, $override );
|
7657 |
+
|
7658 |
+
$is_common_diff = ! empty( $common_diff );
|
7659 |
+
|
7660 |
+
if ( $is_common_diff ) {
|
7661 |
+
foreach ( $common_diff as $k => $v ) {
|
7662 |
+
if ( ! isset( $common_diff_union[ $k ] ) ) {
|
7663 |
+
$common_diff_union[ $k ] = $v;
|
7664 |
+
}
|
7665 |
+
}
|
7666 |
+
}
|
7667 |
+
|
7668 |
+
$is_common_diff_for_any_site = $is_common_diff_for_any_site || $is_common_diff;
|
7669 |
+
}
|
7670 |
+
|
7671 |
+
if ( ! empty( $install_data ) || $is_common_diff ) {
|
7672 |
+
// Add install ID and site unique ID.
|
7673 |
+
$install_data['id'] = $install->id;
|
7674 |
+
$install_data['uid'] = $uid;
|
7675 |
+
|
7676 |
+
$installs_data[] = $install_data;
|
7677 |
+
}
|
7678 |
+
}
|
7679 |
+
}
|
7680 |
+
|
7681 |
+
restore_current_blog();
|
7682 |
+
|
7683 |
+
if ( 0 < count( $installs_data ) && ( $is_common_diff_for_any_site || ! $only_diff ) ) {
|
7684 |
+
if ( ! $only_diff ) {
|
7685 |
+
$installs_data[] = $common;
|
7686 |
+
} else if ( ! empty( $common_diff_union ) ) {
|
7687 |
+
$installs_data[] = $common_diff_union;
|
7688 |
+
}
|
7689 |
+
}
|
7690 |
+
|
7691 |
+
foreach ( $installs_data as &$data ) {
|
7692 |
+
$data = (object) $data;
|
7693 |
+
}
|
7694 |
+
|
7695 |
+
return $installs_data;
|
7696 |
+
}
|
7697 |
+
|
7698 |
+
/**
|
7699 |
+
* Compare site actual data to the stored install data and return the differences for an API data sync.
|
7700 |
+
*
|
7701 |
+
* @author Vova Feldman (@svovaf)
|
7702 |
+
* @since 2.0.0
|
7703 |
+
*
|
7704 |
+
* @param array $site
|
7705 |
+
* @param FS_Site $install
|
7706 |
+
* @param string[] string $override
|
7707 |
+
*
|
7708 |
+
* @return array
|
7709 |
+
*/
|
7710 |
+
private function get_install_diff_for_api( $site, $install, $override = array() ) {
|
7711 |
+
$diff = array();
|
7712 |
+
$special = array();
|
7713 |
+
$special_override = false;
|
7714 |
+
|
7715 |
+
foreach ( $site as $p => $v ) {
|
7716 |
+
if ( property_exists( $install, $p ) ) {
|
7717 |
+
if ( ( is_bool( $install->{$p} ) || ! empty( $install->{$p} ) ) &&
|
7718 |
+
$install->{$p} != $v
|
7719 |
+
) {
|
7720 |
+
$install->{$p} = $v;
|
7721 |
+
$diff[ $p ] = $v;
|
7722 |
+
}
|
7723 |
+
} else {
|
7724 |
+
$special[ $p ] = $v;
|
7725 |
+
|
7726 |
+
if ( isset( $override[ $p ] ) ||
|
7727 |
+
'plugins' === $p ||
|
7728 |
+
'themes' === $p
|
7729 |
+
) {
|
7730 |
+
$special_override = true;
|
7731 |
+
}
|
7732 |
+
}
|
7733 |
+
}
|
7734 |
+
|
7735 |
+
if ( $special_override || 0 < count( $diff ) ) {
|
7736 |
+
// Add special params only if has at least one
|
7737 |
+
// standard param, or if explicitly requested to
|
7738 |
+
// override a special param or a param which is not exist
|
7739 |
+
// in the install object.
|
7740 |
+
$diff = array_merge( $diff, $special );
|
7741 |
+
}
|
7742 |
+
|
7743 |
+
return $diff;
|
7744 |
+
}
|
7745 |
+
|
7746 |
+
/**
|
7747 |
+
* Update install only if changed.
|
7748 |
+
*
|
7749 |
+
* @author Vova Feldman (@svovaf)
|
7750 |
+
* @since 1.0.9
|
7751 |
+
*
|
7752 |
+
* @param string[] string $override
|
7753 |
+
* @param bool $flush
|
7754 |
+
*
|
7755 |
+
* @return false|object|string
|
7756 |
+
*/
|
7757 |
+
private function send_install_update( $override = array(), $flush = false ) {
|
7758 |
+
$this->_logger->entrance();
|
7759 |
+
|
7760 |
+
$check_properties = $this->get_install_data_for_api( $override );
|
7761 |
+
|
7762 |
+
if ( $flush ) {
|
7763 |
+
$params = $check_properties;
|
7764 |
+
} else {
|
7765 |
+
$params = $this->get_install_diff_for_api( $check_properties, $this->_site, $override );
|
7766 |
+
}
|
7767 |
+
|
7768 |
+
if ( 0 < count( $params ) ) {
|
7769 |
+
if ( ! is_multisite() ) {
|
7770 |
+
// Update last install sync timestamp.
|
7771 |
+
$this->set_cron_execution_timestamp( 'install_sync' );
|
7772 |
+
}
|
7773 |
+
|
7774 |
+
$params['uid'] = $this->get_anonymous_id();
|
7775 |
+
|
7776 |
+
// Send updated values to FS.
|
7777 |
+
$site = $this->get_api_site_scope()->call( '/', 'put', $params );
|
7778 |
+
|
7779 |
+
if ( $this->is_api_result_entity( $site ) ) {
|
7780 |
+
if ( ! is_multisite() ) {
|
7781 |
+
// I successfully sent install update, clear scheduled sync if exist.
|
7782 |
+
$this->clear_install_sync_cron();
|
7783 |
+
}
|
7784 |
+
}
|
7785 |
+
|
7786 |
+
return $site;
|
7787 |
+
}
|
7788 |
+
|
7789 |
+
return false;
|
7790 |
+
}
|
7791 |
+
|
7792 |
+
/**
|
7793 |
+
* Update installs only if changed.
|
7794 |
+
*
|
7795 |
+
* @author Vova Feldman (@svovaf)
|
7796 |
+
* @since 2.0.0
|
7797 |
+
*
|
7798 |
+
* @param string[] string $override
|
7799 |
+
* @param bool $flush
|
7800 |
+
*
|
7801 |
+
* @return false|object|string
|
7802 |
+
*/
|
7803 |
+
private function send_installs_update( $override = array(), $flush = false ) {
|
7804 |
+
$this->_logger->entrance();
|
7805 |
+
|
7806 |
+
$installs_data = $this->get_installs_data_for_api( $override, ! $flush );
|
7807 |
+
|
7808 |
+
if ( empty( $installs_data ) ) {
|
7809 |
+
return false;
|
7810 |
+
}
|
7811 |
+
|
7812 |
+
// Update last install sync timestamp.
|
7813 |
+
$this->set_cron_execution_timestamp( 'install_sync' );
|
7814 |
+
|
7815 |
+
// Send updated values to FS.
|
7816 |
+
$result = $this->get_api_user_scope()->call( "/plugins/{$this->_plugin->id}/installs.json", 'put', $installs_data );
|
7817 |
+
|
7818 |
+
if ( $this->is_api_result_object( $result, 'installs' ) ) {
|
7819 |
+
// I successfully sent installs update, clear scheduled sync if exist.
|
7820 |
+
$this->clear_install_sync_cron();
|
7821 |
+
}
|
7822 |
+
|
7823 |
+
return $result;
|
7824 |
+
}
|
7825 |
+
|
7826 |
+
/**
|
7827 |
+
* Update install only if changed.
|
7828 |
+
*
|
7829 |
+
* @author Vova Feldman (@svovaf)
|
7830 |
+
* @since 1.0.9
|
7831 |
+
*
|
7832 |
+
* @param string[] string $override
|
7833 |
+
* @param bool $flush
|
7834 |
+
*/
|
7835 |
+
private function sync_install( $override = array(), $flush = false ) {
|
7836 |
+
$this->_logger->entrance();
|
7837 |
+
|
7838 |
+
$site = $this->send_install_update( $override, $flush );
|
7839 |
+
|
7840 |
+
if ( false === $site ) {
|
7841 |
+
// No sync required.
|
7842 |
+
return;
|
7843 |
+
}
|
7844 |
+
|
7845 |
+
if ( ! $this->is_api_result_entity( $site ) ) {
|
7846 |
+
// Failed to sync, don't update locally.
|
7847 |
+
return;
|
7848 |
+
}
|
7849 |
+
|
7850 |
+
$this->_site = new FS_Site( $site );
|
7851 |
+
|
7852 |
+
$this->_store_site( true );
|
7853 |
+
}
|
7854 |
+
|
7855 |
+
/**
|
7856 |
+
* Update install only if changed.
|
7857 |
+
*
|
7858 |
+
* @author Vova Feldman (@svovaf)
|
7859 |
+
* @since 1.0.9
|
7860 |
+
*
|
7861 |
+
* @param string[] string $override
|
7862 |
+
* @param bool $flush
|
7863 |
+
*/
|
7864 |
+
private function sync_installs( $override = array(), $flush = false ) {
|
7865 |
+
$this->_logger->entrance();
|
7866 |
+
|
7867 |
+
$result = $this->send_installs_update( $override, $flush );
|
7868 |
+
|
7869 |
+
if ( false === $result ) {
|
7870 |
+
// No sync required.
|
7871 |
+
return;
|
7872 |
+
}
|
7873 |
+
|
7874 |
+
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
7875 |
+
// Failed to sync, don't update locally.
|
7876 |
+
return;
|
7877 |
+
}
|
7878 |
+
|
7879 |
+
$address_to_blog_map = $this->get_address_to_blog_map();
|
7880 |
+
|
7881 |
+
foreach ( $result->installs as $install ) {
|
7882 |
+
$this->_site = new FS_Site( $install );
|
7883 |
+
|
7884 |
+
$address = trailingslashit( fs_strip_url_protocol( $install->url ) );
|
7885 |
+
$blog_id = $address_to_blog_map[ $address ];
|
7886 |
+
|
7887 |
+
$this->_store_site( true, $blog_id );
|
7888 |
+
}
|
7889 |
+
}
|
7890 |
+
|
7891 |
+
/**
|
7892 |
+
* Track install's custom event.
|
7893 |
+
*
|
7894 |
+
* IMPORTANT:
|
7895 |
+
* Custom event tracking is currently only supported for specific clients.
|
7896 |
+
* If you are not one of them, please don't use this method. If you will,
|
7897 |
+
* the API will simply ignore your request based on the plugin ID.
|
7898 |
+
*
|
7899 |
+
* Need custom tracking for your plugin or theme?
|
7900 |
+
* If you are interested in custom event tracking please contact yo@freemius.com
|
7901 |
+
* for further details.
|
7902 |
+
*
|
7903 |
+
* @author Vova Feldman (@svovaf)
|
7904 |
+
* @since 1.2.1
|
7905 |
+
*
|
7906 |
+
* @param string $name Event name.
|
7907 |
+
* @param array $properties Associative key/value array with primitive values only
|
7908 |
+
* @param bool $process_at A valid future date-time in the following format Y-m-d H:i:s.
|
7909 |
+
* @param bool $once If true, event will be tracked only once. IMPORTANT: Still trigger the API call.
|
7910 |
+
*
|
7911 |
+
* @return object|false Event data or FALSE on failure.
|
7912 |
+
*
|
7913 |
+
* @throws \Freemius_InvalidArgumentException
|
7914 |
+
*/
|
7915 |
+
public function track_event( $name, $properties = array(), $process_at = false, $once = false ) {
|
7916 |
+
$this->_logger->entrance( http_build_query( array( 'name' => $name, 'once' => $once ) ) );
|
7917 |
+
|
7918 |
+
if ( ! $this->is_registered() ) {
|
7919 |
+
return false;
|
7920 |
+
}
|
7921 |
+
|
7922 |
+
$event = array( 'type' => $name );
|
7923 |
+
|
7924 |
+
if ( is_numeric( $process_at ) && $process_at > time() ) {
|
7925 |
+
$event['process_at'] = $process_at;
|
7926 |
+
}
|
7927 |
+
|
7928 |
+
if ( $once ) {
|
7929 |
+
$event['once'] = true;
|
7930 |
+
}
|
7931 |
+
|
7932 |
+
if ( ! empty( $properties ) ) {
|
7933 |
+
// Verify associative array values are primitive.
|
7934 |
+
foreach ( $properties as $k => $v ) {
|
7935 |
+
if ( ! is_scalar( $v ) ) {
|
7936 |
+
throw new Freemius_InvalidArgumentException( 'The $properties argument must be an associative key/value array with primitive values only.' );
|
7937 |
+
}
|
7938 |
+
}
|
7939 |
+
|
7940 |
+
$event['properties'] = $properties;
|
7941 |
+
}
|
7942 |
+
|
7943 |
+
$result = $this->get_api_site_scope()->call( 'events.json', 'post', $event );
|
7944 |
+
|
7945 |
+
return $this->is_api_error( $result ) ?
|
7946 |
+
false :
|
7947 |
+
$result;
|
7948 |
+
}
|
7949 |
+
|
7950 |
+
/**
|
7951 |
+
* Track install's custom event only once, but it still triggers the API call.
|
7952 |
+
*
|
7953 |
+
* IMPORTANT:
|
7954 |
+
* Custom event tracking is currently only supported for specific clients.
|
7955 |
+
* If you are not one of them, please don't use this method. If you will,
|
7956 |
+
* the API will simply ignore your request based on the plugin ID.
|
7957 |
+
*
|
7958 |
+
* Need custom tracking for your plugin or theme?
|
7959 |
+
* If you are interested in custom event tracking please contact yo@freemius.com
|
7960 |
+
* for further details.
|
7961 |
+
*
|
7962 |
+
* @author Vova Feldman (@svovaf)
|
7963 |
+
* @since 1.2.1
|
7964 |
+
*
|
7965 |
+
* @param string $name Event name.
|
7966 |
+
* @param array $properties Associative key/value array with primitive values only
|
7967 |
+
* @param bool $process_at A valid future date-time in the following format Y-m-d H:i:s.
|
7968 |
+
*
|
7969 |
+
* @return object|false Event data or FALSE on failure.
|
7970 |
+
*
|
7971 |
+
* @throws \Freemius_InvalidArgumentException
|
7972 |
+
*
|
7973 |
+
* @user Freemius::track_event()
|
7974 |
+
*/
|
7975 |
+
public function track_event_once( $name, $properties = array(), $process_at = false ) {
|
7976 |
+
return $this->track_event( $name, $properties, $process_at, true );
|
7977 |
+
}
|
7978 |
+
|
7979 |
+
/**
|
7980 |
+
* Plugin uninstall hook.
|
7981 |
+
*
|
7982 |
+
* @author Vova Feldman (@svovaf)
|
7983 |
+
* @since 1.0.1
|
7984 |
+
*
|
7985 |
+
* @param bool $check_user Enforce checking if user have plugins activation privileges.
|
7986 |
+
*/
|
7987 |
+
function _uninstall_plugin_event( $check_user = true ) {
|
7988 |
+
$this->_logger->entrance( 'slug = ' . $this->_slug );
|
7989 |
+
|
7990 |
+
if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
|
7991 |
+
return;
|
7992 |
+
}
|
7993 |
+
|
7994 |
+
$params = array();
|
7995 |
+
$uninstall_reason = null;
|
7996 |
+
if ( isset( $this->_storage->uninstall_reason ) ) {
|
7997 |
+
$uninstall_reason = $this->_storage->uninstall_reason;
|
7998 |
+
$params['reason_id'] = $uninstall_reason->id;
|
7999 |
+
$params['reason_info'] = $uninstall_reason->info;
|
8000 |
+
}
|
8001 |
+
|
8002 |
+
if ( ! $this->is_registered() ) {
|
8003 |
+
// Send anonymous uninstall event only if user submitted a feedback.
|
8004 |
+
if ( isset( $uninstall_reason ) ) {
|
8005 |
+
if ( isset( $uninstall_reason->is_anonymous ) && ! $uninstall_reason->is_anonymous ) {
|
8006 |
+
$this->opt_in( false, false, false, false, true );
|
8007 |
+
} else {
|
8008 |
+
$params['uid'] = $this->get_anonymous_id();
|
8009 |
+
$this->get_api_plugin_scope()->call( 'uninstall.json', 'put', $params );
|
8010 |
+
}
|
8011 |
+
}
|
8012 |
+
} else {
|
8013 |
+
$params = array_merge( $params, array(
|
8014 |
+
'is_active' => false,
|
8015 |
+
'is_uninstalled' => true,
|
8016 |
+
) );
|
8017 |
+
|
8018 |
+
if ( $this->_is_network_active ) {
|
8019 |
+
// Send uninstall event.
|
8020 |
+
$this->send_installs_update( $params );
|
8021 |
+
} else {
|
8022 |
+
// Send uninstall event.
|
8023 |
+
$this->send_install_update( $params );
|
8024 |
+
}
|
8025 |
+
}
|
8026 |
+
|
8027 |
+
// @todo Decide if we want to delete plugin information from db.
|
8028 |
+
}
|
8029 |
+
|
8030 |
+
/**
|
8031 |
+
* @author Vova Feldman (@svovaf)
|
8032 |
+
* @since 1.1.1
|
8033 |
+
*
|
8034 |
+
* @return string
|
8035 |
+
*/
|
8036 |
+
function premium_plugin_basename() {
|
8037 |
+
return "{$this->_slug}-premium/" . basename( $this->_free_plugin_basename );
|
8038 |
+
}
|
8039 |
+
|
8040 |
+
/**
|
8041 |
+
* Uninstall plugin hook. Called only when connected his account with Freemius for active sites tracking.
|
8042 |
+
*
|
8043 |
+
* @author Vova Feldman (@svovaf)
|
8044 |
+
* @since 1.0.2
|
8045 |
+
*/
|
8046 |
+
public static function _uninstall_plugin_hook() {
|
8047 |
+
self::_load_required_static();
|
8048 |
+
|
8049 |
+
self::$_static_logger->entrance();
|
8050 |
+
|
8051 |
+
if ( ! current_user_can( 'activate_plugins' ) ) {
|
8052 |
+
return;
|
8053 |
+
}
|
8054 |
+
|
8055 |
+
$plugin_file = substr( current_filter(), strlen( 'uninstall_' ) );
|
8056 |
+
|
8057 |
+
self::$_static_logger->info( 'plugin = ' . $plugin_file );
|
8058 |
+
|
8059 |
+
define( 'WP_FS__UNINSTALL_MODE', true );
|
8060 |
+
|
8061 |
+
$fs = self::get_instance_by_file( $plugin_file );
|
8062 |
+
|
8063 |
+
if ( is_object( $fs ) ) {
|
8064 |
+
self::require_plugin_essentials();
|
8065 |
+
|
8066 |
+
if ( is_plugin_active( $fs->_free_plugin_basename ) ||
|
8067 |
+
is_plugin_active( $fs->premium_plugin_basename() )
|
8068 |
+
) {
|
8069 |
+
// Deleting Free or Premium plugin version while the other version still installed.
|
8070 |
+
return;
|
8071 |
+
}
|
8072 |
+
|
8073 |
+
$fs->_uninstall_plugin_event();
|
8074 |
+
|
8075 |
+
$fs->do_action( 'after_uninstall' );
|
8076 |
+
}
|
8077 |
+
}
|
8078 |
+
|
8079 |
+
#----------------------------------------------------------------------------------
|
8080 |
+
#region Plugin Information
|
8081 |
+
#----------------------------------------------------------------------------------
|
8082 |
+
|
8083 |
+
/**
|
8084 |
+
* Load WordPress core plugin.php essential module.
|
8085 |
+
*
|
8086 |
+
* @author Vova Feldman (@svovaf)
|
8087 |
+
* @since 1.1.1
|
8088 |
+
*/
|
8089 |
+
private static function require_plugin_essentials() {
|
8090 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
8091 |
+
self::$_static_logger->log( 'Including wp-admin/includes/plugin.php...' );
|
8092 |
+
|
8093 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
8094 |
+
}
|
8095 |
+
}
|
8096 |
+
|
8097 |
+
/**
|
8098 |
+
* Load WordPress core pluggable.php module.
|
8099 |
+
*
|
8100 |
+
* @author Vova Feldman (@svovaf)
|
8101 |
+
* @since 1.1.2
|
8102 |
+
*/
|
8103 |
+
private static function require_pluggable_essentials() {
|
8104 |
+
if ( ! function_exists( 'wp_get_current_user' ) ) {
|
8105 |
+
require_once ABSPATH . 'wp-includes/pluggable.php';
|
8106 |
+
}
|
8107 |
+
}
|
8108 |
+
|
8109 |
+
/**
|
8110 |
+
* Return plugin data.
|
8111 |
+
*
|
8112 |
+
* @author Vova Feldman (@svovaf)
|
8113 |
+
* @since 1.0.1
|
8114 |
+
*
|
8115 |
+
* @return array
|
8116 |
+
*/
|
8117 |
+
function get_plugin_data() {
|
8118 |
+
if ( ! isset( $this->_plugin_data ) ) {
|
8119 |
+
self::require_plugin_essentials();
|
8120 |
+
|
8121 |
+
if ( $this->is_plugin() ) {
|
8122 |
+
/**
|
8123 |
+
* @author Vova Feldman (@svovaf)
|
8124 |
+
* @since 1.2.0 When using get_plugin_data() do NOT translate plugin data.
|
8125 |
+
*
|
8126 |
+
* @link https://github.com/Freemius/wordpress-sdk/issues/77
|
8127 |
+
*/
|
8128 |
+
$plugin_data = get_plugin_data(
|
8129 |
+
$this->_plugin_main_file_path,
|
8130 |
+
false,
|
8131 |
+
false
|
8132 |
+
);
|
8133 |
+
} else {
|
8134 |
+
$theme_data = wp_get_theme();
|
8135 |
+
|
8136 |
+
$plugin_data = array(
|
8137 |
+
'Name' => $theme_data->get( 'Name' ),
|
8138 |
+
'Version' => $theme_data->get( 'Version' ),
|
8139 |
+
'Author' => $theme_data->get( 'Author' ),
|
8140 |
+
'Description' => $theme_data->get( 'Description' ),
|
8141 |
+
'PluginURI' => $theme_data->get( 'ThemeURI' ),
|
8142 |
+
);
|
8143 |
+
}
|
8144 |
+
|
8145 |
+
$this->_plugin_data = $plugin_data;
|
8146 |
+
}
|
8147 |
+
|
8148 |
+
return $this->_plugin_data;
|
8149 |
+
}
|
8150 |
+
|
8151 |
+
/**
|
8152 |
+
* @author Vova Feldman (@svovaf)
|
8153 |
+
* @since 1.0.1
|
8154 |
+
* @since 1.2.2.5 If slug not set load slug by module ID.
|
8155 |
+
*
|
8156 |
+
* @return string Plugin slug.
|
8157 |
+
*/
|
8158 |
+
function get_slug() {
|
8159 |
+
if ( ! isset( $this->_slug ) ) {
|
8160 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
|
8161 |
+
$this->_slug = $id_slug_type_path_map[ $this->_module_id ]['slug'];
|
8162 |
+
}
|
8163 |
+
|
8164 |
+
return $this->_slug;
|
8165 |
+
}
|
8166 |
+
|
8167 |
+
/**
|
8168 |
+
* @author Vova Feldman (@svovaf)
|
8169 |
+
* @since 1.2.1.7
|
8170 |
+
*
|
8171 |
+
* @return string Plugin slug.
|
8172 |
+
*/
|
8173 |
+
function get_target_folder_name() {
|
8174 |
+
return $this->_slug . ( $this->can_use_premium_code() ? '-premium' : '' );
|
8175 |
+
}
|
8176 |
+
|
8177 |
+
/**
|
8178 |
+
* @author Vova Feldman (@svovaf)
|
8179 |
+
* @since 1.0.1
|
8180 |
+
*
|
8181 |
+
* @return number Plugin ID.
|
8182 |
+
*/
|
8183 |
+
function get_id() {
|
8184 |
+
return $this->_plugin->id;
|
8185 |
+
}
|
8186 |
+
|
8187 |
+
/**
|
8188 |
+
* @author Vova Feldman (@svovaf)
|
8189 |
+
* @since 1.2.1.5
|
8190 |
+
*
|
8191 |
+
* @return string Freemius SDK version
|
8192 |
+
*/
|
8193 |
+
function get_sdk_version() {
|
8194 |
+
return $this->version;
|
8195 |
+
}
|
8196 |
+
|
8197 |
+
/**
|
8198 |
+
* @author Vova Feldman (@svovaf)
|
8199 |
+
* @since 1.2.1.5
|
8200 |
+
*
|
8201 |
+
* @return number Parent plugin ID (if parent exist).
|
8202 |
+
*/
|
8203 |
+
function get_parent_id() {
|
8204 |
+
return $this->is_addon() ?
|
8205 |
+
$this->get_parent_instance()->get_id() :
|
8206 |
+
$this->_plugin->id;
|
8207 |
+
}
|
8208 |
+
|
8209 |
+
/**
|
8210 |
+
* @author Vova Feldman (@svovaf)
|
8211 |
+
* @since 1.0.1
|
8212 |
+
*
|
8213 |
+
* @return string Plugin public key.
|
8214 |
+
*/
|
8215 |
+
function get_public_key() {
|
8216 |
+
return $this->_plugin->public_key;
|
8217 |
+
}
|
8218 |
+
|
8219 |
+
/**
|
8220 |
+
* Will be available only on sandbox mode.
|
8221 |
+
*
|
8222 |
+
* @author Vova Feldman (@svovaf)
|
8223 |
+
* @since 1.0.4
|
8224 |
+
*
|
8225 |
+
* @return mixed Plugin secret key.
|
8226 |
+
*/
|
8227 |
+
function get_secret_key() {
|
8228 |
+
return $this->_plugin->secret_key;
|
8229 |
+
}
|
8230 |
+
|
8231 |
+
/**
|
8232 |
+
* @author Vova Feldman (@svovaf)
|
8233 |
+
* @since 1.1.1
|
8234 |
+
*
|
8235 |
+
* @return bool
|
8236 |
+
*/
|
8237 |
+
function has_secret_key() {
|
8238 |
+
return ! empty( $this->_plugin->secret_key );
|
8239 |
+
}
|
8240 |
+
|
8241 |
+
/**
|
8242 |
+
* @author Vova Feldman (@svovaf)
|
8243 |
+
* @since 1.0.9
|
8244 |
+
*
|
8245 |
+
* @return string
|
8246 |
+
*/
|
8247 |
+
function get_plugin_name() {
|
8248 |
+
$this->_logger->entrance();
|
8249 |
+
|
8250 |
+
if ( ! isset( $this->_plugin_name ) ) {
|
8251 |
+
$plugin_data = $this->get_plugin_data();
|
8252 |
+
|
8253 |
+
// Get name.
|
8254 |
+
$this->_plugin_name = $plugin_data['Name'];
|
8255 |
+
|
8256 |
+
// Check if plugin name contains "(Premium)" suffix and remove it.
|
8257 |
+
$suffix = ' (premium)';
|
8258 |
+
$suffix_len = strlen( $suffix );
|
8259 |
+
|
8260 |
+
if ( strlen( $plugin_data['Name'] ) > $suffix_len &&
|
8261 |
+
$suffix === substr( strtolower( $plugin_data['Name'] ), - $suffix_len )
|
8262 |
+
) {
|
8263 |
+
$this->_plugin_name = substr( $plugin_data['Name'], 0, - $suffix_len );
|
8264 |
+
}
|
8265 |
+
|
8266 |
+
$this->_logger->departure( 'Name = ' . $this->_plugin_name );
|
8267 |
+
}
|
8268 |
+
|
8269 |
+
return $this->_plugin_name;
|
8270 |
+
}
|
8271 |
+
|
8272 |
+
/**
|
8273 |
+
* @author Vova Feldman (@svovaf)
|
8274 |
+
* @since 1.0.0
|
8275 |
+
*
|
8276 |
+
* @return string
|
8277 |
+
*/
|
8278 |
+
function get_plugin_version() {
|
8279 |
+
$this->_logger->entrance();
|
8280 |
+
|
8281 |
+
$plugin_data = $this->get_plugin_data();
|
8282 |
+
|
8283 |
+
$this->_logger->departure( 'Version = ' . $plugin_data['Version'] );
|
8284 |
+
|
8285 |
+
return $this->apply_filters( 'plugin_version', $plugin_data['Version'] );
|
8286 |
+
}
|
8287 |
+
|
8288 |
+
/**
|
8289 |
+
* @author Vova Feldman (@svovaf)
|
8290 |
+
* @since 1.2.1.7
|
8291 |
+
*
|
8292 |
+
* @return string
|
8293 |
+
*/
|
8294 |
+
function get_plugin_title() {
|
8295 |
+
$this->_logger->entrance();
|
8296 |
+
|
8297 |
+
$title = $this->_plugin->title;
|
8298 |
+
|
8299 |
+
return $this->apply_filters( 'plugin_title', $title );
|
8300 |
+
}
|
8301 |
+
|
8302 |
+
/**
|
8303 |
+
* @author Vova Feldman (@svovaf)
|
8304 |
+
* @since 1.2.2.7
|
8305 |
+
*
|
8306 |
+
* @param bool $lowercase
|
8307 |
+
*
|
8308 |
+
* @return string
|
8309 |
+
*/
|
8310 |
+
function get_module_label( $lowercase = false ) {
|
8311 |
+
$label = $this->is_addon() ?
|
8312 |
+
$this->get_text_inline( 'Add-On', 'addon' ) :
|
8313 |
+
( $this->is_plugin() ?
|
8314 |
+
$this->get_text_inline( 'Plugin', 'plugin' ) :
|
8315 |
+
$this->get_text_inline( 'Theme', 'theme' ) );
|
8316 |
+
|
8317 |
+
if ( $lowercase ) {
|
8318 |
+
$label = strtolower( $label );
|
8319 |
+
}
|
8320 |
+
|
8321 |
+
return $label;
|
8322 |
+
}
|
8323 |
+
|
8324 |
+
/**
|
8325 |
+
* @author Vova Feldman (@svovaf)
|
8326 |
+
* @since 1.0.4
|
8327 |
+
*
|
8328 |
+
* @return string
|
8329 |
+
*/
|
8330 |
+
function get_plugin_basename() {
|
8331 |
+
if ( ! isset( $this->_plugin_basename ) ) {
|
8332 |
+
if ( $this->is_plugin() ) {
|
8333 |
+
$this->_plugin_basename = plugin_basename( $this->_plugin_main_file_path );
|
8334 |
+
} else {
|
8335 |
+
$this->_plugin_basename = basename( dirname( $this->_plugin_main_file_path ) );
|
8336 |
+
}
|
8337 |
+
}
|
8338 |
+
|
8339 |
+
return $this->_plugin_basename;
|
8340 |
+
}
|
8341 |
+
|
8342 |
+
function get_plugin_folder_name() {
|
8343 |
+
$this->_logger->entrance();
|
8344 |
+
|
8345 |
+
$plugin_folder = $this->_plugin_basename;
|
8346 |
+
|
8347 |
+
while ( '.' !== dirname( $plugin_folder ) ) {
|
8348 |
+
$plugin_folder = dirname( $plugin_folder );
|
8349 |
+
}
|
8350 |
+
|
8351 |
+
$this->_logger->departure( 'Folder Name = ' . $plugin_folder );
|
8352 |
+
|
8353 |
+
return $plugin_folder;
|
8354 |
+
}
|
8355 |
+
|
8356 |
+
#endregion ------------------------------------------------------------------
|
8357 |
+
|
8358 |
+
/* Account
|
8359 |
+
------------------------------------------------------------------------------------------------------------------*/
|
8360 |
+
|
8361 |
+
/**
|
8362 |
+
* Find plugin's slug by plugin's basename.
|
8363 |
+
*
|
8364 |
+
* @author Vova Feldman (@svovaf)
|
8365 |
+
* @since 1.0.9
|
8366 |
+
*
|
8367 |
+
* @param string $plugin_base_name
|
8368 |
+
*
|
8369 |
+
* @return false|string
|
8370 |
+
*/
|
8371 |
+
private static function find_slug_by_basename( $plugin_base_name ) {
|
8372 |
+
$file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
|
8373 |
+
|
8374 |
+
if ( ! array( $file_slug_map ) || ! isset( $file_slug_map[ $plugin_base_name ] ) ) {
|
8375 |
+
return false;
|
8376 |
+
}
|
8377 |
+
|
8378 |
+
return $file_slug_map[ $plugin_base_name ];
|
8379 |
+
}
|
8380 |
+
|
8381 |
+
/**
|
8382 |
+
* Store the map between the plugin's basename to the slug.
|
8383 |
+
*
|
8384 |
+
* @author Vova Feldman (@svovaf)
|
8385 |
+
* @since 1.0.9
|
8386 |
+
*/
|
8387 |
+
private function store_file_slug_map() {
|
8388 |
+
$file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
|
8389 |
+
|
8390 |
+
if ( ! array( $file_slug_map ) ) {
|
8391 |
+
$file_slug_map = array();
|
8392 |
+
}
|
8393 |
+
|
8394 |
+
if ( ! isset( $file_slug_map[ $this->_plugin_basename ] ) ||
|
8395 |
+
$file_slug_map[ $this->_plugin_basename ] !== $this->_slug
|
8396 |
+
) {
|
8397 |
+
$file_slug_map[ $this->_plugin_basename ] = $this->_slug;
|
8398 |
+
self::$_accounts->set_option( 'file_slug_map', $file_slug_map, true );
|
8399 |
+
}
|
8400 |
+
}
|
8401 |
+
|
8402 |
+
/**
|
8403 |
+
* @return array[number]FS_User
|
8404 |
+
*/
|
8405 |
+
static function get_all_users() {
|
8406 |
+
$users = self::$_accounts->get_option( 'users', array() );
|
8407 |
+
|
8408 |
+
if ( ! is_array( $users ) ) {
|
8409 |
+
$users = array();
|
8410 |
+
}
|
8411 |
+
|
8412 |
+
return $users;
|
8413 |
+
}
|
8414 |
+
|
8415 |
+
/**
|
8416 |
+
* @param string $module_type
|
8417 |
+
* @param null|int $blog_id Since 2.0.0
|
8418 |
+
*
|
8419 |
+
* @return array[string]FS_Site
|
8420 |
+
*/
|
8421 |
+
private static function get_all_sites(
|
8422 |
+
$module_type = WP_FS__MODULE_TYPE_PLUGIN,
|
8423 |
+
$blog_id = null
|
8424 |
+
) {
|
8425 |
+
$sites = self::get_account_option( 'sites', $module_type, $blog_id );
|
8426 |
+
|
8427 |
+
if ( ! is_array( $sites ) ) {
|
8428 |
+
$sites = array();
|
8429 |
+
}
|
8430 |
+
|
8431 |
+
return $sites;
|
8432 |
+
}
|
8433 |
+
|
8434 |
+
/**
|
8435 |
+
* @author Leo Fajardo (@leorw)
|
8436 |
+
*
|
8437 |
+
* @since 1.2.2
|
8438 |
+
*
|
8439 |
+
* @param string $option_name
|
8440 |
+
* @param string $module_type
|
8441 |
+
* @param null|int $network_level_or_blog_id Since 2.0.0
|
8442 |
+
*
|
8443 |
+
* @return mixed
|
8444 |
+
*/
|
8445 |
+
private static function get_account_option( $option_name, $module_type = null, $network_level_or_blog_id = null ) {
|
8446 |
+
if ( ! is_null( $module_type ) && WP_FS__MODULE_TYPE_PLUGIN !== $module_type ) {
|
8447 |
+
$option_name = $module_type . '_' . $option_name;
|
8448 |
+
}
|
8449 |
+
|
8450 |
+
return self::$_accounts->get_option( $option_name, array(), $network_level_or_blog_id );
|
8451 |
+
}
|
8452 |
+
|
8453 |
+
/**
|
8454 |
+
* @author Leo Fajardo (@leorw)
|
8455 |
+
*
|
8456 |
+
* @since 1.2.2
|
8457 |
+
*
|
8458 |
+
* @param string $option_name
|
8459 |
+
* @param mixed $option_value
|
8460 |
+
* @param bool $store
|
8461 |
+
* @param null|int $network_level_or_blog_id Since 2.0.0
|
8462 |
+
*/
|
8463 |
+
private function set_account_option( $option_name, $option_value, $store, $network_level_or_blog_id = null ) {
|
8464 |
+
self::set_account_option_by_module(
|
8465 |
+
$this->_module_type,
|
8466 |
+
$option_name,
|
8467 |
+
$option_value,
|
8468 |
+
$store,
|
8469 |
+
$network_level_or_blog_id
|
8470 |
+
);
|
8471 |
+
}
|
8472 |
+
|
8473 |
+
/**
|
8474 |
+
* @author Vova Feldman (@svovaf)
|
8475 |
+
*
|
8476 |
+
* @since 1.2.2.7
|
8477 |
+
*
|
8478 |
+
* @param string $module_type
|
8479 |
+
* @param string $option_name
|
8480 |
+
* @param mixed $option_value
|
8481 |
+
* @param bool $store
|
8482 |
+
* @param null|int $network_level_or_blog_id Since 2.0.0
|
8483 |
+
*/
|
8484 |
+
private static function set_account_option_by_module(
|
8485 |
+
$module_type,
|
8486 |
+
$option_name,
|
8487 |
+
$option_value,
|
8488 |
+
$store,
|
8489 |
+
$network_level_or_blog_id = null
|
8490 |
+
) {
|
8491 |
+
if ( WP_FS__MODULE_TYPE_PLUGIN != $module_type ) {
|
8492 |
+
$option_name = $module_type . '_' . $option_name;
|
8493 |
+
}
|
8494 |
+
|
8495 |
+
self::$_accounts->set_option( $option_name, $option_value, $store, $network_level_or_blog_id );
|
8496 |
+
}
|
8497 |
+
|
8498 |
+
/**
|
8499 |
+
* @author Vova Feldman (@svovaf)
|
8500 |
+
* @since 1.0.6
|
8501 |
+
*
|
8502 |
+
* @param number|null $module_id
|
8503 |
+
*
|
8504 |
+
* @return FS_Plugin_License[]
|
8505 |
+
*/
|
8506 |
+
private static function get_all_licenses( $module_id = null ) {
|
8507 |
+
$licenses = self::get_account_option( 'all_licenses' );
|
8508 |
+
|
8509 |
+
if ( ! is_array( $licenses ) ) {
|
8510 |
+
$licenses = array();
|
8511 |
+
}
|
8512 |
+
|
8513 |
+
if ( is_null( $module_id ) ) {
|
8514 |
+
return $licenses;
|
8515 |
+
}
|
8516 |
+
|
8517 |
+
$licenses = isset( $licenses[ $module_id ] ) ?
|
8518 |
+
$licenses[ $module_id ] :
|
8519 |
+
array();
|
8520 |
+
|
8521 |
+
return $licenses;
|
8522 |
+
}
|
8523 |
+
|
8524 |
+
/**
|
8525 |
+
* @author Leo Fajardo (@leorw)
|
8526 |
+
* @since 2.0.0
|
8527 |
+
*
|
8528 |
+
* @return array
|
8529 |
+
*/
|
8530 |
+
private static function get_all_licenses_by_module_type() {
|
8531 |
+
$licenses = self::get_account_option( 'all_licenses' );
|
8532 |
+
|
8533 |
+
$licenses_by_module_type = array(
|
8534 |
+
WP_FS__MODULE_TYPE_PLUGIN => array(),
|
8535 |
+
WP_FS__MODULE_TYPE_THEME => array()
|
8536 |
+
);
|
8537 |
+
|
8538 |
+
if ( ! is_array( $licenses ) ) {
|
8539 |
+
return $licenses_by_module_type;
|
8540 |
+
}
|
8541 |
+
|
8542 |
+
foreach ( $licenses as $module_id => $module_licenses ) {
|
8543 |
+
$fs = self::get_instance_by_id( $module_id );
|
8544 |
+
if ( false === $fs ) {
|
8545 |
+
continue;
|
8546 |
+
}
|
8547 |
+
|
8548 |
+
$licenses_by_module_type[ $fs->_module_type ] = array_merge( $licenses_by_module_type[ $fs->_module_type ], $module_licenses );
|
8549 |
+
}
|
8550 |
+
|
8551 |
+
return $licenses_by_module_type;
|
8552 |
+
}
|
8553 |
+
|
8554 |
+
/**
|
8555 |
+
* @author Leo Fajardo (@leorw)
|
8556 |
+
* @since 2.0.0
|
8557 |
+
*
|
8558 |
+
* @param number $module_id
|
8559 |
+
* @param number|null $user_id
|
8560 |
+
*
|
8561 |
+
* @return array
|
8562 |
+
*/
|
8563 |
+
private static function get_user_id_license_ids_map( $module_id, $user_id = null ) {
|
8564 |
+
$all_modules_user_id_license_ids_map = self::get_account_option( 'user_id_license_ids_map' );
|
8565 |
+
|
8566 |
+
if ( ! is_array( $all_modules_user_id_license_ids_map ) ) {
|
8567 |
+
$all_modules_user_id_license_ids_map = array();
|
8568 |
+
}
|
8569 |
+
|
8570 |
+
$user_id_license_ids_map = isset( $all_modules_user_id_license_ids_map[ $module_id ] ) ?
|
8571 |
+
$all_modules_user_id_license_ids_map[ $module_id ] :
|
8572 |
+
array();
|
8573 |
+
|
8574 |
+
if ( FS_User::is_valid_id( $user_id ) ) {
|
8575 |
+
$user_id_license_ids_map = isset( $user_id_license_ids_map[ $user_id ] ) ?
|
8576 |
+
$user_id_license_ids_map[ $user_id ] :
|
8577 |
+
array();
|
8578 |
+
}
|
8579 |
+
|
8580 |
+
return $user_id_license_ids_map;
|
8581 |
+
}
|
8582 |
+
|
8583 |
+
/**
|
8584 |
+
* @author Leo Fajardo (@leorw)
|
8585 |
+
* @since 2.0.0
|
8586 |
+
*
|
8587 |
+
* @param array $new_user_id_license_ids_map
|
8588 |
+
* @param number $module_id
|
8589 |
+
* @param number|null $user_id
|
8590 |
+
*/
|
8591 |
+
private static function store_user_id_license_ids_map( $new_user_id_license_ids_map, $module_id, $user_id = null ) {
|
8592 |
+
$all_modules_user_id_license_ids_map = self::get_account_option( 'user_id_license_ids_map' );
|
8593 |
+
if ( ! is_array( $all_modules_user_id_license_ids_map ) ) {
|
8594 |
+
$all_modules_user_id_license_ids_map = array();
|
8595 |
+
}
|
8596 |
+
|
8597 |
+
if ( ! isset( $all_modules_user_id_license_ids_map[ $module_id ] ) ) {
|
8598 |
+
$all_modules_user_id_license_ids_map[ $module_id ] = array();
|
8599 |
+
}
|
8600 |
+
|
8601 |
+
if ( FS_User::is_valid_id( $user_id ) ) {
|
8602 |
+
$all_modules_user_id_license_ids_map[ $module_id ][ $user_id ] = $new_user_id_license_ids_map;
|
8603 |
+
} else {
|
8604 |
+
$all_modules_user_id_license_ids_map[ $module_id ] = $new_user_id_license_ids_map;
|
8605 |
+
}
|
8606 |
+
|
8607 |
+
self::$_accounts->set_option( 'user_id_license_ids_map', $all_modules_user_id_license_ids_map, true );
|
8608 |
+
}
|
8609 |
+
|
8610 |
+
/**
|
8611 |
+
* Get a collection of the user's linked license IDs.
|
8612 |
+
*
|
8613 |
+
* @author Vova Feldman (@svovaf)
|
8614 |
+
* @since 2.0.0
|
8615 |
+
*
|
8616 |
+
* @param number $user_id
|
8617 |
+
*
|
8618 |
+
* @return number[]
|
8619 |
+
*/
|
8620 |
+
private function get_user_linked_license_ids( $user_id ) {
|
8621 |
+
return self::get_user_id_license_ids_map( $this->_module_id, $user_id );
|
8622 |
+
}
|
8623 |
+
|
8624 |
+
/**
|
8625 |
+
* Override the user's linked license IDs with a new IDs collection.
|
8626 |
+
*
|
8627 |
+
* @author Vova Feldman (@svovaf)
|
8628 |
+
* @since 2.0.0
|
8629 |
+
*
|
8630 |
+
* @param number $user_id
|
8631 |
+
* @param number[] $license_ids
|
8632 |
+
*/
|
8633 |
+
private function set_user_linked_license_ids( $user_id, array $license_ids ) {
|
8634 |
+
self::store_user_id_license_ids_map( $license_ids, $this->_module_id, $user_id );
|
8635 |
+
}
|
8636 |
+
|
8637 |
+
/**
|
8638 |
+
* Link a specified license ID to a given user.
|
8639 |
+
*
|
8640 |
+
* @author Vova Feldman (@svovaf)
|
8641 |
+
* @since 2.0.0
|
8642 |
+
*
|
8643 |
+
* @param number $license_id
|
8644 |
+
* @param number $user_id
|
8645 |
+
*/
|
8646 |
+
private function link_license_2_user( $license_id, $user_id ) {
|
8647 |
+
$license_ids = $this->get_user_linked_license_ids( $user_id );
|
8648 |
+
|
8649 |
+
if ( in_array( $license_id, $license_ids ) ) {
|
8650 |
+
// License already linked.
|
8651 |
+
return;
|
8652 |
+
}
|
8653 |
+
|
8654 |
+
$license_ids[] = $license_id;
|
8655 |
+
|
8656 |
+
$this->set_user_linked_license_ids( $user_id, $license_ids );
|
8657 |
+
}
|
8658 |
+
|
8659 |
+
/**
|
8660 |
+
* @param string|bool $module_type
|
8661 |
+
*
|
8662 |
+
* @return FS_Plugin_Plan[]
|
8663 |
+
*/
|
8664 |
+
private static function get_all_plans( $module_type = false ) {
|
8665 |
+
$plans = self::get_account_option( 'plans', $module_type );
|
8666 |
+
|
8667 |
+
if ( ! is_array( $plans ) ) {
|
8668 |
+
$plans = array();
|
8669 |
+
}
|
8670 |
+
|
8671 |
+
return $plans;
|
8672 |
+
}
|
8673 |
+
|
8674 |
+
/**
|
8675 |
+
* @author Vova Feldman (@svovaf)
|
8676 |
+
* @since 1.0.4
|
8677 |
+
*
|
8678 |
+
* @return FS_Plugin_Tag[]
|
8679 |
+
*/
|
8680 |
+
private static function get_all_updates() {
|
8681 |
+
$updates = self::$_accounts->get_option( 'updates', array() );
|
8682 |
+
|
8683 |
+
if ( ! is_array( $updates ) ) {
|
8684 |
+
$updates = array();
|
8685 |
+
}
|
8686 |
+
|
8687 |
+
return $updates;
|
8688 |
+
}
|
8689 |
+
|
8690 |
+
/**
|
8691 |
+
* @author Vova Feldman (@svovaf)
|
8692 |
+
* @since 1.0.6
|
8693 |
+
*
|
8694 |
+
* @return array<number,FS_Plugin[]>|false
|
8695 |
+
*/
|
8696 |
+
private static function get_all_addons() {
|
8697 |
+
$addons = self::$_accounts->get_option( 'addons', array() );
|
8698 |
+
|
8699 |
+
if ( ! is_array( $addons ) ) {
|
8700 |
+
$addons = array();
|
8701 |
+
}
|
8702 |
+
|
8703 |
+
return $addons;
|
8704 |
+
}
|
8705 |
+
|
8706 |
+
/**
|
8707 |
+
* @author Vova Feldman (@svovaf)
|
8708 |
+
* @since 1.0.6
|
8709 |
+
*
|
8710 |
+
* @return FS_Plugin[]|false
|
8711 |
+
*/
|
8712 |
+
private static function get_all_account_addons() {
|
8713 |
+
$addons = self::$_accounts->get_option( 'account_addons', array() );
|
8714 |
+
|
8715 |
+
if ( ! is_array( $addons ) ) {
|
8716 |
+
$addons = array();
|
8717 |
+
}
|
8718 |
+
|
8719 |
+
return $addons;
|
8720 |
+
}
|
8721 |
+
|
8722 |
+
/**
|
8723 |
+
* Check if user has connected his account (opted-in).
|
8724 |
+
*
|
8725 |
+
* Note:
|
8726 |
+
* If the user opted-in and opted-out on a later stage,
|
8727 |
+
* this will still return true. If you want to check if the
|
8728 |
+
* user is currently opted-in, use:
|
8729 |
+
* `$fs->is_registered() && $fs->is_tracking_allowed()`
|
8730 |
+
*
|
8731 |
+
* @author Vova Feldman (@svovaf)
|
8732 |
+
* @since 1.0.1
|
8733 |
+
* @return bool
|
8734 |
+
*/
|
8735 |
+
function is_registered() {
|
8736 |
+
return is_object( $this->_user );
|
8737 |
+
}
|
8738 |
+
|
8739 |
+
/**
|
8740 |
+
* Returns TRUE if the user opted-in and didn't disconnect (opt-out).
|
8741 |
+
*
|
8742 |
+
* @author Leo Fajardo (@leorw)
|
8743 |
+
* @since 1.2.1.5
|
8744 |
+
*
|
8745 |
+
* @return bool
|
8746 |
+
*/
|
8747 |
+
function is_tracking_allowed() {
|
8748 |
+
return ( is_object( $this->_site ) && $this->_site->is_tracking_allowed() );
|
8749 |
+
}
|
8750 |
+
|
8751 |
+
/**
|
8752 |
+
* @author Vova Feldman (@svovaf)
|
8753 |
+
* @since 1.0.4
|
8754 |
+
*
|
8755 |
+
* @return FS_Plugin
|
8756 |
+
*/
|
8757 |
+
function get_plugin() {
|
8758 |
+
return $this->_plugin;
|
8759 |
+
}
|
8760 |
+
|
8761 |
+
/**
|
8762 |
+
* @author Vova Feldman (@svovaf)
|
8763 |
+
* @since 1.0.3
|
8764 |
+
*
|
8765 |
+
* @return FS_User
|
8766 |
+
*/
|
8767 |
+
function get_user() {
|
8768 |
+
return $this->_user;
|
8769 |
+
}
|
8770 |
+
|
8771 |
+
/**
|
8772 |
+
* @author Vova Feldman (@svovaf)
|
8773 |
+
* @since 1.0.3
|
8774 |
+
*
|
8775 |
+
* @return FS_Site
|
8776 |
+
*/
|
8777 |
+
function get_site() {
|
8778 |
+
return $this->_site;
|
8779 |
+
}
|
8780 |
+
|
8781 |
+
/**
|
8782 |
+
* Get plugin add-ons.
|
8783 |
+
*
|
8784 |
+
* @author Vova Feldman (@svovaf)
|
8785 |
+
* @since 1.0.6
|
8786 |
+
*
|
8787 |
+
* @since 1.1.7.3 If not yet loaded, fetch data from the API.
|
8788 |
+
*
|
8789 |
+
* @param bool $flush
|
8790 |
+
*
|
8791 |
+
* @return FS_Plugin[]|false
|
8792 |
+
*/
|
8793 |
+
function get_addons( $flush = false ) {
|
8794 |
+
$this->_logger->entrance();
|
8795 |
+
|
8796 |
+
if ( ! $this->_has_addons ) {
|
8797 |
+
return false;
|
8798 |
+
}
|
8799 |
+
|
8800 |
+
$addons = $this->sync_addons( $flush );
|
8801 |
+
|
8802 |
+
return ( ! is_array( $addons ) || empty( $addons ) ) ?
|
8803 |
+
false :
|
8804 |
+
$addons;
|
8805 |
+
}
|
8806 |
+
|
8807 |
+
/**
|
8808 |
+
* @author Vova Feldman (@svovaf)
|
8809 |
+
* @since 1.0.6
|
8810 |
+
*
|
8811 |
+
* @return FS_Plugin[]|false
|
8812 |
+
*/
|
8813 |
+
function get_account_addons() {
|
8814 |
+
$this->_logger->entrance();
|
8815 |
+
|
8816 |
+
$addons = self::get_all_account_addons();
|
8817 |
+
|
8818 |
+
if ( ! is_array( $addons ) ||
|
8819 |
+
! isset( $addons[ $this->_plugin->id ] ) ||
|
8820 |
+
! is_array( $addons[ $this->_plugin->id ] ) ||
|
8821 |
+
0 === count( $addons[ $this->_plugin->id ] )
|
8822 |
+
) {
|
8823 |
+
return false;
|
8824 |
+
}
|
8825 |
+
|
8826 |
+
return $addons[ $this->_plugin->id ];
|
8827 |
+
}
|
8828 |
+
|
8829 |
+
/**
|
8830 |
+
* Check if user has any
|
8831 |
+
*
|
8832 |
+
* @author Vova Feldman (@svovaf)
|
8833 |
+
* @since 1.1.6
|
8834 |
+
*
|
8835 |
+
* @return bool
|
8836 |
+
*/
|
8837 |
+
function has_account_addons() {
|
8838 |
+
$addons = $this->get_account_addons();
|
8839 |
+
|
8840 |
+
return is_array( $addons ) && ( 0 < count( $addons ) );
|
8841 |
+
}
|
8842 |
+
|
8843 |
+
|
8844 |
+
/**
|
8845 |
+
* Get add-on by ID (from local data).
|
8846 |
+
*
|
8847 |
+
* @author Vova Feldman (@svovaf)
|
8848 |
+
* @since 1.0.6
|
8849 |
+
*
|
8850 |
+
* @param number $id
|
8851 |
+
*
|
8852 |
+
* @return FS_Plugin|false
|
8853 |
+
*/
|
8854 |
+
function get_addon( $id ) {
|
8855 |
+
$this->_logger->entrance();
|
8856 |
+
|
8857 |
+
$addons = $this->get_addons();
|
8858 |
+
|
8859 |
+
if ( is_array( $addons ) ) {
|
8860 |
+
foreach ( $addons as $addon ) {
|
8861 |
+
if ( $id == $addon->id ) {
|
8862 |
+
return $addon;
|
8863 |
+
}
|
8864 |
+
}
|
8865 |
+
}
|
8866 |
+
|
8867 |
+
return false;
|
8868 |
+
}
|
8869 |
+
|
8870 |
+
/**
|
8871 |
+
* Get add-on by slug (from local data).
|
8872 |
+
*
|
8873 |
+
* @author Vova Feldman (@svovaf)
|
8874 |
+
* @since 1.0.6
|
8875 |
+
*
|
8876 |
+
* @param string $slug
|
8877 |
+
*
|
8878 |
+
* @param bool $flush
|
8879 |
+
*
|
8880 |
+
* @return FS_Plugin|false
|
8881 |
+
*/
|
8882 |
+
function get_addon_by_slug( $slug, $flush = false ) {
|
8883 |
+
$this->_logger->entrance();
|
8884 |
+
|
8885 |
+
$addons = $this->get_addons( $flush );
|
8886 |
+
|
8887 |
+
if ( is_array( $addons ) ) {
|
8888 |
+
foreach ( $addons as $addon ) {
|
8889 |
+
if ( $slug === $addon->slug ) {
|
8890 |
+
return $addon;
|
8891 |
+
}
|
8892 |
+
}
|
8893 |
+
}
|
8894 |
+
|
8895 |
+
return false;
|
8896 |
+
}
|
8897 |
+
|
8898 |
+
/**
|
8899 |
+
* @author Vova Feldman (@svovaf)
|
8900 |
+
* @since 2.0.0
|
8901 |
+
*
|
8902 |
+
* @param number $user_id
|
8903 |
+
*
|
8904 |
+
* @return FS_User
|
8905 |
+
*/
|
8906 |
+
static function _get_user_by_id( $user_id ) {
|
8907 |
+
self::$_static_logger->entrance( "user_id = {$user_id}" );
|
8908 |
+
|
8909 |
+
$users = self::get_all_users();
|
8910 |
+
|
8911 |
+
if ( is_array( $users ) ) {
|
8912 |
+
if ( isset( $users[ $user_id ] ) &&
|
8913 |
+
$users[ $user_id ] instanceof FS_User &&
|
8914 |
+
$user_id == $users[ $user_id ]->id
|
8915 |
+
) {
|
8916 |
+
return $users[ $user_id ];
|
8917 |
+
}
|
8918 |
+
|
8919 |
+
// If user wasn't found by the key, iterate over all the users collection.
|
8920 |
+
foreach ( $users as $user ) {
|
8921 |
+
/**
|
8922 |
+
* @var FS_User $user
|
8923 |
+
*/
|
8924 |
+
if ( $user_id == $user->id ) {
|
8925 |
+
return $user;
|
8926 |
+
}
|
8927 |
+
}
|
8928 |
+
}
|
8929 |
+
|
8930 |
+
return null;
|
8931 |
+
}
|
8932 |
+
|
8933 |
+
/**
|
8934 |
+
* Checks if a Freemius user_id is associated with a super-admin.
|
8935 |
+
*
|
8936 |
+
* @author Vova Feldman (@svovaf)
|
8937 |
+
* @since 2.0.0
|
8938 |
+
*
|
8939 |
+
* @param number $user_id
|
8940 |
+
*
|
8941 |
+
* @return bool
|
8942 |
+
*/
|
8943 |
+
private static function is_super_admin( $user_id ) {
|
8944 |
+
$is_super_admin = false;
|
8945 |
+
|
8946 |
+
$user = self::_get_user_by_id( $user_id );
|
8947 |
+
|
8948 |
+
if ( $user instanceof FS_User && ! empty( $user->email ) ) {
|
8949 |
+
self::require_pluggable_essentials();
|
8950 |
+
|
8951 |
+
$wp_user = get_user_by( 'email', $user->email );
|
8952 |
+
|
8953 |
+
if ( $wp_user instanceof WP_User ) {
|
8954 |
+
$super_admins = get_super_admins();
|
8955 |
+
$is_super_admin = ( is_array( $super_admins ) && in_array( $wp_user->user_login, $super_admins ) );
|
8956 |
+
}
|
8957 |
+
}
|
8958 |
+
|
8959 |
+
return $is_super_admin;
|
8960 |
+
}
|
8961 |
+
|
8962 |
+
#----------------------------------------------------------------------------------
|
8963 |
+
#region Plans & Licensing
|
8964 |
+
#----------------------------------------------------------------------------------
|
8965 |
+
|
8966 |
+
/**
|
8967 |
+
* Check if running premium plugin code.
|
8968 |
+
*
|
8969 |
+
* @author Vova Feldman (@svovaf)
|
8970 |
+
* @since 1.0.5
|
8971 |
+
*
|
8972 |
+
* @return bool
|
8973 |
+
*/
|
8974 |
+
function is_premium() {
|
8975 |
+
return $this->_plugin->is_premium;
|
8976 |
+
}
|
8977 |
+
|
8978 |
+
/**
|
8979 |
+
* Get site's plan ID.
|
8980 |
+
*
|
8981 |
+
* @author Vova Feldman (@svovaf)
|
8982 |
+
* @since 1.0.2
|
8983 |
+
*
|
8984 |
+
* @return number
|
8985 |
+
*/
|
8986 |
+
function get_plan_id() {
|
8987 |
+
return $this->_site->plan_id;
|
8988 |
+
}
|
8989 |
+
|
8990 |
+
/**
|
8991 |
+
* Get site's plan title.
|
8992 |
+
*
|
8993 |
+
* @author Vova Feldman (@svovaf)
|
8994 |
+
* @since 1.0.2
|
8995 |
+
*
|
8996 |
+
* @return string
|
8997 |
+
*/
|
8998 |
+
function get_plan_title() {
|
8999 |
+
$plan = $this->get_plan();
|
9000 |
+
|
9001 |
+
return is_object( $plan ) ? $plan->title : 'PLAN_TITLE';
|
9002 |
+
}
|
9003 |
+
|
9004 |
+
/**
|
9005 |
+
* Get site's plan name.
|
9006 |
+
*
|
9007 |
+
* @author Vova Feldman (@svovaf)
|
9008 |
+
* @since 2.0.0
|
9009 |
+
*
|
9010 |
+
* @return string
|
9011 |
+
*/
|
9012 |
+
function get_plan_name() {
|
9013 |
+
$plan = $this->get_plan();
|
9014 |
+
|
9015 |
+
return is_object( $plan ) ? $plan->name : 'PLAN_NAME';
|
9016 |
+
}
|
9017 |
+
|
9018 |
+
/**
|
9019 |
+
* @author Vova Feldman (@svovaf)
|
9020 |
+
* @since 1.0.9
|
9021 |
+
*
|
9022 |
+
* @return FS_Plugin_Plan|false
|
9023 |
+
*/
|
9024 |
+
function get_plan() {
|
9025 |
+
if ( ! is_object( $this->_site ) ) {
|
9026 |
+
return false;
|
9027 |
+
}
|
9028 |
+
|
9029 |
+
return FS_Plugin_Plan::is_valid_id( $this->_site->plan_id ) ?
|
9030 |
+
$this->_get_plan_by_id( $this->_site->plan_id ) :
|
9031 |
+
false;
|
9032 |
+
}
|
9033 |
+
|
9034 |
+
/**
|
9035 |
+
* @author Vova Feldman (@svovaf)
|
9036 |
+
* @since 1.0.3
|
9037 |
+
*
|
9038 |
+
* @return bool
|
9039 |
+
*/
|
9040 |
+
function is_trial() {
|
9041 |
+
$this->_logger->entrance();
|
9042 |
+
|
9043 |
+
if ( ! $this->is_registered() ) {
|
9044 |
+
return false;
|
9045 |
+
}
|
9046 |
+
|
9047 |
+
return $this->_site->is_trial();
|
9048 |
+
}
|
9049 |
+
|
9050 |
+
/**
|
9051 |
+
* Check if currently in a trial with payment method (credit card or paypal).
|
9052 |
+
*
|
9053 |
+
* @author Vova Feldman (@svovaf)
|
9054 |
+
* @since 1.1.7
|
9055 |
+
*
|
9056 |
+
* @return bool
|
9057 |
+
*/
|
9058 |
+
function is_paid_trial() {
|
9059 |
+
$this->_logger->entrance();
|
9060 |
+
|
9061 |
+
if ( ! $this->is_trial() ) {
|
9062 |
+
return false;
|
9063 |
+
}
|
9064 |
+
|
9065 |
+
return $this->has_active_valid_license() && ( $this->_site->trial_plan_id == $this->_license->plan_id );
|
9066 |
+
}
|
9067 |
+
|
9068 |
+
/**
|
9069 |
+
* Check if trial already utilized.
|
9070 |
+
*
|
9071 |
+
* @since 1.0.9
|
9072 |
+
*
|
9073 |
+
* @return bool
|
9074 |
+
*/
|
9075 |
+
function is_trial_utilized() {
|
9076 |
+
$this->_logger->entrance();
|
9077 |
+
|
9078 |
+
if ( ! $this->is_registered() ) {
|
9079 |
+
return false;
|
9080 |
+
}
|
9081 |
+
|
9082 |
+
return $this->_site->is_trial_utilized();
|
9083 |
+
}
|
9084 |
+
|
9085 |
+
/**
|
9086 |
+
* Get trial plan information (if in trial).
|
9087 |
+
*
|
9088 |
+
* @author Vova Feldman (@svovaf)
|
9089 |
+
* @since 1.0.9
|
9090 |
+
*
|
9091 |
+
* @return bool|FS_Plugin_Plan
|
9092 |
+
*/
|
9093 |
+
function get_trial_plan() {
|
9094 |
+
$this->_logger->entrance();
|
9095 |
+
|
9096 |
+
if ( ! $this->is_trial() ) {
|
9097 |
+
return false;
|
9098 |
+
}
|
9099 |
+
|
9100 |
+
// Try to load plan from local cache.
|
9101 |
+
$trial_plan = $this->_get_plan_by_id( $this->_site->trial_plan_id );
|
9102 |
+
|
9103 |
+
if ( ! is_object( $trial_plan ) ) {
|
9104 |
+
$trial_plan = $this->_fetch_site_plan( $this->_site->trial_plan_id );
|
9105 |
+
|
9106 |
+
/**
|
9107 |
+
* If managed to fetch the plan, add it to the plans collection.
|
9108 |
+
*/
|
9109 |
+
if ( $trial_plan instanceof FS_Plugin_Plan ) {
|
9110 |
+
if ( ! is_array( $this->_plans ) ) {
|
9111 |
+
$this->_plans = array();
|
9112 |
+
}
|
9113 |
+
|
9114 |
+
$this->_plans[] = $trial_plan;
|
9115 |
+
$this->_store_plans();
|
9116 |
+
}
|
9117 |
+
}
|
9118 |
+
|
9119 |
+
if ( $trial_plan instanceof FS_Plugin_Plan ) {
|
9120 |
+
return $trial_plan;
|
9121 |
+
}
|
9122 |
+
|
9123 |
+
/**
|
9124 |
+
* If for some reason failed to get the trial plan, fallback to a dummy name and title.
|
9125 |
+
*/
|
9126 |
+
$trial_plan = new FS_Plugin_Plan();
|
9127 |
+
$trial_plan->id = $this->_site->trial_plan_id;
|
9128 |
+
$trial_plan->name = 'pro';
|
9129 |
+
$trial_plan->title = 'Pro';
|
9130 |
+
|
9131 |
+
return $trial_plan;
|
9132 |
+
}
|
9133 |
+
|
9134 |
+
/**
|
9135 |
+
* Check if the user has an activate, non-expired license on current plugin's install.
|
9136 |
+
*
|
9137 |
+
* @since 1.0.9
|
9138 |
+
*
|
9139 |
+
* @return bool
|
9140 |
+
*/
|
9141 |
+
function is_paying() {
|
9142 |
+
$this->_logger->entrance();
|
9143 |
+
|
9144 |
+
if ( ! $this->is_registered() ) {
|
9145 |
+
return false;
|
9146 |
+
}
|
9147 |
+
|
9148 |
+
if ( ! $this->has_paid_plan() ) {
|
9149 |
+
return false;
|
9150 |
+
}
|
9151 |
+
|
9152 |
+
return (
|
9153 |
+
! $this->is_trial() &&
|
9154 |
+
'free' !== $this->get_plan_name() &&
|
9155 |
+
$this->has_active_valid_license()
|
9156 |
+
);
|
9157 |
+
}
|
9158 |
+
|
9159 |
+
/**
|
9160 |
+
* @author Vova Feldman (@svovaf)
|
9161 |
+
* @since 1.0.4
|
9162 |
+
*
|
9163 |
+
* @return bool
|
9164 |
+
*/
|
9165 |
+
function is_free_plan() {
|
9166 |
+
if ( ! $this->is_registered() ) {
|
9167 |
+
return true;
|
9168 |
+
}
|
9169 |
+
|
9170 |
+
if ( ! $this->has_paid_plan() ) {
|
9171 |
+
return true;
|
9172 |
+
}
|
9173 |
+
|
9174 |
+
return (
|
9175 |
+
'free' === $this->get_plan_name() ||
|
9176 |
+
! $this->has_features_enabled_license()
|
9177 |
+
);
|
9178 |
+
}
|
9179 |
+
|
9180 |
+
/**
|
9181 |
+
* @author Vova Feldman (@svovaf)
|
9182 |
+
* @since 1.0.5
|
9183 |
+
*
|
9184 |
+
* @return bool
|
9185 |
+
*/
|
9186 |
+
function _has_premium_license() {
|
9187 |
+
$this->_logger->entrance();
|
9188 |
+
|
9189 |
+
$premium_license = $this->_get_available_premium_license();
|
9190 |
+
|
9191 |
+
return ( false !== $premium_license );
|
9192 |
+
}
|
9193 |
+
|
9194 |
+
/**
|
9195 |
+
* Check if user has any licenses associated with the plugin (including expired or blocking).
|
9196 |
+
*
|
9197 |
+
* @author Vova Feldman (@svovaf)
|
9198 |
+
* @since 1.1.7.3
|
9199 |
+
*
|
9200 |
+
* @return bool
|
9201 |
+
*/
|
9202 |
+
private function has_any_license() {
|
9203 |
+
return is_array( $this->_licenses ) && ( 0 < count( $this->_licenses ) );
|
9204 |
+
}
|
9205 |
+
|
9206 |
+
/**
|
9207 |
+
* @author Vova Feldman (@svovaf)
|
9208 |
+
* @since 1.0.5
|
9209 |
+
*
|
9210 |
+
* @param bool|null $is_localhost
|
9211 |
+
*
|
9212 |
+
* @return FS_Plugin_License|false
|
9213 |
+
*/
|
9214 |
+
function _get_available_premium_license( $is_localhost = null ) {
|
9215 |
+
$this->_logger->entrance();
|
9216 |
+
|
9217 |
+
$licenses = $this->get_available_premium_licenses( $is_localhost );
|
9218 |
+
if ( ! empty( $licenses ) ) {
|
9219 |
+
return $licenses[0];
|
9220 |
+
}
|
9221 |
+
|
9222 |
+
return false;
|
9223 |
+
}
|
9224 |
+
|
9225 |
+
/**
|
9226 |
+
* @author Vova Feldman (@svovaf)
|
9227 |
+
* @since 1.0.5
|
9228 |
+
*
|
9229 |
+
* @param bool|null $is_localhost
|
9230 |
+
*
|
9231 |
+
* @return FS_Plugin_License[]
|
9232 |
+
*/
|
9233 |
+
function get_available_premium_licenses( $is_localhost = null ) {
|
9234 |
+
$this->_logger->entrance();
|
9235 |
+
|
9236 |
+
$licenses = array();
|
9237 |
+
if ( ! $this->has_paid_plan() ) {
|
9238 |
+
return $licenses;
|
9239 |
+
}
|
9240 |
+
|
9241 |
+
if ( is_array( $this->_licenses ) ) {
|
9242 |
+
foreach ( $this->_licenses as $license ) {
|
9243 |
+
if ( ! $license->can_activate( $is_localhost ) ) {
|
9244 |
+
continue;
|
9245 |
+
}
|
9246 |
+
|
9247 |
+
$licenses[] = $license;
|
9248 |
+
}
|
9249 |
+
}
|
9250 |
+
|
9251 |
+
return $licenses;
|
9252 |
+
}
|
9253 |
+
|
9254 |
+
/**
|
9255 |
+
* Sync local plugin plans with remote server.
|
9256 |
+
*
|
9257 |
+
* IMPORTANT: If for some reason a site is associated with deleted plan, we'll preserve the plan's information and append it as the last plan. This means that if plan is deleted, the is_plan() method will ALWAYS return true for any given argument (it becomes the most inclusive plan).
|
9258 |
+
*
|
9259 |
+
* @author Vova Feldman (@svovaf)
|
9260 |
+
* @since 1.0.5
|
9261 |
+
*
|
9262 |
+
* @return FS_Plugin_Plan[]|object
|
9263 |
+
*/
|
9264 |
+
function _sync_plans() {
|
9265 |
+
$plans = $this->_fetch_plugin_plans();
|
9266 |
+
|
9267 |
+
if ( $this->is_array_instanceof( $plans, 'FS_Plugin_Plan' ) ) {
|
9268 |
+
$plans_map = array();
|
9269 |
+
foreach ( $plans as $plan ) {
|
9270 |
+
$plans_map[ $plan->id ] = true;
|
9271 |
+
}
|
9272 |
+
|
9273 |
+
$plans_ids_to_keep = $this->get_plans_ids_associated_with_installs();
|
9274 |
+
|
9275 |
+
foreach ( $plans_ids_to_keep as $plan_id ) {
|
9276 |
+
if ( isset( $plans_map[ $plan_id ] ) ) {
|
9277 |
+
continue;
|
9278 |
+
}
|
9279 |
+
|
9280 |
+
$missing_plan = self::_get_plan_by_id( $plan_id );
|
9281 |
+
|
9282 |
+
if ( is_object( $missing_plan ) ) {
|
9283 |
+
$plans[] = $missing_plan;
|
9284 |
+
}
|
9285 |
+
}
|
9286 |
+
|
9287 |
+
$this->_plans = $plans;
|
9288 |
+
$this->_store_plans();
|
9289 |
+
}
|
9290 |
+
|
9291 |
+
$this->do_action( 'after_plans_sync', $plans );
|
9292 |
+
|
9293 |
+
return $this->_plans;
|
9294 |
+
}
|
9295 |
+
|
9296 |
+
/**
|
9297 |
+
* Check if specified plan exists locally. If not, fetch it and store it.
|
9298 |
+
*
|
9299 |
+
* @author Vova Feldman (@svovaf)
|
9300 |
+
* @since 2.0.0
|
9301 |
+
*
|
9302 |
+
* @param number $plan_id
|
9303 |
+
*
|
9304 |
+
* @return \FS_Plugin_Plan|object The plan entity or the API error object on failure.
|
9305 |
+
*/
|
9306 |
+
private function sync_plan_if_not_exist( $plan_id ) {
|
9307 |
+
$plan = self::_get_plan_by_id( $plan_id );
|
9308 |
+
|
9309 |
+
if ( is_object( $plan ) ) {
|
9310 |
+
// Plan already exists.
|
9311 |
+
return $plan;
|
9312 |
+
}
|
9313 |
+
|
9314 |
+
$plan = $this->fetch_plan_by_id( $plan_id );
|
9315 |
+
|
9316 |
+
if ( $plan instanceof FS_Plugin_Plan ) {
|
9317 |
+
$this->_plans[] = $plan;
|
9318 |
+
$this->_store_plans();
|
9319 |
+
|
9320 |
+
return $plan;
|
9321 |
+
}
|
9322 |
+
|
9323 |
+
return $plan;
|
9324 |
+
}
|
9325 |
+
|
9326 |
+
/**
|
9327 |
+
* Check if specified license exists locally. If not, fetch it and store it.
|
9328 |
+
*
|
9329 |
+
* @author Vova Feldman (@svovaf)
|
9330 |
+
* @since 2.0.0
|
9331 |
+
*
|
9332 |
+
* @param number $license_id
|
9333 |
+
* @param string $license_key
|
9334 |
+
*
|
9335 |
+
* @return \FS_Plugin_Plan|object The plan entity or the API error object on failure.
|
9336 |
+
*/
|
9337 |
+
private function sync_license_if_not_exist( $license_id, $license_key ) {
|
9338 |
+
$license = $this->_get_license_by_id( $license_id );
|
9339 |
+
|
9340 |
+
if ( is_object( $license ) ) {
|
9341 |
+
// License already exists.
|
9342 |
+
return $license;
|
9343 |
+
}
|
9344 |
+
|
9345 |
+
$license = $this->fetch_license_by_key( $license_id, $license_key );
|
9346 |
+
|
9347 |
+
if ( $license instanceof FS_Plugin_License ) {
|
9348 |
+
$this->_licenses[] = $license;
|
9349 |
+
$this->_license = $license;
|
9350 |
+
$this->_store_licenses();
|
9351 |
+
|
9352 |
+
return $license;
|
9353 |
+
}
|
9354 |
+
|
9355 |
+
return $license;
|
9356 |
+
}
|
9357 |
+
|
9358 |
+
/**
|
9359 |
+
* Get a collection of unique plan IDs that are associated with any installs in the network.
|
9360 |
+
*
|
9361 |
+
* @author Leo Fajardo (@leorw)
|
9362 |
+
* @since 2.0.0
|
9363 |
+
*
|
9364 |
+
* @return number[]
|
9365 |
+
*/
|
9366 |
+
private function get_plans_ids_associated_with_installs() {
|
9367 |
+
if ( ! $this->_is_network_active ) {
|
9368 |
+
if ( ! is_object( $this->_site ) ||
|
9369 |
+
! FS_Plugin_Plan::is_valid_id( $this->_site->plan_id )
|
9370 |
+
) {
|
9371 |
+
return array();
|
9372 |
+
}
|
9373 |
+
|
9374 |
+
return array( $this->_site->plan_id );
|
9375 |
+
}
|
9376 |
+
|
9377 |
+
$plan_ids = array();
|
9378 |
+
$sites = self::get_sites();
|
9379 |
+
foreach ( $sites as $site ) {
|
9380 |
+
$blog_id = self::get_site_blog_id( $site );
|
9381 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
9382 |
+
|
9383 |
+
if ( ! is_object( $install ) ||
|
9384 |
+
! FS_Plugin_Plan::is_valid_id( $install->plan_id )
|
9385 |
+
) {
|
9386 |
+
continue;
|
9387 |
+
}
|
9388 |
+
|
9389 |
+
$plan_ids[ $install->plan_id ] = true;
|
9390 |
+
}
|
9391 |
+
|
9392 |
+
return array_keys( $plan_ids );
|
9393 |
+
}
|
9394 |
+
|
9395 |
+
/**
|
9396 |
+
* Get a collection of unique license IDs that are associated with any installs in the network.
|
9397 |
+
*
|
9398 |
+
* @author Leo Fajardo (@leorw)
|
9399 |
+
* @since 2.0.0
|
9400 |
+
*
|
9401 |
+
* @return number[]
|
9402 |
+
*/
|
9403 |
+
private function get_license_ids_associated_with_installs() {
|
9404 |
+
if ( ! $this->_is_network_active ) {
|
9405 |
+
if ( ! is_object( $this->_site ) ||
|
9406 |
+
! FS_Plugin_License::is_valid_id( $this->_site->license_id )
|
9407 |
+
) {
|
9408 |
+
return array();
|
9409 |
+
}
|
9410 |
+
|
9411 |
+
return array( $this->_site->license_id );
|
9412 |
+
}
|
9413 |
+
|
9414 |
+
$license_ids = array();
|
9415 |
+
$sites = self::get_sites();
|
9416 |
+
foreach ( $sites as $site ) {
|
9417 |
+
$blog_id = self::get_site_blog_id( $site );
|
9418 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
9419 |
+
|
9420 |
+
if ( ! is_object( $install ) ||
|
9421 |
+
! FS_Plugin_License::is_valid_id( $install->license_id )
|
9422 |
+
) {
|
9423 |
+
continue;
|
9424 |
+
}
|
9425 |
+
|
9426 |
+
$license_ids[ $install->license_id ] = true;
|
9427 |
+
}
|
9428 |
+
|
9429 |
+
return array_keys( $license_ids );
|
9430 |
+
}
|
9431 |
+
|
9432 |
+
/**
|
9433 |
+
* @author Vova Feldman (@svovaf)
|
9434 |
+
* @since 1.0.5
|
9435 |
+
*
|
9436 |
+
* @param number $id
|
9437 |
+
*
|
9438 |
+
* @return FS_Plugin_Plan|false
|
9439 |
+
*/
|
9440 |
+
function _get_plan_by_id( $id ) {
|
9441 |
+
$this->_logger->entrance();
|
9442 |
+
|
9443 |
+
if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
|
9444 |
+
$this->_sync_plans();
|
9445 |
+
}
|
9446 |
+
|
9447 |
+
foreach ( $this->_plans as $plan ) {
|
9448 |
+
if ( $id == $plan->id ) {
|
9449 |
+
return $plan;
|
9450 |
+
}
|
9451 |
+
}
|
9452 |
+
|
9453 |
+
return false;
|
9454 |
+
}
|
9455 |
+
|
9456 |
+
/**
|
9457 |
+
* @author Vova Feldman (@svovaf)
|
9458 |
+
* @since 1.1.8.1
|
9459 |
+
*
|
9460 |
+
* @param string $name
|
9461 |
+
*
|
9462 |
+
* @return FS_Plugin_Plan|false
|
9463 |
+
*/
|
9464 |
+
private function get_plan_by_name( $name ) {
|
9465 |
+
$this->_logger->entrance();
|
9466 |
+
|
9467 |
+
if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
|
9468 |
+
$this->_sync_plans();
|
9469 |
+
}
|
9470 |
+
|
9471 |
+
foreach ( $this->_plans as $plan ) {
|
9472 |
+
if ( $name == $plan->name ) {
|
9473 |
+
return $plan;
|
9474 |
+
}
|
9475 |
+
}
|
9476 |
+
|
9477 |
+
return false;
|
9478 |
+
}
|
9479 |
+
|
9480 |
+
/**
|
9481 |
+
* Sync local licenses with remote server.
|
9482 |
+
*
|
9483 |
+
* @author Vova Feldman (@svovaf)
|
9484 |
+
* @since 1.0.6
|
9485 |
+
*
|
9486 |
+
* @param number|bool $site_license_id
|
9487 |
+
* @param number|null $blog_id
|
9488 |
+
*
|
9489 |
+
* @return FS_Plugin_License[]|object
|
9490 |
+
*/
|
9491 |
+
function _sync_licenses( $site_license_id = false, $blog_id = null ) {
|
9492 |
+
$this->_logger->entrance();
|
9493 |
+
|
9494 |
+
$is_network_admin = fs_is_network_admin();
|
9495 |
+
|
9496 |
+
if ( $is_network_admin && is_null( $blog_id ) ) {
|
9497 |
+
$all_licenses = self::get_all_licenses( $this->_module_id );
|
9498 |
+
} else {
|
9499 |
+
$all_licenses = $this->get_user_licenses( $this->_user->id );
|
9500 |
+
}
|
9501 |
+
|
9502 |
+
$foreign_licenses = array(
|
9503 |
+
'ids' => array(),
|
9504 |
+
'license_keys' => array()
|
9505 |
+
);
|
9506 |
+
|
9507 |
+
$all_licenses_map = array();
|
9508 |
+
foreach ( $all_licenses as $license ) {
|
9509 |
+
$all_licenses_map[ $license->id ] = true;
|
9510 |
+
if ( $license->user_id == $this->_user->id || $license->id == $site_license_id ) {
|
9511 |
+
continue;
|
9512 |
+
}
|
9513 |
+
|
9514 |
+
$foreign_licenses['ids'][] = $license->id;
|
9515 |
+
$foreign_licenses['license_keys'][] = $license->secret_key;
|
9516 |
+
}
|
9517 |
+
|
9518 |
+
if ( empty( $foreign_licenses['ids'] ) ) {
|
9519 |
+
$foreign_licenses = array();
|
9520 |
+
}
|
9521 |
+
|
9522 |
+
$licenses = $this->_fetch_licenses( false, $site_license_id, $foreign_licenses, $blog_id );
|
9523 |
+
|
9524 |
+
if ( $this->is_array_instanceof( $licenses, 'FS_Plugin_License' ) ) {
|
9525 |
+
$licenses_map = array();
|
9526 |
+
foreach ( $licenses as $license ) {
|
9527 |
+
$licenses_map[ $license->id ] = true;
|
9528 |
+
}
|
9529 |
+
|
9530 |
+
// $license_ids_to_keep = $this->get_license_ids_associated_with_installs();
|
9531 |
+
// foreach ( $license_ids_to_keep as $license_id ) {
|
9532 |
+
// if ( isset( $licenses_map[ $license_id ] ) ) {
|
9533 |
+
// continue;
|
9534 |
+
// }
|
9535 |
+
//
|
9536 |
+
// $missing_license = self::_get_license_by_id( $license_id, false );
|
9537 |
+
// if ( is_object( $missing_license ) ) {
|
9538 |
+
// $licenses[] = $missing_license;
|
9539 |
+
// $licenses_map[ $missing_license->id ] = true;
|
9540 |
+
// }
|
9541 |
+
// }
|
9542 |
+
|
9543 |
+
$user_license_ids = $this->get_user_linked_license_ids( $this->_user->id );
|
9544 |
+
|
9545 |
+
foreach ( $user_license_ids as $key => $license_id ) {
|
9546 |
+
if ( ! isset( $licenses_map[ $license_id ] ) ) {
|
9547 |
+
// Remove access to licenses that no longer exist.
|
9548 |
+
unset( $user_license_ids[ $key ] );
|
9549 |
+
}
|
9550 |
+
}
|
9551 |
+
|
9552 |
+
if ( ! empty( $user_license_ids ) ) {
|
9553 |
+
foreach ( $licenses_map as $license_id => $value ) {
|
9554 |
+
if ( ! isset( $all_licenses_map[ $license_id ] ) ) {
|
9555 |
+
// Associate new licenses with the user who triggered the license syncing.
|
9556 |
+
$user_license_ids[] = $license_id;
|
9557 |
+
}
|
9558 |
+
}
|
9559 |
+
|
9560 |
+
$user_license_ids = array_unique( $user_license_ids );
|
9561 |
+
} else {
|
9562 |
+
$user_license_ids = array_keys( $licenses_map );
|
9563 |
+
}
|
9564 |
+
|
9565 |
+
if ( ! $is_network_admin || ! is_null( $blog_id ) ) {
|
9566 |
+
$user_licenses = array();
|
9567 |
+
foreach ( $licenses as $license ) {
|
9568 |
+
if ( ! in_array( $license->id, $user_license_ids ) ) {
|
9569 |
+
continue;
|
9570 |
+
}
|
9571 |
+
|
9572 |
+
$user_licenses[] = $license;
|
9573 |
+
}
|
9574 |
+
|
9575 |
+
$this->_licenses = $user_licenses;
|
9576 |
+
} else {
|
9577 |
+
$this->_licenses = $licenses;
|
9578 |
+
}
|
9579 |
+
|
9580 |
+
$this->set_user_linked_license_ids( $this->_user->id, $user_license_ids );
|
9581 |
+
|
9582 |
+
$this->_store_licenses( true, $this->_module_id, $licenses );
|
9583 |
+
}
|
9584 |
+
|
9585 |
+
// Update current license.
|
9586 |
+
if ( is_object( $this->_license ) ) {
|
9587 |
+
$this->_license = $this->_get_license_by_id( $this->_license->id );
|
9588 |
+
}
|
9589 |
+
|
9590 |
+
return $this->_licenses;
|
9591 |
+
}
|
9592 |
+
|
9593 |
+
/**
|
9594 |
+
* @author Vova Feldman (@svovaf)
|
9595 |
+
* @since 1.0.5
|
9596 |
+
*
|
9597 |
+
* @param number $id
|
9598 |
+
* @param bool $sync_licenses
|
9599 |
+
*
|
9600 |
+
* @return FS_Plugin_License|false
|
9601 |
+
*/
|
9602 |
+
function _get_license_by_id( $id, $sync_licenses = true ) {
|
9603 |
+
$this->_logger->entrance();
|
9604 |
+
|
9605 |
+
if ( ! FS_Plugin_License::is_valid_id( $id ) ) {
|
9606 |
+
return false;
|
9607 |
+
}
|
9608 |
+
|
9609 |
+
/**
|
9610 |
+
* When running from the network level admin and opted-in from the network,
|
9611 |
+
* check if the license exists in the network user licenses collection.
|
9612 |
+
*
|
9613 |
+
* @author Vova Feldman (@svovaf)
|
9614 |
+
* @since 2.0.0
|
9615 |
+
*/
|
9616 |
+
if ( fs_is_network_admin() &&
|
9617 |
+
$this->is_network_registered() &&
|
9618 |
+
( ! is_object( $this->_user ) || $this->_storage->network_user_id != $this->_user->id )
|
9619 |
+
) {
|
9620 |
+
$licenses = $this->get_user_licenses( $this->_storage->network_user_id );
|
9621 |
+
|
9622 |
+
foreach ( $licenses as $license ) {
|
9623 |
+
if ( $id == $license->id ) {
|
9624 |
+
return $license;
|
9625 |
+
}
|
9626 |
+
}
|
9627 |
+
}
|
9628 |
+
|
9629 |
+
if ( ! $this->has_any_license() && $sync_licenses ) {
|
9630 |
+
$this->_sync_licenses( $id );
|
9631 |
+
}
|
9632 |
+
|
9633 |
+
if ( is_array( $this->_licenses ) ) {
|
9634 |
+
foreach ( $this->_licenses as $license ) {
|
9635 |
+
if ( $id == $license->id ) {
|
9636 |
+
return $license;
|
9637 |
+
}
|
9638 |
+
}
|
9639 |
+
}
|
9640 |
+
|
9641 |
+
return false;
|
9642 |
+
}
|
9643 |
+
|
9644 |
+
/**
|
9645 |
+
* Get license by ID. Unlike _get_license_by_id(), this method only checks the local storage and return any license, whether it's associated with the current context user/install or not.
|
9646 |
+
*
|
9647 |
+
* @author Vova Feldman (@svovaf)
|
9648 |
+
* @since 2.0.0
|
9649 |
+
*
|
9650 |
+
* @param number $id
|
9651 |
+
*
|
9652 |
+
* @return FS_Plugin_License
|
9653 |
+
*/
|
9654 |
+
private function get_license_by_id( $id ) {
|
9655 |
+
$licenses = self::get_all_licenses( $this->_module_id );
|
9656 |
+
|
9657 |
+
if ( is_array( $licenses ) && ! empty( $licenses ) ) {
|
9658 |
+
foreach ( $licenses as $license ) {
|
9659 |
+
if ( $id == $license->id ) {
|
9660 |
+
return $license;
|
9661 |
+
}
|
9662 |
+
}
|
9663 |
+
}
|
9664 |
+
|
9665 |
+
return null;
|
9666 |
+
}
|
9667 |
+
|
9668 |
+
/**
|
9669 |
+
* Synchronize the site's context license by fetching the license form the API and updating the local data with it.
|
9670 |
+
*
|
9671 |
+
* @author Vova Feldman (@svovaf)
|
9672 |
+
* @since 2.0.0
|
9673 |
+
*
|
9674 |
+
* @return \FS_Plugin_License|mixed
|
9675 |
+
*/
|
9676 |
+
private function sync_site_license() {
|
9677 |
+
$api = $this->get_api_user_scope();
|
9678 |
+
|
9679 |
+
$result = $api->get( "/licenses/{$this->_license->id}.json?license_key=" . urlencode( $this->_license->secret_key ), true );
|
9680 |
+
|
9681 |
+
if ( ! $this->is_api_result_entity( $result ) ) {
|
9682 |
+
return $result;
|
9683 |
+
}
|
9684 |
+
|
9685 |
+
$license = $this->_update_site_license( new FS_Plugin_License( $result ) );
|
9686 |
+
$this->_store_licenses();
|
9687 |
+
|
9688 |
+
return $license;
|
9689 |
+
}
|
9690 |
+
|
9691 |
+
/**
|
9692 |
+
* Get all user's available licenses for the current module.
|
9693 |
+
*
|
9694 |
+
* @author Vova Feldman (@svovaf)
|
9695 |
+
* @since 2.0.0
|
9696 |
+
*
|
9697 |
+
* @param number $user_id
|
9698 |
+
*
|
9699 |
+
* @return FS_Plugin_License[]
|
9700 |
+
*/
|
9701 |
+
private function get_user_licenses( $user_id ) {
|
9702 |
+
$all_licenses = self::get_all_licenses( $this->_module_id );
|
9703 |
+
if ( empty( $all_licenses ) ) {
|
9704 |
+
return array();
|
9705 |
+
}
|
9706 |
+
|
9707 |
+
$user_license_ids = $this->get_user_linked_license_ids( $user_id );
|
9708 |
+
if ( empty( $user_license_ids ) ) {
|
9709 |
+
return array();
|
9710 |
+
}
|
9711 |
+
|
9712 |
+
$licenses = array();
|
9713 |
+
foreach ( $all_licenses as $license ) {
|
9714 |
+
if ( in_array( $license->id, $user_license_ids ) ) {
|
9715 |
+
$licenses[] = $license;
|
9716 |
+
}
|
9717 |
+
}
|
9718 |
+
|
9719 |
+
return $licenses;
|
9720 |
+
}
|
9721 |
+
|
9722 |
+
/**
|
9723 |
+
* Checks if the context license is network activated except on the given blog ID.
|
9724 |
+
*
|
9725 |
+
* @author Vova Feldman (@svovaf)
|
9726 |
+
* @since 2.0.0
|
9727 |
+
*
|
9728 |
+
* @param int $except_blog_id
|
9729 |
+
*
|
9730 |
+
* @return bool
|
9731 |
+
*/
|
9732 |
+
private function is_license_network_active( $except_blog_id = 0 ) {
|
9733 |
+
$this->_logger->entrance();
|
9734 |
+
|
9735 |
+
if ( ! is_object( $this->_license ) ) {
|
9736 |
+
return false;
|
9737 |
+
}
|
9738 |
+
|
9739 |
+
$sites = self::get_sites();
|
9740 |
+
|
9741 |
+
if ( $this->_license->total_activations() < ( count( $sites ) - 1 ) ) {
|
9742 |
+
// There are more sites than the number of activations, so license cannot be network activated.
|
9743 |
+
return false;
|
9744 |
+
}
|
9745 |
+
|
9746 |
+
foreach ( $sites as $site ) {
|
9747 |
+
$blog_id = self::get_site_blog_id( $site );
|
9748 |
+
|
9749 |
+
if ( $except_blog_id == $blog_id ) {
|
9750 |
+
// Skip excluded blog.
|
9751 |
+
continue;
|
9752 |
+
}
|
9753 |
+
|
9754 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
9755 |
+
|
9756 |
+
if ( is_object( $install ) && $install->license_id != $this->_license->id ) {
|
9757 |
+
return false;
|
9758 |
+
}
|
9759 |
+
}
|
9760 |
+
|
9761 |
+
return true;
|
9762 |
+
}
|
9763 |
+
|
9764 |
+
/**
|
9765 |
+
* Checks if license can be activated on all the network sites (opted-in or skipped) that are not yet associated with a license. If possible, try to make the activation, if not return false.
|
9766 |
+
*
|
9767 |
+
* Notice: On success, this method will also update the license activations counters (without updating the license in the storage).
|
9768 |
+
*
|
9769 |
+
* @author Vova Feldman (@svovaf)
|
9770 |
+
* @since 2.0.0
|
9771 |
+
*
|
9772 |
+
* @param \FS_User $user
|
9773 |
+
* @param \FS_Plugin_License $license
|
9774 |
+
*
|
9775 |
+
* @return bool
|
9776 |
+
*/
|
9777 |
+
private function try_activate_license_on_network( FS_User $user, FS_Plugin_License $license ) {
|
9778 |
+
$this->_logger->entrance();
|
9779 |
+
|
9780 |
+
$result = $this->can_activate_license_on_network( $license );
|
9781 |
+
|
9782 |
+
if ( false === $result ) {
|
9783 |
+
return false;
|
9784 |
+
}
|
9785 |
+
|
9786 |
+
$installs_without_license = $result['installs'];
|
9787 |
+
if ( ! empty( $installs_without_license ) ) {
|
9788 |
+
$this->activate_license_on_many_installs( $user, $license->secret_key, $installs_without_license );
|
9789 |
+
}
|
9790 |
+
|
9791 |
+
$disconnected_site_ids = $result['sites'];
|
9792 |
+
if ( ! empty( $disconnected_site_ids ) ) {
|
9793 |
+
$this->activate_license_on_many_sites( $user, $license->secret_key, $disconnected_site_ids );
|
9794 |
+
}
|
9795 |
+
|
9796 |
+
$this->link_license_2_user( $license->id, $user->id );
|
9797 |
+
|
9798 |
+
// Sync license after activations.
|
9799 |
+
$license->activated += $result['production_count'];
|
9800 |
+
$license->activated_local += $result['localhost_count'];
|
9801 |
+
|
9802 |
+
// $this->_store_licenses()
|
9803 |
+
|
9804 |
+
return true;
|
9805 |
+
}
|
9806 |
+
|
9807 |
+
/**
|
9808 |
+
* Checks if the given license can be activated on the whole network.
|
9809 |
+
*
|
9810 |
+
* @author Vova Feldman (@svovaf)
|
9811 |
+
* @since 2.0.0
|
9812 |
+
*
|
9813 |
+
* @param \FS_Plugin_License $license
|
9814 |
+
*
|
9815 |
+
* @return false|array {
|
9816 |
+
* @type array[int]FS_Site $installs Blog ID to install map.
|
9817 |
+
* @type int[] $sites Non-connected blog IDs.
|
9818 |
+
* @type int $production_count Production sites count.
|
9819 |
+
* @type int $localhost_count Production sites count.
|
9820 |
+
* }
|
9821 |
+
*/
|
9822 |
+
private function can_activate_license_on_network( FS_Plugin_License $license ) {
|
9823 |
+
$sites = self::get_sites();
|
9824 |
+
|
9825 |
+
$production_count = 0;
|
9826 |
+
$localhost_count = 0;
|
9827 |
+
|
9828 |
+
$installs_without_license = array();
|
9829 |
+
$disconnected_site_ids = array();
|
9830 |
+
|
9831 |
+
foreach ( $sites as $site ) {
|
9832 |
+
$blog_id = self::get_site_blog_id( $site );
|
9833 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
9834 |
+
|
9835 |
+
if ( is_object( $install ) ) {
|
9836 |
+
if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) {
|
9837 |
+
// License already activated on the install.
|
9838 |
+
continue;
|
9839 |
+
}
|
9840 |
+
|
9841 |
+
$url = $install->url;
|
9842 |
+
|
9843 |
+
$installs_without_license[ $blog_id ] = $install;
|
9844 |
+
} else {
|
9845 |
+
$url = is_object( $site ) ?
|
9846 |
+
$site->siteurl :
|
9847 |
+
get_site_url( $blog_id );
|
9848 |
+
|
9849 |
+
$disconnected_site_ids[] = $blog_id;
|
9850 |
+
}
|
9851 |
+
|
9852 |
+
if ( FS_Site::is_localhost_by_address( $url ) ) {
|
9853 |
+
$localhost_count ++;
|
9854 |
+
} else {
|
9855 |
+
$production_count ++;
|
9856 |
+
}
|
9857 |
+
}
|
9858 |
+
|
9859 |
+
if ( ! $license->can_activate_bulk( $production_count, $localhost_count ) ) {
|
9860 |
+
return false;
|
9861 |
+
}
|
9862 |
+
|
9863 |
+
return array(
|
9864 |
+
'installs' => $installs_without_license,
|
9865 |
+
'sites' => $disconnected_site_ids,
|
9866 |
+
'production_count' => $production_count,
|
9867 |
+
'localhost_count' => $localhost_count,
|
9868 |
+
);
|
9869 |
+
}
|
9870 |
+
|
9871 |
+
/**
|
9872 |
+
* Activate a given license on a collection of installs.
|
9873 |
+
*
|
9874 |
+
* @author Vova Feldman (@svovaf)
|
9875 |
+
* @since 2.0.0
|
9876 |
+
*
|
9877 |
+
* @param \FS_User $user
|
9878 |
+
* @param string $license_key
|
9879 |
+
* @param array $blog_2_install_map {
|
9880 |
+
* @key int Blog ID.
|
9881 |
+
* @value FS_Site Blog's associated install.
|
9882 |
+
* }
|
9883 |
+
*
|
9884 |
+
* @return mixed|true
|
9885 |
+
*/
|
9886 |
+
private function activate_license_on_many_installs(
|
9887 |
+
FS_User $user,
|
9888 |
+
$license_key,
|
9889 |
+
array $blog_2_install_map
|
9890 |
+
) {
|
9891 |
+
$params = array(
|
9892 |
+
array( 'license_key' => $this->apply_filters( 'license_key', $license_key ) )
|
9893 |
+
);
|
9894 |
+
|
9895 |
+
$install_2_blog_map = array();
|
9896 |
+
foreach ( $blog_2_install_map as $blog_id => $install ) {
|
9897 |
+
$params[] = array( 'id' => $install->id );
|
9898 |
+
|
9899 |
+
$install_2_blog_map[ $install->id ] = $blog_id;
|
9900 |
+
}
|
9901 |
+
|
9902 |
+
$result = $this->get_api_user_scope_by_user( $user )->call(
|
9903 |
+
"plugins/{$this->_plugin->id}/installs.json",
|
9904 |
+
'PUT',
|
9905 |
+
$params
|
9906 |
+
);
|
9907 |
+
|
9908 |
+
if ( ! $this->is_api_result_object( $result, 'installs' ) ) {
|
9909 |
+
return $result;
|
9910 |
+
}
|
9911 |
+
|
9912 |
+
foreach ( $result->installs as $r_install ) {
|
9913 |
+
$install = new FS_Site( $r_install );
|
9914 |
+
$install->is_disconnected = false;
|
9915 |
+
|
9916 |
+
// Update install.
|
9917 |
+
$this->_store_site(
|
9918 |
+
true,
|
9919 |
+
$install_2_blog_map[ $r_install->id ],
|
9920 |
+
$install
|
9921 |
+
);
|
9922 |
+
}
|
9923 |
+
|
9924 |
+
return true;
|
9925 |
+
}
|
9926 |
+
|
9927 |
+
/**
|
9928 |
+
* Activate a given license on a collection of blogs/sites that are not yet opted-in.
|
9929 |
+
*
|
9930 |
+
* @author Vova Feldman (@svovaf)
|
9931 |
+
* @since 2.0.0
|
9932 |
+
*
|
9933 |
+
* @param \FS_User $user
|
9934 |
+
* @param string $license_key
|
9935 |
+
* @param int[] $site_ids
|
9936 |
+
*
|
9937 |
+
* @return true|mixed True if successful, otherwise, the API result.
|
9938 |
+
*/
|
9939 |
+
private function activate_license_on_many_sites(
|
9940 |
+
FS_User $user,
|
9941 |
+
$license_key,
|
9942 |
+
array $site_ids
|
9943 |
+
) {
|
9944 |
+
$sites = array();
|
9945 |
+
foreach ( $site_ids as $site_id ) {
|
9946 |
+
$sites[] = $this->get_site_info( array( 'blog_id' => $site_id ) );
|
9947 |
+
}
|
9948 |
+
|
9949 |
+
// Install the plugin.
|
9950 |
+
$result = $this->create_installs_with_user(
|
9951 |
+
$user,
|
9952 |
+
$license_key,
|
9953 |
+
false,
|
9954 |
+
$sites,
|
9955 |
+
false,
|
9956 |
+
true
|
9957 |
+
);
|
9958 |
+
|
9959 |
+
if ( ! $this->is_api_result_entity( $result ) &&
|
9960 |
+
! $this->is_api_result_object( $result, 'installs' )
|
9961 |
+
) {
|
9962 |
+
return $result;
|
9963 |
+
}
|
9964 |
+
|
9965 |
+
$installs = array();
|
9966 |
+
foreach ( $result->installs as $install ) {
|
9967 |
+
$installs[] = new FS_Site( $install );
|
9968 |
+
}
|
9969 |
+
|
9970 |
+
// Map site addresses to their blog IDs.
|
9971 |
+
$address_to_blog_map = $this->get_address_to_blog_map();
|
9972 |
+
|
9973 |
+
$first_blog_id = null;
|
9974 |
+
|
9975 |
+
foreach ( $installs as $install ) {
|
9976 |
+
$address = trailingslashit( fs_strip_url_protocol( $install->url ) );
|
9977 |
+
$blog_id = $address_to_blog_map[ $address ];
|
9978 |
+
|
9979 |
+
$this->_store_site( true, $blog_id, $install );
|
9980 |
+
|
9981 |
+
$this->reset_anonymous_mode( $blog_id );
|
9982 |
+
|
9983 |
+
if ( is_null( $first_blog_id ) ) {
|
9984 |
+
$first_blog_id = $blog_id;
|
9985 |
+
}
|
9986 |
+
}
|
9987 |
+
|
9988 |
+
if ( ! FS_Site::is_valid_id( $this->_storage->network_install_blog_id ) ) {
|
9989 |
+
$this->_storage->network_install_blog_id = $first_blog_id;
|
9990 |
+
}
|
9991 |
+
|
9992 |
+
return true;
|
9993 |
+
}
|
9994 |
+
|
9995 |
+
/**
|
9996 |
+
* Sync site's license with user licenses.
|
9997 |
+
*
|
9998 |
+
* @author Vova Feldman (@svovaf)
|
9999 |
+
* @since 1.0.6
|
10000 |
+
*
|
10001 |
+
* @param FS_Plugin_License|null $new_license
|
10002 |
+
*
|
10003 |
+
* @return FS_Plugin_License|null
|
10004 |
+
*/
|
10005 |
+
function _update_site_license( $new_license ) {
|
10006 |
+
$this->_logger->entrance();
|
10007 |
+
|
10008 |
+
$this->_license = $new_license;
|
10009 |
+
|
10010 |
+
if ( ! is_object( $new_license ) ) {
|
10011 |
+
$this->_site->license_id = null;
|
10012 |
+
$this->_sync_site_subscription( null );
|
10013 |
+
|
10014 |
+
return $this->_license;
|
10015 |
+
}
|
10016 |
+
|
10017 |
+
$this->_site->license_id = $this->_license->id;
|
10018 |
+
|
10019 |
+
if ( ! is_array( $this->_licenses ) ) {
|
10020 |
+
$this->_licenses = array();
|
10021 |
+
}
|
10022 |
+
|
10023 |
+
$is_license_found = false;
|
10024 |
+
for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
|
10025 |
+
if ( $new_license->id == $this->_licenses[ $i ]->id ) {
|
10026 |
+
$this->_licenses[ $i ] = $new_license;
|
10027 |
+
|
10028 |
+
$is_license_found = true;
|
10029 |
+
break;
|
10030 |
+
}
|
10031 |
+
}
|
10032 |
+
|
10033 |
+
// If new license just append.
|
10034 |
+
if ( ! $is_license_found ) {
|
10035 |
+
$this->_licenses[] = $new_license;
|
10036 |
+
}
|
10037 |
+
|
10038 |
+
$this->_sync_site_subscription( $new_license );
|
10039 |
+
|
10040 |
+
return $this->_license;
|
10041 |
+
}
|
10042 |
+
|
10043 |
+
/**
|
10044 |
+
* Sync site's subscription.
|
10045 |
+
*
|
10046 |
+
* @author Vova Feldman (@svovaf)
|
10047 |
+
* @since 1.0.9
|
10048 |
+
*
|
10049 |
+
* @param FS_Plugin_License|null $license
|
10050 |
+
*
|
10051 |
+
* @return bool|\FS_Subscription
|
10052 |
+
*/
|
10053 |
+
private function _sync_site_subscription( $license ) {
|
10054 |
+
if ( ! is_object( $license ) ) {
|
10055 |
+
$this->delete_unused_subscriptions();
|
10056 |
+
|
10057 |
+
return false;
|
10058 |
+
}
|
10059 |
+
|
10060 |
+
// Load subscription details if not lifetime.
|
10061 |
+
$subscription = $license->is_lifetime() ?
|
10062 |
+
false :
|
10063 |
+
$this->_fetch_site_license_subscription();
|
10064 |
+
|
10065 |
+
if ( is_object( $subscription ) && ! isset( $subscription->error ) ) {
|
10066 |
+
$this->store_subscription( $subscription );
|
10067 |
+
} else {
|
10068 |
+
$this->delete_unused_subscriptions();
|
10069 |
+
}
|
10070 |
+
|
10071 |
+
return $subscription;
|
10072 |
+
}
|
10073 |
+
|
10074 |
+
/**
|
10075 |
+
* @author Vova Feldman (@svovaf)
|
10076 |
+
* @since 1.0.6
|
10077 |
+
*
|
10078 |
+
* @return bool|\FS_Plugin_License
|
10079 |
+
*/
|
10080 |
+
function _get_license() {
|
10081 |
+
if ( ! fs_is_network_admin() || is_object( $this->_license ) ) {
|
10082 |
+
return $this->_license;
|
10083 |
+
}
|
10084 |
+
|
10085 |
+
return $this->_get_available_premium_license();
|
10086 |
+
}
|
10087 |
+
|
10088 |
+
/**
|
10089 |
+
* @param number $license_id
|
10090 |
+
*
|
10091 |
+
* @return null|\FS_Subscription
|
10092 |
+
*/
|
10093 |
+
function _get_subscription( $license_id ) {
|
10094 |
+
if ( ! isset( $this->_storage->subscriptions ) ||
|
10095 |
+
empty( $this->_storage->subscriptions )
|
10096 |
+
) {
|
10097 |
+
return null;
|
10098 |
+
}
|
10099 |
+
|
10100 |
+
foreach ( $this->_storage->subscriptions as $subscription ) {
|
10101 |
+
if ( $subscription->license_id == $license_id ) {
|
10102 |
+
return $subscription;
|
10103 |
+
}
|
10104 |
+
}
|
10105 |
+
|
10106 |
+
return null;
|
10107 |
+
}
|
10108 |
+
|
10109 |
+
/**
|
10110 |
+
* @author Leo Fajardo (@leorw)
|
10111 |
+
* @since 2.0.0
|
10112 |
+
*
|
10113 |
+
* @param FS_Subscription $subscription
|
10114 |
+
*/
|
10115 |
+
function store_subscription( FS_Subscription $subscription ) {
|
10116 |
+
if ( ! isset( $this->_storage->subscriptions ) ) {
|
10117 |
+
$this->_storage->subscriptions = array();
|
10118 |
+
}
|
10119 |
+
|
10120 |
+
if ( empty( $this->_storage->subscriptions ) || ! is_multisite() ) {
|
10121 |
+
$this->_storage->subscriptions = array( $subscription );
|
10122 |
+
|
10123 |
+
return;
|
10124 |
+
}
|
10125 |
+
|
10126 |
+
$subscriptions = $this->_storage->subscriptions;
|
10127 |
+
|
10128 |
+
$updated_subscription = false;
|
10129 |
+
foreach ( $subscriptions as $key => $existing_subscription ) {
|
10130 |
+
if ( $existing_subscription->id == $subscription->id ) {
|
10131 |
+
$subscriptions[ $key ] = $subscription;
|
10132 |
+
$updated_subscription = true;
|
10133 |
+
break;
|
10134 |
+
}
|
10135 |
+
}
|
10136 |
+
|
10137 |
+
if ( ! $updated_subscription ) {
|
10138 |
+
$subscriptions[] = $subscription;
|
10139 |
+
}
|
10140 |
+
|
10141 |
+
$this->_storage->subscriptions = $subscriptions;
|
10142 |
+
}
|
10143 |
+
|
10144 |
+
/**
|
10145 |
+
* @author Leo Fajardo (@leorw)
|
10146 |
+
* @since 2.0.0
|
10147 |
+
*/
|
10148 |
+
function delete_unused_subscriptions() {
|
10149 |
+
if ( ! isset( $this->_storage->subscriptions ) ||
|
10150 |
+
empty( $this->_storage->subscriptions ) ||
|
10151 |
+
// Clean up only if there are already at least 3 subscriptions.
|
10152 |
+
( count( $this->_storage->subscriptions ) < 3 )
|
10153 |
+
) {
|
10154 |
+
return;
|
10155 |
+
}
|
10156 |
+
|
10157 |
+
if ( ! is_multisite() ) {
|
10158 |
+
// If not multisite, there should only be 1 subscription, so just clear the array.
|
10159 |
+
$this->_storage->subscriptions = array();
|
10160 |
+
|
10161 |
+
return;
|
10162 |
+
}
|
10163 |
+
|
10164 |
+
$subscriptions_to_keep_by_license_id_map = array();
|
10165 |
+
$sites = self::get_sites();
|
10166 |
+
foreach ( $sites as $site ) {
|
10167 |
+
$blog_id = self::get_site_blog_id( $site );
|
10168 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
10169 |
+
|
10170 |
+
if ( ! is_object( $install ) ||
|
10171 |
+
! FS_Plugin_License::is_valid_id( $install->license_id )
|
10172 |
+
) {
|
10173 |
+
continue;
|
10174 |
+
}
|
10175 |
+
|
10176 |
+
$subscriptions_to_keep_by_license_id_map[ $install->license_id ] = true;
|
10177 |
+
}
|
10178 |
+
|
10179 |
+
if ( empty( $subscriptions_to_keep_by_license_id_map ) ) {
|
10180 |
+
$this->_storage->subscriptions = array();
|
10181 |
+
|
10182 |
+
return;
|
10183 |
+
}
|
10184 |
+
|
10185 |
+
foreach ( $this->_storage->subscriptions as $key => $subscription ) {
|
10186 |
+
if ( ! isset( $subscriptions_to_keep_by_license_id_map[ $subscription->license_id ] ) ) {
|
10187 |
+
unset( $this->_storage->subscriptions[ $key ] );
|
10188 |
+
}
|
10189 |
+
}
|
10190 |
+
}
|
10191 |
+
|
10192 |
+
/**
|
10193 |
+
* @author Vova Feldman (@svovaf)
|
10194 |
+
* @since 1.0.2
|
10195 |
+
*
|
10196 |
+
* @param string $plan Plan name
|
10197 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
10198 |
+
*
|
10199 |
+
* @return bool
|
10200 |
+
*/
|
10201 |
+
function is_plan( $plan, $exact = false ) {
|
10202 |
+
$this->_logger->entrance();
|
10203 |
+
|
10204 |
+
if ( ! $this->is_registered() ) {
|
10205 |
+
return false;
|
10206 |
+
}
|
10207 |
+
|
10208 |
+
$plan = strtolower( $plan );
|
10209 |
+
|
10210 |
+
$current_plan_name = $this->get_plan_name();
|
10211 |
+
|
10212 |
+
if ( $current_plan_name === $plan ) {
|
10213 |
+
// Exact plan.
|
10214 |
+
return true;
|
10215 |
+
} else if ( $exact ) {
|
10216 |
+
// Required exact, but plans are different.
|
10217 |
+
return false;
|
10218 |
+
}
|
10219 |
+
|
10220 |
+
$current_plan_order = - 1;
|
10221 |
+
$required_plan_order = - 1;
|
10222 |
+
for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
|
10223 |
+
if ( $plan === $this->_plans[ $i ]->name ) {
|
10224 |
+
$required_plan_order = $i;
|
10225 |
+
} else if ( $current_plan_name === $this->_plans[ $i ]->name ) {
|
10226 |
+
$current_plan_order = $i;
|
10227 |
+
}
|
10228 |
+
}
|
10229 |
+
|
10230 |
+
return ( $current_plan_order > $required_plan_order );
|
10231 |
+
}
|
10232 |
+
|
10233 |
+
/**
|
10234 |
+
* Check if module has only one plan.
|
10235 |
+
*
|
10236 |
+
* @author Vova Feldman (@svovaf)
|
10237 |
+
* @since 1.2.1.7
|
10238 |
+
*
|
10239 |
+
* @return bool
|
10240 |
+
*/
|
10241 |
+
function is_single_plan() {
|
10242 |
+
$this->_logger->entrance();
|
10243 |
+
|
10244 |
+
if ( ! $this->is_registered() ||
|
10245 |
+
! is_array( $this->_plans ) ||
|
10246 |
+
0 === count( $this->_plans )
|
10247 |
+
) {
|
10248 |
+
return true;
|
10249 |
+
}
|
10250 |
+
|
10251 |
+
return ( 1 === count( $this->_plans ) );
|
10252 |
+
}
|
10253 |
+
|
10254 |
+
/**
|
10255 |
+
* Check if plan based on trial. If not in trial mode, should return false.
|
10256 |
+
*
|
10257 |
+
* @since 1.0.9
|
10258 |
+
*
|
10259 |
+
* @param string $plan Plan name
|
10260 |
+
* @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
|
10261 |
+
*
|
10262 |
+
* @return bool
|
10263 |
+
*/
|
10264 |
+
function is_trial_plan( $plan, $exact = false ) {
|
10265 |
+
$this->_logger->entrance();
|
10266 |
+
|
10267 |
+
if ( ! $this->is_registered() ) {
|
10268 |
+
return false;
|
10269 |
+
}
|
10270 |
+
|
10271 |
+
if ( ! $this->is_trial() ) {
|
10272 |
+
return false;
|
10273 |
+
}
|
10274 |
+
|
10275 |
+
$trial_plan = $this->get_trial_plan();
|
10276 |
+
|
10277 |
+
if ( $trial_plan->name === $plan ) {
|
10278 |
+
// Exact plan.
|
10279 |
+
return true;
|
10280 |
+
} else if ( $exact ) {
|
10281 |
+
// Required exact, but plans are different.
|
10282 |
+
return false;
|
10283 |
+
}
|
10284 |
+
|
10285 |
+
$current_plan_order = - 1;
|
10286 |
+
$required_plan_order = - 1;
|
10287 |
+
for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
|
10288 |
+
if ( $plan === $this->_plans[ $i ]->name ) {
|
10289 |
+
$required_plan_order = $i;
|
10290 |
+
} else if ( $trial_plan->name === $this->_plans[ $i ]->name ) {
|
10291 |
+
$current_plan_order = $i;
|
10292 |
+
}
|
10293 |
+
}
|
10294 |
+
|
10295 |
+
return ( $current_plan_order > $required_plan_order );
|
10296 |
+
}
|
10297 |
+
|
10298 |
+
/**
|
10299 |
+
* Check if plugin has any paid plans.
|
10300 |
+
*
|
10301 |
+
* @author Vova Feldman (@svovaf)
|
10302 |
+
* @since 1.0.7
|
10303 |
+
*
|
10304 |
+
* @return bool
|
10305 |
+
*/
|
10306 |
+
function has_paid_plan() {
|
10307 |
+
return $this->_has_paid_plans ||
|
10308 |
+
FS_Plan_Manager::instance()->has_paid_plan( $this->_plans );
|
10309 |
+
}
|
10310 |
+
|
10311 |
+
/**
|
10312 |
+
* Check if plugin has any plan with a trail.
|
10313 |
+
*
|
10314 |
+
* @author Vova Feldman (@svovaf)
|
10315 |
+
* @since 1.0.9
|
10316 |
+
*
|
10317 |
+
* @return bool
|
10318 |
+
*/
|
10319 |
+
function has_trial_plan() {
|
10320 |
+
/**
|
10321 |
+
* @author Vova Feldman(@svovaf)
|
10322 |
+
* @since 1.2.1.5
|
10323 |
+
*
|
10324 |
+
* Allow setting a trial from the SDK without calling the API.
|
10325 |
+
* But, if the user did opt-in, continue using the real data from the API.
|
10326 |
+
*/
|
10327 |
+
if ( $this->_trial_days >= 0 ) {
|
10328 |
+
return true;
|
10329 |
+
}
|
10330 |
+
|
10331 |
+
return $this->_storage->get( 'has_trial_plan', false );
|
10332 |
+
}
|
10333 |
+
|
10334 |
+
/**
|
10335 |
+
* Check if plugin has any free plan, or is it premium only.
|
10336 |
+
*
|
10337 |
+
* Note: If no plans configured, assume plugin is free.
|
10338 |
+
*
|
10339 |
+
* @author Vova Feldman (@svovaf)
|
10340 |
+
* @since 1.0.7
|
10341 |
+
*
|
10342 |
+
* @return bool
|
10343 |
+
*/
|
10344 |
+
function has_free_plan() {
|
10345 |
+
return ! $this->is_only_premium();
|
10346 |
+
}
|
10347 |
+
|
10348 |
+
/**
|
10349 |
+
* Displays a license activation dialog box when the user clicks on the "Activate License"
|
10350 |
+
* or "Change License" link on the plugins
|
10351 |
+
* page.
|
10352 |
+
*
|
10353 |
+
* @author Leo Fajardo (@leorw)
|
10354 |
+
* @since 1.1.9
|
10355 |
+
*/
|
10356 |
+
function _add_license_activation_dialog_box() {
|
10357 |
+
$vars = array(
|
10358 |
+
'id' => $this->_module_id,
|
10359 |
+
);
|
10360 |
+
|
10361 |
+
fs_require_template( 'forms/license-activation.php', $vars );
|
10362 |
+
fs_require_template( 'forms/resend-key.php', $vars );
|
10363 |
+
}
|
10364 |
+
|
10365 |
+
/**
|
10366 |
+
* Displays the opt-out dialog box when the user clicks on the "Opt Out" link on the "Plugins"
|
10367 |
+
* page.
|
10368 |
+
*
|
10369 |
+
* @author Leo Fajardo (@leorw)
|
10370 |
+
* @since 1.2.1.5
|
10371 |
+
*/
|
10372 |
+
function _add_optout_dialog() {
|
10373 |
+
if ( $this->is_theme() ) {
|
10374 |
+
$vars = null;
|
10375 |
+
fs_require_once_template( '/js/jquery.content-change.php', $vars );
|
10376 |
+
}
|
10377 |
+
|
10378 |
+
$vars = array( 'id' => $this->_module_id );
|
10379 |
+
fs_require_template( 'forms/optout.php', $vars );
|
10380 |
+
}
|
10381 |
+
|
10382 |
+
/**
|
10383 |
+
* Prepare page to include all required UI and logic for the license activation dialog.
|
10384 |
+
*
|
10385 |
+
* @author Vova Feldman (@svovaf)
|
10386 |
+
* @since 1.2.0
|
10387 |
+
*/
|
10388 |
+
function _add_license_activation() {
|
10389 |
+
if ( ! $this->is_user_admin() ) {
|
10390 |
+
// Only admins can activate a license.
|
10391 |
+
return;
|
10392 |
+
}
|
10393 |
+
|
10394 |
+
if ( ! $this->has_paid_plan() ) {
|
10395 |
+
// Module doesn't have any paid plans.
|
10396 |
+
return;
|
10397 |
+
}
|
10398 |
+
|
10399 |
+
if ( ! $this->is_premium() ) {
|
10400 |
+
// Only add license activation logic to the premium version.
|
10401 |
+
return;
|
10402 |
+
}
|
10403 |
+
|
10404 |
+
// Add license activation link and AJAX request handler.
|
10405 |
+
if ( self::is_plugins_page() ) {
|
10406 |
+
/**
|
10407 |
+
* @since 1.2.0 Add license action link only on plugins page.
|
10408 |
+
*/
|
10409 |
+
$this->_add_license_action_link();
|
10410 |
+
}
|
10411 |
+
|
10412 |
+
// Add license activation AJAX callback.
|
10413 |
+
$this->add_ajax_action( 'activate_license', array( &$this, '_activate_license_ajax_action' ) );
|
10414 |
+
|
10415 |
+
// Add resend license AJAX callback.
|
10416 |
+
$this->add_ajax_action( 'resend_license_key', array( &$this, '_resend_license_key_ajax_action' ) );
|
10417 |
+
}
|
10418 |
+
|
10419 |
+
/**
|
10420 |
+
* @author Leo Fajardo (@leorw)
|
10421 |
+
*
|
10422 |
+
* @since 1.1.9
|
10423 |
+
* @since 2.0.0 When a super-admin that hasn't connected before is network activating a license and excluding some of the sites for the license activation, go over the unselected sites in the network and if a site is not connected, skipped, nor delegated, if it's a freemium product then just skip the connection for the site, if it's a premium only product, delegate the connection and license activation to the site admin (Vova Feldman @svovaf).
|
10424 |
+
*/
|
10425 |
+
function _activate_license_ajax_action() {
|
10426 |
+
$this->_logger->entrance();
|
10427 |
+
|
10428 |
+
$this->check_ajax_referer( 'activate_license' );
|
10429 |
+
|
10430 |
+
$license_key = trim( fs_request_get( 'license_key' ) );
|
10431 |
+
|
10432 |
+
if ( empty( $license_key ) ) {
|
10433 |
+
exit;
|
10434 |
+
}
|
10435 |
+
|
10436 |
+
$plugin_id = fs_request_get( 'module_id', '', 'post' );
|
10437 |
+
$fs = ( $plugin_id == $this->_module_id ) ?
|
10438 |
+
$this :
|
10439 |
+
$this->get_addon_instance( $plugin_id );
|
10440 |
+
|
10441 |
+
$error = false;
|
10442 |
+
$next_page = false;
|
10443 |
+
|
10444 |
+
$sites = fs_is_network_admin() ?
|
10445 |
+
fs_request_get( 'sites', array(), 'post' ) :
|
10446 |
+
array();
|
10447 |
+
|
10448 |
+
$blog_id = fs_request_get( 'blog_id' );
|
10449 |
+
$has_valid_blog_id = is_numeric( $blog_id );
|
10450 |
+
|
10451 |
+
if ( $fs->is_registered() ) {
|
10452 |
+
if ( fs_is_network_admin() && ! $has_valid_blog_id ) {
|
10453 |
+
// If no specific blog ID was provided, activate the license for all sites in the network.
|
10454 |
+
$blog_2_install_map = array();
|
10455 |
+
$site_ids = array();
|
10456 |
+
|
10457 |
+
foreach ( $sites as $site ) {
|
10458 |
+
if ( ! isset( $site['blog_id'] ) || ! is_numeric( $site['blog_id'] ) ) {
|
10459 |
+
continue;
|
10460 |
+
}
|
10461 |
+
|
10462 |
+
$install = $this->get_install_by_blog_id( $site['blog_id'] );
|
10463 |
+
|
10464 |
+
if ( is_object( $install ) ) {
|
10465 |
+
$blog_2_install_map[ $site['blog_id'] ] = $install;
|
10466 |
+
} else {
|
10467 |
+
$site_ids[] = $site['blog_id'];
|
10468 |
+
}
|
10469 |
+
}
|
10470 |
+
|
10471 |
+
$user = $this->get_current_or_network_user();
|
10472 |
+
|
10473 |
+
if ( ! empty( $blog_2_install_map ) ) {
|
10474 |
+
$result = $this->activate_license_on_many_installs( $user, $license_key, $blog_2_install_map );
|
10475 |
+
|
10476 |
+
if ( true !== $result ) {
|
10477 |
+
$error = FS_Api::is_api_error_object( $result ) ?
|
10478 |
+
$result->error->message :
|
10479 |
+
var_export( $result, true );
|
10480 |
+
}
|
10481 |
+
}
|
10482 |
+
|
10483 |
+
if ( empty( $error ) && ! empty( $site_ids ) ) {
|
10484 |
+
$result = $this->activate_license_on_many_sites( $user, $license_key, $site_ids );
|
10485 |
+
|
10486 |
+
if ( true !== $result ) {
|
10487 |
+
$error = FS_Api::is_api_error_object( $result ) ?
|
10488 |
+
$result->error->message :
|
10489 |
+
var_export( $result, true );
|
10490 |
+
}
|
10491 |
+
}
|
10492 |
+
} else {
|
10493 |
+
if ( $has_valid_blog_id ) {
|
10494 |
+
/**
|
10495 |
+
* If a specific blog ID was provided, activate the license only for the install that is
|
10496 |
+
* associated with the given blog ID.
|
10497 |
+
*
|
10498 |
+
* @author Leo Fajardo (@leorw)
|
10499 |
+
*/
|
10500 |
+
$this->switch_to_blog( $blog_id );
|
10501 |
+
}
|
10502 |
+
|
10503 |
+
$api = $fs->get_api_site_scope();
|
10504 |
+
|
10505 |
+
$params = array(
|
10506 |
+
'license_key' => $fs->apply_filters( 'license_key', $license_key )
|
10507 |
+
);
|
10508 |
+
|
10509 |
+
$install = $api->call( '/', 'put', $params );
|
10510 |
+
|
10511 |
+
if ( FS_Api::is_api_error( $install ) ) {
|
10512 |
+
$error = FS_Api::is_api_error_object( $install ) ?
|
10513 |
+
$install->error->message :
|
10514 |
+
var_export( $install->error, true );
|
10515 |
+
} else {
|
10516 |
+
$fs->reconnect_locally( $has_valid_blog_id );
|
10517 |
+
}
|
10518 |
+
}
|
10519 |
+
|
10520 |
+
if ( empty( $error ) ) {
|
10521 |
+
$this->network_upgrade_mode_completed();
|
10522 |
+
|
10523 |
+
$fs->_sync_license( true, $has_valid_blog_id );
|
10524 |
+
|
10525 |
+
$next_page = $fs->is_addon() ?
|
10526 |
+
$fs->get_parent_instance()->get_account_url() :
|
10527 |
+
$fs->get_account_url();
|
10528 |
+
}
|
10529 |
+
} else {
|
10530 |
+
$next_page = $fs->opt_in(
|
10531 |
+
false,
|
10532 |
+
false,
|
10533 |
+
false,
|
10534 |
+
$license_key,
|
10535 |
+
false,
|
10536 |
+
false,
|
10537 |
+
false,
|
10538 |
+
$sites
|
10539 |
+
);
|
10540 |
+
|
10541 |
+
if ( isset( $next_page->error ) ) {
|
10542 |
+
$error = $next_page->error;
|
10543 |
+
} else {
|
10544 |
+
if ( fs_is_network_admin() ) {
|
10545 |
+
/**
|
10546 |
+
* Get the list of sites that were just opted-in (and license activated).
|
10547 |
+
* This is an optimization for the next part below saving some DB queries.
|
10548 |
+
*/
|
10549 |
+
$connected_sites = array();
|
10550 |
+
foreach ( $sites as $site ) {
|
10551 |
+
if ( isset( $site['blog_id'] ) && is_numeric( $site['blog_id'] ) ) {
|
10552 |
+
$connected_sites[ $site['blog_id'] ] = true;
|
10553 |
+
}
|
10554 |
+
}
|
10555 |
+
|
10556 |
+
$all_sites = self::get_sites();
|
10557 |
+
$pending_sites = array();
|
10558 |
+
|
10559 |
+
/**
|
10560 |
+
* Check if there are any sites that are not connected, skipped, nor delegated. For every site that falls into that category, if the product is freemium, skip the connection. If the product is premium only, delegate the connection to the site administrator.
|
10561 |
+
*
|
10562 |
+
* @author Vova Feldman (@svovaf)
|
10563 |
+
*/
|
10564 |
+
foreach ( $all_sites as $site ) {
|
10565 |
+
$blog_id = self::get_site_blog_id( $site );
|
10566 |
+
|
10567 |
+
if ( isset( $connected_sites[ $blog_id ] ) ) {
|
10568 |
+
// Site was just connected.
|
10569 |
+
continue;
|
10570 |
+
}
|
10571 |
+
|
10572 |
+
if ( $this->is_installed_on_site( $blog_id ) ) {
|
10573 |
+
// Site was already connected before.
|
10574 |
+
continue;
|
10575 |
+
}
|
10576 |
+
|
10577 |
+
if ( $this->is_site_delegated_connection( $blog_id ) ) {
|
10578 |
+
// Site's connection was delegated.
|
10579 |
+
continue;
|
10580 |
+
}
|
10581 |
+
|
10582 |
+
if ( $this->is_anonymous_site( $blog_id ) ) {
|
10583 |
+
// Site connection was already skipped.
|
10584 |
+
continue;
|
10585 |
+
}
|
10586 |
+
|
10587 |
+
$pending_sites[] = self::get_site_info( $site );
|
10588 |
+
}
|
10589 |
+
|
10590 |
+
if ( ! empty( $pending_sites ) ) {
|
10591 |
+
if ( $this->is_freemium() ) {
|
10592 |
+
$this->skip_connection( $pending_sites );
|
10593 |
+
} else {
|
10594 |
+
$this->delegate_connection( $pending_sites );
|
10595 |
+
}
|
10596 |
+
}
|
10597 |
+
}
|
10598 |
+
}
|
10599 |
+
}
|
10600 |
+
|
10601 |
+
$result = array(
|
10602 |
+
'success' => ( false === $error )
|
10603 |
+
);
|
10604 |
+
|
10605 |
+
if ( false !== $error ) {
|
10606 |
+
$result['error'] = $error;
|
10607 |
+
} else {
|
10608 |
+
$result['next_page'] = $next_page;
|
10609 |
+
}
|
10610 |
+
|
10611 |
+
echo json_encode( $result );
|
10612 |
+
|
10613 |
+
exit;
|
10614 |
+
}
|
10615 |
+
|
10616 |
+
/**
|
10617 |
+
* @author Leo Fajardo (@leorw)
|
10618 |
+
* @since 1.2.3.1
|
10619 |
+
*/
|
10620 |
+
function _network_activate_ajax_action() {
|
10621 |
+
$this->_logger->entrance();
|
10622 |
+
|
10623 |
+
$this->check_ajax_referer( 'network_activate' );
|
10624 |
+
|
10625 |
+
$plugin_id = fs_request_get( 'module_id', '', 'post' );
|
10626 |
+
$fs = ( $plugin_id == $this->_module_id ) ?
|
10627 |
+
$this :
|
10628 |
+
$this->get_addon_instance( $plugin_id );
|
10629 |
+
|
10630 |
+
$error = false;
|
10631 |
+
|
10632 |
+
$sites = fs_request_get( 'sites', array(), 'post' );
|
10633 |
+
if ( is_array( $sites ) && ! empty( $sites ) ) {
|
10634 |
+
$sites_by_action = array(
|
10635 |
+
'allow' => array(),
|
10636 |
+
'delegate' => array(),
|
10637 |
+
'skip' => array()
|
10638 |
+
);
|
10639 |
+
|
10640 |
+
foreach ( $sites as $site ) {
|
10641 |
+
$sites_by_action[ $site['action'] ][] = $site;
|
10642 |
+
}
|
10643 |
+
|
10644 |
+
$total_sites = count( $sites );
|
10645 |
+
$total_sites_to_delegate = count( $sites_by_action['delegate'] );
|
10646 |
+
|
10647 |
+
$next_page = '';
|
10648 |
+
if ( $total_sites === $total_sites_to_delegate &&
|
10649 |
+
! $this->is_network_upgrade_mode()
|
10650 |
+
) {
|
10651 |
+
$this->delegate_connection();
|
10652 |
+
} else {
|
10653 |
+
if ( ! empty( $sites_by_action['delegate'] ) ) {
|
10654 |
+
$this->delegate_connection( $sites_by_action['delegate'] );
|
10655 |
+
}
|
10656 |
+
|
10657 |
+
if ( ! empty( $sites_by_action['skip'] ) ) {
|
10658 |
+
$this->skip_connection( $sites_by_action['skip'] );
|
10659 |
+
}
|
10660 |
+
|
10661 |
+
if ( ! empty( $sites_by_action['allow'] ) ) {
|
10662 |
+
if ( ! $fs->is_registered() || ! $this->_is_network_active ) {
|
10663 |
+
$next_page = $fs->opt_in(
|
10664 |
+
false,
|
10665 |
+
false,
|
10666 |
+
false,
|
10667 |
+
false,
|
10668 |
+
false,
|
10669 |
+
false,
|
10670 |
+
false,
|
10671 |
+
$sites_by_action['allow']
|
10672 |
+
);
|
10673 |
+
} else {
|
10674 |
+
$next_page = $fs->install_with_user(
|
10675 |
+
$this->get_network_user(),
|
10676 |
+
false,
|
10677 |
+
false,
|
10678 |
+
false,
|
10679 |
+
true,
|
10680 |
+
$sites_by_action['allow']
|
10681 |
+
);
|
10682 |
+
}
|
10683 |
+
|
10684 |
+
if ( is_object( $next_page ) && isset( $next_page->error ) ) {
|
10685 |
+
$error = $next_page->error;
|
10686 |
+
}
|
10687 |
+
}
|
10688 |
+
}
|
10689 |
+
|
10690 |
+
if ( empty( $next_page ) ) {
|
10691 |
+
$next_page = $this->get_after_activation_url( 'after_network_activation_url' );
|
10692 |
+
}
|
10693 |
+
} else {
|
10694 |
+
$error = $this->get_text_inline( 'invalid_site_details_collection', 'Invalid site details collection.' );
|
10695 |
+
}
|
10696 |
+
|
10697 |
+
$result = array(
|
10698 |
+
'success' => ( false === $error )
|
10699 |
+
);
|
10700 |
+
|
10701 |
+
if ( false !== $error ) {
|
10702 |
+
$result['error'] = $error;
|
10703 |
+
} else {
|
10704 |
+
$result['next_page'] = $next_page;
|
10705 |
+
}
|
10706 |
+
|
10707 |
+
echo json_encode( $result );
|
10708 |
+
|
10709 |
+
exit;
|
10710 |
+
}
|
10711 |
+
|
10712 |
+
/**
|
10713 |
+
* Billing update AJAX callback.
|
10714 |
+
*
|
10715 |
+
* @author Vova Feldman (@svovaf)
|
10716 |
+
* @since 1.2.1.5
|
10717 |
+
*/
|
10718 |
+
function _update_billing_ajax_action() {
|
10719 |
+
$this->_logger->entrance();
|
10720 |
+
|
10721 |
+
$this->check_ajax_referer( 'update_billing' );
|
10722 |
+
|
10723 |
+
if ( ! $this->is_user_admin() ) {
|
10724 |
+
// Only for admins.
|
10725 |
+
self::shoot_ajax_failure();
|
10726 |
+
}
|
10727 |
+
|
10728 |
+
$billing = fs_request_get( 'billing' );
|
10729 |
+
|
10730 |
+
$api = $this->get_api_user_scope();
|
10731 |
+
$result = $api->call( '/billing.json', 'put', array_merge( $billing, array(
|
10732 |
+
'plugin_id' => $this->get_parent_id(),
|
10733 |
+
) ) );
|
10734 |
+
|
10735 |
+
if ( ! $this->is_api_result_entity( $result ) ) {
|
10736 |
+
self::shoot_ajax_failure();
|
10737 |
+
}
|
10738 |
+
|
10739 |
+
// Purge cached billing.
|
10740 |
+
$this->get_api_user_scope()->purge_cache( 'billing.json' );
|
10741 |
+
|
10742 |
+
self::shoot_ajax_success();
|
10743 |
+
}
|
10744 |
+
|
10745 |
+
/**
|
10746 |
+
* Trial start for anonymous users (AJAX callback).
|
10747 |
+
*
|
10748 |
+
* @author Vova Feldman (@svovaf)
|
10749 |
+
* @since 1.2.1.5
|
10750 |
+
*/
|
10751 |
+
function _start_trial_ajax_action() {
|
10752 |
+
$this->_logger->entrance();
|
10753 |
+
|
10754 |
+
$this->check_ajax_referer( 'start_trial' );
|
10755 |
+
|
10756 |
+
if ( ! $this->is_user_admin() ) {
|
10757 |
+
// Only for admins.
|
10758 |
+
self::shoot_ajax_failure();
|
10759 |
+
}
|
10760 |
+
|
10761 |
+
$trial_data = fs_request_get( 'trial' );
|
10762 |
+
|
10763 |
+
$next_page = $this->opt_in(
|
10764 |
+
false,
|
10765 |
+
false,
|
10766 |
+
false,
|
10767 |
+
false,
|
10768 |
+
false,
|
10769 |
+
$trial_data['plan_id']
|
10770 |
+
);
|
10771 |
+
|
10772 |
+
if ( is_object( $next_page ) && $this->is_api_error( $next_page ) ) {
|
10773 |
+
self::shoot_ajax_failure(
|
10774 |
+
isset( $next_page->error ) ?
|
10775 |
+
$next_page->error->message :
|
10776 |
+
var_export( $next_page, true )
|
10777 |
+
);
|
10778 |
+
}
|
10779 |
+
|
10780 |
+
$this->shoot_ajax_success( array(
|
10781 |
+
'next_page' => $next_page,
|
10782 |
+
) );
|
10783 |
+
}
|
10784 |
+
|
10785 |
+
/**
|
10786 |
+
* @author Leo Fajardo (@leorw)
|
10787 |
+
* @since 1.2.0
|
10788 |
+
*/
|
10789 |
+
function _resend_license_key_ajax_action() {
|
10790 |
+
$this->_logger->entrance();
|
10791 |
+
|
10792 |
+
$this->check_ajax_referer( 'resend_license_key' );
|
10793 |
+
|
10794 |
+
$email_address = sanitize_email( trim( fs_request_get( 'email', '', 'post' ) ) );
|
10795 |
+
|
10796 |
+
if ( empty( $email_address ) ) {
|
10797 |
+
exit;
|
10798 |
+
}
|
10799 |
+
|
10800 |
+
$error = false;
|
10801 |
+
|
10802 |
+
$api = $this->get_api_plugin_scope();
|
10803 |
+
$result = $api->call( '/licenses/resend.json', 'post',
|
10804 |
+
array(
|
10805 |
+
'email' => $email_address,
|
10806 |
+
'url' => home_url(),
|
10807 |
+
)
|
10808 |
+
);
|
10809 |
+
|
10810 |
+
if ( is_object( $result ) && isset( $result->error ) ) {
|
10811 |
+
$error = $result->error;
|
10812 |
+
|
10813 |
+
if ( in_array( $error->code, array( 'invalid_email', 'no_user' ) ) ) {
|
10814 |
+
$error = $this->get_text_inline( "We couldn't find your email address in the system, are you sure it's the right address?", 'email-not-found' );
|
10815 |
+
} else if ( 'no_license' === $error->code ) {
|
10816 |
+
$error = $this->get_text_inline( "We can't see any active licenses associated with that email address, are you sure it's the right address?", 'no-active-licenses' );
|
10817 |
+
} else {
|
10818 |
+
$error = $error->message;
|
10819 |
+
}
|
10820 |
+
}
|
10821 |
+
|
10822 |
+
$licenses = array(
|
10823 |
+
'success' => ( false === $error )
|
10824 |
+
);
|
10825 |
+
|
10826 |
+
if ( false !== $error ) {
|
10827 |
+
$licenses['error'] = sprintf( '%s... %s', $this->get_text_x_inline( 'Oops', 'exclamation', 'oops' ), strtolower( $error ) );
|
10828 |
+
}
|
10829 |
+
|
10830 |
+
echo json_encode( $licenses );
|
10831 |
+
|
10832 |
+
exit;
|
10833 |
+
}
|
10834 |
+
|
10835 |
+
/**
|
10836 |
+
* @author Vova Feldman (@svovaf)
|
10837 |
+
* @since 1.2.1.8
|
10838 |
+
*
|
10839 |
+
* @var string
|
10840 |
+
*/
|
10841 |
+
private static $_pagenow;
|
10842 |
+
|
10843 |
+
/**
|
10844 |
+
* Get current page or the referer if executing a WP AJAX request.
|
10845 |
+
*
|
10846 |
+
* @author Vova Feldman (@svovaf)
|
10847 |
+
* @since 1.2.1.8
|
10848 |
+
*
|
10849 |
+
* @return string
|
10850 |
+
*/
|
10851 |
+
static function get_current_page() {
|
10852 |
+
if ( ! isset( self::$_pagenow ) ) {
|
10853 |
+
global $pagenow;
|
10854 |
+
|
10855 |
+
self::$_pagenow = $pagenow;
|
10856 |
+
|
10857 |
+
if ( self::is_ajax() &&
|
10858 |
+
'admin-ajax.php' === $pagenow
|
10859 |
+
) {
|
10860 |
+
$referer = fs_get_raw_referer();
|
10861 |
+
|
10862 |
+
if ( is_string( $referer ) ) {
|
10863 |
+
$parts = explode( '?', $referer );
|
10864 |
+
|
10865 |
+
self::$_pagenow = basename( $parts[0] );
|
10866 |
+
}
|
10867 |
+
}
|
10868 |
+
}
|
10869 |
+
|
10870 |
+
return self::$_pagenow;
|
10871 |
+
}
|
10872 |
+
|
10873 |
+
/**
|
10874 |
+
* Helper method to check if user in the plugins page.
|
10875 |
+
*
|
10876 |
+
* @author Vova Feldman (@svovaf)
|
10877 |
+
* @since 1.2.1.5
|
10878 |
+
*
|
10879 |
+
* @return bool
|
10880 |
+
*/
|
10881 |
+
static function is_plugins_page() {
|
10882 |
+
return ( 'plugins.php' === self::get_current_page() );
|
10883 |
+
}
|
10884 |
+
|
10885 |
+
/**
|
10886 |
+
* Helper method to check if user in the themes page.
|
10887 |
+
*
|
10888 |
+
* @author Vova Feldman (@svovaf)
|
10889 |
+
* @since 1.2.2.6
|
10890 |
+
*
|
10891 |
+
* @return bool
|
10892 |
+
*/
|
10893 |
+
static function is_themes_page() {
|
10894 |
+
return ( 'themes.php' === self::get_current_page() );
|
10895 |
+
}
|
10896 |
+
|
10897 |
+
#----------------------------------------------------------------------------------
|
10898 |
+
#region Affiliation
|
10899 |
+
#----------------------------------------------------------------------------------
|
10900 |
+
|
10901 |
+
/**
|
10902 |
+
* @author Leo Fajardo (@leorw)
|
10903 |
+
* @since 1.2.3
|
10904 |
+
*
|
10905 |
+
* @return bool
|
10906 |
+
*/
|
10907 |
+
function has_affiliate_program() {
|
10908 |
+
if ( ! is_object( $this->_plugin ) ) {
|
10909 |
+
return false;
|
10910 |
+
}
|
10911 |
+
|
10912 |
+
return $this->_plugin->has_affiliate_program();
|
10913 |
+
}
|
10914 |
+
|
10915 |
+
/**
|
10916 |
+
* @author Leo Fajardo (@leorw)
|
10917 |
+
* @since 1.2.4
|
10918 |
+
*/
|
10919 |
+
private function fetch_affiliate_terms() {
|
10920 |
+
if ( ! is_object( $this->plugin_affiliate_terms ) ) {
|
10921 |
+
$plugins_api = $this->get_api_plugin_scope();
|
10922 |
+
$affiliate_terms = $plugins_api->get( '/aff.json?type=affiliation', false );
|
10923 |
+
|
10924 |
+
if ( ! $this->is_api_result_entity( $affiliate_terms ) ) {
|
10925 |
+
return;
|
10926 |
+
}
|
10927 |
+
|
10928 |
+
$this->plugin_affiliate_terms = new FS_AffiliateTerms( $affiliate_terms );
|
10929 |
+
}
|
10930 |
+
}
|
10931 |
+
|
10932 |
+
/**
|
10933 |
+
* @author Leo Fajardo (@leorw)
|
10934 |
+
* @since 1.2.4
|
10935 |
+
*/
|
10936 |
+
private function fetch_affiliate_and_custom_terms() {
|
10937 |
+
if ( ! empty( $this->_storage->affiliate_application_data ) ) {
|
10938 |
+
$application_data = $this->_storage->affiliate_application_data;
|
10939 |
+
$flush = ( ! isset( $application_data['status'] ) || 'pending' === $application_data['status'] );
|
10940 |
+
|
10941 |
+
$users_api = $this->get_api_user_scope();
|
10942 |
+
$result = $users_api->get( "/plugins/{$this->_plugin->id}/aff/{$this->plugin_affiliate_terms->id}/affiliates.json", $flush );
|
10943 |
+
if ( $this->is_api_result_object( $result, 'affiliates' ) ) {
|
10944 |
+
if ( ! empty( $result->affiliates ) ) {
|
10945 |
+
$affiliate = new FS_Affiliate( $result->affiliates[0] );
|
10946 |
+
|
10947 |
+
if ( ! isset( $application_data['status'] ) || $application_data['status'] !== $affiliate->status ) {
|
10948 |
+
$application_data['status'] = $affiliate->status;
|
10949 |
+
$this->_storage->affiliate_application_data = $application_data;
|
10950 |
+
}
|
10951 |
+
|
10952 |
+
if ( $affiliate->is_using_custom_terms ) {
|
10953 |
+
$affiliate_terms = $users_api->get( "/plugins/{$this->_plugin->id}/affiliates/{$affiliate->id}/aff/{$affiliate->custom_affiliate_terms_id}.json", $flush );
|
10954 |
+
if ( $this->is_api_result_entity( $affiliate_terms ) ) {
|
10955 |
+
$this->custom_affiliate_terms = new FS_AffiliateTerms( $affiliate_terms );
|
10956 |
+
}
|
10957 |
+
}
|
10958 |
+
|
10959 |
+
$this->affiliate = $affiliate;
|
10960 |
+
}
|
10961 |
+
}
|
10962 |
+
}
|
10963 |
+
}
|
10964 |
+
|
10965 |
+
/**
|
10966 |
+
* @author Leo Fajardo (@leorw)
|
10967 |
+
* @since 1.2.3
|
10968 |
+
*/
|
10969 |
+
private function fetch_affiliate_and_terms() {
|
10970 |
+
$this->_logger->entrance();
|
10971 |
+
|
10972 |
+
$this->fetch_affiliate_terms();
|
10973 |
+
$this->fetch_affiliate_and_custom_terms();
|
10974 |
+
}
|
10975 |
+
|
10976 |
+
/**
|
10977 |
+
* @author Leo Fajardo (@leorw)
|
10978 |
+
* @since 1.2.3
|
10979 |
+
*
|
10980 |
+
* @return FS_Affiliate
|
10981 |
+
*/
|
10982 |
+
function get_affiliate() {
|
10983 |
+
return $this->affiliate;
|
10984 |
+
}
|
10985 |
+
|
10986 |
+
|
10987 |
+
/**
|
10988 |
+
* @author Leo Fajardo (@leorw)
|
10989 |
+
* @since 1.2.3
|
10990 |
+
*
|
10991 |
+
* @return FS_AffiliateTerms
|
10992 |
+
*/
|
10993 |
+
function get_affiliate_terms() {
|
10994 |
+
return is_object( $this->custom_affiliate_terms ) ?
|
10995 |
+
$this->custom_affiliate_terms :
|
10996 |
+
$this->plugin_affiliate_terms;
|
10997 |
+
}
|
10998 |
+
|
10999 |
+
/**
|
11000 |
+
* @author Leo Fajardo (@leorw)
|
11001 |
+
* @since 1.2.3
|
11002 |
+
*/
|
11003 |
+
function _submit_affiliate_application() {
|
11004 |
+
$this->_logger->entrance();
|
11005 |
+
|
11006 |
+
$this->check_ajax_referer( 'submit_affiliate_application' );
|
11007 |
+
|
11008 |
+
if ( ! $this->is_user_admin() ) {
|
11009 |
+
// Only for admins.
|
11010 |
+
self::shoot_ajax_failure();
|
11011 |
+
}
|
11012 |
+
|
11013 |
+
$affiliate = fs_request_get( 'affiliate' );
|
11014 |
+
|
11015 |
+
if ( empty( $affiliate['promotion_methods'] ) ) {
|
11016 |
+
unset( $affiliate['promotion_methods'] );
|
11017 |
+
}
|
11018 |
+
|
11019 |
+
if ( ! empty( $affiliate['additional_domains'] ) ) {
|
11020 |
+
$affiliate['additional_domains'] = array_unique( $affiliate['additional_domains'] );
|
11021 |
+
}
|
11022 |
+
|
11023 |
+
if ( ! $this->is_registered() ) {
|
11024 |
+
// Opt in but don't track usage.
|
11025 |
+
$next_page = $this->opt_in(
|
11026 |
+
false,
|
11027 |
+
false,
|
11028 |
+
false,
|
11029 |
+
false,
|
11030 |
+
false,
|
11031 |
+
false,
|
11032 |
+
true
|
11033 |
+
);
|
11034 |
+
|
11035 |
+
if ( is_object( $next_page ) && $this->is_api_error( $next_page ) ) {
|
11036 |
+
self::shoot_ajax_failure(
|
11037 |
+
isset( $next_page->error ) ?
|
11038 |
+
$next_page->error->message :
|
11039 |
+
var_export( $next_page, true )
|
11040 |
+
);
|
11041 |
+
} else if ( $this->is_pending_activation() ) {
|
11042 |
+
self::shoot_ajax_failure( $this->get_text_inline( 'Account is pending activation.', 'account-is-pending-activation' ) );
|
11043 |
+
}
|
11044 |
+
}
|
11045 |
+
|
11046 |
+
$this->fetch_affiliate_terms();
|
11047 |
+
|
11048 |
+
$api = $this->get_api_user_scope();
|
11049 |
+
$result = $api->call(
|
11050 |
+
( "/plugins/{$this->_plugin->id}/aff/{$this->plugin_affiliate_terms->id}/affiliates.json" ),
|
11051 |
+
'post',
|
11052 |
+
$affiliate
|
11053 |
+
);
|
11054 |
+
|
11055 |
+
if ( $this->is_api_error( $result ) ) {
|
11056 |
+
self::shoot_ajax_failure(
|
11057 |
+
isset( $result->error ) ?
|
11058 |
+
$result->error->message :
|
11059 |
+
var_export( $result, true )
|
11060 |
+
);
|
11061 |
+
} else {
|
11062 |
+
if ( $this->_admin_notices->has_sticky( 'affiliate_program' ) ) {
|
11063 |
+
$this->_admin_notices->remove_sticky( 'affiliate_program' );
|
11064 |
+
}
|
11065 |
+
|
11066 |
+
$affiliate_application_data = array(
|
11067 |
+
'status' => 'pending',
|
11068 |
+
'stats_description' => $affiliate['stats_description'],
|
11069 |
+
'promotion_method_description' => $affiliate['promotion_method_description'],
|
11070 |
+
);
|
11071 |
+
|
11072 |
+
if ( ! empty( $affiliate['promotion_methods'] ) ) {
|
11073 |
+
$affiliate_application_data['promotion_methods'] = $affiliate['promotion_methods'];
|
11074 |
+
}
|
11075 |
+
|
11076 |
+
if ( ! empty( $affiliate['domain'] ) ) {
|
11077 |
+
$affiliate_application_data['domain'] = $affiliate['domain'];
|
11078 |
+
}
|
11079 |
+
|
11080 |
+
if ( ! empty( $affiliate['additional_domains'] ) ) {
|
11081 |
+
$affiliate_application_data['additional_domains'] = $affiliate['additional_domains'];
|
11082 |
+
}
|
11083 |
+
|
11084 |
+
$this->_storage->affiliate_application_data = $affiliate_application_data;
|
11085 |
+
}
|
11086 |
+
|
11087 |
+
// Purge cached affiliate.
|
11088 |
+
$api->purge_cache( 'affiliate.json' );
|
11089 |
+
|
11090 |
+
self::shoot_ajax_success( $result );
|
11091 |
+
}
|
11092 |
+
|
11093 |
+
/**
|
11094 |
+
* @author Leo Fajardo (@leorw)
|
11095 |
+
* @since 1.2.3
|
11096 |
+
*
|
11097 |
+
* @return array|null
|
11098 |
+
*/
|
11099 |
+
function get_affiliate_application_data() {
|
11100 |
+
if ( empty( $this->_storage->affiliate_application_data ) ) {
|
11101 |
+
return null;
|
11102 |
+
}
|
11103 |
+
|
11104 |
+
return $this->_storage->affiliate_application_data;
|
11105 |
+
}
|
11106 |
+
|
11107 |
+
#endregion Affiliation ------------------------------------------------------------
|
11108 |
+
|
11109 |
+
#----------------------------------------------------------------------------------
|
11110 |
+
#region URL Generators
|
11111 |
+
#----------------------------------------------------------------------------------
|
11112 |
+
|
11113 |
+
/**
|
11114 |
+
* Alias to pricing_url().
|
11115 |
+
*
|
11116 |
+
* @author Vova Feldman (@svovaf)
|
11117 |
+
* @since 1.0.2
|
11118 |
+
*
|
11119 |
+
* @uses pricing_url()
|
11120 |
+
*
|
11121 |
+
* @param string $period Billing cycle
|
11122 |
+
* @param bool $is_trial
|
11123 |
+
*
|
11124 |
+
* @return string
|
11125 |
+
*/
|
11126 |
+
function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
|
11127 |
+
return $this->pricing_url( $period, $is_trial );
|
11128 |
+
}
|
11129 |
+
|
11130 |
+
/**
|
11131 |
+
* @author Vova Feldman (@svovaf)
|
11132 |
+
* @since 1.0.9
|
11133 |
+
*
|
11134 |
+
* @uses get_upgrade_url()
|
11135 |
+
*
|
11136 |
+
* @return string
|
11137 |
+
*/
|
11138 |
+
function get_trial_url() {
|
11139 |
+
return $this->get_upgrade_url( WP_FS__PERIOD_ANNUALLY, true );
|
11140 |
+
}
|
11141 |
+
|
11142 |
+
/**
|
11143 |
+
* Plugin's pricing URL.
|
11144 |
+
*
|
11145 |
+
* @author Vova Feldman (@svovaf)
|
11146 |
+
* @since 1.0.4
|
11147 |
+
*
|
11148 |
+
* @param string $billing_cycle Billing cycle
|
11149 |
+
*
|
11150 |
+
* @param bool $is_trial
|
11151 |
+
*
|
11152 |
+
* @return string
|
11153 |
+
*/
|
11154 |
+
function pricing_url( $billing_cycle = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
|
11155 |
+
$this->_logger->entrance();
|
11156 |
+
|
11157 |
+
$params = array(
|
11158 |
+
'billing_cycle' => $billing_cycle
|
11159 |
+
);
|
11160 |
+
|
11161 |
+
if ( $is_trial ) {
|
11162 |
+
$params['trial'] = 'true';
|
11163 |
+
}
|
11164 |
+
|
11165 |
+
if ( $this->is_addon() ) {
|
11166 |
+
return $this->_parent->addon_url( $this->_slug );
|
11167 |
+
}
|
11168 |
+
|
11169 |
+
return $this->_get_admin_page_url( 'pricing', $params );
|
11170 |
+
}
|
11171 |
+
|
11172 |
+
/**
|
11173 |
+
* Checkout page URL.
|
11174 |
+
*
|
11175 |
+
* @author Vova Feldman (@svovaf)
|
11176 |
+
* @since 1.0.6
|
11177 |
+
*
|
11178 |
+
* @param string $billing_cycle Billing cycle
|
11179 |
+
* @param bool $is_trial
|
11180 |
+
* @param array $extra (optional) Extra parameters, override other query params.
|
11181 |
+
*
|
11182 |
+
* @return string
|
11183 |
+
*/
|
11184 |
+
function checkout_url(
|
11185 |
+
$billing_cycle = WP_FS__PERIOD_ANNUALLY,
|
11186 |
+
$is_trial = false,
|
11187 |
+
$extra = array()
|
11188 |
+
) {
|
11189 |
+
$this->_logger->entrance();
|
11190 |
+
|
11191 |
+
$params = array(
|
11192 |
+
'checkout' => 'true',
|
11193 |
+
'billing_cycle' => $billing_cycle,
|
11194 |
+
);
|
11195 |
+
|
11196 |
+
if ( $is_trial ) {
|
11197 |
+
$params['trial'] = 'true';
|
11198 |
+
}
|
11199 |
+
|
11200 |
+
/**
|
11201 |
+
* Params in extra override other params.
|
11202 |
+
*/
|
11203 |
+
$params = array_merge( $params, $extra );
|
11204 |
+
|
11205 |
+
return $this->_get_admin_page_url( 'pricing', $params );
|
11206 |
+
}
|
11207 |
+
|
11208 |
+
/**
|
11209 |
+
* Add-on checkout URL.
|
11210 |
+
*
|
11211 |
+
* @author Vova Feldman (@svovaf)
|
11212 |
+
* @since 1.1.7
|
11213 |
+
*
|
11214 |
+
* @param number $addon_id
|
11215 |
+
* @param number $pricing_id
|
11216 |
+
* @param string $billing_cycle
|
11217 |
+
* @param bool $is_trial
|
11218 |
+
*
|
11219 |
+
* @return string
|
11220 |
+
*/
|
11221 |
+
function addon_checkout_url(
|
11222 |
+
$addon_id,
|
11223 |
+
$pricing_id,
|
11224 |
+
$billing_cycle = WP_FS__PERIOD_ANNUALLY,
|
11225 |
+
$is_trial = false
|
11226 |
+
) {
|
11227 |
+
return $this->checkout_url( $billing_cycle, $is_trial, array(
|
11228 |
+
'plugin_id' => $addon_id,
|
11229 |
+
'pricing_id' => $pricing_id,
|
11230 |
+
) );
|
11231 |
+
}
|
11232 |
+
|
11233 |
+
#endregion
|
11234 |
+
|
11235 |
+
#endregion ------------------------------------------------------------------
|
11236 |
+
|
11237 |
+
/**
|
11238 |
+
* Check if plugin has any add-ons.
|
11239 |
+
*
|
11240 |
+
* @author Vova Feldman (@svovaf)
|
11241 |
+
* @since 1.0.5
|
11242 |
+
*
|
11243 |
+
* @since 1.1.7.3 Base logic only on the parameter provided by the developer in the init function.
|
11244 |
+
*
|
11245 |
+
* @return bool
|
11246 |
+
*/
|
11247 |
+
function has_addons() {
|
11248 |
+
$this->_logger->entrance();
|
11249 |
+
|
11250 |
+
return $this->_has_addons;
|
11251 |
+
}
|
11252 |
+
|
11253 |
+
/**
|
11254 |
+
* Check if plugin can work in anonymous mode.
|
11255 |
+
*
|
11256 |
+
* @author Vova Feldman (@svovaf)
|
11257 |
+
* @since 1.0.9
|
11258 |
+
*
|
11259 |
+
* @return bool
|
11260 |
+
*
|
11261 |
+
* @deprecated Please use is_enable_anonymous() instead.
|
11262 |
+
*/
|
11263 |
+
function enable_anonymous() {
|
11264 |
+
return $this->_enable_anonymous;
|
11265 |
+
}
|
11266 |
+
|
11267 |
+
/**
|
11268 |
+
* Check if plugin can work in anonymous mode.
|
11269 |
+
*
|
11270 |
+
* @author Vova Feldman (@svovaf)
|
11271 |
+
* @since 1.1.9
|
11272 |
+
*
|
11273 |
+
* @return bool
|
11274 |
+
*/
|
11275 |
+
function is_enable_anonymous() {
|
11276 |
+
return $this->_enable_anonymous;
|
11277 |
+
}
|
11278 |
+
|
11279 |
+
/**
|
11280 |
+
* Check if plugin is premium only (no free plans).
|
11281 |
+
*
|
11282 |
+
* @author Vova Feldman (@svovaf)
|
11283 |
+
* @since 1.1.9
|
11284 |
+
*
|
11285 |
+
* @return bool
|
11286 |
+
*/
|
11287 |
+
function is_only_premium() {
|
11288 |
+
return $this->_is_premium_only;
|
11289 |
+
}
|
11290 |
+
|
11291 |
+
/**
|
11292 |
+
* Checks if the plugin's type is "plugin". The other type is "theme".
|
11293 |
+
*
|
11294 |
+
* @author Leo Fajardo (@leorw)
|
11295 |
+
* @since 1.2.2
|
11296 |
+
*
|
11297 |
+
* @return bool
|
11298 |
+
*/
|
11299 |
+
function is_plugin() {
|
11300 |
+
return ( WP_FS__MODULE_TYPE_PLUGIN === $this->_module_type );
|
11301 |
+
}
|
11302 |
+
|
11303 |
+
/**
|
11304 |
+
* @author Leo Fajardo (@leorw)
|
11305 |
+
* @since 1.2.2
|
11306 |
+
*
|
11307 |
+
* @return string
|
11308 |
+
*/
|
11309 |
+
function get_module_type() {
|
11310 |
+
if ( ! isset( $this->_module_type ) ) {
|
11311 |
+
$id_slug_type_path_map = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
|
11312 |
+
$this->_module_type = $id_slug_type_path_map[ $this->_module_id ]['type'];
|
11313 |
+
}
|
11314 |
+
|
11315 |
+
return $this->_module_type;
|
11316 |
+
}
|
11317 |
+
|
11318 |
+
/**
|
11319 |
+
* @author Leo Fajardo (@leorw)
|
11320 |
+
* @since 1.2.2
|
11321 |
+
*
|
11322 |
+
* @return string
|
11323 |
+
*/
|
11324 |
+
function get_plugin_main_file_path() {
|
11325 |
+
return $this->_plugin_main_file_path;
|
11326 |
+
}
|
11327 |
+
|
11328 |
+
/**
|
11329 |
+
* Check if module has a premium code version.
|
11330 |
+
*
|
11331 |
+
* Serviceware module might be freemium without any
|
11332 |
+
* premium code version, where the paid features
|
11333 |
+
* are all part of the service.
|
11334 |
+
*
|
11335 |
+
* @author Vova Feldman (@svovaf)
|
11336 |
+
* @since 1.2.1.6
|
11337 |
+
*
|
11338 |
+
* @return bool
|
11339 |
+
*/
|
11340 |
+
function has_premium_version() {
|
11341 |
+
return $this->_has_premium_version;
|
11342 |
+
}
|
11343 |
+
|
11344 |
+
/**
|
11345 |
+
* Check if feature supported with current site's plan.
|
11346 |
+
*
|
11347 |
+
* @author Vova Feldman (@svovaf)
|
11348 |
+
* @since 1.0.1
|
11349 |
+
*
|
11350 |
+
* @todo IMPLEMENT
|
11351 |
+
*
|
11352 |
+
* @param number $feature_id
|
11353 |
+
*
|
11354 |
+
* @throws Exception
|
11355 |
+
*/
|
11356 |
+
function is_feature_supported( $feature_id ) {
|
11357 |
+
throw new Exception( 'not implemented' );
|
11358 |
+
}
|
11359 |
+
|
11360 |
+
/**
|
11361 |
+
* @author Vova Feldman (@svovaf)
|
11362 |
+
* @since 1.0.1
|
11363 |
+
*
|
11364 |
+
* @return bool Is running in SSL/HTTPS
|
11365 |
+
*/
|
11366 |
+
function is_ssl() {
|
11367 |
+
return WP_FS__IS_HTTPS;
|
11368 |
+
}
|
11369 |
+
|
11370 |
+
/**
|
11371 |
+
* @author Vova Feldman (@svovaf)
|
11372 |
+
* @since 1.0.9
|
11373 |
+
*
|
11374 |
+
* @return bool Is running in AJAX call.
|
11375 |
+
*
|
11376 |
+
* @link http://wordpress.stackexchange.com/questions/70676/how-to-check-if-i-am-in-admin-ajax
|
11377 |
+
*/
|
11378 |
+
static function is_ajax() {
|
11379 |
+
return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
|
11380 |
+
}
|
11381 |
+
|
11382 |
+
/**
|
11383 |
+
* Check if it's an AJAX call targeted for the current module.
|
11384 |
+
*
|
11385 |
+
* @author Vova Feldman (@svovaf)
|
11386 |
+
* @since 1.2.0
|
11387 |
+
*
|
11388 |
+
* @param array|string $actions Collection of AJAX actions.
|
11389 |
+
*
|
11390 |
+
* @return bool
|
11391 |
+
*/
|
11392 |
+
function is_ajax_action( $actions ) {
|
11393 |
+
// Verify it's an ajax call.
|
11394 |
+
if ( ! self::is_ajax() ) {
|
11395 |
+
return false;
|
11396 |
+
}
|
11397 |
+
|
11398 |
+
// Verify the call is relevant for the plugin.
|
11399 |
+
if ( $this->_module_id != fs_request_get( 'module_id' ) ) {
|
11400 |
+
return false;
|
11401 |
+
}
|
11402 |
+
|
11403 |
+
// Verify it's one of the specified actions.
|
11404 |
+
if ( is_string( $actions ) ) {
|
11405 |
+
$actions = explode( ',', $actions );
|
11406 |
+
}
|
11407 |
+
|
11408 |
+
if ( is_array( $actions ) && 0 < count( $actions ) ) {
|
11409 |
+
$ajax_action = fs_request_get( 'action' );
|
11410 |
+
|
11411 |
+
foreach ( $actions as $action ) {
|
11412 |
+
if ( $ajax_action === $this->get_action_tag( $action ) ) {
|
11413 |
+
return true;
|
11414 |
+
}
|
11415 |
+
}
|
11416 |
+
}
|
11417 |
+
|
11418 |
+
return false;
|
11419 |
+
}
|
11420 |
+
|
11421 |
+
/**
|
11422 |
+
* Check if it's an AJAX call targeted for current request.
|
11423 |
+
*
|
11424 |
+
* @author Vova Feldman (@svovaf)
|
11425 |
+
* @since 1.2.0
|
11426 |
+
*
|
11427 |
+
* @param array|string $actions Collection of AJAX actions.
|
11428 |
+
* @param number|null $module_id
|
11429 |
+
*
|
11430 |
+
* @return bool
|
11431 |
+
*/
|
11432 |
+
static function is_ajax_action_static( $actions, $module_id = null ) {
|
11433 |
+
// Verify it's an ajax call.
|
11434 |
+
if ( ! self::is_ajax() ) {
|
11435 |
+
return false;
|
11436 |
+
}
|
11437 |
+
|
11438 |
+
|
11439 |
+
if ( ! empty( $module_id ) ) {
|
11440 |
+
// Verify the call is relevant for the plugin.
|
11441 |
+
if ( $module_id != fs_request_get( 'module_id' ) ) {
|
11442 |
+
return false;
|
11443 |
+
}
|
11444 |
+
}
|
11445 |
+
|
11446 |
+
// Verify it's one of the specified actions.
|
11447 |
+
if ( is_string( $actions ) ) {
|
11448 |
+
$actions = explode( ',', $actions );
|
11449 |
+
}
|
11450 |
+
|
11451 |
+
if ( is_array( $actions ) && 0 < count( $actions ) ) {
|
11452 |
+
$ajax_action = fs_request_get( 'action' );
|
11453 |
+
|
11454 |
+
foreach ( $actions as $action ) {
|
11455 |
+
if ( $ajax_action === self::get_ajax_action_static( $action, $module_id ) ) {
|
11456 |
+
return true;
|
11457 |
+
}
|
11458 |
+
}
|
11459 |
+
}
|
11460 |
+
|
11461 |
+
return false;
|
11462 |
+
}
|
11463 |
+
|
11464 |
+
/**
|
11465 |
+
* @author Vova Feldman (@svovaf)
|
11466 |
+
* @since 1.1.7
|
11467 |
+
*
|
11468 |
+
* @return bool
|
11469 |
+
*/
|
11470 |
+
static function is_cron() {
|
11471 |
+
return ( defined( 'DOING_CRON' ) && DOING_CRON );
|
11472 |
+
}
|
11473 |
+
|
11474 |
+
/**
|
11475 |
+
* Check if a real user is visiting the admin dashboard.
|
11476 |
+
*
|
11477 |
+
* @author Vova Feldman (@svovaf)
|
11478 |
+
* @since 1.1.7
|
11479 |
+
*
|
11480 |
+
* @return bool
|
11481 |
+
*/
|
11482 |
+
function is_user_in_admin() {
|
11483 |
+
return is_admin() && ! self::is_ajax() && ! self::is_cron();
|
11484 |
+
}
|
11485 |
+
|
11486 |
+
/**
|
11487 |
+
* Check if a real user is in the customizer view.
|
11488 |
+
*
|
11489 |
+
* @author Vova Feldman (@svovaf)
|
11490 |
+
* @since 1.2.2.7
|
11491 |
+
*
|
11492 |
+
* @return bool
|
11493 |
+
*/
|
11494 |
+
static function is_customizer() {
|
11495 |
+
return is_customize_preview();
|
11496 |
+
}
|
11497 |
+
|
11498 |
+
/**
|
11499 |
+
* Check if running in HTTPS and if site's plan matching the specified plan.
|
11500 |
+
*
|
11501 |
+
* @param string $plan
|
11502 |
+
* @param bool $exact
|
11503 |
+
*
|
11504 |
+
* @return bool
|
11505 |
+
*/
|
11506 |
+
function is_ssl_and_plan( $plan, $exact = false ) {
|
11507 |
+
return ( $this->is_ssl() && $this->is_plan( $plan, $exact ) );
|
11508 |
+
}
|
11509 |
+
|
11510 |
+
/**
|
11511 |
+
* Construct plugin's settings page URL.
|
11512 |
+
*
|
11513 |
+
* @author Vova Feldman (@svovaf)
|
11514 |
+
* @since 1.0.4
|
11515 |
+
*
|
11516 |
+
* @param string $page
|
11517 |
+
* @param array $params
|
11518 |
+
* @param bool|null $network
|
11519 |
+
*
|
11520 |
+
* @return string
|
11521 |
+
*/
|
11522 |
+
function _get_admin_page_url( $page = '', $params = array(), $network = null ) {
|
11523 |
+
if ( is_null( $network ) ) {
|
11524 |
+
$network = (
|
11525 |
+
$this->_is_network_active &&
|
11526 |
+
( fs_is_network_admin() || ! $this->is_delegated_connection() )
|
11527 |
+
);
|
11528 |
+
}
|
11529 |
+
|
11530 |
+
if ( 0 < count( $params ) ) {
|
11531 |
+
foreach ( $params as $k => $v ) {
|
11532 |
+
$params[ $k ] = urlencode( $v );
|
11533 |
+
}
|
11534 |
+
}
|
11535 |
+
|
11536 |
+
$page_param = $this->_menu->get_slug( $page );
|
11537 |
+
|
11538 |
+
if ( empty( $page ) &&
|
11539 |
+
$this->is_theme() &&
|
11540 |
+
// Show the opt-in as an overlay for free wp.org themes or themes without any settings page.
|
11541 |
+
( $this->is_free_wp_org_theme() || ! $this->has_settings_menu() )
|
11542 |
+
) {
|
11543 |
+
$params[ $this->get_unique_affix() . '_show_optin' ] = 'true';
|
11544 |
+
|
11545 |
+
return add_query_arg(
|
11546 |
+
$params,
|
11547 |
+
$this->admin_url( 'themes.php', 'admin', $network )
|
11548 |
+
);
|
11549 |
+
}
|
11550 |
+
|
11551 |
+
if ( ! $this->has_settings_menu() ) {
|
11552 |
+
if ( ! empty( $page ) ) {
|
11553 |
+
// Module doesn't have a setting page, but since the request is for
|
11554 |
+
// a specific Freemius page, use the admin.php path.
|
11555 |
+
return add_query_arg( array_merge( $params, array(
|
11556 |
+
'page' => $page_param,
|
11557 |
+
) ), $this->admin_url( 'admin.php', 'admin', $network ) );
|
11558 |
+
} else {
|
11559 |
+
if ( $this->is_activation_mode() ) {
|
11560 |
+
/**
|
11561 |
+
* @author Vova Feldman
|
11562 |
+
* @since 1.2.1.6
|
11563 |
+
*
|
11564 |
+
* If plugin doesn't have a settings page, create one for the opt-in screen.
|
11565 |
+
*/
|
11566 |
+
return add_query_arg( array_merge( $params, array(
|
11567 |
+
'page' => $this->_slug,
|
11568 |
+
) ), $this->admin_url( 'admin.php', 'admin', $network ) );
|
11569 |
+
} else {
|
11570 |
+
// Plugin without a settings page.
|
11571 |
+
return add_query_arg(
|
11572 |
+
$params,
|
11573 |
+
$this->admin_url( 'plugins.php', 'admin', $network )
|
11574 |
+
);
|
11575 |
+
}
|
11576 |
+
}
|
11577 |
+
}
|
11578 |
+
|
11579 |
+
// Module has a submenu settings page.
|
11580 |
+
if ( ! $this->_menu->is_top_level() ) {
|
11581 |
+
$parent_slug = $this->_menu->get_parent_slug();
|
11582 |
+
$menu_file = ( false !== strpos( $parent_slug, '.php' ) ) ?
|
11583 |
+
$parent_slug :
|
11584 |
+
'admin.php';
|
11585 |
+
|
11586 |
+
return add_query_arg( array_merge( $params, array(
|
11587 |
+
'page' => $page_param,
|
11588 |
+
) ), $this->admin_url( $menu_file, 'admin', $network ) );
|
11589 |
+
}
|
11590 |
+
|
11591 |
+
// Module has a top level CPT settings page.
|
11592 |
+
if ( $this->_menu->is_cpt() ) {
|
11593 |
+
if ( empty( $page ) && $this->is_activation_mode() ) {
|
11594 |
+
return add_query_arg( array_merge( $params, array(
|
11595 |
+
'page' => $page_param
|
11596 |
+
) ), $this->admin_url( 'admin.php', 'admin', $network ) );
|
11597 |
+
} else {
|
11598 |
+
if ( ! empty( $page ) ) {
|
11599 |
+
$params['page'] = $page_param;
|
11600 |
+
}
|
11601 |
+
|
11602 |
+
return add_query_arg(
|
11603 |
+
$params,
|
11604 |
+
$this->admin_url( $this->_menu->get_raw_slug(), 'admin', $network )
|
11605 |
+
);
|
11606 |
+
}
|
11607 |
+
}
|
11608 |
+
|
11609 |
+
// Module has a custom top level settings page.
|
11610 |
+
return add_query_arg( array_merge( $params, array(
|
11611 |
+
'page' => $page_param,
|
11612 |
+
) ), $this->admin_url( 'admin.php', 'admin', $network ) );
|
11613 |
+
}
|
11614 |
+
|
11615 |
+
#--------------------------------------------------------------------------------
|
11616 |
+
#region Multisite
|
11617 |
+
#--------------------------------------------------------------------------------
|
11618 |
+
|
11619 |
+
/**
|
11620 |
+
* @author Leo Fajardo (@leorw)
|
11621 |
+
* @since 2.0.0
|
11622 |
+
*
|
11623 |
+
* @return bool
|
11624 |
+
*/
|
11625 |
+
function is_network_active() {
|
11626 |
+
return $this->_is_network_active;
|
11627 |
+
}
|
11628 |
+
|
11629 |
+
/**
|
11630 |
+
* Delegate activation for the given sites in the network (or all sites if `null`) to site admins.
|
11631 |
+
*
|
11632 |
+
* @author Leo Fajardo (@leorw)
|
11633 |
+
* @since 2.0.0
|
11634 |
+
*
|
11635 |
+
* @param array|null $sites
|
11636 |
+
*/
|
11637 |
+
private function delegate_connection( $sites = null ) {
|
11638 |
+
$this->_logger->entrance();
|
11639 |
+
|
11640 |
+
$this->_admin_notices->remove_sticky( 'connect_account' );
|
11641 |
+
|
11642 |
+
if ( is_null( $sites ) ) {
|
11643 |
+
// All sites delegation.
|
11644 |
+
$this->_storage->store( 'is_delegated_connection', true, true, true );
|
11645 |
+
} else {
|
11646 |
+
// Specified sites delegation.
|
11647 |
+
foreach ( $sites as $site ) {
|
11648 |
+
$this->delegate_site_connection( $site['blog_id'] );
|
11649 |
+
}
|
11650 |
+
}
|
11651 |
+
|
11652 |
+
$this->network_upgrade_mode_completed();
|
11653 |
+
}
|
11654 |
+
|
11655 |
+
/**
|
11656 |
+
* Delegate specific network site conncetion to the site admin.
|
11657 |
+
*
|
11658 |
+
* @author Vova Feldman (@svovaf)
|
11659 |
+
* @since 2.0.0
|
11660 |
+
*
|
11661 |
+
* @param int $blog_id
|
11662 |
+
*/
|
11663 |
+
private function delegate_site_connection( $blog_id ) {
|
11664 |
+
$this->_storage->store( 'is_delegated_connection', true, $blog_id, true );
|
11665 |
+
}
|
11666 |
+
|
11667 |
+
/**
|
11668 |
+
* Check if super-admin delegated the connection of ALL sites to the site admins.
|
11669 |
+
*
|
11670 |
+
* @author Vova Feldman (@svovaf)
|
11671 |
+
* @since 2.0.0
|
11672 |
+
*
|
11673 |
+
* @return bool
|
11674 |
+
*/
|
11675 |
+
function is_network_delegated_connection() {
|
11676 |
+
if ( ! $this->_is_network_active ) {
|
11677 |
+
return false;
|
11678 |
+
}
|
11679 |
+
|
11680 |
+
return $this->_storage->get( 'is_delegated_connection', false, true );
|
11681 |
+
}
|
11682 |
+
|
11683 |
+
/**
|
11684 |
+
* @author Leo Fajardo (@leorw)
|
11685 |
+
* @since 2.0.0
|
11686 |
+
*
|
11687 |
+
* @param int $blog_id
|
11688 |
+
*
|
11689 |
+
* @return bool
|
11690 |
+
*/
|
11691 |
+
function is_site_delegated_connection( $blog_id = 0 ) {
|
11692 |
+
if ( ! $this->_is_network_active ) {
|
11693 |
+
return false;
|
11694 |
+
}
|
11695 |
+
|
11696 |
+
if ( 0 == $blog_id ) {
|
11697 |
+
$blog_id = get_current_blog_id();
|
11698 |
+
}
|
11699 |
+
|
11700 |
+
return $this->_storage->get( 'is_delegated_connection', false, $blog_id );
|
11701 |
+
}
|
11702 |
+
|
11703 |
+
/**
|
11704 |
+
* Check if delegated the connection. When running within the the network admin,
|
11705 |
+
* and haven't specified the blog ID, checks if network level delegated. If running
|
11706 |
+
* within a site admin or specified a blog ID, check if delegated the connection for
|
11707 |
+
* the current context site.
|
11708 |
+
*
|
11709 |
+
* If executed outside the the admin, check if delegated the connection
|
11710 |
+
* for the current context site OR the whole network.
|
11711 |
+
*
|
11712 |
+
* @author Vova Feldman (@svovaf)
|
11713 |
+
* @since 2.0.0
|
11714 |
+
*
|
11715 |
+
* @param int $blog_id If set, checks if network delegated or blog specific delegated.
|
11716 |
+
*
|
11717 |
+
* @return bool
|
11718 |
+
*/
|
11719 |
+
function is_delegated_connection( $blog_id = 0 ) {
|
11720 |
+
if ( ! $this->_is_network_active ) {
|
11721 |
+
return false;
|
11722 |
+
}
|
11723 |
+
|
11724 |
+
if ( fs_is_network_admin() && 0 == $blog_id ) {
|
11725 |
+
return $this->is_network_delegated_connection();
|
11726 |
+
}
|
11727 |
+
|
11728 |
+
return (
|
11729 |
+
$this->is_network_delegated_connection() ||
|
11730 |
+
$this->is_site_delegated_connection( $blog_id )
|
11731 |
+
);
|
11732 |
+
}
|
11733 |
+
|
11734 |
+
/**
|
11735 |
+
* Check if the current module is active for the site.
|
11736 |
+
*
|
11737 |
+
* @author Vova Feldman (@svovaf)
|
11738 |
+
* @since 2.0.0
|
11739 |
+
*
|
11740 |
+
* @param int $blog_id
|
11741 |
+
*
|
11742 |
+
* @return bool
|
11743 |
+
*/
|
11744 |
+
function is_active_for_site( $blog_id ) {
|
11745 |
+
if ( ! is_multisite() ) {
|
11746 |
+
// Not a multisite and this code is executed, means that the plugin is active.
|
11747 |
+
return true;
|
11748 |
+
}
|
11749 |
+
|
11750 |
+
if ( $this->is_theme() ) {
|
11751 |
+
// All themes are site level activated.
|
11752 |
+
return true;
|
11753 |
+
}
|
11754 |
+
|
11755 |
+
if ( $this->_is_network_active ) {
|
11756 |
+
// Plugin was network activated so it's active.
|
11757 |
+
return true;
|
11758 |
+
}
|
11759 |
+
|
11760 |
+
return in_array( $this->_plugin_basename, (array) get_blog_option( $blog_id, 'active_plugins', array() ) );
|
11761 |
+
}
|
11762 |
+
|
11763 |
+
/**
|
11764 |
+
* @author Leo Fajardo (@leorw)
|
11765 |
+
* @since 2.0.0
|
11766 |
+
*
|
11767 |
+
* @return array Active & public sites collection.
|
11768 |
+
*/
|
11769 |
+
static function get_sites() {
|
11770 |
+
/**
|
11771 |
+
* For consistency with get_blog_list() which only return active public sites.
|
11772 |
+
*
|
11773 |
+
* @author Vova Feldman (@svovaf)
|
11774 |
+
*/
|
11775 |
+
$args = array(
|
11776 |
+
'public' => 1,
|
11777 |
+
'archived' => 0,
|
11778 |
+
'mature' => 0,
|
11779 |
+
'spam' => 0,
|
11780 |
+
'deleted' => 0,
|
11781 |
+
);
|
11782 |
+
|
11783 |
+
if ( function_exists( 'get_sites' ) ) {
|
11784 |
+
// For WP 4.6 and above.
|
11785 |
+
return get_sites( $args );
|
11786 |
+
} else if ( function_exists( 'wp_get_sites' ) ) {
|
11787 |
+
// For WP 3.7 to WP 4.5.
|
11788 |
+
return wp_get_sites( $args );
|
11789 |
+
} else {
|
11790 |
+
// For WP 3.6 and below.
|
11791 |
+
return get_blog_list( 0, 'all' );
|
11792 |
+
}
|
11793 |
+
}
|
11794 |
+
|
11795 |
+
/**
|
11796 |
+
* Checks if a given blog is active.
|
11797 |
+
*
|
11798 |
+
* @author Vova Feldman (@svovaf)
|
11799 |
+
* @since 2.0.0
|
11800 |
+
*
|
11801 |
+
* @param $blog_id
|
11802 |
+
*
|
11803 |
+
* @return bool
|
11804 |
+
*/
|
11805 |
+
private static function is_site_active( $blog_id ) {
|
11806 |
+
global $wpdb;
|
11807 |
+
|
11808 |
+
$blog_info = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d", $blog_id ) );
|
11809 |
+
|
11810 |
+
if ( ! is_object( $blog_info ) ) {
|
11811 |
+
return false;
|
11812 |
+
}
|
11813 |
+
|
11814 |
+
return (
|
11815 |
+
true == $blog_info->public &&
|
11816 |
+
false == $blog_info->archived &&
|
11817 |
+
false == $blog_info->mature &&
|
11818 |
+
false == $blog_info->spam &&
|
11819 |
+
false == $blog_info->deleted
|
11820 |
+
);
|
11821 |
+
}
|
11822 |
+
|
11823 |
+
/**
|
11824 |
+
* Get a mapping between the site addresses to their blog IDs.
|
11825 |
+
*
|
11826 |
+
* @author Vova Feldman (@svovaf)
|
11827 |
+
* @since 2.0.0
|
11828 |
+
*
|
11829 |
+
* @return array {
|
11830 |
+
* @key string Site address without protocol with a trailing slash.
|
11831 |
+
* @value int Site's blog ID.
|
11832 |
+
* }
|
11833 |
+
*/
|
11834 |
+
private function get_address_to_blog_map() {
|
11835 |
+
$sites = self::get_sites();
|
11836 |
+
|
11837 |
+
// Map site addresses to their blog IDs.
|
11838 |
+
$address_to_blog_map = array();
|
11839 |
+
foreach ( $sites as $site ) {
|
11840 |
+
$blog_id = self::get_site_blog_id( $site );
|
11841 |
+
$address = trailingslashit( fs_strip_url_protocol( get_site_url( $blog_id ) ) );
|
11842 |
+
$address_to_blog_map[ $address ] = $blog_id;
|
11843 |
+
}
|
11844 |
+
|
11845 |
+
return $address_to_blog_map;
|
11846 |
+
}
|
11847 |
+
|
11848 |
+
/**
|
11849 |
+
* Get a mapping between the site addresses to their blog IDs.
|
11850 |
+
*
|
11851 |
+
* @author Vova Feldman (@svovaf)
|
11852 |
+
* @since 2.0.0
|
11853 |
+
*
|
11854 |
+
* @return array {
|
11855 |
+
* @key int Site's blog ID.
|
11856 |
+
* @value FS_Site Associated install.
|
11857 |
+
* }
|
11858 |
+
*/
|
11859 |
+
function get_blog_install_map() {
|
11860 |
+
$sites = self::get_sites();
|
11861 |
+
|
11862 |
+
// Map site blog ID to its install.
|
11863 |
+
$install_map = array();
|
11864 |
+
|
11865 |
+
foreach ( $sites as $site ) {
|
11866 |
+
$blog_id = self::get_site_blog_id( $site );
|
11867 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
11868 |
+
|
11869 |
+
if ( is_object( $install ) ) {
|
11870 |
+
$install_map[ $blog_id ] = $install;
|
11871 |
+
}
|
11872 |
+
}
|
11873 |
+
|
11874 |
+
return $install_map;
|
11875 |
+
}
|
11876 |
+
|
11877 |
+
/**
|
11878 |
+
* @author Leo Fajardo (@leorw)
|
11879 |
+
*
|
11880 |
+
* @return null|array {
|
11881 |
+
* 'install' => FS_Site Module's install,
|
11882 |
+
* 'blog_id' => string The associated blog ID.
|
11883 |
+
* }
|
11884 |
+
*/
|
11885 |
+
private function find_first_install() {
|
11886 |
+
$sites = self::get_sites();
|
11887 |
+
|
11888 |
+
foreach ( $sites as $site ) {
|
11889 |
+
$blog_id = self::get_site_blog_id( $site );
|
11890 |
+
$install = $this->get_install_by_blog_id( $blog_id );
|
11891 |
+
|
11892 |
+
if ( is_object( $install ) ) {
|
11893 |
+
return array(
|
11894 |
+
'install' => $install,
|
11895 |
+
'blog_id' => $blog_id
|
11896 |
+
);
|
11897 |
+
}
|
11898 |
+
}
|
11899 |
+
|
11900 |
+
return null;
|
11901 |
+
}
|
11902 |
+
|
11903 |
+
/**
|
11904 |
+
* Switches the Freemius site level context to a specified blog.
|
11905 |
+
*
|
11906 |
+
* @author Vova Feldman (@svovaf)
|
11907 |
+
* @since 2.0.0
|
11908 |
+
*
|
11909 |
+
* @param int $blog_id
|
11910 |
+
* @param FS_Site $install
|
11911 |
+
*/
|
11912 |
+
function switch_to_blog( $blog_id, FS_Site $install = null ) {
|
11913 |
+
if ( $blog_id == $this->_context_is_network_or_blog_id ) {
|
11914 |
+
return;
|
11915 |
+
}
|
11916 |
+
|
11917 |
+
switch_to_blog( $blog_id );
|
11918 |
+
$this->_context_is_network_or_blog_id = $blog_id;
|
11919 |
+
|
11920 |
+
self::$_accounts->set_site_blog_context( $blog_id );
|
11921 |
+
$this->_storage->set_site_blog_context( $blog_id );
|
11922 |
+
$this->_storage->set_network_active( true, $this->is_delegated_connection( $blog_id ) );
|
11923 |
+
|
11924 |
+
$this->_site = is_object( $install ) ?
|
11925 |
+
$install :
|
11926 |
+
$this->get_install_by_blog_id( $blog_id );
|
11927 |
+
|
11928 |
+
$this->_user = false;
|
11929 |
+
$this->_licenses = false;
|
11930 |
+
$this->_license = null;
|
11931 |
+
|
11932 |
+
if ( is_object( $this->_site ) ) {
|
11933 |
+
// Try to fetch user from install.
|
11934 |
+
$this->_user = self::_get_user_by_id( $this->_site->user_id );
|
11935 |
+
|
11936 |
+
if ( ! is_object( $this->_user ) &&
|
11937 |
+
FS_User::is_valid_id( $this->_storage->prev_user_id )
|
11938 |
+
) {
|
11939 |
+
// Try to fetch previously saved user.
|
11940 |
+
$this->_user = self::_get_user_by_id( $this->_storage->prev_user_id );
|
11941 |
+
|
11942 |
+
if ( ! is_object( $this->_user ) ) {
|
11943 |
+
// Fallback to network's user.
|
11944 |
+
$this->_user = $this->get_network_user();
|
11945 |
+
}
|
11946 |
+
}
|
11947 |
+
|
11948 |
+
$all_plugin_licenses = self::get_all_licenses( $this->_module_id );
|
11949 |
+
|
11950 |
+
if ( ! empty( $all_plugin_licenses ) ) {
|
11951 |
+
if ( ! FS_Plugin_License::is_valid_id( $this->_site->license_id ) ) {
|
11952 |
+
$this->_license = null;
|
11953 |
+
} else {
|
11954 |
+
$license_found = false;
|
11955 |
+
foreach ( $all_plugin_licenses as $license ) {
|
11956 |
+
if ( $license->id == $this->_site->license_id ) {
|
11957 |
+
// License found.
|
11958 |
+
$this->_license = $license;
|
11959 |
+
$license_found = true;
|
11960 |
+
break;
|
11961 |
+
}
|
11962 |
+
}
|
11963 |
+
|
11964 |
+
if ( $license_found ) {
|
11965 |
+
$this->link_license_2_user( $this->_license->id, $this->_user->id );
|
11966 |
+
}
|
11967 |
+
}
|
11968 |
+
|
11969 |
+
$this->_licenses = $this->get_user_licenses( $this->_user->id );
|
11970 |
+
}
|
11971 |
+
}
|
11972 |
+
|
11973 |
+
unset( $this->_site_api );
|
11974 |
+
unset( $this->_user_api );
|
11975 |
+
}
|
11976 |
+
|
11977 |
+
/**
|
11978 |
+
* Restore the blog context to the blog that originally loaded the module.
|
11979 |
+
*
|
11980 |
+
* @author Vova Feldman (@svovaf)
|
11981 |
+
* @since 2.0.0
|
11982 |
+
*/
|
11983 |
+
function restore_current_blog() {
|
11984 |
+
$this->switch_to_blog( $this->_blog_id );
|
11985 |
+
}
|
11986 |
+
|
11987 |
+
/**
|
11988 |
+
* @author Vova Feldman (@svovaf)
|
11989 |
+
* @since 2.0.0
|
11990 |
+
*
|
11991 |
+
* @param array|WP_Site $site
|
11992 |
+
*
|
11993 |
+
* @return int
|
11994 |
+
*/
|
11995 |
+
static function get_site_blog_id( &$site ) {
|
11996 |
+
return ( $site instanceof WP_Site ) ?
|
11997 |
+
$site->blog_id :
|
11998 |
+
$site['blog_id'];
|
11999 |
+
}
|
12000 |
+
|
12001 |
+
/**
|
12002 |
+
* @author Leo Fajardo (@leorw)
|
12003 |
+
* @since 2.0.0
|
12004 |
+
*
|
12005 |
+
* @param array|WP_Site|null $site
|
12006 |
+
*
|
12007 |
+
* @return array
|
12008 |
+
*/
|
12009 |
+
function get_site_info( $site = null ) {
|
12010 |
+
$this->_logger->entrance();
|
12011 |
+
|
12012 |
+
$switched = false;
|
12013 |
+
|
12014 |
+
if ( is_null( $site ) ) {
|
12015 |
+
$url = get_site_url();
|
12016 |
+
$name = get_bloginfo( 'name' );
|
12017 |
+
$blog_id = null;
|
12018 |
+
} else {
|
12019 |
+
$blog_id = self::get_site_blog_id( $site );
|
12020 |
+
|
12021 |
+
if ( get_current_blog_id() != $blog_id ) {
|
12022 |
+
switch_to_blog( $blog_id );
|
12023 |
+
$switched = true;
|
12024 |
+
}
|
12025 |
+
|
12026 |
+
if ( $site instanceof WP_Site ) {
|
12027 |
+
$url = $site->siteurl;
|
12028 |
+
$name = $site->blogname;
|
12029 |
+
} else {
|
12030 |
+
$url = get_site_url( $blog_id );
|
12031 |
+
$name = get_bloginfo( 'name' );
|
12032 |
+
}
|
12033 |
+
}
|
12034 |
+
|
12035 |
+
$info = array(
|
12036 |
+
'uid' => $this->get_anonymous_id( $blog_id ),
|
12037 |
+
'url' => $url,
|
12038 |
+
'title' => $name,
|
12039 |
+
'language' => get_bloginfo( 'language' ),
|
12040 |
+
'charset' => get_bloginfo( 'charset' ),
|
12041 |
+
);
|
12042 |
+
|
12043 |
+
if ( is_numeric( $blog_id ) ) {
|
12044 |
+
$info['blog_id'] = $blog_id;
|
12045 |
+
}
|
12046 |
+
|
12047 |
+
if ( $switched ) {
|
12048 |
+
restore_current_blog();
|
12049 |
+
}
|
12050 |
+
|
12051 |
+
return $info;
|
12052 |
+
}
|
12053 |
+
|
12054 |
+
/**
|
12055 |
+
* Load the module's install based on the blog ID.
|
12056 |
+
*
|
12057 |
+
* @author Vova Feldman (@svovaf)
|
12058 |
+
* @since 2.0.0
|
12059 |
+
*
|
12060 |
+
* @param int|null $blog_id
|
12061 |
+
*
|
12062 |
+
* @return FS_Site
|
12063 |
+
*/
|
12064 |
+
function get_install_by_blog_id( $blog_id = null ) {
|
12065 |
+
$installs = self::get_all_sites( $this->_module_type, $blog_id );
|
12066 |
+
$install = isset( $installs[ $this->_slug ] ) ? $installs[ $this->_slug ] : null;
|
12067 |
+
|
12068 |
+
if ( is_object( $install ) &&
|
12069 |
+
is_numeric( $install->id ) &&
|
12070 |
+
is_numeric( $install->user_id ) &&
|
12071 |
+
FS_Plugin_Plan::is_valid_id( $install->plan_id )
|
12072 |
+
) {
|
12073 |
+
// Load site.
|
12074 |
+
$install = clone $install;
|
12075 |
+
}
|
12076 |
+
|
12077 |
+
return $install;
|
12078 |
+
}
|
12079 |
+
|
12080 |
+
/**
|
12081 |
+
* Check if module is installed on a specified site.
|
12082 |
+
*
|
12083 |
+
* @author Vova Feldman (@svovaf)
|
12084 |
+
* @since 2.0.0
|
12085 |
+
*
|
12086 |
+
* @param int|null $blog_id
|
12087 |
+
*
|
12088 |
+
* @return bool
|
12089 |
+
*/
|
12090 |
+
function is_installed_on_site( $blog_id = null ) {
|
12091 |
+
$installs = self::get_all_sites( $this->_module_type, $blog_id );
|
12092 |
+
$install = isset( $installs[ $this->_slug ] ) ? $installs[ $this->_slug ] : null;
|
12093 |
+
|
12094 |
+
return (
|
12095 |
+
is_object( $install ) &&
|
12096 |
+
is_numeric( $install->id ) &&
|
12097 |
+
is_numeric( $install->user_id ) &&
|
12098 |
+
FS_Plugin_Plan::is_valid_id( $install->plan_id )
|
12099 |
+
);
|
12100 |
+
}
|
12101 |
+
|
12102 |
+
/**
|
12103 |
+
* Check if super-admin connected at least one site via the network opt-in.
|
12104 |
+
*
|
12105 |
+
* @author Vova Feldman (@svovaf)
|
12106 |
+
* @since 2.0.0
|
12107 |
+
*
|
12108 |
+
* @return bool
|
12109 |
+
*/
|
12110 |
+
function is_network_registered() {
|
12111 |
+
if ( ! $this->_is_network_active ) {
|
12112 |
+
return false;
|
12113 |
+
}
|
12114 |
+
|
12115 |
+
return FS_User::is_valid_id( $this->_storage->network_user_id );
|
12116 |
+
}
|
12117 |
+
|
12118 |
+
/**
|
12119 |
+
* Returns the main user associated with the network.
|
12120 |
+
*
|
12121 |
+
* @author Vova Feldman (@svovaf)
|
12122 |
+
* @since 2.0.0
|
12123 |
+
*
|
12124 |
+
* @return FS_User
|
12125 |
+
*/
|
12126 |
+
function get_network_user() {
|
12127 |
+
if ( ! $this->_is_network_active ) {
|
12128 |
+
return null;
|
12129 |
+
}
|
12130 |
+
|
12131 |
+
return FS_User::is_valid_id( $this->_storage->network_user_id ) ?
|
12132 |
+
self::_get_user_by_id( $this->_storage->network_user_id ) :
|
12133 |
+
null;
|
12134 |
+
}
|
12135 |
+
|
12136 |
+
/**
|
12137 |
+
* Returns the current context user or the network's main user.
|
12138 |
+
*
|
12139 |
+
* @author Vova Feldman (@svovaf)
|
12140 |
+
* @since 2.0.0
|
12141 |
+
*
|
12142 |
+
* @return FS_User
|
12143 |
+
*/
|
12144 |
+
function get_current_or_network_user() {
|
12145 |
+
return ( $this->_user instanceof FS_User ) ?
|
12146 |
+
$this->_user :
|
12147 |
+
$this->get_network_user();
|
12148 |
+
}
|
12149 |
+
|
12150 |
+
/**
|
12151 |
+
* Returns the main install associated with the network.
|
12152 |
+
*
|
12153 |
+
* @author Vova Feldman (@svovaf)
|
12154 |
+
* @since 2.0.0
|
12155 |
+
*
|
12156 |
+
* @return FS_Site
|
12157 |
+
*/
|
12158 |
+
function get_network_install() {
|
12159 |
+
if ( ! $this->_is_network_active ) {
|
12160 |
+
return null;
|
12161 |
+
}
|
12162 |
+
|
12163 |
+
return FS_Site::is_valid_id( $this->_storage->network_install_blog_id ) ?
|
12164 |
+
$this->get_install_by_blog_id( $this->_storage->network_install_blog_id ) :
|
12165 |
+
null;
|
12166 |
+
}
|
12167 |
+
|
12168 |
+
/**
|
12169 |
+
* Returns the blog ID that is associated with the main install.
|
12170 |
+
*
|
12171 |
+
* @author Leo Fajardo (@leorw)
|
12172 |
+
* @since 2.0.0
|
12173 |
+
*
|
12174 |
+
* @return int|null
|
12175 |
+
*/
|
12176 |
+
function get_network_install_blog_id() {
|
12177 |
+
if ( ! $this->_is_network_active ) {
|
12178 |
+
return null;
|
12179 |
+
}
|
12180 |
+
|
12181 |
+
return FS_Site::is_valid_id( $this->_storage->network_install_blog_id ) ?
|
12182 |
+
$this->_storage->network_install_blog_id :
|
12183 |
+
null;
|
12184 |
+
}
|
12185 |
+
|
12186 |
+
/**
|
12187 |
+
* Returns the current context install or the network's main install.
|
12188 |
+
*
|
12189 |
+
* @author Vova Feldman (@svovaf)
|
12190 |
+
* @since 2.0.0
|
12191 |
+
*
|
12192 |
+
* @return FS_Site
|
12193 |
+
*/
|
12194 |
+
function get_current_or_network_install() {
|
12195 |
+
return ( $this->_site instanceof FS_Site ) ?
|
12196 |
+
$this->_site :
|
12197 |
+
$this->get_network_install();
|
12198 |
+
}
|
12199 |
+
|
12200 |
+
/**
|
12201 |
+
* Check if executing a site level action from the network level admin.
|
12202 |
+
*
|
12203 |
+
* @author Vova Feldman (@svovaf)
|
12204 |
+
* @since 2.0.0
|
12205 |
+
*
|
12206 |
+
* @return false|int If yes, return the requested blog ID.
|
12207 |
+
*/
|
12208 |
+
private function is_network_level_site_specific_action() {
|
12209 |
+
if ( ! $this->_is_network_active ) {
|
12210 |
+
return false;
|
12211 |
+
}
|
12212 |
+
|
12213 |
+
if ( ! fs_is_network_admin() ) {
|
12214 |
+
return false;
|
12215 |
+
}
|
12216 |
+
|
12217 |
+
$blog_id = fs_request_get( 'blog_id', '' );
|
12218 |
+
|
12219 |
+
return is_numeric( $blog_id ) ? $blog_id : false;
|
12220 |
+
}
|
12221 |
+
|
12222 |
+
/**
|
12223 |
+
* Check if executing an action from the network level admin.
|
12224 |
+
*
|
12225 |
+
* @author Vova Feldman (@svovaf)
|
12226 |
+
* @since 2.0.0
|
12227 |
+
*
|
12228 |
+
* @return bool
|
12229 |
+
*/
|
12230 |
+
private function is_network_level_action() {
|
12231 |
+
return ( $this->_is_network_active && fs_is_network_admin() );
|
12232 |
+
}
|
12233 |
+
|
12234 |
+
/**
|
12235 |
+
* Needs to be executed after site deactivation, archive, deletion, or flag as spam.
|
12236 |
+
* The logic updates the network level user and blog, and reschedule the crons if the cron executing site matching the site that is no longer publicly active.
|
12237 |
+
*
|
12238 |
+
* @author Vova Feldman (@svovaf)
|
12239 |
+
* @since 2.0.0
|
12240 |
+
*
|
12241 |
+
* @param int $context_blog_id
|
12242 |
+
*/
|
12243 |
+
private function update_multisite_data_after_site_deactivation( $context_blog_id = 0 ) {
|
12244 |
+
$this->_logger->entrance();
|
12245 |
+
|
12246 |
+
if ( $this->_is_network_active ) {
|
12247 |
+
if ( $context_blog_id == $this->_storage->network_install_blog_id ) {
|
12248 |
+
$installs_map = $this->get_blog_install_map();
|
12249 |
+
|
12250 |
+
foreach ( $installs_map as $blog_id => $install ) {
|
12251 |
+
/**
|
12252 |
+
* @var FS_Site $install
|
12253 |
+
*/
|
12254 |
+
if ( $context_blog_id == $blog_id ) {
|
12255 |
+
continue;
|
12256 |
+
}
|
12257 |
+
|
12258 |
+
if ( $install->user_id != $this->_storage->network_user_id ) {
|
12259 |
+
continue;
|
12260 |
+
}
|
12261 |
+
|
12262 |
+
// Switch reference to a blog that is opted-in and belong to the same super-admin.
|
12263 |
+
$this->_storage->network_install_blog_id = $blog_id;
|
12264 |
+
break;
|
12265 |
+
}
|
12266 |
+
}
|
12267 |
+
}
|
12268 |
+
|
12269 |
+
if ( $this->is_sync_cron_scheduled() &&
|
12270 |
+
$context_blog_id == $this->get_sync_cron_blog_id()
|
12271 |
+
) {
|
12272 |
+
$this->schedule_sync_cron( WP_FS__SCRIPT_START_TIME, true, $context_blog_id );
|
12273 |
+
}
|
12274 |
+
|
12275 |
+
if ( $this->is_install_sync_scheduled() &&
|
12276 |
+
$context_blog_id == $this->get_install_sync_cron_blog_id()
|
12277 |
+
) {
|
12278 |
+
$this->schedule_install_sync( $context_blog_id );
|
12279 |
+
}
|
12280 |
+
}
|
12281 |
+
|
12282 |
+
/**
|
12283 |
+
* Executed after site deactivation, archive, or flag as spam.
|
12284 |
+
*
|
12285 |
+
* @author Vova Feldman (@svovaf)
|
12286 |
+
* @since 2.0.0
|
12287 |
+
*
|
12288 |
+
* @param int $context_blog_id
|
12289 |
+
*/
|
12290 |
+
public function _after_site_deactivated_callback( $context_blog_id = 0 ) {
|
12291 |
+
$this->_logger->entrance();
|
12292 |
+
|
12293 |
+
$install = $this->get_install_by_blog_id( $context_blog_id );
|
12294 |
+
|
12295 |
+
if ( ! is_object( $install ) ) {
|
12296 |
+
// Site not connected.
|
12297 |
+
return;
|
12298 |
+
}
|
12299 |
+
|
12300 |
+
$this->update_multisite_data_after_site_deactivation( $context_blog_id );
|
12301 |
+
|
12302 |
+
$current_blog_id = get_current_blog_id();
|
12303 |
+
|
12304 |
+
$this->switch_to_blog( $context_blog_id );
|
12305 |
+
|
12306 |
+
// Send deactivation event.
|
12307 |
+
$this->sync_install( array(
|
12308 |
+
'is_active' => false,
|
12309 |
+
) );
|
12310 |
+
|
12311 |
+
$this->switch_to_blog( $current_blog_id );
|
12312 |
+
}
|
12313 |
+
|
12314 |
+
/**
|
12315 |
+
* Executed after site deletion.
|
12316 |
+
*
|
12317 |
+
* @author Vova Feldman (@svovaf)
|
12318 |
+
* @since 2.0.0
|
12319 |
+
*
|
12320 |
+
* @param int $context_blog_id
|
12321 |
+
* @param bool $drop True if site's database tables should be dropped. Default is false.
|
12322 |
+
*/
|
12323 |
+
public function _after_site_deleted_callback( $context_blog_id = 0, $drop = false ) {
|
12324 |
+
$this->_logger->entrance();
|
12325 |
+
|
12326 |
+
$install = $this->get_install_by_blog_id( $context_blog_id );
|
12327 |
+
|
12328 |
+
if ( ! is_object( $install ) ) {
|
12329 |
+
// Site not connected.
|
12330 |
+
return;
|
12331 |
+
}
|
12332 |
+
|
12333 |
+
$this->update_multisite_data_after_site_deactivation( $context_blog_id );
|
12334 |
+
|
12335 |
+
$current_blog_id = get_current_blog_id();
|
12336 |
+
|
12337 |
+
$this->switch_to_blog( $context_blog_id );
|
12338 |
+
|
12339 |
+
if ( $drop ) {
|
12340 |
+
// Delete install if dropping site DB.
|
12341 |
+
$this->delete_account_event();
|
12342 |
+
} else {
|
12343 |
+
// Send deactivation event.
|
12344 |
+
$this->sync_install( array(
|
12345 |
+
'is_active' => false,
|
12346 |
+
) );
|
12347 |
+
}
|
12348 |
+
|
12349 |
+
$this->switch_to_blog( $current_blog_id );
|
12350 |
+
}
|
12351 |
+
|
12352 |
+
/**
|
12353 |
+
* Executed after site re-activation.
|
12354 |
+
*
|
12355 |
+
* @author Vova Feldman (@svovaf)
|
12356 |
+
* @since 2.0.0
|
12357 |
+
*
|
12358 |
+
* @param int $context_blog_id
|
12359 |
+
*/
|
12360 |
+
public function _after_site_reactivated_callback( $context_blog_id = 0 ) {
|
12361 |
+
$this->_logger->entrance();
|
12362 |
+
|
12363 |
+
$install = $this->get_install_by_blog_id( $context_blog_id );
|
12364 |
+
|
12365 |
+
if ( ! is_object( $install ) ) {
|
12366 |
+
// Site not connected.
|
12367 |
+
return;
|
12368 |
+
}
|
12369 |
+
|
12370 |
+
if ( ! self::is_site_active( $context_blog_id ) ) {
|
12371 |
+
// Site not yet active (can be in spam mode, archived, deleted...).
|
12372 |
+
return;
|
12373 |
+
}
|
12374 |
+
|
12375 |
+
$current_blog_id = get_current_blog_id();
|
12376 |
+
|
12377 |
+
$this->switch_to_blog( $context_blog_id );
|
12378 |
+
|
12379 |
+
// Send re-activation event.
|
12380 |
+
$this->sync_install( array(
|
12381 |
+
'is_active' => true,
|
12382 |
+
) );
|
12383 |
+
|
12384 |
+
$this->switch_to_blog( $current_blog_id );
|
12385 |
+
}
|
12386 |
+
|
12387 |
+
#endregion Multisite
|
12388 |
+
|
12389 |
+
/**
|
12390 |
+
* @author Leo Fajardo (@leorw)
|
12391 |
+
*
|
12392 |
+
* @param string $path
|
12393 |
+
* @param string $scheme
|
12394 |
+
* @param bool $network
|
12395 |
+
*
|
12396 |
+
* @return string
|
12397 |
+
*/
|
12398 |
+
private function admin_url( $path = '', $scheme = 'admin', $network = true ) {
|
12399 |
+
return ( $this->_is_network_active && $network ) ?
|
12400 |
+
network_admin_url( $path, $scheme ) :
|
12401 |
+
admin_url( $path, $scheme );
|
12402 |
+
}
|
12403 |
+
|
12404 |
+
/**
|
12405 |
+
* Check if currently in a specified admin page.
|
12406 |
+
*
|
12407 |
+
* @author Vova Feldman (@svovaf)
|
12408 |
+
* @since 1.2.2.7
|
12409 |
+
*
|
12410 |
+
* @param string $page
|
12411 |
+
*
|
12412 |
+
* @return bool
|
12413 |
+
*/
|
12414 |
+
function is_admin_page( $page ) {
|
12415 |
+
return ( $this->_menu->get_slug( $page ) === fs_request_get( 'page', '', 'get' ) );
|
12416 |
+
}
|
12417 |
+
|
12418 |
+
/**
|
12419 |
+
* Get module's main admin setting page URL.
|
12420 |
+
*
|
12421 |
+
* @author Vova Feldman (@svovaf)
|
12422 |
+
* @since 1.2.2.7
|
12423 |
+
*
|
12424 |
+
* @return string
|
12425 |
+
*/
|
12426 |
+
function main_menu_url() {
|
12427 |
+
return $this->_menu->main_menu_url();
|
12428 |
+
}
|
12429 |
+
|
12430 |
+
/**
|
12431 |
+
* Check if currently on the theme's setting page or
|
12432 |
+
* on any of the Freemius added pages (via tabs).
|
12433 |
+
*
|
12434 |
+
* @author Vova Feldman (@svovaf)
|
12435 |
+
* @since 1.2.2.7
|
12436 |
+
*
|
12437 |
+
* @return bool
|
12438 |
+
*/
|
12439 |
+
function is_theme_settings_page() {
|
12440 |
+
return fs_starts_with(
|
12441 |
+
fs_request_get( 'page', '', 'get' ),
|
12442 |
+
$this->_menu->get_slug()
|
12443 |
+
);
|
12444 |
+
}
|
12445 |
+
|
12446 |
+
/**
|
12447 |
+
* Plugin's account page + sync license URL.
|
12448 |
+
*
|
12449 |
+
* @author Vova Feldman (@svovaf)
|
12450 |
+
* @since 1.1.9.1
|
12451 |
+
*
|
12452 |
+
* @param bool|number $plugin_id
|
12453 |
+
* @param bool $add_action_nonce
|
12454 |
+
* @param array $params
|
12455 |
+
*
|
12456 |
+
* @return string
|
12457 |
+
*/
|
12458 |
+
function _get_sync_license_url( $plugin_id = false, $add_action_nonce = true, $params = array() ) {
|
12459 |
+
if ( is_numeric( $plugin_id ) ) {
|
12460 |
+
$params['plugin_id'] = $plugin_id;
|
12461 |
+
}
|
12462 |
+
|
12463 |
+
return $this->get_account_url(
|
12464 |
+
$this->get_unique_affix() . '_sync_license',
|
12465 |
+
$params,
|
12466 |
+
$add_action_nonce
|
12467 |
+
);
|
12468 |
+
}
|
12469 |
+
|
12470 |
+
/**
|
12471 |
+
* Plugin's account URL.
|
12472 |
+
*
|
12473 |
+
* @author Vova Feldman (@svovaf)
|
12474 |
+
* @since 1.0.4
|
12475 |
+
*
|
12476 |
+
* @param bool|string $action
|
12477 |
+
* @param array $params
|
12478 |
+
*
|
12479 |
+
* @param bool $add_action_nonce
|
12480 |
+
*
|
12481 |
+
* @return string
|
12482 |
+
*/
|
12483 |
+
function get_account_url( $action = false, $params = array(), $add_action_nonce = true ) {
|
12484 |
+
if ( is_string( $action ) ) {
|
12485 |
+
$params['fs_action'] = $action;
|
12486 |
+
}
|
12487 |
+
|
12488 |
+
self::require_pluggable_essentials();
|
12489 |
+
|
12490 |
+
return ( $add_action_nonce && is_string( $action ) ) ?
|
12491 |
+
fs_nonce_url( $this->_get_admin_page_url( 'account', $params ), $action ) :
|
12492 |
+
$this->_get_admin_page_url( 'account', $params );
|
12493 |
+
}
|
12494 |
+
|
12495 |
+
/**
|
12496 |
+
* @author Vova Feldman (@svovaf)
|
12497 |
+
* @since 1.2.0
|
12498 |
+
*
|
12499 |
+
* @param string $tab
|
12500 |
+
* @param bool $action
|
12501 |
+
* @param array $params
|
12502 |
+
* @param bool $add_action_nonce
|
12503 |
+
*
|
12504 |
+
* @return string
|
12505 |
+
*
|
12506 |
+
* @uses get_account_url()
|
12507 |
+
*/
|
12508 |
+
function get_account_tab_url( $tab, $action = false, $params = array(), $add_action_nonce = true ) {
|
12509 |
+
$params['tab'] = $tab;
|
12510 |
+
|
12511 |
+
return $this->get_account_url( $action, $params, $add_action_nonce );
|
12512 |
+
}
|
12513 |
+
|
12514 |
+
/**
|
12515 |
+
* Plugin's account URL.
|
12516 |
+
*
|
12517 |
+
* @author Vova Feldman (@svovaf)
|
12518 |
+
* @since 1.0.4
|
12519 |
+
*
|
12520 |
+
* @param bool|string $topic
|
12521 |
+
* @param bool|string $message
|
12522 |
+
*
|
12523 |
+
* @return string
|
12524 |
+
*/
|
12525 |
+
function contact_url( $topic = false, $message = false ) {
|
12526 |
+
$params = array();
|
12527 |
+
if ( is_string( $topic ) ) {
|
12528 |
+
$params['topic'] = $topic;
|
12529 |
+
}
|
12530 |
+
if ( is_string( $message ) ) {
|
12531 |
+
$params['message'] = $message;
|
12532 |
+
}
|
12533 |
+
|
12534 |
+
if ( $this->is_addon() ) {
|
12535 |
+
$params['addon_id'] = $this->get_id();
|
12536 |
+
|
12537 |
+
return $this->get_parent_instance()->_get_admin_page_url( 'contact', $params );
|
12538 |
+
} else {
|
12539 |
+
return $this->_get_admin_page_url( 'contact', $params );
|
12540 |
+
}
|
12541 |
+
}
|
12542 |
+
|
12543 |
+
/**
|
12544 |
+
* Add-on direct info URL.
|
12545 |
+
*
|
12546 |
+
* @author Vova Feldman (@svovaf)
|
12547 |
+
* @since 1.1.0
|
12548 |
+
*
|
12549 |
+
* @param string $slug
|
12550 |
+
*
|
12551 |
+
* @return string
|
12552 |
+
*/
|
12553 |
+
function addon_url( $slug ) {
|
12554 |
+
return $this->_get_admin_page_url( 'addons', array(
|
12555 |
+
'slug' => $slug
|
12556 |
+
) );
|
12557 |
+
}
|
12558 |
+
|
12559 |
+
/* Logger
|
12560 |
+
------------------------------------------------------------------------------------------------------------------*/
|
12561 |
+
/**
|
12562 |
+
* @param string $id
|
12563 |
+
* @param bool $prefix_slug
|
12564 |
+
*
|
12565 |
+
* @return FS_Logger
|
12566 |
+
*/
|
12567 |
+
function get_logger( $id = '', $prefix_slug = true ) {
|
12568 |
+
return FS_Logger::get_logger( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id );
|
12569 |
+
}
|
12570 |
+
|
12571 |
+
/**
|
12572 |
+
* Note: This method is used externally so don't delete it.
|
12573 |
+
*
|
12574 |
+
* @param $id
|
12575 |
+
* @param bool $load_options
|
12576 |
+
* @param bool $prefix_slug
|
12577 |
+
*
|
12578 |
+
* @return FS_Option_Manager
|
12579 |
+
*/
|
12580 |
+
function get_options_manager( $id, $load_options = false, $prefix_slug = true ) {
|
12581 |
+
return FS_Option_Manager::get_manager( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id, $load_options );
|
12582 |
+
}
|
12583 |
+
|
12584 |
+
/* Security
|
12585 |
+
------------------------------------------------------------------------------------------------------------------*/
|
12586 |
+
private static function _encrypt( $str ) {
|
12587 |
+
if ( is_null( $str ) ) {
|
12588 |
+
return null;
|
12589 |
+
}
|
12590 |
+
|
12591 |
+
/**
|
12592 |
+
* The encrypt/decrypt functions are used to protect
|
12593 |
+
* the user from messing up with some of the sensitive
|
12594 |
+
* data stored for the module as a JSON in the database.
|
12595 |
+
*
|
12596 |
+
* I used the same suggested hack by the theme review team.
|
12597 |
+
* For more details, look at the function `Base64UrlDecode()`
|
12598 |
+
* in `./sdk/FreemiusBase.php`.
|
12599 |
+
*
|
12600 |
+
* @todo Remove this hack once the base64 error is removed from the Theme Check.
|
12601 |
+
*
|
12602 |
+
* @author Vova Feldman (@svovaf)
|
12603 |
+
* @since 1.2.2
|
12604 |
+
*/
|
12605 |
+
$fn = 'base64' . '_encode';
|
12606 |
+
|
12607 |
+
return $fn( $str );
|
12608 |
+
}
|
12609 |
+
|
12610 |
+
static function _decrypt( $str ) {
|
12611 |
+
if ( is_null( $str ) ) {
|
12612 |
+
return null;
|
12613 |
+
}
|
12614 |
+
|
12615 |
+
/**
|
12616 |
+
* The encrypt/decrypt functions are used to protect
|
12617 |
+
* the user from messing up with some of the sensitive
|
12618 |
+
* data stored for the module as a JSON in the database.
|
12619 |
+
*
|
12620 |
+
* I used the same suggested hack by the theme review team.
|
12621 |
+
* For more details, look at the function `Base64UrlDecode()`
|
12622 |
+
* in `./sdk/FreemiusBase.php`.
|
12623 |
+
*
|
12624 |
+
* @todo Remove this hack once the base64 error is removed from the Theme Check.
|
12625 |
+
*
|
12626 |
+
* @author Vova Feldman (@svovaf)
|
12627 |
+
* @since 1.2.2
|
12628 |
+
*/
|
12629 |
+
$fn = 'base64' . '_decode';
|
12630 |
+
|
12631 |
+
return $fn( $str );
|
12632 |
+
}
|
12633 |
+
|
12634 |
+
/**
|
12635 |
+
* @author Vova Feldman (@svovaf)
|
12636 |
+
* @since 1.0.5
|
12637 |
+
*
|
12638 |
+
* @param FS_Entity $entity
|
12639 |
+
*
|
12640 |
+
* @return FS_Entity Return an encrypted clone entity.
|
12641 |
+
*/
|
12642 |
+
private static function _encrypt_entity( FS_Entity $entity ) {
|
12643 |
+
$clone = clone $entity;
|
12644 |
+
$props = get_object_vars( $entity );
|
12645 |
+
|
12646 |
+
foreach ( $props as $key => $val ) {
|
12647 |
+
$clone->{$key} = self::_encrypt( $val );
|
12648 |
+
}
|
12649 |
+
|
12650 |
+
return $clone;
|
12651 |
+
}
|
12652 |
+
|
12653 |
+
/**
|
12654 |
+
* @author Vova Feldman (@svovaf)
|
12655 |
+
* @since 1.0.5
|
12656 |
+
*
|
12657 |
+
* @param FS_Entity $entity
|
12658 |
+
*
|
12659 |
+
* @return FS_Entity Return an decrypted clone entity.
|
12660 |
+
*/
|
12661 |
+
private static function decrypt_entity( FS_Entity $entity ) {
|
12662 |
+
$clone = clone $entity;
|
12663 |
+
$props = get_object_vars( $entity );
|
12664 |
+
|
12665 |
+
foreach ( $props as $key => $val ) {
|
12666 |
+
$clone->{$key} = self::_decrypt( $val );
|
12667 |
+
}
|
12668 |
+
|
12669 |
+
return $clone;
|
12670 |
+
}
|
12671 |
+
|
12672 |
+
/**
|
12673 |
+
* Tries to activate account based on POST params.
|
12674 |
+
*
|
12675 |
+
* @author Vova Feldman (@svovaf)
|
12676 |
+
* @since 1.0.2
|
12677 |
+
*
|
12678 |
+
* @deprecated Not in use, outdated.
|
12679 |
+
*/
|
12680 |
+
function _activate_account() {
|
12681 |
+
if ( $this->is_registered() ) {
|
12682 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|