Auto Terms of Service and Privacy Policy - Version 1.8

Version Description

160 * WARNING: All direct plugin file edits (required in versions prior to v1.4) will be lost and will need to be entered via the plugin's settings page. Make sure you backup your information BEFORE UPDATING to a new version.

Note: See TracBrowser for help on using the repository browser.

Download this release

Release Info

Developer cliffpaulick
Plugin Icon Auto Terms of Service and Privacy Policy
Version 1.8
Comparing to
See all releases

Version 1.8

Files changed (92) hide show
  1. auto-terms-of-service-privacy-policy.php +712 -0
  2. freemius/LICENSE.txt +340 -0
  3. freemius/assets/css/admin/account.css +1 -0
  4. freemius/assets/css/admin/add-ons.css +2 -0
  5. freemius/assets/css/admin/common.css +1 -0
  6. freemius/assets/css/admin/connect.css +1 -0
  7. freemius/assets/css/admin/deactivation-feedback.css +1 -0
  8. freemius/assets/css/admin/debug.css +1 -0
  9. freemius/assets/css/admin/dialog-boxes.css +2 -0
  10. freemius/assets/css/admin/license-activation.css +1 -0
  11. freemius/assets/css/common.css +1 -0
  12. freemius/assets/img/auto-terms-of-service-and-privacy-policy.svg +26 -0
  13. freemius/assets/img/plugin-icon.png +0 -0
  14. freemius/assets/js/nojquery.ba-postmessage.js +140 -0
  15. freemius/assets/js/nojquery.ba-postmessage.min.js +12 -0
  16. freemius/assets/js/postmessage.js +135 -0
  17. freemius/assets/scss/_colors.scss +58 -0
  18. freemius/assets/scss/_functions.scss +0 -0
  19. freemius/assets/scss/_load.scss +4 -0
  20. freemius/assets/scss/_mixins.scss +227 -0
  21. freemius/assets/scss/_start.scss +4 -0
  22. freemius/assets/scss/_vars.scss +5 -0
  23. freemius/assets/scss/admin/_deactivation-feedback.scss +55 -0
  24. freemius/assets/scss/admin/_license-activation.scss +7 -0
  25. freemius/assets/scss/admin/_license-key-resend.scss +44 -0
  26. freemius/assets/scss/admin/_modal-common.scss +155 -0
  27. freemius/assets/scss/admin/account.scss +250 -0
  28. freemius/assets/scss/admin/add-ons.scss +449 -0
  29. freemius/assets/scss/admin/common.scss +160 -0
  30. freemius/assets/scss/admin/connect.scss +471 -0
  31. freemius/assets/scss/admin/debug.scss +91 -0
  32. freemius/assets/scss/admin/dialog-boxes.scss +5 -0
  33. freemius/config.php +301 -0
  34. freemius/includes/class-freemius-abstract.php +527 -0
  35. freemius/includes/class-freemius.php +11344 -0
  36. freemius/includes/class-fs-api.php +558 -0
  37. freemius/includes/class-fs-logger.php +205 -0
  38. freemius/includes/class-fs-plugin-updater.php +337 -0
  39. freemius/includes/class-fs-security.php +79 -0
  40. freemius/includes/debug/class-fs-debug-bar-panel.php +64 -0
  41. freemius/includes/debug/debug-bar-start.php +52 -0
  42. freemius/includes/entities/class-fs-billing.php +95 -0
  43. freemius/includes/entities/class-fs-entity.php +149 -0
  44. freemius/includes/entities/class-fs-payment.php +94 -0
  45. freemius/includes/entities/class-fs-plugin-info.php +34 -0
  46. freemius/includes/entities/class-fs-plugin-license.php +216 -0
  47. freemius/includes/entities/class-fs-plugin-plan.php +145 -0
  48. freemius/includes/entities/class-fs-plugin-tag.php +24 -0
  49. freemius/includes/entities/class-fs-plugin.php +94 -0
  50. freemius/includes/entities/class-fs-pricing.php +141 -0
  51. freemius/includes/entities/class-fs-scope-entity.php +29 -0
  52. freemius/includes/entities/class-fs-site.php +148 -0
  53. freemius/includes/entities/class-fs-subscription.php +125 -0
  54. freemius/includes/entities/class-fs-user.php +62 -0
  55. freemius/includes/fs-core-functions.php +505 -0
  56. freemius/includes/fs-essential-functions.php +433 -0
  57. freemius/includes/fs-plugin-info-dialog.php +930 -0
  58. freemius/includes/i18n.php +534 -0
  59. freemius/includes/managers/class-fs-admin-menu-manager.php +571 -0
  60. freemius/includes/managers/class-fs-admin-notice-manager.php +313 -0
  61. freemius/includes/managers/class-fs-cache-manager.php +237 -0
  62. freemius/includes/managers/class-fs-key-value-storage.php +326 -0
  63. freemius/includes/managers/class-fs-license-manager.php +104 -0
  64. freemius/includes/managers/class-fs-option-manager.php +302 -0
  65. freemius/includes/managers/class-fs-plan-manager.php +162 -0
  66. freemius/includes/managers/class-fs-plugin-manager.php +154 -0
  67. freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +9 -0
  68. freemius/includes/sdk/Exceptions/EmptyArgumentException.php +9 -0
  69. freemius/includes/sdk/Exceptions/Exception.php +74 -0
  70. freemius/includes/sdk/Exceptions/InvalidArgumentException.php +8 -0
  71. freemius/includes/sdk/Exceptions/OAuthException.php +12 -0
  72. freemius/includes/sdk/Freemius.php +583 -0
  73. freemius/includes/sdk/FreemiusBase.php +188 -0
  74. freemius/includes/sdk/LICENSE.txt +340 -0
  75. freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +47 -0
  76. freemius/languages/freemius-da_DK.mo +0 -0
  77. freemius/languages/freemius-da_DK.po +1661 -0
  78. freemius/languages/freemius-en.mo +0 -0
  79. freemius/languages/freemius-en.po +1522 -0
  80. freemius/languages/freemius-he.mo +0 -0
  81. freemius/languages/freemius-he.po +1661 -0
  82. freemius/languages/freemius-it_IT.mo +0 -0
  83. freemius/languages/freemius-it_IT.po +1668 -0
  84. freemius/languages/freemius.pot +1525 -0
  85. freemius/require.php +43 -0
  86. freemius/start.php +308 -0
  87. freemius/templates/account.php +716 -0
  88. freemius/templates/add-ons.php +154 -0
  89. freemius/templates/add-trial-to-pricing.php +31 -0
  90. freemius/templates/admin-notice.php +46 -0
  91. freemius/templates/all-admin-notice.php +39 -0
  92. freemius/templates/billing.php +406 -0
auto-terms-of-service-privacy-policy.php ADDED
@@ -0,0 +1,712 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Auto Terms of Service and Privacy Policy
4
+ Plugin URI: https://wordpress.org/plugins/auto-terms-of-service-and-privacy-policy/
5
+ Description: Puts your own information into a version of Automattic's <a href="http://en.wordpress.com/tos/">Terms of Service</a> and <a href="http://automattic.com/privacy/">Privacy Policy</a>, both available under the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Sharealike</a> license, that have been modified to exclude specifics to Automattic (like mentions of "JetPack", "WordPress.com", and "VIP") and have more generic language that can apply to most any site or service provider, including single sites, subscription sites, blog networks, and others. <strong>Edit plugin's settings, then use one or more of the 3 available shortcodes: [my_terms_of_service_and_privacy_policy], [my_terms_of_service], and/or [my_privacy_policy]</strong>
6
+ Text Domain: auto-terms-of-service-and-privacy-policy
7
+ Version: 1.8
8
+ Author: TourKick (Clifford P)
9
+ Author URI: http://twitter.com/TourKick
10
+ License: GPL2 - http://codex.wordpress.org/Writing_a_Plugin#License
11
+ */
12
+ /*
13
+ WARNING: I'm human. I'm not perfect. Neither are you. Neither is this...
14
+ But hopefully it's more good than bad.
15
+ */
16
+ /*
17
+ DISCLAIMER: I am not an attorney. I am not liable for any content, code, or other errors or omissions or inaccuracies. This plugin provides no warranties or guarantees. Do not rely on me to update the plugin ever. USE AT YOUR OWN RISK. I am not liable if Automattic removes their permission to use and adapt their work or if this plugin blows you or your website up or does anything negative. Finally, it needs to be said: READ YOUR OWN TERMS OF SERVICE AND PRIVACY POLICY BEFORE PUBLISHING. If you do not like Automattic's version, simply replacing their info with yours, maybe this plugin is not for you.
18
+ -Clifford Paulick and/or TourKick LLC
19
+ */
20
+
21
+
22
+ defined( 'ABSPATH' ) or die(); //do not allow plugin file to be called directly (security protection)
23
+
24
+
25
+ // plugin folder path
26
+ if(!defined('TCPP_PLUGIN_DIR')) {
27
+ define('TCPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
28
+ }
29
+ // plugin folder url
30
+ if(!defined('TCPP_PLUGIN_URL')) {
31
+ define('TCPP_PLUGIN_URL', plugin_dir_url( __FILE__ ));
32
+ }
33
+
34
+
35
+ // START Freemius
36
+ // Create a helper function for easy SDK access.
37
+ function tk_auto_terms_freemius() {
38
+ global $tk_auto_terms_freemius;
39
+
40
+ if ( ! isset( $tk_auto_terms_freemius ) ) {
41
+ // Include Freemius SDK.
42
+ require_once dirname(__FILE__) . '/freemius/start.php';
43
+
44
+ $tk_auto_terms_freemius = fs_dynamic_init( array(
45
+ 'id' => '78',
46
+ 'slug' => 'auto-terms-of-service-and-privacy-policy',
47
+ 'type' => 'plugin',
48
+ 'public_key' => 'pk_d9ea0af03f0660769f7de48a9f664',
49
+ 'is_premium' => false,
50
+ 'has_addons' => false,
51
+ 'has_paid_plans' => false,
52
+ 'menu' => array(
53
+ 'slug' => 'auto-terms-of-service-and-privacy-policy/auto-terms-of-service-privacy-policy.php',
54
+ 'parent' => array(
55
+ 'slug' => 'options-general.php',
56
+ ),
57
+ ),
58
+ ) );
59
+ }
60
+
61
+ return $tk_auto_terms_freemius;
62
+ }
63
+
64
+ // Init Freemius.
65
+ tk_auto_terms_freemius();
66
+
67
+
68
+ function tk_auto_terms_freemius_agreement_text() {
69
+ return sprintf( __( 'By using this plugin, you agree to %s and %s Terms.', 'auto-terms-of-service-and-privacy-policy' ),
70
+ '<a target="_blank" href="http://tourkick.com/terms/?utm_source=terms_agreement_text&utm_medium=free-plugin&utm_term=Auto%20Terms%20plugin&utm_campaign=WP%20Auto%20Terms">TourKick\'s</a>',
71
+ '<a target="_blank" href="https://freemius.com/terms/">Freemius\'</a>'
72
+ );
73
+ }
74
+
75
+
76
+ // Freemius: customize the new user message
77
+ /* Default text:
78
+ Please help us improve Auto Terms of Service and Privacy Policy! If you opt-in, some data about your usage of Auto Terms of Service and Privacy Policy will be sent to freemius.com. If you skip this, that's okay! Auto Terms of Service and Privacy Policy will still work just fine.
79
+ */
80
+ function tk_auto_terms_freemius_custom_connect_message(
81
+ $message,
82
+ $user_first_name,
83
+ $plugin_title,
84
+ $user_login,
85
+ $site_link,
86
+ $freemius_link
87
+ ) {
88
+ $tk_custom_message = sprintf(
89
+ __fs( 'hey-x' ) . '<br><br>' . __( 'The <strong>%2$s</strong> plugin is ready to go! Want to help make %2$s more awesome? Securely share some data to get the best experience and stay informed.', 'auto-terms-of-service-and-privacy-policy' ),
90
+ $user_first_name,
91
+ $plugin_title,
92
+ '<strong>' . $user_login . '</strong>',
93
+ $site_link,
94
+ $freemius_link
95
+ );
96
+
97
+ $tk_custom_message .= '<br><small>' . tk_auto_terms_freemius_agreement_text() . '</small>';
98
+
99
+ return $tk_custom_message;
100
+ }
101
+ tk_auto_terms_freemius()->add_filter( 'connect_message', 'tk_auto_terms_freemius_custom_connect_message', 10, 6 );
102
+
103
+
104
+ // END Freemius
105
+
106
+
107
+ // Add settings link on plugin page from http://bavotasan.com/2009/a-settings-link-for-your-wordpress-plugins/
108
+ function atospp_plugin_settings_link($links) {
109
+ $settings_link = '<a href="options-general.php?page=auto-terms-of-service-and-privacy-policy/auto-terms-of-service-privacy-policy.php">Settings</a>';
110
+ array_unshift($links, $settings_link);
111
+ return $links;
112
+ }
113
+ $plugin = plugin_basename(__FILE__);
114
+ add_filter("plugin_action_links_$plugin", 'atospp_plugin_settings_link' );
115
+
116
+
117
+
118
+ /* --------------------- START OPTIONS PAGE ------------------ */
119
+ class ATOSPP_Options{
120
+
121
+ public $options;
122
+
123
+ public function __construct(){
124
+ //delete_option('atospp_plugin_options');
125
+ $this->options = get_option('atospp_plugin_options');
126
+ $this->register_settings_and_fields();
127
+ }
128
+
129
+ public static function add_menu_page(){
130
+ add_options_page('Auto TOS & PP Options', 'Auto TOS & PP', 'administrator', __FILE__, array('ATOSPP_Options', 'display_options_page'));
131
+ }
132
+
133
+ public static function display_options_page(){
134
+ ?>
135
+
136
+ <div class="wrap">
137
+
138
+ <h2>Auto Terms of Service and Privacy Policy Options</h2>
139
+
140
+ <form action="options.php" method="post" enctype="multipart/form-data">
141
+ <?php
142
+ if ( function_exists('settings_fields') ) {
143
+ settings_fields('atospp_plugin_options'); // Output nonce, action, and option_page fields for a settings page. This should match the group name used in register_setting()
144
+ }
145
+ do_settings_sections(__FILE__);
146
+ ?>
147
+
148
+ <p class="submit">
149
+ <input name="submit" type="submit" class="button-primary" value="Save Changes">
150
+ </p>
151
+ </form>
152
+
153
+ </div>
154
+
155
+ <?php
156
+ }
157
+
158
+ public function settings_page_greetbox(){
159
+ $tourkicklogo = plugins_url('images/tourkick-logo-square-300.png', __FILE__);
160
+ $tourkicklogo = str_replace('http:', '', $tourkicklogo); //protocol-relative to make sure it works if wp-admin is HTTPS
161
+ $tourkicklogo = sprintf('<a href="http://wpautoterms.com/" target="_blank"><img style="float: left; margin: 5px 40px 10px 10px;" width="100" height="100" src=\'%s\'></a>', $tourkicklogo);
162
+ $displaytop = '<div style="width: 80%; padding: 20px; margin: 20px; background-color: #fff;">';
163
+ $displaytop .= $tourkicklogo;
164
+ $displaytop .= '<h2><a href="http://b.tourkick.com/atospp-rate-5-stars" target="_blank">Leave a Review</a>
165
+ <br><br>
166
+ <a href="http://b.tourkick.com/atospp-w-org-support-forum" target="_blank">Plugin Support and Feature Requests</a></h2>
167
+ <br>
168
+ <p>In the future, I plan to add additional features, including additional languages, ability to customize text, and to easily add a checkbox to signup forms.</p>
169
+ <p>Some new features may be free and some may be paid, either via a separate premium version or add-ons. Monetizing the plugin should fund further development and further improvement to both free and paid versions.</p>
170
+ <p>Please share your feedback (including feature requests) via one of the WordPress links, above.</p>
171
+ <br>
172
+ Find me online: <a href="http://b.tourkick.com/twitter-follow-tourkick" target="_blank">Twitter</a> | <a href="http://b.tourkick.com/facebook-tourkick" target="_blank">Facebook</a> | <a href="http://b.tourkick.com/cliffpaulick-w-org-profile-plugins" target="_blank">WordPress Profile</a> | <a href="http://bit.ly/tourkick-com" target="_blank">Website</a></p>
173
+ </div>';
174
+ $displaytop .= 'Settings<br><br><hr><span style="font-size: 80%;">Available shortcodes:<ul><li>[my_terms_of_service_and_privacy_policy]</li><li> [my_terms_of_service]</li><li>[my_privacy_policy]</li></ul></span><hr>';
175
+
176
+ return $displaytop;
177
+ }
178
+
179
+
180
+ public function register_settings_and_fields(){
181
+ register_setting('atospp_plugin_options', 'atospp_plugin_options'); // https://codex.wordpress.org/Function_Reference/register_setting
182
+ $greetbox = $this->settings_page_greetbox();
183
+ add_settings_section('atospp_section', $greetbox, array($this, 'atospp_section_callback'), __FILE__);
184
+
185
+ add_settings_field('atospp_onoff', 'On/Off:<br><small><span style="color:darkred;">Enter all your info below, then Turn On so shortcodes can work.</span><br><span style="color:red;">Will not allow you to Turn On until you enter all required <span style="color:red;">(*)</span> fields.</span></small>', array($this, 'atospp_onoff_setting'), __FILE__, 'atospp_section');
186
+ add_settings_field('atospp_tos_heading', '<span style="color:red;">(*)</span> TOS Heading:<br><small>e.g. Terms of Service, Terms of Use</small>', array($this, 'atospp_tos_heading_setting'), __FILE__, 'atospp_section');
187
+ add_settings_field('atospp_pp_heading', '<span style="color:red;">(*)</span> PP Heading:<br><small>e.g. Privacy Policy</small>', array($this, 'atospp_pp_heading_setting'), __FILE__, 'atospp_section');
188
+ add_settings_field('atospp_namefull', '<span style="color:red;">(*)</span> Full Name:<br><small>e.g. Automattic Inc.</small>', array($this, 'atospp_namefull_setting'), __FILE__, 'atospp_section');
189
+ add_settings_field('atospp_name', '<span style="color:red;">(*)</span> Name:<br><small>e.g. Automattic</small>', array($this, 'atospp_name_setting'), __FILE__, 'atospp_section');
190
+ add_settings_field('atospp_namepossessive', '<span style="color:red;">(*)</span> Possessive Name:<br><small>e.g. Automattic\'s</small>', array($this, 'atospp_namepossessive_setting'), __FILE__, 'atospp_section');
191
+ add_settings_field('atospp_domainname', '<span style="color:red;">(*)</span> Domain Name:<br><small>e.g. Automattic.com</small>', array($this, 'atospp_domainname_setting'), __FILE__, 'atospp_section');
192
+ add_settings_field('atospp_websiteurl', '<span style="color:red;">(*)</span> Official Website URL:<br><small>e.g. http://www.wordpress.com/</small>', array($this, 'atospp_websiteurl_setting'), __FILE__, 'atospp_section');
193
+ add_settings_field('atospp_minage', '<span style="color:red;">(*)</span> Minimum Age:<br><small>e.g. 13</small>', array($this, 'atospp_minage_setting'), __FILE__, 'atospp_section');
194
+ add_settings_field('atospp_time_feesnotifications', '<span style="color:red;">(*)</span> Time Period for changing fees and for notifications:<br><small>e.g. thirty (30) days</small>', array($this, 'atospp_time_feesnotifications_setting'), __FILE__, 'atospp_section');
195
+ add_settings_field('atospp_time_replytopriorityemail', '<span style="color:red;">(*)</span> Time Period for replying to priority email:<br><small>e.g. one business day</small>', array($this, 'atospp_time_replytopriorityemail_setting'), __FILE__, 'atospp_section');
196
+ add_settings_field('atospp_time_determiningmaxdamages', '<span style="color:red;">(*)</span> Time Period for determining maximum damages:<br><small>e.g. twelve (12) month<br><span style="color:darkred;">Notice no "S" on "month"</span></small>', array($this, 'atospp_time_determiningmaxdamages_setting'), __FILE__, 'atospp_section');
197
+ add_settings_field('atospp_dmcanoticeurl', 'DMCA Notice URL:<br><small>e.g. http://automattic.com/dmca-notice/<br><span style="color:darkred;">If left blank, sentence about reporting DMCA violations will be shown but not hyperlinked.</span></small>', array($this, 'atospp_dmcanoticeurl_setting'), __FILE__, 'atospp_section');
198
+ add_settings_field('atospp_venue', '<span style="color:red;">(*)</span> Venue:<br><small>e.g. state of California, U.S.A.</small>', array($this, 'atospp_venue_setting'), __FILE__, 'atospp_section');
199
+ add_settings_field('atospp_courtlocation', '<span style="color:red;">(*)</span> Court Location:<br><small>e.g. San Francisco County, California</small>', array($this, 'atospp_courtlocation_setting'), __FILE__, 'atospp_section');
200
+ add_settings_field('atospp_arbitrationlocation', '<span style="color:red;">(*)</span> Arbitration Location:<br><small>e.g. San Francisco, California</small>', array($this, 'atospp_arbitrationlocation_setting'), __FILE__, 'atospp_section');
201
+
202
+ }
203
+
204
+ public function atospp_section_callback(){
205
+ //Optional
206
+ }
207
+
208
+ /*
209
+ INPUTS
210
+ */
211
+
212
+ public function atospp_tos_heading_setting(){
213
+ $tos_heading = "Terms of Service";
214
+ if(!empty($this->options['atospp_tos_heading'])){
215
+ $tos_heading = $this->options['atospp_tos_heading'];
216
+ }
217
+ printf( '<input name="atospp_plugin_options[atospp_tos_heading]" type="text" value="%s">', $tos_heading );
218
+ }
219
+
220
+ public function atospp_pp_heading_setting(){
221
+ $pp_heading = "Privacy Policy";
222
+ if(!empty($this->options['atospp_pp_heading'])){
223
+ $pp_heading = $this->options['atospp_pp_heading'];
224
+ }
225
+ printf( '<input name="atospp_plugin_options[atospp_pp_heading]" type="text" value="%s">', $pp_heading );
226
+ }
227
+
228
+ public function atospp_namefull_setting(){
229
+ $namefull = '';
230
+ if(!empty($this->options['atospp_namefull'])){
231
+ $namefull = $this->options['atospp_namefull'];
232
+ }
233
+ printf( '<input name="atospp_plugin_options[atospp_namefull]" type="text" value="%s">', $namefull );
234
+ }
235
+
236
+ public function atospp_name_setting(){
237
+ $name = '';
238
+ if(!empty($this->options['atospp_name'])){
239
+ $name = $this->options['atospp_name'];
240
+ }
241
+ printf( '<input name="atospp_plugin_options[atospp_name]" type="text" value="%s">', $name );
242
+ }
243
+
244
+ public function atospp_namepossessive_setting(){
245
+ $namepossessive = '';
246
+ if(!empty($this->options['atospp_namepossessive'])){
247
+ $namepossessive = $this->options['atospp_namepossessive'];
248
+ }
249
+ printf( '<input name="atospp_plugin_options[atospp_namepossessive]" type="text" value="%s">', $namepossessive );
250
+ }
251
+
252
+ public function atospp_domainname_setting(){
253
+ $domainname = '';
254
+ if(!empty($this->options['atospp_domainname'])){
255
+ $domainname = $this->options['atospp_domainname'];
256
+ }
257
+ printf( '<input name="atospp_plugin_options[atospp_domainname]" type="text" value="%s">', $domainname );
258
+ }
259
+
260
+ public function atospp_websiteurl_setting(){
261
+ $websiteurl = get_site_url();
262
+ if(!empty($this->options['atospp_websiteurl'])){
263
+ $websiteurl = $this->options['atospp_websiteurl'];
264
+ }
265
+ printf( '<input name="atospp_plugin_options[atospp_websiteurl]" type="text" value="%s">', $websiteurl );
266
+ }
267
+
268
+ public function atospp_minage_setting(){
269
+ $minage = "13";
270
+ if(!empty($this->options['atospp_minage'])){
271
+ $minage = $this->options['atospp_minage'];
272
+ }
273
+ printf( '<input name="atospp_plugin_options[atospp_minage]" type="text" value="%s">', $minage );
274
+ }
275
+
276
+ public function atospp_time_feesnotifications_setting(){
277
+ $timefeesnotifications = "thirty (30) days";
278
+ if(!empty($this->options['atospp_time_feesnotifications'])){
279
+ $timefeesnotifications = $this->options['atospp_time_feesnotifications'];
280
+ }
281
+ printf( '<input name="atospp_plugin_options[atospp_time_feesnotifications]" type="text" value="%s">', $timefeesnotifications );
282
+ }
283
+
284
+ public function atospp_time_replytopriorityemail_setting(){
285
+ $timereplytopriorityemail = "one business day";
286
+ if(!empty($this->options['atospp_time_replytopriorityemail'])){
287
+ $timereplytopriorityemail = $this->options['atospp_time_replytopriorityemail'];
288
+ }
289
+ printf( '<input name="atospp_plugin_options[atospp_time_replytopriorityemail]" type="text" value="%s">', $timereplytopriorityemail );
290
+ }
291
+
292
+ public function atospp_time_determiningmaxdamages_setting(){
293
+ $timedeterminingmaxdamages = "twelve (12) month";
294
+ if(!empty($this->options['atospp_time_determiningmaxdamages'])){
295
+ $timedeterminingmaxdamages = $this->options['atospp_time_determiningmaxdamages'];
296
+ }
297
+ printf( '<input name="atospp_plugin_options[atospp_time_determiningmaxdamages]" type="text" value="%s">', $timedeterminingmaxdamages );
298
+ }
299
+
300
+ public function atospp_dmcanoticeurl_setting(){
301
+ $dmcanoticeurl = '';
302
+ if(!empty($this->options['atospp_dmcanoticeurl'])){
303
+ $dmcanoticeurl = $this->options['atospp_dmcanoticeurl'];
304
+ }
305
+ printf( '<input name="atospp_plugin_options[atospp_dmcanoticeurl]" type="text" value="%s">', $dmcanoticeurl );
306
+ }
307
+
308
+ public function atospp_venue_setting(){
309
+ $venue = '';
310
+ if(!empty($this->options['atospp_venue'])){
311
+ $venue = $this->options['atospp_venue'];
312
+ }
313
+ printf( '<input name="atospp_plugin_options[atospp_venue]" type="text" value="%s">', $venue );
314
+ }
315
+
316
+ public function atospp_courtlocation_setting(){
317
+ $courtlocation = '';
318
+ if(!empty($this->options['atospp_courtlocation'])){
319
+ $courtlocation = $this->options['atospp_courtlocation'];
320
+ }
321
+ printf( '<input name="atospp_plugin_options[atospp_courtlocation]" type="text" value="%s">', $courtlocation );
322
+ }
323
+
324
+ public function atospp_arbitrationlocation_setting(){
325
+ $arbitrationlocation = '';
326
+ if(!empty($this->options['atospp_arbitrationlocation'])){
327
+ $arbitrationlocation = $this->options['atospp_arbitrationlocation'];
328
+ }
329
+ printf( '<input name="atospp_plugin_options[atospp_arbitrationlocation]" type="text" value="%s">', $arbitrationlocation );
330
+ }
331
+
332
+
333
+
334
+ // last so it can check required fields!
335
+ public function atospp_onoff_setting(){
336
+ $onoff = 'atospp_off';
337
+ if(
338
+ !empty($this->options['atospp_onoff'])
339
+ && !empty($this->options['atospp_tos_heading'])
340
+ && !empty($this->options['atospp_pp_heading'])
341
+ && !empty($this->options['atospp_namefull'])
342
+ && !empty($this->options['atospp_name'])
343
+ && !empty($this->options['atospp_namepossessive'])
344
+ && !empty($this->options['atospp_domainname'])
345
+ && !empty($this->options['atospp_websiteurl'])
346
+ && !empty($this->options['atospp_minage'])
347
+ && !empty($this->options['atospp_time_feesnotifications'])
348
+ && !empty($this->options['atospp_time_replytopriorityemail'])
349
+ && !empty($this->options['atospp_time_determiningmaxdamages'])
350
+ && !empty($this->options['atospp_venue'])
351
+ && !empty($this->options['atospp_courtlocation'])
352
+ && !empty($this->options['atospp_arbitrationlocation'])
353
+ ){
354
+ $onoff = $this->options['atospp_onoff'];
355
+ }
356
+
357
+ $off = '';
358
+ if($onoff == 'atospp_off'){
359
+ $off = "selected='selected'";
360
+ }
361
+
362
+ $on = '';
363
+ if($onoff == 'atospp_on'){
364
+ $on = "selected='selected'";
365
+ }
366
+
367
+ echo "<select name='atospp_plugin_options[atospp_onoff]'>";
368
+ echo "<option value='atospp_off' $off>Off / Coming Soon</option>";
369
+ echo "<option value='atospp_on' $on>On / Displaying</option>";
370
+ echo "</select>";
371
+ }
372
+
373
+
374
+
375
+ }
376
+
377
+ add_action('admin_menu', 'initOptionsATOSPP');
378
+
379
+ function initOptionsATOSPP(){
380
+ ATOSPP_Options::add_menu_page();
381
+ }
382
+
383
+ add_action('admin_init', 'initAdminATOSPP');
384
+
385
+ function initAdminATOSPP(){
386
+ new ATOSPP_Options();
387
+ }
388
+
389
+
390
+
391
+ /* --------------------- END OPTIONS PAGE ------------------ */
392
+
393
+
394
+
395
+
396
+ /* --------------------- START SETUP ------------------ */
397
+
398
+ function atospp_settings_url() {
399
+ $settingspage = admin_url('options-general.php?page=auto-terms-of-service-and-privacy-policy/auto-terms-of-service-privacy-policy.php');
400
+
401
+ return $settingspage;
402
+ }
403
+
404
+
405
+ function atospp_back_to_top() {
406
+ $backtotoptext = '<p><a class="auto-tos-pp-back-to-top" href="#atospp-toc">Back to top</a></p>';
407
+
408
+ return $backtotoptext;
409
+ }
410
+
411
+
412
+ function atospp_separator() {
413
+ $separator = '<div class="auto-tos-pp-separator" style="width: 100%; border-bottom: 1px black solid; margin: 20px 0 20px 0;"></div>';
414
+
415
+ return $separator;
416
+ }
417
+
418
+
419
+ function atospp_plugin_version() { //from http://code.garyjones.co.uk/get-wordpress-plugin-version because get_plugin_data() only works in wp-admin
420
+ if ( ! function_exists( 'get_plugins' ) ) {
421
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
422
+ }
423
+ $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) );
424
+ $plugin_file = basename( ( __FILE__ ) );
425
+ $plugin_version = $plugin_folder[$plugin_file]['Version'];
426
+
427
+ return $plugin_version;
428
+ }
429
+
430
+ function atospp_publish_on_off() {
431
+ $options = get_option('atospp_plugin_options');
432
+
433
+ if(
434
+ empty($options['atospp_onoff'])
435
+ || empty($options['atospp_tos_heading'])
436
+ || empty($options['atospp_pp_heading'])
437
+ || empty($options['atospp_namefull'])
438
+ || empty($options['atospp_name'])
439
+ || empty($options['atospp_namepossessive'])
440
+ || empty($options['atospp_domainname'])
441
+ || empty($options['atospp_websiteurl'])
442
+ || empty($options['atospp_minage'])
443
+ || empty($options['atospp_time_feesnotifications'])
444
+ || empty($options['atospp_time_replytopriorityemail'])
445
+ || empty($options['atospp_time_determiningmaxdamages'])
446
+ || empty($options['atospp_venue'])
447
+ || empty($options['atospp_courtlocation'])
448
+ || empty($options['atospp_arbitrationlocation'])
449
+ ){
450
+ $tcpp_publish = 'atospp_off';
451
+ } else {
452
+ $tcpp_publish = $options['atospp_onoff'];
453
+ }
454
+
455
+ return $tcpp_publish;
456
+ }
457
+
458
+
459
+
460
+ function atospp_create_tos() {
461
+
462
+ $options = get_option('atospp_plugin_options');
463
+
464
+ $tcpp_termsheading = $options['atospp_tos_heading'];
465
+ $tcpp_privacypolicyheading = $options['atospp_pp_heading'];
466
+ $tcpp_biznamefull = $options['atospp_namefull'];
467
+ $tcpp_bizname = $options['atospp_name'];
468
+ $tcpp_biznamepossessive = $options['atospp_namepossessive'];
469
+ $tcpp_domainname = $options['atospp_domainname'];
470
+ $tcpp_websiteurl = $options['atospp_websiteurl'];
471
+ $tcpp_minimumage = $options['atospp_minage'];
472
+ $tcpp_timeperiodforchangingfeesandfornotifications = $options['atospp_time_feesnotifications'];
473
+ $tcpp_timeperiodtoreplytopriorityemail = $options['atospp_time_replytopriorityemail'];
474
+ $tcpp_timeperiodfordeterminingmaximumdamages = $options['atospp_time_determiningmaxdamages'];
475
+
476
+ $tcpp_dmcanoticeurl = $options['atospp_dmcanoticeurl'];
477
+
478
+ if(!empty($tcpp_dmcanoticeurl)) {
479
+ $tcpp_dmcaoutput = "$tcpp_bizname in accordance with <a href=\"$tcpp_dmcanoticeurl\">$tcpp_biznamepossessive Digital Millennium Copyright Act (&quot;DMCA&quot;) Policy</a>";
480
+ } else {
481
+ $tcpp_dmcaoutput = "$tcpp_bizname in accordance with $tcpp_biznamepossessive Digital Millennium Copyright Act (&quot;DMCA&quot;) Policy";
482
+ }
483
+
484
+ $tcpp_venue = $options['atospp_venue'];
485
+ $tcpp_courtlocation = $options['atospp_courtlocation'];
486
+ $tcpp_arbitrationlocation = $options['atospp_arbitrationlocation'];
487
+
488
+
489
+
490
+ $tcpp_tcond = '';
491
+ $tcpp_tcond .= apply_filters( 'atospp_tos_before_heading', '' );
492
+ $tcpp_tcond .= "<h2 id='atospp-terms' class='auto-tos-pp tosheading'>$tcpp_termsheading:</h2>";
493
+ $tcpp_tcond .= apply_filters( 'atospp_tos_after_heading', '' );
494
+ $tcpp_tcond .= "<p>The following terms and conditions govern all use of the $tcpp_domainname website and all content, services and products available at or through the website (taken together, the Website). The Website is owned and operated by $tcpp_biznamefull (&quot;$tcpp_bizname&quot;). The Website is offered subject to your acceptance without modification of all of the terms and conditions contained herein and all other operating rules, policies (including, without limitation, $tcpp_biznamepossessive $tcpp_privacypolicyheading) and procedures that may be published from time to time on this Site by $tcpp_bizname (collectively, the &quot;Agreement&quot;).</p>
495
+ <p>Please read this Agreement carefully before accessing or using the Website. By accessing or using any part of the web site, you agree to become bound by the terms and conditions of this agreement. If you do not agree to all the terms and conditions of this agreement, then you may not access the Website or use any services. If these terms and conditions are considered an offer by $tcpp_bizname, acceptance is expressly limited to these terms. The Website is available only to individuals who are at least $tcpp_minimumage years old.</p>
496
+ <ol>
497
+ <li><strong>Your $tcpp_domainname Account and Site.</strong> If you create a blog/site on the Website, you are responsible for maintaining the security of your account and blog, and you are fully responsible for all activities that occur under the account and any other actions taken in connection with the blog. You must not describe or assign keywords to your blog in a misleading or unlawful manner, including in a manner intended to trade on the name or reputation of others, and $tcpp_bizname may change or remove any description or keyword that it considers inappropriate or unlawful, or otherwise likely to cause $tcpp_bizname liability. You must immediately notify $tcpp_bizname of any unauthorized uses of your blog, your account or any other breaches of security. $tcpp_bizname will not be liable for any acts or omissions by You, including any damages of any kind incurred as a result of such acts or omissions.</li>
498
+ <li><strong>Responsibility of Contributors.</strong> If you operate a blog, comment on a blog, post material to the Website, post links on the Website, or otherwise make (or allow any third party to make) material available by means of the Website (any such material, &quot;Content&quot;), You are entirely responsible for the content of, and any harm resulting from, that Content. That is the case regardless of whether the Content in question constitutes text, graphics, an audio file, or computer software. By making Content available, you represent and warrant that:
499
+ <ul>
500
+ <li>the downloading, copying and use of the Content will not infringe the proprietary rights, including but not limited to the copyright, patent, trademark or trade secret rights, of any third party;</li>
501
+ <li>if your employer has rights to intellectual property you create, you have either (i) received permission from your employer to post or make available the Content, including but not limited to any software, or (ii) secured from your employer a waiver as to all rights in or to the Content;</li>
502
+ <li>you have fully complied with any third-party licenses relating to the Content, and have done all things necessary to successfully pass through to end users any required terms;</li>
503
+ <li>the Content does not contain or install any viruses, worms, malware, Trojan horses or other harmful or destructive content;</li>
504
+ <li class='important'>the Content is not spam, is not machine- or randomly-generated, and does not contain unethical or unwanted commercial content designed to drive traffic to third party sites or boost the search engine rankings of third party sites, or to further unlawful acts (such as phishing) or mislead recipients as to the source of the material (such as spoofing);</li>
505
+ <li>the Content is not pornographic, does not contain threats or incite violence towards individuals or entities, and does not violate the privacy or publicity rights of any third party;</li>
506
+ <li>your blog is not getting advertised via unwanted electronic messages such as spam links on newsgroups, email lists, other blogs and web sites, and similar unsolicited promotional methods;</li>
507
+ <li>your blog is not named in a manner that misleads your readers into thinking that you are another person or company. For example, your blog's URL or name is not the name of a person other than yourself or company other than your own; and</li>
508
+ <li>you have, in the case of Content that includes computer code, accurately categorized and/or described the type, nature, uses and effects of the materials, whether requested to do so by $tcpp_bizname or otherwise.</li>
509
+ </ul>
510
+ <p>By submitting Content to $tcpp_bizname for inclusion on your Website, you grant $tcpp_bizname a world-wide, royalty-free, and non-exclusive license to reproduce, modify, adapt and publish the Content solely for the purpose of displaying, distributing and promoting your blog. If you delete Content, $tcpp_bizname will use reasonable efforts to remove it from the Website, but you acknowledge that caching or references to the Content may not be made immediately unavailable.</p>
511
+ <p>Without limiting any of those representations or warranties, $tcpp_bizname has the right (though not the obligation) to, in $tcpp_biznamepossessive sole discretion (i) refuse or remove any content that, in $tcpp_biznamepossessive reasonable opinion, violates any $tcpp_bizname policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in $tcpp_biznamepossessive sole discretion. $tcpp_bizname will have no obligation to provide a refund of any amounts previously paid.</li>
512
+ <li><strong>Payment and Renewal.</strong>
513
+ <ul>
514
+ <li><strong>General Terms.</strong><br>
515
+ By selecting a product or service, you agree to pay $tcpp_bizname the one-time and/or monthly or annual subscription fees indicated (additional payment terms may be included in other communications). Subscription payments will be charged on a pre-pay basis on the day you sign up for an Upgrade and will cover the use of that service for a monthly or annual subscription period as indicated. Payments are not refundable.</li>
516
+ <li><strong>Automatic Renewal. </strong><br>
517
+ Unless you notify $tcpp_bizname before the end of the applicable subscription period that you want to cancel a subscription, your subscription will automatically renew and you authorize us to collect the then-applicable annual or monthly subscription fee for such subscription (as well as any taxes) using any credit card or other payment mechanism we have on record for you. Upgrades can be canceled at any time by submitting your request to $tcpp_bizname in writing.</li>
518
+ </ul>
519
+ </li>
520
+ <li><strong>Services.</strong>
521
+ <ul>
522
+ <li><strong>Fees; Payment. </strong>By signing up for a Services account you agree to pay $tcpp_bizname the applicable setup fees and recurring fees. Applicable fees will be invoiced starting from the day your services are established and in advance of using such services. $tcpp_bizname reserves the right to change the payment terms and fees upon $tcpp_timeperiodforchangingfeesandfornotifications prior written notice to you. Services can be canceled by you at anytime on $tcpp_timeperiodforchangingfeesandfornotifications written notice to $tcpp_bizname.</li>
523
+ <li><strong>Support.</strong> If your service includes access to priority email support. &quot;Email support&quot; means the ability to make requests for technical support assistance by email at any time (with reasonable efforts by $tcpp_bizname to respond within $tcpp_timeperiodtoreplytopriorityemail) concerning the use of the VIP Services. &quot;Priority&quot; means that support takes priority over support for users of the standard or free $tcpp_domainname services. All support will be provided in accordance with $tcpp_bizname standard services practices, procedures and policies.</li>
524
+ </ul>
525
+ <li><strong>Responsibility of Website Visitors.</strong> $tcpp_bizname has not reviewed, and cannot review, all of the material, including computer software, posted to the Website, and cannot therefore be responsible for that material's content, use or effects. By operating the Website, $tcpp_bizname does not represent or imply that it endorses the material there posted, or that it believes such material to be accurate, useful or non-harmful. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses, and other harmful or destructive content. The Website may contain content that is offensive, indecent, or otherwise objectionable, as well as content containing technical inaccuracies, typographical mistakes, and other errors. The Website may also contain material that violates the privacy or publicity rights, or infringes the intellectual property and other proprietary rights, of third parties, or the downloading, copying or use of which is subject to additional terms and conditions, stated or unstated. $tcpp_bizname disclaims any responsibility for any harm resulting from the use by visitors of the Website, or from any downloading by those visitors of content there posted.</li>
526
+ <li><strong>Content Posted on Other Websites.</strong> We have not reviewed, and cannot review, all of the material, including computer software, made available through the websites and webpages to which $tcpp_domainname links, and that link to $tcpp_domainname. $tcpp_bizname does not have any control over those non-$tcpp_bizname websites and webpages, and is not responsible for their contents or their use. By linking to a non-$tcpp_bizname website or webpage, $tcpp_bizname does not represent or imply that it endorses such website or webpage. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses, and other harmful or destructive content. $tcpp_bizname disclaims any responsibility for any harm resulting from your use of non-$tcpp_bizname websites and webpages.</li>
527
+ <li><strong>Copyright Infringement and DMCA Policy.</strong> As $tcpp_bizname asks others to respect its intellectual property rights, it respects the intellectual property rights of others. If you believe that material located on or linked to by $tcpp_domainname violates your copyright, you are encouraged to notify $tcpp_dmcaoutput. $tcpp_bizname will respond to all such notices, including as required or appropriate by removing the infringing material or disabling all links to the infringing material. $tcpp_bizname will terminate a visitor's access to and use of the Website if, under appropriate circumstances, the visitor is determined to be a repeat infringer of the copyrights or other intellectual property rights of $tcpp_bizname or others. In the case of such termination, $tcpp_bizname will have no obligation to provide a refund of any amounts previously paid to $tcpp_bizname.</li>
528
+ <li><strong>Intellectual Property.</strong> This Agreement does not transfer from $tcpp_bizname to you any $tcpp_bizname or third party intellectual property, and all right, title and interest in and to such property will remain (as between the parties) solely with $tcpp_bizname. $tcpp_bizname, $tcpp_domainname, the $tcpp_domainname logo, and all other trademarks, service marks, graphics and logos used in connection with $tcpp_domainname, or the Website are trademarks or registered trademarks of $tcpp_bizname or $tcpp_biznamepossessive licensors. Other trademarks, service marks, graphics and logos used in connection with the Website may be the trademarks of other third parties. Your use of the Website grants you no right or license to reproduce or otherwise use any $tcpp_bizname or third-party trademarks.</li>
529
+ <li><strong>Advertisements.</strong> $tcpp_bizname reserves the right to display advertisements on your blog unless you have purchased an ad-free account.</li>
530
+ <li><strong>Attribution.</strong> $tcpp_bizname reserves the right to display attribution links such as 'Blog at $tcpp_domainname,' theme author, and font attribution in your blog footer or toolbar.</li>
531
+ <li><strong>Partner Products.</strong> By activating a partner product (e.g. theme) from one of our partners, you agree to that partner's terms of service. You can opt out of their terms of service at any time by de-activating the partner product.</li>
532
+ <li><strong>Domain Names.</strong> If you are registering a domain name, using or transferring a previously registered domain name, you acknowledge and agree that use of the domain name is also subject to the policies of the Internet Corporation for Assigned Names and Numbers (&quot;ICANN&quot;), including their <a href=\"http://www.icann.org/en/registrars/registrant-rights-responsibilities-en.htm\">Registration Rights and Responsibilities</a>.</li>
533
+ <li><strong>Changes. </strong>$tcpp_bizname reserves the right, at its sole discretion, to modify or replace any part of this Agreement. It is your responsibility to check this Agreement periodically for changes. Your continued use of or access to the Website following the posting of any changes to this Agreement constitutes acceptance of those changes. $tcpp_bizname may also, in the future, offer new services and/or features through the Website (including, the release of new tools and resources). Such new features and/or services shall be subject to the terms and conditions of this Agreement. <strong><br>
534
+ </strong></li>
535
+ <li><strong>Termination. </strong>$tcpp_bizname may terminate your access to all or any part of the Website at any time, with or without cause, with or without notice, effective immediately. If you wish to terminate this Agreement or your $tcpp_domainname account (if you have one), you may simply discontinue using the Website. Notwithstanding the foregoing, if you have a paid services account, such account can only be terminated by $tcpp_bizname if you materially breach this Agreement and fail to cure such breach within $tcpp_timeperiodforchangingfeesandfornotifications from $tcpp_biznamepossessive notice to you thereof; provided that, $tcpp_bizname can terminate the Website immediately as part of a general shut down of our service. All provisions of this Agreement which by their nature should survive termination shall survive termination, including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of liability. <strong><br>
536
+ </strong></li>
537
+ <li class='important'><strong>Disclaimer of Warranties.</strong> The Website is provided &quot;as is&quot;. $tcpp_bizname and its suppliers and licensors hereby disclaim all warranties of any kind, express or implied, including, without limitation, the warranties of merchantability, fitness for a particular purpose and non-infringement. Neither $tcpp_bizname nor its suppliers and licensors, makes any warranty that the Website will be error free or that access thereto will be continuous or uninterrupted. You understand that you download from, or otherwise obtain content or services through, the Website at your own discretion and risk.</li>
538
+ <li class='important'><strong>Limitation of Liability.</strong> In no event will $tcpp_bizname, or its suppliers or licensors, be liable with respect to any subject matter of this agreement under any contract, negligence, strict liability or other legal or equitable theory for: (i) any special, incidental or consequential damages; (ii) the cost of procurement for substitute products or services; (iii) for interruption of use or loss or corruption of data; or (iv) for any amounts that exceed the fees paid by you to $tcpp_bizname under this agreement during the $tcpp_timeperiodfordeterminingmaximumdamages period prior to the cause of action. $tcpp_bizname shall have no liability for any failure or delay due to matters beyond their reasonable control. The foregoing shall not apply to the extent prohibited by applicable law.</li>
539
+ <li><strong>General Representation and Warranty.</strong> You represent and warrant that (i) your use of the Website will be in strict accordance with the $tcpp_bizname $tcpp_privacypolicyheading, with this Agreement and with all applicable laws and regulations (including without limitation any local laws or regulations in your country, state, city, or other governmental area, regarding online conduct and acceptable content, and including all applicable laws regarding the transmission of technical data exported from the United States or the country in which you reside) and (ii) your use of the Website will not infringe or misappropriate the intellectual property rights of any third party.</li>
540
+ <li><strong>Indemnification.</strong> You agree to indemnify and hold harmless $tcpp_bizname, its contractors, and its licensors, and their respective directors, officers, employees and agents from and against any and all claims and expenses, including attorneys' fees, arising out of your use of the Website, including but not limited to your violation of this Agreement.</li>
541
+ <li><strong>Miscellaneous.</strong> This Agreement constitutes the entire agreement between $tcpp_bizname and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of $tcpp_bizname, or by the posting by $tcpp_bizname of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the $tcpp_venue, excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in $tcpp_courtlocation. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (&quot;JAMS&quot;) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in $tcpp_arbitrationlocation, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys' fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties' original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; $tcpp_bizname may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns.</li>
542
+ </ol>";
543
+ $tcpp_tcond .= apply_filters( 'atospp_tos_after_end', '' );
544
+
545
+
546
+ return $tcpp_tcond;
547
+ }
548
+
549
+
550
+
551
+ function atospp_create_pp() {
552
+
553
+ $options = get_option('atospp_plugin_options');
554
+
555
+ $tcpp_termsheading = $options['atospp_tos_heading'];
556
+ $tcpp_privacypolicyheading = $options['atospp_pp_heading'];
557
+ $tcpp_biznamefull = $options['atospp_namefull'];
558
+ $tcpp_bizname = $options['atospp_name'];
559
+ $tcpp_biznamepossessive = $options['atospp_namepossessive'];
560
+ $tcpp_domainname = $options['atospp_domainname'];
561
+ $tcpp_websiteurl = $options['atospp_websiteurl'];
562
+ $tcpp_minimumage = $options['atospp_minage'];
563
+ $tcpp_timeperiodforchangingfeesandfornotifications = $options['atospp_time_feesnotifications'];
564
+ $tcpp_timeperiodtoreplytopriorityemail = $options['atospp_time_replytopriorityemail'];
565
+ $tcpp_timeperiodfordeterminingmaximumdamages = $options['atospp_time_determiningmaxdamages'];
566
+
567
+ //do not need DMCA options for PP
568
+
569
+ $tcpp_venue = $options['atospp_venue'];
570
+ $tcpp_courtlocation = $options['atospp_courtlocation'];
571
+ $tcpp_arbitrationlocation = $options['atospp_arbitrationlocation'];
572
+
573
+
574
+
575
+
576
+ $tcpp_privacypolicy = '';
577
+ $tcpp_privacypolicy .= apply_filters( 'atospp_pp_before_heading', '' );
578
+ $tcpp_privacypolicy .= "<h2 id='atospp-privacy' class='auto-tos-pp ppheading'>$tcpp_privacypolicyheading:</h2>";
579
+ $tcpp_privacypolicy .= apply_filters( 'atospp_pp_after_heading', '' );
580
+ $tcpp_privacypolicy .= "<p>$tcpp_biznamefull (&quot;<strong>$tcpp_bizname</strong>&quot;) operates $tcpp_domainname and may operate other websites. It is $tcpp_biznamepossessive policy to respect your privacy regarding any information we may collect while operating our websites.</p>
581
+ <h3>Website Visitors</h3>
582
+ <p>Like most website operators, $tcpp_bizname collects non-personally-identifying information of the sort that web browsers and servers typically make available, such as the browser type, language preference, referring site, and the date and time of each visitor request. $tcpp_biznamepossessive purpose in collecting non-personally identifying information is to better understand how $tcpp_biznamepossessive visitors use its website. From time to time, $tcpp_bizname may release non-personally-identifying information in the aggregate, e.g., by publishing a report on trends in the usage of its website.</p>
583
+ <p>$tcpp_bizname also collects potentially personally-identifying information like Internet Protocol (IP) addresses for logged in users and for users leaving comments on $tcpp_domainname blogs/sites. $tcpp_bizname only discloses logged in user and commenter IP addresses under the same circumstances that it uses and discloses personally-identifying information as described below, except that commenter IP addresses and email addresses are visible and disclosed to the administrators of the blog/site where the comment was left.</p>
584
+ <h3>Gathering of Personally-Identifying Information</h3>
585
+ <p>Certain visitors to $tcpp_biznamepossessive websites choose to interact with $tcpp_bizname in ways that require $tcpp_bizname to gather personally-identifying information. The amount and type of information that $tcpp_bizname gathers depends on the nature of the interaction. For example, we ask visitors who sign up at <a href=\"$tcpp_websiteurl\">$tcpp_domainname</a> to provide a username and email address. Those who engage in transactions with $tcpp_bizname are asked to provide additional information, including as necessary the personal and financial information required to process those transactions. In each case, $tcpp_bizname collects such information only insofar as is necessary or appropriate to fulfill the purpose of the visitor's interaction with $tcpp_bizname. $tcpp_bizname does not disclose personally-identifying information other than as described below. And visitors can always refuse to supply personally-identifying information, with the caveat that it may prevent them from engaging in certain website-related activities.</p>
586
+ <h3>Aggregated Statistics</h3>
587
+ <p>$tcpp_bizname may collect statistics about the behavior of visitors to its websites. $tcpp_bizname may display this information publicly or provide it to others. However, $tcpp_bizname does not disclose personally-identifying information other than as described below.</p>
588
+ <h3>Protection of Certain Personally-Identifying Information</h3>
589
+ <p>$tcpp_bizname discloses potentially personally-identifying and personally-identifying information only to those of its employees, contractors and affiliated organizations that (i) need to know that information in order to process it on $tcpp_biznamepossessive behalf or to provide services available at $tcpp_biznamepossessive websites, and (ii) that have agreed not to disclose it to others. Some of those employees, contractors and affiliated organizations may be located outside of your home country; by using $tcpp_biznamepossessive websites, you consent to the transfer of such information to them. $tcpp_bizname will not rent or sell potentially personally-identifying and personally-identifying information to anyone. Other than to its employees, contractors and affiliated organizations, as described above, $tcpp_bizname discloses potentially personally-identifying and personally-identifying information only in response to a subpoena, court order or other governmental request, or when $tcpp_bizname believes in good faith that disclosure is reasonably necessary to protect the property or rights of $tcpp_bizname, third parties or the public at large. If you are a registered user of an $tcpp_bizname website and have supplied your email address, $tcpp_bizname may occasionally send you an email to tell you about new features, solicit your feedback, or just keep you up to date with what's going on with $tcpp_bizname and our products. If you send us a request (for example via email or via one of our feedback mechanisms), we reserve the right to publish it in order to help us clarify or respond to your request or to help us support other users. $tcpp_bizname takes all measures reasonably necessary to protect against the unauthorized access, use, alteration or destruction of potentially personally-identifying and personally-identifying information.</p>
590
+ <h3>Cookies</h3>
591
+ <p>A cookie is a string of information that a website stores on a visitor's computer, and that the visitor's browser provides to the website each time the visitor returns. $tcpp_bizname uses cookies to help $tcpp_bizname identify and track visitors, their usage of $tcpp_bizname website, and their website access preferences. $tcpp_bizname visitors who do not wish to have cookies placed on their computers should set their browsers to refuse cookies before using $tcpp_biznamepossessive websites, with the drawback that certain features of $tcpp_biznamepossessive websites may not function properly without the aid of cookies.</p>
592
+ <h3>Business Transfers</h3>
593
+ <p>If $tcpp_bizname, or substantially all of its assets, were acquired, or in the unlikely event that $tcpp_bizname goes out of business or enters bankruptcy, user information would be one of the assets that is transferred or acquired by a third party. You acknowledge that such transfers may occur, and that any acquirer of $tcpp_bizname may continue to use your personal information as set forth in this policy.</p>
594
+ <h3>Ads</h3>
595
+ <p>Ads appearing on any of our websites may be delivered to users by advertising partners, who may set cookies. These cookies allow the ad server to recognize your computer each time they send you an online advertisement to compile information about you or others who use your computer. This information allows ad networks to, among other things, deliver targeted advertisements that they believe will be of most interest to you. This Privacy Policy covers the use of cookies by $tcpp_bizname and does not cover the use of cookies by any advertisers.</p>
596
+ <h3>$tcpp_privacypolicyheading Changes</h3>
597
+ <p>Although most changes are likely to be minor, $tcpp_bizname may change its $tcpp_privacypolicyheading from time to time, and in $tcpp_biznamepossessive sole discretion. $tcpp_bizname encourages visitors to frequently check this page for any changes to its $tcpp_privacypolicyheading. If you have a $tcpp_domainname account, you might also receive an alert informing you of these changes. Your continued use of this site after any change in this $tcpp_privacypolicyheading will constitute your acceptance of such change.</p>";
598
+ $tcpp_privacypolicy .= apply_filters( 'atospp_pp_after_end', '' );
599
+
600
+
601
+ return $tcpp_privacypolicy;
602
+ }
603
+
604
+
605
+
606
+
607
+ function atospp_create_tos_pp() {
608
+
609
+ $options = get_option('atospp_plugin_options');
610
+
611
+ $tcpp_termsheading = $options['atospp_tos_heading'];
612
+ $tcpp_privacypolicyheading = $options['atospp_pp_heading'];
613
+ // do not need the rest of this code block
614
+
615
+
616
+ // Add Separators and Back To Top links ONLY when the Table of Contents exists, which only exists when both TOS and PP are displayed together
617
+ // Using priority 9 so default priority of 10 is not needed in child theme functions.php
618
+ add_filter('atospp_tos_before_heading', 'atospp_separator', 9);
619
+ add_filter('atospp_pp_before_heading', 'atospp_separator', 9);
620
+
621
+ add_filter('atospp_tos_after_end', 'atospp_back_to_top', 9);
622
+ add_filter('atospp_pp_after_end', 'atospp_back_to_top', 9);
623
+
624
+
625
+ $tcpp_combinedtermsandprivacy = sprintf('
626
+ <h2 id="atospp-toc" class="auto-tos-pp tospptocheading">Contents:</h2>
627
+ <ol class="auto-tos-pp tospptoc">
628
+ <li><a href="#atospp-terms">%1$s</a></li>
629
+ <li><a href="#atospp-privacy">%2$s</a></li>
630
+ </ol>
631
+ %3$s
632
+ %4$s',
633
+ $tcpp_termsheading,
634
+ $tcpp_privacypolicyheading,
635
+ atospp_create_tos(),
636
+ atospp_create_pp()
637
+ );
638
+
639
+
640
+ return $tcpp_combinedtermsandprivacy;
641
+
642
+
643
+ }
644
+
645
+
646
+
647
+ /* --------------------- END SETUP ------------------ */
648
+
649
+
650
+
651
+
652
+ /* --------------------- START SHORTCODES ------------------ */
653
+
654
+
655
+
656
+ // shortcode [my_terms_of_service_and_privacy_policy]
657
+ function my_terms_of_service_and_privacy_policy_func() {
658
+
659
+ $tcpp_combinedtermsandprivacy = atospp_create_tos_pp();
660
+
661
+ $a = sprintf('<!-- ATOSPP version: %s, my_terms_of_service_and_privacy_policy -->', atospp_plugin_version() );
662
+ if(!empty($tcpp_combinedtermsandprivacy) && atospp_publish_on_off() == 'atospp_on')
663
+ { $a .= $tcpp_combinedtermsandprivacy; }
664
+ elseif( current_user_can('edit_plugins') ) {
665
+ $a .= sprintf('<p>Terms and Privacy Policy are coming soon. <a href="%s">Configure this plugin\'s settings.</a></p>', atospp_settings_url() ); }
666
+ else { $a .= '<p>Terms and Privacy Policy are coming soon.</p>'; }
667
+
668
+ return $a;
669
+ }
670
+ add_shortcode('my_terms_of_service_and_privacy_policy', 'my_terms_of_service_and_privacy_policy_func');
671
+
672
+
673
+ // shortcode [my_terms_of_service]
674
+ function my_terms_of_service_func() {
675
+
676
+ $tcpp_tcond = atospp_create_tos();
677
+
678
+ $b = sprintf('<!-- ATOSPP version: %s, my_terms_of_service -->', atospp_plugin_version() );
679
+ if(!empty($tcpp_tcond) && atospp_publish_on_off() == 'atospp_on')
680
+ { $b .= $tcpp_tcond; }
681
+ elseif( current_user_can('edit_plugins') ) {
682
+ $b .= sprintf('<p>Terms are coming soon. <a href="%s">Configure this plugin\'s settings.</a></p>', atospp_settings_url() ); }
683
+ else { $b .= '<p>Terms are coming soon.</p>'; }
684
+
685
+ return $b;
686
+ }
687
+ add_shortcode('my_terms_of_service', 'my_terms_of_service_func');
688
+
689
+
690
+ // shortcode [my_privacy_policy]
691
+ function my_privacy_policy_func() {
692
+
693
+ $tcpp_privacypolicy = atospp_create_pp();
694
+
695
+ $c = sprintf('<!-- ATOSPP version: %s, my_privacy_policy -->', atospp_plugin_version() );
696
+ if(!empty($tcpp_privacypolicy) && atospp_publish_on_off() == 'atospp_on')
697
+ { $c .= $tcpp_privacypolicy; }
698
+ elseif( current_user_can('edit_plugins') ) {
699
+ $c .= sprintf('<p>Privacy Policy is coming soon. <a href="%s">Configure this plugin\'s settings.</a></p>', atospp_settings_url() ); }
700
+ else { $c .= '<p>Privacy Policy is coming soon.</p>'; }
701
+
702
+ return $c;
703
+ }
704
+ add_shortcode('my_privacy_policy', 'my_privacy_policy_func');
705
+
706
+
707
+
708
+ /* --------------------- END SHORTCODES ------------------ */
709
+
710
+
711
+ // End of plugin
712
+ // Do not add closing PHP tag
freemius/LICENSE.txt ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
340
+
freemius/assets/css/admin/account.css ADDED
@@ -0,0 +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 i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .button i.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_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%}
freemius/assets/css/admin/add-ons.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ #fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner ul{-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,0.15s;-o-transition:all,0.15s;-ms-transition:all,0.15s;-webkit-transition:all,0.15s;transition:all,0.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:0.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:greenyellow;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,0.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,0.3);box-shadow:1px 1px 1px rgba(0,0,0,0.3);text-transform:uppercase;font-size:0.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}
2
+ #TB_window,#TB_window iframe{width:772px !important}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,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);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:greenyellow;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid darkgreen;padding:2px;text-align:center;font-size:0.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#F3F3F3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:greenyellow}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:0.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
freemius/assets/css/admin/common.css ADDED
@@ -0,0 +1 @@
 
1
+ .fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,0.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;box-shadow:0px 2px 2px rgba(6,113,6,0.3);opacity:0.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 500px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:'\21B3';padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:'\21B2'}.fs-submenu-item.pricing.upgrade-mode{color:greenyellow}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}
freemius/assets/css/admin/connect.css ADDED
@@ -0,0 +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}.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}
freemius/assets/css/admin/deactivation-feedback.css ADDED
@@ -0,0 +1 @@
 
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 .fs-modal-dialog li.reason{margin-bottom:10px}.fs-modal .fs-modal-dialog li.reason .reason-input,.fs-modal .fs-modal-dialog li.reason .internal-message{margin-left:29px}.fs-modal .fs-modal-dialog li.reason label{display:table}.fs-modal .fs-modal-dialog li.reason label>span{display:table-cell;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-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body h2{font-size:20px}.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:not(.active){display:none}.fs-modal .reason-input,.fs-modal .internal-message{margin:3px 0 3px 22px}.fs-modal .reason-input input,.fs-modal .reason-input textarea,.fs-modal .internal-message input,.fs-modal .internal-message textarea{width:100%}.fs-modal li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}body.has-fs-modal{overflow:hidden}#the-list .deactivate>.fs-slug{display:none}
freemius/assets/css/admin/debug.css ADDED
@@ -0,0 +1 @@
 
1
+ .switch{position:relative;display:inline-block;font-size:1.6em;font-weight:bold;color:#ccc;text-shadow:0px 1px 1px rgba(255,255,255,0.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:4px;background:#ececec;box-shadow:0px 0px 4px rgba(0,0,0,0.1),inset 0px 1px 3px 0px rgba(0,0,0,0.1);cursor:pointer}.switch span{display:inline-block;width:35px;text-transform:uppercase}.switch span.on{color:#6bc406}.switch .toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.3);border-radius:4px;background:#fff;background:-moz-linear-gradient(top, #ececec 0%, #fff 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));background:-webkit-linear-gradient(top, #ececec 0%, #fff 100%);background:-o-linear-gradient(top, #ececec 0%, #fff 100%);background:-ms-linear-gradient(top, #ececec 0%, #fff 100%);background:linear-gradient(top, #ececec 0%, #fff 100%);box-shadow:inset 0px 1px 0px 0px rgba(255,255,255,0.5);z-index:999;-moz-transition:all 0.15s ease-in-out;-o-transition:all 0.15s ease-in-out;-ms-transition:all 0.15s ease-in-out;-webkit-transition:all 0.15s ease-in-out;transition:all 0.15s ease-in-out}.switch.on .toggle{left:2%}.switch.off .toggle{left:54%}.switch.round{padding:0px 20px;border-radius:40px}.switch.round .toggle{border-radius:40px;width:14px;height:14px}.switch.round.on .toggle{left:3%;background:#6bc406}.switch.round.off .toggle{left:58%}.switch-label{font-size:20px;line-height:31px;margin:0 5px}
freemius/assets/css/admin/dialog-boxes.css ADDED
@@ -0,0 +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-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 .fs-modal-body .input-container>.email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend .fs-modal-body input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:right;margin-left:7px}@media (max-width: 650px){.fs-modal.fs-modal-license-key-resend .fs-modal-body .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}
freemius/assets/css/admin/license-activation.css ADDED
@@ -0,0 +1 @@
 
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-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body .license-activation-message{margin:0;display:none}.fs-modal .fs-modal-body input.license_key{width:100%}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px}.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:not(.active){display:none}body.has-fs-modal{overflow:hidden}
freemius/assets/css/common.css ADDED
@@ -0,0 +1 @@
 
1
+ .fs-notice.success{color:green;font-weight:700}
freemius/assets/img/auto-terms-of-service-and-privacy-policy.svg ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Noun_Project_TOS" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
5
+ y="0px" width="500px" height="500px" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
6
+ <style type="text/css">
7
+ <![CDATA[
8
+ .st0{display:none;fill:#0989DA;stroke:#231F20;stroke-width:2;stroke-miterlimit:10;}
9
+ .st1{fill:#FF90B7;stroke:#231F20;stroke-width:2;stroke-miterlimit:10;}
10
+ .st2{fill:#231F20;stroke:#231F20;stroke-width:2;stroke-miterlimit:10;}
11
+ ]]>
12
+ </style>
13
+ <g>
14
+ <path class="st2" d="M377.7,70.5H122.3v359h255.3V70.5z M361.7,86.4v327.1H138.3V86.4H361.7"/>
15
+ <path class="st0" d="M377.7,70.5H122.3v359h255.3V70.5z M361.7,86.4v327.1H138.3V86.4H361.7"/>
16
+ <rect x="174.2" y="118.4" class="st1" width="151.6" height="19.9"/>
17
+ <rect x="174.2" y="178.2" class="st1" width="151.6" height="12"/>
18
+ <rect x="174.2" y="214.1" class="st1" width="151.6" height="12"/>
19
+ <rect x="174.2" y="250" class="st1" width="151.6" height="12"/>
20
+ <rect x="174.2" y="285.9" class="st1" width="91.8" height="12"/>
21
+ <path class="st1" d="M219.1,369l-6.8,6.8l-9.1-9.1l-9.1,9.1l-6.8-6.8l9.1-9.1l-9.1-9.1l6.8-6.8l9.1,9.1l9.1-9.1l6.8,6.8l-9.1,9.1
22
+ L219.1,369z M162.2,333.8v55.9H242v-55.9H162.2z"/>
23
+ <path class="st1" d="M304.8,368.7l-6.6,6.6l-16.5-16.5l6.6-6.6l9.9,9.9l15.4-15.4l6.6,6.6L304.8,368.7z M258,333.8v55.9h79.8v-55.9
24
+ H258z"/>
25
+ </g>
26
+ </svg>
freemius/assets/img/plugin-icon.png ADDED
Binary file
freemius/assets/js/nojquery.ba-postmessage.js ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery postMessage - v0.5 - 9/11/2009
3
+ * http://benalman.com/projects/jquery-postmessage-plugin/
4
+ *
5
+ * Copyright (c) 2009 "Cowboy" Ben Alman
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ * http://benalman.com/about/license/
8
+ *
9
+ * Non-jQuery fork by Jeff Lee
10
+ *
11
+ * This fork consists of the following changes:
12
+ * 1. Basic code cleanup and restructuring, for legibility.
13
+ * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
14
+ * in terms of both function names and object scope. Scope is specified by
15
+ * the the "this" context of NoJQueryPostMessageMixin();
16
+ * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
17
+ * at least three different GitHub users requesting the removal of this
18
+ * "Opera sniff" on the original project's Issues page, so I figured this
19
+ * would be a relatively safe change.
20
+ * 4. `postMessage` no longer uses `$.param` to serialize messages that are not
21
+ * strings. I actually prefer this structure anyway. `receiveMessage` does
22
+ * not implement a corresponding deserialization step, and as such it seems
23
+ * cleaner and more symmetric to leave both data serialization and
24
+ * deserialization to the client.
25
+ * 5. The use of `$.isFunction` is replaced by a functionally-identical check.
26
+ * 6. The `$:nomunge` YUI option is no longer necessary.
27
+ */
28
+
29
+ function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
30
+
31
+ var setMessageCallback, unsetMessageCallback, currentMsgCallback,
32
+ intervalId, lastHash, cacheBust = 1;
33
+
34
+ if (window.postMessage) {
35
+
36
+ if (window.addEventListener) {
37
+ setMessageCallback = function(callback) {
38
+ window.addEventListener('message', callback, false);
39
+ }
40
+
41
+ unsetMessageCallback = function(callback) {
42
+ window.removeEventListener('message', callback, false);
43
+ }
44
+ } else {
45
+ setMessageCallback = function(callback) {
46
+ window.attachEvent('onmessage', callback);
47
+ }
48
+
49
+ unsetMessageCallback = function(callback) {
50
+ window.detachEvent('onmessage', callback);
51
+ }
52
+ }
53
+
54
+ this[postBinding] = function(message, targetUrl, target) {
55
+ if (!targetUrl) {
56
+ return;
57
+ }
58
+
59
+ // The browser supports window.postMessage, so call it with a targetOrigin
60
+ // set appropriately, based on the targetUrl parameter.
61
+ target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
62
+ }
63
+
64
+ // Since the browser supports window.postMessage, the callback will be
65
+ // bound to the actual event associated with window.postMessage.
66
+ this[receiveBinding] = function(callback, sourceOrigin, delay) {
67
+ // Unbind an existing callback if it exists.
68
+ if (currentMsgCallback) {
69
+ unsetMessageCallback(currentMsgCallback);
70
+ currentMsgCallback = null;
71
+ }
72
+
73
+ if (!callback) {
74
+ return false;
75
+ }
76
+
77
+ // Bind the callback. A reference to the callback is stored for ease of
78
+ // unbinding.
79
+ currentMsgCallback = setMessageCallback(function(e) {
80
+ switch(Object.prototype.toString.call(sourceOrigin)) {
81
+ case '[object String]':
82
+ if (sourceOrigin !== e.origin) {
83
+ return false;
84
+ }
85
+ break;
86
+ case '[object Function]':
87
+ if (sourceOrigin(e.origin)) {
88
+ return false;
89
+ }
90
+ break;
91
+ }
92
+
93
+ callback(e);
94
+ });
95
+ };
96
+
97
+ } else {
98
+
99
+ this[postBinding] = function(message, targetUrl, target) {
100
+ if (!targetUrl) {
101
+ return;
102
+ }
103
+
104
+ // The browser does not support window.postMessage, so set the location
105
+ // of the target to targetUrl#message. A bit ugly, but it works! A cache
106
+ // bust parameter is added to ensure that repeat messages trigger the
107
+ // callback.
108
+ target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
109
+ }
110
+
111
+ // Since the browser sucks, a polling loop will be started, and the
112
+ // callback will be called whenever the location.hash changes.
113
+ this[receiveBinding] = function(callback, sourceOrigin, delay) {
114
+ if (intervalId) {
115
+ clearInterval(intervalId);
116
+ intervalId = null;
117
+ }
118
+
119
+ if (callback) {
120
+ delay = typeof sourceOrigin === 'number'
121
+ ? sourceOrigin
122
+ : typeof delay === 'number'
123
+ ? delay
124
+ : 100;
125
+
126
+ intervalId = setInterval(function(){
127
+ var hash = document.location.hash,
128
+ re = /^#?\d+&/;
129
+ if ( hash !== lastHash && re.test( hash ) ) {
130
+ lastHash = hash;
131
+ callback({ data: hash.replace( re, '' ) });
132
+ }
133
+ }, delay );
134
+ }
135
+ };
136
+
137
+ }
138
+
139
+ return this;
140
+ }
freemius/assets/js/nojquery.ba-postmessage.min.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * nojquery-postmessage by Jeff Lee
3
+ * a non-jQuery fork of:
4
+ *
5
+ * jQuery postMessage - v0.5 - 9/11/2009
6
+ * http://benalman.com/projects/jquery-postmessage-plugin/
7
+ *
8
+ * Copyright (c) 2009 "Cowboy" Ben Alman
9
+ * Dual licensed under the MIT and GPL licenses.
10
+ * http://benalman.com/about/license/
11
+ */
12
+ function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
freemius/assets/js/postmessage.js ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($, undef) {
2
+ var global = this;
3
+
4
+ // Namespace.
5
+ global.FS = global.FS || {};
6
+
7
+ global.FS.PostMessage = function ()
8
+ {
9
+ var
10
+ _is_child = false,
11
+ _postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
12
+ _callbacks = {},
13
+ _base_url,
14
+ _parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
15
+ _parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
16
+ _init = function () {
17
+ _postman.receiveMessage(function (e) {
18
+ var data = JSON.parse(e.data);
19
+
20
+ if (_callbacks[data.type]) {
21
+ for (var i = 0; i < _callbacks[data.type].length; i++) {
22
+ // Execute type callbacks.
23
+ _callbacks[data.type][i](data.data);
24
+ }
25
+ }
26
+ }, _base_url);
27
+ },
28
+ _hasParent = ('' !== _parent_url),
29
+ $window = $(window),
30
+ $html = $('html');
31
+
32
+ return {
33
+ init : function (url, iframes)
34
+ {
35
+ _base_url = url;
36
+ _init();
37
+
38
+ // Automatically receive forward messages.
39
+ FS.PostMessage.receiveOnce('forward', function (data){
40
+ window.location = data.url;
41
+ });
42
+
43
+ iframes = iframes || [];
44
+
45
+ if (iframes.length > 0) {
46
+ $window.on('scroll', function () {
47
+ for (var i = 0; i < iframes.length; i++) {
48
+ FS.PostMessage.postScroll(iframes[i]);
49
+ }
50
+ });
51
+ }
52
+ },
53
+ init_child : function ()
54
+ {
55
+ this.init(_parent_subdomain);
56
+
57
+ _is_child = true;
58
+
59
+ // Post height of a child right after window is loaded.
60
+ $(window).bind('load', function () {
61
+ FS.PostMessage.postHeight();
62
+
63
+ // Post message that window was loaded.
64
+ FS.PostMessage.post('loaded');
65
+ });
66
+ },
67
+ hasParent : function ()
68
+ {
69
+ return _hasParent;
70
+ },
71
+ postHeight : function (diff, wrapper) {
72
+ diff = diff || 0;
73
+ wrapper = wrapper || '#wrap_section';
74
+ this.post('height', {
75
+ height: diff + $(wrapper).outerHeight(true)
76
+ });
77
+ },
78
+ postScroll : function (iframe) {
79
+ this.post('scroll', {
80
+ top: $window.scrollTop(),
81
+ height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
82
+ }, iframe);
83
+ },
84
+ post : function (type, data, iframe)
85
+ {
86
+ console.debug('PostMessage.post', type);
87
+
88
+ if (iframe)
89
+ {
90
+ // Post to iframe.
91
+ _postman.postMessage(JSON.stringify({
92
+ type: type,
93
+ data: data
94
+ }), iframe.src, iframe.contentWindow);
95
+ }
96
+ else {
97
+ // Post to parent.
98
+ _postman.postMessage(JSON.stringify({
99
+ type: type,
100
+ data: data
101
+ }), _parent_url, window.parent);
102
+ }
103
+ },
104
+ receive: function (type, callback)
105
+ {
106
+ console.debug('PostMessage.receive', type);
107
+
108
+ if (undef === _callbacks[type])
109
+ _callbacks[type] = [];
110
+
111
+ _callbacks[type].push(callback);
112
+ },
113
+ receiveOnce: function (type, callback)
114
+ {
115
+ if (this.is_set(type))
116
+ return;
117
+
118
+ this.receive(type, callback);
119
+ },
120
+ // Check if any callbacks assigned to a specified message type.
121
+ is_set: function (type)
122
+ {
123
+ return (undef != _callbacks[type]);
124
+ },
125
+ parent_url: function ()
126
+ {
127
+ return _parent_url;
128
+ },
129
+ parent_subdomain: function ()
130
+ {
131
+ return _parent_subdomain;
132
+ }
133
+ };
134
+ }();
135
+ })(jQuery);
freemius/assets/scss/_colors.scss ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $menu-hover-color: #333;
2
+ $darkest-color: #000;
3
+ $fms-live-color: #71ae00;
4
+ $fms-test-color: #f7941d;
5
+ $fms-link-color: #29abe1;
6
+ $fms-link-hover-color: darken(#29abe1, 10%);
7
+ $body-bkg: #111;
8
+ $special-color: #d3135a;
9
+ $body-color: #f1f1f1;
10
+ $fms-white: #f1f1f1;
11
+ $container-bkg: #222;
12
+ $container-bkg-odd: #262626;
13
+ $container-border-color: #333;
14
+ $table-head-bkg: #333;
15
+ $table-head-color: #999;
16
+ $info-color: #999;
17
+ $error-color: #ff0000;
18
+
19
+ $fs-logo-blue-color: #29abe1;
20
+ $fs-logo-green-color: #71ae00;
21
+ $fs-logo-magenta-color: #d3135a;
22
+
23
+ $fs-notice-promotion-border-color: #00a0d2;
24
+ $fs-notice-promotion-bkg: #f2fcff;
25
+
26
+ // WordPress colors.
27
+ $page-header-bkg: #333;
28
+ $page-header-color: $fms-white;
29
+ $text-dark-color: #333;
30
+ $text-light-color: #666;
31
+ $text-lightest-color: #999;
32
+
33
+ // WP Buttons.
34
+ $button-primary-bkg: #6bc406;
35
+ $button-primary-color: $fms-white;
36
+ $button-secondary-bkg: #333;
37
+ $button-secondary-color: $fms-white;
38
+ $featured-color: #6bc406;
39
+ $wp-selected-color: #0074a3;
40
+
41
+ $wordpress_color: #01749A;
42
+ $blogger_color: #ff8100;
43
+ $wix_color: #fac102;
44
+ $shopify_color: #80d100;
45
+ $addthis_color: #fe6d4e;
46
+ $tumblr_color: #34506b;
47
+ $zepo_color: #00baf2;
48
+ $jquery_color: #000919;
49
+ $javascript_color: #00baf2;
50
+ $squarespace_color: #000;
51
+
52
+ $blog_color: #ff6600;
53
+ $facebook_color: #3b5998;
54
+ $twitter_color: #4099ff;
55
+ $linkedin_color: #4875b4;
56
+ $youtube_color: #ff3333;
57
+ $gplus_color: #c63d2d;
58
+
freemius/assets/scss/_functions.scss ADDED
File without changes
freemius/assets/scss/_load.scss ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ @import 'mixins';
2
+ @import "vars";
3
+ @import "functions";
4
+ @import "colors";
freemius/assets/scss/_mixins.scss ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ---- CSS3 SASS MIXINS ----
2
+ // https://github.com/madr/css3-sass-mixins
3
+ //
4
+ // Copyright (C) 2011 by Anders Ytterström
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ // of this software and associated documentation files (the "Software"), to deal
8
+ // in the Software without restriction, including without limitation the rights
9
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ // copies of the Software, and to permit persons to whom the Software is
11
+ // furnished to do so, subject to the following conditions:
12
+ //
13
+ // The above copyright notice and this permission notice shall be included in
14
+ // all copies or substantial portions of the Software.
15
+ //
16
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ // THE SOFTWARE.
23
+ //
24
+
25
+ // ---- LEGACY IE SUPPORT USING FILTERS ----
26
+ // Should IE filters be used or not?
27
+ // PROS: gradients, drop shadows etc will be handled by css.
28
+ // CONS: will harm the site performance badly,
29
+ // especially on sites with heavy rendering and scripting.
30
+ $useIEFilters: 0;
31
+ // might be 0 or 1. disabled by default.
32
+ // ---- /LEGACY IE SUPPORT USING FILTERS ----
33
+
34
+
35
+ @mixin background-size ($value) {
36
+ -webkit-background-size: $value;
37
+ background-size: $value;
38
+ }
39
+
40
+ @mixin border-image ($path, $offsets, $repeats) {
41
+ -moz-border-image: $path $offsets $repeats;
42
+ -o-border-image: $path $offsets $repeats;
43
+ -webkit-border-image: $path $offsets $repeats;
44
+ border-image: $path $offsets $repeats;
45
+ }
46
+
47
+ @mixin border-radius ($values...) {
48
+ -moz-border-radius: $values;
49
+ -webkit-border-radius: $values;
50
+ border-radius: $values;
51
+ /*-moz-background-clip: padding;
52
+ -webkit-background-clip: padding-box;
53
+ background-clip: padding-box;*/
54
+ }
55
+
56
+ @mixin box-shadow ($values...) {
57
+ -moz-box-shadow: $values;
58
+ -webkit-box-shadow: $values;
59
+ box-shadow: $values;
60
+ }
61
+
62
+ //@mixin box-shadow ($x, $y, $offset, $hex, $ie: $useIEFilters, $inset: null, $spread:null) {
63
+ // -moz-box-shadow: $x $y $offset $spread $hex $inset;
64
+ // -webkit-box-shadow: $x $y $offset $spread $hex $inset;
65
+ // box-shadow: $x $y $offset $spread $hex $inset;
66
+ //
67
+ // @if $ie == 1 {
68
+ // $iecolor: '#' + red($hex) + green($hex) + blue($hex);
69
+ // filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}');
70
+ // -ms-filter: quote(progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}'));
71
+ // }
72
+ //}
73
+
74
+ @mixin box-sizing($value) {
75
+ -moz-box-sizing: $value;
76
+ -webkit-box-sizing: $value;
77
+ box-sizing: $value;
78
+ }
79
+
80
+ // requires sass 3.2
81
+ //@mixin keyframes {
82
+ // @-moz-keyframes { @content; }
83
+ // @-ms-keyframes { @content; }
84
+ // @-o-keyframes { @content; }
85
+ // @-webkit-keyframes { @content; }
86
+ // @keyframes { @content; }
87
+ //}
88
+
89
+ @mixin linear-gradient($from, $to, $ie: $useIEFilters) {
90
+ @if $ie != 1 { background-color: $to; }
91
+
92
+ background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, $from),color-stop(1, $to));
93
+ background-image: -webkit-linear-gradient(top, $from, $to);
94
+ background-image: -moz-linear-gradient(top, $from, $to);
95
+ background-image: -ms-linear-gradient(top, $from, $to);
96
+ background-image: -o-linear-gradient(top, $from, $to);
97
+ background-image: linear-gradient(top, bottom, $from, $to);
98
+
99
+ @if $ie == 1 {
100
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}');
101
+ }
102
+ }
103
+
104
+ @mixin horizontal-gradient($startColor: #555, $endColor: #333, $ie: $useIEFilters) {
105
+ @if $ie != 1 { background-color: $endColor; }
106
+
107
+ background-color: $endColor;
108
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from($startColor), to($endColor)); // Safari 4+, Chrome 2+
109
+ background-image: -webkit-linear-gradient(left, $startColor, $endColor); // Safari 5.1+, Chrome 10+
110
+ background-image: -moz-linear-gradient(left, $startColor, $endColor); // FF 3.6+
111
+ background-image: -o-linear-gradient(left, $startColor, $endColor); // Opera 11.10
112
+ background-image: linear-gradient(to right, $startColor, $endColor); // Standard, IE10
113
+ background-repeat: repeat-x;
114
+ @if $ie == 1 {
115
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$startColor}', endColorstr='#{$endColor}', GradientType=1);
116
+ }
117
+ }
118
+
119
+ @mixin radial-gradient($from, $to, $ie: $useIEFilters) {
120
+ @if $ie != 1 { background-color: $to; }
121
+
122
+ background: -moz-radial-gradient(center, circle cover, $from 0%, $to 100%);
123
+ background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, $from), color-stop(100%, $to));
124
+ background: -webkit-radial-gradient(center, circle cover, $from 0%, $to 100%);
125
+ background: -o-radial-gradient(center, circle cover, $from 0%, $to 100%);
126
+ background: -ms-radial-gradient(center, circle cover, $from 0%, $to 100%);
127
+ background: radial-gradient(center, circle cover, $from 0%, $to 100%);
128
+ background-color: $from;
129
+
130
+ @if $ie == 1 {
131
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}', GradientType=1); /* IE6-9 fallback on horizontal gradient */
132
+ }
133
+ }
134
+
135
+ /*@mixin rgba-bg ($hex, $alpha, $ie: $useIEFilters) {
136
+ @if $ie == 1 {
137
+ background-color: none;
138
+ $hexopac: ie-hex-str(rgba($hex, $alpha));
139
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}}');
140
+ -ms-filter: quote(progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}'));
141
+ }
142
+ @else {
143
+ background-color: $hex;
144
+ background-color: rgba($hex, $alpha);
145
+ }
146
+ }*/
147
+
148
+ @mixin perspective($perspective) {
149
+ -moz-perspective: $perspective;
150
+ -ms-perspective: $perspective;
151
+ -webkit-perspective: $perspective;
152
+ perspective: $perspective;
153
+ -moz-transform-style: preserve-3d;
154
+ -ms-transform-style: preserve-3d;
155
+ -webkit-transform-style: preserve-3d;
156
+ transform-style: preserve-3d;
157
+ }
158
+
159
+ @mixin transform ($transforms) {
160
+ -moz-transform: $transforms;
161
+ -o-transform: $transforms;
162
+ -ms-transform: $transforms;
163
+ -webkit-transform: $transforms;
164
+ transform: $transforms;
165
+ }
166
+
167
+ @mixin matrix ($a, $b, $c, $d, $e, $f) {
168
+ -moz-transform: matrix($a, $b, $c, $d, #{$e}px, #{$f}px);
169
+ -o-transform: matrix($a, $b, $c, $d, $e, $f);
170
+ -ms-transform: matrix($a, $b, $c, $d, $e, $f);
171
+ -webkit-transform: matrix($a, $b, $c, $d, $e, $f);
172
+ transform: matrix($a, $b, $c, $d, $e, $f);
173
+ }
174
+
175
+ @mixin rotate ($deg) {
176
+ @include transform(rotate(#{$deg}deg));
177
+ }
178
+
179
+ @mixin scale ($size) {
180
+ @include transform(scale(#{$size}));
181
+ }
182
+
183
+ @mixin translate ($x, $y) {
184
+ @include transform(translate($x, $y));
185
+ }
186
+
187
+ @mixin transition ($value...) {
188
+ -moz-transition: $value;
189
+ -o-transition: $value;
190
+ -ms-transition: $value;
191
+ -webkit-transition: $value;
192
+ transition: $value;
193
+ }
194
+
195
+ // ==== /CSS3 SASS MIXINS ====
196
+
197
+ @mixin opacity($opacity) {
198
+ opacity: $opacity;
199
+ $opacity-ie: $opacity * 100;
200
+ filter: alpha(opacity=$opacity-ie); //IE8
201
+ }
202
+
203
+ @mixin size($width, $height: $width)
204
+ {
205
+ width: $width;
206
+ height: $height;
207
+ }
208
+
209
+ @mixin clearfix
210
+ {
211
+ &:after {
212
+ content: "";
213
+ display: table;
214
+ clear: both;
215
+ }
216
+ }
217
+
218
+ // Placeholder text
219
+ @mixin placeholder($color: $input-color-placeholder) {
220
+ // Firefox
221
+ &::-moz-placeholder {
222
+ color: $color;
223
+ opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526
224
+ }
225
+ &:-ms-input-placeholder { color: $color; } // Internet Explorer 10+
226
+ &::-webkit-input-placeholder { color: $color; } // Safari and Chrome
227
+ }
freemius/assets/scss/_start.scss ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ @import "vars";
2
+ @import "colors";
3
+ @import "mixins";
4
+ @import "functions";
freemius/assets/scss/_vars.scss ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ $is_production: true;
2
+
3
+ $img_common: if($is_production == true, '//img.freemius.com', 'http://img.freemius:8080');
4
+
5
+ $layout_width: 960px;
freemius/assets/scss/admin/_deactivation-feedback.scss ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../colors";
2
+
3
+ .fs-modal.fs-modal-deactivation-feedback {
4
+ .reason-input, .internal-message {
5
+ margin: 3px 0 3px 22px;
6
+
7
+ input, textarea {
8
+ width: 100%;
9
+ }
10
+ }
11
+
12
+ li.reason {
13
+ &.has-internal-message .internal-message {
14
+ border: 1px solid lighten($darkest-color, 80%);
15
+ padding: 7px;
16
+ display: none;
17
+ }
18
+
19
+ @media (max-width: 650px) {
20
+ li.reason {
21
+ margin-bottom: 10px;
22
+
23
+ .reason-input, .internal-message {
24
+ margin-left: 29px;
25
+ }
26
+
27
+ label {
28
+ display: table;
29
+
30
+ > span {
31
+ display: table-cell;
32
+ font-size: 1.3em;
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ .anonymous-feedback-label {
40
+ float: left;
41
+ }
42
+
43
+ .fs-modal-panel {
44
+ margin-top: 0 !important;
45
+
46
+ h3 {
47
+ margin-top: 0;
48
+ line-height: 1.5em;
49
+ }
50
+ }
51
+ }
52
+
53
+ #the-list .deactivate > .fs-slug {
54
+ display: none;
55
+ }
freemius/assets/scss/admin/_license-activation.scss ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .fs-modal.fs-modal-license-activation {
2
+ .fs-modal-body {
3
+ input.license_key {
4
+ width: 100%;
5
+ }
6
+ }
7
+ }
freemius/assets/scss/admin/_license-key-resend.scss ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .fs-modal.fs-modal-license-key-resend {
2
+ .fs-modal-body {
3
+ .input-container > .email-address-container {
4
+ overflow: hidden;
5
+ padding-right: 2px;
6
+ }
7
+
8
+ input.email-address {
9
+ width: 100%;
10
+ }
11
+
12
+ .button-container {
13
+ float: right;
14
+ margin-left: 7px;
15
+
16
+ @media (max-width: 650px) {
17
+ margin-top: 2px;
18
+ }
19
+ }
20
+ }
21
+ }
22
+
23
+ .rtl
24
+ {
25
+ .fs-modal.fs-modal-license-key-resend {
26
+ .fs-modal-body {
27
+ .input-container > .email-address-container {
28
+ padding-left: 2px;
29
+ padding-right: 0;
30
+ }
31
+
32
+ .button-container {
33
+ float: left;
34
+ margin-right: 7px;
35
+ margin-left: 0;
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ a.show-license-resend-modal {
42
+ margin-top: 4px;
43
+ display: inline-block;
44
+ }
freemius/assets/scss/admin/_modal-common.scss ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../colors";
2
+ @import "../mixins";
3
+
4
+ .fs-modal {
5
+ position: fixed;
6
+ overflow: auto;
7
+ height: 100%;
8
+ width: 100%;
9
+ top: 0;
10
+ z-index: 100000;
11
+ display: none;
12
+ background: rgba(0, 0, 0, 0.6);
13
+
14
+ .fs-modal-dialog {
15
+ background: transparent;
16
+ position: absolute;
17
+ left: 50%;
18
+ margin-left: -298px;
19
+ padding-bottom: 30px;
20
+ top: -100%;
21
+ z-index: 100001;
22
+ width: 596px;
23
+
24
+ @media (max-width: 650px) {
25
+ margin-left: -50%;
26
+ box-sizing: border-box;
27
+ padding-left: 10px;
28
+ padding-right: 10px;
29
+ width: 100%;
30
+
31
+ .fs-modal-panel > h3 > strong {
32
+ font-size: 1.3em;
33
+ }
34
+ }
35
+ }
36
+
37
+ &.active {
38
+ display: block;
39
+
40
+ &:before {
41
+ display: block;
42
+ }
43
+
44
+ .fs-modal-dialog {
45
+ top: 10%;
46
+ }
47
+ }
48
+
49
+ .fs-modal-body,
50
+ .fs-modal-footer {
51
+ border: 0;
52
+ background: #fefefe;
53
+ padding: 20px;
54
+ }
55
+
56
+ .fs-modal-header {
57
+ border-bottom: #eeeeee solid 1px;
58
+ background: #fbfbfb;
59
+ padding: 15px 20px;
60
+ position: relative;
61
+ margin-bottom: -10px;
62
+ // z-index: 2;
63
+
64
+ h4 {
65
+ margin: 0;
66
+ padding: 0;
67
+ text-transform: uppercase;
68
+ font-size: 1.2em;
69
+ font-weight: bold;
70
+ color: #cacaca;
71
+ text-shadow: 1px 1px 1px #fff;
72
+ letter-spacing: 0.6px;
73
+ -webkit-font-smoothing: antialiased;
74
+ }
75
+
76
+ .fs-close {
77
+ position: absolute;
78
+ right: 10px;
79
+ top: 12px;
80
+ cursor: pointer;
81
+ color: #bbb;
82
+ @include border-radius(20px);
83
+ padding: 3px;
84
+ @include transition(all 0.2s ease-in-out);
85
+
86
+ &:hover {
87
+ color: #fff;
88
+ background: #aaa;
89
+ }
90
+ }
91
+ }
92
+
93
+ .fs-modal-body {
94
+ border-bottom: 0;
95
+
96
+ p {
97
+ font-size: 14px;
98
+ }
99
+
100
+ h2 {
101
+ font-size: 20px;
102
+ line-height: 1.5em;
103
+ }
104
+
105
+ > div {
106
+ margin-top: 10px;
107
+
108
+ h2 {
109
+ font-weight: bold;
110
+ font-size: 20px;
111
+ margin-top: 0;
112
+ }
113
+ }
114
+ }
115
+
116
+ .fs-modal-footer {
117
+ border-top: #eeeeee solid 1px;
118
+ text-align: right;
119
+
120
+ > .button {
121
+ margin: 0 7px;
122
+
123
+ &:first-child {
124
+ margin: 0;
125
+ }
126
+ }
127
+ }
128
+
129
+ .fs-modal-panel {
130
+ > .notice.inline {
131
+ margin: 0;
132
+ display: none;
133
+ }
134
+
135
+ &:not(.active) {
136
+ display: none;
137
+ }
138
+ }
139
+ }
140
+
141
+ .rtl
142
+ {
143
+ .fs-modal {
144
+ .fs-modal-header {
145
+ .fs-close {
146
+ right: auto;
147
+ left: 20px;
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ body.has-fs-modal {
154
+ overflow: hidden;
155
+ }
freemius/assets/scss/admin/account.scss ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../start";
2
+
3
+ #fs_account
4
+ {
5
+ .postbox,
6
+ .widefat
7
+ {
8
+ max-width: 700px;
9
+ }
10
+
11
+ h3
12
+ {
13
+ font-size: 1.3em;
14
+ padding: 12px 15px;
15
+ margin: 0 0 12px 0;
16
+ line-height: 1.4;
17
+ border-bottom: 1px solid #F1F1F1;
18
+ }
19
+
20
+ i.dashicons
21
+ {
22
+ font-size: 1.2em;
23
+ height: 1.2em;
24
+ width: 1.2em;
25
+ }
26
+
27
+ .button
28
+ {
29
+ i.dashicons
30
+ {
31
+ vertical-align: middle;
32
+ }
33
+ }
34
+
35
+ .fs-header-actions
36
+ {
37
+ position: absolute;
38
+ top: 17px;
39
+ right: 15px;
40
+ font-size: 0.9em;
41
+
42
+ ul
43
+ {
44
+ margin: 0;
45
+ }
46
+
47
+ li
48
+ {
49
+ form
50
+ {
51
+ display: inline-block;
52
+ }
53
+
54
+ float: left;
55
+ a
56
+ {
57
+ text-decoration: none;
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ #fs_account_details .button-group {
64
+ float: right;
65
+ }
66
+
67
+ .rtl #fs_account .fs-header-actions
68
+ {
69
+ left: 15px;
70
+ right: auto;
71
+ }
72
+
73
+ .fs-key-value-table
74
+ {
75
+ width: 100%;
76
+
77
+ form
78
+ {
79
+ display: inline-block;
80
+ }
81
+
82
+ tr
83
+ {
84
+ td:first-child
85
+ {
86
+ nobr
87
+ {
88
+ font-weight: bold;
89
+ }
90
+
91
+ text-align: right;
92
+
93
+ form
94
+ {
95
+ display: block;
96
+ }
97
+ }
98
+
99
+ td.fs-right
100
+ {
101
+ text-align: right;
102
+ }
103
+
104
+ &.fs-odd
105
+ {
106
+ background: #ebebeb;
107
+ }
108
+ }
109
+
110
+ td, th
111
+ {
112
+ padding: 10px;
113
+ }
114
+
115
+ code {
116
+ line-height: 28px;
117
+ }
118
+
119
+ var, code, input[type="text"]
120
+ {
121
+ color: #0073AA;
122
+ font-size: 16px;
123
+ background: none;
124
+ }
125
+
126
+ input[type="text"] {
127
+ width: 100%;
128
+ font-weight: bold;
129
+ }
130
+ }
131
+
132
+ label.fs-tag
133
+ {
134
+ background: #ffba00;
135
+ color: #fff;
136
+ display: inline-block;
137
+ border-radius: 3px;
138
+ padding: 5px;
139
+ font-size: 11px;
140
+ line-height: 11px;
141
+ vertical-align: baseline;
142
+
143
+ &.fs-warn
144
+ {
145
+ background: #ffba00;
146
+ }
147
+ &.fs-success
148
+ {
149
+ background: #46b450;
150
+ }
151
+ &.fs-error
152
+ {
153
+ background: #dc3232;
154
+ }
155
+ }
156
+
157
+ #fs_addons
158
+ {
159
+ h3
160
+ {
161
+ border: none;
162
+ margin-bottom: 0;
163
+ padding: 4px 5px;
164
+ }
165
+
166
+ td
167
+ {
168
+ vertical-align: middle;
169
+ }
170
+
171
+ thead {
172
+ white-space: nowrap;
173
+ }
174
+
175
+ td:first-child,
176
+ th:first-child
177
+ {
178
+ text-align: left;
179
+ font-weight: bold;
180
+ }
181
+ td:last-child,
182
+ th:last-child
183
+ {
184
+ text-align: right;
185
+ }
186
+ th
187
+ {
188
+ font-weight: bold;
189
+ }
190
+ }
191
+
192
+ #fs_billing_address {
193
+ width: 100%;
194
+
195
+ tr {
196
+ td {
197
+ width: 50%;
198
+ padding: 5px;
199
+ }
200
+
201
+ &:first-of-type {
202
+ td {
203
+ padding-top: 0;
204
+ }
205
+ }
206
+ }
207
+
208
+ @mixin read-mode {
209
+ border-color: transparent;
210
+ color: #777;
211
+ border-bottom: 1px dashed #ccc;
212
+ padding-left: 0;
213
+ background: none;
214
+ }
215
+
216
+ span {
217
+ font-weight: bold;
218
+ }
219
+
220
+ input, select {
221
+ @include placeholder(transparent);
222
+
223
+ display: block;
224
+ width: 100%;
225
+ margin-top: 5px;
226
+
227
+ &.fs-read-mode {
228
+ @include read-mode();
229
+ }
230
+ }
231
+
232
+
233
+ &.fs-read-mode {
234
+ td span {
235
+ display: none;
236
+ }
237
+
238
+ input, select
239
+ {
240
+ @include read-mode();
241
+ @include placeholder(#ccc);
242
+ }
243
+ }
244
+
245
+
246
+ button {
247
+ display: block;
248
+ width: 100%;
249
+ }
250
+ }
freemius/assets/scss/admin/add-ons.scss ADDED
@@ -0,0 +1,449 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../start";
2
+
3
+ #fs_addons
4
+ {
5
+ .fs-cards-list
6
+ {
7
+ list-style: none;
8
+
9
+ .fs-card
10
+ {
11
+ float: left;
12
+ // height: 185px; // With reviews/ratings
13
+ height: 152px;
14
+ width: 310px;
15
+ padding: 0;
16
+ margin: 0 0 30px 30px;
17
+ font-size: 14px;
18
+ list-style: none;
19
+ border: 1px solid #ddd;
20
+ cursor: pointer;
21
+ position: relative;
22
+
23
+ .fs-overlay
24
+ {
25
+ position: absolute;
26
+ left: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ top: 0;
30
+ z-index: 9;
31
+ }
32
+
33
+ .fs-inner
34
+ {
35
+ background-color: #fff;
36
+ overflow: hidden;
37
+ height: 100%;
38
+ position: relative;
39
+
40
+ ul
41
+ {
42
+ @include transition(all, 0.15s);
43
+ left: 0;
44
+ right: 0;
45
+ top: 0;
46
+ position: absolute;
47
+ }
48
+
49
+ li
50
+ {
51
+ list-style: none;
52
+ line-height: 18px;
53
+ padding: 0 15px;
54
+ width: 100%;
55
+ display: block;
56
+ @include box-sizing(border-box);
57
+ }
58
+
59
+ .fs-card-banner
60
+ {
61
+ padding: 0;
62
+ margin: 0;
63
+ line-height: 0;
64
+ display: block;
65
+ height: 100px;
66
+ background-repeat: repeat-x;
67
+ background-size: 100% 100%;
68
+ @include transition(all, 0.15s);
69
+ }
70
+
71
+ .fs-title
72
+ {
73
+ margin: 10px 0 0 0;
74
+ height: 18px;
75
+ overflow: hidden;
76
+ color: #000;
77
+ white-space: nowrap;
78
+ text-overflow: ellipsis;
79
+ font-weight: bold;
80
+ }
81
+
82
+ .fs-offer
83
+ {
84
+ font-size: 0.9em;
85
+ }
86
+
87
+ .fs-description
88
+ {
89
+ background-color: #f9f9f9;
90
+ padding: 10px 15px 100px 15px;
91
+ border-top: 1px solid #eee;
92
+ margin: 0 0 10px 0;
93
+ color: #777;
94
+ }
95
+
96
+ .fs-tag
97
+ {
98
+ position: absolute;
99
+ top: 10px;
100
+ right: 0px;
101
+ background: greenyellow;
102
+ display: block;
103
+ padding: 2px 10px;
104
+ @include box-shadow(1px 1px 1px rgba(0,0,0,0.3));
105
+ text-transform: uppercase;
106
+ font-size: 0.9em;
107
+ font-weight: bold;
108
+ }
109
+
110
+ .fs-cta
111
+ {
112
+ .button
113
+ {
114
+ position: absolute;
115
+ top: 112px;
116
+ right: 10px;
117
+ }
118
+ }
119
+ }
120
+
121
+ @media screen and (min-width: 960px) {
122
+ &:hover
123
+ {
124
+ .fs-overlay
125
+ {
126
+ border: 2px solid $fms-link-color;
127
+ margin-left: -1px;
128
+ margin-top: -1px;
129
+ }
130
+
131
+ .fs-inner
132
+ {
133
+ ul
134
+ {
135
+ top: -100px;
136
+ }
137
+
138
+ .fs-card-banner
139
+ {
140
+ // background-position: 50% -100px;
141
+ }
142
+
143
+ .fs-title,
144
+ .fs-offer
145
+ {
146
+ color: $fms-link-color;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ #TB_window
156
+ {
157
+ &, iframe
158
+ {
159
+ width: 772px !important;
160
+ }
161
+ }
162
+
163
+ #plugin-information
164
+ {
165
+ #section-description
166
+ {
167
+ h2, h3, p, b, i, blockquote, li, ul, ol
168
+ {
169
+ clear: none;
170
+ }
171
+
172
+ .fs-selling-points
173
+ {
174
+ padding-bottom: 10px;
175
+ border-bottom: 1px solid #ddd;
176
+
177
+ ul
178
+ {
179
+ margin: 0;
180
+
181
+ li
182
+ {
183
+ padding: 0;
184
+ list-style: none outside none;
185
+
186
+ i.dashicons
187
+ {
188
+ color: $fs-logo-green-color;
189
+ font-size: 3em;
190
+ vertical-align: middle;
191
+ line-height: 30px;
192
+ float: left;
193
+ margin: 0 0 0 -15px;
194
+ }
195
+
196
+ h3
197
+ {
198
+ margin: 1em 30px !important;
199
+ }
200
+ }
201
+ }
202
+ }
203
+
204
+ .fs-screenshots
205
+ {
206
+ @include clearfix();
207
+ ul
208
+ {
209
+ list-style: none;
210
+ margin: 0;
211
+
212
+ li
213
+ {
214
+ width: 225px;
215
+ height: 225px;
216
+ float: left;
217
+ margin-bottom: 20px;
218
+ @include box-sizing(content-box);
219
+
220
+ a
221
+ {
222
+ display: block;
223
+ width: 100%;
224
+ height: 100%;
225
+ border: 1px solid;
226
+ @include box-shadow(1px 1px 1px rgba(0, 0, 0, 0.2));
227
+ background-size: cover;
228
+ }
229
+
230
+ &.odd
231
+ {
232
+ margin-right: 20px;
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+
239
+ .plugin-information-pricing
240
+ {
241
+ $pricing_color: #FFFEEC;
242
+ $borders_color: #DDD;
243
+ margin: -16px;
244
+ // padding: 20px;
245
+ border-bottom: 1px solid $borders_color;
246
+
247
+ .fs-plan
248
+ {
249
+
250
+ h3
251
+ {
252
+ margin-top: 0;
253
+ padding: 20px;
254
+ font-size: 16px;
255
+ }
256
+
257
+ .nav-tab-wrapper
258
+ {
259
+ border-bottom: 1px solid $borders_color;
260
+
261
+ .nav-tab
262
+ {
263
+ cursor: pointer;
264
+ position: relative;
265
+ padding: 0 10px;
266
+ font-size: 0.9em;
267
+
268
+ label
269
+ {
270
+ text-transform: uppercase;
271
+ color: green;
272
+ background: greenyellow;
273
+ position: absolute;
274
+ left: -1px;
275
+ right: -1px;
276
+ bottom: 100%;
277
+ border: 1px solid darkgreen;
278
+ padding: 2px;
279
+ text-align: center;
280
+ font-size: 0.9em;
281
+ line-height: 1em;
282
+ }
283
+
284
+ &.nav-tab-active
285
+ {
286
+ cursor: default;
287
+ background: $pricing_color;
288
+ border-bottom-color: $pricing_color;
289
+ }
290
+ }
291
+ }
292
+
293
+ &.fs-single-cycle
294
+ {
295
+ h3
296
+ {
297
+ background: $pricing_color;
298
+ margin: 0;
299
+ padding-bottom: 0;
300
+ color: #0073aa;
301
+ }
302
+
303
+ .nav-tab-wrapper,
304
+ .fs-billing-frequency
305
+ {
306
+ display: none;
307
+ }
308
+ }
309
+
310
+ .fs-pricing-body
311
+ {
312
+ background: $pricing_color;
313
+ padding: 20px;
314
+ }
315
+
316
+ .button
317
+ {
318
+ width: 100%;
319
+ text-align: center;
320
+ font-weight: bold;
321
+ text-transform: uppercase;
322
+ font-size: 1.1em;
323
+ }
324
+
325
+ label
326
+ {
327
+ white-space: nowrap;
328
+ }
329
+
330
+ var {
331
+ font-style: normal;
332
+ }
333
+
334
+ .fs-billing-frequency,
335
+ .fs-annual-discount
336
+ {
337
+ text-align: center;
338
+ display: block;
339
+ font-weight: bold;
340
+ margin-bottom: 10px;
341
+ text-transform: uppercase;
342
+ background: #F3F3F3;
343
+ padding: 2px;
344
+ border: 1px solid #ccc;
345
+ }
346
+
347
+ .fs-annual-discount
348
+ {
349
+ text-transform: none;
350
+ color: green;
351
+ background: greenyellow;
352
+ }
353
+
354
+ ul.fs-trial-terms
355
+ {
356
+ font-size: 0.9em;
357
+
358
+ i
359
+ {
360
+ float: left;
361
+ margin: 0 0 0 -15px;
362
+ }
363
+
364
+ li
365
+ {
366
+ margin: 10px 0 0 0;
367
+ }
368
+ }
369
+ }
370
+ }
371
+
372
+ #section-features
373
+ {
374
+ .fs-features
375
+ {
376
+ margin: -20px -26px;
377
+ }
378
+
379
+ table
380
+ {
381
+ width: 100%;
382
+ border-spacing: 0;
383
+ border-collapse: separate;
384
+
385
+ thead
386
+ {
387
+ th
388
+ {
389
+ padding: 10px 0;
390
+ }
391
+
392
+ .fs-price
393
+ {
394
+ color: $fs-logo-green-color;
395
+ font-weight: normal;
396
+ display: block;
397
+ text-align: center;
398
+ }
399
+ }
400
+
401
+ tbody
402
+ {
403
+ td
404
+ {
405
+ border-top: 1px solid #ccc;
406
+ padding: 10px 0;
407
+ text-align: center;
408
+ width: 100px;
409
+ color: $fs-logo-green-color;
410
+
411
+ &:first-child
412
+ {
413
+ text-align: left;
414
+ width: auto;
415
+ color: inherit;
416
+ padding-left: 26px;
417
+ }
418
+ }
419
+ tr.fs-odd
420
+ {
421
+ td
422
+ {
423
+ background: #fefefe;
424
+ }
425
+ }
426
+ }
427
+ }
428
+
429
+ .dashicons-yes
430
+ {
431
+ width: 30px;
432
+ height: 30px;
433
+ font-size: 30px;
434
+ }
435
+ }
436
+ }
437
+
438
+ @media screen and (max-width: 961px) {
439
+ #fs_addons
440
+ {
441
+ .fs-cards-list
442
+ {
443
+ .fs-card
444
+ {
445
+ height: 265px;
446
+ }
447
+ }
448
+ }
449
+ }
freemius/assets/scss/admin/common.scss ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../start";
2
+
3
+ .fs-notice
4
+ {
5
+ position: relative;
6
+
7
+ &.fs-has-title
8
+ {
9
+ margin-bottom: 30px !important;
10
+ }
11
+
12
+ &.success
13
+ {
14
+ color: green;
15
+ // font-weight: normal;
16
+ }
17
+
18
+ &.promotion
19
+ {
20
+ border-color: $fs-notice-promotion-border-color !important;
21
+ background-color: $fs-notice-promotion-bkg !important;
22
+ }
23
+
24
+ .fs-notice-body
25
+ {
26
+ margin: .5em 0;
27
+ padding: 2px;
28
+ }
29
+
30
+ .fs-close
31
+ {
32
+ // position: absolute;
33
+ // top: 2px;
34
+ // bottom: 2px;
35
+ // right: 2px;
36
+ // min-width: 100px;
37
+ // text-align: center;
38
+ // padding-right: 2px;
39
+ cursor: pointer;
40
+ color: #aaa;
41
+ float: right;
42
+
43
+ &:hover
44
+ {
45
+ color: #666;
46
+ // background: #A9A9A9;
47
+ }
48
+
49
+ > *
50
+ {
51
+ margin-top: 7px;
52
+ display: inline-block;
53
+ }
54
+ }
55
+
56
+ label.fs-plugin-title
57
+ {
58
+ background: rgba(0, 0, 0, 0.3);
59
+ color: #fff;
60
+ padding: 2px 10px;
61
+ position: absolute;
62
+ top: 100%;
63
+ bottom: auto;
64
+ right: auto;
65
+ @include border-radius(0 0 3px 3px);
66
+ left: 10px;
67
+ font-size: 12px;
68
+ font-weight: bold;
69
+ cursor: auto;
70
+ }
71
+ }
72
+
73
+ .rtl .fs-notice
74
+ {
75
+ .fs-close
76
+ {
77
+ // left: 2px;
78
+ // right: auto;
79
+ // padding-right: 0;
80
+ // padding-left: 2px;
81
+ float: left;
82
+ }
83
+ }
84
+
85
+ .fs-secure-notice
86
+ {
87
+ position: fixed;
88
+ top: 32px;
89
+ left: 160px;
90
+ right: 0;
91
+ background: rgb(235, 253, 235);
92
+ padding: 10px 20px;
93
+ color: green;
94
+ z-index: 9999;
95
+ box-shadow: 0px 2px 2px rgba(6, 113, 6, 0.3);
96
+ @include opacity(0.95);
97
+
98
+ &:hover
99
+ {
100
+ @include opacity(1);
101
+ }
102
+ }
103
+
104
+ @media screen and (max-width: 960px) {
105
+ .fs-secure-notice
106
+ {
107
+ left: 36px;
108
+ }
109
+ }
110
+
111
+ @media screen and (max-width:500px) {
112
+ #fs_promo_tab {
113
+ display: none;
114
+ }
115
+ }
116
+
117
+ @media screen and (max-width: 782px) {
118
+ .fs-secure-notice
119
+ {
120
+ left: 0;
121
+ top: 46px;
122
+ text-align: center;
123
+ }
124
+ }
125
+
126
+ span.fs-submenu-item.fs-sub:before
127
+ {
128
+ // Add small arrow.
129
+ content: '\21B3';
130
+ padding: 0 5px;
131
+ }
132
+
133
+ .rtl
134
+ {
135
+ span.fs-submenu-item.fs-sub:before
136
+ {
137
+ // Add small RTL arrow.
138
+ content: '\21B2';
139
+ }
140
+ }
141
+
142
+ .fs-submenu-item
143
+ {
144
+ &.pricing
145
+ {
146
+ &.upgrade-mode
147
+ {
148
+ color: greenyellow;
149
+ }
150
+
151
+ &.trial-mode
152
+ {
153
+ color: #83e2ff;
154
+ }
155
+ }
156
+ }
157
+
158
+ #adminmenu .update-plugins.fs-trial {
159
+ background-color: #00b9eb;
160
+ }
freemius/assets/scss/admin/connect.scss ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ .fs-actions
57
+ {
58
+ padding: 10px 20px;
59
+ background: #C0C7CA;
60
+
61
+ .button
62
+ {
63
+ padding: 0 10px 1px;
64
+ line-height: 35px;
65
+ height: 37px;
66
+ font-size: 16px;
67
+ margin-bottom: 0;
68
+
69
+ .dashicons
70
+ {
71
+ font-size: 37px;
72
+ margin-left: -8px;
73
+ margin-right: 12px;
74
+ }
75
+
76
+ &.button-primary
77
+ {
78
+ padding-right: 15px;
79
+ padding-left: 15px;
80
+
81
+ &:after
82
+ {
83
+ content: ' \279C';
84
+ }
85
+
86
+ &.fs-loading
87
+ {
88
+ &:after
89
+ {
90
+ content: '';
91
+ }
92
+ }
93
+ }
94
+
95
+ &.button-secondary
96
+ {
97
+ float: right;
98
+ }
99
+ }
100
+
101
+ // .fs-skip
102
+ // {
103
+ // line-height: 38px;
104
+ // vertical-align: middle;
105
+ // text-decoration: none;
106
+ // margin-left: 10px;
107
+ // }
108
+ }
109
+
110
+ &.fs-anonymous-disabled
111
+ {
112
+ .fs-actions
113
+ {
114
+ .button.button-primary
115
+ {
116
+ width: 100%;
117
+ }
118
+ }
119
+ }
120
+
121
+ .fs-permissions
122
+ {
123
+ padding: 10px 20px;
124
+ background: #FEFEFE;
125
+ // background: #F1F1F1;
126
+ @include transition(background 0.5s ease);
127
+
128
+ .fs-license-sync-disclaimer {
129
+ text-align: center;
130
+ margin-top: 0;
131
+ }
132
+
133
+ .fs-trigger
134
+ {
135
+ font-size: 0.9em;
136
+ text-decoration: none;
137
+ text-align: center;
138
+ display: block;
139
+ }
140
+
141
+ ul
142
+ {
143
+ height: 0;
144
+ overflow: hidden;
145
+ margin: 0;
146
+
147
+ li
148
+ {
149
+ margin-bottom: 12px;
150
+
151
+ &:last-child
152
+ {
153
+ margin-bottom: 0;
154
+ }
155
+
156
+ i.dashicons
157
+ {
158
+ float: left;
159
+ font-size: 40px;
160
+ width: 40px;
161
+ height: 40px;
162
+ }
163
+
164
+ div
165
+ {
166
+ margin-left: 55px;
167
+
168
+ span
169
+ {
170
+ font-weight: bold;
171
+ text-transform: uppercase;
172
+ color: #23282d;
173
+ }
174
+
175
+ p
176
+ {
177
+ margin: 2px 0 0 0;
178
+ }
179
+ }
180
+ }
181
+ }
182
+
183
+ &.fs-open
184
+ {
185
+ background: #fff;
186
+
187
+ ul
188
+ {
189
+ height: auto;
190
+ margin: 20px 20px 10px 20px;
191
+ }
192
+ }
193
+
194
+ @media screen and (max-width: ($form_width - 1)) {
195
+ background: #fff;
196
+
197
+ .fs-trigger
198
+ {
199
+ display: none;
200
+ }
201
+
202
+ ul
203
+ {
204
+ height: auto;
205
+ margin: 20px;
206
+ }
207
+ }
208
+ }
209
+
210
+ .fs-freemium-licensing {
211
+ padding: 8px;
212
+ // background: #0085BA;
213
+ background: #777;
214
+ color: #fff;
215
+
216
+ p {
217
+ text-align: center;
218
+ display: block;
219
+ margin: 0;
220
+ padding: 0;
221
+ }
222
+
223
+ a {
224
+ color: #C2EEFF;
225
+ text-decoration: underline;
226
+ }
227
+ }
228
+
229
+ $icon_size: 80px;
230
+ $wp_logo_padding: $icon_size / 10;
231
+ $icons_top: 10px;
232
+
233
+ .fs-visual
234
+ {
235
+ padding: 12px;
236
+ line-height: 0;
237
+ background: #fafafa;
238
+ height: $icon_size;
239
+ position: relative;
240
+
241
+ .fs-site-icon
242
+ {
243
+ position: absolute;
244
+ left: 20px;
245
+ top: $icons_top;
246
+ }
247
+
248
+ .fs-connect-logo
249
+ {
250
+ position: absolute;
251
+ right: 20px;
252
+ top: $icons_top;
253
+ }
254
+
255
+ .fs-plugin-icon
256
+ {
257
+ position: absolute;
258
+ top: $icons_top;
259
+ left: 50%;
260
+ margin-left: - ($icon_size / 2);
261
+ }
262
+
263
+ .fs-plugin-icon,
264
+ .fs-site-icon,
265
+ img,
266
+ object
267
+ {
268
+ width: $icon_size;
269
+ height: $icon_size;
270
+ }
271
+
272
+ .dashicons-wordpress
273
+ {
274
+ font-size: $icon_size - ($wp_logo_padding * 2);
275
+ background: $wordpress_color;
276
+ color: #fff;
277
+ width: $icon_size - ($wp_logo_padding * 2);
278
+ height: $icon_size - ($wp_logo_padding * 2);
279
+ padding: $wp_logo_padding;
280
+ }
281
+
282
+ .dashicons-plus
283
+ {
284
+ position: absolute;
285
+ top: 50%;
286
+ font-size: 30px;
287
+ margin-top: -10px;
288
+ color: #bbb;
289
+
290
+ &.fs-first
291
+ {
292
+ left: 28%;
293
+ }
294
+ &.fs-second
295
+ {
296
+ left: 65%;
297
+ }
298
+ }
299
+
300
+ .fs-plugin-icon,
301
+ .fs-connect-logo,
302
+ .fs-site-icon
303
+ {
304
+ border: 1px solid #ccc;
305
+ padding: 1px;
306
+ background: #fff;
307
+ }
308
+ }
309
+
310
+ .fs-terms
311
+ {
312
+ text-align: center;
313
+ font-size: 0.85em;
314
+ padding: 5px;
315
+ background: rgba(0, 0, 0, 0.05);
316
+
317
+ &, a
318
+ {
319
+ color: #999;
320
+ }
321
+
322
+ a
323
+ {
324
+ text-decoration: none;
325
+ }
326
+ }
327
+ }
328
+
329
+ .rtl
330
+ {
331
+ #fs_connect
332
+ {
333
+ .fs-actions
334
+ {
335
+ padding: 10px 20px;
336
+ background: #C0C7CA;
337
+
338
+ .button
339
+ {
340
+ .dashicons
341
+ {
342
+ font-size: 37px;
343
+ margin-left: -8px;
344
+ margin-right: 12px;
345
+ }
346
+
347
+ &.button-primary
348
+ {
349
+ &:after
350
+ {
351
+ content: ' \000bb';
352
+ }
353
+
354
+ &.fs-loading
355
+ {
356
+ &:after
357
+ {
358
+ content: '';
359
+ }
360
+ }
361
+ }
362
+
363
+ &.button-secondary
364
+ {
365
+ float: left;
366
+ }
367
+ }
368
+ }
369
+
370
+ .fs-permissions
371
+ {
372
+ ul
373
+ {
374
+ li
375
+ {
376
+ div
377
+ {
378
+ margin-right: 55px;
379
+ margin-left: 0;
380
+ }
381
+
382
+ i.dashicons
383
+ {
384
+ float: right;
385
+ }
386
+
387
+ }
388
+ }
389
+ }
390
+
391
+ .fs-visual
392
+ {
393
+ .fs-site-icon
394
+ {
395
+ right: 20px;
396
+ left: auto;
397
+ }
398
+
399
+ .fs-connect-logo
400
+ {
401
+ right: auto;
402
+ left: 20px;
403
+ }
404
+ }
405
+ }
406
+ }
407
+
408
+ .wp-pointer-content
409
+ {
410
+ #fs_connect
411
+ {
412
+ margin: 0;
413
+ @include box-shadow(none);
414
+ }
415
+ }
416
+
417
+ .fs-opt-in-pointer
418
+ {
419
+ .wp-pointer-content
420
+ {
421
+ padding: 0;
422
+ }
423
+
424
+ &.wp-pointer-top
425
+ {
426
+ .wp-pointer-arrow
427
+ {
428
+ border-bottom-color: #dfdfdf;
429
+ }
430
+ .wp-pointer-arrow-inner
431
+ {
432
+ border-bottom-color: #fafafa;
433
+ }
434
+ }
435
+
436
+ &.wp-pointer-bottom
437
+ {
438
+ .wp-pointer-arrow
439
+ {
440
+ border-top-color: #dfdfdf;
441
+ }
442
+ .wp-pointer-arrow-inner
443
+ {
444
+ border-top-color: #fafafa;
445
+ }
446
+ }
447
+
448
+ &.wp-pointer-left
449
+ {
450
+ .wp-pointer-arrow
451
+ {
452
+ border-right-color: #dfdfdf;
453
+ }
454
+ .wp-pointer-arrow-inner
455
+ {
456
+ border-right-color: #fafafa;
457
+ }
458
+ }
459
+
460
+ &.wp-pointer-right
461
+ {
462
+ .wp-pointer-arrow
463
+ {
464
+ border-left-color: #dfdfdf;
465
+ }
466
+ .wp-pointer-arrow-inner
467
+ {
468
+ border-left-color: #fafafa;
469
+ }
470
+ }
471
+ }
freemius/assets/scss/admin/debug.scss ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../start";
2
+
3
+ .switch
4
+ {
5
+ position: relative;
6
+ display: inline-block;
7
+ font-size: 1.6em;
8
+ font-weight: bold;
9
+ color: #ccc;
10
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.8);
11
+ height: 18px;
12
+ padding: 6px 6px 5px 6px;
13
+ border: 1px solid #ccc;
14
+ border: 1px solid rgba(0, 0, 0, 0.2);
15
+ border-radius: 4px;
16
+ background: #ececec;
17
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1), inset 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
18
+ cursor: pointer;
19
+
20
+ span
21
+ {
22
+ display: inline-block; width: 35px;
23
+ text-transform: uppercase;
24
+
25
+ &.on
26
+ {
27
+ color: $button-primary-bkg;
28
+ }
29
+ }
30
+
31
+ .toggle
32
+ {
33
+ position: absolute;
34
+ top: 1px;
35
+ width: 37px;
36
+ height: 25px;
37
+ border: 1px solid #ccc;
38
+ border: 1px solid rgba(0, 0, 0, 0.3);
39
+ border-radius: 4px;
40
+ background: #fff;
41
+ background: -moz-linear-gradient(top, #ececec 0%, #fff 100%);
42
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #fff));
43
+ background: -webkit-linear-gradient(top, #ececec 0%, #fff 100%);
44
+ background: -o-linear-gradient(top, #ececec 0%, #fff 100%);
45
+ background: -ms-linear-gradient(top, #ececec 0%, #fff 100%);
46
+ background: linear-gradient(top, #ececec 0%, #fff 100%);
47
+ box-shadow: inset 0px 1px 0px 0px rgba(255, 255, 255, 0.5);
48
+ z-index: 999;
49
+ @include transition(all 0.15s ease-in-out);
50
+ }
51
+
52
+ &.on .toggle
53
+ {
54
+ left: 2%;
55
+ }
56
+ &.off .toggle
57
+ {
58
+ left: 54%;
59
+ }
60
+
61
+ /* Round switch */
62
+ &.round
63
+ {
64
+ padding: 0px 20px;
65
+ border-radius: 40px;
66
+
67
+ .toggle
68
+ {
69
+ border-radius: 40px;
70
+ width: 14px;
71
+ height: 14px;
72
+ }
73
+
74
+ &.on .toggle
75
+ {
76
+ left: 3%;
77
+ background: $button-primary-bkg;
78
+ }
79
+ &.off .toggle
80
+ {
81
+ left: 58%;
82
+ }
83
+ }
84
+ }
85
+
86
+ .switch-label
87
+ {
88
+ font-size: 20px;
89
+ line-height: 31px;
90
+ margin: 0 5px;
91
+ }
freemius/assets/scss/admin/dialog-boxes.scss ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ @import "../start";
2
+ @import "modal-common";
3
+ @import "deactivation-feedback";
4
+ @import "license-activation";
5
+ @import "license-key-resend";
freemius/config.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
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__DOMAIN_PRODUCTION', 'wp.freemius.com' );
130
+ define( 'WP_FS__ADDRESS_PRODUCTION', 'https://' . WP_FS__DOMAIN_PRODUCTION );
131
+
132
+ if ( ! defined( 'WP_FS__DOMAIN_LOCALHOST' ) ) {
133
+ define( 'WP_FS__DOMAIN_LOCALHOST', 'wp.freemius' );
134
+ }
135
+ if ( ! defined( 'WP_FS__ADDRESS_LOCALHOST' ) ) {
136
+ define( 'WP_FS__ADDRESS_LOCALHOST', 'http://' . WP_FS__DOMAIN_LOCALHOST . ':8080' );
137
+ }
138
+
139
+ if ( ! defined( 'WP_FS__TESTING_DOMAIN' ) ) {
140
+ define( 'WP_FS__TESTING_DOMAIN', 'fswp' );
141
+ }
142
+
143
+ #--------------------------------------------------------------------------------
144
+ #region HTTP
145
+ #--------------------------------------------------------------------------------
146
+
147
+ if ( ! defined( 'WP_FS__IS_HTTP_REQUEST' ) ) {
148
+ define( 'WP_FS__IS_HTTP_REQUEST', isset( $_SERVER['HTTP_HOST'] ) );
149
+ }
150
+
151
+ if ( ! defined( 'WP_FS__IS_HTTPS' ) ) {
152
+ define( 'WP_FS__IS_HTTPS', ( WP_FS__IS_HTTP_REQUEST &&
153
+ // Checks if CloudFlare's HTTPS (Flexible SSL support).
154
+ isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) &&
155
+ 'https' === strtolower( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
156
+ ) ||
157
+ // Check if HTTPS request.
158
+ ( isset( $_SERVER['HTTPS'] ) && 'on' == $_SERVER['HTTPS'] ) ||
159
+ ( isset( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] )
160
+ );
161
+ }
162
+
163
+ if ( ! defined( 'WP_FS__IS_POST_REQUEST' ) ) {
164
+ define( 'WP_FS__IS_POST_REQUEST', ( WP_FS__IS_HTTP_REQUEST &&
165
+ strtoupper( $_SERVER['REQUEST_METHOD'] ) == 'POST' ) );
166
+ }
167
+
168
+ if ( ! defined( 'WP_FS__REMOTE_ADDR' ) ) {
169
+ define( 'WP_FS__REMOTE_ADDR', fs_get_ip() );
170
+ }
171
+
172
+ if ( ! defined( 'WP_FS__IS_LOCALHOST' ) ) {
173
+ if ( defined( 'WP_FS__LOCALHOST_IP' ) ) {
174
+ define( 'WP_FS__IS_LOCALHOST', ( WP_FS__LOCALHOST_IP === WP_FS__REMOTE_ADDR ) );
175
+ } else {
176
+ define( 'WP_FS__IS_LOCALHOST', WP_FS__IS_HTTP_REQUEST &&
177
+ is_string( WP_FS__REMOTE_ADDR ) &&
178
+ ( substr( WP_FS__REMOTE_ADDR, 0, 4 ) === '127.' ||
179
+ WP_FS__REMOTE_ADDR === '::1' )
180
+ );
181
+ }
182
+ }
183
+
184
+ if ( ! defined( 'WP_FS__IS_LOCALHOST_FOR_SERVER' ) ) {
185
+ define( 'WP_FS__IS_LOCALHOST_FOR_SERVER', ( ! WP_FS__IS_HTTP_REQUEST ||
186
+ false !== strpos( $_SERVER['HTTP_HOST'], 'localhost' ) ) );
187
+ }
188
+
189
+ #endregion
190
+
191
+ if ( ! defined( 'WP_FS__IS_PRODUCTION_MODE' ) ) {
192
+ // By default, run with Freemius production servers.
193
+ define( 'WP_FS__IS_PRODUCTION_MODE', true );
194
+ }
195
+
196
+ if ( ! defined( 'WP_FS__ADDRESS' ) ) {
197
+ define( 'WP_FS__ADDRESS', ( WP_FS__IS_PRODUCTION_MODE ? WP_FS__ADDRESS_PRODUCTION : WP_FS__ADDRESS_LOCALHOST ) );
198
+ }
199
+
200
+
201
+ #--------------------------------------------------------------------------------
202
+ #region API
203
+ #--------------------------------------------------------------------------------
204
+
205
+ if ( ! defined( 'WP_FS__API_ADDRESS_LOCALHOST' ) ) {
206
+ define( 'WP_FS__API_ADDRESS_LOCALHOST', 'http://api.freemius:8080' );
207
+ }
208
+ if ( ! defined( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST' ) ) {
209
+ define( 'WP_FS__API_SANDBOX_ADDRESS_LOCALHOST', 'http://sandbox-api.freemius:8080' );
210
+ }
211
+
212
+ // Set API address for local testing.
213
+ if ( ! WP_FS__IS_PRODUCTION_MODE ) {
214
+ if ( ! defined( 'FS_API__ADDRESS' ) ) {
215
+ define( 'FS_API__ADDRESS', WP_FS__API_ADDRESS_LOCALHOST );
216
+ }
217
+ if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
218
+ define( 'FS_API__SANDBOX_ADDRESS', WP_FS__API_SANDBOX_ADDRESS_LOCALHOST );
219
+ }
220
+ }
221
+
222
+ #endregion
223
+
224
+ define( 'WP_FS___OPTION_PREFIX', 'fs' . ( WP_FS__IS_PRODUCTION_MODE ? '' : '_dbg' ) . '_' );
225
+
226
+ if ( ! defined( 'WP_FS__ACCOUNTS_OPTION_NAME' ) ) {
227
+ define( 'WP_FS__ACCOUNTS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'accounts' );
228
+ }
229
+ if ( ! defined( 'WP_FS__API_CACHE_OPTION_NAME' ) ) {
230
+ define( 'WP_FS__API_CACHE_OPTION_NAME', WP_FS___OPTION_PREFIX . 'api_cache' );
231
+ }
232
+ define( 'WP_FS__OPTIONS_OPTION_NAME', WP_FS___OPTION_PREFIX . 'options' );
233
+
234
+ /**
235
+ * Billing Frequencies
236
+ */
237
+ define( 'WP_FS__PERIOD_ANNUALLY', 'annual' );
238
+ define( 'WP_FS__PERIOD_MONTHLY', 'monthly' );
239
+ define( 'WP_FS__PERIOD_LIFETIME', 'lifetime' );
240
+
241
+ /**
242
+ * Plans
243
+ */
244
+ define( 'WP_FS__PLAN_DEFAULT_PAID', false );
245
+ define( 'WP_FS__PLAN_FREE', 'free' );
246
+ define( 'WP_FS__PLAN_TRIAL', 'trial' );
247
+
248
+ /**
249
+ * Times in seconds
250
+ */
251
+ if ( ! defined( 'WP_FS__TIME_5_MIN_IN_SEC' ) ) {
252
+ define( 'WP_FS__TIME_5_MIN_IN_SEC', 300 );
253
+ }
254
+ if ( ! defined( 'WP_FS__TIME_10_MIN_IN_SEC' ) ) {
255
+ define( 'WP_FS__TIME_10_MIN_IN_SEC', 600 );
256
+ }
257
+ // define( 'WP_FS__TIME_15_MIN_IN_SEC', 900 );
258
+ if ( ! defined( 'WP_FS__TIME_24_HOURS_IN_SEC' ) ) {
259
+ define( 'WP_FS__TIME_24_HOURS_IN_SEC', 86400 );
260
+ }
261
+
262
+ #--------------------------------------------------------------------------------
263
+ #region Debugging
264
+ #--------------------------------------------------------------------------------
265
+
266
+ if ( ! defined( 'WP_FS__DEBUG_SDK' ) ) {
267
+ $debug_mode = get_option( 'fs_debug_mode', null );
268
+
269
+ if ( $debug_mode === null ) {
270
+ $debug_mode = false;
271
+ add_option( 'fs_debug_mode', $debug_mode );
272
+ }
273
+
274
+ define( 'WP_FS__DEBUG_SDK', is_numeric( $debug_mode ) ? ( 0 < $debug_mode ) : WP_FS__DEV_MODE );
275
+ }
276
+
277
+ if ( ! defined( 'WP_FS__ECHO_DEBUG_SDK' ) ) {
278
+ define( 'WP_FS__ECHO_DEBUG_SDK', WP_FS__DEV_MODE && ! empty( $_GET['fs_dbg_echo'] ) );
279
+ }
280
+ if ( ! defined( 'WP_FS__LOG_DATETIME_FORMAT' ) ) {
281
+ define( 'WP_FS__LOG_DATETIME_FORMAT', 'Y-m-d H:i:s' );
282
+ }
283
+ if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
284
+ define( 'FS_API__LOGGER_ON', WP_FS__DEBUG_SDK );
285
+ }
286
+
287
+ if ( WP_FS__ECHO_DEBUG_SDK ) {
288
+ error_reporting( E_ALL );
289
+ }
290
+
291
+ #endregion
292
+
293
+ if ( ! defined( 'WP_FS__SCRIPT_START_TIME' ) ) {
294
+ define( 'WP_FS__SCRIPT_START_TIME', time() );
295
+ }
296
+ if ( ! defined( 'WP_FS__DEFAULT_PRIORITY' ) ) {
297
+ define( 'WP_FS__DEFAULT_PRIORITY', 10 );
298
+ }
299
+ if ( ! defined( 'WP_FS__LOWEST_PRIORITY' ) ) {
300
+ define( 'WP_FS__LOWEST_PRIORITY', 999999999 );
301
+ }
freemius/includes/class-freemius-abstract.php ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.7
7
+ */
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+
13
+ /**
14
+ * - Each instance of Freemius class represents a single plugin
15
+ * install by a single user (the installer of the plugin).
16
+ *
17
+ * - Each website can only have one install of the same plugin.
18
+ *
19
+ * - Install entity is only created after a user connects his account with Freemius.
20
+ *
21
+ * Class Freemius_Abstract
22
+ */
23
+ abstract class Freemius_Abstract {
24
+
25
+ #----------------------------------------------------------------------------------
26
+ #region Identity
27
+ #----------------------------------------------------------------------------------
28
+
29
+ /**
30
+ * Check if user registered with Freemius by connecting his account.
31
+ *
32
+ * @since 1.0.1
33
+ * @return bool
34
+ */
35
+ abstract function is_registered();
36
+
37
+ /**
38
+ * Check if the user skipped connecting the account with Freemius.
39
+ *
40
+ * @since 1.0.7
41
+ *
42
+ * @return bool
43
+ */
44
+ abstract function is_anonymous();
45
+
46
+ /**
47
+ * Check if the user currently in activation mode.
48
+ *
49
+ * @since 1.0.7
50
+ *
51
+ * @return bool
52
+ */
53
+ abstract function is_activation_mode();
54
+
55
+ #endregion
56
+
57
+ #----------------------------------------------------------------------------------
58
+ #region Usage Tracking
59
+ #----------------------------------------------------------------------------------
60
+
61
+ /**
62
+ * Returns TRUE if the user opted-in and didn't disconnect (opt-out).
63
+ *
64
+ * @author Leo Fajardo (@leorw)
65
+ * @since 1.2.1.5
66
+ *
67
+ * @return bool
68
+ */
69
+ abstract function is_tracking_allowed();
70
+
71
+ /**
72
+ * Returns TRUE if the user never opted-in or manually opted-out.
73
+ *
74
+ * @author Vova Feldman (@svovaf)
75
+ * @since 1.2.1.5
76
+ *
77
+ * @return bool
78
+ */
79
+ function is_tracking_prohibited() {
80
+ return ! $this->is_registered() || ! $this->is_tracking_allowed();
81
+ }
82
+
83
+ /**
84
+ * Opt-out from usage tracking.
85
+ *
86
+ * Note: This will not delete the account information but will stop all tracking.
87
+ *
88
+ * Returns:
89
+ * 1. FALSE - If the user never opted-in.
90
+ * 2. TRUE - If successfully opted-out.
91
+ * 3. object - API Result on failure.
92
+ *
93
+ * @author Leo Fajardo (@leorw)
94
+ * @since 1.2.1.5
95
+ *
96
+ * @return bool|object
97
+ */
98
+ abstract function stop_tracking();
99
+
100
+ /**
101
+ * Opt-in back into usage tracking.
102
+ *
103
+ * Note: This will only work if the user opted-in previously.
104
+ *
105
+ * Returns:
106
+ * 1. FALSE - If the user never opted-in.
107
+ * 2. TRUE - If successfully opted-in back to usage tracking.
108
+ * 3. object - API result on failure.
109
+ *
110
+ * @author Leo Fajardo (@leorw)
111
+ * @since 1.2.1.5
112
+ *
113
+ * @return bool|object
114
+ */
115
+ abstract function allow_tracking();
116
+
117
+ #endregion
118
+
119
+ #----------------------------------------------------------------------------------
120
+ #region Permissions
121
+ #----------------------------------------------------------------------------------
122
+
123
+ /**
124
+ * Check if plugin must be WordPress.org compliant.
125
+ *
126
+ * @since 1.0.7
127
+ *
128
+ * @return bool
129
+ */
130
+ abstract function is_org_repo_compliant();
131
+
132
+ /**
133
+ * Check if plugin is allowed to install executable files.
134
+ *
135
+ * @author Vova Feldman (@svovaf)
136
+ * @since 1.0.5
137
+ *
138
+ * @return bool
139
+ */
140
+ function is_allowed_to_install() {
141
+ return ( $this->is_premium() || ! $this->is_org_repo_compliant() );
142
+ }
143
+
144
+ #endregion
145
+
146
+ /**
147
+ * Check if user in trial or in free plan (not paying).
148
+ *
149
+ * @author Vova Feldman (@svovaf)
150
+ * @since 1.0.4
151
+ *
152
+ * @return bool
153
+ */
154
+ function is_not_paying() {
155
+ return ( $this->is_trial() || $this->is_free_plan() );
156
+ }
157
+
158
+ /**
159
+ * Check if the user has an activated and valid paid license on current plugin's install.
160
+ *
161
+ * @since 1.0.9
162
+ *
163
+ * @return bool
164
+ */
165
+ abstract function is_paying();
166
+
167
+ /**
168
+ * Check if the user is paying or in trial.
169
+ *
170
+ * @since 1.0.9
171
+ *
172
+ * @return bool
173
+ */
174
+ function is_paying_or_trial() {
175
+ return ( $this->is_paying() || $this->is_trial() );
176
+ }
177
+
178
+ /**
179
+ * Check if user in a trial or have feature enabled license.
180
+ *
181
+ * @author Vova Feldman (@svovaf)
182
+ * @since 1.1.7
183
+ *
184
+ * @return bool
185
+ */
186
+ abstract function can_use_premium_code();
187
+
188
+ #----------------------------------------------------------------------------------
189
+ #region Premium Only
190
+ #----------------------------------------------------------------------------------
191
+
192
+ /**
193
+ * All logic wrapped in methods with "__premium_only()" suffix will be only
194
+ * included in the premium code.
195
+ *
196
+ * Example:
197
+ * if ( freemius()->is__premium_only() ) {
198
+ * ...
199
+ * }
200
+ */
201
+
202
+ /**
203
+ * Returns true when running premium plugin code.
204
+ *
205
+ * @since 1.0.9
206
+ *
207
+ * @return bool
208
+ */
209
+ function is__premium_only() {
210
+ return $this->is_premium();
211
+ }
212
+
213
+ /**
214
+ * Check if the user has an activated and valid paid license on current plugin's install.
215
+ *
216
+ * @since 1.0.9
217
+ *
218
+ * @return bool
219
+ *
220
+ */
221
+ function is_paying__premium_only() {
222
+ return ( $this->is__premium_only() && $this->is_paying() );
223
+ }
224
+
225
+ /**
226
+ * All code wrapped in this statement will be only included in the premium code.
227
+ *
228
+ * @since 1.0.9
229
+ *
230
+ * @param string $plan Plan name
231
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
232
+ *
233
+ * @return bool
234
+ */
235
+ function is_plan__premium_only( $plan, $exact = false ) {
236
+ return ( $this->is_premium() && $this->is_plan( $plan, $exact ) );
237
+ }
238
+
239
+ /**
240
+ * Check if plan matches active license' plan or active trial license' plan.
241
+ *
242
+ * All code wrapped in this statement will be only included in the premium code.
243
+ *
244
+ * @since 1.0.9
245
+ *
246
+ * @param string $plan Plan name
247
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
248
+ *
249
+ * @return bool
250
+ */
251
+ function is_plan_or_trial__premium_only( $plan, $exact = false ) {
252
+ return ( $this->is_premium() && $this->is_plan_or_trial( $plan, $exact ) );
253
+ }
254
+
255
+ /**
256
+ * Check if the user is paying or in trial.
257
+ *
258
+ * All code wrapped in this statement will be only included in the premium code.
259
+ *
260
+ * @since 1.0.9
261
+ *
262
+ * @return bool
263
+ */
264
+ function is_paying_or_trial__premium_only() {
265
+ return $this->is_premium() && $this->is_paying_or_trial();
266
+ }
267
+
268
+ /**
269
+ * Check if the user has an activated and valid paid license on current plugin's install.
270
+ *
271
+ * @since 1.0.4
272
+ *
273
+ * @return bool
274
+ *
275
+ * @deprecated Method name is confusing since it's not clear from the name the code will be removed.
276
+ * @using Alias to is_paying__premium_only()
277
+ */
278
+ function is_paying__fs__() {
279
+ return $this->is_paying__premium_only();
280
+ }
281
+
282
+ /**
283
+ * Check if user in a trial or have feature enabled license.
284
+ *
285
+ * All code wrapped in this statement will be only included in the premium code.
286
+ *
287
+ * @author Vova Feldman (@svovaf)
288
+ * @since 1.1.9
289
+ *
290
+ * @return bool
291
+ */
292
+ function can_use_premium_code__premium_only() {
293
+ return $this->is_premium() && $this->can_use_premium_code();
294
+ }
295
+
296
+ #endregion
297
+
298
+ #----------------------------------------------------------------------------------
299
+ #region Trial
300
+ #----------------------------------------------------------------------------------
301
+
302
+ /**
303
+ * Check if the user in a trial.
304
+ *
305
+ * @since 1.0.3
306
+ *
307
+ * @return bool
308
+ */
309
+ abstract function is_trial();
310
+
311
+ /**
312
+ * Check if trial already utilized.
313
+ *
314
+ * @since 1.0.9
315
+ *
316
+ * @return bool
317
+ */
318
+ abstract function is_trial_utilized();
319
+
320
+ #endregion
321
+
322
+ #----------------------------------------------------------------------------------
323
+ #region Plans
324
+ #----------------------------------------------------------------------------------
325
+
326
+ /**
327
+ * Check if plugin using the free plan.
328
+ *
329
+ * @since 1.0.4
330
+ *
331
+ * @return bool
332
+ */
333
+ abstract function is_free_plan();
334
+
335
+ /**
336
+ * @since 1.0.2
337
+ *
338
+ * @param string $plan Plan name
339
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
340
+ *
341
+ * @return bool
342
+ */
343
+ abstract function is_plan( $plan, $exact = false );
344
+
345
+ /**
346
+ * Check if plan based on trial. If not in trial mode, should return false.
347
+ *
348
+ * @since 1.0.9
349
+ *
350
+ * @param string $plan Plan name
351
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
352
+ *
353
+ * @return bool
354
+ */
355
+ abstract function is_trial_plan( $plan, $exact = false );
356
+
357
+ /**
358
+ * Check if plan matches active license' plan or active trial license' plan.
359
+ *
360
+ * @since 1.0.9
361
+ *
362
+ * @param string $plan Plan name
363
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
364
+ *
365
+ * @return bool
366
+ */
367
+ function is_plan_or_trial( $plan, $exact = false ) {
368
+ return $this->is_plan( $plan, $exact ) ||
369
+ $this->is_trial_plan( $plan, $exact );
370
+ }
371
+
372
+ /**
373
+ * Check if plugin has any paid plans.
374
+ *
375
+ * @author Vova Feldman (@svovaf)
376
+ * @since 1.0.7
377
+ *
378
+ * @return bool
379
+ */
380
+ abstract function has_paid_plan();
381
+
382
+ /**
383
+ * Check if plugin has any free plan, or is it premium only.
384
+ *
385
+ * Note: If no plans configured, assume plugin is free.
386
+ *
387
+ * @author Vova Feldman (@svovaf)
388
+ * @since 1.0.7
389
+ *
390
+ * @return bool
391
+ */
392
+ abstract function has_free_plan();
393
+
394
+ /**
395
+ * Check if plugin is premium only (no free plans).
396
+ *
397
+ * NOTE: is__premium_only() is very different method, don't get confused.
398
+ *
399
+ * @author Vova Feldman (@svovaf)
400
+ * @since 1.1.9
401
+ *
402
+ * @return bool
403
+ */
404
+ abstract function is_only_premium();
405
+
406
+ /**
407
+ * Checks if it's a freemium plugin.
408
+ *
409
+ * @author Vova Feldman (@svovaf)
410
+ * @since 1.1.9
411
+ *
412
+ * @return bool
413
+ */
414
+ function is_freemium() {
415
+ return $this->has_paid_plan() &&
416
+ $this->has_free_plan();
417
+ }
418
+
419
+ #endregion
420
+
421
+ /**
422
+ * Check if running payments in sandbox mode.
423
+ *
424
+ * @since 1.0.4
425
+ *
426
+ * @return bool
427
+ */
428
+ abstract function is_payments_sandbox();
429
+
430
+ /**
431
+ * Check if running test vs. live plugin.
432
+ *
433
+ * @since 1.0.5
434
+ *
435
+ * @return bool
436
+ */
437
+ abstract function is_live();
438
+
439
+ /**
440
+ * Check if running premium plugin code.
441
+ *
442
+ * @since 1.0.5
443
+ *
444
+ * @return bool
445
+ */
446
+ abstract function is_premium();
447
+
448
+ /**
449
+ * Get upgrade URL.
450
+ *
451
+ * @author Vova Feldman (@svovaf)
452
+ * @since 1.0.2
453
+ *
454
+ * @param string $period Billing cycle
455
+ *
456
+ * @return string
457
+ */
458
+ abstract function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY );
459
+
460
+ /**
461
+ * Check if Freemius was first added in a plugin update.
462
+ *
463
+ * @author Vova Feldman (@svovaf)
464
+ * @since 1.1.5
465
+ *
466
+ * @return bool
467
+ */
468
+ function is_plugin_update() {
469
+ return ! $this->is_plugin_new_install();
470
+ }
471
+
472
+ /**
473
+ * Check if Freemius was part of the plugin when the user installed it first.
474
+ *
475
+ * @author Vova Feldman (@svovaf)
476
+ * @since 1.1.5
477
+ *
478
+ * @return bool
479
+ */
480
+ abstract function is_plugin_new_install();
481
+
482
+ #----------------------------------------------------------------------------------
483
+ #region Marketing
484
+ #----------------------------------------------------------------------------------
485
+
486
+ /**
487
+ * Check if current user purchased any other plugins before.
488
+ *
489
+ * @author Vova Feldman (@svovaf)
490
+ * @since 1.0.9
491
+ *
492
+ * @return bool
493
+ */
494
+ abstract function has_purchased_before();
495
+
496
+ /**
497
+ * Check if current user classified as an agency.
498
+ *
499
+ * @author Vova Feldman (@svovaf)
500
+ * @since 1.0.9
501
+ *
502
+ * @return bool
503
+ */
504
+ abstract function is_agency();
505
+
506
+ /**
507
+ * Check if current user classified as a developer.
508
+ *
509
+ * @author Vova Feldman (@svovaf)
510
+ * @since 1.0.9
511
+ *
512
+ * @return bool
513
+ */
514
+ abstract function is_developer();
515
+
516
+ /**
517
+ * Check if current user classified as a business.
518
+ *
519
+ * @author Vova Feldman (@svovaf)
520
+ * @since 1.0.9
521
+ *
522
+ * @return bool
523
+ */
524
+ abstract function is_business();
525
+
526
+ #endregion
527
+ }
freemius/includes/class-freemius.php ADDED
@@ -0,0 +1,11344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
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
+ #endregion Plugin Info
72
+
73
+ /**
74
+ * @since 1.0.9
75
+ *
76
+ * @var bool If false, don't turn Freemius on.
77
+ */
78
+ private $_is_on;
79
+
80
+ /**
81
+ * @since 1.1.3
82
+ *
83
+ * @var bool If false, don't turn Freemius on.
84
+ */
85
+ private $_is_anonymous;
86
+
87
+ /**
88
+ * @since 1.0.9
89
+ * @var bool If false, issues with connectivity to Freemius API.
90
+ */
91
+ private $_has_api_connection;
92
+
93
+ /**
94
+ * @since 1.0.9
95
+ * @var bool Hints the SDK if plugin can support anonymous mode (if skip connect is visible).
96
+ */
97
+ private $_enable_anonymous;
98
+
99
+ /**
100
+ * @since 1.1.7.5
101
+ * @var bool Hints the SDK if plugin should run in anonymous mode (only adds feedback form).
102
+ */
103
+ private $_anonymous_mode;
104
+
105
+ /**
106
+ * @since 1.1.9
107
+ * @var bool Hints the SDK if plugin have any free plans.
108
+ */
109
+ private $_is_premium_only;
110
+
111
+ /**
112
+ * @since 1.0.8
113
+ * @var bool Hints the SDK if the plugin has any paid plans.
114
+ */
115
+ private $_has_paid_plans;
116
+
117
+ /**
118
+ * @since 1.2.1.5
119
+ * @var int Hints the SDK if the plugin offers a trial period. If negative, no trial, if zero - has a trial but
120
+ * without a specified period, if positive - the number of trial days.
121
+ */
122
+ private $_trial_days = - 1;
123
+
124
+ /**
125
+ * @since 1.2.1.5
126
+ * @var bool Hints the SDK if the trial requires a payment method or not.
127
+ */
128
+ private $_is_trial_require_payment = false;
129
+
130
+ /**
131
+ * @since 1.0.7
132
+ * @var bool Hints the SDK if the plugin is WordPress.org compliant.
133
+ */
134
+ private $_is_org_compliant;
135
+
136
+ /**
137
+ * @since 1.0.7
138
+ * @var bool Hints the SDK if the plugin is has add-ons.
139
+ */
140
+ private $_has_addons;
141
+
142
+ /**
143
+ * @since 1.1.6
144
+ * @var string[]bool.
145
+ */
146
+ private $_permissions;
147
+
148
+ /**
149
+ * @var FS_Key_Value_Storage
150
+ */
151
+ private $_storage;
152
+
153
+ /**
154
+ * @since 1.0.0
155
+ *
156
+ * @var FS_Logger
157
+ */
158
+ private $_logger;
159
+ /**
160
+ * @since 1.0.4
161
+ *
162
+ * @var FS_Plugin
163
+ */
164
+ private $_plugin = false;
165
+ /**
166
+ * @since 1.0.4
167
+ *
168
+ * @var FS_Plugin|false
169
+ */
170
+ private $_parent_plugin = false;
171
+ /**
172
+ * @since 1.1.1
173
+ *
174
+ * @var Freemius
175
+ */
176
+ private $_parent = false;
177
+ /**
178
+ * @since 1.0.1
179
+ *
180
+ * @var FS_User
181
+ */
182
+ private $_user = false;
183
+ /**
184
+ * @since 1.0.1
185
+ *
186
+ * @var FS_Site
187
+ */
188
+ private $_site = false;
189
+ /**
190
+ * @since 1.0.1
191
+ *
192
+ * @var FS_Plugin_License
193
+ */
194
+ private $_license;
195
+ /**
196
+ * @since 1.0.2
197
+ *
198
+ * @var FS_Plugin_Plan[]
199
+ */
200
+ private $_plans = false;
201
+ /**
202
+ * @var FS_Plugin_License[]
203
+ * @since 1.0.5
204
+ */
205
+ private $_licenses = false;
206
+
207
+ /**
208
+ * @since 1.0.1
209
+ *
210
+ * @var FS_Admin_Menu_Manager
211
+ */
212
+ private $_menu;
213
+
214
+ /**
215
+ * @var FS_Admin_Notice_Manager
216
+ */
217
+ private $_admin_notices;
218
+
219
+ /**
220
+ * @since 1.1.6
221
+ *
222
+ * @var FS_Admin_Notice_Manager
223
+ */
224
+ private static $_global_admin_notices;
225
+
226
+ /**
227
+ * @var FS_Logger
228
+ * @since 1.0.0
229
+ */
230
+ private static $_static_logger;
231
+
232
+ /**
233
+ * @var FS_Option_Manager
234
+ * @since 1.0.2
235
+ */
236
+ private static $_accounts;
237
+
238
+ /**
239
+ * @var Freemius[]
240
+ */
241
+ private static $_instances = array();
242
+
243
+ #region Uninstall Reasons IDs
244
+
245
+ const REASON_NO_LONGER_NEEDED = 1;
246
+ const REASON_FOUND_A_BETTER_PLUGIN = 2;
247
+ const REASON_NEEDED_FOR_A_SHORT_PERIOD = 3;
248
+ const REASON_BROKE_MY_SITE = 4;
249
+ const REASON_SUDDENLY_STOPPED_WORKING = 5;
250
+ const REASON_CANT_PAY_ANYMORE = 6;
251
+ const REASON_OTHER = 7;
252
+ const REASON_DIDNT_WORK = 8;
253
+ const REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION = 9;
254
+ const REASON_COULDNT_MAKE_IT_WORK = 10;
255
+ const REASON_GREAT_BUT_NEED_SPECIFIC_FEATURE = 11;
256
+ const REASON_NOT_WORKING = 12;
257
+ const REASON_NOT_WHAT_I_WAS_LOOKING_FOR = 13;
258
+ const REASON_DIDNT_WORK_AS_EXPECTED = 14;
259
+ const REASON_TEMPORARY_DEACTIVATION = 15;
260
+
261
+ #endregion
262
+
263
+ /* Ctor
264
+ ------------------------------------------------------------------------------------------------------------------*/
265
+
266
+ /**
267
+ * Main singleton instance.
268
+ *
269
+ * @author Vova Feldman (@svovaf)
270
+ * @since 1.0.0
271
+ *
272
+ * @param string $slug
273
+ * @param bool $is_init Since 1.2.1 Is initiation sequence.
274
+ */
275
+ private function __construct( $slug, $is_init = false ) {
276
+ $this->_slug = $slug;
277
+
278
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
279
+
280
+ $this->_storage = FS_Key_Value_Storage::instance( 'plugin_data', $this->_slug );
281
+
282
+ $this->_plugin_main_file_path = $this->_find_caller_plugin_file( $is_init );
283
+ $this->_plugin_dir_path = plugin_dir_path( $this->_plugin_main_file_path );
284
+ $this->_plugin_basename = plugin_basename( $this->_plugin_main_file_path );
285
+ $this->_free_plugin_basename = str_replace( '-premium/', '/', $this->_plugin_basename );
286
+
287
+ $base_name_split = explode( '/', $this->_plugin_basename );
288
+ $this->_plugin_dir_name = $base_name_split[0];
289
+
290
+ if ( $this->_logger->is_on() ) {
291
+ $this->_logger->info( 'plugin_main_file_path = ' . $this->_plugin_main_file_path );
292
+ $this->_logger->info( 'plugin_dir_path = ' . $this->_plugin_dir_path );
293
+ $this->_logger->info( 'plugin_basename = ' . $this->_plugin_basename );
294
+ $this->_logger->info( 'free_plugin_basename = ' . $this->_free_plugin_basename );
295
+ $this->_logger->info( 'plugin_dir_name = ' . $this->_plugin_dir_name );
296
+ }
297
+
298
+ // Remember link between file to slug.
299
+ $this->store_file_slug_map();
300
+
301
+ // Store plugin's initial install timestamp.
302
+ if ( ! isset( $this->_storage->install_timestamp ) ) {
303
+ $this->_storage->install_timestamp = WP_FS__SCRIPT_START_TIME;
304
+ }
305
+
306
+ $this->_plugin = FS_Plugin_Manager::instance( $this->_slug )->get();
307
+
308
+ $this->_admin_notices = FS_Admin_Notice_Manager::instance(
309
+ $slug,
310
+ is_object( $this->_plugin ) ? $this->_plugin->title : ''
311
+ );
312
+
313
+ if ( 'true' === fs_request_get( 'fs_clear_api_cache' ) ||
314
+ 'true' === fs_request_is_action( 'restart_freemius' )
315
+ ) {
316
+ FS_Api::clear_cache();
317
+ }
318
+
319
+ $this->_register_hooks();
320
+
321
+ $this->_load_account();
322
+
323
+ $this->_version_updates_handler();
324
+ }
325
+
326
+ /**
327
+ * @author Vova Feldman (@svovaf)
328
+ * @since 1.0.9
329
+ */
330
+ private function _version_updates_handler() {
331
+ if ( ! isset( $this->_storage->sdk_version ) || $this->_storage->sdk_version != $this->version ) {
332
+ // Freemius version upgrade mode.
333
+ $this->_storage->sdk_last_version = $this->_storage->sdk_version;
334
+ $this->_storage->sdk_version = $this->version;
335
+
336
+ if ( empty( $this->_storage->sdk_last_version ) ||
337
+ version_compare( $this->_storage->sdk_last_version, $this->version, '<' )
338
+ ) {
339
+ $this->_storage->sdk_upgrade_mode = true;
340
+ $this->_storage->sdk_downgrade_mode = false;
341
+ } else {
342
+ $this->_storage->sdk_downgrade_mode = true;
343
+ $this->_storage->sdk_upgrade_mode = false;
344
+
345
+ }
346
+
347
+ $this->do_action( 'sdk_version_update', $this->_storage->sdk_last_version, $this->version );
348
+ }
349
+
350
+ $plugin_version = $this->get_plugin_version();
351
+ if ( ! isset( $this->_storage->plugin_version ) || $this->_storage->plugin_version != $plugin_version ) {
352
+ // Plugin version upgrade mode.
353
+ $this->_storage->plugin_last_version = $this->_storage->plugin_version;
354
+ $this->_storage->plugin_version = $plugin_version;
355
+
356
+ if ( empty( $this->_storage->plugin_last_version ) ||
357
+ version_compare( $this->_storage->plugin_last_version, $plugin_version, '<' )
358
+ ) {
359
+ $this->_storage->plugin_upgrade_mode = true;
360
+ $this->_storage->plugin_downgrade_mode = false;
361
+ } else {
362
+ $this->_storage->plugin_downgrade_mode = true;
363
+ $this->_storage->plugin_upgrade_mode = false;
364
+ }
365
+
366
+ if ( ! empty( $this->_storage->plugin_last_version ) ) {
367
+ // Different version of the plugin was installed before, therefore it's an update.
368
+ $this->_storage->is_plugin_new_install = false;
369
+ }
370
+
371
+ $this->do_action( 'plugin_version_update', $this->_storage->plugin_last_version, $plugin_version );
372
+ }
373
+ }
374
+
375
+ /**
376
+ * @author Vova Feldman (@svovaf)
377
+ * @since 1.1.5
378
+ *
379
+ * @param string $sdk_prev_version
380
+ * @param string $sdk_version
381
+ */
382
+ function _data_migration( $sdk_prev_version, $sdk_version ) {
383
+ /**
384
+ * @since 1.1.7.3 Fixed unwanted connectivity test cleanup.
385
+ */
386
+ if ( empty( $sdk_prev_version ) ) {
387
+ return;
388
+ }
389
+
390
+ if ( version_compare( $sdk_prev_version, '1.1.5', '<' ) &&
391
+ version_compare( $sdk_version, '1.1.5', '>=' )
392
+ ) {
393
+ // On version 1.1.5 merged connectivity and is_on data.
394
+ if ( isset( $this->_storage->connectivity_test ) ) {
395
+ if ( ! isset( $this->_storage->is_on ) ) {
396
+ unset( $this->_storage->connectivity_test );
397
+ } else {
398
+ $connectivity_data = $this->_storage->connectivity_test;
399
+ $connectivity_data['is_active'] = $this->_storage->is_on['is_active'];
400
+ $connectivity_data['timestamp'] = $this->_storage->is_on['timestamp'];
401
+
402
+ // Override.
403
+ $this->_storage->connectivity_test = $connectivity_data;
404
+
405
+ // Remove previous structure.
406
+ unset( $this->_storage->is_on );
407
+ }
408
+
409
+ }
410
+ }
411
+ }
412
+
413
+ /**
414
+ * This action is connected to the 'plugins_loaded' hook and helps to determine
415
+ * if this is a new plugin installation or a plugin update.
416
+ *
417
+ * There are 3 different use-cases:
418
+ * 1) New plugin installation right with Freemius:
419
+ * 1.1 _activate_plugin_event_hook() will be executed first
420
+ * 1.2 Since $this->_storage->is_plugin_new_install is not set,
421
+ * and $this->_storage->plugin_last_version is not set,
422
+ * $this->_storage->is_plugin_new_install will be set to TRUE.
423
+ * 1.3 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
424
+ * be already set to TRUE.
425
+ *
426
+ * 2) Plugin update, didn't have Freemius before, and now have the SDK:
427
+ * 2.1 _activate_plugin_event_hook() will not be executed, because
428
+ * the activation hook do NOT fires on updates since WP 3.1.
429
+ * 2.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install will
430
+ * be empty, therefore, it will be set to FALSE.
431
+ *
432
+ * 3) Plugin update, had Freemius in prev version as well:
433
+ * 3.1 _version_updates_handler() will be executed 1st, since FS was installed
434
+ * before, $this->_storage->plugin_last_version will NOT be empty,
435
+ * therefore, $this->_storage->is_plugin_new_install will be set to FALSE.
436
+ * 3.2 When _plugins_loaded() will be executed, $this->_storage->is_plugin_new_install is
437
+ * already set, therefore, it will not be modified.
438
+ *
439
+ * Use-case #3 is backward compatible, #3.1 will be executed since 1.0.9.
440
+ *
441
+ * NOTE:
442
+ * The only fallback of this mechanism is if an admin updates a plugin based on use-case #2,
443
+ * and then, the next immediate PageView is the plugin's main settings page, it will not
444
+ * show the opt-in right away. The reason it will happen is because Freemius execution
445
+ * will be turned off till the plugin is fully loaded at least once
446
+ * (till $this->_storage->was_plugin_loaded is TRUE).
447
+ *
448
+ * @author Vova Feldman (@svovaf)
449
+ * @since 1.1.9
450
+ *
451
+ */
452
+ function _plugins_loaded() {
453
+ // Update flag that plugin was loaded with Freemius at least once.
454
+ $this->_storage->was_plugin_loaded = true;
455
+
456
+ if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
457
+ $this->_storage->is_plugin_new_install = false;
458
+ }
459
+ }
460
+
461
+ /**
462
+ * @author Vova Feldman (@svovaf)
463
+ * @since 1.0.9
464
+ */
465
+ private function _register_hooks() {
466
+ $this->_logger->entrance();
467
+
468
+ if ( is_admin() ) {
469
+ $plugin_dir = dirname( $this->_plugin_dir_path ) . '/';
470
+
471
+ /**
472
+ * @since 1.2.2
473
+ *
474
+ * Hook to both free and premium version activations to support
475
+ * auto deactivation on the other version activation.
476
+ */
477
+ register_activation_hook(
478
+ $plugin_dir . $this->_free_plugin_basename,
479
+ array( &$this, '_activate_plugin_event_hook' )
480
+ );
481
+ register_activation_hook(
482
+ $plugin_dir . $this->premium_plugin_basename(),
483
+ array( &$this, '_activate_plugin_event_hook' )
484
+ );
485
+
486
+ /**
487
+ * Part of the mechanism to identify new plugin install vs. plugin update.
488
+ *
489
+ * @author Vova Feldman (@svovaf)
490
+ * @since 1.1.9
491
+ */
492
+ if ( empty( $this->_storage->was_plugin_loaded ) ) {
493
+ if ( $this->is_activation_mode( false ) ) {
494
+ add_action( 'plugins_loaded', array( &$this, '_plugins_loaded' ) );
495
+ } else {
496
+ // If was activated before, then it was already loaded before.
497
+ $this->_plugins_loaded();
498
+ }
499
+ }
500
+
501
+ if ( ! $this->is_ajax() ) {
502
+ if ( ! $this->is_addon() ) {
503
+ add_action( 'init', array( &$this, '_add_default_submenu_items' ), WP_FS__LOWEST_PRIORITY );
504
+ add_action( 'admin_menu', array( &$this, '_prepare_admin_menu' ), WP_FS__LOWEST_PRIORITY );
505
+ }
506
+ }
507
+ }
508
+
509
+ register_deactivation_hook( $this->_plugin_main_file_path, array( &$this, '_deactivate_plugin_hook' ) );
510
+
511
+ add_action( 'init', array( &$this, '_redirect_on_clicked_menu_link' ), WP_FS__LOWEST_PRIORITY );
512
+
513
+ add_action( 'admin_init', array( &$this, '_add_tracking_links' ) );
514
+ add_action( 'admin_init', array( &$this, '_add_license_activation' ) );
515
+ $this->add_ajax_action( 'update_billing', array( &$this, '_update_billing_ajax_action' ) );
516
+ $this->add_ajax_action( 'start_trial', array( &$this, '_start_trial_ajax_action' ) );
517
+
518
+ $this->add_action( 'after_plans_sync', array( &$this, '_check_for_trial_plans' ) );
519
+
520
+ $this->add_action( 'sdk_version_update', array( &$this, '_data_migration' ), WP_FS__DEFAULT_PRIORITY, 2 );
521
+
522
+ add_action( 'admin_init', array( &$this, '_add_trial_notice' ) );
523
+ add_action( 'admin_init', array( &$this, '_enqueue_common_css' ) );
524
+
525
+ /**
526
+ * Handle request to reset anonymous mode for `get_reconnect_url()`.
527
+ *
528
+ * @author Vova Feldman (@svovaf)
529
+ * @since 1.2.1.5
530
+ */
531
+ if ( fs_request_is_action( 'reset_anonymous_mode' ) &&
532
+ $this->_slug === fs_request_get( 'fs_slug' )
533
+ ) {
534
+ add_action( 'admin_init', array( &$this, 'connect_again' ) );
535
+ }
536
+ }
537
+
538
+ /**
539
+ * Keeping the uninstall hook registered for free or premium plugin version may result to a fatal error that
540
+ * could happen when a user tries to uninstall either version while one of them is still active. Uninstalling a
541
+ * plugin will trigger inclusion of the free or premium version and if one of them is active during the
542
+ * uninstallation, a fatal error may occur in case the plugin's class or functions are already defined.
543
+ *
544
+ * @author Leo Fajardo (leorw)
545
+ *
546
+ * @since 1.2.0
547
+ */
548
+ private function unregister_uninstall_hook() {
549
+ $uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
550
+ unset( $uninstallable_plugins[ $this->_free_plugin_basename ] );
551
+ unset( $uninstallable_plugins[ $this->premium_plugin_basename() ] );
552
+
553
+ update_option( 'uninstall_plugins', $uninstallable_plugins );
554
+ }
555
+
556
+ /**
557
+ * @since 1.2.0 Invalidate module's main file cache, otherwise, FS_Plugin_Updater will not fetch updates.
558
+ */
559
+ private function clear_module_main_file_cache() {
560
+ if ( ! isset( $this->_storage->plugin_main_file ) ||
561
+ empty( $this->_storage->plugin_main_file->path )
562
+ ) {
563
+ return;
564
+ }
565
+
566
+ $plugin_main_file = clone $this->_storage->plugin_main_file;
567
+
568
+ // Store cached path (2nd layer cache).
569
+ $plugin_main_file->prev_path = $plugin_main_file->path;
570
+
571
+ // Clear cached path.
572
+ unset( $plugin_main_file->path );
573
+
574
+ $this->_storage->plugin_main_file = $plugin_main_file;
575
+ }
576
+
577
+ /**
578
+ * @author Vova Feldman (@svovaf)
579
+ * @since 1.0.9
580
+ */
581
+ private function _register_account_hooks() {
582
+ if ( is_admin() ) {
583
+ // If user is paying or in trial and have the free version installed,
584
+ // assume that the deactivation is for the upgrade process.
585
+ if ( ! $this->is_paying_or_trial() || $this->is_premium() ) {
586
+ $this->add_ajax_action(
587
+ 'submit_uninstall_reason',
588
+ array( &$this, '_submit_uninstall_reason_action' )
589
+ );
590
+
591
+ if ( $this->is_plugins_page() ) {
592
+ add_action( 'admin_footer', array( &$this, '_add_deactivation_feedback_dialog_box' ) );
593
+ }
594
+ }
595
+
596
+ if ( ! $this->is_addon() ) {
597
+ if ( $this->is_registered() ) {
598
+ $this->add_filter( 'after_code_type_change', array( &$this, '_after_code_type_change' ) );
599
+ }
600
+ }
601
+ }
602
+ }
603
+
604
+ /**
605
+ * Leverage backtrace to find caller plugin file path.
606
+ *
607
+ * @author Vova Feldman (@svovaf)
608
+ * @since 1.0.6
609
+ *
610
+ * @param bool $is_init Is initiation sequence.
611
+ *
612
+ * @return string
613
+ *
614
+ * @uses fs_find_caller_plugin_file
615
+ */
616
+ private function _find_caller_plugin_file( $is_init = false ) {
617
+ // Try to load the cached value of the file path.
618
+ if ( isset( $this->_storage->plugin_main_file ) ) {
619
+ $plugin_main_file = $this->_storage->plugin_main_file;
620
+ if ( isset( $plugin_main_file->path ) && file_exists( $plugin_main_file->path ) ) {
621
+ return $this->_storage->plugin_main_file->path;
622
+ }
623
+ }
624
+
625
+ /**
626
+ * @since 1.2.1
627
+ *
628
+ * `clear_module_main_file_cache()` is clearing the plugin's cached path on
629
+ * deactivation. Therefore, if any plugin/theme was initiating `Freemius`
630
+ * with that plugin's slug, it was overriding the empty plugin path with a wrong path.
631
+ *
632
+ * So, we've added a special mechanism with a 2nd layer of cache that uses `prev_path`
633
+ * when the class instantiator isn't the module.
634
+ */
635
+ if ( ! $is_init ) {
636
+ // Fetch prev path cache.
637
+ if ( isset( $this->_storage->plugin_main_file ) &&
638
+ isset( $this->_storage->plugin_main_file->prev_path )
639
+ ) {
640
+ if ( file_exists( $this->_storage->plugin_main_file->prev_path ) ) {
641
+ return $this->_storage->plugin_main_file->prev_path;
642
+ }
643
+ }
644
+
645
+ wp_die(
646
+ __fs( 'failed-finding-main-path', $this->_slug ),
647
+ __fs( 'error' ),
648
+ array( 'back_link' => true )
649
+ );
650
+ }
651
+
652
+ /**
653
+ * @since 1.2.1
654
+ *
655
+ * Only the original instantiator that calls dynamic_init can modify the module's path.
656
+ */
657
+ // Find caller module.
658
+ $plugin_file = fs_find_caller_plugin_file();
659
+
660
+ $this->_storage->plugin_main_file = (object) array(
661
+ 'path' => fs_normalize_path( $plugin_file ),
662
+ );
663
+
664
+ return $plugin_file;
665
+ }
666
+
667
+
668
+ #----------------------------------------------------------------------------------
669
+ #region Deactivation Feedback Form
670
+ #----------------------------------------------------------------------------------
671
+
672
+ /**
673
+ * Displays a confirmation and feedback dialog box when the user clicks on the "Deactivate" link on the plugins
674
+ * page.
675
+ *
676
+ * @author Vova Feldman (@svovaf)
677
+ * @author Leo Fajardo (@leorw)
678
+ * @since 1.1.2
679
+ */
680
+ function _add_deactivation_feedback_dialog_box() {
681
+ /* Check the type of user:
682
+ * 1. Long-term (long-term)
683
+ * 2. Non-registered and non-anonymous short-term (non-registered-and-non-anonymous-short-term).
684
+ * 3. Short-term (short-term)
685
+ */
686
+ $is_long_term_user = true;
687
+
688
+ // Check if the site is at least 2 days old.
689
+ $time_installed = $this->_storage->install_timestamp;
690
+
691
+ // Difference in seconds.
692
+ $date_diff = time() - $time_installed;
693
+
694
+ // Convert seconds to days.
695
+ $date_diff_days = floor( $date_diff / ( 60 * 60 * 24 ) );
696
+
697
+ if ( $date_diff_days < 2 ) {
698
+ $is_long_term_user = false;
699
+ }
700
+
701
+ $is_long_term_user = $this->apply_filters( 'is_long_term_user', $is_long_term_user );
702
+
703
+ if ( $is_long_term_user ) {
704
+ $user_type = 'long-term';
705
+ } else {
706
+ if ( ! $this->is_registered() && ! $this->is_anonymous() ) {
707
+ $user_type = 'non-registered-and-non-anonymous-short-term';
708
+ } else {
709
+ $user_type = 'short-term';
710
+ }
711
+ }
712
+
713
+ $uninstall_reasons = $this->_get_uninstall_reasons( $user_type );
714
+
715
+ // Load the HTML template for the deactivation feedback dialog box.
716
+ $vars = array(
717
+ 'reasons' => $uninstall_reasons,
718
+ 'slug' => $this->_slug
719
+ );
720
+
721
+ /**
722
+ * @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.
723
+ */
724
+ fs_require_template( 'forms/deactivation/form.php', $vars );
725
+ }
726
+
727
+ /**
728
+ * @author Leo Fajardo (leorw)
729
+ * @since 1.1.2
730
+ *
731
+ * @param string $user_type
732
+ *
733
+ * @return array The uninstall reasons for the specified user type.
734
+ */
735
+ function _get_uninstall_reasons( $user_type = 'long-term' ) {
736
+ $internal_message_template_var = array(
737
+ 'slug' => $this->_slug
738
+ );
739
+
740
+ if ( $this->is_registered() && false !== $this->get_plan() && $this->get_plan()->has_technical_support() ) {
741
+ $contact_support_template = fs_get_template( 'forms/deactivation/contact.php', $internal_message_template_var );
742
+ } else {
743
+ $contact_support_template = '';
744
+ }
745
+
746
+ $reason_found_better_plugin = array(
747
+ 'id' => self::REASON_FOUND_A_BETTER_PLUGIN,
748
+ 'text' => __fs( 'reason-found-a-better-plugin', $this->_slug ),
749
+ 'input_type' => 'textfield',
750
+ 'input_placeholder' => __fs( 'placeholder-plugin-name', $this->_slug )
751
+ );
752
+
753
+ $reason_temporary_deactivation = array(
754
+ 'id' => self::REASON_TEMPORARY_DEACTIVATION,
755
+ 'text' => __fs( 'reason-temporary-deactivation', $this->_slug ),
756
+ 'input_type' => '',
757
+ 'input_placeholder' => ''
758
+ );
759
+
760
+ $reason_other = array(
761
+ 'id' => self::REASON_OTHER,
762
+ 'text' => __fs( 'reason-other', $this->_slug ),
763
+ 'input_type' => 'textfield',
764
+ 'input_placeholder' => ''
765
+ );
766
+
767
+ $long_term_user_reasons = array(
768
+ array(
769
+ 'id' => self::REASON_NO_LONGER_NEEDED,
770
+ 'text' => __fs( 'reason-no-longer-needed', $this->_slug ),
771
+ 'input_type' => '',
772
+ 'input_placeholder' => ''
773
+ ),
774
+ $reason_found_better_plugin,
775
+ array(
776
+ 'id' => self::REASON_NEEDED_FOR_A_SHORT_PERIOD,
777
+ 'text' => __fs( 'reason-needed-for-a-short-period', $this->_slug ),
778
+ 'input_type' => '',
779
+ 'input_placeholder' => ''
780
+ ),
781
+ array(
782
+ 'id' => self::REASON_BROKE_MY_SITE,
783
+ 'text' => __fs( 'reason-broke-my-site', $this->_slug ),
784
+ 'input_type' => '',
785
+ 'input_placeholder' => '',
786
+ 'internal_message' => $contact_support_template
787
+ ),
788
+ array(
789
+ 'id' => self::REASON_SUDDENLY_STOPPED_WORKING,
790
+ 'text' => __fs( 'reason-suddenly-stopped-working', $this->_slug ),
791
+ 'input_type' => '',
792
+ 'input_placeholder' => '',
793
+ 'internal_message' => $contact_support_template
794
+ )
795
+ );
796
+
797
+ if ( $this->is_paying() ) {
798
+ $long_term_user_reasons[] = array(
799
+ 'id' => self::REASON_CANT_PAY_ANYMORE,
800
+ 'text' => __fs( 'reason-cant-pay-anymore', $this->_slug ),
801
+ 'input_type' => 'textfield',
802
+ 'input_placeholder' => __fs( 'placeholder-comfortable-price', $this->_slug )
803
+ );
804
+ }
805
+
806
+ $reason_dont_share_info = array(
807
+ 'id' => self::REASON_DONT_LIKE_TO_SHARE_MY_INFORMATION,
808
+ 'text' => __fs( 'reason-dont-like-to-share-my-information', $this->_slug ),
809
+ 'input_type' => '',
810
+ 'input_placeholder' => ''
811
+ );
812
+
813
+ /**
814
+ * If the current user has selected the "don't share data" reason in the deactivation feedback modal, inform the
815
+ * user by showing additional message that he doesn't have to share data and can just choose to skip the opt-in
816
+ * (the Skip button is included in the message to show). This message will only be shown if anonymous mode is
817
+ * enabled and the user's account is currently not in pending activation state (similar to the way the Skip
818
+ * button in the opt-in form is shown/hidden).
819
+ */
820
+ if ( $this->is_enable_anonymous() && ! $this->is_pending_activation() ) {
821
+ $reason_dont_share_info['internal_message'] = fs_get_template( 'forms/deactivation/retry-skip.php', $internal_message_template_var );
822
+ }
823
+
824
+ $uninstall_reasons = array(
825
+ 'long-term' => $long_term_user_reasons,
826
+ 'non-registered-and-non-anonymous-short-term' => array(
827
+ array(
828
+ 'id' => self::REASON_DIDNT_WORK,
829
+ 'text' => __fs( 'reason-didnt-work', $this->_slug ),
830
+ 'input_type' => '',
831
+ 'input_placeholder' => ''
832
+ ),
833
+ $reason_dont_share_info,
834
+ $reason_found_better_plugin
835
+ ),
836
+ 'short-term' => array(
837
+ array(
838
+ 'id' => self::REASON_COULDNT_MAKE_IT_WORK,
839
+ 'text' => __fs( 'reason-couldnt-make-it-work', $this->_slug ),
840
+ 'input_type' => '',
841
+ 'input_placeholder' => '',
842
+ 'internal_message' => $contact_support_template
843
+ ),
844
+ $reason_found_better_plugin,
845
+ array(
846
+ 'id' => self::REASON_GREAT_BUT_NEED_SPECIFIC_FEATURE,
847
+ 'text' => __fs( 'reason-great-but-need-specific-feature', $this->_slug ),
848
+ 'input_type' => 'textarea',
849
+ 'input_placeholder' => __fs( 'placeholder-feature', $this->_slug )
850
+ ),
851
+ array(
852
+ 'id' => self::REASON_NOT_WORKING,
853
+ 'text' => __fs( 'reason-not-working', $this->_slug ),
854
+ 'input_type' => 'textarea',
855
+ 'input_placeholder' => __fs( 'placeholder-share-what-didnt-work', $this->_slug )
856
+ ),
857
+ array(
858
+ 'id' => self::REASON_NOT_WHAT_I_WAS_LOOKING_FOR,
859
+ 'text' => __fs( 'reason-not-what-i-was-looking-for', $this->_slug ),
860
+ 'input_type' => 'textarea',
861
+ 'input_placeholder' => __fs( 'placeholder-what-youve-been-looking-for', $this->_slug )
862
+ ),
863
+ array(
864
+ 'id' => self::REASON_DIDNT_WORK_AS_EXPECTED,
865
+ 'text' => __fs( 'reason-didnt-work-as-expected', $this->_slug ),
866
+ 'input_type' => 'textarea',
867
+ 'input_placeholder' => __fs( 'placeholder-what-did-you-expect', $this->_slug )
868
+ )
869
+ )
870
+ );
871
+
872
+ // Randomize the reasons for the current user type.
873
+ shuffle( $uninstall_reasons[ $user_type ] );
874
+
875
+ // Keep the following reasons as the last items in the list.
876
+ $uninstall_reasons[ $user_type ][] = $reason_temporary_deactivation;
877
+ $uninstall_reasons[ $user_type ][] = $reason_other;
878
+
879
+ $uninstall_reasons = $this->apply_filters( 'uninstall_reasons', $uninstall_reasons );
880
+
881
+ return $uninstall_reasons[ $user_type ];
882
+ }
883
+
884
+ /**
885
+ * Called after the user has submitted his reason for deactivating the plugin.
886
+ *
887
+ * @author Leo Fajardo (@leorw)
888
+ * @since 1.1.2
889
+ */
890
+ function _submit_uninstall_reason_action() {
891
+ $reason_id = fs_request_get( 'reason_id' );
892
+
893
+ // Check if the given reason ID is an unsigned integer.
894
+ if ( ! ctype_digit( $reason_id ) ) {
895
+ exit;
896
+ }
897
+
898
+ $reason_info = trim( fs_request_get( 'reason_info', '' ) );
899
+ if ( ! empty( $reason_info ) ) {
900
+ $reason_info = substr( $reason_info, 0, 128 );
901
+ }
902
+
903
+ $reason = (object) array(
904
+ 'id' => $reason_id,
905
+ 'info' => $reason_info,
906
+ 'is_anonymous' => fs_request_get_bool( 'is_anonymous' )
907
+ );
908
+
909
+ $this->_storage->store( 'uninstall_reason', $reason );
910
+
911
+ // Print '1' for successful operation.
912
+ echo 1;
913
+ exit;
914
+ }
915
+
916
+ #endregion
917
+
918
+ #----------------------------------------------------------------------------------
919
+ #region Instance
920
+ #----------------------------------------------------------------------------------
921
+
922
+ /**
923
+ * Main singleton instance.
924
+ *
925
+ * @author Vova Feldman (@svovaf)
926
+ * @since 1.0.0
927
+ *
928
+ * @param string $slug
929
+ * @param bool $is_init Is initiation sequence.
930
+ *
931
+ * @return Freemius
932
+ */
933
+ static function instance( $slug, $is_init = false ) {
934
+ $slug = strtolower( $slug );
935
+
936
+ if ( ! isset( self::$_instances[ $slug ] ) ) {
937
+ if ( 0 === count( self::$_instances ) ) {
938
+ self::_load_required_static();
939
+ }
940
+
941
+ self::$_instances[ $slug ] = new Freemius( $slug, $is_init );
942
+ }
943
+
944
+ return self::$_instances[ $slug ];
945
+ }
946
+
947
+ /**
948
+ * @author Vova Feldman (@svovaf)
949
+ * @since 1.0.6
950
+ *
951
+ * @param string|number $slug_or_id
952
+ *
953
+ * @return bool
954
+ */
955
+ private static function has_instance( $slug_or_id ) {
956
+ return ! is_numeric( $slug_or_id ) ?
957
+ isset( self::$_instances[ strtolower( $slug_or_id ) ] ) :
958
+ ( false !== self::get_instance_by_id( $slug_or_id ) );
959
+ }
960
+
961
+ /**
962
+ * @author Vova Feldman (@svovaf)
963
+ * @since 1.0.6
964
+ *
965
+ * @param $id
966
+ *
967
+ * @return false|Freemius
968
+ */
969
+ static function get_instance_by_id( $id ) {
970
+ foreach ( self::$_instances as $slug => $instance ) {
971
+ if ( $id == $instance->get_id() ) {
972
+ return $instance;
973
+ }
974
+ }
975
+
976
+ return false;
977
+ }
978
+
979
+ /**
980
+ *
981
+ * @author Vova Feldman (@svovaf)
982
+ * @since 1.0.1
983
+ *
984
+ * @param $plugin_file
985
+ *
986
+ * @return false|Freemius
987
+ */
988
+ static function get_instance_by_file( $plugin_file ) {
989
+ $slug = self::find_slug_by_basename( $plugin_file );
990
+
991
+ return ( false !== $slug ) ?
992
+ self::instance( $slug ) :
993
+ false;
994
+ }
995
+
996
+ /**
997
+ * @author Vova Feldman (@svovaf)
998
+ * @since 1.0.6
999
+ *
1000
+ * @return false|Freemius
1001
+ */
1002
+ function get_parent_instance() {
1003
+ return self::get_instance_by_id( $this->_plugin->parent_plugin_id );
1004
+ }
1005
+
1006
+ /**
1007
+ * @author Vova Feldman (@svovaf)
1008
+ * @since 1.0.6
1009
+ *
1010
+ * @param $slug_or_id
1011
+ *
1012
+ * @return bool|Freemius
1013
+ */
1014
+ function get_addon_instance( $slug_or_id ) {
1015
+ return ! is_numeric( $slug_or_id ) ?
1016
+ self::instance( strtolower( $slug_or_id ) ) :
1017
+ self::get_instance_by_id( $slug_or_id );
1018
+ }
1019
+
1020
+ #endregion ------------------------------------------------------------------
1021
+
1022
+ /**
1023
+ * @author Vova Feldman (@svovaf)
1024
+ * @since 1.0.6
1025
+ *
1026
+ * @return bool
1027
+ */
1028
+ function is_parent_plugin_installed() {
1029
+ return self::has_instance( $this->_plugin->parent_plugin_id );
1030
+ }
1031
+
1032
+ /**
1033
+ * Check if add-on parent plugin in activation mode.
1034
+ *
1035
+ * @author Vova Feldman (@svovaf)
1036
+ * @since 1.0.7
1037
+ *
1038
+ * @return bool
1039
+ */
1040
+ function is_parent_in_activation() {
1041
+ $parent_fs = $this->get_parent_instance();
1042
+ if ( ! is_object( $parent_fs ) ) {
1043
+ return false;
1044
+ }
1045
+
1046
+ return ( $parent_fs->is_activation_mode() );
1047
+ }
1048
+
1049
+ /**
1050
+ * Is plugin in activation mode.
1051
+ *
1052
+ * @author Vova Feldman (@svovaf)
1053
+ * @since 1.0.7
1054
+ *
1055
+ * @param bool $and_on
1056
+ *
1057
+ * @return bool
1058
+ */
1059
+ function is_activation_mode( $and_on = true ) {
1060
+ return (
1061
+ ( $this->is_on() || ! $and_on ) &&
1062
+ ! $this->is_registered() &&
1063
+ ( ! $this->is_enable_anonymous() ||
1064
+ ( ! $this->is_anonymous() && ! $this->is_pending_activation() ) )
1065
+ );
1066
+ }
1067
+
1068
+ /**
1069
+ * Get collection of all active plugins.
1070
+ *
1071
+ * @author Vova Feldman (@svovaf)
1072
+ * @since 1.0.9
1073
+ *
1074
+ * @return array[string]array
1075
+ */
1076
+ private static function get_active_plugins() {
1077
+ self::require_plugin_essentials();
1078
+
1079
+ $active_plugin = array();
1080
+ $all_plugins = get_plugins();
1081
+ $active_plugins_basenames = get_option( 'active_plugins' );
1082
+
1083
+ foreach ( $active_plugins_basenames as $plugin_basename ) {
1084
+ $active_plugin[ $plugin_basename ] = $all_plugins[ $plugin_basename ];
1085
+ }
1086
+
1087
+ return $active_plugin;
1088
+ }
1089
+
1090
+ /**
1091
+ * Get collection of all plugins.
1092
+ *
1093
+ * @author Vova Feldman (@svovaf)
1094
+ * @since 1.1.8
1095
+ *
1096
+ * @return array Key is the plugin file path and the value is an array of the plugin data.
1097
+ */
1098
+ private static function get_all_plugins() {
1099
+ self::require_plugin_essentials();
1100
+
1101
+ $all_plugins = get_plugins();
1102
+ $active_plugins_basenames = get_option( 'active_plugins' );
1103
+
1104
+ foreach ( $all_plugins as $basename => &$data ) {
1105
+ // By default set to inactive (next foreach update the active plugins).
1106
+ $data['is_active'] = false;
1107
+ // Enrich with plugin slug.
1108
+ $data['slug'] = self::get_plugin_slug( $basename );
1109
+ }
1110
+
1111
+ // Flag active plugins.
1112
+ foreach ( $active_plugins_basenames as $basename ) {
1113
+ if ( isset( $all_plugins[ $basename ] ) ) {
1114
+ $all_plugins[ $basename ]['is_active'] = true;
1115
+ }
1116
+ }
1117
+
1118
+ return $all_plugins;
1119
+ }
1120
+
1121
+
1122
+ /**
1123
+ * Cached result of get_site_transient( 'update_plugins' )
1124
+ *
1125
+ * @author Vova Feldman (@svovaf)
1126
+ * @since 1.1.8
1127
+ *
1128
+ * @var object
1129
+ */
1130
+ private static $_plugins_info;
1131
+
1132
+ /**
1133
+ * Helper function to get specified plugin's slug.
1134
+ *
1135
+ * @author Vova Feldman (@svovaf)
1136
+ * @since 1.1.8
1137
+ *
1138
+ * @param $basename
1139
+ *
1140
+ * @return string
1141
+ */
1142
+ private static function get_plugin_slug( $basename ) {
1143
+ if ( ! isset( self::$_plugins_info ) ) {
1144
+ self::$_plugins_info = get_site_transient( 'update_plugins' );
1145
+ }
1146
+
1147
+ $slug = '';
1148
+
1149
+ if ( is_object( self::$_plugins_info ) ) {
1150
+ if ( isset( self::$_plugins_info->no_update ) &&
1151
+ isset( self::$_plugins_info->no_update[ $basename ] ) &&
1152
+ ! empty( self::$_plugins_info->no_update[ $basename ]->slug )
1153
+ ) {
1154
+ $slug = self::$_plugins_info->no_update[ $basename ]->slug;
1155
+ } else if ( isset( self::$_plugins_info->response ) &&
1156
+ isset( self::$_plugins_info->response[ $basename ] ) &&
1157
+ ! empty( self::$_plugins_info->response[ $basename ]->slug )
1158
+ ) {
1159
+ $slug = self::$_plugins_info->response[ $basename ]->slug;
1160
+ }
1161
+ }
1162
+
1163
+ if ( empty( $slug ) ) {
1164
+ // Try to find slug from FS data.
1165
+ $slug = self::find_slug_by_basename( $basename );
1166
+ }
1167
+
1168
+ if ( empty( $slug ) ) {
1169
+ // Fallback to plugin's folder name.
1170
+ $slug = dirname( $basename );
1171
+ }
1172
+
1173
+ return $slug;
1174
+ }
1175
+
1176
+ private static $_statics_loaded = false;
1177
+
1178
+ /**
1179
+ * Load static resources.
1180
+ *
1181
+ * @author Vova Feldman (@svovaf)
1182
+ * @since 1.0.1
1183
+ */
1184
+ private static function _load_required_static() {
1185
+ if ( self::$_statics_loaded ) {
1186
+ return;
1187
+ }
1188
+
1189
+ self::$_static_logger = FS_Logger::get_logger( WP_FS__SLUG, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
1190
+
1191
+ self::$_static_logger->entrance();
1192
+
1193
+ self::$_accounts = FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
1194
+
1195
+ self::$_global_admin_notices = FS_Admin_Notice_Manager::instance( 'global' );
1196
+
1197
+ // Configure which Freemius powered plugins should be auto updated.
1198
+ // add_filter( 'auto_update_plugin', '_include_plugins_in_auto_update', 10, 2 );
1199
+
1200
+ add_action( 'admin_menu', array( 'Freemius', 'add_debug_page' ) );
1201
+
1202
+ add_action( "wp_ajax_fs_toggle_debug_mode", array( 'Freemius', '_toggle_debug_mode' ) );
1203
+
1204
+ add_action( 'plugins_loaded', array( 'Freemius', '_load_textdomain' ), 1 );
1205
+
1206
+ self::$_statics_loaded = true;
1207
+ }
1208
+
1209
+ #----------------------------------------------------------------------------------
1210
+ #region Localization
1211
+ #----------------------------------------------------------------------------------
1212
+
1213
+ /**
1214
+ * Load framework's text domain.
1215
+ *
1216
+ * @author Vova Feldman (@svovaf)
1217
+ * @since 1.2.1
1218
+ */
1219
+ static function _load_textdomain() {
1220
+ if ( ! is_admin() ) {
1221
+ return;
1222
+ }
1223
+
1224
+ global $fs_active_plugins;
1225
+
1226
+ load_plugin_textdomain(
1227
+ 'freemius',
1228
+ false,
1229
+ $fs_active_plugins->newest->sdk_path . '/languages/'
1230
+ );
1231
+
1232
+ // @todo Load for themes.
1233
+ }
1234
+
1235
+ #endregion
1236
+
1237
+ #----------------------------------------------------------------------------------
1238
+ #region Debugging
1239
+ #----------------------------------------------------------------------------------
1240
+
1241
+ /**
1242
+ * @author Vova Feldman (@svovaf)
1243
+ * @since 1.0.8
1244
+ */
1245
+ static function add_debug_page() {
1246
+ if ( ! current_user_can( 'activate_plugins' ) ) {
1247
+ return;
1248
+ }
1249
+
1250
+ self::$_static_logger->entrance();
1251
+
1252
+ $title = sprintf( '%s [v.%s]', __fs( 'freemius-debug' ), WP_FS__SDK_VERSION );
1253
+
1254
+ if ( WP_FS__DEV_MODE ) {
1255
+ // Add top-level debug menu item.
1256
+ $hook = add_menu_page(
1257
+ $title,
1258
+ $title,
1259
+ 'manage_options',
1260
+ 'freemius',
1261
+ array( 'Freemius', '_debug_page_render' )
1262
+ );
1263
+ } else {
1264
+ // Add hidden debug page.
1265
+ $hook = add_submenu_page(
1266
+ null,
1267
+ $title,
1268
+ $title,
1269
+ 'manage_options',
1270
+ 'freemius',
1271
+ array( 'Freemius', '_debug_page_render' )
1272
+ );
1273
+ }
1274
+
1275
+ add_action( "load-$hook", array( 'Freemius', '_debug_page_actions' ) );
1276
+ }
1277
+
1278
+ /**
1279
+ * @author Vova Feldman (@svovaf)
1280
+ * @since 1.1.7.3
1281
+ */
1282
+ static function _toggle_debug_mode() {
1283
+ if ( in_array( $_POST['is_on'], array( 0, 1 ) ) ) {
1284
+ update_option( 'fs_debug_mode', $_POST['is_on'] );
1285
+ }
1286
+
1287
+ exit;
1288
+ }
1289
+
1290
+ /**
1291
+ * @author Vova Feldman (@svovaf)
1292
+ * @since 1.0.8
1293
+ */
1294
+ static function _debug_page_actions() {
1295
+ self::_clean_admin_content_section();
1296
+
1297
+ if ( fs_request_is_action( 'restart_freemius' ) ) {
1298
+ check_admin_referer( 'restart_freemius' );
1299
+
1300
+ // Clear accounts data.
1301
+ self::$_accounts->clear( true );
1302
+
1303
+ // Clear SDK reference cache.
1304
+ delete_option( 'fs_active_plugins' );
1305
+ } else if ( fs_request_is_action( 'simulate_trial' ) ) {
1306
+ check_admin_referer( 'simulate_trial' );
1307
+
1308
+ $slug = fs_request_get( 'slug' );
1309
+
1310
+ $fs = freemius( $slug );
1311
+
1312
+ // Update SDK install to at least 24 hours before.
1313
+ $fs->_storage->install_timestamp = ( time() - WP_FS__TIME_24_HOURS_IN_SEC );
1314
+ // Unset the trial shown timestamp.
1315
+ unset( $fs->_storage->trial_promotion_shown );
1316
+ }
1317
+ }
1318
+
1319
+ /**
1320
+ * @author Vova Feldman (@svovaf)
1321
+ * @since 1.0.8
1322
+ */
1323
+ static function _debug_page_render() {
1324
+ self::$_static_logger->entrance();
1325
+
1326
+ $sites = self::get_all_sites();
1327
+ $users = self::get_all_users();
1328
+ $addons = self::get_all_addons();
1329
+ $account_addons = self::get_all_account_addons();
1330
+ $licenses = self::get_all_licenses();
1331
+
1332
+ // $plans = self::get_all_plans();
1333
+ // $licenses = self::get_all_licenses();
1334
+
1335
+ $vars = array(
1336
+ 'sites' => $sites,
1337
+ 'users' => $users,
1338
+ 'addons' => $addons,
1339
+ 'account_addons' => $account_addons,
1340
+ 'licenses' => $licenses,
1341
+ );
1342
+
1343
+ fs_enqueue_local_style( 'fs_account', '/admin/debug.css' );
1344
+ fs_require_once_template( 'debug.php', $vars );
1345
+ }
1346
+
1347
+ #endregion
1348
+
1349
+ #----------------------------------------------------------------------------------
1350
+ #region Connectivity Issues
1351
+ #----------------------------------------------------------------------------------
1352
+
1353
+ /**
1354
+ * Check if Freemius should be turned on for the current plugin install.
1355
+ *
1356
+ * Note:
1357
+ * $this->_is_on is updated in has_api_connectivity()
1358
+ *
1359
+ * @author Vova Feldman (@svovaf)
1360
+ * @since 1.0.9
1361
+ *
1362
+ * @return bool
1363
+ */
1364
+ function is_on() {
1365
+ self::$_static_logger->entrance();
1366
+
1367
+ if ( isset( $this->_is_on ) ) {
1368
+ return $this->_is_on;
1369
+ }
1370
+
1371
+ // If already installed or pending then sure it's on :)
1372
+ if ( $this->is_registered() || $this->is_pending_activation() ) {
1373
+ $this->_is_on = true;
1374
+
1375
+ return true;
1376
+ }
1377
+
1378
+ return false;
1379
+ }
1380
+
1381
+ /**
1382
+ * @author Vova Feldman (@svovaf)
1383
+ * @since 1.1.7.3
1384
+ *
1385
+ * @param bool $flush_if_no_connectivity
1386
+ *
1387
+ * @return bool
1388
+ */
1389
+ private function should_run_connectivity_test( $flush_if_no_connectivity = false ) {
1390
+ if ( ! isset( $this->_storage->connectivity_test ) ) {
1391
+ // Connectivity test was never executed, or cache was cleared.
1392
+ return true;
1393
+ }
1394
+
1395
+ if ( WP_FS__PING_API_ON_IP_OR_HOST_CHANGES ) {
1396
+ if ( WP_FS__IS_HTTP_REQUEST ) {
1397
+ if ( $_SERVER['HTTP_HOST'] != $this->_storage->connectivity_test['host'] ) {
1398
+ // Domain changed.
1399
+ return true;
1400
+ }
1401
+
1402
+ if ( WP_FS__REMOTE_ADDR != $this->_storage->connectivity_test['server_ip'] ) {
1403
+ // Server IP changed.
1404
+ return true;
1405
+ }
1406
+ }
1407
+ }
1408
+
1409
+ if ( $this->_storage->connectivity_test['is_connected'] &&
1410
+ $this->_storage->connectivity_test['is_active']
1411
+ ) {
1412
+ // API connected and Freemius is active - no need to run connectivity check.
1413
+ return false;
1414
+ }
1415
+
1416
+ if ( $flush_if_no_connectivity ) {
1417
+ /**
1418
+ * If explicitly asked to flush when no connectivity - do it only
1419
+ * if at least 10 sec passed from the last API connectivity test.
1420
+ */
1421
+ return ( isset( $this->_storage->connectivity_test['timestamp'] ) &&
1422
+ ( WP_FS__SCRIPT_START_TIME - $this->_storage->connectivity_test['timestamp'] ) > 10 );
1423
+ }
1424
+
1425
+ /**
1426
+ * @since 1.1.7 Don't check for connectivity on plugin downgrade.
1427
+ */
1428
+ $version = $this->get_plugin_version();
1429
+ if ( version_compare( $version, $this->_storage->connectivity_test['version'], '>' ) ) {
1430
+ // If it's a plugin version upgrade and Freemius is off or no connectivity, run connectivity test.
1431
+ return true;
1432
+ }
1433
+
1434
+ return false;
1435
+ }
1436
+
1437
+ /**
1438
+ * @author Vova Feldman (@svovaf)
1439
+ * @since 1.1.7.4
1440
+ *
1441
+ * @return object|false
1442
+ */
1443
+ private function ping() {
1444
+ if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY ) {
1445
+ return false;
1446
+ }
1447
+
1448
+ $version = $this->get_plugin_version();
1449
+
1450
+ $is_update = $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() );
1451
+
1452
+ return $this->get_api_plugin_scope()->ping(
1453
+ $this->get_anonymous_id(),
1454
+ array(
1455
+ 'is_update' => json_encode( $is_update ),
1456
+ 'version' => $version,
1457
+ 'sdk' => $this->version,
1458
+ 'is_admin' => json_encode( is_admin() ),
1459
+ 'is_ajax' => json_encode( $this->is_ajax() ),
1460
+ 'is_cron' => json_encode( $this->is_cron() ),
1461
+ 'is_http' => json_encode( WP_FS__IS_HTTP_REQUEST ),
1462
+ )
1463
+ );
1464
+ }
1465
+
1466
+ /**
1467
+ * Check if there's any connectivity issue to Freemius API.
1468
+ *
1469
+ * @author Vova Feldman (@svovaf)
1470
+ * @since 1.0.9
1471
+ *
1472
+ * @param bool $flush_if_no_connectivity
1473
+ *
1474
+ * @return bool
1475
+ */
1476
+ function has_api_connectivity( $flush_if_no_connectivity = false ) {
1477
+ $this->_logger->entrance();
1478
+
1479
+ if ( isset( $this->_has_api_connection ) && ( $this->_has_api_connection || ! $flush_if_no_connectivity ) ) {
1480
+ return $this->_has_api_connection;
1481
+ }
1482
+
1483
+ if ( WP_FS__SIMULATE_NO_API_CONNECTIVITY &&
1484
+ isset( $this->_storage->connectivity_test ) &&
1485
+ true === $this->_storage->connectivity_test['is_connected']
1486
+ ) {
1487
+ unset( $this->_storage->connectivity_test );
1488
+ }
1489
+
1490
+ if ( ! $this->should_run_connectivity_test( $flush_if_no_connectivity ) ) {
1491
+ $this->_has_api_connection = $this->_storage->connectivity_test['is_connected'];
1492
+ /**
1493
+ * @since 1.1.6 During dev mode, if there's connectivity - turn Freemius on regardless the configuration.
1494
+ *
1495
+ * @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.
1496
+ */
1497
+ $this->_is_on = $this->_storage->connectivity_test['is_active'] ||
1498
+ $this->is_premium() ||
1499
+ ( WP_FS__DEV_MODE && $this->_has_api_connection && ! WP_FS__SIMULATE_FREEMIUS_OFF );
1500
+
1501
+ return $this->_has_api_connection;
1502
+ }
1503
+
1504
+ $pong = $this->ping();
1505
+ $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1506
+
1507
+ if ( ! $is_connected ) {
1508
+ // API failure.
1509
+ $this->_add_connectivity_issue_message( $pong );
1510
+ }
1511
+
1512
+ $this->store_connectivity_info( $pong, $is_connected );
1513
+
1514
+ return $this->_has_api_connection;
1515
+ }
1516
+
1517
+ /**
1518
+ * @author Vova Feldman (@svovaf)
1519
+ * @since 1.1.7.4
1520
+ *
1521
+ * @param object $pong
1522
+ * @param bool $is_connected
1523
+ */
1524
+ private function store_connectivity_info( $pong, $is_connected ) {
1525
+ $this->_logger->entrance();
1526
+
1527
+ $version = $this->get_plugin_version();
1528
+
1529
+ if ( ! $is_connected || WP_FS__SIMULATE_FREEMIUS_OFF ) {
1530
+ $is_active = false;
1531
+ } else {
1532
+ $is_active = ( isset( $pong->is_active ) && true == $pong->is_active );
1533
+ }
1534
+
1535
+ $is_active = $this->apply_filters(
1536
+ 'is_on',
1537
+ $is_active,
1538
+ $this->is_plugin_update(),
1539
+ $version
1540
+ );
1541
+
1542
+ $this->_storage->connectivity_test = array(
1543
+ 'is_connected' => $is_connected,
1544
+ 'host' => $_SERVER['HTTP_HOST'],
1545
+ 'server_ip' => WP_FS__REMOTE_ADDR,
1546
+ 'is_active' => $is_active,
1547
+ 'timestamp' => WP_FS__SCRIPT_START_TIME,
1548
+ // Last version with connectivity attempt.
1549
+ 'version' => $version,
1550
+ );
1551
+
1552
+ $this->_has_api_connection = $is_connected;
1553
+ $this->_is_on = $is_active || ( WP_FS__DEV_MODE && $is_connected && ! WP_FS__SIMULATE_FREEMIUS_OFF );
1554
+ }
1555
+
1556
+ /**
1557
+ * Force turning Freemius on.
1558
+ *
1559
+ * @author Vova Feldman (@svovaf)
1560
+ * @since 1.1.8.1
1561
+ *
1562
+ * @return bool TRUE if successfully turned on.
1563
+ */
1564
+ private function turn_on() {
1565
+ $this->_logger->entrance();
1566
+
1567
+ if ( $this->is_on() || ! isset( $this->_storage->connectivity_test['is_active'] ) ) {
1568
+ return false;
1569
+ }
1570
+
1571
+ $updated_connectivity = $this->_storage->connectivity_test;
1572
+ $updated_connectivity['is_active'] = true;
1573
+ $updated_connectivity['timestamp'] = WP_FS__SCRIPT_START_TIME;
1574
+ $this->_storage->connectivity_test = $updated_connectivity;
1575
+
1576
+ $this->_is_on = true;
1577
+
1578
+ return true;
1579
+ }
1580
+
1581
+ /**
1582
+ * Anonymous and unique site identifier (Hash).
1583
+ *
1584
+ * @author Vova Feldman (@svovaf)
1585
+ * @since 1.1.0
1586
+ *
1587
+ * @return string
1588
+ */
1589
+ function get_anonymous_id() {
1590
+ $unique_id = self::$_accounts->get_option( 'unique_id' );
1591
+
1592
+ if ( empty( $unique_id ) || ! is_string( $unique_id ) ) {
1593
+ $key = get_site_url();
1594
+
1595
+ // If localhost, assign microtime instead of domain.
1596
+ if ( WP_FS__IS_LOCALHOST ||
1597
+ false !== strpos( $key, 'localhost' ) ||
1598
+ false === strpos( $key, '.' )
1599
+ ) {
1600
+ $key = microtime();
1601
+ }
1602
+
1603
+ $unique_id = md5( $key );
1604
+
1605
+ self::$_accounts->set_option( 'unique_id', $unique_id, true );
1606
+ }
1607
+
1608
+ $this->_logger->departure( $unique_id );
1609
+
1610
+ return $unique_id;
1611
+ }
1612
+
1613
+ /**
1614
+ * @author Vova Feldman (@svovaf)
1615
+ * @since 1.1.7.4
1616
+ *
1617
+ * @return \WP_User
1618
+ */
1619
+ static function _get_current_wp_user() {
1620
+ self::require_pluggable_essentials();
1621
+
1622
+ return wp_get_current_user();
1623
+ }
1624
+
1625
+ /**
1626
+ * Generate API connectivity issue message.
1627
+ *
1628
+ * @author Vova Feldman (@svovaf)
1629
+ * @since 1.0.9
1630
+ *
1631
+ * @param mixed $api_result
1632
+ * @param bool $is_first_failure
1633
+ */
1634
+ function _add_connectivity_issue_message( $api_result, $is_first_failure = true ) {
1635
+ if ( ! $this->is_premium() && $this->_enable_anonymous ) {
1636
+ // Don't add message if it's the free version and can run anonymously.
1637
+ return;
1638
+ }
1639
+
1640
+ if ( ! function_exists( 'wp_nonce_url' ) ) {
1641
+ require_once( ABSPATH . 'wp-includes/functions.php' );
1642
+ }
1643
+
1644
+ $current_user = self::_get_current_wp_user();
1645
+ // $admin_email = get_option( 'admin_email' );
1646
+ $admin_email = $current_user->user_email;
1647
+
1648
+ $message = false;
1649
+ if ( is_object( $api_result ) &&
1650
+ isset( $api_result->error ) &&
1651
+ isset( $api_result->error->code )
1652
+ ) {
1653
+ switch ( $api_result->error->code ) {
1654
+ case 'curl_missing':
1655
+ $message = sprintf(
1656
+ __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1657
+ __fs( 'curl-missing-message', $this->_slug ) . ' ' .
1658
+ ' %s',
1659
+ '<b>' . $this->get_plugin_name() . '</b>',
1660
+ sprintf(
1661
+ '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1662
+ sprintf(
1663
+ '<a class="fs-resolve" data-type="curl" href="#"><b>%s</b></a>%s',
1664
+ __fs( 'curl-missing-no-clue-title', $this->_slug ),
1665
+ ' - ' . sprintf(
1666
+ __fs( 'curl-missing-no-clue-desc', $this->_slug ),
1667
+ '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1668
+ )
1669
+ ),
1670
+ sprintf(
1671
+ '<b>%s</b> - %s',
1672
+ __fs( 'sysadmin-title', $this->_slug ),
1673
+ __fs( 'curl-missing-sysadmin-desc', $this->_slug )
1674
+ ),
1675
+ sprintf(
1676
+ '<a href="%s"><b>%s</b></a>%s',
1677
+ wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1678
+ __fs( 'deactivate-plugin-title', $this->_slug ),
1679
+ ' - ' . __fs( 'deactivate-plugin-desc', 'freemius', $this->_slug )
1680
+ )
1681
+ )
1682
+ );
1683
+ break;
1684
+ case 'cloudflare_ddos_protection':
1685
+ $message = sprintf(
1686
+ __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1687
+ __fs( 'cloudflare-blocks-connection-message', $this->_slug ) . ' ' .
1688
+ __fs( 'happy-to-resolve-issue-asap', $this->_slug ) .
1689
+ ' %s',
1690
+ '<b>' . $this->get_plugin_name() . '</b>',
1691
+ sprintf(
1692
+ '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1693
+ sprintf(
1694
+ '<a class="fs-resolve" data-type="cloudflare" href="#"><b>%s</b></a>%s',
1695
+ __fs( 'fix-issue-title', $this->_slug ),
1696
+ ' - ' . sprintf(
1697
+ __fs( 'fix-issue-desc', $this->_slug ),
1698
+ '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1699
+ )
1700
+ ),
1701
+ sprintf(
1702
+ '<a href="%s" target="_blank"><b>%s</b></a>%s',
1703
+ sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
1704
+ __fs( 'install-previous-title', $this->_slug ),
1705
+ ' - ' . __fs( 'install-previous-desc', $this->_slug )
1706
+ ),
1707
+ sprintf(
1708
+ '<a href="%s"><b>%s</b></a>%s',
1709
+ wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1710
+ __fs( 'deactivate-plugin-title', $this->_slug ),
1711
+ ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1712
+ )
1713
+ )
1714
+ );
1715
+ break;
1716
+ case 'squid_cache_block':
1717
+ $message = sprintf(
1718
+ __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1719
+ __fs( 'squid-blocks-connection-message', $this->_slug ) .
1720
+ ' %s',
1721
+ '<b>' . $this->get_plugin_name() . '</b>',
1722
+ sprintf(
1723
+ '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1724
+ sprintf(
1725
+ '<a class="fs-resolve" data-type="squid" href="#"><b>%s</b></a>%s',
1726
+ __fs( 'squid-no-clue-title', $this->_slug ),
1727
+ ' - ' . sprintf(
1728
+ __fs( 'squid-no-clue-desc', $this->_slug ),
1729
+ '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1730
+ )
1731
+ ),
1732
+ sprintf(
1733
+ '<b>%s</b> - %s',
1734
+ __fs( 'sysadmin-title', $this->_slug ),
1735
+ sprintf(
1736
+ __fs( 'squid-sysadmin-desc', $this->_slug ),
1737
+ // We use a filter since the plugin might require additional API connectivity.
1738
+ '<b>' . implode( ', ', $this->apply_filters( 'api_domains', array( 'api.freemius.com' ) ) ) . '</b>' )
1739
+ ),
1740
+ sprintf(
1741
+ '<a href="%s"><b>%s</b></a>%s',
1742
+ wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1743
+ __fs( 'deactivate-plugin-title', $this->_slug ),
1744
+ ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1745
+ )
1746
+ )
1747
+ );
1748
+ break;
1749
+ // default:
1750
+ // $message = __fs( 'connectivity-test-fails-message', $this->_slug );
1751
+ // break;
1752
+ }
1753
+ }
1754
+
1755
+ $message_id = 'failed_connect_api';
1756
+ $type = 'error';
1757
+
1758
+ if ( false === $message ) {
1759
+ if ( $is_first_failure ) {
1760
+ // First attempt failed.
1761
+ $message = sprintf(
1762
+ __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1763
+ __fs( 'connectivity-test-fails-message', $this->_slug ) . ' ' .
1764
+ __fs( 'connectivity-test-maybe-temporary', $this->_slug ) . '<br><br>' .
1765
+ '%s',
1766
+ '<b>' . $this->get_plugin_name() . '</b>',
1767
+ sprintf(
1768
+ '<div id="fs_firewall_issue_options">%s %s</div>',
1769
+ sprintf(
1770
+ '<a class="button button-primary fs-resolve" data-type="retry_ping" href="#">%s</a>',
1771
+ __fs( 'yes-do-your-thing', $this->_slug )
1772
+ ),
1773
+ sprintf(
1774
+ '<a href="%s" class="button">%s</a>',
1775
+ wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1776
+ __fs( 'no-deactivate', $this->_slug )
1777
+ )
1778
+ )
1779
+ );
1780
+
1781
+ $message_id = 'failed_connect_api_first';
1782
+ $type = 'promotion';
1783
+ } else {
1784
+ // Second connectivity attempt failed.
1785
+ $message = sprintf(
1786
+ __fs( 'x-requires-access-to-api', $this->_slug ) . ' ' .
1787
+ __fs( 'connectivity-test-fails-message', $this->_slug ) . ' ' .
1788
+ __fs( 'happy-to-resolve-issue-asap', $this->_slug ) .
1789
+ ' %s',
1790
+ '<b>' . $this->get_plugin_name() . '</b>',
1791
+ sprintf(
1792
+ '<ol id="fs_firewall_issue_options"><li>%s</li><li>%s</li><li>%s</li></ol>',
1793
+ sprintf(
1794
+ '<a class="fs-resolve" data-type="general" href="#"><b>%s</b></a>%s',
1795
+ __fs( 'fix-issue-title', $this->_slug ),
1796
+ ' - ' . sprintf(
1797
+ __fs( 'fix-issue-desc', $this->_slug ),
1798
+ '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1799
+ )
1800
+ ),
1801
+ sprintf(
1802
+ '<a href="%s" target="_blank"><b>%s</b></a>%s',
1803
+ sprintf( 'https://wordpress.org/plugins/%s/download/', $this->_slug ),
1804
+ __fs( 'install-previous-title', $this->_slug ),
1805
+ ' - ' . __fs( 'install-previous-desc', $this->_slug )
1806
+ ),
1807
+ sprintf(
1808
+ '<a href="%s"><b>%s</b></a>%s',
1809
+ wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $this->_plugin_basename . '&amp;plugin_status=' . 'all' . '&amp;paged=' . '1' . '&amp;s=' . '', 'deactivate-plugin_' . $this->_plugin_basename ),
1810
+ __fs( 'deactivate-plugin-title', $this->_slug ),
1811
+ ' - ' . __fs( 'deactivate-plugin-desc', $this->_slug )
1812
+ )
1813
+ )
1814
+ );
1815
+ }
1816
+ }
1817
+
1818
+ $this->_admin_notices->add_sticky(
1819
+ $message,
1820
+ $message_id,
1821
+ __fs( 'oops', $this->_slug ) . '...',
1822
+ $type
1823
+ );
1824
+ }
1825
+
1826
+ /**
1827
+ * Handle user request to resolve connectivity issue.
1828
+ * This method will send an email to Freemius API technical staff for resolution.
1829
+ * The email will contain server's info and installed plugins (might be caching issue).
1830
+ *
1831
+ * @author Vova Feldman (@svovaf)
1832
+ * @since 1.0.9
1833
+ */
1834
+ function _email_about_firewall_issue() {
1835
+ $this->_admin_notices->remove_sticky( 'failed_connect_api' );
1836
+
1837
+ $pong = $this->ping();
1838
+
1839
+ $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1840
+
1841
+ if ( $is_connected ) {
1842
+ $this->store_connectivity_info( $pong, $is_connected );
1843
+
1844
+ echo $this->get_after_plugin_activation_redirect_url();
1845
+ exit;
1846
+ }
1847
+
1848
+ $current_user = self::_get_current_wp_user();
1849
+ $admin_email = $current_user->user_email;
1850
+
1851
+ $error_type = fs_request_get( 'error_type', 'general' );
1852
+
1853
+ switch ( $error_type ) {
1854
+ case 'squid':
1855
+ $title = 'Squid ACL Blocking Issue';
1856
+ break;
1857
+ case 'cloudflare':
1858
+ $title = 'CloudFlare Blocking Issue';
1859
+ break;
1860
+ default:
1861
+ $title = 'API Connectivity Issue';
1862
+ break;
1863
+ }
1864
+
1865
+ $custom_email_sections = array();
1866
+
1867
+ if ( 'squid' === $error_type ) {
1868
+ // Override the 'Site' email section.
1869
+ $custom_email_sections['site'] = array(
1870
+ 'rows' => array(
1871
+ 'hosting_company' => array( 'Hosting Company', fs_request_get( 'hosting_company' ) )
1872
+ )
1873
+ );
1874
+ }
1875
+
1876
+ // Add 'API Error' custom email section.
1877
+ $custom_email_sections['api_error'] = array(
1878
+ 'title' => 'API Error',
1879
+ 'rows' => array(
1880
+ 'ping' => array( is_string( $pong ) ? htmlentities( $pong ) : json_encode( $pong ) )
1881
+ )
1882
+ );
1883
+
1884
+ // Add PHP info for deeper investigation.
1885
+ ob_start();
1886
+ phpinfo();
1887
+ $php_info = ob_get_clean();
1888
+ $custom_email_sections['php_info'] = array(
1889
+ 'title' => 'PHP Info',
1890
+ 'rows' => array(
1891
+ 'info' => array( $php_info )
1892
+ )
1893
+ );
1894
+
1895
+ // Send email with technical details to resolve CloudFlare's firewall unnecessary protection.
1896
+ $this->send_email(
1897
+ 'api@freemius.com', // recipient
1898
+ $title . ' [' . $this->get_plugin_name() . ']', // subject
1899
+ $custom_email_sections,
1900
+ array( "Reply-To: $admin_email <$admin_email>" ) // headers
1901
+ );
1902
+
1903
+ $this->_admin_notices->add_sticky(
1904
+ sprintf(
1905
+ __fs( 'fix-request-sent-message', $this->_slug ),
1906
+ '<a href="mailto:' . $admin_email . '">' . $admin_email . '</a>'
1907
+ ),
1908
+ 'server_details_sent'
1909
+ );
1910
+
1911
+ // Action was taken, tell that API connectivity troubleshooting should be off now.
1912
+
1913
+ echo "1";
1914
+ exit;
1915
+ }
1916
+
1917
+ /**
1918
+ * Handle connectivity test retry approved by the user.
1919
+ *
1920
+ * @author Vova Feldman (@svovaf)
1921
+ * @since 1.1.7.4
1922
+ */
1923
+ function _retry_connectivity_test() {
1924
+ $this->_admin_notices->remove_sticky( 'failed_connect_api_first' );
1925
+
1926
+ $pong = $this->ping();
1927
+
1928
+ $is_connected = $this->get_api_plugin_scope()->is_valid_ping( $pong );
1929
+
1930
+ if ( $is_connected ) {
1931
+ $this->store_connectivity_info( $pong, $is_connected );
1932
+
1933
+ echo $this->get_after_plugin_activation_redirect_url();
1934
+ } else {
1935
+ // Add connectivity issue message after 2nd failed attempt.
1936
+ $this->_add_connectivity_issue_message( $pong, false );
1937
+
1938
+ echo "1";
1939
+ }
1940
+
1941
+ exit;
1942
+ }
1943
+
1944
+ static function _add_firewall_issues_javascript() {
1945
+ $params = array();
1946
+ fs_require_once_template( 'firewall-issues-js.php', $params );
1947
+ }
1948
+
1949
+ #endregion
1950
+
1951
+ #----------------------------------------------------------------------------------
1952
+ #region Email
1953
+ #----------------------------------------------------------------------------------
1954
+
1955
+ /**
1956
+ * Generates and sends an HTML email with customizable sections.
1957
+ *
1958
+ * @author Leo Fajardo (@leorw)
1959
+ * @since 1.1.2
1960
+ *
1961
+ * @param string $to_address
1962
+ * @param string $subject
1963
+ * @param array $sections
1964
+ * @param array $headers
1965
+ *
1966
+ * @return bool Whether the email contents were sent successfully.
1967
+ */
1968
+ private function send_email(
1969
+ $to_address,
1970
+ $subject,
1971
+ $sections = array(),
1972
+ $headers = array()
1973
+ ) {
1974
+ $default_sections = $this->get_email_sections();
1975
+
1976
+ // Insert new sections or replace the default email sections.
1977
+ if ( is_array( $sections ) && ! empty( $sections ) ) {
1978
+ foreach ( $sections as $section_id => $custom_section ) {
1979
+ if ( ! isset( $default_sections[ $section_id ] ) ) {
1980
+ // If the section does not exist, add it.
1981
+ $default_sections[ $section_id ] = $custom_section;
1982
+ } else {
1983
+ // If the section already exists, override it.
1984
+ $current_section = $default_sections[ $section_id ];
1985
+
1986
+ // Replace the current section's title if a custom section title exists.
1987
+ if ( isset( $custom_section['title'] ) ) {
1988
+ $current_section['title'] = $custom_section['title'];
1989
+ }
1990
+
1991
+ // Insert new rows under the current section or replace the default rows.
1992
+ if ( isset( $custom_section['rows'] ) && is_array( $custom_section['rows'] ) && ! empty( $custom_section['rows'] ) ) {
1993
+ foreach ( $custom_section['rows'] as $row_id => $row ) {
1994
+ $current_section['rows'][ $row_id ] = $row;
1995
+ }
1996
+ }
1997
+
1998
+ $default_sections[ $section_id ] = $current_section;
1999
+ }
2000
+ }
2001
+ }
2002
+
2003
+ $vars = array( 'sections' => $default_sections );
2004
+ $message = fs_get_template( 'email.php', $vars );
2005
+
2006
+ // Set the type of email to HTML.
2007
+ $headers[] = 'Content-type: text/html';
2008
+
2009
+ $header_string = implode( "\r\n", $headers );
2010
+
2011
+ return wp_mail(
2012
+ $to_address,
2013
+ $subject,
2014
+ $message,
2015
+ $header_string
2016
+ );
2017
+ }
2018
+
2019
+ /**
2020
+ * Generates the data for the sections of the email content.
2021
+ *
2022
+ * @author Leo Fajardo (@leorw)
2023
+ * @since 1.1.2
2024
+ *
2025
+ * @return array
2026
+ */
2027
+ private function get_email_sections() {
2028
+ // Retrieve the current user's information so that we can get the user's email, first name, and last name below.
2029
+ $current_user = self::_get_current_wp_user();
2030
+
2031
+ // Retrieve the cURL version information so that we can get the version number below.
2032
+ $curl_version_information = curl_version();
2033
+
2034
+ $active_plugin = self::get_active_plugins();
2035
+
2036
+ // Generate the list of active plugins separated by new line.
2037
+ $active_plugin_string = '';
2038
+ foreach ( $active_plugin as $plugin ) {
2039
+ $active_plugin_string .= sprintf(
2040
+ '<a href="%s">%s</a> [v%s]<br>',
2041
+ $plugin['PluginURI'],
2042
+ $plugin['Name'],
2043
+ $plugin['Version']
2044
+ );
2045
+ }
2046
+
2047
+ $server_ip = WP_FS__REMOTE_ADDR;
2048
+
2049
+ // Generate the default email sections.
2050
+ $sections = array(
2051
+ 'sdk' => array(
2052
+ 'title' => 'SDK',
2053
+ 'rows' => array(
2054
+ 'fs_version' => array( 'FS Version', $this->version ),
2055
+ 'curl_version' => array( 'cURL Version', $curl_version_information['version'] )
2056
+ )
2057
+ ),
2058
+ 'plugin' => array(
2059
+ 'title' => 'Plugin',
2060
+ 'rows' => array(
2061
+ 'name' => array( 'Name', $this->get_plugin_name() ),
2062
+ 'version' => array( 'Version', $this->get_plugin_version() )
2063
+ )
2064
+ ),
2065
+ 'site' => array(
2066
+ 'title' => 'Site',
2067
+ 'rows' => array(
2068
+ 'unique_id' => array( 'Address', $this->get_anonymous_id() ),
2069
+ 'address' => array( 'Address', site_url() ),
2070
+ 'host' => array(
2071
+ 'HTTP_HOST',
2072
+ ( ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '' )
2073
+ ),
2074
+ 'server_addr' => array(
2075
+ 'SERVER_ADDR',
2076
+ '<a href="http://www.projecthoneypot.org/ip_' . $server_ip . '">' . $server_ip . '</a>'
2077
+ )
2078
+ )
2079
+ ),
2080
+ 'user' => array(
2081
+ 'title' => 'User',
2082
+ 'rows' => array(
2083
+ 'email' => array( 'Email', $current_user->user_email ),
2084
+ 'first' => array( 'First', $current_user->user_firstname ),
2085
+ 'last' => array( 'Last', $current_user->user_lastname )
2086
+ )
2087
+ ),
2088
+ 'plugins' => array(
2089
+ 'title' => 'Plugins',
2090
+ 'rows' => array(
2091
+ 'active_plugins' => array( 'Active Plugins', $active_plugin_string )
2092
+ )
2093
+ ),
2094
+ );
2095
+
2096
+ // Allow the sections to be modified by other code.
2097
+ $sections = $this->apply_filters( 'email_template_sections', $sections );
2098
+
2099
+ return $sections;
2100
+ }
2101
+
2102
+ #endregion
2103
+
2104
+ #----------------------------------------------------------------------------------
2105
+ #region Initialization
2106
+ #----------------------------------------------------------------------------------
2107
+
2108
+ /**
2109
+ * Init plugin's Freemius instance.
2110
+ *
2111
+ * @author Vova Feldman (@svovaf)
2112
+ * @since 1.0.1
2113
+ *
2114
+ * @param number $id
2115
+ * @param string $public_key
2116
+ * @param bool $is_live
2117
+ * @param bool $is_premium
2118
+ */
2119
+ function init( $id, $public_key, $is_live = true, $is_premium = true ) {
2120
+ $this->_logger->entrance();
2121
+
2122
+ $this->dynamic_init( array(
2123
+ 'id' => $id,
2124
+ 'public_key' => $public_key,
2125
+ 'is_live' => $is_live,
2126
+ 'is_premium' => $is_premium,
2127
+ ) );
2128
+ }
2129
+
2130
+ /**
2131
+ * Dynamic initiator, originally created to support initiation
2132
+ * with parent_id for add-ons.
2133
+ *
2134
+ * @author Vova Feldman (@svovaf)
2135
+ * @since 1.0.6
2136
+ *
2137
+ * @param array $plugin_info
2138
+ *
2139
+ * @throws Freemius_Exception
2140
+ */
2141
+ function dynamic_init( array $plugin_info ) {
2142
+ $this->_logger->entrance();
2143
+
2144
+ $this->parse_settings( $plugin_info );
2145
+
2146
+ if ( $this->should_stop_execution() ) {
2147
+ return;
2148
+ }
2149
+
2150
+ if ( ! $this->is_registered() ) {
2151
+ if ( $this->is_anonymous() ) {
2152
+ // If user skipped, no need to test connectivity.
2153
+ $this->_has_api_connection = true;
2154
+ $this->_is_on = true;
2155
+ } else {
2156
+ if ( ! $this->has_api_connectivity() ) {
2157
+ if ( $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) ||
2158
+ $this->_admin_notices->has_sticky( 'failed_connect_api' )
2159
+ ) {
2160
+ if ( ! $this->_enable_anonymous || $this->is_premium() ) {
2161
+ // If anonymous mode is disabled, add firewall admin-notice message.
2162
+ add_action( 'admin_footer', array( 'Freemius', '_add_firewall_issues_javascript' ) );
2163
+
2164
+ $this->add_ajax_action( 'resolve_firewall_issues', array(
2165
+ &$this,
2166
+ '_email_about_firewall_issue'
2167
+ ) );
2168
+
2169
+ $this->add_ajax_action( 'retry_connectivity_test', array(
2170
+ &$this,
2171
+ '_retry_connectivity_test'
2172
+ ) );
2173
+ }
2174
+ }
2175
+
2176
+ return;
2177
+ } else {
2178
+ $this->_admin_notices->remove_sticky( array(
2179
+ 'failed_connect_api_first',
2180
+ 'failed_connect_api',
2181
+ ) );
2182
+
2183
+ if ( $this->_anonymous_mode ) {
2184
+ // Simulate anonymous mode.
2185
+ $this->_is_anonymous = true;
2186
+ }
2187
+ }
2188
+ }
2189
+
2190
+ // Check if Freemius is on for the current plugin.
2191
+ // This MUST be executed after all the plugin variables has been loaded.
2192
+ if ( ! $this->is_on() ) {
2193
+ return;
2194
+ }
2195
+ }
2196
+
2197
+ if ( $this->has_api_connectivity() ) {
2198
+ if ( $this->is_cron() ) {
2199
+ $this->hook_callback_to_sync_cron();
2200
+ } else if ( $this->is_user_in_admin() ) {
2201
+ /**
2202
+ * Schedule daily data sync cron if:
2203
+ *
2204
+ * 1. User opted-in (for tracking).
2205
+ * 2. If skipped, but later upgraded (opted-in via upgrade).
2206
+ *
2207
+ * @author Vova Feldman (@svovaf)
2208
+ * @since 1.1.7.3
2209
+ *
2210
+ */
2211
+ if ( $this->is_registered() ) {
2212
+ if ( ! $this->is_sync_cron_on() && $this->is_tracking_allowed() ) {
2213
+ $this->schedule_sync_cron();
2214
+ }
2215
+ }
2216
+
2217
+ /**
2218
+ * Check if requested for manual blocking background sync.
2219
+ */
2220
+ if ( fs_request_has( 'background_sync' ) ) {
2221
+ $this->run_manual_sync();
2222
+ }
2223
+ }
2224
+ }
2225
+
2226
+ if ( $this->is_registered() ) {
2227
+ $this->hook_callback_to_install_sync();
2228
+ }
2229
+
2230
+ if ( $this->is_addon() ) {
2231
+ if ( $this->is_parent_plugin_installed() ) {
2232
+ // Link to parent FS.
2233
+ $this->_parent = self::get_instance_by_id( $this->_plugin->parent_plugin_id );
2234
+
2235
+ // Get parent plugin reference.
2236
+ $this->_parent_plugin = $this->_parent->get_plugin();
2237
+ }
2238
+ }
2239
+
2240
+ if ( $this->is_user_in_admin() ) {
2241
+ if ( $this->is_plugins_page() ) {
2242
+ $this->hook_plugin_action_links();
2243
+ }
2244
+
2245
+ if ( $this->is_addon() ) {
2246
+ if ( ! $this->is_parent_plugin_installed() ) {
2247
+ $parent_name = $this->get_option( $plugin_info, 'parent_name', null );
2248
+
2249
+ if ( isset( $plugin_info['parent'] ) ) {
2250
+ $parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
2251
+ }
2252
+
2253
+ $this->_admin_notices->add(
2254
+ ( ! empty( $parent_name ) ?
2255
+ sprintf( __fs( 'addon-x-cannot-run-without-y', $this->_slug ), $this->get_plugin_name(), $parent_name ) :
2256
+ sprintf( __fs( 'addon-x-cannot-run-without-parent', $this->_slug ), $this->get_plugin_name() )
2257
+ ),
2258
+ __fs( 'oops', $this->_slug ) . '...',
2259
+ 'error'
2260
+ );
2261
+
2262
+ return;
2263
+ } else {
2264
+ if ( $this->_parent->is_registered() && ! $this->is_registered() ) {
2265
+ // If parent plugin activated, automatically install add-on for the user.
2266
+ $this->_activate_addon_account( $this->_parent );
2267
+ }
2268
+
2269
+ // @todo This should be only executed on activation. It should be migrated to register_activation_hook() together with other activation related logic.
2270
+ if ( $this->is_premium() ) {
2271
+ // Remove add-on download admin-notice.
2272
+ $this->_parent->_admin_notices->remove_sticky( array(
2273
+ 'addon_plan_upgraded_' . $this->_slug,
2274
+ 'no_addon_license_' . $this->_slug,
2275
+ ) );
2276
+ }
2277
+
2278
+ $this->deactivate_premium_only_addon_without_license();
2279
+ }
2280
+ } else {
2281
+ add_action( 'admin_init', array( &$this, '_admin_init_action' ) );
2282
+
2283
+ if ( $this->has_addons() &&
2284
+ 'plugin-information' === fs_request_get( 'tab', false ) &&
2285
+ $this->get_id() == fs_request_get( 'parent_plugin_id', false )
2286
+ ) {
2287
+ require_once WP_FS__DIR_INCLUDES . '/fs-plugin-info-dialog.php';
2288
+
2289
+ new FS_Plugin_Info_Dialog( $this );
2290
+ }
2291
+ }
2292
+
2293
+ if ( $this->is_premium() ) {
2294
+ new FS_Plugin_Updater( $this );
2295
+ }
2296
+
2297
+ // if ( $this->is_registered() ||
2298
+ // $this->is_anonymous() ||
2299
+ // $this->is_pending_activation()
2300
+ // ) {
2301
+ // $this->_init_admin();
2302
+ // }
2303
+ }
2304
+
2305
+ $this->do_action( 'initiated' );
2306
+
2307
+ if ( $this->_storage->prev_is_premium !== $this->_plugin->is_premium ) {
2308
+ if ( isset( $this->_storage->prev_is_premium ) ) {
2309
+ $this->apply_filters(
2310
+ 'after_code_type_change',
2311
+ // New code type.
2312
+ $this->_plugin->is_premium
2313
+ );
2314
+ } else {
2315
+ // Set for code type for the first time.
2316
+ $this->_storage->prev_is_premium = $this->_plugin->is_premium;
2317
+ }
2318
+ }
2319
+
2320
+ if ( ! $this->is_addon() ) {
2321
+ if ( $this->is_registered() ) {
2322
+ // Fix for upgrade from versions < 1.0.9.
2323
+ if ( ! isset( $this->_storage->activation_timestamp ) ) {
2324
+ $this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
2325
+ }
2326
+
2327
+ $this->do_action( 'after_init_plugin_registered' );
2328
+ } else if ( $this->is_anonymous() ) {
2329
+ $this->do_action( 'after_init_plugin_anonymous' );
2330
+ } else if ( $this->is_pending_activation() ) {
2331
+ $this->do_action( 'after_init_plugin_pending_activations' );
2332
+ }
2333
+ } else {
2334
+ if ( $this->is_registered() ) {
2335
+ $this->do_action( 'after_init_addon_registered' );
2336
+ } else if ( $this->is_anonymous() ) {
2337
+ $this->do_action( 'after_init_addon_anonymous' );
2338
+ } else if ( $this->is_pending_activation() ) {
2339
+ $this->do_action( 'after_init_addon_pending_activations' );
2340
+ }
2341
+ }
2342
+ }
2343
+
2344
+ /**
2345
+ * @author Leo Fajardo (@leorw)
2346
+ *
2347
+ * @since 1.2.1.5
2348
+ */
2349
+ function _stop_tracking_callback() {
2350
+ $result = $this->stop_tracking();
2351
+
2352
+ if ( true === $result ) {
2353
+ $this->shoot_ajax_success();
2354
+ }
2355
+
2356
+ $this->_logger->api_error( $result );
2357
+
2358
+ $this->shoot_ajax_failure(
2359
+ __fs( 'unexpected-api-error', $this->_slug ) .
2360
+ ( $this->is_api_error( $result ) && isset( $result->error ) ?
2361
+ $result->error->message :
2362
+ var_export( $result, true ) )
2363
+ );
2364
+ }
2365
+
2366
+ /**
2367
+ * @author Leo Fajardo (@leorw)
2368
+ * @since 1.2.1.5
2369
+ */
2370
+ function _allow_tracking_callback() {
2371
+ $result = $this->allow_tracking();
2372
+
2373
+ if ( true === $result ) {
2374
+ $this->shoot_ajax_success();
2375
+ }
2376
+
2377
+ $this->_logger->api_error( $result );
2378
+
2379
+ $this->shoot_ajax_failure(
2380
+ __fs( 'unexpected-api-error', $this->_slug ) .
2381
+ ( $this->is_api_error( $result ) && isset( $result->error ) ?
2382
+ $result->error->message :
2383
+ var_export( $result, true ) )
2384
+ );
2385
+ }
2386
+
2387
+ /**
2388
+ * Opt-out from usage tracking.
2389
+ *
2390
+ * Note: This will not delete the account information but will stop all tracking.
2391
+ *
2392
+ * Returns:
2393
+ * 1. FALSE - If the user never opted-in.
2394
+ * 2. TRUE - If successfully opted-out.
2395
+ * 3. object - API result on failure.
2396
+ *
2397
+ * @author Leo Fajardo (@leorw)
2398
+ * @since 1.2.1.5
2399
+ *
2400
+ * @return bool|object
2401
+ */
2402
+ function stop_tracking() {
2403
+ $this->_logger->entrance();
2404
+
2405
+ if ( ! $this->is_registered() ) {
2406
+ // User never opted-in.
2407
+ return false;
2408
+ }
2409
+
2410
+ if ( $this->is_tracking_prohibited() ) {
2411
+ // Already disconnected.
2412
+ return true;
2413
+ }
2414
+
2415
+ // Send update to FS.
2416
+ $result = $this->get_api_site_scope()->call( '/?fields=is_disconnected', 'put', array(
2417
+ 'is_disconnected' => true
2418
+ ) );
2419
+
2420
+ if ( ! $this->is_api_result_entity( $result ) ||
2421
+ ! isset( $result->is_disconnected ) ||
2422
+ ! $result->is_disconnected
2423
+ ) {
2424
+ $this->_logger->api_error( $result );
2425
+
2426
+ return $result;
2427
+ }
2428
+
2429
+ $this->_site->is_disconnected = $result->is_disconnected;
2430
+ $this->_store_site();
2431
+
2432
+ $this->clear_sync_cron();
2433
+
2434
+ // Successfully disconnected.
2435
+ return true;
2436
+ }
2437
+
2438
+ /**
2439
+ * Opt-in back into usage tracking.
2440
+ *
2441
+ * Note: This will only work if the user opted-in previously.
2442
+ *
2443
+ * Returns:
2444
+ * 1. FALSE - If the user never opted-in.
2445
+ * 2. TRUE - If successfully opted-in back to usage tracking.
2446
+ * 3. object - API result on failure.
2447
+ *
2448
+ * @author Leo Fajardo (@leorw)
2449
+ * @since 1.2.1.5
2450
+ *
2451
+ * @return bool|object
2452
+ */
2453
+ function allow_tracking() {
2454
+ $this->_logger->entrance();
2455
+
2456
+ if ( ! $this->is_registered() ) {
2457
+ // User never opted-in.
2458
+ return false;
2459
+ }
2460
+
2461
+ if ( $this->is_tracking_allowed() ) {
2462
+ // Tracking already allowed.
2463
+ return true;
2464
+ }
2465
+
2466
+ $result = $this->get_api_site_scope()->call( '/?is_disconnected', 'put', array(
2467
+ 'is_disconnected' => false
2468
+ ) );
2469
+
2470
+ if ( ! $this->is_api_result_entity( $result ) ||
2471
+ ! isset( $result->is_disconnected ) ||
2472
+ $result->is_disconnected
2473
+ ) {
2474
+ $this->_logger->api_error( $result );
2475
+
2476
+ return $result;
2477
+ }
2478
+
2479
+ $this->_site->is_disconnected = $result->is_disconnected;
2480
+ $this->_store_site();
2481
+
2482
+ $this->schedule_sync_cron();
2483
+
2484
+ // Successfully reconnected.
2485
+ return true;
2486
+ }
2487
+
2488
+ /**
2489
+ * If user opted-in and later disabled usage-tracking,
2490
+ * re-allow tracking for licensing and updates.
2491
+ *
2492
+ * @author Leo Fajardo (@leorw)
2493
+ *
2494
+ * @since 1.2.1.5
2495
+ */
2496
+ private function reconnect_locally() {
2497
+ $this->_logger->entrance();
2498
+
2499
+ if ( $this->is_tracking_prohibited() &&
2500
+ $this->is_registered()
2501
+ ) {
2502
+ $this->_site->is_disconnected = false;
2503
+ $this->_store_site();
2504
+ }
2505
+ }
2506
+
2507
+ /**
2508
+ * Parse plugin's settings (as defined by the plugin dev).
2509
+ *
2510
+ * @author Vova Feldman (@svovaf)
2511
+ * @since 1.1.7.3
2512
+ *
2513
+ * @param array $plugin_info
2514
+ *
2515
+ * @throws \Freemius_Exception
2516
+ */
2517
+ private function parse_settings( &$plugin_info ) {
2518
+ $this->_logger->entrance();
2519
+
2520
+ $id = $this->get_numeric_option( $plugin_info, 'id', false );
2521
+ $public_key = $this->get_option( $plugin_info, 'public_key', false );
2522
+ $secret_key = $this->get_option( $plugin_info, 'secret_key', null );
2523
+ $parent_id = $this->get_numeric_option( $plugin_info, 'parent_id', null );
2524
+ $parent_name = $this->get_option( $plugin_info, 'parent_name', null );
2525
+
2526
+ /**
2527
+ * @author Vova Feldman (@svovaf)
2528
+ * @since 1.1.9 Try to pull secret key from external config.
2529
+ */
2530
+ if ( is_null( $secret_key ) && defined( "WP_FS__{$this->_slug}_SECRET_KEY" ) ) {
2531
+ $secret_key = constant( "WP_FS__{$this->_slug}_SECRET_KEY" );
2532
+ }
2533
+
2534
+ if ( isset( $plugin_info['parent'] ) ) {
2535
+ $parent_id = $this->get_numeric_option( $plugin_info['parent'], 'id', null );
2536
+ // $parent_slug = $this->get_option( $plugin_info['parent'], 'slug', null );
2537
+ // $parent_public_key = $this->get_option( $plugin_info['parent'], 'public_key', null );
2538
+ // $parent_name = $this->get_option( $plugin_info['parent'], 'name', null );
2539
+ }
2540
+
2541
+ if ( false === $id ) {
2542
+ throw new Freemius_Exception( 'Plugin id parameter is not set.' );
2543
+ }
2544
+ if ( false === $public_key ) {
2545
+ throw new Freemius_Exception( 'Plugin public_key parameter is not set.' );
2546
+ }
2547
+
2548
+ $plugin = ( $this->_plugin instanceof FS_Plugin ) ?
2549
+ $this->_plugin :
2550
+ new FS_Plugin();
2551
+
2552
+ $plugin->update( array(
2553
+ 'id' => $id,
2554
+ 'public_key' => $public_key,
2555
+ 'slug' => $this->_slug,
2556
+ 'parent_plugin_id' => $parent_id,
2557
+ 'version' => $this->get_plugin_version(),
2558
+ 'title' => $this->get_plugin_name(),
2559
+ 'file' => $this->_plugin_basename,
2560
+ 'is_premium' => $this->get_bool_option( $plugin_info, 'is_premium', true ),
2561
+ 'is_live' => $this->get_bool_option( $plugin_info, 'is_live', true ),
2562
+ // 'secret_key' => $secret_key,
2563
+ ) );
2564
+
2565
+ if ( $plugin->is_updated() ) {
2566
+ // Update plugin details.
2567
+ $this->_plugin = FS_Plugin_Manager::instance( $this->_slug )->store( $plugin );
2568
+ }
2569
+ // Set the secret key after storing the plugin, we don't want to store the key in the storage.
2570
+ $this->_plugin->secret_key = $secret_key;
2571
+
2572
+ if ( ! isset( $plugin_info['menu'] ) ) {
2573
+ // Back compatibility to 1.1.2
2574
+ $plugin_info['menu'] = array(
2575
+ 'slug' => isset( $plugin_info['menu_slug'] ) ?
2576
+ $plugin_info['menu_slug'] :
2577
+ $this->_slug
2578
+ );
2579
+ }
2580
+
2581
+ $this->_menu = FS_Admin_Menu_Manager::instance( $this->_slug );
2582
+ $this->_menu->init( $plugin_info['menu'], $this->is_addon() );
2583
+
2584
+ $this->_has_addons = $this->get_bool_option( $plugin_info, 'has_addons', false );
2585
+ $this->_has_paid_plans = $this->get_bool_option( $plugin_info, 'has_paid_plans', true );
2586
+ $this->_is_org_compliant = $this->get_bool_option( $plugin_info, 'is_org_compliant', true );
2587
+ $this->_is_premium_only = $this->get_bool_option( $plugin_info, 'is_premium_only', false );
2588
+ if ( $this->_is_premium_only ) {
2589
+ // If premium only plugin, disable anonymous mode.
2590
+ $this->_enable_anonymous = false;
2591
+ $this->_anonymous_mode = false;
2592
+ } else {
2593
+ $this->_enable_anonymous = $this->get_bool_option( $plugin_info, 'enable_anonymous', true );
2594
+ $this->_anonymous_mode = $this->get_bool_option( $plugin_info, 'anonymous_mode', false );
2595
+ }
2596
+ $this->_permissions = $this->get_option( $plugin_info, 'permissions', array() );
2597
+
2598
+ if ( ! empty( $plugin_info['trial'] ) ) {
2599
+ $this->_trial_days = $this->get_numeric_option(
2600
+ $plugin_info['trial'],
2601
+ 'days',
2602
+ // Default to 0 - trial without days specification.
2603
+ 0
2604
+ );
2605
+
2606
+ $this->_is_trial_require_payment = $this->get_bool_option( $plugin_info['trial'], 'is_require_payment', false );
2607
+ }
2608
+ }
2609
+
2610
+ /**
2611
+ * @param string[] $options
2612
+ * @param string $key
2613
+ * @param mixed $default
2614
+ *
2615
+ * @return bool
2616
+ */
2617
+ private function get_option( &$options, $key, $default = false ) {
2618
+ return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
2619
+ }
2620
+
2621
+ private function get_bool_option( &$options, $key, $default = false ) {
2622
+ return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
2623
+ }
2624
+
2625
+ private function get_numeric_option( &$options, $key, $default = false ) {
2626
+ return isset( $options[ $key ] ) && is_numeric( $options[ $key ] ) ? $options[ $key ] : $default;
2627
+ }
2628
+
2629
+ /**
2630
+ * Gate keeper.
2631
+ *
2632
+ * @author Vova Feldman (@svovaf)
2633
+ * @since 1.1.7.3
2634
+ *
2635
+ * @return bool
2636
+ */
2637
+ private function should_stop_execution() {
2638
+ if ( empty( $this->_storage->was_plugin_loaded ) ) {
2639
+ /**
2640
+ * Don't execute Freemius until plugin was fully loaded at least once,
2641
+ * to give the opportunity for the activation hook to run before pinging
2642
+ * the API for connectivity test. This logic is relevant for the
2643
+ * identification of new plugin install vs. plugin update.
2644
+ *
2645
+ * @author Vova Feldman (@svovaf)
2646
+ * @since 1.1.9
2647
+ */
2648
+ return true;
2649
+ }
2650
+
2651
+ if ( $this->is_activation_mode() ) {
2652
+ if ( ! is_admin() ) {
2653
+ /**
2654
+ * If in activation mode, don't execute Freemius outside of the
2655
+ * admin dashboard.
2656
+ *
2657
+ * @author Vova Feldman (@svovaf)
2658
+ * @since 1.1.7.3
2659
+ */
2660
+ return true;
2661
+ }
2662
+
2663
+ if ( ! WP_FS__IS_HTTP_REQUEST ) {
2664
+ /**
2665
+ * If in activation and executed without HTTP context (e.g. CLI, Cronjob),
2666
+ * then don't start Freemius.
2667
+ *
2668
+ * @author Vova Feldman (@svovaf)
2669
+ * @since 1.1.6.3
2670
+ *
2671
+ * @link https://wordpress.org/support/topic/errors-in-the-freemius-class-when-running-in-wordpress-in-cli
2672
+ */
2673
+ return true;
2674
+ }
2675
+
2676
+ if ( $this->is_cron() ) {
2677
+ /**
2678
+ * If in activation mode, don't execute Freemius during wp crons
2679
+ * (wp crons have HTTP context - called as HTTP request).
2680
+ *
2681
+ * @author Vova Feldman (@svovaf)
2682
+ * @since 1.1.7.3
2683
+ */
2684
+ return true;
2685
+ }
2686
+
2687
+ if ( $this->is_ajax() &&
2688
+ ! $this->_admin_notices->has_sticky( 'failed_connect_api_first' ) &&
2689
+ ! $this->_admin_notices->has_sticky( 'failed_connect_api' )
2690
+ ) {
2691
+ /**
2692
+ * During activation, if running in AJAX mode, unless there's a sticky
2693
+ * connectivity issue notice, don't run Freemius.
2694
+ *
2695
+ * @author Vova Feldman (@svovaf)
2696
+ * @since 1.1.7.3
2697
+ */
2698
+ return true;
2699
+ }
2700
+ }
2701
+
2702
+ return false;
2703
+ }
2704
+
2705
+ /**
2706
+ * Triggered after code type has changed.
2707
+ *
2708
+ * @author Vova Feldman (@svovaf)
2709
+ * @since 1.1.9.1
2710
+ */
2711
+ function _after_code_type_change() {
2712
+ $this->_logger->entrance();
2713
+
2714
+ add_action( is_admin() ? 'admin_init' : 'init', array(
2715
+ &$this,
2716
+ '_plugin_code_type_changed'
2717
+ ) );
2718
+ }
2719
+
2720
+ /**
2721
+ * Handles plugin's code type change (free <--> premium).
2722
+ *
2723
+ * @author Vova Feldman (@svovaf)
2724
+ * @since 1.0.9
2725
+ */
2726
+ function _plugin_code_type_changed() {
2727
+ $this->_logger->entrance();
2728
+
2729
+ if ( $this->is_premium() ) {
2730
+ $this->reconnect_locally();
2731
+
2732
+ // Activated premium code.
2733
+ $this->do_action( 'after_premium_version_activation' );
2734
+
2735
+ // Remove all sticky messages related to download of the premium version.
2736
+ $this->_admin_notices->remove_sticky( array(
2737
+ 'trial_started',
2738
+ 'plan_upgraded',
2739
+ 'plan_changed',
2740
+ 'license_activated',
2741
+ ) );
2742
+
2743
+ $this->_admin_notices->add_sticky(
2744
+ __fs( 'premium-activated-message', $this->_slug ),
2745
+ 'premium_activated',
2746
+ __fs( 'woot', $this->_slug ) . '!'
2747
+ );
2748
+ } else {
2749
+ // Remove sticky message related to premium code activation.
2750
+ $this->_admin_notices->remove_sticky( 'premium_activated' );
2751
+
2752
+ // Activated free code (after had the premium before).
2753
+ $this->do_action( 'after_free_version_reactivation' );
2754
+
2755
+ if ( $this->is_paying() && ! $this->is_premium() ) {
2756
+ $this->_admin_notices->add_sticky(
2757
+ sprintf(
2758
+ __fs( 'you-have-x-license', $this->_slug ),
2759
+ $this->_site->plan->title
2760
+ ) . $this->get_complete_upgrade_instructions(),
2761
+ 'plan_upgraded',
2762
+ __fs( 'yee-haw', $this->_slug ) . '!'
2763
+ );
2764
+ }
2765
+ }
2766
+
2767
+ // Schedule code type changes event.
2768
+ $this->schedule_install_sync();
2769
+
2770
+ /**
2771
+ * Unregister the uninstall hook for the other version of the plugin (with different code type) to avoid
2772
+ * triggering a fatal error when uninstalling that plugin. For example, after deactivating the "free" version
2773
+ * of a specific plugin, its uninstall hook should be unregistered after the "premium" version has been
2774
+ * activated. If we don't do that, a fatal error will occur when we try to uninstall the "free" version since
2775
+ * the main file of the "free" version will be loaded first before calling the hooked callback. Since the
2776
+ * free and premium versions are almost identical (same class or have same functions), a fatal error like
2777
+ * "Cannot redeclare class MyClass" or "Cannot redeclare my_function()" will occur.
2778
+ */
2779
+ $this->unregister_uninstall_hook();
2780
+
2781
+ $this->clear_module_main_file_cache();
2782
+
2783
+ // Update is_premium of latest version.
2784
+ $this->_storage->prev_is_premium = $this->_plugin->is_premium;
2785
+ }
2786
+
2787
+ #endregion
2788
+
2789
+ #----------------------------------------------------------------------------------
2790
+ #region Add-ons
2791
+ #----------------------------------------------------------------------------------
2792
+
2793
+ /**
2794
+ * Check if add-on installed and activated on site.
2795
+ *
2796
+ * @author Vova Feldman (@svovaf)
2797
+ * @since 1.0.6
2798
+ *
2799
+ * @param string|number $slug_or_id
2800
+ *
2801
+ * @return bool
2802
+ */
2803
+ function is_addon_activated( $slug_or_id ) {
2804
+ return self::has_instance( $slug_or_id );
2805
+ }
2806
+
2807
+ /**
2808
+ * Check if add-on was connected to install
2809
+ *
2810
+ * @author Vova Feldman (@svovaf)
2811
+ * @since 1.1.7
2812
+ *
2813
+ * @param string $slug
2814
+ *
2815
+ * @return bool
2816
+ */
2817
+ function is_addon_connected( $slug ) {
2818
+ $sites = self::get_all_sites();
2819
+
2820
+ if ( ! isset( $sites[ $slug ] ) ) {
2821
+ return false;
2822
+ }
2823
+
2824
+ $site = $sites[ $slug ];
2825
+
2826
+ $plugin = FS_Plugin_Manager::instance( $slug )->get();
2827
+
2828
+ if ( $plugin->parent_plugin_id != $this->_plugin->id ) {
2829
+ // The given slug do NOT belong to any of the plugin's add-ons.
2830
+ return false;
2831
+ }
2832
+
2833
+ return ( is_object( $site ) &&
2834
+ is_numeric( $site->id ) &&
2835
+ is_numeric( $site->user_id ) &&
2836
+ is_object( $site->plan )
2837
+ );
2838
+ }
2839
+
2840
+ /**
2841
+ * Determines if add-on installed.
2842
+ *
2843
+ * NOTE: This is a heuristic and only works if the folder/file named as the slug.
2844
+ *
2845
+ * @author Vova Feldman (@svovaf)
2846
+ * @since 1.0.6
2847
+ *
2848
+ * @param string $slug
2849
+ *
2850
+ * @return bool
2851
+ */
2852
+ function is_addon_installed( $slug ) {
2853
+ return file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this->get_addon_basename( $slug ) ) );
2854
+ }
2855
+
2856
+ /**
2857
+ * Get add-on basename.
2858
+ *
2859
+ * @author Vova Feldman (@svovaf)
2860
+ * @since 1.0.6
2861
+ *
2862
+ * @param string $slug
2863
+ *
2864
+ * @return string
2865
+ */
2866
+ function get_addon_basename( $slug ) {
2867
+ if ( $this->is_addon_activated( $slug ) ) {
2868
+ self::instance( $slug )->get_plugin_basename();
2869
+ }
2870
+
2871
+ $premium_basename = $slug . '-premium/' . $slug . '.php';
2872
+
2873
+ if ( file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $premium_basename ) ) ) {
2874
+ return $premium_basename;
2875
+ }
2876
+
2877
+ $free_basename = $slug . '/' . $slug . '.php';
2878
+
2879
+ return $free_basename;
2880
+ }
2881
+
2882
+ /**
2883
+ * Get installed add-ons instances.
2884
+ *
2885
+ * @author Vova Feldman (@svovaf)
2886
+ * @since 1.0.6
2887
+ *
2888
+ * @return Freemius[]
2889
+ */
2890
+ function get_installed_addons() {
2891
+ $installed_addons = array();
2892
+ foreach ( self::$_instances as $slug => $instance ) {
2893
+ if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
2894
+ if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
2895
+ $installed_addons[] = $instance;
2896
+ }
2897
+ }
2898
+ }
2899
+
2900
+ return $installed_addons;
2901
+ }
2902
+
2903
+ /**
2904
+ * Check if any add-ons of the plugin are installed.
2905
+ *
2906
+ * @author Leo Fajardo (@leorw)
2907
+ * @since 1.1.1
2908
+ *
2909
+ * @return bool
2910
+ */
2911
+ function has_installed_addons() {
2912
+ if ( ! $this->has_addons() ) {
2913
+ return false;
2914
+ }
2915
+
2916
+ foreach ( self::$_instances as $slug => $instance ) {
2917
+ if ( $instance->is_addon() && is_object( $instance->_parent_plugin ) ) {
2918
+ if ( $this->_plugin->id == $instance->_parent_plugin->id ) {
2919
+ return true;
2920
+ }
2921
+ }
2922
+ }
2923
+
2924
+ return false;
2925
+ }
2926
+
2927
+ /**
2928
+ * Tell Freemius that the current plugin is an add-on.
2929
+ *
2930
+ * @author Vova Feldman (@svovaf)
2931
+ * @since 1.0.6
2932
+ *
2933
+ * @param number $parent_plugin_id The parent plugin ID
2934
+ */
2935
+ function init_addon( $parent_plugin_id ) {
2936
+ $this->_plugin->parent_plugin_id = $parent_plugin_id;
2937
+ }
2938
+
2939
+ /**
2940
+ * @author Vova Feldman (@svovaf)
2941
+ * @since 1.0.6
2942
+ *
2943
+ * @return bool
2944
+ */
2945
+ function is_addon() {
2946
+ return isset( $this->_plugin->parent_plugin_id ) && is_numeric( $this->_plugin->parent_plugin_id );
2947
+ }
2948
+
2949
+ /**
2950
+ * Deactivate add-on if it's premium only and the user does't have a valid license.
2951
+ *
2952
+ * @param bool $is_after_trial_cancel
2953
+ *
2954
+ * @return bool If add-on was deactivated.
2955
+ */
2956
+ private function deactivate_premium_only_addon_without_license( $is_after_trial_cancel = false ) {
2957
+ if ( ! $this->has_free_plan() &&
2958
+ ! $this->has_features_enabled_license() &&
2959
+ ! $this->_has_premium_license()
2960
+ ) {
2961
+ // IF wrapper is turned off because activation_timestamp is currently only stored for plugins (not addons).
2962
+ // if (empty($this->_storage->activation_timestamp) ||
2963
+ // (WP_FS__SCRIPT_START_TIME - $this->_storage->activation_timestamp) > 30
2964
+ // ) {
2965
+ /**
2966
+ * @todo When it's first fail, there's no reason to try and re-sync because the licenses were just synced after initial activation.
2967
+ *
2968
+ * Retry syncing the user add-on licenses.
2969
+ */
2970
+ // Sync licenses.
2971
+ $this->_sync_licenses();
2972
+ // }
2973
+
2974
+ // Try to activate premium license.
2975
+ $this->_activate_license( true );
2976
+
2977
+ if ( ! $this->has_free_plan() &&
2978
+ ! $this->has_features_enabled_license() &&
2979
+ ! $this->_has_premium_license()
2980
+ ) {
2981
+ // @todo Check if deactivate plugins also call the deactivation hook.
2982
+
2983
+ deactivate_plugins( array( $this->_plugin_basename ), true );
2984
+
2985
+ $this->_parent->_admin_notices->add_sticky(
2986
+ sprintf(
2987
+ __fs( ( $is_after_trial_cancel ?
2988
+ 'addon-trial-cancelled-message' :
2989
+ 'addon-no-license-message' ),
2990
+ $this->_parent->_slug
2991
+ ),
2992
+ '<b>' . $this->_plugin->title . '</b>'
2993
+ ) . ' ' . sprintf(
2994
+ '<a href="%s" aria-label="%s" class="button button-primary" style="margin-left: 10px; vertical-align: middle;">%s &nbsp;&#10140;</a>',
2995
+ $this->_parent->addon_url( $this->_slug ),
2996
+ esc_attr( sprintf( __fs( 'more-information-about-x', $this->_parent->_slug ), $this->_plugin->title ) ),
2997
+ __fs( 'purchase-license', $this->_parent->_slug )
2998
+ ),
2999
+ 'no_addon_license_' . $this->_slug,
3000
+ ( $is_after_trial_cancel ? '' : __fs( 'oops', $this->_parent->_slug ) . '...' ),
3001
+ ( $is_after_trial_cancel ? 'success' : 'error' )
3002
+ );
3003
+
3004
+ return true;
3005
+ }
3006
+ }
3007
+
3008
+ return false;
3009
+ }
3010
+
3011
+ #endregion
3012
+
3013
+ #----------------------------------------------------------------------------------
3014
+ #region Sandbox
3015
+ #----------------------------------------------------------------------------------
3016
+
3017
+ /**
3018
+ * Set Freemius into sandbox mode for debugging.
3019
+ *
3020
+ * @author Vova Feldman (@svovaf)
3021
+ * @since 1.0.4
3022
+ *
3023
+ * @param string $secret_key
3024
+ */
3025
+ function init_sandbox( $secret_key ) {
3026
+ $this->_plugin->secret_key = $secret_key;
3027
+
3028
+ // Update plugin details.
3029
+ FS_Plugin_Manager::instance( $this->_slug )->update( $this->_plugin, true );
3030
+ }
3031
+
3032
+ /**
3033
+ * Check if running payments in sandbox mode.
3034
+ *
3035
+ * @author Vova Feldman (@svovaf)
3036
+ * @since 1.0.4
3037
+ *
3038
+ * @return bool
3039
+ */
3040
+ function is_payments_sandbox() {
3041
+ return ( ! $this->is_live() ) || isset( $this->_plugin->secret_key );
3042
+ }
3043
+
3044
+ #endregion
3045
+
3046
+ /**
3047
+ * Check if running test vs. live plugin.
3048
+ *
3049
+ * @author Vova Feldman (@svovaf)
3050
+ * @since 1.0.5
3051
+ *
3052
+ * @return bool
3053
+ */
3054
+ function is_live() {
3055
+ return $this->_plugin->is_live;
3056
+ }
3057
+
3058
+ /**
3059
+ * Check if the user skipped connecting the account with Freemius.
3060
+ *
3061
+ * @author Vova Feldman (@svovaf)
3062
+ * @since 1.0.7
3063
+ *
3064
+ * @return bool
3065
+ */
3066
+ function is_anonymous() {
3067
+ if ( ! isset( $this->_is_anonymous ) ) {
3068
+ if ( ! isset( $this->_storage->is_anonymous ) ) {
3069
+ // Not skipped.
3070
+ $this->_is_anonymous = false;
3071
+ } else if ( is_bool( $this->_storage->is_anonymous ) ) {
3072
+ // For back compatibility, since the variable was boolean before.
3073
+ $this->_is_anonymous = $this->_storage->is_anonymous;
3074
+
3075
+ // Upgrade stored data format to 1.1.3 format.
3076
+ $this->set_anonymous_mode( $this->_storage->is_anonymous );
3077
+ } else {
3078
+ // Version 1.1.3 and later.
3079
+ $this->_is_anonymous = $this->_storage->is_anonymous['is'];
3080
+ }
3081
+ }
3082
+
3083
+ return $this->_is_anonymous;
3084
+ }
3085
+
3086
+ /**
3087
+ * Check if user connected his account and install pending email activation.
3088
+ *
3089
+ * @author Vova Feldman (@svovaf)
3090
+ * @since 1.0.7
3091
+ *
3092
+ * @return bool
3093
+ */
3094
+ function is_pending_activation() {
3095
+ return $this->_storage->get( 'is_pending_activation', false );
3096
+ }
3097
+
3098
+ /**
3099
+ * Check if plugin must be WordPress.org compliant.
3100
+ *
3101
+ * @since 1.0.7
3102
+ *
3103
+ * @return bool
3104
+ */
3105
+ function is_org_repo_compliant() {
3106
+ return $this->_is_org_compliant;
3107
+ }
3108
+
3109
+ #----------------------------------------------------------------------------------
3110
+ #region Daily Sync Cron
3111
+ #----------------------------------------------------------------------------------
3112
+
3113
+ /**
3114
+ * @author Vova Feldman (@svovaf)
3115
+ * @since 1.1.7.3
3116
+ */
3117
+ private function run_manual_sync() {
3118
+ $this->require_pluggable_essentials();
3119
+
3120
+ if ( ! current_user_can( 'activate_plugins' ) ) {
3121
+ return;
3122
+ }
3123
+
3124
+ // Run manual sync.
3125
+ $this->_sync_cron();
3126
+
3127
+ // Reschedule next cron to run 24 hours from now (performance optimization).
3128
+ $this->clear_sync_cron();
3129
+
3130
+ $this->schedule_sync_cron( time() + WP_FS__TIME_24_HOURS_IN_SEC, false );
3131
+ }
3132
+
3133
+ /**
3134
+ * Data sync cron job. Replaces the background sync non blocking HTTP request
3135
+ * that doesn't halt page loading.
3136
+ *
3137
+ * @author Vova Feldman (@svovaf)
3138
+ * @since 1.1.7.3
3139
+ */
3140
+ function _sync_cron() {
3141
+ $this->_logger->entrance();
3142
+
3143
+ // Store the last time data sync was executed.
3144
+ $this->_storage->sync_timestamp = time();
3145
+
3146
+ // Check if API is temporary down.
3147
+ if ( FS_Api::is_temporary_down() ) {
3148
+ return;
3149
+ }
3150
+
3151
+ // @todo Add logic that identifies API latency, and reschedule the next background sync randomly between 8-16 hours.
3152
+
3153
+ if ( $this->is_registered() ) {
3154
+ if ( $this->has_paid_plan() ) {
3155
+ // Initiate background plan sync.
3156
+ $this->_sync_license( true );
3157
+
3158
+ if ( $this->is_paying() ) {
3159
+ // Check for premium plugin updates.
3160
+ $this->_check_updates( true );
3161
+ }
3162
+ } else {
3163
+ // Sync install (only if something changed locally).
3164
+ $this->sync_install();
3165
+ }
3166
+ }
3167
+
3168
+ $this->do_action( 'after_sync_cron' );
3169
+ }
3170
+
3171
+ /**
3172
+ * Check if sync was executed in the last $period of seconds.
3173
+ *
3174
+ * @author Vova Feldman (@svovaf)
3175
+ * @since 1.1.7.3
3176
+ *
3177
+ * @param int $period In seconds
3178
+ *
3179
+ * @return bool
3180
+ */
3181
+ private function is_sync_executed( $period = WP_FS__TIME_24_HOURS_IN_SEC ) {
3182
+ if ( ! isset( $this->_storage->sync_timestamp ) ) {
3183
+ return false;
3184
+ }
3185
+
3186
+ return ( $this->_storage->sync_timestamp > ( WP_FS__SCRIPT_START_TIME - $period ) );
3187
+ }
3188
+
3189
+ /**
3190
+ * @author Vova Feldman (@svovaf)
3191
+ * @since 1.1.7.3
3192
+ *
3193
+ * @return bool
3194
+ */
3195
+ private function is_sync_cron_on() {
3196
+ /**
3197
+ * @var object $sync_cron_data
3198
+ */
3199
+ $sync_cron_data = $this->_storage->get( 'sync_cron', null );
3200
+
3201
+ return ( ! is_null( $sync_cron_data ) && true === $sync_cron_data->on );
3202
+ }
3203
+
3204
+ /**
3205
+ * @author Vova Feldman (@svovaf)
3206
+ * @since 1.1.7.3
3207
+ *
3208
+ * @param int $start_at Defaults to now.
3209
+ * @param bool $randomize_start If true, schedule first job randomly during the next 12 hours. Otherwise,
3210
+ * schedule job to start right away.
3211
+ */
3212
+ private function schedule_sync_cron( $start_at = WP_FS__SCRIPT_START_TIME, $randomize_start = true ) {
3213
+ $this->_logger->entrance();
3214
+
3215
+ if ( $randomize_start ) {
3216
+ // Schedule first sync with a random 12 hour time range from now.
3217
+ $start_at += rand( 0, ( WP_FS__TIME_24_HOURS_IN_SEC / 2 ) );
3218
+ }
3219
+
3220
+ // Schedule daily WP cron.
3221
+ wp_schedule_event(
3222
+ $start_at,
3223
+ 'daily',
3224
+ $this->get_action_tag( 'data_sync' )
3225
+ );
3226
+
3227
+ $this->_storage->store( 'sync_cron', (object) array(
3228
+ 'version' => $this->get_plugin_version(),
3229
+ 'sdk_version' => $this->version,
3230
+ 'timestamp' => WP_FS__SCRIPT_START_TIME,
3231
+ 'on' => true,
3232
+ ) );
3233
+ }
3234
+
3235
+ /**
3236
+ * Add the actual sync function to the cron job hook.
3237
+ *
3238
+ * @author Vova Feldman (@svovaf)
3239
+ * @since 1.1.7.3
3240
+ */
3241
+ private function hook_callback_to_sync_cron() {
3242
+ $this->add_action( 'data_sync', array( &$this, '_sync_cron' ) );
3243
+ }
3244
+
3245
+ /**
3246
+ * @author Vova Feldman (@svovaf)
3247
+ * @since 1.1.7.3
3248
+ */
3249
+ private function clear_sync_cron() {
3250
+ $this->_logger->entrance();
3251
+
3252
+ if ( ! $this->is_sync_cron_on() ) {
3253
+ return;
3254
+ }
3255
+
3256
+ $this->_storage->remove( 'sync_cron' );
3257
+
3258
+ wp_clear_scheduled_hook( $this->get_action_tag( 'data_sync' ) );
3259
+ }
3260
+
3261
+ /**
3262
+ * Unix timestamp for next sync cron execution or false if not scheduled.
3263
+ *
3264
+ * @author Vova Feldman (@svovaf)
3265
+ * @since 1.1.7.3
3266
+ *
3267
+ * @return int|false
3268
+ */
3269
+ function next_sync_cron() {
3270
+ $this->_logger->entrance();
3271
+
3272
+ if ( ! $this->is_sync_cron_on() ) {
3273
+ return false;
3274
+ }
3275
+
3276
+ return wp_next_scheduled( $this->get_action_tag( 'data_sync' ) );
3277
+ }
3278
+
3279
+ /**
3280
+ * Unix timestamp for previous sync cron execution or false if never executed.
3281
+ *
3282
+ * @author Vova Feldman (@svovaf)
3283
+ * @since 1.1.7.3
3284
+ *
3285
+ * @return int|false
3286
+ */
3287
+ function last_sync_cron() {
3288
+ $this->_logger->entrance();
3289
+
3290
+ return $this->_storage->get( 'sync_timestamp' );
3291
+ }
3292
+
3293
+ #endregion Daily Sync Cron ------------------------------------------------------------------
3294
+
3295
+ #----------------------------------------------------------------------------------
3296
+ #region Async Install Sync
3297
+ #----------------------------------------------------------------------------------
3298
+
3299
+ /**
3300
+ * @author Vova Feldman (@svovaf)
3301
+ * @since 1.1.7.3
3302
+ *
3303
+ * @return bool
3304
+ */
3305
+ private function is_install_sync_scheduled() {
3306
+ /**
3307
+ * @var object $cron_data
3308
+ */
3309
+ $cron_data = $this->_storage->get( 'install_sync_cron', null );
3310
+
3311
+ return ( ! is_null( $cron_data ) && true === $cron_data->on );
3312
+ }
3313
+
3314
+ /**
3315
+ * Instead of running blocking install sync event, execute non blocking scheduled wp-cron.
3316
+ *
3317
+ * @author Vova Feldman (@svovaf)
3318
+ * @since 1.1.7.3
3319
+ */
3320
+ private function schedule_install_sync() {
3321
+ $this->_logger->entrance();
3322
+
3323
+ $this->clear_install_sync_cron();
3324
+
3325
+ // Schedule immediate install sync.
3326
+ wp_schedule_single_event(
3327
+ WP_FS__SCRIPT_START_TIME,
3328
+ $this->get_action_tag( 'install_sync' )
3329
+ );
3330
+
3331
+ $this->_storage->store( 'install_sync_cron', (object) array(
3332
+ 'version' => $this->get_plugin_version(),
3333
+ 'sdk_version' => $this->version,
3334
+ 'timestamp' => WP_FS__SCRIPT_START_TIME,
3335
+ 'on' => true,
3336
+ ) );
3337
+ }
3338
+
3339
+ /**
3340
+ * Unix timestamp for previous install sync cron execution or false if never executed.
3341
+ *
3342
+ * @todo There's some very strange bug that $this->_storage->install_sync_timestamp value is not being
3343
+ * updated. But for sure the sync event is working.
3344
+ *
3345
+ * @author Vova Feldman (@svovaf)
3346
+ * @since 1.1.7.3
3347
+ *
3348
+ * @return int|false
3349
+ */
3350
+ function last_install_sync() {
3351
+ $this->_logger->entrance();
3352
+
3353
+ return $this->_storage->get( 'install_sync_timestamp' );
3354
+ }
3355
+
3356
+ /**
3357
+ * Unix timestamp for next install sync cron execution or false if not scheduled.
3358
+ *
3359
+ * @author Vova Feldman (@svovaf)
3360
+ * @since 1.1.7.3
3361
+ *
3362
+ * @return int|false
3363
+ */
3364
+ function next_install_sync() {
3365
+ $this->_logger->entrance();
3366
+
3367
+ if ( ! $this->is_install_sync_scheduled() ) {
3368
+ return false;
3369
+ }
3370
+
3371
+ return wp_next_scheduled( $this->get_action_tag( 'install_sync' ) );
3372
+ }
3373
+
3374
+ /**
3375
+ * Add the actual install sync function to the cron job hook.
3376
+ *
3377
+ * @author Vova Feldman (@svovaf)
3378
+ * @since 1.1.7.3
3379
+ */
3380
+ private function hook_callback_to_install_sync() {
3381
+ $this->add_action( 'install_sync', array( &$this, '_run_sync_install' ) );
3382
+ }
3383
+
3384
+ /**
3385
+ * @author Vova Feldman (@svovaf)
3386
+ * @since 1.1.7.3
3387
+ */
3388
+ private function clear_install_sync_cron() {
3389
+ $this->_logger->entrance();
3390
+
3391
+ if ( ! $this->is_install_sync_scheduled() ) {
3392
+ return;
3393
+ }
3394
+
3395
+ $this->_storage->remove( 'install_sync_cron' );
3396
+
3397
+ wp_clear_scheduled_hook( $this->get_action_tag( 'install_sync' ) );
3398
+ }
3399
+
3400
+ /**
3401
+ * @author Vova Feldman (@svovaf)
3402
+ * @since 1.1.7.3
3403
+ */
3404
+ public function _run_sync_install() {
3405
+ $this->_logger->entrance();
3406
+
3407
+ // Update last install sync timestamp.
3408
+ $this->_storage->install_sync_timestamp = time();
3409
+
3410
+ $this->sync_install( array(), true );
3411
+ }
3412
+
3413
+ #endregion Async Install Sync ------------------------------------------------------------------
3414
+
3415
+ /**
3416
+ * Show a notice that activation is currently pending.
3417
+ *
3418
+ * @author Vova Feldman (@svovaf)
3419
+ * @since 1.0.7
3420
+ *
3421
+ * @param bool|string $email
3422
+ * @param bool $is_pending_trial Since 1.2.1.5
3423
+ */
3424
+ function _add_pending_activation_notice( $email = false, $is_pending_trial = false ) {
3425
+ if ( ! is_string( $email ) ) {
3426
+ $current_user = self::_get_current_wp_user();
3427
+ $email = $current_user->user_email;
3428
+ }
3429
+
3430
+ $this->_admin_notices->add_sticky(
3431
+ sprintf(
3432
+ __fs( 'pending-activation-message', $this->_slug ),
3433
+ '<b>' . $this->get_plugin_name() . '</b>',
3434
+ '<b>' . $email . '</b>',
3435
+ __fs( $is_pending_trial ? 'start-the-trial' : 'complete-the-install', $this->_slug )
3436
+ ),
3437
+ 'activation_pending',
3438
+ 'Thanks!'
3439
+ );
3440
+ }
3441
+
3442
+ /**
3443
+ * Check if currently in plugin activation.
3444
+ *
3445
+ * @author Vova Feldman (@svovaf)
3446
+ * @since 1.1.4
3447
+ *
3448
+ * @return bool
3449
+ */
3450
+ function is_plugin_activation() {
3451
+ return get_option( "fs_{$this->_slug}_activated", false );
3452
+ }
3453
+
3454
+ /**
3455
+ *
3456
+ * NOTE: admin_menu action executed before admin_init.
3457
+ *
3458
+ * @author Vova Feldman (@svovaf)
3459
+ * @since 1.0.7
3460
+ */
3461
+ function _admin_init_action() {
3462
+ /**
3463
+ * Automatically redirect to connect/activation page after plugin activation.
3464
+ *
3465
+ * @since 1.1.7 Do NOT redirect to opt-in when running in network admin mode.
3466
+ */
3467
+ if ( $this->is_plugin_activation() ) {
3468
+ delete_option( "fs_{$this->_slug}_activated" );
3469
+
3470
+ if ( ! function_exists( 'is_network_admin' ) || ! is_network_admin() ) {
3471
+ $this->_redirect_on_activation_hook();
3472
+
3473
+ return;
3474
+ }
3475
+ }
3476
+
3477
+ if ( fs_request_is_action( $this->_slug . '_skip_activation' ) ) {
3478
+ check_admin_referer( $this->_slug . '_skip_activation' );
3479
+
3480
+ $this->skip_connection();
3481
+
3482
+ fs_redirect( $this->get_after_activation_url( 'after_skip_url' ) );
3483
+ }
3484
+
3485
+ if ( ! $this->is_addon() && ! $this->is_registered() && ! $this->is_anonymous() ) {
3486
+ if ( ! $this->is_pending_activation() ) {
3487
+ if ( ! $this->_menu->is_activation_page() ) {
3488
+ if ( $this->is_plugin_new_install() || $this->is_only_premium() ) {
3489
+ // Show notice for new plugin installations.
3490
+ $this->_admin_notices->add(
3491
+ sprintf(
3492
+ __fs( 'you-are-step-away', $this->_slug ),
3493
+ sprintf( '<b><a href="%s">%s</a></b>',
3494
+ $this->get_activation_url(),
3495
+ sprintf( __fs( 'activate-x-now', $this->_slug ), $this->get_plugin_name() )
3496
+ )
3497
+ ),
3498
+ '',
3499
+ 'update-nag'
3500
+ );
3501
+ } else {
3502
+ if ( ! isset( $this->_storage->sticky_optin_added ) ) {
3503
+ $this->_storage->sticky_optin_added = true;
3504
+
3505
+ // Show notice for new plugin installations.
3506
+ $this->_admin_notices->add_sticky(
3507
+ sprintf(
3508
+ __fs( 'few-plugin-tweaks', $this->_slug ),
3509
+ sprintf( '<b><a href="%s">%s</a></b>',
3510
+ $this->get_activation_url(),
3511
+ sprintf( __fs( 'optin-x-now', $this->_slug ), $this->get_plugin_name() )
3512
+ )
3513
+ ),
3514
+ 'connect_account',
3515
+ '',
3516
+ 'update-nag'
3517
+ );
3518
+ }
3519
+
3520
+ if ( $this->has_filter( 'optin_pointer_element' ) ) {
3521
+ // Don't show admin nag if plugin update.
3522
+ wp_enqueue_script( 'wp-pointer' );
3523
+ wp_enqueue_style( 'wp-pointer' );
3524
+
3525
+ $this->_enqueue_connect_essentials();
3526
+
3527
+ add_action( 'admin_print_footer_scripts', array(
3528
+ $this,
3529
+ '_add_connect_pointer_script'
3530
+ ) );
3531
+ }
3532
+
3533
+ }
3534
+ }
3535
+ }
3536
+ }
3537
+
3538
+ $this->_add_upgrade_action_link();
3539
+ }
3540
+
3541
+ /**
3542
+ * Enqueue connect requires scripts and styles.
3543
+ *
3544
+ * @author Vova Feldman (@svovaf)
3545
+ * @since 1.1.4
3546
+ */
3547
+ function _enqueue_connect_essentials() {
3548
+ wp_enqueue_script( 'jquery' );
3549
+ wp_enqueue_script( 'json2' );
3550
+
3551
+ fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
3552
+ fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
3553
+
3554
+ fs_enqueue_local_style( 'fs_connect', '/admin/connect.css' );
3555
+ }
3556
+
3557
+ /**
3558
+ * Add connect / opt-in pointer.
3559
+ *
3560
+ * @author Vova Feldman (@svovaf)
3561
+ * @since 1.1.4
3562
+ */
3563
+ function _add_connect_pointer_script() {
3564
+ $vars = array( 'slug' => $this->_slug );
3565
+ $pointer_content = fs_get_template( 'connect.php', $vars );
3566
+ ?>
3567
+ <script type="text/javascript">// <![CDATA[
3568
+ jQuery(document).ready(function ($) {
3569
+ if ('undefined' !== typeof(jQuery().pointer)) {
3570
+
3571
+ var element = <?php echo $this->apply_filters( 'optin_pointer_element', '$("#non_existing_element");' ) ?>;
3572
+
3573
+ if (element.length > 0) {
3574
+ var optin = $(element).pointer($.extend(true, {}, {
3575
+ content : <?php echo json_encode( $pointer_content ) ?>,
3576
+ position : {
3577
+ edge : 'left',
3578
+ align: 'center'
3579
+ },
3580
+ buttons : function () {
3581
+ // Don't show pointer buttons.
3582
+ return '';
3583
+ },
3584
+ pointerWidth: 482
3585
+ }, <?php echo $this->apply_filters( 'optin_pointer_options_json', '{}' ) ?>));
3586
+
3587
+ <?php
3588
+ echo $this->apply_filters( 'optin_pointer_execute', "
3589
+
3590
+ optin.pointer('open');
3591
+
3592
+ // Tag the opt-in pointer with custom class.
3593
+ $('.wp-pointer #fs_connect')
3594
+ .parents('.wp-pointer.wp-pointer-top')
3595
+ .addClass('fs-opt-in-pointer');
3596
+
3597
+ ", 'element', 'optin' ) ?>
3598
+ }
3599
+ }
3600
+ });
3601
+ // ]]></script>
3602
+ <?php
3603
+ }
3604
+
3605
+ /**
3606
+ * Return current page's URL.
3607
+ *
3608
+ * @author Vova Feldman (@svovaf)
3609
+ * @since 1.0.7
3610
+ *
3611
+ * @return string
3612
+ */
3613
+ function current_page_url() {
3614
+ $url = 'http';
3615
+
3616
+ if ( isset( $_SERVER["HTTPS"] ) ) {
3617
+ if ( $_SERVER["HTTPS"] == "on" ) {
3618
+ $url .= "s";
3619
+ }
3620
+ }
3621
+ $url .= "://";
3622
+ if ( $_SERVER["SERVER_PORT"] != "80" ) {
3623
+ $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
3624
+ } else {
3625
+ $url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
3626
+ }
3627
+
3628
+ return esc_url( $url );
3629
+ }
3630
+
3631
+ /**
3632
+ * Check if the current page is the plugin's main admin settings page.
3633
+ *
3634
+ * @author Vova Feldman (@svovaf)
3635
+ * @since 1.0.7
3636
+ *
3637
+ * @return bool
3638
+ */
3639
+ function _is_plugin_page() {
3640
+ return fs_is_plugin_page( $this->_menu->get_raw_slug() ) ||
3641
+ fs_is_plugin_page( $this->_slug );
3642
+ }
3643
+
3644
+ /* Events
3645
+ ------------------------------------------------------------------------------------------------------------------*/
3646
+ /**
3647
+ * Delete site install from Database.
3648
+ *
3649
+ * @author Vova Feldman (@svovaf)
3650
+ * @since 1.0.1
3651
+ *
3652
+ * @param bool $store
3653
+ */
3654
+ function _delete_site( $store = true ) {
3655
+ $sites = self::get_all_sites();
3656
+
3657
+ if ( isset( $sites[ $this->_slug ] ) ) {
3658
+ unset( $sites[ $this->_slug ] );
3659
+ }
3660
+
3661
+ self::$_accounts->set_option( 'sites', $sites, $store );
3662
+ }
3663
+
3664
+ /**
3665
+ * Delete plugin's plans information.
3666
+ *
3667
+ * @param bool $store Flush to Database if true.
3668
+ *
3669
+ * @author Vova Feldman (@svovaf)
3670
+ * @since 1.0.9
3671
+ */
3672
+ private function _delete_plans( $store = true ) {
3673
+ $this->_logger->entrance();
3674
+
3675
+ $plans = self::get_all_plans();
3676
+
3677
+ unset( $plans[ $this->_slug ] );
3678
+
3679
+ self::$_accounts->set_option( 'plans', $plans, $store );
3680
+ }
3681
+
3682
+ /**
3683
+ * Delete all plugin licenses.
3684
+ *
3685
+ * @author Vova Feldman (@svovaf)
3686
+ * @since 1.0.9
3687
+ *
3688
+ * @param bool $store
3689
+ * @param string|bool $plugin_slug
3690
+ */
3691
+ private function _delete_licenses( $store = true, $plugin_slug = false ) {
3692
+ $this->_logger->entrance();
3693
+
3694
+ $all_licenses = self::get_all_licenses();
3695
+
3696
+ if ( ! is_string( $plugin_slug ) ) {
3697
+ $plugin_slug = $this->_slug;
3698
+ }
3699
+
3700
+ unset( $all_licenses[ $plugin_slug ] );
3701
+
3702
+ self::$_accounts->set_option( 'licenses', $all_licenses, $store );
3703
+ }
3704
+
3705
+ /**
3706
+ * Check if Freemius was added on new plugin installation.
3707
+ *
3708
+ * @author Vova Feldman (@svovaf)
3709
+ * @since 1.1.5
3710
+ *
3711
+ * @return bool
3712
+ */
3713
+ function is_plugin_new_install() {
3714
+ return isset( $this->_storage->is_plugin_new_install ) &&
3715
+ $this->_storage->is_plugin_new_install;
3716
+ }
3717
+
3718
+ /**
3719
+ * Check if it's the first plugin release that is running Freemius.
3720
+ *
3721
+ * @author Vova Feldman (@svovaf)
3722
+ * @since 1.2.1.5
3723
+ *
3724
+ * @return bool
3725
+ */
3726
+ function is_first_freemius_powered_version() {
3727
+ return empty( $this->_storage->plugin_last_version );
3728
+ }
3729
+
3730
+ /**
3731
+ * Plugin activated hook.
3732
+ *
3733
+ * @author Vova Feldman (@svovaf)
3734
+ * @since 1.0.1
3735
+ *
3736
+ * @uses FS_Api
3737
+ */
3738
+ function _activate_plugin_event_hook() {
3739
+ $this->_logger->entrance( 'slug = ' . $this->_slug );
3740
+
3741
+ if ( ! current_user_can( 'activate_plugins' ) ) {
3742
+ return;
3743
+ }
3744
+
3745
+ $this->unregister_uninstall_hook();
3746
+
3747
+ // Clear API cache on activation.
3748
+ FS_Api::clear_cache();
3749
+
3750
+ if ( $this->is_registered() ) {
3751
+ $this->reconnect_locally();
3752
+
3753
+ // Schedule re-activation event and sync.
3754
+ // $this->sync_install( array(), true );
3755
+ $this->schedule_install_sync();
3756
+
3757
+ $is_premium_version_activation = ( current_filter() !== ( 'activate_' . $this->_free_plugin_basename ) );
3758
+
3759
+ // 1. If running in the activation of the FREE module, get the basename of the PREMIUM.
3760
+ // 2. If running in the activation of the PREMIUM module, get the basename of the FREE.
3761
+ $other_version_basename = $is_premium_version_activation ?
3762
+ $this->_free_plugin_basename :
3763
+ $this->premium_plugin_basename();
3764
+
3765
+ /**
3766
+ * If the other module version is activate, deactivate it.
3767
+ *
3768
+ * @author Leo Fajardo (@leorw)
3769
+ * @since 1.2.2
3770
+ */
3771
+ if ( is_plugin_active( $other_version_basename ) ) {
3772
+ deactivate_plugins( $other_version_basename );
3773
+ }
3774
+
3775
+ // If activating the premium module version, add an admin noitce to congratulate for an upgrade completion.
3776
+ if ( $is_premium_version_activation ) {
3777
+ $this->_admin_notices->add(
3778
+ sprintf( __fs( 'successful-version-upgrade-message', $this->_slug ), sprintf( '<b>%s</b>', $this->_plugin->title ) ),
3779
+ __fs( 'woot', $this->_slug ) . '!'
3780
+ );
3781
+ }
3782
+ } else if ( $this->is_anonymous() ) {
3783
+ /**
3784
+ * Reset "skipped" click cache on the following:
3785
+ * 1. Development mode.
3786
+ * 2. If the user skipped the exact same version before.
3787
+ *
3788
+ * @todo 3. If explicitly asked to retry after every activation.
3789
+ */
3790
+ if ( WP_FS__DEV_MODE ||
3791
+ $this->get_plugin_version() == $this->_storage->is_anonymous['version']
3792
+ ) {
3793
+ $this->reset_anonymous_mode();
3794
+ }
3795
+ }
3796
+
3797
+ if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
3798
+ /**
3799
+ * If no previous version of plugin's version exist, it means that it's either
3800
+ * the first time that the plugin installed on the site, or the plugin was installed
3801
+ * before but didn't have Freemius integrated.
3802
+ *
3803
+ * Since register_activation_hook() do NOT fires on updates since 3.1, and only fires
3804
+ * on manual activation via the dashboard, is_plugin_activation() is TRUE
3805
+ * only after immediate activation.
3806
+ *
3807
+ * @since 1.1.4
3808
+ * @link https://make.wordpress.org/core/2010/10/27/plugin-activation-hooks-no-longer-fire-for-updates/
3809
+ */
3810
+ $this->_storage->is_plugin_new_install = empty( $this->_storage->plugin_last_version );
3811
+ }
3812
+
3813
+ if ( ! $this->_anonymous_mode && $this->has_api_connectivity( WP_FS__DEV_MODE ) ) {
3814
+ // Store hint that the plugin was just activated to enable auto-redirection to settings.
3815
+ add_option( "fs_{$this->_slug}_activated", true );
3816
+ }
3817
+
3818
+ /**
3819
+ * Activation hook is executed after the plugin's main file is loaded, therefore,
3820
+ * after the plugin was loaded. The logic is located at activate_plugin()
3821
+ * ./wp-admin/includes/plugin.php.
3822
+ *
3823
+ * @author Vova Feldman (@svovaf)
3824
+ * @since 1.1.9
3825
+ */
3826
+ $this->_storage->was_plugin_loaded = true;
3827
+ }
3828
+
3829
+ /**
3830
+ * Delete account.
3831
+ *
3832
+ * @author Vova Feldman (@svovaf)
3833
+ * @since 1.0.3
3834
+ *
3835
+ * @param bool $check_user Enforce checking if user have plugins activation privileges.
3836
+ */
3837
+ function delete_account_event( $check_user = true ) {
3838
+ $this->_logger->entrance( 'slug = ' . $this->_slug );
3839
+
3840
+ if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
3841
+ return;
3842
+ }
3843
+
3844
+ $this->do_action( 'before_account_delete' );
3845
+
3846
+ // Clear all admin notices.
3847
+ $this->_admin_notices->clear_all_sticky();
3848
+
3849
+ $this->_delete_site( false );
3850
+
3851
+ $this->_delete_plans( false );
3852
+
3853
+ $this->_delete_licenses( false );
3854
+
3855
+ // Delete add-ons related to plugin's account.
3856
+ $this->_delete_account_addons( false );
3857
+
3858
+ // @todo Delete plans and licenses of add-ons.
3859
+
3860
+ self::$_accounts->store();
3861
+
3862
+ /**
3863
+ * IMPORTANT:
3864
+ * Clear crons must be executed before clearing all storage.
3865
+ * Otherwise, the cron will not be cleared.
3866
+ */
3867
+ $this->clear_sync_cron();
3868
+ $this->clear_install_sync_cron();
3869
+
3870
+ // Clear all storage data.
3871
+ $this->_storage->clear_all( true, array(
3872
+ 'connectivity_test',
3873
+ 'is_on',
3874
+ ) );
3875
+
3876
+ // Send delete event.
3877
+ $this->get_api_site_scope()->call( '/', 'delete' );
3878
+
3879
+ $this->do_action( 'after_account_delete' );
3880
+ }
3881
+
3882
+ /**
3883
+ * Plugin deactivation hook.
3884
+ *
3885
+ * @author Vova Feldman (@svovaf)
3886
+ * @since 1.0.1
3887
+ */
3888
+ function _deactivate_plugin_hook() {
3889
+ $this->_logger->entrance( 'slug = ' . $this->_slug );
3890
+
3891
+ if ( ! current_user_can( 'activate_plugins' ) ) {
3892
+ return;
3893
+ }
3894
+
3895
+ $this->_admin_notices->clear_all_sticky();
3896
+ if ( isset( $this->_storage->sticky_optin_added ) ) {
3897
+ unset( $this->_storage->sticky_optin_added );
3898
+ }
3899
+
3900
+ if ( ! isset( $this->_storage->is_plugin_new_install ) ) {
3901
+ // Remember that plugin was already installed.
3902
+ $this->_storage->is_plugin_new_install = false;
3903
+ }
3904
+
3905
+ // Hook to plugin uninstall.
3906
+ register_uninstall_hook( $this->_plugin_main_file_path, array( 'Freemius', '_uninstall_plugin_hook' ) );
3907
+
3908
+ $this->clear_module_main_file_cache();
3909
+ $this->clear_sync_cron();
3910
+ $this->clear_install_sync_cron();
3911
+
3912
+ if ( $this->is_registered() ) {
3913
+ // Send deactivation event.
3914
+ $this->sync_install( array(
3915
+ 'is_active' => false,
3916
+ ) );
3917
+ } else {
3918
+ if ( ! $this->has_api_connectivity() ) {
3919
+ // Reset connectivity test cache.
3920
+ unset( $this->_storage->connectivity_test );
3921
+ }
3922
+ }
3923
+
3924
+ // Clear API cache on deactivation.
3925
+ FS_Api::clear_cache();
3926
+
3927
+ $this->remove_sdk_reference();
3928
+ }
3929
+
3930
+ /**
3931
+ * @author Vova Feldman (@svovaf)
3932
+ * @since 1.1.6
3933
+ */
3934
+ private function remove_sdk_reference() {
3935
+ global $fs_active_plugins;
3936
+
3937
+ foreach ( $fs_active_plugins->plugins as $sdk_path => &$data ) {
3938
+ if ( $this->_plugin_basename == $data->plugin_path ) {
3939
+ unset( $fs_active_plugins->plugins[ $sdk_path ] );
3940
+ break;
3941
+ }
3942
+ }
3943
+
3944
+ fs_fallback_to_newest_active_sdk();
3945
+ }
3946
+
3947
+ /**
3948
+ * @author Vova Feldman (@svovaf)
3949
+ * @since 1.1.3
3950
+ *
3951
+ * @param bool $is_anonymous
3952
+ */
3953
+ private function set_anonymous_mode( $is_anonymous = true ) {
3954
+ // Store information regarding skip to try and opt-in the user
3955
+ // again in the future.
3956
+ $this->_storage->is_anonymous = array(
3957
+ 'is' => $is_anonymous,
3958
+ 'timestamp' => WP_FS__SCRIPT_START_TIME,
3959
+ 'version' => $this->get_plugin_version(),
3960
+ );
3961
+
3962
+ // Update anonymous mode cache.
3963
+ $this->_is_anonymous = $is_anonymous;
3964
+ }
3965
+
3966
+ /**
3967
+ * @author Vova Feldman (@svovaf)
3968
+ * @since 1.1.3
3969
+ */
3970
+ private function reset_anonymous_mode() {
3971
+ unset( $this->_storage->is_anonymous );
3972
+ }
3973
+
3974
+ /**
3975
+ * Clears the anonymous mode and redirects to the opt-in screen.
3976
+ *
3977
+ * @author Vova Feldman (@svovaf)
3978
+ * @since 1.1.7
3979
+ */
3980
+ function connect_again() {
3981
+ if ( ! $this->is_anonymous() ) {
3982
+ return;
3983
+ }
3984
+
3985
+ $this->reset_anonymous_mode();
3986
+
3987
+ fs_redirect( $this->get_activation_url() );
3988
+ }
3989
+
3990
+ /**
3991
+ * Skip account connect, and set anonymous mode.
3992
+ *
3993
+ * @author Vova Feldman (@svovaf)
3994
+ * @since 1.1.1
3995
+ */
3996
+ private function skip_connection() {
3997
+ $this->_logger->entrance();
3998
+
3999
+ $this->_admin_notices->remove_sticky( 'connect_account' );
4000
+
4001
+ $this->set_anonymous_mode();
4002
+
4003
+ // Send anonymous skip event.
4004
+ // No user identified info nor any tracking will be sent after the user skips the opt-in.
4005
+ $this->get_api_plugin_scope()->call( 'skip.json', 'put', array(
4006
+ 'uid' => $this->get_anonymous_id(),
4007
+ ) );
4008
+ }
4009
+
4010
+ /**
4011
+ * Plugin version update hook.
4012
+ *
4013
+ * @author Vova Feldman (@svovaf)
4014
+ * @since 1.0.4
4015
+ */
4016
+ private function update_plugin_version_event() {
4017
+ $this->_logger->entrance();
4018
+
4019
+ if ( ! $this->is_registered() ) {
4020
+ return;
4021
+ }
4022
+
4023
+ $this->schedule_install_sync();
4024
+ // $this->sync_install( array(), true );
4025
+ }
4026
+
4027
+ /**
4028
+ * Return a list of modified plugins since the last sync.
4029
+ *
4030
+ * Note:
4031
+ * There's no point to store a plugins counter since even if the number of
4032
+ * plugins didn't change, we still need to check if the versions are all the
4033
+ * same and the activity state is similar.
4034
+ *
4035
+ * @author Vova Feldman (@svovaf)
4036
+ * @since 1.1.8
4037
+ *
4038
+ * @return array|false
4039
+ */
4040
+ private function get_plugins_data_for_api() {
4041
+ // Alias.
4042
+ $option_name = 'all_plugins';
4043
+
4044
+ $all_cached_plugins = self::$_accounts->get_option( $option_name );
4045
+
4046
+ if ( ! is_object( $all_cached_plugins ) ) {
4047
+ $all_cached_plugins = (object) array(
4048
+ 'timestamp' => '',
4049
+ 'md5' => '',
4050
+ 'plugins' => array(),
4051
+ );
4052
+ }
4053
+
4054
+ $time = time();
4055
+
4056
+ if ( ! empty( $all_cached_plugins->timestamp ) &&
4057
+ ( $time - $all_cached_plugins->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
4058
+ ) {
4059
+ // Don't send plugin updates if last update was in the past 5 min.
4060
+ return false;
4061
+ }
4062
+
4063
+ // Write timestamp to lock the logic.
4064
+ $all_cached_plugins->timestamp = $time;
4065
+ self::$_accounts->set_option( $option_name, $all_cached_plugins, true );
4066
+
4067
+ // Reload options from DB.
4068
+ self::$_accounts->load( true );
4069
+ $all_cached_plugins = self::$_accounts->get_option( $option_name );
4070
+
4071
+ if ( $time != $all_cached_plugins->timestamp ) {
4072
+ // If timestamp is different, then another thread captured the lock.
4073
+ return false;
4074
+ }
4075
+
4076
+ // Check if there's a change in plugins.
4077
+ $all_plugins = self::get_all_plugins();
4078
+
4079
+ // Check if plugins changed.
4080
+ ksort( $all_plugins );
4081
+
4082
+ $plugins_signature = '';
4083
+ foreach ( $all_plugins as $basename => $data ) {
4084
+ $plugins_signature .= $data['slug'] . ',' .
4085
+ $data['Version'] . ',' .
4086
+ ( $data['is_active'] ? '1' : '0' ) . ';';
4087
+ }
4088
+
4089
+ // Check if plugins status changed (version or active/inactive).
4090
+ $plugins_changed = ( $all_cached_plugins->md5 !== md5( $plugins_signature ) );
4091
+
4092
+ $plugins_update_data = array();
4093
+
4094
+ if ( $plugins_changed ) {
4095
+ // Change in plugins, report changes.
4096
+
4097
+ // Update existing plugins info.
4098
+ foreach ( $all_cached_plugins->plugins as $basename => $data ) {
4099
+ if ( ! isset( $all_plugins[ $basename ] ) ) {
4100
+ // Plugin uninstalled.
4101
+ $uninstalled_plugin_data = $data;
4102
+ $uninstalled_plugin_data['is_active'] = false;
4103
+ $uninstalled_plugin_data['is_uninstalled'] = true;
4104
+ $plugins_update_data[] = $uninstalled_plugin_data;
4105
+
4106
+ unset( $all_plugins[ $basename ] );
4107
+ unset( $all_cached_plugins->plugins[ $basename ] );
4108
+ } else if ( $data['is_active'] !== $all_plugins[ $basename ]['is_active'] ||
4109
+ $data['version'] !== $all_plugins[ $basename ]['Version']
4110
+ ) {
4111
+ // Plugin activated or deactivated, or version changed.
4112
+ $all_cached_plugins->plugins[ $basename ]['is_active'] = $all_plugins[ $basename ]['is_active'];
4113
+ $all_cached_plugins->plugins[ $basename ]['version'] = $all_plugins[ $basename ]['Version'];
4114
+
4115
+ $plugins_update_data[] = $all_cached_plugins->plugins[ $basename ];
4116
+ }
4117
+ }
4118
+
4119
+ // Find new plugins that weren't yet seen before.
4120
+ foreach ( $all_plugins as $basename => $data ) {
4121
+ if ( ! isset( $all_cached_plugins->plugins[ $basename ] ) ) {
4122
+ // New plugin.
4123
+ $new_plugin = array(
4124
+ 'slug' => $data['slug'],
4125
+ 'version' => $data['Version'],
4126
+ 'title' => $data['Name'],
4127
+ 'is_active' => $data['is_active'],
4128
+ 'is_uninstalled' => false,
4129
+ );
4130
+
4131
+ $plugins_update_data[] = $new_plugin;
4132
+ $all_cached_plugins->plugins[ $basename ] = $new_plugin;
4133
+ }
4134
+ }
4135
+
4136
+ $all_cached_plugins->md5 = md5( $plugins_signature );
4137
+ $all_cached_plugins->timestamp = $time;
4138
+ self::$_accounts->set_option( $option_name, $all_cached_plugins, true );
4139
+ }
4140
+
4141
+ return $plugins_update_data;
4142
+ }
4143
+
4144
+ /**
4145
+ * Return a list of modified themes since the last sync.
4146
+ *
4147
+ * Note:
4148
+ * There's no point to store a themes counter since even if the number of
4149
+ * themes didn't change, we still need to check if the versions are all the
4150
+ * same and the activity state is similar.
4151
+ *
4152
+ * @author Vova Feldman (@svovaf)
4153
+ * @since 1.1.8
4154
+ *
4155
+ * @return array|false
4156
+ */
4157
+ private function get_themes_data_for_api() {
4158
+ // Alias.
4159
+ $option_name = 'all_themes';
4160
+
4161
+ $all_cached_themes = self::$_accounts->get_option( $option_name );
4162
+
4163
+ if ( ! is_object( $all_cached_themes ) ) {
4164
+ $all_cached_themes = (object) array(
4165
+ 'timestamp' => '',
4166
+ 'md5' => '',
4167
+ 'themes' => array(),
4168
+ );
4169
+ }
4170
+
4171
+ $time = time();
4172
+
4173
+ if ( ! empty( $all_cached_themes->timestamp ) &&
4174
+ ( $time - $all_cached_themes->timestamp ) < WP_FS__TIME_5_MIN_IN_SEC
4175
+ ) {
4176
+ // Don't send theme updates if last update was in the past 5 min.
4177
+ return false;
4178
+ }
4179
+
4180
+ // Write timestamp to lock the logic.
4181
+ $all_cached_themes->timestamp = $time;
4182
+ self::$_accounts->set_option( $option_name, $all_cached_themes, true );
4183
+
4184
+ // Reload options from DB.
4185
+ self::$_accounts->load( true );
4186
+ $all_cached_themes = self::$_accounts->get_option( $option_name );
4187
+
4188
+ if ( $time != $all_cached_themes->timestamp ) {
4189
+ // If timestamp is different, then another thread captured the lock.
4190
+ return false;
4191
+ }
4192
+
4193
+ // Get active theme.
4194
+ $active_theme = wp_get_theme();
4195
+ $active_theme_stylesheet = $active_theme->get_stylesheet();
4196
+
4197
+ // Check if there's a change in themes.
4198
+ $all_themes = wp_get_themes();
4199
+
4200
+ // Check if themes changed.
4201
+ ksort( $all_themes );
4202
+
4203
+ $themes_signature = '';
4204
+ foreach ( $all_themes as $slug => $data ) {
4205
+ $is_active = ( $slug === $active_theme_stylesheet );
4206
+ $themes_signature .= $slug . ',' .
4207
+ $data->version . ',' .
4208
+ ( $is_active ? '1' : '0' ) . ';';
4209
+ }
4210
+
4211
+ // Check if themes status changed (version or active/inactive).
4212
+ $themes_changed = ( $all_cached_themes->md5 !== md5( $themes_signature ) );
4213
+
4214
+ $themes_update_data = array();
4215
+
4216
+ if ( $themes_changed ) {
4217
+ // Change in themes, report changes.
4218
+
4219
+ // Update existing themes info.
4220
+ foreach ( $all_cached_themes->themes as $slug => $data ) {
4221
+ $is_active = ( $slug === $active_theme_stylesheet );
4222
+
4223
+ if ( ! isset( $all_themes[ $slug ] ) ) {
4224
+ // Plugin uninstalled.
4225
+ $uninstalled_theme_data = $data;
4226
+ $uninstalled_theme_data['is_active'] = false;
4227
+ $uninstalled_theme_data['is_uninstalled'] = true;
4228
+ $themes_update_data[] = $uninstalled_theme_data;
4229
+
4230
+ unset( $all_themes[ $slug ] );
4231
+ unset( $all_cached_themes->themes[ $slug ] );
4232
+ } else if ( $data['is_active'] !== $is_active ||
4233
+ $data['version'] !== $all_themes[ $slug ]->version
4234
+ ) {
4235
+ // Plugin activated or deactivated, or version changed.
4236
+
4237
+ $all_cached_themes->themes[ $slug ]['is_active'] = $is_active;
4238
+ $all_cached_themes->themes[ $slug ]['version'] = $all_themes[ $slug ]->version;
4239
+
4240
+ $themes_update_data[] = $all_cached_themes->themes[ $slug ];
4241
+ }
4242
+ }
4243
+
4244
+ // Find new themes that weren't yet seen before.
4245
+ foreach ( $all_themes as $slug => $data ) {
4246
+ if ( ! isset( $all_cached_themes->themes[ $slug ] ) ) {
4247
+ $is_active = ( $slug === $active_theme_stylesheet );
4248
+
4249
+ // New plugin.
4250
+ $new_plugin = array(
4251
+ 'slug' => $slug,
4252
+ 'version' => $data->version,
4253
+ 'title' => $data->name,
4254
+ 'is_active' => $is_active,
4255
+ 'is_uninstalled' => false,
4256
+ );
4257
+
4258
+ $themes_update_data[] = $new_plugin;
4259
+ $all_cached_themes->themes[ $slug ] = $new_plugin;
4260
+ }
4261
+ }
4262
+
4263
+ $all_cached_themes->md5 = md5( $themes_signature );
4264
+ $all_cached_themes->timestamp = time();
4265
+ self::$_accounts->set_option( $option_name, $all_cached_themes, true );
4266
+ }
4267
+
4268
+ return $themes_update_data;
4269
+ }
4270
+
4271
+ /**
4272
+ * Update install details.
4273
+ *
4274
+ * @author Vova Feldman (@svovaf)
4275
+ * @since 1.1.2
4276
+ *
4277
+ * @param string[] string $override
4278
+ * @param bool $include_plugins Since 1.1.8 by default include plugin changes.
4279
+ * @param bool $include_themes Since 1.1.8 by default include plugin changes.
4280
+ *
4281
+ * @return array
4282
+ */
4283
+ private function get_install_data_for_api(
4284
+ array $override,
4285
+ $include_plugins = true,
4286
+ $include_themes = true
4287
+ ) {
4288
+ /**
4289
+ * @since 1.1.8 Also send plugin updates.
4290
+ */
4291
+ if ( $include_plugins && ! isset( $override['plugins'] ) ) {
4292
+ $plugins = $this->get_plugins_data_for_api();
4293
+ if ( ! empty( $plugins ) ) {
4294
+ $override['plugins'] = $plugins;
4295
+ }
4296
+ }
4297
+ /**
4298
+ * @since 1.1.8 Also send themes updates.
4299
+ */
4300
+ if ( $include_themes && ! isset( $override['themes'] ) ) {
4301
+ $themes = $this->get_themes_data_for_api();
4302
+ if ( ! empty( $themes ) ) {
4303
+ $override['themes'] = $themes;
4304
+ }
4305
+ }
4306
+
4307
+ return array_merge( array(
4308
+ 'version' => $this->get_plugin_version(),
4309
+ 'is_premium' => $this->is_premium(),
4310
+ 'language' => get_bloginfo( 'language' ),
4311
+ 'charset' => get_bloginfo( 'charset' ),
4312
+ 'platform_version' => get_bloginfo( 'version' ),
4313
+ 'sdk_version' => $this->version,
4314
+ 'programming_language_version' => phpversion(),
4315
+ 'title' => get_bloginfo( 'name' ),
4316
+ 'url' => get_site_url(),
4317
+ // Special params.
4318
+ 'is_active' => true,
4319
+ 'is_disconnected' => $this->is_tracking_prohibited(),
4320
+ 'is_uninstalled' => false,
4321
+ ), $override );
4322
+ }
4323
+
4324
+ /**
4325
+ * Update install only if changed.
4326
+ *
4327
+ * @author Vova Feldman (@svovaf)
4328
+ * @since 1.0.9
4329
+ *
4330
+ * @param string[] string $override
4331
+ * @param bool $flush
4332
+ *
4333
+ * @return false|object|string
4334
+ */
4335
+ private function send_install_update( $override = array(), $flush = false ) {
4336
+ $this->_logger->entrance();
4337
+
4338
+ $check_properties = $this->get_install_data_for_api( $override );
4339
+
4340
+ if ( $flush ) {
4341
+ $params = $check_properties;
4342
+ } else {
4343
+ $params = array();
4344
+ $special = array();
4345
+ $special_override = false;
4346
+
4347
+ foreach ( $check_properties as $p => $v ) {
4348
+ if ( property_exists( $this->_site, $p ) ) {
4349
+ if ( ( is_bool( $this->_site->{$p} ) || ! empty( $this->_site->{$p} ) ) &&
4350
+ $this->_site->{$p} != $v
4351
+ ) {
4352
+ $this->_site->{$p} = $v;
4353
+ $params[ $p ] = $v;
4354
+ }
4355
+ } else {
4356
+ $special[ $p ] = $v;
4357
+
4358
+ if ( isset( $override[ $p ] ) ||
4359
+ 'plugins' === $p ||
4360
+ 'themes' === $p
4361
+ ) {
4362
+ $special_override = true;
4363
+ }
4364
+ }
4365
+ }
4366
+
4367
+ if ( $special_override || 0 < count( $params ) ) {
4368
+ // Add special params only if has at least one
4369
+ // standard param, or if explicitly requested to
4370
+ // override a special param or a param which is not exist
4371
+ // in the install object.
4372
+ $params = array_merge( $params, $special );
4373
+ }
4374
+ }
4375
+
4376
+ if ( 0 < count( $params ) ) {
4377
+ // Update last install sync timestamp.
4378
+ $this->_storage->install_sync_timestamp = time();
4379
+
4380
+ $params['uid'] = $this->get_anonymous_id();
4381
+
4382
+ // Send updated values to FS.
4383
+ $site = $this->get_api_site_scope()->call( '/', 'put', $params );
4384
+
4385
+ if ( $this->is_api_result_entity( $site ) ) {
4386
+ // I successfully sent install update, clear scheduled sync if exist.
4387
+ $this->clear_install_sync_cron();
4388
+ }
4389
+
4390
+ return $site;
4391
+ }
4392
+
4393
+ return false;
4394
+ }
4395
+
4396
+ /**
4397
+ * Update install only if changed.
4398
+ *
4399
+ * @author Vova Feldman (@svovaf)
4400
+ * @since 1.0.9
4401
+ *
4402
+ * @param string[] string $override
4403
+ * @param bool $flush
4404
+ */
4405
+ private function sync_install( $override = array(), $flush = false ) {
4406
+ $this->_logger->entrance();
4407
+
4408
+ $site = $this->send_install_update( $override, $flush );
4409
+
4410
+ if ( false === $site ) {
4411
+ // No sync required.
4412
+ return;
4413
+ }
4414
+
4415
+ if ( ! $this->is_api_result_entity( $site ) ) {
4416
+ // Failed to sync, don't update locally.
4417
+ return;
4418
+ }
4419
+
4420
+ $plan = $this->get_plan();
4421
+ $this->_site = new FS_Site( $site );
4422
+ $this->_site->plan = $plan;
4423
+
4424
+ $this->_store_site( true );
4425
+ }
4426
+
4427
+ /**
4428
+ * Track install's custom event.
4429
+ *
4430
+ * IMPORTANT:
4431
+ * Custom event tracking is currently only supported for specific clients.
4432
+ * If you are not one of them, please don't use this method. If you will,
4433
+ * the API will simply ignore your request based on the plugin ID.
4434
+ *
4435
+ * Need custom tracking for your plugin or theme?
4436
+ * If you are interested in custom event tracking please contact yo@freemius.com
4437
+ * for further details.
4438
+ *
4439
+ * @author Vova Feldman (@svovaf)
4440
+ * @since 1.2.1
4441
+ *
4442
+ * @param string $name Event name.
4443
+ * @param array $properties Associative key/value array with primitive values only
4444
+ * @param bool $process_at A valid future date-time in the following format Y-m-d H:i:s.
4445
+ * @param bool $once If true, event will be tracked only once. IMPORTANT: Still trigger the API call.
4446
+ *
4447
+ * @return object|false Event data or FALSE on failure.
4448
+ *
4449
+ * @throws \Freemius_InvalidArgumentException
4450
+ */
4451
+ public function track_event( $name, $properties = array(), $process_at = false, $once = false ) {
4452
+ $this->_logger->entrance( http_build_query( array( 'name' => $name, 'once' => $once ) ) );
4453
+
4454
+ if ( ! $this->is_registered() ) {
4455
+ return false;
4456
+ }
4457
+
4458
+ $event = array( 'type' => $name );
4459
+
4460
+ if ( is_numeric( $process_at ) && $process_at > time() ) {
4461
+ $event['process_at'] = $process_at;
4462
+ }
4463
+
4464
+ if ( $once ) {
4465
+ $event['once'] = true;
4466
+ }
4467
+
4468
+ if ( ! empty( $properties ) ) {
4469
+ // Verify associative array values are primitive.
4470
+ foreach ( $properties as $k => $v ) {
4471
+ if ( ! is_scalar( $v ) ) {
4472
+ throw new Freemius_InvalidArgumentException( 'The $properties argument must be an associative key/value array with primitive values only.' );
4473
+ }
4474
+ }
4475
+
4476
+ $event['properties'] = $properties;
4477
+ }
4478
+
4479
+ $result = $this->get_api_site_scope()->call( 'events.json', 'post', $event );
4480
+
4481
+ return $this->is_api_error( $result ) ?
4482
+ false :
4483
+ $result;
4484
+ }
4485
+
4486
+ /**
4487
+ * Track install's custom event only once, but it still triggers the API call.
4488
+ *
4489
+ * IMPORTANT:
4490
+ * Custom event tracking is currently only supported for specific clients.
4491
+ * If you are not one of them, please don't use this method. If you will,
4492
+ * the API will simply ignore your request based on the plugin ID.
4493
+ *
4494
+ * Need custom tracking for your plugin or theme?
4495
+ * If you are interested in custom event tracking please contact yo@freemius.com
4496
+ * for further details.
4497
+ *
4498
+ * @author Vova Feldman (@svovaf)
4499
+ * @since 1.2.1
4500
+ *
4501
+ * @param string $name Event name.
4502
+ * @param array $properties Associative key/value array with primitive values only
4503
+ * @param bool $process_at A valid future date-time in the following format Y-m-d H:i:s.
4504
+ *
4505
+ * @return object|false Event data or FALSE on failure.
4506
+ *
4507
+ * @throws \Freemius_InvalidArgumentException
4508
+ *
4509
+ * @user Freemius::track_event()
4510
+ */
4511
+ public function track_event_once( $name, $properties = array(), $process_at = false ) {
4512
+ return $this->track_event( $name, $properties, $process_at, true );
4513
+ }
4514
+
4515
+ /**
4516
+ * Plugin uninstall hook.
4517
+ *
4518
+ * @author Vova Feldman (@svovaf)
4519
+ * @since 1.0.1
4520
+ *
4521
+ * @param bool $check_user Enforce checking if user have plugins activation privileges.
4522
+ */
4523
+ function _uninstall_plugin_event( $check_user = true ) {
4524
+ $this->_logger->entrance( 'slug = ' . $this->_slug );
4525
+
4526
+ if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
4527
+ return;
4528
+ }
4529
+
4530
+ $params = array();
4531
+ $uninstall_reason = null;
4532
+ if ( isset( $this->_storage->uninstall_reason ) ) {
4533
+ $uninstall_reason = $this->_storage->uninstall_reason;
4534
+ $params['reason_id'] = $uninstall_reason->id;
4535
+ $params['reason_info'] = $uninstall_reason->info;
4536
+ }
4537
+
4538
+ if ( ! $this->is_registered() && isset( $uninstall_reason ) ) {
4539
+ // Send anonymous uninstall event only if user submitted a feedback.
4540
+ if ( isset( $uninstall_reason->is_anonymous ) && ! $uninstall_reason->is_anonymous ) {
4541
+ $this->opt_in( false, false, false, false, true );
4542
+ } else {
4543
+ $params['uid'] = $this->get_anonymous_id();
4544
+ $this->get_api_plugin_scope()->call( 'uninstall.json', 'put', $params );
4545
+ }
4546
+ } else {
4547
+ // Send uninstall event.
4548
+ $this->send_install_update( array_merge( $params, array(
4549
+ 'is_active' => false,
4550
+ 'is_uninstalled' => true,
4551
+ ) ) );
4552
+ }
4553
+
4554
+ // @todo Decide if we want to delete plugin information from db.
4555
+ }
4556
+
4557
+ /**
4558
+ * @author Vova Feldman (@svovaf)
4559
+ * @since 1.1.1
4560
+ *
4561
+ * @return string
4562
+ */
4563
+ private function premium_plugin_basename() {
4564
+ return preg_replace( '/\//', '-premium/', $this->_free_plugin_basename, 1 );
4565
+ }
4566
+
4567
+ /**
4568
+ * Uninstall plugin hook. Called only when connected his account with Freemius for active sites tracking.
4569
+ *
4570
+ * @author Vova Feldman (@svovaf)
4571
+ * @since 1.0.2
4572
+ */
4573
+ public static function _uninstall_plugin_hook() {
4574
+ self::_load_required_static();
4575
+
4576
+ self::$_static_logger->entrance();
4577
+
4578
+ if ( ! current_user_can( 'activate_plugins' ) ) {
4579
+ return;
4580
+ }
4581
+
4582
+ $plugin_file = substr( current_filter(), strlen( 'uninstall_' ) );
4583
+
4584
+ self::$_static_logger->info( 'plugin = ' . $plugin_file );
4585
+
4586
+ define( 'WP_FS__UNINSTALL_MODE', true );
4587
+
4588
+ $fs = self::get_instance_by_file( $plugin_file );
4589
+
4590
+ if ( is_object( $fs ) ) {
4591
+ self::require_plugin_essentials();
4592
+
4593
+ if ( is_plugin_active( $fs->_free_plugin_basename ) ||
4594
+ is_plugin_active( $fs->premium_plugin_basename() )
4595
+ ) {
4596
+ // Deleting Free or Premium plugin version while the other version still installed.
4597
+ return;
4598
+ }
4599
+
4600
+ $fs->_uninstall_plugin_event();
4601
+
4602
+ $fs->do_action( 'after_uninstall' );
4603
+ }
4604
+ }
4605
+
4606
+ #----------------------------------------------------------------------------------
4607
+ #region Plugin Information
4608
+ #----------------------------------------------------------------------------------
4609
+
4610
+ /**
4611
+ * Load WordPress core plugin.php essential module.
4612
+ *
4613
+ * @author Vova Feldman (@svovaf)
4614
+ * @since 1.1.1
4615
+ */
4616
+ private static function require_plugin_essentials() {
4617
+ if ( ! function_exists( 'get_plugins' ) ) {
4618
+ self::$_static_logger->log( 'Including wp-admin/includes/plugin.php...' );
4619
+
4620
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
4621
+ }
4622
+ }
4623
+
4624
+ /**
4625
+ * Load WordPress core pluggable.php module.
4626
+ *
4627
+ * @author Vova Feldman (@svovaf)
4628
+ * @since 1.1.2
4629
+ */
4630
+ private static function require_pluggable_essentials() {
4631
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
4632
+ require_once( ABSPATH . 'wp-includes/pluggable.php' );
4633
+ }
4634
+ }
4635
+
4636
+ /**
4637
+ * Return plugin data.
4638
+ *
4639
+ * @author Vova Feldman (@svovaf)
4640
+ * @since 1.0.1
4641
+ *
4642
+ * @return array
4643
+ */
4644
+ function get_plugin_data() {
4645
+ if ( ! isset( $this->_plugin_data ) ) {
4646
+ self::require_plugin_essentials();
4647
+
4648
+ /**
4649
+ * @author Vova Feldman (@svovaf)
4650
+ * @since 1.2.0 When using get_plugin_data() do NOT translate plugin data.
4651
+ *
4652
+ * @link https://github.com/Freemius/wordpress-sdk/issues/77
4653
+ */
4654
+ $this->_plugin_data = get_plugin_data(
4655
+ $this->_plugin_main_file_path,
4656
+ false,
4657
+ false
4658
+ );
4659
+ }
4660
+
4661
+ return $this->_plugin_data;
4662
+ }
4663
+
4664
+ /**
4665
+ * @author Vova Feldman (@svovaf)
4666
+ * @since 1.0.1
4667
+ *
4668
+ * @return string Plugin slug.
4669
+ */
4670
+ function get_slug() {
4671
+ return $this->_slug;
4672
+ }
4673
+
4674
+ /**
4675
+ * @author Vova Feldman (@svovaf)
4676
+ * @since 1.0.1
4677
+ *
4678
+ * @return number Plugin ID.
4679
+ */
4680
+ function get_id() {
4681
+ return $this->_plugin->id;
4682
+ }
4683
+
4684
+ /**
4685
+ * @author Vova Feldman (@svovaf)
4686
+ * @since 1.2.1.5
4687
+ *
4688
+ * @return string Freemius SDK version
4689
+ */
4690
+ function get_sdk_version() {
4691
+ return $this->version;
4692
+ }
4693
+
4694
+ /**
4695
+ * @author Vova Feldman (@svovaf)
4696
+ * @since 1.2.1.5
4697
+ *
4698
+ * @return number Parent plugin ID (if parent exist).
4699
+ */
4700
+ function get_parent_id() {
4701
+ return $this->is_addon() ?
4702
+ $this->get_parent_instance()->get_id() :
4703
+ $this->_plugin->id;
4704
+ }
4705
+
4706
+ /**
4707
+ * @author Vova Feldman (@svovaf)
4708
+ * @since 1.0.1
4709
+ *
4710
+ * @return string Plugin public key.
4711
+ */
4712
+ function get_public_key() {
4713
+ return $this->_plugin->public_key;
4714
+ }
4715
+
4716
+ /**
4717
+ * Will be available only on sandbox mode.
4718
+ *
4719
+ * @author Vova Feldman (@svovaf)
4720
+ * @since 1.0.4
4721
+ *
4722
+ * @return mixed Plugin secret key.
4723
+ */
4724
+ function get_secret_key() {
4725
+ return $this->_plugin->secret_key;
4726
+ }
4727
+
4728
+ /**
4729
+ * @author Vova Feldman (@svovaf)
4730
+ * @since 1.1.1
4731
+ *
4732
+ * @return bool
4733
+ */
4734
+ function has_secret_key() {
4735
+ return ! empty( $this->_plugin->secret_key );
4736
+ }
4737
+
4738
+ /**
4739
+ * @author Vova Feldman (@svovaf)
4740
+ * @since 1.0.9
4741
+ *
4742
+ * @return string
4743
+ */
4744
+ function get_plugin_name() {
4745
+ $this->_logger->entrance();
4746
+
4747
+ if ( ! isset( $this->_plugin_name ) ) {
4748
+ $plugin_data = $this->get_plugin_data();
4749
+
4750
+ // Get name.
4751
+ $this->_plugin_name = $plugin_data['Name'];
4752
+
4753
+ // Check if plugin name contains [Premium] suffix and remove it.
4754
+ $suffix = '[premium]';
4755
+ $suffix_len = strlen( $suffix );
4756
+
4757
+ if ( strlen( $plugin_data['Name'] ) > $suffix_len &&
4758
+ $suffix === substr( strtolower( $plugin_data['Name'] ), - $suffix_len )
4759
+ ) {
4760
+ $this->_plugin_name = substr( $plugin_data['Name'], 0, - $suffix_len );
4761
+ }
4762
+
4763
+ $this->_logger->departure( 'Name = ' . $this->_plugin_name );
4764
+ }
4765
+
4766
+ return $this->_plugin_name;
4767
+ }
4768
+
4769
+ /**
4770
+ * @author Vova Feldman (@svovaf)
4771
+ * @since 1.0.0
4772
+ *
4773
+ * @return string
4774
+ */
4775
+ function get_plugin_version() {
4776
+ $this->_logger->entrance();
4777
+
4778
+ $plugin_data = $this->get_plugin_data();
4779
+
4780
+ $this->_logger->departure( 'Version = ' . $plugin_data['Version'] );
4781
+
4782
+ return $this->apply_filters( 'plugin_version', $plugin_data['Version'] );
4783
+ }
4784
+
4785
+ /**
4786
+ * @author Vova Feldman (@svovaf)
4787
+ * @since 1.0.4
4788
+ *
4789
+ * @return string
4790
+ */
4791
+ function get_plugin_basename() {
4792
+ return $this->_plugin_basename;
4793
+ }
4794
+
4795
+ function get_plugin_folder_name() {
4796
+ $this->_logger->entrance();
4797
+
4798
+ $plugin_folder = $this->_plugin_basename;
4799
+
4800
+ while ( '.' !== dirname( $plugin_folder ) ) {
4801
+ $plugin_folder = dirname( $plugin_folder );
4802
+ }
4803
+
4804
+ $this->_logger->departure( 'Folder Name = ' . $plugin_folder );
4805
+
4806
+ return $plugin_folder;
4807
+ }
4808
+
4809
+ #endregion ------------------------------------------------------------------
4810
+
4811
+ /* Account
4812
+ ------------------------------------------------------------------------------------------------------------------*/
4813
+
4814
+ /**
4815
+ * Find plugin's slug by plugin's basename.
4816
+ *
4817
+ * @author Vova Feldman (@svovaf)
4818
+ * @since 1.0.9
4819
+ *
4820
+ * @param string $plugin_base_name
4821
+ *
4822
+ * @return false|string
4823
+ */
4824
+ private static function find_slug_by_basename( $plugin_base_name ) {
4825
+ $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
4826
+
4827
+ if ( ! array( $file_slug_map ) || ! isset( $file_slug_map[ $plugin_base_name ] ) ) {
4828
+ return false;
4829
+ }
4830
+
4831
+ return $file_slug_map[ $plugin_base_name ];
4832
+ }
4833
+
4834
+ /**
4835
+ * Store the map between the plugin's basename to the slug.
4836
+ *
4837
+ * @author Vova Feldman (@svovaf)
4838
+ * @since 1.0.9
4839
+ */
4840
+ private function store_file_slug_map() {
4841
+ $file_slug_map = self::$_accounts->get_option( 'file_slug_map', array() );
4842
+
4843
+ if ( ! array( $file_slug_map ) ) {
4844
+ $file_slug_map = array();
4845
+ }
4846
+
4847
+ if ( ! isset( $file_slug_map[ $this->_plugin_basename ] ) ||
4848
+ $file_slug_map[ $this->_plugin_basename ] !== $this->_slug
4849
+ ) {
4850
+ $file_slug_map[ $this->_plugin_basename ] = $this->_slug;
4851
+ self::$_accounts->set_option( 'file_slug_map', $file_slug_map, true );
4852
+ }
4853
+ }
4854
+
4855
+ /**
4856
+ * @return FS_User[]
4857
+ */
4858
+ static function get_all_users() {
4859
+ $users = self::$_accounts->get_option( 'users', array() );
4860
+
4861
+ if ( ! is_array( $users ) ) {
4862
+ $users = array();
4863
+ }
4864
+
4865
+ return $users;
4866
+ }
4867
+
4868
+ /**
4869
+ * @return FS_Site[]
4870
+ */
4871
+ private static function get_all_sites() {
4872
+ $sites = self::$_accounts->get_option( 'sites', array() );
4873
+
4874
+ if ( ! is_array( $sites ) ) {
4875
+ $sites = array();
4876
+ }
4877
+
4878
+ return $sites;
4879
+ }
4880
+
4881
+ /**
4882
+ * @author Vova Feldman (@svovaf)
4883
+ * @since 1.0.6
4884
+ *
4885
+ * @return FS_Plugin_License[]
4886
+ */
4887
+ private static function get_all_licenses() {
4888
+ $licenses = self::$_accounts->get_option( 'licenses', array() );
4889
+
4890
+ if ( ! is_array( $licenses ) ) {
4891
+ $licenses = array();
4892
+ }
4893
+
4894
+ return $licenses;
4895
+ }
4896
+
4897
+ /**
4898
+ * @return FS_Plugin_Plan[]
4899
+ */
4900
+ private static function get_all_plans() {
4901
+ $plans = self::$_accounts->get_option( 'plans', array() );
4902
+
4903
+ if ( ! is_array( $plans ) ) {
4904
+ $plans = array();
4905
+ }
4906
+
4907
+ return $plans;
4908
+ }
4909
+
4910
+ /**
4911
+ * @author Vova Feldman (@svovaf)
4912
+ * @since 1.0.4
4913
+ *
4914
+ * @return FS_Plugin_Tag[]
4915
+ */
4916
+ private static function get_all_updates() {
4917
+ $updates = self::$_accounts->get_option( 'updates', array() );
4918
+
4919
+ if ( ! is_array( $updates ) ) {
4920
+ $updates = array();
4921
+ }
4922
+
4923
+ return $updates;
4924
+ }
4925
+
4926
+ /**
4927
+ * @author Vova Feldman (@svovaf)
4928
+ * @since 1.0.6
4929
+ *
4930
+ * @return array<number,FS_Plugin[]>|false
4931
+ */
4932
+ private static function get_all_addons() {
4933
+ $addons = self::$_accounts->get_option( 'addons', array() );
4934
+
4935
+ if ( ! is_array( $addons ) ) {
4936
+ $addons = array();
4937
+ }
4938
+
4939
+ return $addons;
4940
+ }
4941
+
4942
+ /**
4943
+ * @author Vova Feldman (@svovaf)
4944
+ * @since 1.0.6
4945
+ *
4946
+ * @return FS_Plugin[]|false
4947
+ */
4948
+ private static function get_all_account_addons() {
4949
+ $addons = self::$_accounts->get_option( 'account_addons', array() );
4950
+
4951
+ if ( ! is_array( $addons ) ) {
4952
+ $addons = array();
4953
+ }
4954
+
4955
+ return $addons;
4956
+ }
4957
+
4958
+ /**
4959
+ * Check if user is registered.
4960
+ *
4961
+ * @author Vova Feldman (@svovaf)
4962
+ * @since 1.0.1
4963
+ * @return bool
4964
+ */
4965
+ function is_registered() {
4966
+ return is_object( $this->_user );
4967
+ }
4968
+
4969
+ /**
4970
+ * Returns TRUE if the user opted-in and didn't disconnect (opt-out).
4971
+ *
4972
+ * @author Leo Fajardo (@leorw)
4973
+ * @since 1.2.1.5
4974
+ *
4975
+ * @return bool
4976
+ */
4977
+ function is_tracking_allowed() {
4978
+ return ( is_object( $this->_site ) && true !== $this->_site->is_disconnected );
4979
+ }
4980
+
4981
+ /**
4982
+ * @author Vova Feldman (@svovaf)
4983
+ * @since 1.0.4
4984
+ *
4985
+ * @return FS_Plugin
4986
+ */
4987
+ function get_plugin() {
4988
+ return $this->_plugin;
4989
+ }
4990
+
4991
+ /**
4992
+ * @author Vova Feldman (@svovaf)
4993
+ * @since 1.0.3
4994
+ *
4995
+ * @return FS_User
4996
+ */
4997
+ function get_user() {
4998
+ return $this->_user;
4999
+ }
5000
+
5001
+ /**
5002
+ * @author Vova Feldman (@svovaf)
5003
+ * @since 1.0.3
5004
+ *
5005
+ * @return FS_Site
5006
+ */
5007
+ function get_site() {
5008
+ return $this->_site;
5009
+ }
5010
+
5011
+ /**
5012
+ * Get plugin add-ons.
5013
+ *
5014
+ * @author Vova Feldman (@svovaf)
5015
+ * @since 1.0.6
5016
+ *
5017
+ * @since 1.1.7.3 If not yet loaded, fetch data from the API.
5018
+ *
5019
+ * @param bool $flush
5020
+ *
5021
+ * @return FS_Plugin[]|false
5022
+ */
5023
+ function get_addons( $flush = false ) {
5024
+ $this->_logger->entrance();
5025
+
5026
+ if ( ! $this->_has_addons ) {
5027
+ return false;
5028
+ }
5029
+
5030
+ $addons = $this->_sync_addons( $flush );
5031
+
5032
+ return ( ! is_array( $addons ) || empty( $addons ) ) ?
5033
+ false :
5034
+ $addons;
5035
+ }
5036
+
5037
+ /**
5038
+ * @author Vova Feldman (@svovaf)
5039
+ * @since 1.0.6
5040
+ *
5041
+ * @return FS_Plugin[]|false
5042
+ */
5043
+ function get_account_addons() {
5044
+ $this->_logger->entrance();
5045
+
5046
+ $addons = self::get_all_account_addons();
5047
+
5048
+ if ( ! is_array( $addons ) ||
5049
+ ! isset( $addons[ $this->_plugin->id ] ) ||
5050
+ ! is_array( $addons[ $this->_plugin->id ] ) ||
5051
+ 0 === count( $addons[ $this->_plugin->id ] )
5052
+ ) {
5053
+ return false;
5054
+ }
5055
+
5056
+ return $addons[ $this->_plugin->id ];
5057
+ }
5058
+
5059
+ /**
5060
+ * Check if user has any
5061
+ *
5062
+ * @author Vova Feldman (@svovaf)
5063
+ * @since 1.1.6
5064
+ *
5065
+ * @return bool
5066
+ */
5067
+ function has_account_addons() {
5068
+ $addons = $this->get_account_addons();
5069
+
5070
+ return is_array( $addons ) && ( 0 < count( $addons ) );
5071
+ }
5072
+
5073
+
5074
+ /**
5075
+ * Get add-on by ID (from local data).
5076
+ *
5077
+ * @author Vova Feldman (@svovaf)
5078
+ * @since 1.0.6
5079
+ *
5080
+ * @param number $id
5081
+ *
5082
+ * @return FS_Plugin|false
5083
+ */
5084
+ function get_addon( $id ) {
5085
+ $this->_logger->entrance();
5086
+
5087
+ $addons = $this->get_addons();
5088
+
5089
+ if ( is_array( $addons ) ) {
5090
+ foreach ( $addons as $addon ) {
5091
+ if ( $id == $addon->id ) {
5092
+ return $addon;
5093
+ }
5094
+ }
5095
+ }
5096
+
5097
+ return false;
5098
+ }
5099
+
5100
+ /**
5101
+ * Get add-on by slug (from local data).
5102
+ *
5103
+ * @author Vova Feldman (@svovaf)
5104
+ * @since 1.0.6
5105
+ *
5106
+ * @param string $slug
5107
+ *
5108
+ * @param bool $flush
5109
+ *
5110
+ * @return FS_Plugin|false
5111
+ */
5112
+ function get_addon_by_slug( $slug, $flush = false ) {
5113
+ $this->_logger->entrance();
5114
+
5115
+ $addons = $this->get_addons( $flush );
5116
+
5117
+ if ( is_array( $addons ) ) {
5118
+ foreach ( $addons as $addon ) {
5119
+ if ( $slug === $addon->slug ) {
5120
+ return $addon;
5121
+ }
5122
+ }
5123
+ }
5124
+
5125
+ return false;
5126
+ }
5127
+
5128
+ #----------------------------------------------------------------------------------
5129
+ #region Plans & Licensing
5130
+ #----------------------------------------------------------------------------------
5131
+
5132
+ /**
5133
+ * Check if running premium plugin code.
5134
+ *
5135
+ * @author Vova Feldman (@svovaf)
5136
+ * @since 1.0.5
5137
+ *
5138
+ * @return bool
5139
+ */
5140
+ function is_premium() {
5141
+ return $this->_plugin->is_premium;
5142
+ }
5143
+
5144
+ /**
5145
+ * Get site's plan ID.
5146
+ *
5147
+ * @author Vova Feldman (@svovaf)
5148
+ * @since 1.0.2
5149
+ *
5150
+ * @return number
5151
+ */
5152
+ function get_plan_id() {
5153
+ return $this->_site->plan->id;
5154
+ }
5155
+
5156
+ /**
5157
+ * Get site's plan title.
5158
+ *
5159
+ * @author Vova Feldman (@svovaf)
5160
+ * @since 1.0.2
5161
+ *
5162
+ * @return string
5163
+ */
5164
+ function get_plan_title() {
5165
+ return $this->_site->plan->title;
5166
+ }
5167
+
5168
+ /**
5169
+ * @author Vova Feldman (@svovaf)
5170
+ * @since 1.0.9
5171
+ *
5172
+ * @return FS_Plugin_Plan|false
5173
+ */
5174
+ function get_plan() {
5175
+ return is_object( $this->_site->plan ) ?
5176
+ $this->_site->plan :
5177
+ false;
5178
+ }
5179
+
5180
+ /**
5181
+ * @author Vova Feldman (@svovaf)
5182
+ * @since 1.0.3
5183
+ *
5184
+ * @return bool
5185
+ */
5186
+ function is_trial() {
5187
+ $this->_logger->entrance();
5188
+
5189
+ if ( ! $this->is_registered() ) {
5190
+ return false;
5191
+ }
5192
+
5193
+ return $this->_site->is_trial();
5194
+ }
5195
+
5196
+ /**
5197
+ * Check if currently in a trial with payment method (credit card or paypal).
5198
+ *
5199
+ * @author Vova Feldman (@svovaf)
5200
+ * @since 1.1.7
5201
+ *
5202
+ * @return bool
5203
+ */
5204
+ function is_paid_trial() {
5205
+ $this->_logger->entrance();
5206
+
5207
+ if ( ! $this->is_trial() ) {
5208
+ return false;
5209
+ }
5210
+
5211
+ return $this->has_active_valid_license() && ( $this->_site->trial_plan_id == $this->_license->plan_id );
5212
+ }
5213
+
5214
+ /**
5215
+ * Check if trial already utilized.
5216
+ *
5217
+ * @since 1.0.9
5218
+ *
5219
+ * @return bool
5220
+ */
5221
+ function is_trial_utilized() {
5222
+ $this->_logger->entrance();
5223
+
5224
+ if ( ! $this->is_registered() ) {
5225
+ return false;
5226
+ }
5227
+
5228
+ return $this->_site->is_trial_utilized();
5229
+ }
5230
+
5231
+ /**
5232
+ * Get trial plan information (if in trial).
5233
+ *
5234
+ * @author Vova Feldman (@svovaf)
5235
+ * @since 1.0.9
5236
+ *
5237
+ * @return bool|FS_Plugin_Plan
5238
+ */
5239
+ function get_trial_plan() {
5240
+ $this->_logger->entrance();
5241
+
5242
+ if ( ! $this->is_trial() ) {
5243
+ return false;
5244
+ }
5245
+
5246
+ return $this->_storage->trial_plan;
5247
+ }
5248
+
5249
+ /**
5250
+ * Check if the user has an activate, non-expired license on current plugin's install.
5251
+ *
5252
+ * @since 1.0.9
5253
+ *
5254
+ * @return bool
5255
+ */
5256
+ function is_paying() {
5257
+ $this->_logger->entrance();
5258
+
5259
+ if ( ! $this->is_registered() ) {
5260
+ return false;
5261
+ }
5262
+
5263
+ if ( ! $this->has_paid_plan() ) {
5264
+ return false;
5265
+ }
5266
+
5267
+ return (
5268
+ ! $this->is_trial() &&
5269
+ 'free' !== $this->_site->plan->name &&
5270
+ $this->has_active_valid_license()
5271
+ );
5272
+ }
5273
+
5274
+ /**
5275
+ * @author Vova Feldman (@svovaf)
5276
+ * @since 1.0.4
5277
+ *
5278
+ * @return bool
5279
+ */
5280
+ function is_free_plan() {
5281
+ if ( ! $this->is_registered() ) {
5282
+ return true;
5283
+ }
5284
+
5285
+ if ( ! $this->has_paid_plan() ) {
5286
+ return true;
5287
+ }
5288
+
5289
+ return (
5290
+ 'free' === $this->_site->plan->name ||
5291
+ ! $this->has_features_enabled_license()
5292
+ );
5293
+ }
5294
+
5295
+ /**
5296
+ * @author Vova Feldman (@svovaf)
5297
+ * @since 1.0.5
5298
+ *
5299
+ * @return bool
5300
+ */
5301
+ function _has_premium_license() {
5302
+ $this->_logger->entrance();
5303
+
5304
+ $premium_license = $this->_get_available_premium_license();
5305
+
5306
+ return ( false !== $premium_license );
5307
+ }
5308
+
5309
+ /**
5310
+ * Check if user has any licenses associated with the plugin (including expired or blocking).
5311
+ *
5312
+ * @author Vova Feldman (@svovaf)
5313
+ * @since 1.1.7.3
5314
+ *
5315
+ * @return bool
5316
+ */
5317
+ private function has_any_license() {
5318
+ return is_array( $this->_licenses ) && ( 0 < count( $this->_licenses ) );
5319
+ }
5320
+
5321
+ /**
5322
+ * @author Vova Feldman (@svovaf)
5323
+ * @since 1.0.5
5324
+ *
5325
+ * @return FS_Plugin_License|false
5326
+ */
5327
+ function _get_available_premium_license() {
5328
+ $this->_logger->entrance();
5329
+
5330
+ if ( ! $this->has_paid_plan() ) {
5331
+ return false;
5332
+ }
5333
+
5334
+ if ( is_array( $this->_licenses ) ) {
5335
+ foreach ( $this->_licenses as $license ) {
5336
+ if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
5337
+ return $license;
5338
+ }
5339
+ }
5340
+ }
5341
+
5342
+ return false;
5343
+ }
5344
+
5345
+ /**
5346
+ * Sync local plugin plans with remote server.
5347
+ *
5348
+ * @author Vova Feldman (@svovaf)
5349
+ * @since 1.0.5
5350
+ *
5351
+ * @return FS_Plugin_Plan[]|object
5352
+ */
5353
+ function _sync_plans() {
5354
+ $plans = $this->_fetch_plugin_plans();
5355
+
5356
+ if ( $this->is_array_instanceof( $plans, 'FS_Plugin_Plan' ) ) {
5357
+ $this->_plans = $plans;
5358
+ $this->_store_plans();
5359
+ }
5360
+
5361
+ $this->do_action( 'after_plans_sync', $plans );
5362
+
5363
+ return $this->_plans;
5364
+ }
5365
+
5366
+ /**
5367
+ * @author Vova Feldman (@svovaf)
5368
+ * @since 1.0.5
5369
+ *
5370
+ * @param number $id
5371
+ *
5372
+ * @return FS_Plugin_Plan|false
5373
+ */
5374
+ function _get_plan_by_id( $id ) {
5375
+ $this->_logger->entrance();
5376
+
5377
+ if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
5378
+ $this->_sync_plans();
5379
+ }
5380
+
5381
+ foreach ( $this->_plans as $plan ) {
5382
+ if ( $id == $plan->id ) {
5383
+ return $plan;
5384
+ }
5385
+ }
5386
+
5387
+ return false;
5388
+ }
5389
+
5390
+ /**
5391
+ * @author Vova Feldman (@svovaf)
5392
+ * @since 1.1.8.1
5393
+ *
5394
+ * @param string $name
5395
+ *
5396
+ * @return FS_Plugin_Plan|false
5397
+ */
5398
+ private function get_plan_by_name( $name ) {
5399
+ $this->_logger->entrance();
5400
+
5401
+ if ( ! is_array( $this->_plans ) || 0 === count( $this->_plans ) ) {
5402
+ $this->_sync_plans();
5403
+ }
5404
+
5405
+ foreach ( $this->_plans as $plan ) {
5406
+ if ( $name == $plan->name ) {
5407
+ return $plan;
5408
+ }
5409
+ }
5410
+
5411
+ return false;
5412
+ }
5413
+
5414
+ /**
5415
+ * Sync local plugin plans with remote server.
5416
+ *
5417
+ * @author Vova Feldman (@svovaf)
5418
+ * @since 1.0.6
5419
+ *
5420
+ * @param number|bool $site_license_id
5421
+ *
5422
+ * @return FS_Plugin_License[]|object
5423
+ */
5424
+ function _sync_licenses( $site_license_id = false ) {
5425
+ $licenses = $this->_fetch_licenses( false, $site_license_id );
5426
+
5427
+ if ( $this->is_array_instanceof( $licenses, 'FS_Plugin_License' ) ) {
5428
+ $this->_licenses = $licenses;
5429
+ $this->_store_licenses();
5430
+ }
5431
+
5432
+ // Update current license.
5433
+ if ( is_object( $this->_license ) ) {
5434
+ $this->_license = $this->_get_license_by_id( $this->_license->id );
5435
+ }
5436
+
5437
+ return $this->_licenses;
5438
+ }
5439
+
5440
+ /**
5441
+ * @author Vova Feldman (@svovaf)
5442
+ * @since 1.0.5
5443
+ *
5444
+ * @param number $id
5445
+ *
5446
+ * @return FS_Plugin_License|false
5447
+ */
5448
+ function _get_license_by_id( $id ) {
5449
+ $this->_logger->entrance();
5450
+
5451
+ if ( ! is_numeric( $id ) ) {
5452
+ return false;
5453
+ }
5454
+
5455
+ if ( ! $this->has_any_license() ) {
5456
+ $this->_sync_licenses();
5457
+ }
5458
+
5459
+ foreach ( $this->_licenses as $license ) {
5460
+ if ( $id == $license->id ) {
5461
+ return $license;
5462
+ }
5463
+ }
5464
+
5465
+ return false;
5466
+ }
5467
+
5468
+ /**
5469
+ * Sync site's license with user licenses.
5470
+ *
5471
+ * @author Vova Feldman (@svovaf)
5472
+ * @since 1.0.6
5473
+ *
5474
+ * @param FS_Plugin_License|null $new_license
5475
+ */
5476
+ function _update_site_license( $new_license ) {
5477
+ $this->_logger->entrance();
5478
+
5479
+ $this->_license = $new_license;
5480
+
5481
+ if ( ! is_object( $new_license ) ) {
5482
+ $this->_site->license_id = null;
5483
+ $this->_sync_site_subscription( null );
5484
+
5485
+ return;
5486
+ }
5487
+
5488
+ $this->_site->license_id = $this->_license->id;
5489
+
5490
+ if ( ! is_array( $this->_licenses ) ) {
5491
+ $this->_licenses = array();
5492
+ }
5493
+
5494
+ $is_license_found = false;
5495
+ for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
5496
+ if ( $new_license->id == $this->_licenses[ $i ]->id ) {
5497
+ $this->_licenses[ $i ] = $new_license;
5498
+
5499
+ $is_license_found = true;
5500
+ break;
5501
+ }
5502
+ }
5503
+
5504
+ // If new license just append.
5505
+ if ( ! $is_license_found ) {
5506
+ $this->_licenses[] = $new_license;
5507
+ }
5508
+
5509
+ $this->_sync_site_subscription( $new_license );
5510
+ }
5511
+
5512
+ /**
5513
+ * Sync site's subscription.
5514
+ *
5515
+ * @author Vova Feldman (@svovaf)
5516
+ * @since 1.0.9
5517
+ *
5518
+ * @param FS_Plugin_License|null $license
5519
+ *
5520
+ * @return bool|\FS_Subscription
5521
+ */
5522
+ private function _sync_site_subscription( $license ) {
5523
+ if ( ! is_object( $license ) ) {
5524
+ unset( $this->_storage->subscription );
5525
+
5526
+ return false;
5527
+ }
5528
+
5529
+ // Load subscription details if not lifetime.
5530
+ $subscription = $license->is_lifetime() ?
5531
+ false :
5532
+ $this->_fetch_site_license_subscription();
5533
+
5534
+ if ( is_object( $subscription ) && ! isset( $subscription->error ) ) {
5535
+ $this->_storage->subscription = $subscription;
5536
+ } else {
5537
+ unset( $this->_storage->subscription );
5538
+ }
5539
+
5540
+ return $subscription;
5541
+ }
5542
+
5543
+ /**
5544
+ * @author Vova Feldman (@svovaf)
5545
+ * @since 1.0.6
5546
+ *
5547
+ * @return bool|\FS_Plugin_License
5548
+ */
5549
+ function _get_license() {
5550
+ return $this->_license;
5551
+ }
5552
+
5553
+ /**
5554
+ * @return bool|\FS_Subscription
5555
+ */
5556
+ function _get_subscription() {
5557
+ return isset( $this->_storage->subscription ) ?
5558
+ $this->_storage->subscription :
5559
+ false;
5560
+ }
5561
+
5562
+ /**
5563
+ * @author Vova Feldman (@svovaf)
5564
+ * @since 1.0.2
5565
+ *
5566
+ * @param string $plan Plan name
5567
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
5568
+ *
5569
+ * @return bool
5570
+ */
5571
+ function is_plan( $plan, $exact = false ) {
5572
+ $this->_logger->entrance();
5573
+
5574
+ if ( ! $this->is_registered() ) {
5575
+ return false;
5576
+ }
5577
+
5578
+ $plan = strtolower( $plan );
5579
+
5580
+ if ( $this->_site->plan->name === $plan ) // Exact plan.
5581
+ {
5582
+ return true;
5583
+ } else if ( $exact ) // Required exact, but plans are different.
5584
+ {
5585
+ return false;
5586
+ }
5587
+
5588
+ $current_plan_order = - 1;
5589
+ $required_plan_order = - 1;
5590
+ for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
5591
+ if ( $plan === $this->_plans[ $i ]->name ) {
5592
+ $required_plan_order = $i;
5593
+ } else if ( $this->_site->plan->name === $this->_plans[ $i ]->name ) {
5594
+ $current_plan_order = $i;
5595
+ }
5596
+ }
5597
+
5598
+ return ( $current_plan_order > $required_plan_order );
5599
+ }
5600
+
5601
+ /**
5602
+ * Check if plan based on trial. If not in trial mode, should return false.
5603
+ *
5604
+ * @since 1.0.9
5605
+ *
5606
+ * @param string $plan Plan name
5607
+ * @param bool $exact If true, looks for exact plan. If false, also check "higher" plans.
5608
+ *
5609
+ * @return bool
5610
+ */
5611
+ function is_trial_plan( $plan, $exact = false ) {
5612
+ $this->_logger->entrance();
5613
+
5614
+ if ( ! $this->is_registered() ) {
5615
+ return false;
5616
+ }
5617
+
5618
+ if ( ! $this->is_trial() ) {
5619
+ return false;
5620
+ }
5621
+
5622
+ if ( ! isset( $this->_storage->trial_plan ) ) {
5623
+ // Store trial plan information.
5624
+ $this->_enrich_site_trial_plan( true );
5625
+ }
5626
+
5627
+ if ( $this->_storage->trial_plan->name === $plan ) // Exact plan.
5628
+ {
5629
+ return true;
5630
+ } else if ( $exact ) // Required exact, but plans are different.
5631
+ {
5632
+ return false;
5633
+ }
5634
+
5635
+ $current_plan_order = - 1;
5636
+ $required_plan_order = - 1;
5637
+ for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
5638
+ if ( $plan === $this->_plans[ $i ]->name ) {
5639
+ $required_plan_order = $i;
5640
+ } else if ( $this->_storage->trial_plan->name === $this->_plans[ $i ]->name ) {
5641
+ $current_plan_order = $i;
5642
+ }
5643
+ }
5644
+
5645
+ return ( $current_plan_order > $required_plan_order );
5646
+ }
5647
+
5648
+ /**
5649
+ * Check if plugin has any paid plans.
5650
+ *
5651
+ * @author Vova Feldman (@svovaf)
5652
+ * @since 1.0.7
5653
+ *
5654
+ * @return bool
5655
+ */
5656
+ function has_paid_plan() {
5657
+ return $this->_has_paid_plans ||
5658
+ FS_Plan_Manager::instance()->has_paid_plan( $this->_plans );
5659
+ }
5660
+
5661
+ /**
5662
+ * Check if plugin has any plan with a trail.
5663
+ *
5664
+ * @author Vova Feldman (@svovaf)
5665
+ * @since 1.0.9
5666
+ *
5667
+ * @return bool
5668
+ */
5669
+ function has_trial_plan() {
5670
+ if ( ! $this->is_registered() ) {
5671
+ /**
5672
+ * @author Vova Feldman(@svovaf)
5673
+ * @since 1.2.1.5
5674
+ *
5675
+ * Allow setting a trial from the SDK without calling the API.
5676
+ * But, if the user did opt-in, continue using the real data from the API.
5677
+ */
5678
+ if ( $this->_trial_days >= 0 ) {
5679
+ return true;
5680
+ }
5681
+
5682
+ return false;
5683
+ }
5684
+
5685
+ return $this->_storage->get( 'has_trial_plan', false );
5686
+ }
5687
+
5688
+ /**
5689
+ * Check if plugin has any free plan, or is it premium only.
5690
+ *
5691
+ * Note: If no plans configured, assume plugin is free.
5692
+ *
5693
+ * @author Vova Feldman (@svovaf)
5694
+ * @since 1.0.7
5695
+ *
5696
+ * @return bool
5697
+ */
5698
+ function has_free_plan() {
5699
+ return ! $this->is_only_premium();
5700
+ }
5701
+
5702
+ /**
5703
+ * Displays a license activation dialog box when the user clicks on the "Activate License"
5704
+ * or "Change License" link on the plugins
5705
+ * page.
5706
+ *
5707
+ * @author Leo Fajardo (@leorw)
5708
+ * @since 1.1.9
5709
+ */
5710
+ function _add_license_activation_dialog_box() {
5711
+ $vars = array(
5712
+ 'slug' => $this->_slug,
5713
+ );
5714
+
5715
+ fs_require_template( 'forms/license-activation.php', $vars );
5716
+ fs_require_template( 'forms/resend-key.php', $vars );
5717
+ }
5718
+
5719
+ /**
5720
+ * Displays the opt-out dialog box when the user clicks on the "Opt Out" link on the "Plugins"
5721
+ * page.
5722
+ *
5723
+ * @author Leo Fajardo (@leorw)
5724
+ * @since 1.2.1.5
5725
+ */
5726
+ function _add_optout_dialog() {
5727
+ $vars = array(
5728
+ 'slug' => $this->_slug,
5729
+ );
5730
+
5731
+ fs_require_template( 'forms/optout.php', $vars );
5732
+ }
5733
+
5734
+ /**
5735
+ * Prepare page to include all required UI and logic for the license activation dialog.
5736
+ *
5737
+ * @author Vova Feldman (@svovaf)
5738
+ * @since 1.2.0
5739
+ */
5740
+ function _add_license_activation() {
5741
+ if ( ! current_user_can( 'activate_plugins' ) ) {
5742
+ // Only admins can activate a license.
5743
+ return;
5744
+ }
5745
+
5746
+ if ( ! $this->has_paid_plan() ) {
5747
+ // Module doesn't have any paid plans.
5748
+ return;
5749
+ }
5750
+
5751
+ if ( ! $this->is_premium() ) {
5752
+ // Only add license activation logic to the premium version.
5753
+ return;
5754
+ }
5755
+
5756
+ // Add license activation link and AJAX request handler.
5757
+ if ( $this->is_plugins_page() ) {
5758
+ /**
5759
+ * @since 1.2.0 Add license action link only on plugins page.
5760
+ */
5761
+ $this->_add_license_action_link();
5762
+ }
5763
+
5764
+ // Add license activation AJAX callback.
5765
+ $this->add_ajax_action( 'activate_license', array( &$this, '_activate_license_ajax_action' ) );
5766
+
5767
+ // Add resend license AJAX callback.
5768
+ $this->add_ajax_action( 'resend_license_key', array( &$this, '_resend_license_key_ajax_action' ) );
5769
+ }
5770
+
5771
+ /**
5772
+ * @author Leo Fajardo (@leorw)
5773
+ * @since 1.1.9
5774
+ */
5775
+ function _activate_license_ajax_action() {
5776
+ $license_key = trim( fs_request_get( 'license_key' ) );
5777
+
5778
+ if ( empty( $license_key ) ) {
5779
+ exit;
5780
+ }
5781
+
5782
+ $slug = $_POST['slug'];
5783
+ $fs = ( ( $slug === $this->_slug ) ? $this : self::instance( $slug ) );
5784
+ $error = false;
5785
+ $next_page = false;
5786
+
5787
+ if ( $this->is_registered() ) {
5788
+ $api = $fs->get_api_site_scope();
5789
+ $install = $api->call( '/', 'put', array(
5790
+ 'license_key' => $this->apply_filters( 'license_key', $license_key )
5791
+ ) );
5792
+
5793
+ if ( isset( $install->error ) ) {
5794
+ $error = $install->error->message;
5795
+ } else {
5796
+ $fs = $this->is_addon() ?
5797
+ $this->get_parent_instance() :
5798
+ $this;
5799
+
5800
+ $next_page = $fs->_get_sync_license_url( $this->get_id(), true );
5801
+
5802
+ $this->reconnect_locally();
5803
+ }
5804
+ } else {
5805
+ $next_page = $this->opt_in( false, false, false, $license_key );
5806
+
5807
+ if ( isset( $next_page->error ) ) {
5808
+ $error = $next_page->error;
5809
+ }
5810
+ }
5811
+
5812
+ $result = array(
5813
+ 'success' => ( false === $error )
5814
+ );
5815
+
5816
+ if ( false !== $error ) {
5817
+ $result['error'] = $error;
5818
+ } else {
5819
+ $result['next_page'] = $next_page;
5820
+ }
5821
+
5822
+ echo json_encode( $result );
5823
+
5824
+ exit;
5825
+ }
5826
+
5827
+ /**
5828
+ * Billing update AJAX callback.
5829
+ *
5830
+ * @author Vova Feldman (@svovaf)
5831
+ * @since 1.2.1.5
5832
+ */
5833
+ function _update_billing_ajax_action() {
5834
+ check_ajax_referer( $this->get_action_tag( 'update_billing' ), 'security' );
5835
+
5836
+ if ( ! current_user_can( 'activate_plugins' ) ) {
5837
+ // Only for admins.
5838
+ $this->shoot_ajax_failure();
5839
+ }
5840
+
5841
+ $billing = fs_request_get( 'billing' );
5842
+
5843
+ $api = $this->get_api_user_scope();
5844
+ $result = $api->call( '/billing.json', 'put', array_merge( $billing, array(
5845
+ 'plugin_id' => $this->get_parent_id(),
5846
+ ) ) );
5847
+
5848
+ if ( ! $this->is_api_result_entity( $result ) ) {
5849
+ $this->shoot_ajax_failure();
5850
+ }
5851
+
5852
+ // Purge cached billing.
5853
+ $this->get_api_user_scope()->purge_cache( 'billing.json' );
5854
+
5855
+ $this->shoot_ajax_success();
5856
+ }
5857
+
5858
+ /**
5859
+ * Trial start for anonymous users (AJAX callback).
5860
+ *
5861
+ * @author Vova Feldman (@svovaf)
5862
+ * @since 1.2.1.5
5863
+ */
5864
+ function _start_trial_ajax_action() {
5865
+ check_ajax_referer( $this->get_action_tag( 'start_trial' ), 'security' );
5866
+
5867
+ if ( ! current_user_can( 'activate_plugins' ) ) {
5868
+ // Only for admins.
5869
+ $this->shoot_ajax_failure();
5870
+ }
5871
+
5872
+ $trial_data = fs_request_get( 'trial' );
5873
+
5874
+ $next_page = $this->opt_in(
5875
+ false,
5876
+ false,
5877
+ false,
5878
+ false,
5879
+ false,
5880
+ $trial_data['plan_id']
5881
+ );
5882
+
5883
+ if ( is_object( $next_page ) && $this->is_api_error( $next_page ) ) {
5884
+ $this->shoot_ajax_failure(
5885
+ isset( $next_page->error ) ?
5886
+ $next_page->error->message :
5887
+ var_export( $next_page, true )
5888
+ );
5889
+ }
5890
+
5891
+ $this->shoot_ajax_success( array(
5892
+ 'next_page' => $next_page,
5893
+ ) );
5894
+ }
5895
+
5896
+ /**
5897
+ * @author Leo Fajardo (@leorw)
5898
+ * @since 1.2.0
5899
+ */
5900
+ function _resend_license_key_ajax_action() {
5901
+ if ( ! isset( $_POST['email'] ) ) {
5902
+ exit;
5903
+ }
5904
+
5905
+ $email_address = trim( $_POST['email'] );
5906
+ if ( empty( $email_address ) ) {
5907
+ exit;
5908
+ }
5909
+
5910
+ $error = false;
5911
+
5912
+ $api = $this->get_api_plugin_scope();
5913
+ $result = $api->call( '/licenses/resend.json', 'post',
5914
+ array(
5915
+ 'email' => $email_address,
5916
+ 'is_localhost' => WP_FS__IS_LOCALHOST
5917
+ )
5918
+ );
5919
+
5920
+ if ( is_object( $result ) && isset( $result->error ) ) {
5921
+ $error = $result->error;
5922
+
5923
+ if ( in_array( $error->code, array( 'invalid_email', 'no_user' ) ) ) {
5924
+ $error = __fs( 'email-not-found' );
5925
+ } else if ( 'no_license' === $error->code ) {
5926
+ $error = __fs( 'no-active-licenses' );
5927
+ } else {
5928
+ $error = $error->message;
5929
+ }
5930
+ }
5931
+
5932
+ $licenses = array(
5933
+ 'success' => ( false === $error )
5934
+ );
5935
+
5936
+ if ( false !== $error ) {
5937
+ $licenses['error'] = sprintf( '%s... %s', __fs( 'oops', $this->_slug ), strtolower( $error ) );
5938
+ }
5939
+
5940
+ echo json_encode( $licenses );
5941
+
5942
+ exit;
5943
+ }
5944
+
5945
+ /**
5946
+ * Helper method to check if user in the plugins page.
5947
+ *
5948
+ * @author Vova Feldman (@svovaf)
5949
+ * @since 1.2.1.5
5950
+ *
5951
+ * @return bool
5952
+ */
5953
+ private function is_plugins_page() {
5954
+ global $pagenow;
5955
+
5956
+ return ( 'plugins.php' === $pagenow );
5957
+ }
5958
+
5959
+ #----------------------------------------------------------------------------------
5960
+ #region URL Generators
5961
+ #----------------------------------------------------------------------------------
5962
+
5963
+ /**
5964
+ * Alias to pricing_url().
5965
+ *
5966
+ * @author Vova Feldman (@svovaf)
5967
+ * @since 1.0.2
5968
+ *
5969
+ * @uses pricing_url()
5970
+ *
5971
+ * @param string $period Billing cycle
5972
+ * @param bool $is_trial
5973
+ *
5974
+ * @return string
5975
+ */
5976
+ function get_upgrade_url( $period = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
5977
+ return $this->pricing_url( $period, $is_trial );
5978
+ }
5979
+
5980
+ /**
5981
+ * @author Vova Feldman (@svovaf)
5982
+ * @since 1.0.9
5983
+ *
5984
+ * @uses get_upgrade_url()
5985
+ *
5986
+ * @return string
5987
+ */
5988
+ function get_trial_url() {
5989
+ return $this->get_upgrade_url( WP_FS__PERIOD_ANNUALLY, true );
5990
+ }
5991
+
5992
+ /**
5993
+ * Plugin's pricing URL.
5994
+ *
5995
+ * @author Vova Feldman (@svovaf)
5996
+ * @since 1.0.4
5997
+ *
5998
+ * @param string $billing_cycle Billing cycle
5999
+ *
6000
+ * @param bool $is_trial
6001
+ *
6002
+ * @return string
6003
+ */
6004
+ function pricing_url( $billing_cycle = WP_FS__PERIOD_ANNUALLY, $is_trial = false ) {
6005
+ $this->_logger->entrance();
6006
+
6007
+ $params = array(
6008
+ 'billing_cycle' => $billing_cycle
6009
+ );
6010
+
6011
+ if ( $is_trial ) {
6012
+ $params['trial'] = 'true';
6013
+ }
6014
+
6015
+ return $this->_get_admin_page_url( 'pricing', $params );
6016
+ }
6017
+
6018
+ /**
6019
+ * Checkout page URL.
6020
+ *
6021
+ * @author Vova Feldman (@svovaf)
6022
+ * @since 1.0.6
6023
+ *
6024
+ * @param string $billing_cycle Billing cycle
6025
+ * @param bool $is_trial
6026
+ * @param array $extra (optional) Extra parameters, override other query params.
6027
+ *
6028
+ * @return string
6029
+ */
6030
+ function checkout_url(
6031
+ $billing_cycle = WP_FS__PERIOD_ANNUALLY,
6032
+ $is_trial = false,
6033
+ $extra = array()
6034
+ ) {
6035
+ $this->_logger->entrance();
6036
+
6037
+ $params = array(
6038
+ 'checkout' => 'true',
6039
+ 'billing_cycle' => $billing_cycle,
6040
+ );
6041
+
6042
+ if ( $is_trial ) {
6043
+ $params['trial'] = 'true';
6044
+ }
6045
+
6046
+ /**
6047
+ * Params in extra override other params.
6048
+ */
6049
+ $params = array_merge( $params, $extra );
6050
+
6051
+ return $this->_get_admin_page_url( 'pricing', $params );
6052
+ }
6053
+
6054
+ /**
6055
+ * Add-on checkout URL.
6056
+ *
6057
+ * @author Vova Feldman (@svovaf)
6058
+ * @since 1.1.7
6059
+ *
6060
+ * @param number $addon_id
6061
+ * @param number $pricing_id
6062
+ * @param string $billing_cycle
6063
+ * @param bool $is_trial
6064
+ *
6065
+ * @return string
6066
+ */
6067
+ function addon_checkout_url(
6068
+ $addon_id,
6069
+ $pricing_id,
6070
+ $billing_cycle = WP_FS__PERIOD_ANNUALLY,
6071
+ $is_trial = false
6072
+ ) {
6073
+ return $this->checkout_url( $billing_cycle, $is_trial, array(
6074
+ 'plugin_id' => $addon_id,
6075
+ 'pricing_id' => $pricing_id,
6076
+ ) );
6077
+ }
6078
+
6079
+ #endregion
6080
+
6081
+ #endregion ------------------------------------------------------------------
6082
+
6083
+ /**
6084
+ * Check if plugin has any add-ons.
6085
+ *
6086
+ * @author Vova Feldman (@svovaf)
6087
+ * @since 1.0.5
6088
+ *
6089
+ * @since 1.1.7.3 Base logic only on the parameter provided by the developer in the init function.
6090
+ *
6091
+ * @return bool
6092
+ */
6093
+ function has_addons() {
6094
+ $this->_logger->entrance();
6095
+
6096
+ return $this->_has_addons;
6097
+ }
6098
+
6099
+ /**
6100
+ * Check if plugin can work in anonymous mode.
6101
+ *
6102
+ * @author Vova Feldman (@svovaf)
6103
+ * @since 1.0.9
6104
+ *
6105
+ * @return bool
6106
+ *
6107
+ * @deprecated Please use is_enable_anonymous() instead
6108
+ */
6109
+ function enable_anonymous() {
6110
+ return $this->_enable_anonymous;
6111
+ }
6112
+
6113
+ /**
6114
+ * Check if plugin can work in anonymous mode.
6115
+ *
6116
+ * @author Vova Feldman (@svovaf)
6117
+ * @since 1.1.9
6118
+ *
6119
+ * @return bool
6120
+ */
6121
+ function is_enable_anonymous() {
6122
+ return $this->_enable_anonymous;
6123
+ }
6124
+
6125
+ /**
6126
+ * Check if plugin is premium only (no free plans).
6127
+ *
6128
+ * @author Vova Feldman (@svovaf)
6129
+ * @since 1.1.9
6130
+ *
6131
+ * @return bool
6132
+ */
6133
+ function is_only_premium() {
6134
+ return $this->_is_premium_only;
6135
+ }
6136
+
6137
+ /**
6138
+ * Check if feature supported with current site's plan.
6139
+ *
6140
+ * @author Vova Feldman (@svovaf)
6141
+ * @since 1.0.1
6142
+ *
6143
+ * @todo IMPLEMENT
6144
+ *
6145
+ * @param number $feature_id
6146
+ *
6147
+ * @throws Exception
6148
+ */
6149
+ function is_feature_supported( $feature_id ) {
6150
+ throw new Exception( 'not implemented' );
6151
+ }
6152
+
6153
+ /**
6154
+ * @author Vova Feldman (@svovaf)
6155
+ * @since 1.0.1
6156
+ *
6157
+ * @return bool Is running in SSL/HTTPS
6158
+ */
6159
+ function is_ssl() {
6160
+ return WP_FS__IS_HTTPS;
6161
+ }
6162
+
6163
+ /**
6164
+ * @author Vova Feldman (@svovaf)
6165
+ * @since 1.0.9
6166
+ *
6167
+ * @return bool Is running in AJAX call.
6168
+ *
6169
+ * @link http://wordpress.stackexchange.com/questions/70676/how-to-check-if-i-am-in-admin-ajax
6170
+ */
6171
+ function is_ajax() {
6172
+ return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
6173
+ }
6174
+
6175
+ /**
6176
+ * Check if it's an AJAX call targeted for the current module.
6177
+ *
6178
+ * @author Vova Feldman (@svovaf)
6179
+ * @since 1.2.0
6180
+ *
6181
+ * @param array|string $actions Collection of AJAX actions.
6182
+ *
6183
+ * @return bool
6184
+ */
6185
+ function is_ajax_action( $actions ) {
6186
+ // Verify it's an ajax call.
6187
+ if ( ! $this->is_ajax() ) {
6188
+ return false;
6189
+ }
6190
+
6191
+ // Verify the call is relevant for the plugin.
6192
+ if ( $this->_slug !== fs_request_get( 'slug' ) ) {
6193
+ return false;
6194
+ }
6195
+
6196
+ // Verify it's one of the specified actions.
6197
+ if ( is_string( $actions ) ) {
6198
+ $actions = explode( ',', $actions );
6199
+ }
6200
+
6201
+ if ( is_array( $actions ) && 0 < count( $actions ) ) {
6202
+ $ajax_action = fs_request_get( 'action' );
6203
+
6204
+ foreach ( $actions as $action ) {
6205
+ if ( $ajax_action === $this->get_action_tag( $action ) ) {
6206
+ return true;
6207
+ }
6208
+ }
6209
+ }
6210
+
6211
+ return false;
6212
+ }
6213
+
6214
+ /**
6215
+ * @author Vova Feldman (@svovaf)
6216
+ * @since 1.1.7
6217
+ *
6218
+ * @return bool
6219
+ */
6220
+ function is_cron() {
6221
+ return ( defined( 'DOING_CRON' ) && DOING_CRON );
6222
+ }
6223
+
6224
+ /**
6225
+ * Check if a real user is visiting the admin dashboard.
6226
+ *
6227
+ * @author Vova Feldman (@svovaf)
6228
+ * @since 1.1.7
6229
+ *
6230
+ * @return bool
6231
+ */
6232
+ function is_user_in_admin() {
6233
+ return is_admin() && ! $this->is_ajax() && ! $this->is_cron();
6234
+ }
6235
+
6236
+ /**
6237
+ * Check if running in HTTPS and if site's plan matching the specified plan.
6238
+ *
6239
+ * @param string $plan
6240
+ * @param bool $exact
6241
+ *
6242
+ * @return bool
6243
+ */
6244
+ function is_ssl_and_plan( $plan, $exact = false ) {
6245
+ return ( $this->is_ssl() && $this->is_plan( $plan, $exact ) );
6246
+ }
6247
+
6248
+ /**
6249
+ * Construct plugin's settings page URL.
6250
+ *
6251
+ * @author Vova Feldman (@svovaf)
6252
+ * @since 1.0.4
6253
+ *
6254
+ * @param string $page
6255
+ * @param array $params
6256
+ *
6257
+ * @return string
6258
+ */
6259
+ function _get_admin_page_url( $page = '', $params = array() ) {
6260
+ if ( 0 < count( $params ) ) {
6261
+ foreach ( $params as $k => $v ) {
6262
+ $params[ $k ] = urlencode( $v );
6263
+ }
6264
+ }
6265
+
6266
+ if ( ! $this->_menu->is_top_level() ) {
6267
+ $parent_slug = $this->_menu->get_parent_slug();
6268
+ $menu_file = ( false !== strpos( $parent_slug, '.php' ) ) ?
6269
+ $parent_slug :
6270
+ 'admin.php';
6271
+
6272
+ return add_query_arg( array_merge( $params, array(
6273
+ 'page' => $this->_menu->get_slug( $page ),
6274
+ ) ), admin_url( $menu_file, 'admin' ) );
6275
+ }
6276
+
6277
+ if ( $this->_menu->is_cpt() ) {
6278
+ if ( empty( $page ) && $this->is_activation_mode() ) {
6279
+ return add_query_arg( array_merge( $params, array(
6280
+ 'page' => $this->_menu->get_slug()
6281
+ ) ), admin_url( 'admin.php', 'admin' ) );
6282
+ } else {
6283
+ if ( ! empty( $page ) ) {
6284
+ $params['page'] = $this->_menu->get_slug( $page );
6285
+ }
6286
+
6287
+ return add_query_arg( $params, admin_url( $this->_menu->get_raw_slug(), 'admin' ) );
6288
+ }
6289
+ } else {
6290
+ return add_query_arg( array_merge( $params, array(
6291
+ 'page' => $this->_menu->get_slug( $page ),
6292
+ ) ), admin_url( 'admin.php', 'admin' ) );
6293
+ }
6294
+ }
6295
+
6296
+ /**
6297
+ * Plugin's account page + sync license URL.
6298
+ *
6299
+ * @author Vova Feldman (@svovaf)
6300
+ * @since 1.1.9.1
6301
+ *
6302
+ * @param bool|number $plugin_id
6303
+ * @param bool $add_action_nonce
6304
+ *
6305
+ * @return string
6306
+ */
6307
+ function _get_sync_license_url( $plugin_id = false, $add_action_nonce = true ) {
6308
+ $params = array();
6309
+
6310
+ if ( is_numeric( $plugin_id ) ) {
6311
+ $params['plugin_id'] = $plugin_id;
6312
+ }
6313
+
6314
+ return $this->get_account_url(
6315
+ $this->_slug . '_sync_license',
6316
+ $params,
6317
+ $add_action_nonce
6318
+ );
6319
+ }
6320
+
6321
+ /**
6322
+ * Plugin's account URL.
6323
+ *
6324
+ * @author Vova Feldman (@svovaf)
6325
+ * @since 1.0.4
6326
+ *
6327
+ * @param bool|string $action
6328
+ * @param array $params
6329
+ *
6330
+ * @param bool $add_action_nonce
6331
+ *
6332
+ * @return string
6333
+ */
6334
+ function get_account_url( $action = false, $params = array(), $add_action_nonce = true ) {
6335
+ if ( is_string( $action ) ) {
6336
+ $params['fs_action'] = $action;
6337
+ }
6338
+
6339
+ self::require_pluggable_essentials();
6340
+
6341
+ return ( $add_action_nonce && is_string( $action ) ) ?
6342
+ fs_nonce_url( $this->_get_admin_page_url( 'account', $params ), $action ) :
6343
+ $this->_get_admin_page_url( 'account', $params );
6344
+ }
6345
+
6346
+ /**
6347
+ * @author Vova Feldman (@svovaf)
6348
+ * @since 1.2.0
6349
+ *
6350
+ * @param string $tab
6351
+ * @param bool $action
6352
+ * @param array $params
6353
+ * @param bool $add_action_nonce
6354
+ *
6355
+ * @return string
6356
+ *
6357
+ * @uses get_account_url()
6358
+ */
6359
+ function get_account_tab_url( $tab, $action = false, $params = array(), $add_action_nonce = true ) {
6360
+ $params['tab'] = $tab;
6361
+
6362
+ return $this->get_account_url( $action, $params, $add_action_nonce );
6363
+ }
6364
+
6365
+ /**
6366
+ * Plugin's account URL.
6367
+ *
6368
+ * @author Vova Feldman (@svovaf)
6369
+ * @since 1.0.4
6370
+ *
6371
+ * @param bool|string $topic
6372
+ * @param bool|string $message
6373
+ *
6374
+ * @return string
6375
+ */
6376
+ function contact_url( $topic = false, $message = false ) {
6377
+ $params = array();
6378
+ if ( is_string( $topic ) ) {
6379
+ $params['topic'] = $topic;
6380
+ }
6381
+ if ( is_string( $message ) ) {
6382
+ $params['message'] = $message;
6383
+ }
6384
+
6385
+ if ( $this->is_addon() ) {
6386
+ $params['addon_id'] = $this->get_id();
6387
+
6388
+ return $this->get_parent_instance()->_get_admin_page_url( 'contact', $params );
6389
+ } else {
6390
+ return $this->_get_admin_page_url( 'contact', $params );
6391
+ }
6392
+ }
6393
+
6394
+ /**
6395
+ * Add-on direct info URL.
6396
+ *
6397
+ * @author Vova Feldman (@svovaf)
6398
+ * @since 1.1.0
6399
+ *
6400
+ * @param string $slug
6401
+ *
6402
+ * @return string
6403
+ */
6404
+ function addon_url( $slug ) {
6405
+ return $this->_get_admin_page_url( 'addons', array(
6406
+ 'slug' => $slug
6407
+ ) );
6408
+ }
6409
+
6410
+ /* Logger
6411
+ ------------------------------------------------------------------------------------------------------------------*/
6412
+ /**
6413
+ * @param string $id
6414
+ * @param bool $prefix_slug
6415
+ *
6416
+ * @return FS_Logger
6417
+ */
6418
+ function get_logger( $id = '', $prefix_slug = true ) {
6419
+ return FS_Logger::get_logger( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id );
6420
+ }
6421
+
6422
+ /**
6423
+ * @param $id
6424
+ * @param bool $load_options
6425
+ * @param bool $prefix_slug
6426
+ *
6427
+ * @return FS_Option_Manager
6428
+ */
6429
+ function get_options_manager( $id, $load_options = false, $prefix_slug = true ) {
6430
+ return FS_Option_Manager::get_manager( ( $prefix_slug ? $this->_slug : '' ) . ( ( ! $prefix_slug || empty( $id ) ) ? '' : '_' ) . $id, $load_options );
6431
+ }
6432
+
6433
+ /* Security
6434
+ ------------------------------------------------------------------------------------------------------------------*/
6435
+ private function _encrypt( $str ) {
6436
+ if ( is_null( $str ) ) {
6437
+ return null;
6438
+ }
6439
+
6440
+ return base64_encode( $str );
6441
+ }
6442
+
6443
+ private function _decrypt( $str ) {
6444
+ if ( is_null( $str ) ) {
6445
+ return null;
6446
+ }
6447
+
6448
+ return base64_decode( $str );
6449
+ }
6450
+
6451
+ /**
6452
+ * @author Vova Feldman (@svovaf)
6453
+ * @since 1.0.5
6454
+ *
6455
+ * @param FS_Entity $entity
6456
+ *
6457
+ * @return FS_Entity Return an encrypted clone entity.
6458
+ */
6459
+ private function _encrypt_entity( FS_Entity $entity ) {
6460
+ $clone = clone $entity;
6461
+ $props = get_object_vars( $entity );
6462
+
6463
+ foreach ( $props as $key => $val ) {
6464
+ $clone->{$key} = $this->_encrypt( $val );
6465
+ }
6466
+
6467
+ return $clone;
6468
+ }
6469
+
6470
+ /**
6471
+ * @author Vova Feldman (@svovaf)
6472
+ * @since 1.0.5
6473
+ *
6474
+ * @param FS_Entity $entity
6475
+ *
6476
+ * @return FS_Entity Return an decrypted clone entity.
6477
+ */
6478
+ private function _decrypt_entity( FS_Entity $entity ) {
6479
+ $clone = clone $entity;
6480
+ $props = get_object_vars( $entity );
6481
+
6482
+ foreach ( $props as $key => $val ) {
6483
+ $clone->{$key} = $this->_decrypt( $val );
6484
+ }
6485
+
6486
+ return $clone;
6487
+ }
6488
+
6489
+ /**
6490
+ * Tries to activate account based on POST params.
6491
+ *
6492
+ * @author Vova Feldman (@svovaf)
6493
+ * @since 1.0.2
6494
+ */
6495
+ function _activate_account() {
6496
+ if ( $this->is_registered() ) {
6497
+ // Already activated.
6498
+ return;
6499
+ }
6500
+
6501
+ self::_clean_admin_content_section();
6502
+
6503
+ if ( fs_request_is_action( 'activate' ) && fs_request_is_post() ) {
6504
+ // check_admin_referer( 'activate_' . $this->_plugin->public_key );
6505
+
6506
+ // Verify matching plugin details.
6507
+ if ( $this->_plugin->id != fs_request_get( 'plugin_id' ) || $this->_slug != fs_request_get( 'plugin_slug' ) ) {
6508
+ return;
6509
+ }
6510
+
6511
+ $user = new FS_User();
6512
+ $user->id = fs_request_get( 'user_id' );
6513
+ $user->public_key = fs_request_get( 'user_public_key' );
6514
+ $user->secret_key = fs_request_get( 'user_secret_key' );
6515
+ $user->email = fs_request_get( 'user_email' );
6516
+ $user->first = fs_request_get( 'user_first' );
6517
+ $user->last = fs_request_get( 'user_last' );
6518
+ $user->is_verified = fs_request_get_bool( 'user_is_verified' );
6519
+
6520
+ $site = new FS_Site();
6521
+ $site->id = fs_request_get( 'install_id' );
6522
+ $site->public_key = fs_request_get( 'install_public_key' );
6523
+ $site->secret_key = fs_request_get( 'install_secret_key' );
6524
+ $site->plan->id = fs_request_get( 'plan_id' );
6525
+ $site->plan->title = fs_request_get( 'plan_title' );
6526
+ $site->plan->name = fs_request_get( 'plan_name' );
6527
+
6528
+ $plans = array();
6529
+ $plans_data = json_decode( urldecode( fs_request_get( 'plans' ) ) );
6530
+ foreach ( $plans_data as $p ) {
6531
+ $plans[] = new FS_Plugin_Plan( $p );
6532
+ }
6533
+
6534
+ $this->_set_account( $user, $site, $plans );
6535
+
6536
+ // Reload the page with the keys.
6537
+ fs_redirect( $this->_get_admin_page_url() );
6538
+ }
6539
+ }
6540
+
6541
+ /**
6542
+ * @author Vova Feldman (@svovaf)
6543
+ * @since 1.0.7
6544
+ *
6545
+ * @param string $email
6546
+ *
6547
+ * @return FS_User|bool
6548
+ */
6549
+ static function _get_user_by_email( $email ) {
6550
+ self::$_static_logger->entrance();
6551
+
6552
+ $email = trim( strtolower( $email ) );
6553
+ $users = self::get_all_users();
6554
+ if ( is_array( $users ) ) {
6555
+ foreach ( $users as $u ) {
6556
+ if ( $email === trim( strtolower( $u->email ) ) ) {
6557
+ return $u;
6558
+ }
6559
+ }
6560
+ }
6561
+
6562
+ return false;
6563
+ }
6564
+
6565
+ #----------------------------------------------------------------------------------
6566
+ #region Account (Loading, Updates & Activation)
6567
+ #----------------------------------------------------------------------------------
6568
+
6569
+ /***
6570
+ * Load account information (user + site).
6571
+ *
6572
+ * @author Vova Feldman (@svovaf)
6573
+ * @since 1.0.1
6574
+ */
6575
+ private function _load_account() {
6576
+ $this->_logger->entrance();
6577
+
6578
+ $this->do_action( 'before_account_load' );
6579
+
6580
+ $sites = self::get_all_sites();
6581
+ $users = self::get_all_users();
6582
+ $plans = self::get_all_plans();
6583
+ $licenses = self::get_all_licenses();
6584
+
6585
+ if ( $this->_logger->is_on() && is_admin() ) {
6586
+ $this->_logger->log( 'sites = ' . var_export( $sites, true ) );
6587
+ $this->_logger->log( 'users = ' . var_export( $users, true ) );
6588
+ $this->_logger->log( 'plans = ' . var_export( $plans, true ) );
6589
+ $this->_logger->log( 'licenses = ' . var_export( $licenses, true ) );
6590
+ }
6591
+
6592
+ $site = isset( $sites[ $this->_slug ] ) ? $sites[ $this->_slug ] : false;
6593
+
6594
+ if ( is_object( $site ) &&
6595
+ is_numeric( $site->id ) &&
6596
+ is_numeric( $site->user_id ) &&
6597
+ is_object( $site->plan )
6598
+ ) {
6599
+ // Load site.
6600
+ $this->_site = clone $site;
6601
+ $this->_site->plan = $this->_decrypt_entity( $this->_site->plan );
6602
+
6603
+ // Load relevant user.
6604
+ $this->_user = clone $users[ $this->_site->user_id ];
6605
+
6606
+ // Load plans.
6607
+ $this->_plans = $plans[ $this->_slug ];
6608
+ if ( ! is_array( $this->_plans ) || empty( $this->_plans ) ) {
6609
+ $this->_sync_plans();
6610
+ } else {
6611
+ for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
6612
+ if ( $this->_plans[ $i ] instanceof FS_Plugin_Plan ) {
6613
+ $this->_plans[ $i ] = $this->_decrypt_entity( $this->_plans[ $i ] );
6614
+ } else {
6615
+ unset( $this->_plans[ $i ] );
6616
+ }
6617
+ }
6618
+ }
6619
+
6620
+ // Load licenses.
6621
+ $this->_licenses = array();
6622
+ if ( is_array( $licenses ) &&
6623
+ isset( $licenses[ $this->_slug ] ) &&
6624
+ isset( $licenses[ $this->_slug ][ $this->_user->id ] )
6625
+ ) {
6626
+ $this->_licenses = $licenses[ $this->_slug ][ $this->_user->id ];
6627
+ }
6628
+
6629
+ $this->_license = $this->_get_license_by_id( $this->_site->license_id );
6630
+
6631
+ if ( $this->_site->version != $this->get_plugin_version() ) {
6632
+ // If stored install version is different than current installed plugin version,
6633
+ // then update plugin version event.
6634
+ $this->update_plugin_version_event();
6635
+ }
6636
+ }
6637
+
6638
+ $this->_register_account_hooks();
6639
+ }
6640
+
6641
+ /**
6642
+ * @author Vova Feldman (@svovaf)
6643
+ * @since 1.0.1
6644
+ *
6645
+ * @param FS_User $user
6646
+ * @param FS_Site $site
6647
+ * @param bool|array $plans
6648
+ */
6649
+ private function _set_account( FS_User $user, FS_Site $site, $plans = false ) {
6650
+ $site->slug = $this->_slug;
6651
+ $site->user_id = $user->id;
6652
+
6653
+ $this->_site = $site;
6654
+ $this->_user = $user;
6655
+ if ( false !== $plans ) {
6656
+ $this->_plans = $plans;
6657
+ }
6658
+
6659
+ $this->send_install_update();
6660
+
6661
+ $this->_store_account();
6662
+
6663
+ }
6664
+
6665
+ /**
6666
+ * @author Vova Feldman (@svovaf)
6667
+ * @since 1.1.7.4
6668
+ *
6669
+ * @param array $override_with
6670
+ *
6671
+ * @return array
6672
+ */
6673
+ function get_opt_in_params( $override_with = array() ) {
6674
+ $this->_logger->entrance();
6675
+
6676
+ $current_user = self::_get_current_wp_user();
6677
+
6678
+ $activation_action = $this->_slug . '_activate_new';
6679
+ $return_url = $this->is_anonymous() ?
6680
+ // If skipped already, then return to the account page.
6681
+ $this->get_account_url( $activation_action, array(), false ) :
6682
+ // Return to the module's main page.
6683
+ $this->_get_admin_page_url(
6684
+ '',
6685
+ array( 'fs_action' => $activation_action )
6686
+ );
6687
+
6688
+ $params = array(
6689
+ 'user_firstname' => $current_user->user_firstname,
6690
+ 'user_lastname' => $current_user->user_lastname,
6691
+ 'user_nickname' => $current_user->user_nicename,
6692
+ 'user_email' => $current_user->user_email,
6693
+ 'user_ip' => WP_FS__REMOTE_ADDR,
6694
+ 'plugin_slug' => $this->_slug,
6695
+ 'plugin_id' => $this->get_id(),
6696
+ 'plugin_public_key' => $this->get_public_key(),
6697
+ 'plugin_version' => $this->get_plugin_version(),
6698
+ 'return_url' => fs_nonce_url( $return_url, $activation_action ),
6699
+ 'account_url' => fs_nonce_url( $this->_get_admin_page_url(
6700
+ 'account',
6701
+ array( 'fs_action' => 'sync_user' )
6702
+ ), 'sync_user' ),
6703
+ 'site_uid' => $this->get_anonymous_id(),
6704
+ 'site_url' => get_site_url(),
6705
+ 'site_name' => get_bloginfo( 'name' ),
6706
+ 'platform_version' => get_bloginfo( 'version' ),
6707
+ 'sdk_version' => $this->version,
6708
+ 'programming_language_version' => phpversion(),
6709
+ 'language' => get_bloginfo( 'language' ),
6710
+ 'charset' => get_bloginfo( 'charset' ),
6711
+ 'is_premium' => $this->is_premium(),
6712
+ 'is_active' => true,
6713
+ 'is_uninstalled' => false,
6714
+ );
6715
+
6716
+ if ( $this->is_pending_activation() &&
6717
+ ! empty( $this->_storage->pending_license_key )
6718
+ ) {
6719
+ $params['license_key'] = $this->_storage->pending_license_key;
6720
+ }
6721
+
6722
+ if ( WP_FS__SKIP_EMAIL_ACTIVATION && $this->has_secret_key() ) {
6723
+ // Even though rand() is known for its security issues,
6724
+ // the timestamp adds another layer of protection.
6725
+ // It would be very hard for an attacker to get the secret key form here.
6726
+ // Plus, this should never run in production since the secret should never
6727
+ // be included in the production version.
6728
+ $params['ts'] = WP_FS__SCRIPT_START_TIME;
6729
+ $params['salt'] = md5( uniqid( rand() ) );
6730
+ $params['secure'] = md5(
6731
+ $params['ts'] .
6732
+ $params['salt'] .
6733
+ $this->get_secret_key()
6734
+ );
6735
+ }
6736
+
6737
+ return array_merge( $params, $override_with );
6738
+ }
6739
+
6740
+ /**
6741
+ * 1. If successful opt-in or pending activation returns the next page that the user should be redirected to.
6742
+ * 2. If there was an API error, return the API result.
6743
+ *
6744
+ * @author Vova Feldman (@svovaf)
6745
+ * @since 1.1.7.4
6746
+ *
6747
+ * @param string|bool $email
6748
+ * @param string|bool $first
6749
+ * @param string|bool $last
6750
+ * @param string|bool $license_key
6751
+ * @param bool $is_uninstall If "true", this means that the module is currently being uninstalled.
6752
+ * In this case, the user and site info will be sent to the server but no
6753
+ * data will be saved to the WP installation's database.
6754
+ * @param number|bool $trial_plan_id
6755
+ *
6756
+ * @return string|object
6757
+ * @use WP_Error
6758
+ */
6759
+ function opt_in(
6760
+ $email = false,
6761
+ $first = false,
6762
+ $last = false,
6763
+ $license_key = false,
6764
+ $is_uninstall = false,
6765
+ $trial_plan_id = false
6766
+ ) {
6767
+ $this->_logger->entrance();
6768
+
6769
+ if ( false === $email ) {
6770
+ $current_user = self::_get_current_wp_user();
6771
+ $email = $current_user->user_email;
6772
+ }
6773
+
6774
+ /**
6775
+ * @since 1.2.1 If activating with license key, ignore the context-user
6776
+ * since the user will be automatically loaded from the license.
6777
+ */
6778
+ if ( empty( $license_key ) ) {
6779
+ // Clean up pending license if opt-ing in again.
6780
+ $this->_storage->remove( 'pending_license_key' );
6781
+
6782
+ if ( ! $is_uninstall ) {
6783
+ $fs_user = Freemius::_get_user_by_email( $email );
6784
+ if ( is_object( $fs_user ) && ! $this->is_pending_activation() ) {
6785
+ return $this->install_with_current_user( false, $trial_plan_id );
6786
+ }
6787
+ }
6788
+ }
6789
+
6790
+ $user_info = array();
6791
+ if ( ! empty( $email ) ) {
6792
+ $user_info['user_email'] = $email;
6793
+ }
6794
+ if ( ! empty( $first ) ) {
6795
+ $user_info['user_firstname'] = $first;
6796
+ }
6797
+ if ( ! empty( $last ) ) {
6798
+ $user_info['user_lastname'] = $last;
6799
+ }
6800
+
6801
+ $params = $this->get_opt_in_params( $user_info );
6802
+
6803
+ $filtered_license_key = false;
6804
+ if ( is_string( $license_key ) ) {
6805
+ $filtered_license_key = $this->apply_filters( 'license_key', $license_key );
6806
+ $params['license_key'] = $filtered_license_key;
6807
+ } else if ( FS_Plugin_Plan::is_valid_id( $trial_plan_id ) ) {
6808
+ $params['trial_plan_id'] = $trial_plan_id;
6809
+ }
6810
+
6811
+ if ( $is_uninstall ) {
6812
+ $params['uninstall_params'] = array(
6813
+ 'reason_id' => $this->_storage->uninstall_reason->id,
6814
+ 'reason_info' => $this->_storage->uninstall_reason->info
6815
+ );
6816
+ }
6817
+
6818
+ $params['format'] = 'json';
6819
+
6820
+ $url = WP_FS__ADDRESS . '/action/service/user/install/';
6821
+ if ( isset( $_COOKIE['XDEBUG_SESSION'] ) ) {
6822
+ $url = add_query_arg( 'XDEBUG_SESSION', 'PHPSTORM', $url );
6823
+ }
6824
+
6825
+ $response = wp_remote_post( $url, array(
6826
+ 'method' => 'POST',
6827
+ 'body' => $params,
6828
+ 'timeout' => 15,
6829
+ ) );
6830
+
6831
+ if ( $response instanceof WP_Error ) {
6832
+ if ( 'https://' === substr( $url, 0, 8 ) &&
6833
+ isset( $response->errors ) &&
6834
+ isset( $response->errors['http_request_failed'] )
6835
+ ) {
6836
+ $http_error = strtolower( $response->errors['http_request_failed'][0] );
6837
+
6838
+ if ( false !== strpos( $http_error, 'ssl' ) ) {
6839
+ // Failed due to old version of cURL or Open SSL (SSLv3 is not supported by CloudFlare).
6840
+ $url = 'http://' . substr( $url, 8 );
6841
+
6842
+ $response = wp_remote_post( $url, array(
6843
+ 'method' => 'POST',
6844
+ 'body' => $params,
6845
+ 'timeout' => 15,
6846
+ ) );
6847
+ }
6848
+ }
6849
+ }
6850
+
6851
+ if ( is_wp_error( $response ) ) {
6852
+ /**
6853
+ * @var WP_Error $response
6854
+ */
6855
+ $result = new stdClass();
6856
+
6857
+ $error_code = $response->get_error_code();
6858
+ $error_type = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $error_code ) ) );
6859
+
6860
+ $result->error = (object) array(
6861
+ 'type' => $error_type,
6862
+ 'message' => $response->get_error_message(),
6863
+ 'code' => $error_code,
6864
+ 'http' => 402
6865
+ );
6866
+
6867
+ return $result;
6868
+ }
6869
+
6870
+ // Module is being uninstalled, don't handle the returned data.
6871
+ if ( $is_uninstall ) {
6872
+ return true;
6873
+ }
6874
+
6875
+ $decoded = @json_decode( $response['body'] );
6876
+
6877
+ if ( empty( $decoded ) ) {
6878
+ return false;
6879
+ }
6880
+
6881
+ if ( ! $this->is_api_result_object( $decoded ) ) {
6882
+ if ( ! empty( $params['license_key'] ) ) {
6883
+ // Pass the fully entered license key to the failure handler.
6884
+ $params['license_key'] = $license_key;
6885
+ }
6886
+
6887
+ return $is_uninstall ?
6888
+ $decoded :
6889
+ $this->apply_filters( 'after_install_failure', $decoded, $params );
6890
+ } else if ( isset( $decoded->pending_activation ) && $decoded->pending_activation ) {
6891
+ // Pending activation, add message.
6892
+ return $this->set_pending_confirmation(
6893
+ true,
6894
+ false,
6895
+ $filtered_license_key,
6896
+ ! empty( $params['trial_plan_id'] )
6897
+ );
6898
+ } else if ( isset( $decoded->install_secret_key ) ) {
6899
+ return $this->install_with_new_user(
6900
+ $decoded->user_id,
6901
+ $decoded->user_public_key,
6902
+ $decoded->user_secret_key,
6903
+ $decoded->install_id,
6904
+ $decoded->install_public_key,
6905
+ $decoded->install_secret_key,
6906
+ false
6907
+ );
6908
+ }
6909
+
6910
+ return $decoded;
6911
+ }
6912
+
6913
+ /**
6914
+ * Set user and site identities.
6915
+ *
6916
+ * @author Vova Feldman (@svovaf)
6917
+ * @since 1.0.9
6918
+ *
6919
+ * @param FS_User $user
6920
+ * @param FS_Site $site
6921
+ * @param bool $redirect
6922
+ *
6923
+ * @return string If redirect is `false`, returns the next page the user should be redirected to.
6924
+ */
6925
+ function setup_account( FS_User $user, FS_Site $site, $redirect = true ) {
6926
+ $this->_user = $user;
6927
+ $this->_site = $site;
6928
+
6929
+ $this->_sync_plans();
6930
+
6931
+ $this->_enrich_site_plan( false );
6932
+
6933
+ $this->_set_account( $user, $site );
6934
+
6935
+ if ( $this->is_trial() ) {
6936
+ // Store trial plan information.
6937
+ $this->_enrich_site_trial_plan( true );
6938
+ }
6939
+
6940
+ // If Freemius was OFF before, turn it on.
6941
+ $this->turn_on();
6942
+
6943
+ $this->do_action( 'after_account_connection', $user, $site );
6944
+
6945
+ if ( is_numeric( $site->license_id ) ) {
6946
+ $this->_license = $this->_get_license_by_id( $site->license_id );
6947
+ }
6948
+
6949
+ $this->_admin_notices->remove_sticky( 'connect_account' );
6950
+
6951
+ if ( $this->is_pending_activation() ) {
6952
+ // Remove pending activation sticky notice (if still exist).
6953
+ $this->_admin_notices->remove_sticky( 'activation_pending' );
6954
+
6955
+ // Remove plugin from pending activation mode.
6956
+ unset( $this->_storage->is_pending_activation );
6957
+
6958
+ if ( ! $this->is_paying_or_trial() ) {
6959
+ $this->_admin_notices->add_sticky(
6960
+ sprintf( __fs( 'plugin-x-activation-message', $this->_slug ), '<b>' . $this->get_plugin_name() . '</b>' ),
6961
+ 'activation_complete'
6962
+ );
6963
+ }
6964
+ }
6965
+
6966
+ if ( $this->is_paying_or_trial() && ! $this->is_premium() ) {
6967
+ if ( $this->is_paying() ) {
6968
+ $this->_admin_notices->add_sticky(
6969
+ sprintf(
6970
+ __fs( 'activation-with-plan-x-message', $this->_slug ),
6971
+ $this->_site->plan->title
6972
+ ) . $this->get_complete_upgrade_instructions(),
6973
+ 'plan_upgraded',
6974
+ __fs( 'yee-haw', $this->_slug ) . '!'
6975
+ );
6976
+ } else {
6977
+ $this->_admin_notices->add_sticky(
6978
+ sprintf(
6979
+ __fs( 'trial-started-message', $this->_slug ),
6980
+ '<i>' . $this->get_plugin_name() . '</i>'
6981
+ ) . $this->get_complete_upgrade_instructions( $this->_storage->trial_plan->title ),
6982
+ 'trial_started',
6983
+ __fs( 'yee-haw', $this->_slug ) . '!'
6984
+ );
6985
+ }
6986
+
6987
+ $this->_admin_notices->remove_sticky( array(
6988
+ 'trial_promotion',
6989
+ ) );
6990
+ }
6991
+
6992
+ $plugin_id = fs_request_get( 'plugin_id', false );
6993
+
6994
+ // Store activation time ONLY for plugins (not add-ons).
6995
+ if ( ! is_numeric( $plugin_id ) || ( $plugin_id == $this->_plugin->id ) ) {
6996
+ $this->_storage->activation_timestamp = WP_FS__SCRIPT_START_TIME;
6997
+ }
6998
+
6999
+ $next_page = '';
7000
+
7001
+ if ( is_numeric( $plugin_id ) ) {
7002
+ if ( $plugin_id != $this->_plugin->id ) {
7003
+ // Add-on was installed - sync license right after install.
7004
+ $next_page = $this->_get_sync_license_url( $plugin_id );
7005
+ }
7006
+ } else {
7007
+ /**
7008
+ * @author Vova Feldman (@svovaf)
7009
+ * @since 1.1.9 If site installed with a valid license, sync license.
7010
+ */
7011
+ if ( $this->is_paying() ) {
7012
+ $this->_sync_plugin_license( true );
7013
+ }
7014
+
7015
+ // Reload the page with the keys.
7016
+ $next_page = $this->is_anonymous() ?
7017
+ // If user previously skipped, redirect to account page.
7018
+ $this->get_account_url() :
7019
+ $this->get_after_activation_url( 'after_connect_url' );
7020
+ }
7021
+
7022
+ if ( ! empty( $next_page ) && $redirect ) {
7023
+ fs_redirect( $next_page );
7024
+ }
7025
+
7026
+ return $next_page;
7027
+ }
7028
+
7029
+ /**
7030
+ * Install plugin with new user information after approval.
7031
+ *
7032
+ * @author Vova Feldman (@svovaf)
7033
+ * @since 1.0.7
7034
+ */
7035
+ function _install_with_new_user() {
7036
+ $this->_logger->entrance();
7037
+
7038
+ if ( $this->is_registered() ) {
7039
+ return;
7040
+ }
7041
+
7042
+ if ( fs_request_is_action( $this->_slug . '_activate_new' ) ) {
7043
+ // check_admin_referer( $this->_slug . '_activate_new' );
7044
+
7045
+ if ( fs_request_has( 'user_secret_key' ) ) {
7046
+ $this->install_with_new_user(
7047
+ fs_request_get( 'user_id' ),
7048
+ fs_request_get( 'user_public_key' ),
7049
+ fs_request_get( 'user_secret_key' ),
7050
+ fs_request_get( 'install_id' ),
7051
+ fs_request_get( 'install_public_key' ),
7052
+ fs_request_get( 'install_secret_key' )
7053
+ );
7054
+ } else if ( fs_request_has( 'pending_activation' ) ) {
7055
+ $this->set_pending_confirmation( fs_request_get( 'user_email' ), true );
7056
+ }
7057
+ }
7058
+ }
7059
+
7060
+ /**
7061
+ * Install plugin with new user.
7062
+ *
7063
+ * @author Vova Feldman (@svovaf)
7064
+ * @since 1.1.7.4
7065
+ *
7066
+ * @param number $user_id
7067
+ * @param string $user_public_key
7068
+ * @param string $user_secret_key
7069
+ * @param number $install_id
7070
+ * @param string $install_public_key
7071
+ * @param string $install_secret_key
7072
+ * @param bool $redirect
7073
+ *
7074
+ * @return string If redirect is `false`, returns the next page the user should be redirected to.
7075
+ */
7076
+ private function install_with_new_user(
7077
+ $user_id,
7078
+ $user_public_key,
7079
+ $user_secret_key,
7080
+ $install_id,
7081
+ $install_public_key,
7082
+ $install_secret_key,
7083
+ $redirect = true
7084
+ ) {
7085
+ $user = new FS_User();
7086
+ $user->id = $user_id;
7087
+ $user->public_key = $user_public_key;
7088
+ $user->secret_key = $user_secret_key;
7089
+
7090
+ $this->_user = $user;
7091
+ $user_result = $this->get_api_user_scope()->get();
7092
+ $user = new FS_User( $user_result );
7093
+ $this->_user = $user;
7094
+
7095
+ $site = new FS_Site();
7096
+ $site->id = $install_id;
7097
+ $site->public_key = $install_public_key;
7098
+ $site->secret_key = $install_secret_key;
7099
+
7100
+ $this->_site = $site;
7101
+ $site_result = $this->get_api_site_scope()->get();
7102
+ $site = new FS_Site( $site_result );
7103
+ $this->_site = $site;
7104
+
7105
+ return $this->setup_account( $this->_user, $this->_site, $redirect );
7106
+ }
7107
+
7108
+ /**
7109
+ * @author Vova Feldman (@svovaf)
7110
+ * @since 1.1.7.4
7111
+ *
7112
+ * @param string|bool $email
7113
+ * @param bool $redirect
7114
+ * @param string|bool $license_key Since 1.2.1.5
7115
+ * @param bool $is_pending_trial Since 1.2.1.5
7116
+ *
7117
+ * @return string Since 1.2.1.5 if $redirect is `false`, return the pending activation page.
7118
+ */
7119
+ private function set_pending_confirmation(
7120
+ $email = false,
7121
+ $redirect = true,
7122
+ $license_key = false,
7123
+ $is_pending_trial = false
7124
+ ) {
7125
+ // Install must be activated via email since
7126
+ // user with the same email already exist.
7127
+ $this->_storage->is_pending_activation = true;
7128
+ $this->_add_pending_activation_notice( $email, $is_pending_trial );
7129
+
7130
+ if ( ! empty( $license_key ) ) {
7131
+ $this->_storage->pending_license_key = $license_key;
7132
+ }
7133
+
7134
+ // Remove the opt-in sticky notice.
7135
+ $this->_admin_notices->remove_sticky( array(
7136
+ 'connect_account',
7137
+ 'trial_promotion',
7138
+ ) );
7139
+
7140
+ $next_page = $this->get_after_activation_url( 'after_pending_connect_url' );
7141
+
7142
+ // Reload the page with with pending activation message.
7143
+ if ( $redirect ) {
7144
+ fs_redirect( $next_page );
7145
+ }
7146
+
7147
+ return $next_page;
7148
+ }
7149
+
7150
+ /**
7151
+ * Install plugin with current logged WP user info.
7152
+ *
7153
+ * @author Vova Feldman (@svovaf)
7154
+ * @since 1.0.7
7155
+ */
7156
+ function _install_with_current_user() {
7157
+ $this->_logger->entrance();
7158
+
7159
+ if ( $this->is_registered() ) {
7160
+ return;
7161
+ }
7162
+
7163
+ if ( fs_request_is_action( $this->_slug . '_activate_existing' ) && fs_request_is_post() ) {
7164
+ // check_admin_referer( 'activate_existing_' . $this->_plugin->public_key );
7165
+
7166
+ /**
7167
+ * @author Vova Feldman (@svovaf)
7168
+ * @since 1.1.9 Add license key if given.
7169
+ */
7170
+ $license_key = fs_request_get( 'license_secret_key' );
7171
+
7172
+ $this->install_with_current_user( $license_key );
7173
+ }
7174
+ }
7175
+
7176
+
7177
+ /**
7178
+ * @author Vova Feldman (@svovaf)
7179
+ * @since 1.1.7.4
7180
+ *
7181
+ * @param string|bool $license_key
7182
+ * @param number|bool $trial_plan_id
7183
+ * @param bool $redirect
7184
+ *
7185
+ * @return string|object If redirect is `false`, returns the next page the user should be redirected to, or the
7186
+ * API error object if failed to install.
7187
+ */
7188
+ private function install_with_current_user(
7189
+ $license_key = false,
7190
+ $trial_plan_id = false,
7191
+ $redirect = true
7192
+ ) {
7193
+ // Get current logged WP user.
7194
+ $current_user = self::_get_current_wp_user();
7195
+
7196
+ // Find the relevant FS user by the email.
7197
+ $user = self::_get_user_by_email( $current_user->user_email );
7198
+
7199
+ // We have to set the user before getting user scope API handler.
7200
+ $this->_user = $user;
7201
+
7202
+ $extra_install_params = array(
7203
+ 'uid' => $this->get_anonymous_id(),
7204
+ );
7205
+
7206
+ if ( ! empty( $license_key ) ) {
7207
+ $filtered_license_key = $this->apply_filters( 'license_key', $license_key );
7208
+ $extra_install_params['license_key'] = $filtered_license_key;
7209
+ } else if ( FS_Plugin_Plan::is_valid_id( $trial_plan_id ) ) {
7210
+ $extra_install_params['trial_plan_id'] = $trial_plan_id;
7211
+ }
7212
+
7213
+ $args = $this->get_install_data_for_api( $extra_install_params, false, false );
7214
+
7215
+ // Install the plugin.
7216
+ $install = $this->get_api_user_scope()->call(
7217
+ "/plugins/{$this->get_id()}/installs.json",
7218
+ 'post',
7219
+ $args
7220
+ );
7221
+
7222
+ if ( ! $this->is_api_result_entity( $install ) ) {
7223
+ if ( ! empty( $args['license_key'] ) ) {
7224
+ // Pass full the fully entered license key to the failure handler.
7225
+ $args['license_key'] = $license_key;
7226
+ }
7227
+
7228
+ $install = $this->apply_filters( 'after_install_failure', $install, $args );
7229
+
7230
+ $this->_admin_notices->add(
7231
+ sprintf( __fs( 'could-not-activate-x', $this->_slug ), $this->get_plugin_name() ) . ' ' .
7232
+ __fs( 'contact-us-with-error-message', $this->_slug ) . ' ' . '<b>' . $install->error->message . '</b>',
7233
+ __fs( 'oops', $this->_slug ) . '...',
7234
+ 'error'
7235
+ );
7236
+
7237
+ if ( $redirect ) {
7238
+ fs_redirect( $this->get_activation_url( array( 'error' => $install->error->message ) ) );
7239
+ }
7240
+
7241
+ return $install;
7242
+ }
7243
+
7244
+ $site = new FS_Site( $install );
7245
+ $this->_site = $site;
7246
+
7247
+ return $this->setup_account( $this->_user, $this->_site, $redirect );
7248
+ }
7249
+
7250
+ /**
7251
+ * Tries to activate add-on account based on parent plugin info.
7252
+ *
7253
+ * @author Vova Feldman (@svovaf)
7254
+ * @since 1.0.6
7255
+ *
7256
+ * @param Freemius $parent_fs
7257
+ */
7258
+ private function _activate_addon_account( Freemius $parent_fs ) {
7259
+ if ( $this->is_registered() ) {
7260
+ // Already activated.
7261
+ return;
7262
+ }
7263
+
7264
+ // Activate add-on with parent plugin credentials.
7265
+ $addon_install = $parent_fs->get_api_site_scope()->call(
7266
+ "/addons/{$this->_plugin->id}/installs.json",
7267
+ 'post',
7268
+ $this->get_install_data_for_api( array(
7269
+ 'uid' => $this->get_anonymous_id(),
7270
+ ), false, false )
7271
+ );
7272
+
7273
+ if ( isset( $addon_install->error ) ) {
7274
+ $this->_admin_notices->add(
7275
+ sprintf( __fs( 'could-not-activate-x', $this->_slug ), $this->get_plugin_name() ) . ' ' .
7276
+ __fs( 'contact-us-with-error-message', $this->_slug ) . ' ' . '<b>' . $addon_install->error->message . '</b>',
7277
+ __fs( 'oops', $this->_slug ) . '...',
7278
+ 'error'
7279
+ );
7280
+
7281
+ return;
7282
+ }
7283
+
7284
+ // First of all, set site info - otherwise we won't
7285
+ // be able to invoke API calls.
7286
+ $this->_site = new FS_Site( $addon_install );
7287
+
7288
+ // Sync add-on plans.
7289
+ $this->_sync_plans();
7290
+
7291
+ // Get site's current plan.
7292
+ $this->_site->plan = $this->_get_plan_by_id( $this->_site->plan->id );
7293
+
7294
+ // Get user information based on parent's plugin.
7295
+ $user = $parent_fs->get_user();
7296
+
7297
+ $this->_set_account( $user, $this->_site );
7298
+
7299
+ // Sync licenses.
7300
+ $this->_sync_licenses();
7301
+
7302
+ // Try to activate premium license.
7303
+ $this->_activate_license( true );
7304
+ }
7305
+
7306
+ #endregion
7307
+
7308
+ #----------------------------------------------------------------------------------
7309
+ #region Admin Menu Items
7310
+ #----------------------------------------------------------------------------------
7311
+
7312
+ private $_menu_items = array();
7313
+
7314
+ /**
7315
+ * @author Vova Feldman (@svovaf)
7316
+ * @since 1.0.7
7317
+ *
7318
+ * @return string
7319
+ */
7320
+ function get_menu_slug() {
7321
+ return $this->_menu->get_slug();
7322
+ }
7323
+
7324
+ /**
7325
+ * @author Vova Feldman (@svovaf)
7326
+ * @since 1.0.9
7327
+ */
7328
+ function _prepare_admin_menu() {
7329
+ // if ( ! $this->is_on() ) {
7330
+ // return;
7331
+ // }
7332
+
7333
+ if ( ! $this->has_api_connectivity() && ! $this->is_enable_anonymous() ) {
7334
+ $this->_menu->remove_menu_item();
7335
+ } else {
7336
+ $this->do_action( 'before_admin_menu_init' );
7337
+
7338
+ $this->add_menu_action();
7339
+ $this->add_submenu_items();
7340
+ }
7341
+ }
7342
+
7343
+ /**
7344
+ * Admin dashboard menu items modifications.
7345
+ *
7346
+ * NOTE: admin_menu action executed before admin_init.
7347
+ *
7348
+ * @author Vova Feldman (@svovaf)
7349
+ * @since 1.0.7
7350
+ *
7351
+ */
7352
+ private function add_menu_action() {
7353
+ if ( $this->is_activation_mode() ) {
7354
+ $this->override_plugin_menu_with_activation();
7355
+ } else {
7356
+ // If not registered try to install user.
7357
+ if ( ! $this->is_registered() &&
7358
+ fs_request_is_action( $this->_slug . '_activate_new' )
7359
+ ) {
7360
+ $this->_install_with_new_user();
7361
+ }
7362
+ }
7363
+ }
7364
+
7365
+ /**
7366
+ * @author Vova Feldman (@svovaf)
7367
+ * @since 1.0.1
7368
+ */
7369
+ function _redirect_on_clicked_menu_link() {
7370
+ $this->_logger->entrance();
7371
+
7372
+ $page = strtolower( isset( $_REQUEST['page'] ) ? $_REQUEST['page'] : '' );
7373
+
7374
+ $this->_logger->log( 'page = ' . $page );
7375
+
7376
+ foreach ( $this->_menu_items as $priority => $items ) {
7377
+ foreach ( $items as $item ) {
7378
+ if ( isset( $item['url'] ) ) {
7379
+ if ( $page === $this->_menu->get_slug( strtolower( $item['menu_slug'] ) ) ) {
7380
+ $this->_logger->log( 'Redirecting to ' . $item['url'] );
7381
+
7382
+ fs_redirect( $item['url'] );
7383
+ }
7384
+ }
7385
+ }
7386
+ }
7387
+ }
7388
+
7389
+ /**
7390
+ * Remove plugin's all admin menu items & pages, and replace with activation page.
7391
+ *
7392
+ * @author Vova Feldman (@svovaf)
7393
+ * @since 1.0.1
7394
+ */
7395
+ private function override_plugin_menu_with_activation() {
7396
+ $this->_logger->entrance();
7397
+
7398
+ $hook = false;
7399
+
7400
+ if ( $this->_menu->is_top_level() ) {
7401
+ $hook = $this->_menu->override_menu_item( array( &$this, '_connect_page_render' ) );
7402
+
7403
+ if ( false === $hook ) {
7404
+ // Create new menu item just for the opt-in.
7405
+ $hook = add_menu_page(
7406
+ $this->get_plugin_name(),
7407
+ $this->get_plugin_name(),
7408
+ 'manage_options',
7409
+ $this->_menu->get_slug(),
7410
+ array( &$this, '_connect_page_render' )
7411
+ );
7412
+ }
7413
+ } else {
7414
+ $menus = array( $this->_menu->get_parent_slug() );
7415
+
7416
+ if ( $this->_menu->is_override_exact() ) {
7417
+ // Make sure the current page is matching the activation page.
7418
+ $activation_url = strtolower( $this->get_activation_url() );
7419
+ $request_url = strtolower( $_SERVER['REQUEST_URI'] );
7420
+
7421
+ if ( parse_url( $activation_url, PHP_URL_PATH ) !== parse_url( $request_url, PHP_URL_PATH ) ) {
7422
+ // Different path - DO NOT OVERRIDE PAGE.
7423
+ return;
7424
+ }
7425
+
7426
+ $activation_url_params = array();
7427
+ parse_str( parse_url( $activation_url, PHP_URL_QUERY ), $activation_url_params );
7428
+
7429
+ $request_url_params = array();
7430
+ parse_str( parse_url( $request_url, PHP_URL_QUERY ), $request_url_params );
7431
+
7432
+
7433
+ foreach ( $activation_url_params as $key => $val ) {
7434
+ if ( ! isset( $request_url_params[ $key ] ) || $val != $request_url_params[ $key ] ) {
7435
+ // Not matching query string - DO NOT OVERRIDE PAGE.
7436
+ return;
7437
+ }
7438
+ }
7439
+ }
7440
+
7441
+ foreach ( $menus as $parent_slug ) {
7442
+ $hook = $this->_menu->override_submenu_action(
7443
+ $parent_slug,
7444
+ $this->_menu->get_raw_slug(),
7445
+ array( &$this, '_connect_page_render' )
7446
+ );
7447
+
7448
+ if ( false !== $hook ) {
7449
+ // Found plugin's submenu item.
7450
+ break;
7451
+ }
7452
+ }
7453
+ }
7454
+
7455
+ if ( $this->_menu->is_activation_page() ) {
7456
+ // Clean admin page from distracting content.
7457
+ self::_clean_admin_content_section();
7458
+ }
7459
+
7460
+ if ( false !== $hook ) {
7461
+ if ( fs_request_is_action( $this->_slug . '_activate_existing' ) ) {
7462
+ add_action( "load-$hook", array( &$this, '_install_with_current_user' ) );
7463
+ } else if ( fs_request_is_action( $this->_slug . '_activate_new' ) ) {
7464
+ add_action( "load-$hook", array( &$this, '_install_with_new_user' ) );
7465
+ }
7466
+ }
7467
+ }
7468
+
7469
+ /**
7470
+ * @author Leo Fajardo (leorw)
7471
+ * @since 1.2.1
7472
+ *
7473
+ * return string
7474
+ */
7475
+ function get_top_level_menu_capability() {
7476
+ global $menu;
7477
+
7478
+ $top_level_menu_slug = $this->get_top_level_menu_slug();
7479
+
7480
+ foreach ( $menu as $menu_info ) {
7481
+ /**
7482
+ * The second element in the menu info array is the capability/role that has access to the menu and the
7483
+ * third element is the menu slug.
7484
+ */
7485
+ if ( $menu_info[2] === $top_level_menu_slug ) {
7486
+ return $menu_info[1];
7487
+ }
7488
+ }
7489
+
7490
+ return 'read';
7491
+ }
7492
+
7493
+ /**
7494
+ * @author Vova Feldman (@svovaf)
7495
+ * @since 1.0.0
7496
+ *
7497
+ * @return string
7498
+ */
7499
+ private function get_top_level_menu_slug() {
7500
+ return ( $this->is_addon() ?
7501
+ $this->get_parent_instance()->_menu->get_top_level_menu_slug() :
7502
+ $this->_menu->get_top_level_menu_slug() );
7503
+ }
7504
+
7505
+ /**
7506
+ * Add default Freemius menu items.
7507
+ *
7508
+ * @author Vova Feldman (@svovaf)
7509
+ * @since 1.0.0
7510
+ */
7511
+ private function add_submenu_items() {
7512
+ $this->_logger->entrance();
7513
+
7514
+ if ( ! $this->is_addon() ) {
7515
+ if ( ! $this->is_activation_mode() ) {
7516
+ if ( $this->is_registered() ) {
7517
+ // Add user account page.
7518
+ $this->add_submenu_item(
7519
+ __fs( 'account', $this->_slug ),
7520
+ array( &$this, '_account_page_render' ),
7521
+ $this->get_plugin_name() . ' &ndash; ' . __fs( 'account', $this->_slug ),
7522
+ 'manage_options',
7523
+ 'account',
7524
+ array( &$this, '_account_page_load' ),
7525
+ WP_FS__DEFAULT_PRIORITY,
7526
+ $this->_menu->is_submenu_item_visible( 'account' )
7527
+ );
7528
+ }
7529
+
7530
+ // Add contact page.
7531
+ $this->add_submenu_item(
7532
+ __fs( 'contact-us', $this->_slug ),
7533
+ array( &$this, '_contact_page_render' ),
7534
+ $this->get_plugin_name() . ' &ndash; ' . __fs( 'contact-us', $this->_slug ),
7535
+ 'manage_options',
7536
+ 'contact',
7537
+ 'Freemius::_clean_admin_content_section',
7538
+ WP_FS__DEFAULT_PRIORITY,
7539
+ $this->_menu->is_submenu_item_visible( 'contact' )
7540
+ );
7541
+
7542
+ if ( $this->has_addons() ) {
7543
+ $this->add_submenu_item(
7544
+ __fs( 'add-ons', $this->_slug ),
7545
+ array( &$this, '_addons_page_render' ),
7546
+ $this->get_plugin_name() . ' &ndash; ' . __fs( 'add-ons', $this->_slug ),
7547
+ 'manage_options',
7548
+ 'addons',
7549
+ array( &$this, '_addons_page_load' ),
7550
+ WP_FS__LOWEST_PRIORITY - 1,
7551
+ $this->_menu->is_submenu_item_visible( 'addons' )
7552
+ );
7553
+ }
7554
+
7555
+ $show_pricing = ( $this->has_paid_plan() && $this->_menu->is_submenu_item_visible( 'pricing' ) );
7556
+ // If user don't have paid plans, add pricing page
7557
+ // to support add-ons checkout but don't add the submenu item.
7558
+ // || (isset( $_GET['page'] ) && $this->_menu->get_slug( 'pricing' ) == $_GET['page']);
7559
+
7560
+ $pricing_cta_slug = 'upgrade';
7561
+ $pricing_class = 'upgrade-mode';
7562
+ if ( $show_pricing ) {
7563
+ if ( $this->_admin_notices->has_sticky( 'trial_promotion' ) &&
7564
+ ! $this->is_paying_or_trial()
7565
+ ) {
7566
+ // If running a trial promotion, modify the pricing to load the trial.
7567
+ $pricing_cta_slug = 'start-trial';
7568
+ $pricing_class = 'trial-mode';
7569
+ } else if ( $this->is_paying() ) {
7570
+ $pricing_cta_slug = 'pricing';
7571
+ $pricing_class = '';
7572
+ }
7573
+ }
7574
+
7575
+ // Add upgrade/pricing page.
7576
+ $this->add_submenu_item(
7577
+ __fs( $pricing_cta_slug, $this->_slug ) . '&nbsp;&nbsp;&#x27a4;',
7578
+ array( &$this, '_pricing_page_render' ),
7579
+ $this->get_plugin_name() . ' &ndash; ' . __fs( 'pricing', $this->_slug ),
7580
+ 'manage_options',
7581
+ 'pricing',
7582
+ 'Freemius::_clean_admin_content_section',
7583
+ WP_FS__LOWEST_PRIORITY,
7584
+ $show_pricing,
7585
+ $pricing_class
7586
+ );
7587
+ }
7588
+ }
7589
+
7590
+
7591
+ if ( 0 < count( $this->_menu_items ) ) {
7592
+ if ( ! $this->_menu->is_top_level() ) {
7593
+ fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
7594
+
7595
+ // Append submenu items right after the plugin's submenu item.
7596
+ $this->order_sub_submenu_items();
7597
+ } else {
7598
+ // Append submenu items.
7599
+ $this->embed_submenu_items();
7600
+ }
7601
+ }
7602
+ }
7603
+
7604
+ /**
7605
+ * Moved the actual submenu item additions to a separated function,
7606
+ * in order to support sub-submenu items when the plugin's settings
7607
+ * only have a submenu and not top-level menu item.
7608
+ *
7609
+ * @author Vova Feldman (@svovaf)
7610
+ * @since 1.1.4
7611
+ */
7612
+ private function embed_submenu_items() {
7613
+ $item_template = $this->_menu->is_top_level() ?
7614
+ '<span class="fs-submenu-item %s %s %s">%s</span>' :
7615
+ '<span class="fs-submenu-item fs-sub %s %s %s">%s</span>';
7616
+
7617
+ $top_level_menu_capability = $this->get_top_level_menu_capability();
7618
+
7619
+ ksort( $this->_menu_items );
7620
+
7621
+ foreach ( $this->_menu_items as $priority => $items ) {
7622
+ foreach ( $items as $item ) {
7623
+ $capability = ( ! empty( $item['capability'] ) ? $item['capability'] : $top_level_menu_capability );
7624
+
7625
+ $menu_item = sprintf(
7626
+ $item_template,
7627
+ $this->_slug,
7628
+ $item['menu_slug'],
7629
+ ! empty( $item['class'] ) ? $item['class'] : '',
7630
+ $item['menu_title']
7631
+ );
7632
+
7633
+ $menu_slug = $this->_menu->get_slug( $item['menu_slug'] );
7634
+
7635
+ if ( ! isset( $item['url'] ) ) {
7636
+ $hook = add_submenu_page(
7637
+ $item['show_submenu'] ?
7638
+ $this->get_top_level_menu_slug() :
7639
+ null,
7640
+ $item['page_title'],
7641
+ $menu_item,
7642
+ $capability,
7643
+ $menu_slug,
7644
+ $item['render_function']
7645
+ );
7646
+
7647
+ if ( false !== $item['before_render_function'] ) {
7648
+ add_action( "load-$hook", $item['before_render_function'] );
7649
+ }
7650
+ } else {
7651
+ add_submenu_page(
7652
+ $this->get_top_level_menu_slug(),
7653
+ $item['page_title'],
7654
+ $menu_item,
7655
+ $capability,
7656
+ $menu_slug,
7657
+ array( $this, '' )
7658
+ );
7659
+ }
7660
+ }
7661
+ }
7662
+ }
7663
+
7664
+ /**
7665
+ * Re-order the submenu items so all Freemius added new submenu items
7666
+ * are added right after the plugin's settings submenu item.
7667
+ *
7668
+ * @author Vova Feldman (@svovaf)
7669
+ * @since 1.1.4
7670
+ */
7671
+ private function order_sub_submenu_items() {
7672
+ global $submenu;
7673
+
7674
+ $menu_slug = $this->_menu->get_top_level_menu_slug();
7675
+
7676
+ /**
7677
+ * Before "admin_menu" fires, WordPress will loop over the default submenus and remove pages for which the user
7678
+ * does not have permissions. So in case a plugin does not have top-level menu but does have submenus under any
7679
+ * of the default menus, only users that have the right role can access its sub-submenus (Account, Contact Us,
7680
+ * Support Forum, etc.) since $submenu[ $menu_slug ] will be empty if the user doesn't have permission.
7681
+ *
7682
+ * In case a plugin does not have submenus under any of the default menus but does have submenus under the menu
7683
+ * of another plugin, only users that have the right role can access its sub-submenus since we will use the
7684
+ * capability needed to access the parent menu as the capability for the submenus that we will add.
7685
+ */
7686
+ if ( empty( $submenu[ $menu_slug ] ) ) {
7687
+ return;
7688
+ }
7689
+
7690
+ $top_level_menu = &$submenu[ $menu_slug ];
7691
+
7692
+ $all_submenu_items_after = array();
7693
+
7694
+ $found_submenu_item = false;
7695
+
7696
+ foreach ( $top_level_menu as $submenu_id => $meta ) {
7697
+ if ( $found_submenu_item ) {
7698
+ // Remove all submenu items after the plugin's submenu item.
7699
+ $all_submenu_items_after[] = $meta;
7700
+ unset( $top_level_menu[ $submenu_id ] );
7701
+ }
7702
+
7703
+ if ( $this->_menu->get_raw_slug() === $meta[2] ) {
7704
+ // Found the submenu item, put all below.
7705
+ $found_submenu_item = true;
7706
+ continue;
7707
+ }
7708
+ }
7709
+
7710
+ // Embed all plugin's new submenu items.
7711
+ $this->embed_submenu_items();
7712
+
7713
+ // Start with specially high number to make sure it's appended.
7714
+ $i = max( 10000, max( array_keys( $top_level_menu ) ) + 1 );
7715
+ foreach ( $all_submenu_items_after as $meta ) {
7716
+ $top_level_menu[ $i ] = $meta;
7717
+ $i ++;
7718
+ }
7719
+
7720
+ // Sort submenu items.
7721
+ ksort( $top_level_menu );
7722
+ }
7723
+
7724
+ /**
7725
+ * Displays the Support Forum link when enabled.
7726
+ *
7727
+ * Can be filtered like so:
7728
+ *
7729
+ * function _fs_show_support_menu( $is_visible, $menu_id ) {
7730
+ * if ( 'support' === $menu_id ) {
7731
+ * return _fs->is_registered();
7732
+ * }
7733
+ * return $is_visible;
7734
+ * }
7735
+ * _fs()->add_filter('is_submenu_visible', '_fs_show_support_menu', 10, 2);
7736
+ *
7737
+ */
7738
+ function _add_default_submenu_items() {
7739
+ if ( ! $this->is_on() ) {
7740
+ return;
7741
+ }
7742
+
7743
+ if ( ! $this->is_activation_mode() ) {
7744
+ if ( $this->_menu->is_submenu_item_visible( 'support' ) ) {
7745
+ $this->add_submenu_link_item(
7746
+ $this->apply_filters( 'support_forum_submenu', __fs( 'support-forum', $this->_slug ) ),
7747
+ $this->apply_filters( 'support_forum_url', 'https://wordpress.org/support/plugin/' . $this->_slug ),
7748
+ 'wp-support-forum',
7749
+ null,
7750
+ 50
7751
+ );
7752
+ }
7753
+ }
7754
+ }
7755
+
7756
+ /**
7757
+ * @author Vova Feldman (@svovaf)
7758
+ * @since 1.0.1
7759
+ *
7760
+ * @param string $menu_title
7761
+ * @param callable $render_function
7762
+ * @param bool|string $page_title
7763
+ * @param string $capability
7764
+ * @param bool|string $menu_slug
7765
+ * @param bool|callable $before_render_function
7766
+ * @param int $priority
7767
+ * @param bool $show_submenu
7768
+ * @param string $class Since 1.2.1.5 can add custom classes to menu items.
7769
+ */
7770
+ function add_submenu_item(
7771
+ $menu_title,
7772
+ $render_function,
7773
+ $page_title = false,
7774
+ $capability = 'manage_options',
7775
+ $menu_slug = false,
7776
+ $before_render_function = false,
7777
+ $priority = WP_FS__DEFAULT_PRIORITY,
7778
+ $show_submenu = true,
7779
+ $class = ''
7780
+ ) {
7781
+ $this->_logger->entrance( 'Title = ' . $menu_title );
7782
+
7783
+ if ( $this->is_addon() ) {
7784
+ $parent_fs = $this->get_parent_instance();
7785
+
7786
+ if ( is_object( $parent_fs ) ) {
7787
+ $parent_fs->add_submenu_item(
7788
+ $menu_title,
7789
+ $render_function,
7790
+ $page_title,
7791
+ $capability,
7792
+ $menu_slug,
7793
+ $before_render_function,
7794
+ $priority,
7795
+ $show_submenu,
7796
+ $class
7797
+ );
7798
+
7799
+ return;
7800
+ }
7801
+ }
7802
+
7803
+ if ( ! isset( $this->_menu_items[ $priority ] ) ) {
7804
+ $this->_menu_items[ $priority ] = array();
7805
+ }
7806
+
7807
+ $this->_menu_items[ $priority ][] = array(
7808
+ 'page_title' => is_string( $page_title ) ? $page_title : $menu_title,
7809
+ 'menu_title' => $menu_title,
7810
+ 'capability' => $capability,
7811
+ 'menu_slug' => is_string( $menu_slug ) ? $menu_slug : strtolower( $menu_title ),
7812
+ 'render_function' => $render_function,
7813
+ 'before_render_function' => $before_render_function,
7814
+ 'show_submenu' => $show_submenu,
7815
+ 'class' => $class,
7816
+ );
7817
+ }
7818
+
7819
+ /**
7820
+ * @author Vova Feldman (@svovaf)
7821
+ * @since 1.0.1
7822
+ *
7823
+ * @param string $menu_title
7824
+ * @param string $url
7825
+ * @param bool $menu_slug
7826
+ * @param string $capability
7827
+ * @param int $priority
7828
+ *
7829
+ */
7830
+ function add_submenu_link_item(
7831
+ $menu_title,
7832
+ $url,
7833
+ $menu_slug = false,
7834
+ $capability = 'read',
7835
+ $priority = WP_FS__DEFAULT_PRIORITY
7836
+ ) {
7837
+ $this->_logger->entrance( 'Title = ' . $menu_title . '; Url = ' . $url );
7838
+
7839
+ if ( $this->is_addon() ) {
7840
+ $parent_fs = $this->get_parent_instance();
7841
+
7842
+ if ( is_object( $parent_fs ) ) {
7843
+ $parent_fs->add_submenu_link_item(
7844
+ $menu_title,
7845
+ $url,
7846
+ $menu_slug,
7847
+ $capability,
7848
+ $priority
7849
+ );
7850
+
7851
+ return;
7852
+ }
7853
+ }
7854
+
7855
+ if ( ! isset( $this->_menu_items[ $priority ] ) ) {
7856
+ $this->_menu_items[ $priority ] = array();
7857
+ }
7858
+
7859
+ $this->_menu_items[ $priority ][] = array(
7860
+ 'menu_title' => $menu_title,
7861
+ 'capability' => $capability,
7862
+ 'menu_slug' => is_string( $menu_slug ) ? $menu_slug : strtolower( $menu_title ),
7863
+ 'url' => $url,
7864
+ 'page_title' => $menu_title,
7865
+ 'render_function' => 'fs_dummy',
7866
+ 'before_render_function' => '',
7867
+ );
7868
+ }
7869
+
7870
+ #endregion ------------------------------------------------------------------
7871
+
7872
+ /* Actions / Hooks / Filters
7873
+ ------------------------------------------------------------------------------------------------------------------*/
7874
+ /**
7875
+ * @author Vova Feldman (@svovaf)
7876
+ * @since 1.1.7
7877
+ *
7878
+ * @param string $tag
7879
+ *
7880
+ * @return string
7881
+ */
7882
+ public function get_action_tag( $tag ) {
7883
+ return "fs_{$tag}_{$this->_slug}";
7884
+ }
7885
+
7886
+ /**
7887
+ * @author Vova Feldman (@svovaf)
7888
+ * @since 1.2.1
7889
+ *
7890
+ * @param string $tag
7891
+ *
7892
+ * @return string
7893
+ */
7894
+ private function get_ajax_action_tag( $tag ) {
7895
+ return 'wp_ajax_' . $this->get_action_tag( $tag );
7896
+ }
7897
+
7898
+ /**
7899
+ * Do action, specific for the current context plugin.
7900
+ *
7901
+ * @author Vova Feldman (@svovaf)
7902
+ * @since 1.0.1
7903
+ *
7904
+ * @param string $tag The name of the action to be executed.
7905
+ * @param mixed $arg,... Optional. Additional arguments which are passed on to the
7906
+ * functions hooked to the action. Default empty.
7907
+ *
7908
+ * @uses do_action()
7909
+ */
7910
+ function do_action( $tag, $arg = '' ) {
7911
+ $this->_logger->entrance( $tag );
7912
+
7913
+ $args = func_get_args();
7914
+
7915
+ call_user_func_array( 'do_action', array_merge(
7916
+ array( $this->get_action_tag( $tag ) ),
7917
+ array_slice( $args, 1 ) )
7918
+ );
7919
+ }
7920
+
7921
+ /**
7922
+ * Add action, specific for the current context plugin.
7923
+ *
7924
+ * @author Vova Feldman (@svovaf)
7925
+ * @since 1.0.1
7926
+ *
7927
+ * @param string $tag
7928
+ * @param callable $function_to_add
7929
+ * @param int $priority
7930
+ * @param int $accepted_args
7931
+ *
7932
+ * @uses add_action()
7933
+ */
7934
+ function add_action( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
7935
+ $this->_logger->entrance( $tag );
7936
+
7937
+ add_action( $this->get_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
7938
+ }
7939
+
7940
+ /**
7941
+ * Add AJAX action, specific for the current context plugin.
7942
+ *
7943
+ * @author Vova Feldman (@svovaf)
7944
+ * @since 1.2.1
7945
+ *
7946
+ * @param string $tag
7947
+ * @param callable $function_to_add
7948
+ * @param int $priority
7949
+ * @param int $accepted_args
7950
+ *
7951
+ * @uses add_action()
7952
+ *
7953
+ * @return bool True if action added, false if no need to add the action since the AJAX call isn't matching.
7954
+ */
7955
+ function add_ajax_action( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
7956
+ $this->_logger->entrance( $tag );
7957
+
7958
+ if ( ! $this->is_ajax_action( $tag ) ) {
7959
+ return false;
7960
+ }
7961
+
7962
+ add_action( $this->get_ajax_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
7963
+
7964
+ $this->_logger->info( "$tag AJAX callback action added." );
7965
+
7966
+ return true;
7967
+ }
7968
+
7969
+ /**
7970
+ * Send a JSON response back to an Ajax request.
7971
+ *
7972
+ * @author Vova Feldman (@svovaf)
7973
+ * @since 1.2.1.5
7974
+ *
7975
+ * @param mixed $response
7976
+ */
7977
+ function shoot_ajax_response( $response ) {
7978
+ wp_send_json( $response );
7979
+ }
7980
+
7981
+ /**
7982
+ * Send a JSON response back to an Ajax request, indicating success.
7983
+ *
7984
+ * @author Vova Feldman (@svovaf)
7985
+ * @since 1.2.1.5
7986
+ *
7987
+ * @param mixed $data Data to encode as JSON, then print and exit.
7988
+ */
7989
+ function shoot_ajax_success( $data = null ) {
7990
+ wp_send_json_success( $data );
7991
+ }
7992
+
7993
+ /**
7994
+ * Send a JSON response back to an Ajax request, indicating failure.
7995
+ *
7996
+ * @author Vova Feldman (@svovaf)
7997
+ * @since 1.2.1.5
7998
+ *
7999
+ * @param mixed $error Optional error message.
8000
+ */
8001
+ function shoot_ajax_failure( $error = '' ) {
8002
+ $result = array( 'success' => false );
8003
+ if ( ! empty( $error ) ) {
8004
+ $result['error'] = $error;
8005
+ }
8006
+
8007
+ wp_send_json( $result );
8008
+ }
8009
+
8010
+ /**
8011
+ * Apply filter, specific for the current context plugin.
8012
+ *
8013
+ * @author Vova Feldman (@svovaf)
8014
+ * @since 1.0.9
8015
+ *
8016
+ * @param string $tag The name of the filter hook.
8017
+ * @param mixed $value The value on which the filters hooked to `$tag` are applied on.
8018
+ *
8019
+ * @return mixed The filtered value after all hooked functions are applied to it.
8020
+ *
8021
+ * @uses apply_filters()
8022
+ */
8023
+ function apply_filters( $tag, $value ) {
8024
+ $this->_logger->entrance( $tag );
8025
+
8026
+ $args = func_get_args();
8027
+ array_unshift( $args, $this->_slug );
8028
+
8029
+ return call_user_func_array( 'fs_apply_filter', $args );
8030
+ }
8031
+
8032
+ /**
8033
+ * Add filter, specific for the current context plugin.
8034
+ *
8035
+ * @author Vova Feldman (@svovaf)
8036
+ * @since 1.0.9
8037
+ *
8038
+ * @param string $tag
8039
+ * @param callable $function_to_add
8040
+ * @param int $priority
8041
+ * @param int $accepted_args
8042
+ *
8043
+ * @uses add_filter()
8044
+ */
8045
+ function add_filter( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
8046
+ $this->_logger->entrance( $tag );
8047
+
8048
+ add_filter( $this->get_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
8049
+ }
8050
+
8051
+ /**
8052
+ * Check if has filter.
8053
+ *
8054
+ * @author Vova Feldman (@svovaf)
8055
+ * @since 1.1.4
8056
+ *
8057
+ * @param string $tag
8058
+ * @param callable|bool $function_to_check Optional. The callback to check for. Default false.
8059
+ *
8060
+ * @return false|int
8061
+ *
8062
+ * @uses has_filter()
8063
+ */
8064
+ function has_filter( $tag, $function_to_check = false ) {
8065
+ $this->_logger->entrance( $tag );
8066
+
8067
+ return has_filter( $this->get_action_tag( $tag ), $function_to_check );
8068
+ }
8069
+
8070
+ /**
8071
+ * Override default i18n text phrases.
8072
+ *
8073
+ * @author Vova Feldman (@svovaf)
8074
+ * @since 1.1.6
8075
+ *
8076
+ * @param string[] string $key_value
8077
+ *
8078
+ * @uses fs_override_i18n()
8079
+ */
8080
+ function override_i18n( $key_value ) {
8081
+ fs_override_i18n( $key_value, $this->_slug );
8082
+ }
8083
+
8084
+ /* Account Page
8085
+ ------------------------------------------------------------------------------------------------------------------*/
8086
+ /**
8087
+ * Update site information.
8088
+ *
8089
+ * @author Vova Feldman (@svovaf)
8090
+ * @since 1.0.1
8091
+ *
8092
+ * @param bool $store Flush to Database if true.
8093
+ */
8094
+ private function _store_site( $store = true ) {
8095
+ $this->_logger->entrance();
8096
+
8097
+ if ( empty( $this->_site->id ) ) {
8098
+ $this->_logger->error( "Empty install ID, can't store site." );
8099
+
8100
+ return;
8101
+ }
8102
+
8103
+ $encrypted_site = clone $this->_site;
8104
+ $encrypted_site->plan = $this->_encrypt_entity( $this->_site->plan );
8105
+
8106
+ $sites = self::get_all_sites();
8107
+ $sites[ $this->_slug ] = $encrypted_site;
8108
+ self::$_accounts->set_option( 'sites', $sites, $store );
8109
+ }
8110
+
8111
+ /**
8112
+ * Update plugin's plans information.
8113
+ *
8114
+ * @author Vova Feldman (@svovaf)
8115
+ * @since 1.0.2
8116
+ *
8117
+ * @param bool $store Flush to Database if true.
8118
+ */
8119
+ private function _store_plans( $store = true ) {
8120
+ $this->_logger->entrance();
8121
+
8122
+ $plans = self::get_all_plans();
8123
+
8124
+ // Copy plans.
8125
+ $encrypted_plans = array();
8126
+ for ( $i = 0, $len = count( $this->_plans ); $i < $len; $i ++ ) {
8127
+ $encrypted_plans[] = $this->_encrypt_entity( $this->_plans[ $i ] );
8128
+ }
8129
+
8130
+ $plans[ $this->_slug ] = $encrypted_plans;
8131
+ self::$_accounts->set_option( 'plans', $plans, $store );
8132
+ }
8133
+
8134
+ /**
8135
+ * Update user's plugin licenses.
8136
+ *
8137
+ * @author Vova Feldman (@svovaf)
8138
+ * @since 1.0.5
8139
+ *
8140
+ * @param bool $store
8141
+ * @param string|bool $plugin_slug
8142
+ * @param FS_Plugin_License[] $licenses
8143
+ */
8144
+ private function _store_licenses( $store = true, $plugin_slug = false, $licenses = array() ) {
8145
+ $this->_logger->entrance();
8146
+
8147
+ $all_licenses = self::get_all_licenses();
8148
+
8149
+ if ( ! is_string( $plugin_slug ) ) {
8150
+ $plugin_slug = $this->_slug;
8151
+ $licenses = $this->_licenses;
8152
+ }
8153
+
8154
+ if ( ! isset( $all_licenses[ $plugin_slug ] ) ) {
8155
+ $all_licenses[ $plugin_slug ] = array();
8156
+ }
8157
+
8158
+ $all_licenses[ $plugin_slug ][ $this->_user->id ] = $licenses;
8159
+
8160
+ self::$_accounts->set_option( 'licenses', $all_licenses, $store );
8161
+ }
8162
+
8163
+ /**
8164
+ * Update user information.
8165
+ *
8166
+ * @author Vova Feldman (@svovaf)
8167
+ * @since 1.0.1
8168
+ *
8169
+ * @param bool $store Flush to Database if true.
8170
+ */
8171
+ private function _store_user( $store = true ) {
8172
+ $this->_logger->entrance();
8173
+
8174
+ if ( empty( $this->_user->id ) ) {
8175
+ $this->_logger->error( "Empty user ID, can't store user." );
8176
+
8177
+ return;
8178
+ }
8179
+
8180
+ $users = self::get_all_users();
8181
+ $users[ $this->_user->id ] = $this->_user;
8182
+ self::$_accounts->set_option( 'users', $users, $store );
8183
+ }
8184
+
8185
+ /**
8186
+ * Update new updates information.
8187
+ *
8188
+ * @author Vova Feldman (@svovaf)
8189
+ * @since 1.0.4
8190
+ *
8191
+ * @param FS_Plugin_Tag|null $update
8192
+ * @param bool $store Flush to Database if true.
8193
+ * @param bool|number $plugin_id
8194
+ */
8195
+ private function _store_update( $update, $store = true, $plugin_id = false ) {
8196
+ $this->_logger->entrance();
8197
+
8198
+ if ( $update instanceof FS_Plugin_Tag ) {
8199
+ $update->updated = time();
8200
+ }
8201
+
8202
+ if ( ! is_numeric( $plugin_id ) ) {
8203
+ $plugin_id = $this->_plugin->id;
8204
+ }
8205
+
8206
+ $updates = self::get_all_updates();
8207
+ $updates[ $plugin_id ] = $update;
8208
+ self::$_accounts->set_option( 'updates', $updates, $store );
8209
+ }
8210
+
8211
+ /**
8212
+ * Update new updates information.
8213
+ *
8214
+ * @author Vova Feldman (@svovaf)
8215
+ * @since 1.0.6
8216
+ *
8217
+ * @param FS_Plugin[] $plugin_addons
8218
+ * @param bool $store Flush to Database if true.
8219
+ */
8220
+ private function _store_addons( $plugin_addons, $store = true ) {
8221
+ $this->_logger->entrance();
8222
+
8223
+ $addons = self::get_all_addons();
8224
+ $addons[ $this->_plugin->id ] = $plugin_addons;
8225
+ self::$_accounts->set_option( 'addons', $addons, $store );
8226
+ }
8227
+
8228
+ /**
8229
+ * Delete plugin's associated add-ons.
8230
+ *
8231
+ * @author Vova Feldman (@svovaf)
8232
+ * @since 1.0.8
8233
+ *
8234
+ * @param bool $store
8235
+ *
8236
+ * @return bool
8237
+ */
8238
+ private function _delete_account_addons( $store = true ) {
8239
+ $all_addons = self::get_all_account_addons();
8240
+
8241
+ if ( ! isset( $all_addons[ $this->_plugin->id ] ) ) {
8242
+ return false;
8243
+ }
8244
+
8245
+ unset( $all_addons[ $this->_plugin->id ] );
8246
+
8247
+ self::$_accounts->set_option( 'account_addons', $all_addons, $store );
8248
+
8249
+ return true;
8250
+ }
8251
+
8252
+ /**
8253
+ * Update account add-ons list.
8254
+ *
8255
+ * @author Vova Feldman (@svovaf)
8256
+ * @since 1.0.6
8257
+ *
8258
+ * @param FS_Plugin[] $addons
8259
+ * @param bool $store Flush to Database if true.
8260
+ */
8261
+ private function _store_account_addons( $addons, $store = true ) {
8262
+ $this->_logger->entrance();
8263
+
8264
+ $all_addons = self::get_all_account_addons();
8265
+ $all_addons[ $this->_plugin->id ] = $addons;
8266
+ self::$_accounts->set_option( 'account_addons', $all_addons, $store );
8267
+ }
8268
+
8269
+ /**
8270
+ * Store account params in the Database.
8271
+ *
8272
+ * @author Vova Feldman (@svovaf)
8273
+ * @since 1.0.1
8274
+ */
8275
+ private function _store_account() {
8276
+ $this->_logger->entrance();
8277
+
8278
+ $this->_store_site( false );
8279
+ $this->_store_user( false );
8280
+ $this->_store_plans( false );
8281
+ $this->_store_licenses( false );
8282
+
8283
+ self::$_accounts->store();
8284
+ }
8285
+
8286
+ /**
8287
+ * Sync user's information.
8288
+ *
8289
+ * @author Vova Feldman (@svovaf)
8290
+ * @since 1.0.3
8291
+ * @uses FS_Api
8292
+ */
8293
+ private function _handle_account_user_sync() {
8294
+ $this->_logger->entrance();
8295
+
8296
+ $api = $this->get_api_user_scope();
8297
+
8298
+ // Get user's information.
8299
+ $user = $api->get( '/', true );
8300
+
8301
+ if ( isset( $user->id ) ) {
8302
+ $this->_user->first = $user->first;
8303
+ $this->_user->last = $user->last;
8304
+ $this->_user->email = $user->email;
8305
+
8306
+ $is_menu_item_account_visible = $this->_menu->is_submenu_item_visible( 'account' );
8307
+
8308
+ if ( $user->is_verified &&
8309
+ ( ! isset( $this->_user->is_verified ) || false === $this->_user->is_verified )
8310
+ ) {
8311
+ $this->_user->is_verified = true;
8312
+
8313
+ $this->do_action( 'account_email_verified', $user->email );
8314
+
8315
+ $this->_admin_notices->add(
8316
+ __fs( 'email-verified-message', $this->_slug ),
8317
+ __fs( 'right-on', $this->_slug ) . '!',
8318
+ 'success',
8319
+ // Make admin sticky if account menu item is invisible,
8320
+ // since the page will be auto redirected to the plugin's
8321
+ // main settings page, and the non-sticky message
8322
+ // will disappear.
8323
+ ! $is_menu_item_account_visible,
8324
+ false,
8325
+ 'email_verified'
8326
+ );
8327
+ }
8328
+
8329
+ // Flush user details to DB.
8330
+ $this->_store_user();
8331
+
8332
+ $this->do_action( 'after_account_user_sync', $user );
8333
+
8334
+ /**
8335
+ * If account menu item is hidden, redirect to plugin's main settings page.
8336
+ *
8337
+ * @author Vova Feldman (@svovaf)
8338
+ * @since 1.1.6
8339
+ *
8340
+ * @link https://github.com/Freemius/wordpress-sdk/issues/6
8341
+ */
8342
+ if ( ! $is_menu_item_account_visible ) {
8343
+ fs_redirect( $this->_get_admin_page_url() );
8344
+ }
8345
+ }
8346
+ }
8347
+
8348
+ /**
8349
+ * @param bool $store
8350
+ *
8351
+ * @return FS_Plugin_Plan|object|false
8352
+ */
8353
+ private function _enrich_site_plan( $store = true ) {
8354
+ // Try to load plan from local cache.
8355
+ $plan = $this->_get_plan_by_id( $this->_site->plan->id );
8356
+
8357
+ if ( false === $plan ) {
8358
+ $plan = $this->_fetch_site_plan();
8359
+ }
8360
+
8361
+ if ( $plan instanceof FS_Plugin_Plan ) {
8362
+ $this->_update_plan( $plan, $store );
8363
+ }
8364
+
8365
+ return $plan;
8366
+ }
8367
+
8368
+ /**
8369
+ * @author Vova Feldman (@svovaf)
8370
+ * @since 1.0.9
8371
+ * @uses FS_Api
8372
+ *
8373
+ * @param bool $store
8374
+ *
8375
+ * @return FS_Plugin_Plan|object|false
8376
+ */
8377
+ private function _enrich_site_trial_plan( $store = true ) {
8378
+ // Try to load plan from local cache.
8379
+ $trial_plan = $this->_get_plan_by_id( $this->_site->trial_plan_id );
8380
+
8381
+ if ( false === $trial_plan ) {
8382
+ $trial_plan = $this->_fetch_site_plan( $this->_site->trial_plan_id );
8383
+ }
8384
+
8385
+ if ( $trial_plan instanceof FS_Plugin_Plan ) {
8386
+ $this->_storage->store( 'trial_plan', $trial_plan, $store );
8387
+ }
8388
+
8389
+ return $trial_plan;
8390
+ }
8391
+
8392
+ /**
8393
+ * @author Vova Feldman (@svovaf)
8394
+ * @since 1.0.9
8395
+ * @uses FS_Api
8396
+ *
8397
+ * @param number|bool $license_id
8398
+ *
8399
+ * @return FS_Subscription|object|bool
8400
+ */
8401
+ private function _fetch_site_license_subscription( $license_id = false ) {
8402
+ $this->_logger->entrance();
8403
+ $api = $this->get_api_site_scope();
8404
+
8405
+ if ( ! is_numeric( $license_id ) ) {
8406
+ $license_id = $this->_license->id;
8407
+ }
8408
+
8409
+ $result = $api->get( "/licenses/{$license_id}/subscriptions.json", true );
8410
+
8411
+ return ! isset( $result->error ) ?
8412
+ ( ( is_array( $result->subscriptions ) && 0 < count( $result->subscriptions ) ) ?
8413
+ new FS_Subscription( $result->subscriptions[0] ) :
8414
+ false
8415
+ ) :
8416
+ $result;
8417
+ }
8418
+
8419
+ /**
8420
+ * @author Vova Feldman (@svovaf)
8421
+ * @since 1.0.4
8422
+ * @uses FS_Api
8423
+ *
8424
+ * @param number|bool $plan_id
8425
+ *
8426
+ * @return FS_Plugin_Plan|object
8427
+ */
8428
+ private function _fetch_site_plan( $plan_id = false ) {
8429
+ $this->_logger->entrance();
8430
+ $api = $this->get_api_site_scope();
8431
+
8432
+ if ( ! is_numeric( $plan_id ) ) {
8433
+ $plan_id = $this->_site->plan->id;
8434
+ }
8435
+
8436
+ $plan = $api->get( "/plans/{$plan_id}.json", true );
8437
+
8438
+ return ! isset( $plan->error ) ? new FS_Plugin_Plan( $plan ) : $plan;
8439
+ }
8440
+
8441
+ /**
8442
+ * @author Vova Feldman (@svovaf)
8443
+ * @since 1.0.5
8444
+ * @uses FS_Api
8445
+ *
8446
+ * @return FS_Plugin_Plan[]|object
8447
+ */
8448
+ private function _fetch_plugin_plans() {
8449
+ $this->_logger->entrance();
8450
+ $api = $this->get_api_site_scope();
8451
+
8452
+ $result = $api->get( '/plans.json', true );
8453
+
8454
+ if ( $this->is_api_result_object( $result, 'plans' ) && is_array( $result->plans ) ) {
8455
+ for ( $i = 0, $len = count( $result->plans ); $i < $len; $i ++ ) {
8456
+ $result->plans[ $i ] = new FS_Plugin_Plan( $result->plans[ $i ] );
8457
+ }
8458
+
8459
+ $result = $result->plans;
8460
+ }
8461
+
8462
+ return $result;
8463
+ }
8464
+
8465
+ /**
8466
+ * @author Vova Feldman (@svovaf)
8467
+ * @since 1.0.5
8468
+ * @uses FS_Api
8469
+ *
8470
+ * @param number|bool $plugin_id
8471
+ * @param number|bool $site_license_id
8472
+ *
8473
+ * @return FS_Plugin_License[]|object
8474
+ */
8475
+ private function _fetch_licenses( $plugin_id = false, $site_license_id = false ) {
8476
+ $this->_logger->entrance();
8477
+
8478
+ $api = $this->get_api_user_scope();
8479
+
8480
+ if ( ! is_numeric( $plugin_id ) ) {
8481
+ $plugin_id = $this->_plugin->id;
8482
+ }
8483
+
8484
+ $result = $api->get( "/plugins/{$plugin_id}/licenses.json", true );
8485
+
8486
+ $is_site_license_synced = false;
8487
+
8488
+ $api_errors = array();
8489
+
8490
+ if ( $this->is_api_result_object( $result, 'licenses' ) &&
8491
+ is_array( $result->licenses )
8492
+ ) {
8493
+ for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
8494
+ $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
8495
+
8496
+ if ( ( ! $is_site_license_synced ) && is_numeric( $site_license_id ) ) {
8497
+ $is_site_license_synced = ( $site_license_id == $result->licenses[ $i ]->id );
8498
+ }
8499
+ }
8500
+
8501
+ $result = $result->licenses;
8502
+ } else {
8503
+ $api_errors[] = $result;
8504
+ $result = array();
8505
+ }
8506
+
8507
+ if ( ! $is_site_license_synced ) {
8508
+ $api = $this->get_api_site_scope();
8509
+
8510
+ if ( is_numeric( $site_license_id ) ) {
8511
+ // Try to retrieve a foreign license that is linked to the install.
8512
+ $api_result = $api->call( '/licenses.json' );
8513
+
8514
+ if ( $this->is_api_result_object( $api_result, 'licenses' ) &&
8515
+ is_array( $api_result->licenses )
8516
+ ) {
8517
+ $licenses = $api_result->licenses;
8518
+
8519
+ if ( ! empty( $licenses ) ) {
8520
+ $result[] = new FS_Plugin_License( $licenses[0] );
8521
+ }
8522
+ } else {
8523
+ $api_errors[] = $api_result;
8524
+ }
8525
+ } else if ( is_object( $this->_license ) ) {
8526
+ // Fetch foreign license by ID and license key.
8527
+ $license = $api->get( "/licenses/{$this->_license->id}.json?license_key=" .
8528
+ urlencode( $this->_license->secret_key ) );
8529
+
8530
+ if ( $this->is_api_result_entity( $license ) ) {
8531
+ $result[] = new FS_Plugin_License( $license );
8532
+ } else {
8533
+ $api_errors[] = $license;
8534
+ }
8535
+ }
8536
+ }
8537
+
8538
+ if ( is_array( $result ) && 0 < count( $result ) ) {
8539
+ // If found at least one license, return license collection even if there are errors.
8540
+ return $result;
8541
+ }
8542
+
8543
+ if ( ! empty( $api_errors ) ) {
8544
+ // If found any errors and no licenses, return first error.
8545
+ return $api_errors[0];
8546
+ }
8547
+
8548
+ // Fallback to empty licenses list.
8549
+ return $result;
8550
+ }
8551
+
8552
+ /**
8553
+ * @author Vova Feldman (@svovaf)
8554
+ * @since 1.2.0
8555
+ * @uses FS_Api
8556
+ *
8557
+ * @param number|bool $plugin_id
8558
+ *
8559
+ * @return FS_Payment[]|object
8560
+ */
8561
+ function _fetch_payments( $plugin_id = false ) {
8562
+ $this->_logger->entrance();
8563
+
8564
+ $api = $this->get_api_user_scope();
8565
+
8566
+ if ( ! is_numeric( $plugin_id ) ) {
8567
+ $plugin_id = $this->_plugin->id;
8568
+ }
8569
+
8570
+ $result = $api->get( "/plugins/{$plugin_id}/payments.json", true );
8571
+
8572
+ if ( ! isset( $result->error ) ) {
8573
+ for ( $i = 0, $len = count( $result->payments ); $i < $len; $i ++ ) {
8574
+ $result->payments[ $i ] = new FS_Payment( $result->payments[ $i ] );
8575
+ }
8576
+ $result = $result->payments;
8577
+ }
8578
+
8579
+ return $result;
8580
+ }
8581
+
8582
+ /**
8583
+ * @author Vova Feldman (@svovaf)
8584
+ * @since 1.2.1.5
8585
+ * @uses FS_Api
8586
+ *
8587
+ * @return \FS_Billing|mixed
8588
+ */
8589
+ function _fetch_billing() {
8590
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-billing.php';
8591
+
8592
+ $billing = $this->get_api_user_scope()->call( 'billing.json' );
8593
+
8594
+ if ( $this->is_api_result_entity( $billing ) ) {
8595
+ $billing = new FS_Billing( $billing );
8596
+ }
8597
+
8598
+ return $billing;
8599
+ }
8600
+
8601
+ /**
8602
+ * @author Vova Feldman (@svovaf)
8603
+ * @since 1.0.4
8604
+ *
8605
+ * @param FS_Plugin_Plan $plan
8606
+ * @param bool $store
8607
+ */
8608
+ private function _update_plan( $plan, $store = false ) {
8609
+ $this->_logger->entrance();
8610
+
8611
+ $this->_site->plan = $plan;
8612
+ $this->_store_site( $store );
8613
+ }
8614
+
8615
+ /**
8616
+ * @author Vova Feldman (@svovaf)
8617
+ * @since 1.0.5
8618
+ *
8619
+ * @param FS_Plugin_License[] $licenses
8620
+ * @param string|bool $plugin_slug
8621
+ */
8622
+ private function _update_licenses( $licenses, $plugin_slug = false ) {
8623
+ $this->_logger->entrance();
8624
+
8625
+ if ( is_array( $licenses ) ) {
8626
+ for ( $i = 0, $len = count( $licenses ); $i < $len; $i ++ ) {
8627
+ $licenses[ $i ]->updated = time();
8628
+ }
8629
+ }
8630
+
8631
+ if ( ! is_string( $plugin_slug ) ) {
8632
+ $this->_licenses = $licenses;
8633
+ }
8634
+
8635
+ $this->_store_licenses( true, $plugin_slug, $licenses );
8636
+ }
8637
+
8638
+ /**
8639
+ * @author Vova Feldman (@svovaf)
8640
+ * @since 1.0.4
8641
+ *
8642
+ * @param bool|number $plugin_id
8643
+ * @param bool $flush Since 1.1.7.3
8644
+ *
8645
+ * @return object|false New plugin tag info if exist.
8646
+ */
8647
+ private function _fetch_newer_version( $plugin_id = false, $flush = true ) {
8648
+ $latest_tag = $this->_fetch_latest_version( $plugin_id, $flush );
8649
+
8650
+ if ( ! is_object( $latest_tag ) ) {
8651
+ return false;
8652
+ }
8653
+
8654
+ // Check if version is actually newer.
8655
+ $has_new_version =
8656
+ // If it's an non-installed add-on then always return latest.
8657
+ ( $this->_is_addon_id( $plugin_id ) && ! $this->is_addon_activated( $plugin_id ) ) ||
8658
+ // Compare versions.
8659
+ version_compare( $this->get_plugin_version(), $latest_tag->version, '<' );
8660
+
8661
+ $this->_logger->departure( $has_new_version ? 'Found newer plugin version ' . $latest_tag->version : 'No new version' );
8662
+
8663
+ return $has_new_version ? $latest_tag : false;
8664
+ }
8665
+
8666
+ /**
8667
+ * @author Vova Feldman (@svovaf)
8668
+ * @since 1.0.5
8669
+ *
8670
+ * @param bool|number $plugin_id
8671
+ * @param bool $flush Since 1.1.7.3
8672
+ *
8673
+ * @return bool|FS_Plugin_Tag
8674
+ */
8675
+ function get_update( $plugin_id = false, $flush = true ) {
8676
+ $this->_logger->entrance();
8677
+
8678
+ if ( ! is_numeric( $plugin_id ) ) {
8679
+ $plugin_id = $this->_plugin->id;
8680
+ }
8681
+
8682
+ $this->_check_updates( true, $plugin_id, $flush );
8683
+ $updates = $this->get_all_updates();
8684
+
8685
+ return isset( $updates[ $plugin_id ] ) && is_object( $updates[ $plugin_id ] ) ? $updates[ $plugin_id ] : false;
8686
+ }
8687
+
8688
+ /**
8689
+ * Check if site assigned with active license.
8690
+ *
8691
+ * @author Vova Feldman (@svovaf)
8692
+ * @since 1.0.6
8693
+ *
8694
+ * @deprecated Please use has_active_valid_license() instead because license can be cancelled.
8695
+ */
8696
+ function has_active_license() {
8697
+ return (
8698
+ is_object( $this->_license ) &&
8699
+ is_numeric( $this->_license->id ) &&
8700
+ ! $this->_license->is_expired()
8701
+ );
8702
+ }
8703
+
8704
+ /**
8705
+ * Check if site assigned with active & valid (not expired) license.
8706
+ *
8707
+ * @author Vova Feldman (@svovaf)
8708
+ * @since 1.2.1
8709
+ */
8710
+ function has_active_valid_license() {
8711
+ return (
8712
+ is_object( $this->_license ) &&
8713
+ is_numeric( $this->_license->id ) &&
8714
+ $this->_license->is_active() &&
8715
+ $this->_license->is_valid()
8716
+ );
8717
+ }
8718
+
8719
+ /**
8720
+ * Check if site assigned with license with enabled features.
8721
+ *
8722
+ * @author Vova Feldman (@svovaf)
8723
+ * @since 1.0.6
8724
+ *
8725
+ * @return bool
8726
+ */
8727
+ function has_features_enabled_license() {
8728
+ return (
8729
+ is_object( $this->_license ) &&
8730
+ is_numeric( $this->_license->id ) &&
8731
+ $this->_license->is_features_enabled()
8732
+ );
8733
+ }
8734
+
8735
+ /**
8736
+ * Check if user is a trial or have feature enabled license.
8737
+ *
8738
+ * @author Vova Feldman (@svovaf)
8739
+ * @since 1.1.7
8740
+ *
8741
+ * @return bool
8742
+ */
8743
+ function can_use_premium_code() {
8744
+ return $this->is_trial() || $this->has_features_enabled_license();
8745
+ }
8746
+
8747
+ /**
8748
+ * Sync site's plan.
8749
+ *
8750
+ * @author Vova Feldman (@svovaf)
8751
+ * @since 1.0.3
8752
+ *
8753
+ * @uses FS_Api
8754
+ *
8755
+ * @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by
8756
+ * the admin.
8757
+ */
8758
+ private function _sync_license( $background = false ) {
8759
+ $this->_logger->entrance();
8760
+
8761
+ $plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
8762
+
8763
+ $is_addon_sync = ( ! $this->_plugin->is_addon() && $plugin_id != $this->get_id() );
8764
+
8765
+ if ( $is_addon_sync ) {
8766
+ $this->_sync_addon_license( $plugin_id, $background );
8767
+ } else {
8768
+ $this->_sync_plugin_license( $background );
8769
+ }
8770
+
8771
+ $this->do_action( 'after_account_plan_sync', $this->_site->plan->name );
8772
+ }
8773
+
8774
+ /**
8775
+ * Sync plugin's add-on license.
8776
+ *
8777
+ * @author Vova Feldman (@svovaf)
8778
+ * @since 1.0.6
8779
+ * @uses FS_Api
8780
+ *
8781
+ * @param number $addon_id
8782
+ * @param bool $background
8783
+ */
8784
+ private function _sync_addon_license( $addon_id, $background ) {
8785
+ $this->_logger->entrance();
8786
+
8787
+ if ( $this->is_addon_activated( $addon_id ) ) {
8788
+ // If already installed, use add-on sync.
8789
+ $fs_addon = self::get_instance_by_id( $addon_id );
8790
+ $fs_addon->_sync_license( $background );
8791
+
8792
+ return;
8793
+ }
8794
+
8795
+ // Validate add-on exists.
8796
+ $addon = $this->get_addon( $addon_id );
8797
+
8798
+ if ( ! is_object( $addon ) ) {
8799
+ return;
8800
+ }
8801
+
8802
+ // Add add-on into account add-ons.
8803
+ $account_addons = $this->get_account_addons();
8804
+ if ( ! is_array( $account_addons ) ) {
8805
+ $account_addons = array();
8806
+ }
8807
+ $account_addons[] = $addon->id;
8808
+ $account_addons = array_unique( $account_addons );
8809
+ $this->_store_account_addons( $account_addons );
8810
+
8811
+ // Load add-on licenses.
8812
+ $licenses = $this->_fetch_licenses( $addon->id );
8813
+
8814
+ // Sync add-on licenses.
8815
+ if ( $this->is_array_instanceof( $licenses, 'FS_Plugin_License' ) ) {
8816
+ $this->_update_licenses( $licenses, $addon->slug );
8817
+
8818
+ if ( ! $this->is_addon_installed( $addon->slug ) && FS_License_Manager::has_premium_license( $licenses ) ) {
8819
+ $plans_result = $this->get_api_site_or_plugin_scope()->get( "/addons/{$addon_id}/plans.json" );
8820
+
8821
+ if ( ! isset( $plans_result->error ) ) {
8822
+ $plans = array();
8823
+ foreach ( $plans_result->plans as $plan ) {
8824
+ $plans[] = new FS_Plugin_Plan( $plan );
8825
+ }
8826
+
8827
+ $this->_admin_notices->add_sticky(
8828
+ FS_Plan_Manager::instance()->has_free_plan( $plans ) ?
8829
+ sprintf(
8830
+ __fs( 'addon-successfully-upgraded-message', $this->_slug ),
8831
+ $addon->title
8832
+ ) . ' ' . $this->_get_latest_download_link(
8833
+ __fs( 'download-latest-version', $this->_slug ),
8834
+ $addon_id
8835
+ )
8836
+ :
8837
+ sprintf(
8838
+ __fs( 'addon-successfully-purchased-message', $this->_slug ),
8839
+ $addon->title
8840
+ ) . ' ' . $this->_get_latest_download_link(
8841
+ __fs( 'download-latest-version', $this->_slug ),
8842
+ $addon_id
8843
+ ),
8844
+ 'addon_plan_upgraded_' . $addon->slug,
8845
+ __fs( 'yee-haw', $this->_slug ) . '!'
8846
+ );
8847
+ }
8848
+ }
8849
+ }
8850
+ }
8851
+
8852
+ /**
8853
+ * Sync site's plugin plan.
8854
+ *
8855
+ * @author Vova Feldman (@svovaf)
8856
+ * @since 1.0.6
8857
+ * @uses FS_Api
8858
+ *
8859
+ * @param bool $background Hints the method if it's a background sync. If false, it means that was initiated by
8860
+ * the admin.
8861
+ */
8862
+ private function _sync_plugin_license( $background = false ) {
8863
+ $this->_logger->entrance();
8864
+
8865
+ /**
8866
+ * Sync site info.
8867
+ *
8868
+ * @todo This line will execute install sync on a daily basis, even if running the free version (for opted-in users). The reason we want to keep it that way is for cases when the user was a paying customer, then there was a failure in subscription payment, and then after some time the payment was successful. This could be heavily optimized. For example, we can skip the $flush if the current install was never associated with a paid version.
8869
+ */
8870
+ $site = $this->send_install_update( array(), true );
8871
+
8872
+ $plan_change = 'none';
8873
+
8874
+ if ( ! $this->is_api_result_entity( $site ) ) {
8875
+ // Show API messages only if not background sync or if paying customer.
8876
+ if ( ! $background || $this->is_paying() ) {
8877
+ // Try to ping API to see if not blocked.
8878
+ if ( ! FS_Api::test() ) {
8879
+ /**
8880
+ * Failed to ping API - blocked!
8881
+ *
8882
+ * @author Vova Feldman (@svovaf)
8883
+ * @since 1.1.6 Only show message related to one of the Freemius powered plugins. Once it will be resolved it will fix the issue for all plugins anyways. There's no point to scare users with multiple error messages.
8884
+ */
8885
+ $api = $this->get_api_site_scope();
8886
+
8887
+ if ( ! self::$_global_admin_notices->has_sticky( 'api_blocked' ) ) {
8888
+ self::$_global_admin_notices->add(
8889
+ sprintf(
8890
+ __fs( 'server-blocking-access', $this->_slug ),
8891
+ $this->get_plugin_name(),
8892
+ '<a href="' . $api->get_url() . '" target="_blank">' . $api->get_url() . '</a>'
8893
+ ) . '<br> ' . __fs( 'server-error-message', $this->_slug ) . var_export( $site->error, true ),
8894
+ __fs( 'oops', $this->_slug ) . '...',
8895
+ 'error',
8896
+ $background,
8897
+ false,
8898
+ 'api_blocked'
8899
+ );
8900
+ }
8901
+ } else {
8902
+ // Authentication params are broken.
8903
+ $this->_admin_notices->add(
8904
+ __fs( 'wrong-authentication-param-message', $this->_slug ),
8905
+ __fs( 'oops', $this->_slug ) . '...',
8906
+ 'error'
8907
+ );
8908
+ }
8909
+ }
8910
+
8911
+ // No reason to continue with license sync while there are API issues.
8912
+ return;
8913
+ }
8914
+
8915
+ // Remove sticky API connectivity message.
8916
+ self::$_global_admin_notices->remove_sticky( 'api_blocked' );
8917
+
8918
+ $site = new FS_Site( $site );
8919
+
8920
+ // Sync plans.
8921
+ $this->_sync_plans();
8922
+
8923
+ if ( ! $this->has_paid_plan() ) {
8924
+ $this->_site = $site;
8925
+ $this->_enrich_site_plan( true );
8926
+ $this->_store_site();
8927
+ } else {
8928
+ /**
8929
+ * Sync licenses. Pass the site's license ID so that the foreign licenses will be fetched if the license
8930
+ * associated with that ID is not included in the user's licenses collection.
8931
+ */
8932
+ $this->_sync_licenses( $site->license_id );
8933
+
8934
+ // Check if plan / license changed.
8935
+ if ( ! FS_Entity::equals( $site->plan, $this->_site->plan ) ||
8936
+ // Check if trial started.
8937
+ $site->trial_plan_id != $this->_site->trial_plan_id ||
8938
+ $site->trial_ends != $this->_site->trial_ends ||
8939
+ // Check if license changed.
8940
+ $site->license_id != $this->_site->license_id
8941
+ ) {
8942
+ if ( $site->is_trial() && ( ! $this->_site->is_trial() || $site->trial_ends != $this->_site->trial_ends ) ) {
8943
+ // New trial started.
8944
+ $this->_site = $site;
8945
+ $plan_change = 'trial_started';
8946
+
8947
+ // Store trial plan information.
8948
+ $this->_enrich_site_trial_plan( true );
8949
+
8950
+ // For trial with subscription use-case.
8951
+ $new_license = is_null( $site->license_id ) ? null : $this->_get_license_by_id( $site->license_id );
8952
+
8953
+ if ( is_object( $new_license ) && $new_license->is_valid() ) {
8954
+ $this->_site = $site;
8955
+ $this->_update_site_license( $new_license );
8956
+ $this->_store_licenses();
8957
+ $this->_enrich_site_plan( true );
8958
+
8959
+ $this->_sync_site_subscription( $this->_license );
8960
+ }
8961
+ } else if ( $this->_site->is_trial() && ! $site->is_trial() && ! is_numeric( $site->license_id ) ) {
8962
+ // Was in trial, but now trial expired and no license ID.
8963
+ // New trial started.
8964
+ $this->_site = $site;
8965
+ $plan_change = 'trial_expired';
8966
+
8967
+ // Clear trial plan information.
8968
+ $this->_storage->trial_plan = null;
8969
+
8970
+ } else {
8971
+ $is_free = $this->is_free_plan();
8972
+
8973
+ // Make sure license exist and not expired.
8974
+ $new_license = is_null( $site->license_id ) ?
8975
+ null :
8976
+ $this->_get_license_by_id( $site->license_id );
8977
+
8978
+ if ( $is_free && is_null( $new_license ) && $this->has_any_license() && $this->_license->is_cancelled ) {
8979
+ // License cancelled.
8980
+ $this->_site = $site;
8981
+ $this->_update_site_license( $new_license );
8982
+ $this->_store_licenses();
8983
+ $this->_enrich_site_plan( true );
8984
+
8985
+ $plan_change = 'cancelled';
8986
+ } else if ( $is_free && ( ( ! is_object( $new_license ) || $new_license->is_expired() ) ) ) {
8987
+ // The license is expired, so ignore upgrade method.
8988
+ } else {
8989
+ // License changed.
8990
+ $this->_site = $site;
8991
+ $this->_update_site_license( $new_license );
8992
+ $this->_store_licenses();
8993
+ $this->_enrich_site_plan( true );
8994
+
8995
+ $plan_change = $is_free ?
8996
+ 'upgraded' :
8997
+ ( is_object( $new_license ) ?
8998
+ 'changed' :
8999
+ 'downgraded' );
9000
+ }
9001
+ }
9002
+
9003
+ // Store updated site info.
9004
+ $this->_store_site();
9005
+ } else {
9006
+ if ( is_object( $this->_license ) && $this->_license->is_expired() ) {
9007
+ if ( ! $this->has_features_enabled_license() ) {
9008
+ $this->_deactivate_license();
9009
+ $plan_change = 'downgraded';
9010
+ } else {
9011
+ $plan_change = 'expired';
9012
+ }
9013
+ }
9014
+
9015
+ if ( is_numeric( $site->license_id ) && is_object( $this->_license ) ) {
9016
+ $this->_sync_site_subscription( $this->_license );
9017
+ }
9018
+ }
9019
+ }
9020
+
9021
+ if ( $this->has_paid_plan() ) {
9022
+ switch ( $plan_change ) {
9023
+ case 'none':
9024
+ if ( ! $background && is_admin() ) {
9025
+ $plan = $this->is_trial() ?
9026
+ $this->_storage->trial_plan :
9027
+ $this->_site->plan;
9028
+
9029
+ $this->_admin_notices->add(
9030
+ sprintf(
9031
+ __fs( 'plan-did-not-change-message', $this->_slug ),
9032
+ '<i><b>' . $plan->title . ( $this->is_trial() ? ' ' . __fs( 'trial', $this->_slug ) : '' ) . '</b></i>'
9033
+ ) . ' ' . sprintf(
9034
+ '<a href="%s">%s</a>',
9035
+ $this->contact_url(
9036
+ 'bug',
9037
+ sprintf( __fs( 'plan-did-not-change-email-message', $this->_slug ),
9038
+ strtoupper( $plan->name )
9039
+ )
9040
+ ),
9041
+ __fs( 'contact-us-here', $this->_slug )
9042
+ ),
9043
+ __fs( 'hmm', $this->_slug ) . '...'
9044
+ );
9045
+ }
9046
+ break;
9047
+ case 'upgraded':
9048
+ $this->_admin_notices->add_sticky(
9049
+ sprintf(
9050
+ __fs( 'plan-upgraded-message', $this->_slug ),
9051
+ '<i>' . $this->get_plugin_name() . '</i>'
9052
+ ) . $this->get_complete_upgrade_instructions(),
9053
+ 'plan_upgraded',
9054
+ __fs( 'yee-haw', $this->_slug ) . '!'
9055
+ );
9056
+
9057
+ $this->_admin_notices->remove_sticky( array(
9058
+ 'trial_started',
9059
+ 'trial_promotion',
9060
+ 'trial_expired',
9061
+ 'activation_complete',
9062
+ ) );
9063
+ break;
9064
+ case 'changed':
9065
+ $this->_admin_notices->add_sticky(
9066
+ sprintf(
9067
+ __fs( 'plan-changed-to-x-message', $this->_slug ),
9068
+ $this->_site->plan->title
9069
+ ),
9070
+ 'plan_changed'
9071
+ );
9072
+
9073
+ $this->_admin_notices->remove_sticky( array(
9074
+ 'trial_started',
9075
+ 'trial_promotion',
9076
+ 'trial_expired',
9077
+ 'activation_complete',
9078
+ ) );
9079
+ break;
9080
+ case 'downgraded':
9081
+ $this->_admin_notices->add_sticky(
9082
+ sprintf( __fs( 'license-expired-blocking-message', $this->_slug ) ),
9083
+ 'license_expired',
9084
+ __fs( 'hmm', $this->_slug ) . '...'
9085
+ );
9086
+ $this->_admin_notices->remove_sticky( 'plan_upgraded' );
9087
+ break;
9088
+ case 'cancelled':
9089
+ $this->_admin_notices->add(
9090
+ __fs( 'license-cancelled', $this->_slug ) . ' ' .
9091
+ sprintf(
9092
+ '<a href="%s">%s</a>',
9093
+ $this->contact_url( 'bug' ),
9094
+ __fs( 'contact-us-here', $this->_slug )
9095
+ ),
9096
+ __fs( 'hmm', $this->_slug ) . '...',
9097
+ 'error'
9098
+ );
9099
+ $this->_admin_notices->remove_sticky( 'plan_upgraded' );
9100
+ break;
9101
+ case 'expired':
9102
+ $this->_admin_notices->add_sticky(
9103
+ sprintf( __fs( 'license-expired-non-blocking-message', $this->_slug ), $this->_site->plan->title ),
9104
+ 'license_expired',
9105
+ __fs( 'hmm', $this->_slug ) . '...'
9106
+ );
9107
+ $this->_admin_notices->remove_sticky( 'plan_upgraded' );
9108
+ break;
9109
+ case 'trial_started':
9110
+ $this->_admin_notices->add_sticky(
9111
+ sprintf(
9112
+ __fs( 'trial-started-message', $this->_slug ),
9113
+ '<i>' . $this->get_plugin_name() . '</i>'
9114
+ ) . $this->get_complete_upgrade_instructions( $this->_storage->trial_plan->title ),
9115
+ 'trial_started',
9116
+ __fs( 'yee-haw', $this->_slug ) . '!'
9117
+ );
9118
+
9119
+ $this->_admin_notices->remove_sticky( array(
9120
+ 'trial_promotion',
9121
+ ) );
9122
+ break;
9123
+ case 'trial_expired':
9124
+ $this->_admin_notices->add_sticky(
9125
+ __fs( 'trial-expired-message', $this->_slug ),
9126
+ 'trial_expired',
9127
+ __fs( 'hmm', $this->_slug ) . '...'
9128
+ );
9129
+ $this->_admin_notices->remove_sticky( array(
9130
+ 'trial_started',
9131
+ 'trial_promotion',
9132
+ 'plan_upgraded',
9133
+ ) );
9134
+ break;
9135
+ }
9136
+ }
9137
+
9138
+ if ( 'none' !== $plan_change ) {
9139
+ $this->do_action( 'after_license_change', $plan_change, $this->_site->plan );
9140
+ }
9141
+ }
9142
+
9143
+ /**
9144
+ * @author Vova Feldman (@svovaf)
9145
+ * @since 1.0.5
9146
+ *
9147
+ * @param bool $background
9148
+ */
9149
+ protected function _activate_license( $background = false ) {
9150
+ $this->_logger->entrance();
9151
+
9152
+ $license_id = fs_request_get( 'license_id' );
9153
+
9154
+ if ( FS_Plugin_License::is_valid_id( $license_id ) && $license_id == $this->_site->license_id ) {
9155
+ // License is already activated.
9156
+ return;
9157
+ }
9158
+
9159
+ $premium_license = FS_Plugin_License::is_valid_id( $license_id ) ?
9160
+ $this->_get_license_by_id( $license_id ) :
9161
+ $this->_get_available_premium_license();
9162
+
9163
+ if ( ! is_object( $premium_license ) ) {
9164
+ return;
9165
+ }
9166
+
9167
+ /**
9168
+ * If the premium license is already associated with the install, just
9169
+ * update the license reference (activation is not required).
9170
+ *
9171
+ * @since 1.1.9
9172
+ */
9173
+ if ( $premium_license->id == $this->_site->license_id ) {
9174
+ // License is already activated.
9175
+ $this->_update_site_license( $premium_license );
9176
+ $this->_enrich_site_plan( false );
9177
+ $this->_store_account();
9178
+
9179
+ return;
9180
+ }
9181
+
9182
+ if ( $this->_site->user_id != $premium_license->user_id ) {
9183
+ $api_request_params = array( 'license_key' => $premium_license->secret_key );
9184
+ } else {
9185
+ $api_request_params = array();
9186
+ }
9187
+
9188
+ $api = $this->get_api_site_scope();
9189
+ $license = $api->call( "/licenses/{$premium_license->id}.json", 'put', $api_request_params );
9190
+
9191
+ if ( ! $this->is_api_result_entity( $license ) ) {
9192
+ if ( ! $background ) {
9193
+ $this->_admin_notices->add( sprintf(
9194
+ '%s %s',
9195
+ __fs( 'license-activation-failed-message', $this->_slug ),
9196
+ ( is_object( $license ) && isset( $license->error ) ?
9197
+ $license->error->message :
9198
+ sprintf( '%s<br><code>%s</code>',
9199
+ __fs( 'server-error-message', $this->_slug ),
9200
+ var_export( $license, true )
9201
+ )
9202
+ )
9203
+ ),
9204
+ __fs( 'hmm', $this->_slug ) . '...',
9205
+ 'error'
9206
+ );
9207
+ }
9208
+
9209
+ return;
9210
+ }
9211
+
9212
+ $premium_license = new FS_Plugin_License( $license );
9213
+
9214
+ // Updated site plan.
9215
+ $site = $this->get_api_site_scope()->get( '/', true );
9216
+ if ( $this->is_api_result_entity( $site ) ) {
9217
+ $this->_site = new FS_Site( $site );
9218
+ }
9219
+ $this->_update_site_license( $premium_license );
9220
+ $this->_enrich_site_plan( false );
9221
+
9222
+ $this->_store_account();
9223
+
9224
+ if ( ! $background ) {
9225
+ $this->_admin_notices->add_sticky(
9226
+ __fs( 'license-activated-message', $this->_slug ) .
9227
+ $this->get_complete_upgrade_instructions(),
9228
+ 'license_activated',
9229
+ __fs( 'yee-haw', $this->_slug ) . '!'
9230
+ );
9231
+ }
9232
+
9233
+ $this->_admin_notices->remove_sticky( array(
9234
+ 'trial_promotion',
9235
+ 'license_expired',
9236
+ ) );
9237
+ }
9238
+
9239
+ /**
9240
+ * @author Vova Feldman (@svovaf)
9241
+ * @since 1.0.5
9242
+ *
9243
+ * @param bool $show_notice
9244
+ */
9245
+ protected function _deactivate_license( $show_notice = true ) {
9246
+ $this->_logger->entrance();
9247
+
9248
+ if ( ! is_object( $this->_license ) ) {
9249
+ $this->_admin_notices->add(
9250
+ sprintf( __fs( 'no-active-license-message', $this->_slug ), $this->_site->plan->title ),
9251
+ __fs( 'hmm', $this->_slug ) . '...'
9252
+ );
9253
+
9254
+ return;
9255
+ }
9256
+
9257
+ $api = $this->get_api_site_scope();
9258
+ $license = $api->call( "/licenses/{$this->_site->license_id}.json", 'delete' );
9259
+
9260
+ if ( isset( $license->error ) ) {
9261
+ $this->_admin_notices->add(
9262
+ __fs( 'license-deactivation-failed-message', $this->_slug ) . '<br> ' .
9263
+ __fs( 'server-error-message', $this->_slug ) . ' ' . var_export( $license->error, true ),
9264
+ __fs( 'hmm', $this->_slug ) . '...',
9265
+ 'error'
9266
+ );
9267
+
9268
+ return;
9269
+ }
9270
+
9271
+ // Update license cache.
9272
+ for ( $i = 0, $len = count( $this->_licenses ); $i < $len; $i ++ ) {
9273
+ if ( $license->id == $this->_licenses[ $i ]->id ) {
9274
+ $this->_licenses[ $i ] = new FS_Plugin_License( $license );
9275
+ }
9276
+ }
9277
+
9278
+ // Updated site plan to default.
9279
+ $this->_sync_plans();
9280
+ $this->_site->plan->id = $this->_plans[0]->id;
9281
+ // Unlink license from site.
9282
+ $this->_update_site_license( null );
9283
+ $this->_enrich_site_plan( false );
9284
+
9285
+ $this->_store_account();
9286
+
9287
+ if ( $show_notice ) {
9288
+ $this->_admin_notices->add(
9289
+ sprintf( __fs( 'license-deactivation-message', $this->_slug ), $this->_site->plan->title ),
9290
+ __fs( 'ok', $this->_slug )
9291
+ );
9292
+ }
9293
+
9294
+ $this->_admin_notices->remove_sticky( array(
9295
+ 'plan_upgraded',
9296
+ 'license_activated',
9297
+ ) );
9298
+ }
9299
+
9300
+ /**
9301
+ * Site plan downgrade.
9302
+ *
9303
+ * @author Vova Feldman (@svovaf)
9304
+ * @since 1.0.4
9305
+ *
9306
+ * @uses FS_Api
9307
+ */
9308
+ private function _downgrade_site() {
9309
+ $this->_logger->entrance();
9310
+
9311
+ $api = $this->get_api_site_scope();
9312
+ $site = $api->call( 'downgrade.json', 'put' );
9313
+
9314
+ $plan_downgraded = false;
9315
+ $plan = false;
9316
+ if ( $this->is_api_result_entity( $site ) ) {
9317
+ $prev_plan_id = $this->_site->plan->id;
9318
+
9319
+ // Update new site plan id.
9320
+ $this->_site->plan->id = $site->plan_id;
9321
+
9322
+ $plan = $this->_enrich_site_plan();
9323
+ $subscription = $this->_sync_site_subscription( $this->_license );
9324
+
9325
+ // Plan downgraded if plan was changed or subscription was cancelled.
9326
+ $plan_downgraded = ( $plan instanceof FS_Plugin_Plan && $prev_plan_id != $plan->id ) ||
9327
+ ( is_object( $subscription ) && ! isset( $subscription->error ) && ! $subscription->is_active() );
9328
+ } else {
9329
+ // handle different error cases.
9330
+
9331
+ }
9332
+
9333
+ if ( $plan_downgraded ) {
9334
+ // Remove previous sticky message about upgrade (if exist).
9335
+ $this->_admin_notices->remove_sticky( 'plan_upgraded' );
9336
+
9337
+ $this->_admin_notices->add(
9338
+ sprintf( __fs( 'plan-x-downgraded-message', $this->_slug ),
9339
+ $plan->title,
9340
+ human_time_diff( time(), strtotime( $this->_license->expiration ) )
9341
+ )
9342
+ );
9343
+
9344
+ // Store site updates.
9345
+ $this->_store_site();
9346
+ } else {
9347
+ $this->_admin_notices->add(
9348
+ __fs( 'plan-downgraded-failure-message', $this->_slug ),
9349
+ __fs( 'oops', $this->_slug ) . '...',
9350
+ 'error'
9351
+ );
9352
+ }
9353
+ }
9354
+
9355
+ /**
9356
+ * @author Vova Feldman (@svovaf)
9357
+ * @since 1.1.8.1
9358
+ *
9359
+ * @param bool|string $plan_name
9360
+ *
9361
+ * @return bool If trial was successfully started.
9362
+ */
9363
+ function start_trial( $plan_name = false ) {
9364
+ $this->_logger->entrance();
9365
+
9366
+ if ( $this->is_trial() ) {
9367
+ // Already in trial mode.
9368
+ $this->_admin_notices->add(
9369
+ __fs( 'in-trial-mode', $this->_slug ),
9370
+ __fs( 'oops', $this->_slug ) . '...',
9371
+ 'error'
9372
+ );
9373
+
9374
+ return false;
9375
+ }
9376
+
9377
+ if ( $this->_site->is_trial_utilized() ) {
9378
+ // Trial was already utilized.
9379
+ $this->_admin_notices->add(
9380
+ __fs( 'trial-utilized', $this->_slug ),
9381
+ __fs( 'oops', $this->_slug ) . '...',
9382
+ 'error'
9383
+ );
9384
+
9385
+ return false;
9386
+ }
9387
+
9388
+ if ( false !== $plan_name ) {
9389
+ $plan = $this->get_plan_by_name( $plan_name );
9390
+
9391
+ if ( false === $plan ) {
9392
+ // Plan doesn't exist.
9393
+ $this->_admin_notices->add(
9394
+ sprintf( __fs( 'trial-plan-x-not-exist', $this->_slug ), $plan_name ),
9395
+ __fs( 'oops', $this->_slug ) . '...',
9396
+ 'error'
9397
+ );
9398
+
9399
+ return false;
9400
+ }
9401
+
9402
+ if ( ! $plan->has_trial() ) {
9403
+ // Plan doesn't exist.
9404
+ $this->_admin_notices->add(
9405
+ sprintf( __fs( 'plan-x-no-trial', $this->_slug ), $plan_name ),
9406
+ __fs( 'oops', $this->_slug ) . '...',
9407
+ 'error'
9408
+ );
9409
+
9410
+ return false;
9411
+ }
9412
+ } else {
9413
+ if ( ! $this->has_trial_plan() ) {
9414
+ // None of the plans have a trial.
9415
+ $this->_admin_notices->add(
9416
+ __fs( 'no-trials', $this->_slug ),
9417
+ __fs( 'oops', $this->_slug ) . '...',
9418
+ 'error'
9419
+ );
9420
+
9421
+ return false;
9422
+ }
9423
+
9424
+ $plans_with_trial = FS_Plan_Manager::instance()->get_trial_plans( $this->_plans );
9425
+
9426
+ $plan = $plans_with_trial[0];
9427
+ }
9428
+
9429
+ $api = $this->get_api_site_scope();
9430
+ $plan = $api->call( "plans/{$plan->id}/trials.json", 'post' );
9431
+
9432
+ if ( ! $this->is_api_result_entity( $plan ) ) {
9433
+ // Some API error while trying to start the trial.
9434
+ $this->_admin_notices->add(
9435
+ __fs( 'unexpected-api-error', $this->_slug ) . ' ' . var_export( $plan, true ),
9436
+ __fs( 'oops', $this->_slug ) . '...',
9437
+ 'error'
9438
+ );
9439
+
9440
+ return false;
9441
+ }
9442
+
9443
+ // Sync license.
9444
+ $this->_sync_license();
9445
+
9446
+ return $this->is_trial();
9447
+ }
9448
+
9449
+ /**
9450
+ * Cancel site trial.
9451
+ *
9452
+ * @author Vova Feldman (@svovaf)
9453
+ * @since 1.0.9
9454
+ *
9455
+ * @uses FS_Api
9456
+ */
9457
+ private function _cancel_trial() {
9458
+ $this->_logger->entrance();
9459
+
9460
+ if ( ! $this->is_trial() ) {
9461
+ $this->_admin_notices->add(
9462
+ __fs( 'trial-cancel-no-trial-message', $this->_slug ),
9463
+ __fs( 'oops', $this->_slug ) . '...',
9464
+ 'error'
9465
+ );
9466
+
9467
+ return;
9468
+ }
9469
+
9470
+ $api = $this->get_api_site_scope();
9471
+ $site = $api->call( 'trials.json', 'delete' );
9472
+
9473
+ $trial_cancelled = false;
9474
+
9475
+ if ( $this->is_api_result_entity( $site ) ) {
9476
+ $prev_trial_ends = $this->_site->trial_ends;
9477
+
9478
+ if ( $this->is_paid_trial() ) {
9479
+ $this->_license->expiration = $site->trial_ends;
9480
+ $this->_license->is_cancelled = true;
9481
+ $this->_update_site_license( $this->_license );
9482
+ $this->_store_licenses();
9483
+
9484
+ // Clear subscription reference.
9485
+ $this->_sync_site_subscription( null );
9486
+ }
9487
+
9488
+ // Update site info.
9489
+ $this->_site = new FS_Site( $site );
9490
+ $this->_enrich_site_plan();
9491
+
9492
+ $trial_cancelled = ( $prev_trial_ends != $site->trial_ends );
9493
+ } else {
9494
+ // handle different error cases.
9495
+
9496
+ }
9497
+
9498
+ if ( $trial_cancelled ) {
9499
+ // Remove previous sticky messages about upgrade or trial (if exist).
9500
+ $this->_admin_notices->remove_sticky( array(
9501
+ 'trial_started',
9502
+ 'trial_promotion',
9503
+ 'plan_upgraded',
9504
+ ) );
9505
+
9506
+ // Store site updates.
9507
+ $this->_store_site();
9508
+
9509
+ if ( ! $this->is_addon() ||
9510
+ ! $this->deactivate_premium_only_addon_without_license( true )
9511
+ ) {
9512
+ $this->_admin_notices->add(
9513
+ sprintf( __fs( 'trial-cancel-message', $this->_slug ), $this->_storage->trial_plan->title )
9514
+ );
9515
+ }
9516
+
9517
+ // Clear trial plan information.
9518
+ unset( $this->_storage->trial_plan );
9519
+ } else {
9520
+ $this->_admin_notices->add(
9521
+ __fs( 'trial-cancel-failure-message', $this->_slug ),
9522
+ __fs( 'oops', $this->_slug ) . '...',
9523
+ 'error'
9524
+ );
9525
+ }
9526
+ }
9527
+
9528
+ /**
9529
+ * @author Vova Feldman (@svovaf)
9530
+ * @since 1.0.6
9531
+ *
9532
+ * @param bool|number $plugin_id
9533
+ *
9534
+ * @return bool
9535
+ */
9536
+ private function _is_addon_id( $plugin_id ) {
9537
+ return is_numeric( $plugin_id ) && ( $this->get_id() != $plugin_id );
9538
+ }
9539
+
9540
+ /**
9541
+ * Check if user eligible to download premium version updates.
9542
+ *
9543
+ * @author Vova Feldman (@svovaf)
9544
+ * @since 1.0.6
9545
+ *
9546
+ * @return bool
9547
+ */
9548
+ private function _can_download_premium() {
9549
+ return $this->has_active_valid_license() ||
9550
+ ( $this->is_trial() && ! $this->get_trial_plan()->is_free() );
9551
+ }
9552
+
9553
+ /**
9554
+ *
9555
+ * @author Vova Feldman (@svovaf)
9556
+ * @since 1.0.6
9557
+ *
9558
+ * @param bool|number $addon_id
9559
+ * @param string $type "json" or "zip"
9560
+ *
9561
+ * @return string
9562
+ */
9563
+ private function _get_latest_version_endpoint( $addon_id = false, $type = 'json' ) {
9564
+
9565
+ $is_addon = $this->_is_addon_id( $addon_id );
9566
+
9567
+ $is_premium = null;
9568
+ if ( ! $is_addon ) {
9569
+ $is_premium = $this->_can_download_premium();
9570
+ } else if ( $this->is_addon_activated( $addon_id ) ) {
9571
+ $is_premium = self::get_instance_by_id( $addon_id )->_can_download_premium();
9572
+ }
9573
+
9574
+ return // If add-on, then append add-on ID.
9575
+ ( $is_addon ? "/addons/$addon_id" : '' ) .
9576
+ '/updates/latest.' . $type .
9577
+ // If add-on and not yet activated, try to fetch based on server licensing.
9578
+ ( is_bool( $is_premium ) ? '?is_premium=' . json_encode( $is_premium ) : '' );
9579
+ }
9580
+
9581
+ /**
9582
+ * @author Vova Feldman (@svovaf)
9583
+ * @since 1.0.4
9584
+ *
9585
+ * @param bool|number $addon_id
9586
+ * @param bool $flush Since 1.1.7.3
9587
+ *
9588
+ * @return object|false Plugin latest tag info.
9589
+ */
9590
+ function _fetch_latest_version( $addon_id = false, $flush = true ) {
9591
+ $this->_logger->entrance();
9592
+
9593
+ /**
9594
+ * @since 1.1.7.3 Check for plugin updates from Freemius only if opted-in.
9595
+ * @since 1.1.7.4 Also check updates for add-ons.
9596
+ */
9597
+ if ( ! $this->is_registered() &&
9598
+ ! $this->_is_addon_id( $addon_id )
9599
+ ) {
9600
+ return false;
9601
+ }
9602
+
9603
+ $tag = $this->get_api_site_or_plugin_scope()->get(
9604
+ $this->_get_latest_version_endpoint( $addon_id, 'json' ),
9605
+ $flush
9606
+ );
9607
+
9608
+ $latest_version = ( is_object( $tag ) && isset( $tag->version ) ) ? $tag->version : 'couldn\'t get';
9609
+
9610
+ $this->_logger->departure( 'Latest version ' . $latest_version );
9611
+
9612
+ return ( is_object( $tag ) && isset( $tag->version ) ) ? $tag : false;
9613
+ }
9614
+
9615
+ #----------------------------------------------------------------------------------
9616
+ #region Download Plugin
9617
+ #----------------------------------------------------------------------------------
9618
+
9619
+ /**
9620
+ * Download latest plugin version, based on plan.
9621
+ *
9622
+ * Not like _download_latest(), this will redirect the page
9623
+ * to secure download url to prevent dual download (from FS to WP server,
9624
+ * and then from WP server to the client / browser).
9625
+ *
9626
+ * @author Vova Feldman (@svovaf)
9627
+ * @since 1.0.9
9628
+ *
9629
+ * @param bool|number $plugin_id
9630
+ *
9631
+ * @uses FS_Api
9632
+ * @uses wp_redirect()
9633
+ */
9634
+ private function _download_latest_directly( $plugin_id = false ) {
9635
+ $this->_logger->entrance();
9636
+
9637
+ wp_redirect( $this->_get_latest_download_api_url( $plugin_id ) );
9638
+ }
9639
+
9640
+ /**
9641
+ * Get latest plugin FS API download URL.
9642
+ *
9643
+ * @author Vova Feldman (@svovaf)
9644
+ * @since 1.0.9
9645
+ *
9646
+ * @param bool|number $plugin_id
9647
+ *
9648
+ * @return string
9649
+ */
9650
+ private function _get_latest_download_api_url( $plugin_id = false ) {
9651
+ $this->_logger->entrance();
9652
+
9653
+ return $this->get_api_site_scope()->get_signed_url(
9654
+ $this->_get_latest_version_endpoint( $plugin_id, 'zip' )
9655
+ );
9656
+ }
9657
+
9658
+ /**
9659
+ * Get payment invoice URL.
9660
+ *
9661
+ * @author Vova Feldman (@svovaf)
9662
+ * @since 1.2.0
9663
+ *
9664
+ * @param bool|number $payment_id
9665
+ *
9666
+ * @return string
9667
+ */
9668
+ function _get_invoice_api_url( $payment_id = false ) {
9669
+ $this->_logger->entrance();
9670
+
9671
+ return $this->get_api_user_scope()->get_signed_url(
9672
+ "/payments/{$payment_id}/invoice.pdf"
9673
+ );
9674
+ }
9675
+
9676
+ /**
9677
+ * Get latest plugin download link.
9678
+ *
9679
+ * @author Vova Feldman (@svovaf)
9680
+ * @since 1.0.9
9681
+ *
9682
+ * @param string $label
9683
+ * @param bool|number $plugin_id
9684
+ *
9685
+ * @return string
9686
+ */
9687
+ private function _get_latest_download_link( $label, $plugin_id = false ) {
9688
+ return sprintf(
9689
+ '<a target="_blank" href="%s">%s</a>',
9690
+ $this->_get_latest_download_local_url( $plugin_id ),
9691
+ $label
9692
+ );
9693
+ }
9694
+
9695
+ /**
9696
+ * Get latest plugin download local URL.
9697
+ *
9698
+ * @author Vova Feldman (@svovaf)
9699
+ * @since 1.0.9
9700
+ *
9701
+ * @param bool|number $plugin_id
9702
+ *
9703
+ * @return string
9704
+ */
9705
+ function _get_latest_download_local_url( $plugin_id = false ) {
9706
+ // Add timestamp to protect from caching.
9707
+ $params = array( 'ts' => WP_FS__SCRIPT_START_TIME );
9708
+
9709
+ if ( ! empty( $plugin_id ) ) {
9710
+ $params['plugin_id'] = $plugin_id;
9711
+ }
9712
+
9713
+ return $this->get_account_url( 'download_latest', $params );
9714
+ }
9715
+
9716
+ #endregion Download Plugin ------------------------------------------------------------------
9717
+
9718
+ /**
9719
+ * @author Vova Feldman (@svovaf)
9720
+ * @since 1.0.4
9721
+ *
9722
+ * @uses FS_Api
9723
+ *
9724
+ * @param bool $background Hints the method if it's a background updates check. If false, it means that
9725
+ * was initiated by the admin.
9726
+ * @param bool|number $plugin_id
9727
+ * @param bool $flush Since 1.1.7.3
9728
+ */
9729
+ private function _check_updates( $background = false, $plugin_id = false, $flush = true ) {
9730
+ $this->_logger->entrance();
9731
+
9732
+ // Check if there's a newer version for download.
9733
+ $new_version = $this->_fetch_newer_version( $plugin_id, $flush );
9734
+
9735
+ $update = null;
9736
+ if ( is_object( $new_version ) ) {
9737
+ $update = new FS_Plugin_Tag( $new_version );
9738
+
9739
+ if ( ! $background ) {
9740
+ $this->_admin_notices->add(
9741
+ sprintf(
9742
+ __fs( 'version-x-released', $this->_slug ) . ' ' . __fs( 'please-download-x', $this->_slug ),
9743
+ $update->version,
9744
+ sprintf(
9745
+ '<a href="%s" target="_blank">%s</a>',
9746
+ $this->get_account_url( 'download_latest' ),
9747
+ sprintf( __fs( 'latest-x-version', $this->_slug ), $this->_site->plan->title )
9748
+ )
9749
+ ),
9750
+ __fs( 'new', $this->_slug ) . '!'
9751
+ );
9752
+ }
9753
+ } else if ( false === $new_version && ! $background ) {
9754
+ $this->_admin_notices->add(
9755
+ __fs( 'you-have-latest', $this->_slug ),
9756
+ __fs( 'you-are-good', $this->_slug )
9757
+ );
9758
+ }
9759
+
9760
+ $this->_store_update( $update, true, $plugin_id );
9761
+ }
9762
+
9763
+ /**
9764
+ * @author Vova Feldman (@svovaf)
9765
+ * @since 1.0.4
9766
+ *
9767
+ * @param bool $flush Since 1.1.7.3 add 24 hour cache by default.
9768
+ *
9769
+ * @return FS_Plugin[]
9770
+ *
9771
+ * @uses FS_Api
9772
+ */
9773
+ private function _sync_addons( $flush = false ) {
9774
+ $this->_logger->entrance();
9775
+
9776
+ $api = $this->get_api_site_or_plugin_scope();
9777
+
9778
+ /**
9779
+ * @since 1.2.1
9780
+ *
9781
+ * If there's a cached version of the add-ons and not asking
9782
+ * for a flush, just use the currently stored add-ons.
9783
+ */
9784
+ if ( ! $flush && $api->is_cached( '/addons.json?enriched=true' ) ) {
9785
+ $addons = self::get_all_addons();
9786
+
9787
+ return $addons[ $this->_plugin->id ];
9788
+ }
9789
+
9790
+ $result = $api->get( '/addons.json?enriched=true', $flush );
9791
+
9792
+ $addons = array();
9793
+ if ( $this->is_api_result_object( $result, 'plugins' ) &&
9794
+ is_array( $result->plugins )
9795
+ ) {
9796
+ for ( $i = 0, $len = count( $result->plugins ); $i < $len; $i ++ ) {
9797
+ $addons[ $i ] = new FS_Plugin( $result->plugins[ $i ] );
9798
+ }
9799
+
9800
+ $this->_store_addons( $addons, true );
9801
+ }
9802
+
9803
+ return $addons;
9804
+ }
9805
+
9806
+ /**
9807
+ * Handle user email update.
9808
+ *
9809
+ * @author Vova Feldman (@svovaf)
9810
+ * @since 1.0.3
9811
+ * @uses FS_Api
9812
+ *
9813
+ * @param string $new_email
9814
+ *
9815
+ * @return object
9816
+ */
9817
+ private function _update_email( $new_email ) {
9818
+ $this->_logger->entrance();
9819
+
9820
+
9821
+ $api = $this->get_api_user_scope();
9822
+ $user = $api->call( "?plugin_id={$this->_plugin->id}&fields=id,email,is_verified", 'put', array(
9823
+ 'email' => $new_email,
9824
+ 'after_email_confirm_url' => $this->_get_admin_page_url(
9825
+ 'account',
9826
+ array( 'fs_action' => 'sync_user' )
9827
+ ),
9828
+ ) );
9829
+
9830
+ if ( ! isset( $user->error ) ) {
9831
+ $this->_user->email = $user->email;
9832
+ $this->_user->is_verified = $user->is_verified;
9833
+ $this->_store_user();
9834
+ } else {
9835
+ // handle different error cases.
9836
+
9837
+ }
9838
+
9839
+ return $user;
9840
+ }
9841
+
9842
+ #----------------------------------------------------------------------------------
9843
+ #region API Error Handling
9844
+ #----------------------------------------------------------------------------------
9845
+
9846
+ /**
9847
+ * @author Vova Feldman (@svovaf)
9848
+ * @since 1.1.1
9849
+ *
9850
+ * @param mixed $result
9851
+ *
9852
+ * @return bool Is API result contains an error.
9853
+ */
9854
+ private function is_api_error( $result ) {
9855
+ return FS_Api::is_api_error( $result );
9856
+ }
9857
+
9858
+ /**
9859
+ * Checks if given API result is a non-empty and not an error object.
9860
+ *
9861
+ * @author Vova Feldman (@svovaf)
9862
+ * @since 1.2.1.5
9863
+ *
9864
+ * @param mixed $result
9865
+ * @param string|null $required_property Optional property we want to verify that is set.
9866
+ *
9867
+ * @return bool
9868
+ */
9869
+ function is_api_result_object( $result, $required_property = null ) {
9870
+ return FS_Api::is_api_result_object( $result, $required_property );
9871
+ }
9872
+
9873
+ /**
9874
+ * Checks if given API result is a non-empty entity object with non-empty ID.
9875
+ *
9876
+ * @author Vova Feldman (@svovaf)
9877
+ * @since 1.2.1.5
9878
+ *
9879
+ * @param mixed $result
9880
+ *
9881
+ * @return bool
9882
+ */
9883
+ private function is_api_result_entity( $result ) {
9884
+ return FS_Api::is_api_result_entity( $result );
9885
+ }
9886
+
9887
+ #endregion
9888
+
9889
+ /**
9890
+ * Make sure a given argument is an array of a specific type.
9891
+ *
9892
+ * @author Vova Feldman (@svovaf)
9893
+ * @since 1.2.1.5
9894
+ *
9895
+ * @param mixed $array
9896
+ * @param string $class
9897
+ *
9898
+ * @return bool
9899
+ */
9900
+ private function is_array_instanceof( $array, $class ) {
9901
+ return ( is_array( $array ) && ( empty( $array ) || $array[0] instanceof $class ) );
9902
+ }
9903
+
9904
+ /**
9905
+ * Start install ownership change.
9906
+ *
9907
+ * @author Vova Feldman (@svovaf)
9908
+ * @since 1.1.1
9909
+ * @uses FS_Api
9910
+ *
9911
+ * @param string $candidate_email
9912
+ *
9913
+ * @return bool Is ownership change successfully initiated.
9914
+ */
9915
+ private function init_change_owner( $candidate_email ) {
9916
+ $this->_logger->entrance();
9917
+
9918
+ $api = $this->get_api_site_scope();
9919
+ $result = $api->call( "/users/{$this->_user->id}.json", 'put', array(
9920
+ 'email' => $candidate_email,
9921
+ 'after_confirm_url' => $this->_get_admin_page_url(
9922
+ 'account',
9923
+ array( 'fs_action' => 'change_owner' )
9924
+ ),
9925
+ ) );
9926
+
9927
+ return ! $this->is_api_error( $result );
9928
+ }
9929
+
9930
+ /**
9931
+ * Handle install ownership change.
9932
+ *
9933
+ * @author Vova Feldman (@svovaf)
9934
+ * @since 1.1.1
9935
+ * @uses FS_Api
9936
+ *
9937
+ * @return bool Was ownership change successfully complete.
9938
+ */
9939
+ private function complete_change_owner() {
9940
+ $this->_logger->entrance();
9941
+
9942
+ $site_result = $this->get_api_site_scope( true )->get();
9943
+ $site = new FS_Site( $site_result );
9944
+ $this->_site = $site;
9945
+
9946
+ $user = new FS_User();
9947
+ $user->id = fs_request_get( 'user_id' );
9948
+
9949
+ // Validate install's user and given user.
9950
+ if ( $user->id != $this->_site->user_id ) {
9951
+ return false;
9952
+ }
9953
+
9954
+ $user->public_key = fs_request_get( 'user_public_key' );
9955
+ $user->secret_key = fs_request_get( 'user_secret_key' );
9956
+
9957
+ // Fetch new user information.
9958
+ $this->_user = $user;
9959
+ $user_result = $this->get_api_user_scope( true )->get();
9960
+ $user = new FS_User( $user_result );
9961
+ $this->_user = $user;
9962
+
9963
+ $this->_set_account( $user, $site );
9964
+
9965
+ return true;
9966
+ }
9967
+
9968
+ /**
9969
+ * Handle user name update.
9970
+ *
9971
+ * @author Vova Feldman (@svovaf)
9972
+ * @since 1.0.9
9973
+ * @uses FS_Api
9974
+ *
9975
+ * @return object
9976
+ */
9977
+ private function update_user_name() {
9978
+ $this->_logger->entrance();
9979
+ $name = fs_request_get( 'fs_user_name_' . $this->_slug, '' );
9980
+
9981
+ $api = $this->get_api_user_scope();
9982
+ $user = $api->call( "?plugin_id={$this->_plugin->id}&fields=id,first,last", 'put', array(
9983
+ 'name' => $name,
9984
+ ) );
9985
+
9986
+ if ( ! isset( $user->error ) ) {
9987
+ $this->_user->first = $user->first;
9988
+ $this->_user->last = $user->last;
9989
+ $this->_store_user();
9990
+ } else {
9991
+ // handle different error cases.
9992
+
9993
+ }
9994
+
9995
+ return $user;
9996
+ }
9997
+
9998
+ /**
9999
+ * Verify user email.
10000
+ *
10001
+ * @author Vova Feldman (@svovaf)
10002
+ * @since 1.0.3
10003
+ * @uses FS_Api
10004
+ */
10005
+ private function verify_email() {
10006
+ $this->_handle_account_user_sync();
10007
+
10008
+ if ( $this->_user->is_verified() ) {
10009
+ return;
10010
+ }
10011
+
10012
+ $api = $this->get_api_site_scope();
10013
+ $result = $api->call( "/users/{$this->_user->id}/verify.json", 'put', array(
10014
+ 'after_email_confirm_url' => $this->_get_admin_page_url(
10015
+ 'account',
10016
+ array( 'fs_action' => 'sync_user' )
10017
+ )
10018
+ ) );
10019
+
10020
+ if ( ! isset( $result->error ) ) {
10021
+ $this->_admin_notices->add( sprintf(
10022
+ __fs( 'verification-email-sent-message', $this->_slug ),
10023
+ sprintf( '<a href="mailto:%1s">%2s</a>', esc_url( $this->_user->email ), $this->_user->email )
10024
+ ) );
10025
+ } else {
10026
+ // handle different error cases.
10027
+
10028
+ }
10029
+ }
10030
+
10031
+ /**
10032
+ * @author Vova Feldman (@svovaf)
10033
+ * @since 1.1.2
10034
+ *
10035
+ * @param array $params
10036
+ *
10037
+ * @return string
10038
+ */
10039
+ private function get_activation_url( $params = array() ) {
10040
+ return $this->apply_filters( 'connect_url', $this->_get_admin_page_url( '', $params ) );
10041
+ }
10042
+
10043
+ /**
10044
+ * @author Vova Feldman (@svovaf)
10045
+ * @since 1.2.1.5
10046
+ *
10047
+ * @param array $params
10048
+ *
10049
+ * @return string
10050
+ */
10051
+ function get_reconnect_url( $params = array() ) {
10052
+ $params['fs_action'] = 'reset_anonymous_mode';
10053
+ $params['fs_slug'] = $this->_slug;
10054
+
10055
+ return $this->apply_filters( 'connect_url', $this->_get_admin_page_url( '', $params ) );
10056
+ }
10057
+
10058
+ /**
10059
+ * Get the URL of the page that should be loaded after the user connect or skip in the opt-in screen.
10060
+ *
10061
+ * @author Vova Feldman (@svovaf)
10062
+ * @since 1.1.3
10063
+ *
10064
+ * @param string $filter Filter name.
10065
+ *
10066
+ * @return string
10067
+ */
10068
+ function get_after_activation_url( $filter ) {
10069
+ $first_time_path = $this->_menu->get_first_time_path();
10070
+
10071
+ return $this->apply_filters(
10072
+ $filter,
10073
+ empty( $first_time_path ) ?
10074
+ $this->_get_admin_page_url() :
10075
+ $first_time_path
10076
+ );
10077
+ }
10078
+
10079
+ /**
10080
+ * Handle account page updates / edits / actions.
10081
+ *
10082
+ * @author Vova Feldman (@svovaf)
10083
+ * @since 1.0.2
10084
+ *
10085
+ */
10086
+ private function _handle_account_edits() {
10087
+ if ( ! current_user_can( 'activate_plugins' ) ) {
10088
+ return;
10089
+ }
10090
+
10091
+ $plugin_id = fs_request_get( 'plugin_id', $this->get_id() );
10092
+ $action = fs_get_action();
10093
+
10094
+ switch ( $action ) {
10095
+ case 'delete_account':
10096
+ check_admin_referer( $action );
10097
+
10098
+ if ( $plugin_id == $this->get_id() ) {
10099
+ $this->delete_account_event();
10100
+
10101
+ // Clear user and site.
10102
+ $this->_site = null;
10103
+ $this->_user = null;
10104
+
10105
+ fs_redirect( $this->get_activation_url() );
10106
+ } else {
10107
+ if ( $this->is_addon_activated( $plugin_id ) ) {
10108
+ $fs_addon = self::get_instance_by_id( $plugin_id );
10109
+ $fs_addon->delete_account_event();
10110
+
10111
+ fs_redirect( $this->_get_admin_page_url( 'account' ) );
10112
+ }
10113
+ }
10114
+
10115
+ return;
10116
+
10117
+ case 'downgrade_account':
10118
+ check_admin_referer( $action );
10119
+
10120
+ if ( $plugin_id == $this->get_id() ) {
10121
+ $this->_downgrade_site();
10122
+ } else if ( $this->is_addon_activated( $plugin_id ) ) {
10123
+ $fs_addon = self::get_instance_by_id( $plugin_id );
10124
+ $fs_addon->_downgrade_site();
10125
+ }
10126
+
10127
+ return;
10128
+
10129
+ case 'activate_license':
10130
+ check_admin_referer( $action );
10131
+
10132
+ if ( $plugin_id == $this->get_id() ) {
10133
+ $this->_activate_license();
10134
+ } else {
10135
+ if ( $this->is_addon_activated( $plugin_id ) ) {
10136
+ $fs_addon = self::get_instance_by_id( $plugin_id );
10137
+ $fs_addon->_activate_license();
10138
+ }
10139
+ }
10140
+
10141
+ return;
10142
+
10143
+ case 'deactivate_license':
10144
+ check_admin_referer( $action );
10145
+
10146
+ if ( $plugin_id == $this->get_id() ) {
10147
+ $this->_deactivate_license();
10148
+ } else {
10149
+ if ( $this->is_addon_activated( $plugin_id ) ) {
10150
+ $fs_addon = self::get_instance_by_id( $plugin_id );
10151
+ $fs_addon->_deactivate_license();
10152
+ }
10153
+ }
10154
+
10155
+ return;
10156
+
10157
+ case 'check_updates':
10158
+ check_admin_referer( $action );
10159
+ $this->_check_updates();
10160
+
10161
+ return;
10162
+
10163
+ case 'change_owner':
10164
+ $state = fs_request_get( 'state', 'init' );
10165
+ switch ( $state ) {
10166
+ case 'init':
10167
+ $candidate_email = fs_request_get( 'candidate_email', '' );
10168
+
10169
+ if ( $this->init_change_owner( $candidate_email ) ) {
10170
+ $this->_admin_notices->add( sprintf( __fs( 'change-owner-request-sent-x', $this->_slug ), '<b>' . $this->_user->email . '</b>' ) );
10171
+ }
10172
+ break;
10173
+ case 'owner_confirmed':
10174
+ $candidate_email = fs_request_get( 'candidate_email', '' );
10175
+
10176
+ $this->_admin_notices->add( sprintf( __fs( 'change-owner-request_owner-confirmed', $this->_slug ), '<b>' . $candidate_email . '</b>' ) );
10177
+ break;
10178
+ case 'candidate_confirmed':
10179
+ if ( $this->complete_change_owner() ) {
10180
+ $this->_admin_notices->add_sticky(
10181
+ sprintf( __fs( 'change-owner-request_candidate-confirmed', $this->_slug ), '<b>' . $this->_user->email . '</b>' ),
10182
+ 'ownership_changed',
10183
+ __fs( 'congrats', $this->_slug ) . '!'
10184
+ );
10185
+ } else {
10186
+ // @todo Handle failed ownership change message.
10187
+ }
10188
+ break;
10189
+ }
10190
+
10191
+ return;
10192
+
10193
+ case 'update_email':
10194
+ check_admin_referer( 'update_email' );
10195
+
10196
+ $new_email = fs_request_get( 'fs_email_' . $this->_slug, '' );
10197
+ $result = $this->_update_email( $new_email );
10198
+
10199
+ if ( isset( $result->error ) ) {
10200
+ switch ( $result->error->code ) {
10201
+ case 'user_exist':
10202
+ $this->_admin_notices->add(
10203
+ __fs( 'user-exist-message', $this->_slug ) . ' ' .
10204
+ sprintf( __fs( 'user-exist-message_ownership', $this->_slug ), '<b>' . $new_email . '</b>' ) .
10205
+ sprintf(
10206
+ '<a style="margin-left: 10px;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
10207
+ $this->get_account_url( 'change_owner', array(
10208
+ 'state' => 'init',
10209
+ 'candidate_email' => $new_email
10210
+ ) ),
10211
+ __fs( 'change-ownership', $this->_slug )
10212
+ ),
10213
+ __fs( 'oops', $this->_slug ) . '...',
10214
+ 'error'
10215
+ );
10216
+ break;
10217
+ }
10218
+ } else {
10219
+ $this->_admin_notices->add( __fs( 'email-updated-message', $this->_slug ) );
10220
+ }
10221
+
10222
+ return;
10223
+
10224
+ case 'update_user_name':
10225
+ check_admin_referer( 'update_user_name' );
10226
+
10227
+ $result = $this->update_user_name();
10228
+
10229
+ if ( isset( $result->error ) ) {
10230
+ $this->_admin_notices->add(
10231
+ __fs( 'name-update-failed-message', $this->_slug ),
10232
+ __fs( 'oops', $this->_slug ) . '...',
10233
+ 'error'
10234
+ );
10235
+ } else {
10236
+ $this->_admin_notices->add( __fs( 'name-updated-message', $this->_slug ) );
10237
+ }
10238
+
10239
+ return;
10240
+
10241
+ #region Actions that might be called from external links (e.g. email)
10242
+
10243
+ case 'cancel_trial':
10244
+ if ( $plugin_id == $this->get_id() ) {
10245
+ $this->_cancel_trial();
10246
+ } else {
10247
+ if ( $this->is_addon_activated( $plugin_id ) ) {
10248
+ $fs_addon = self::get_instance_by_id( $plugin_id );
10249
+ $fs_addon->_cancel_trial();
10250
+ }
10251
+ }
10252
+
10253
+ return;
10254
+
10255
+ case 'verify_email':
10256
+ $this->verify_email();
10257
+
10258
+ return;
10259
+
10260
+ case 'sync_user':
10261
+ $this->_handle_account_user_sync();
10262
+
10263
+ return;
10264
+
10265
+ case $this->_slug . '_sync_license':
10266
+ $this->_sync_license();
10267
+
10268
+ return;
10269
+
10270
+ case 'download_latest':
10271
+ $this->_download_latest_directly( $plugin_id );
10272
+
10273
+ return;
10274
+
10275
+ #endregion
10276
+ }
10277
+
10278
+ if ( WP_FS__IS_POST_REQUEST ) {
10279
+ $properties = array( 'site_secret_key', 'site_id', 'site_public_key' );
10280
+ foreach ( $properties as $p ) {
10281
+ if ( 'update_' . $p === $action ) {
10282
+ check_admin_referer( $action );
10283
+
10284
+ $this->_logger->log( $action );
10285
+
10286
+ $site_property = substr( $p, strlen( 'site_' ) );
10287
+ $site_property_value = fs_request_get( 'fs_' . $p . '_' . $this->_slug, '' );
10288
+ $this->get_site()->{$site_property} = $site_property_value;
10289
+
10290
+ // Store account after modification.
10291
+ $this->_store_site();
10292
+
10293
+ $this->do_action( 'account_property_edit', 'site', $site_property, $site_property_value );
10294
+
10295
+ $this->_admin_notices->add( sprintf(
10296
+ __fs( 'x-updated', $this->_slug ),
10297
+ '<b>' . str_replace( '_', ' ', $p ) . '</b>' ) );
10298
+
10299
+ return;
10300
+ }
10301
+ }
10302
+ }
10303
+ }
10304
+
10305
+ /**
10306
+ * Account page resources load.
10307
+ *
10308
+ * @author Vova Feldman (@svovaf)
10309
+ * @since 1.0.6
10310
+ */
10311
+ function _account_page_load() {
10312
+ $this->_logger->entrance();
10313
+
10314
+ $this->_logger->info( var_export( $_REQUEST, true ) );
10315
+
10316
+ fs_enqueue_local_style( 'fs_account', '/admin/account.css' );
10317
+
10318
+ if ( $this->has_addons() ) {
10319
+ wp_enqueue_script( 'plugin-install' );
10320
+ add_thickbox();
10321
+
10322
+ function fs_addons_body_class( $classes ) {
10323
+ $classes .= ' plugins-php';
10324
+
10325
+ return $classes;
10326
+ }
10327
+
10328
+ add_filter( 'admin_body_class', 'fs_addons_body_class' );
10329
+ }
10330
+
10331
+ if ( $this->has_paid_plan() &&
10332
+ ! $this->has_any_license() &&
10333
+ ! $this->is_sync_executed() &&
10334
+ $this->is_tracking_allowed()
10335
+ ) {
10336
+ /**
10337
+ * If no licenses found and no sync job was executed during the last 24 hours,
10338
+ * just execute the sync job right away (blocking execution).
10339
+ *
10340
+ * @since 1.1.7.3
10341
+ */
10342
+ $this->run_manual_sync();
10343
+ }
10344
+
10345
+ $this->_handle_account_edits();
10346
+
10347
+ $this->do_action( 'account_page_load_before_departure' );
10348
+ }
10349
+
10350
+ /**
10351
+ * Render account page.
10352
+ *
10353
+ * @author Vova Feldman (@svovaf)
10354
+ * @since 1.0.0
10355
+ */
10356
+ function _account_page_render() {
10357
+ $this->_logger->entrance();
10358
+
10359
+ $vars = array( 'slug' => $this->_slug );
10360
+ if ( 'billing' === fs_request_get( 'tab' ) ) {
10361
+ fs_require_once_template( 'billing.php', $vars );
10362
+ } else {
10363
+ fs_require_once_template( 'account.php', $vars );
10364
+ }
10365
+ }
10366
+
10367
+ /**
10368
+ * Render account connect page.
10369
+ *
10370
+ * @author Vova Feldman (@svovaf)
10371
+ * @since 1.0.7
10372
+ */
10373
+ function _connect_page_render() {
10374
+ $this->_logger->entrance();
10375
+
10376
+ $vars = array( 'slug' => $this->_slug );
10377
+ fs_require_once_template( 'connect.php', $vars );
10378
+ }
10379
+
10380
+ /**
10381
+ * Load required resources before add-ons page render.
10382
+ *
10383
+ * @author Vova Feldman (@svovaf)
10384
+ * @since 1.0.6
10385
+ */
10386
+ function _addons_page_load() {
10387
+ $this->_logger->entrance();
10388
+
10389
+ fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
10390
+
10391
+ wp_enqueue_script( 'plugin-install' );
10392
+ add_thickbox();
10393
+
10394
+ function fs_addons_body_class( $classes ) {
10395
+ $classes .= ' plugins-php';
10396
+
10397
+ return $classes;
10398
+ }
10399
+
10400
+ add_filter( 'admin_body_class', 'fs_addons_body_class' );
10401
+
10402
+ if ( ! $this->is_registered() && $this->is_org_repo_compliant() ) {
10403
+ $this->_admin_notices->add(
10404
+ sprintf( __fs( 'addons-info-external-message', $this->_slug ), '<b>' . $this->get_plugin_name() . '</b>' ),
10405
+ __fs( 'heads-up', $this->_slug ),
10406
+ 'update-nag'
10407
+ );
10408
+ }
10409
+ }
10410
+
10411
+ /**
10412
+ * Render add-ons page.
10413
+ *
10414
+ * @author Vova Feldman (@svovaf)
10415
+ * @since 1.0.6
10416
+ */
10417
+ function _addons_page_render() {
10418
+ $this->_logger->entrance();
10419
+
10420
+ $vars = array( 'slug' => $this->_slug );
10421
+ fs_require_once_template( 'add-ons.php', $vars );
10422
+ }
10423
+
10424
+ /* Pricing & Upgrade
10425
+ ------------------------------------------------------------------------------------------------------------------*/
10426
+ /**
10427
+ * Render pricing page.
10428
+ *
10429
+ * @author Vova Feldman (@svovaf)
10430
+ * @since 1.0.0
10431
+ */
10432
+ function _pricing_page_render() {
10433
+ $this->_logger->entrance();
10434
+
10435
+ $vars = array( 'slug' => $this->_slug );
10436
+
10437
+ if ( 'true' === fs_request_get( 'checkout', false ) ) {
10438
+ fs_require_once_template( 'checkout.php', $vars );
10439
+ } else {
10440
+ fs_require_once_template( 'pricing.php', $vars );
10441
+ }
10442
+ }
10443
+
10444
+ #----------------------------------------------------------------------------------
10445
+ #region Contact Us
10446
+ #----------------------------------------------------------------------------------
10447
+
10448
+ /**
10449
+ * Render contact-us page.
10450
+ *
10451
+ * @author Vova Feldman (@svovaf)
10452
+ * @since 1.0.3
10453
+ */
10454
+ function _contact_page_render() {
10455
+ $this->_logger->entrance();
10456
+
10457
+ $vars = array( 'slug' => $this->_slug );
10458
+ fs_require_once_template( 'contact.php', $vars );
10459
+ }
10460
+
10461
+ #endregion ------------------------------------------------------------------------
10462
+
10463
+ /**
10464
+ * Hide all admin notices to prevent distractions.
10465
+ *
10466
+ * @author Vova Feldman (@svovaf)
10467
+ * @since 1.0.3
10468
+ *
10469
+ * @uses remove_all_actions()
10470
+ */
10471
+ private static function _hide_admin_notices() {
10472
+ remove_all_actions( 'admin_notices' );
10473
+ remove_all_actions( 'network_admin_notices' );
10474
+ remove_all_actions( 'all_admin_notices' );
10475
+ remove_all_actions( 'user_admin_notices' );
10476
+ }
10477
+
10478
+ static function _clean_admin_content_section_hook() {
10479
+ self::_hide_admin_notices();
10480
+
10481
+ // Hide footer.
10482
+ echo '<style>#wpfooter { display: none !important; }</style>';
10483
+ }
10484
+
10485
+ /**
10486
+ * Attach to admin_head hook to hide all admin notices.
10487
+ *
10488
+ * @author Vova Feldman (@svovaf)
10489
+ * @since 1.0.3
10490
+ */
10491
+ static function _clean_admin_content_section() {
10492
+ add_action( 'admin_head', 'Freemius::_clean_admin_content_section_hook' );
10493
+ }
10494
+
10495
+ /* CSS & JavaScript
10496
+ ------------------------------------------------------------------------------------------------------------------*/
10497
+ /* function _enqueue_script($handle, $src) {
10498
+ $url = plugins_url( substr( WP_FS__DIR_JS, strlen( $this->_plugin_dir_path ) ) . '/assets/js/' . $src );
10499
+
10500
+ $this->_logger->entrance( 'script = ' . $url );
10501
+
10502
+ wp_enqueue_script( $handle, $url );
10503
+ }*/
10504
+
10505
+ /* SDK
10506
+ ------------------------------------------------------------------------------------------------------------------*/
10507
+ private $_user_api;
10508
+
10509
+ /**
10510
+ *
10511
+ * @author Vova Feldman (@svovaf)
10512
+ * @since 1.0.2
10513
+ *
10514
+ * @param bool $flush
10515
+ *
10516
+ * @return FS_Api
10517
+ */
10518
+ function get_api_user_scope( $flush = false ) {
10519
+ if ( ! isset( $this->_user_api ) || $flush ) {
10520
+ $this->_user_api = FS_Api::instance(
10521
+ $this->_slug,
10522
+ 'user',
10523
+ $this->_user->id,
10524
+ $this->_user->public_key,
10525
+ ! $this->is_live(),
10526
+ $this->_user->secret_key
10527
+ );
10528
+ }
10529
+
10530
+ return $this->_user_api;
10531
+ }
10532
+
10533
+ private $_site_api;
10534
+
10535
+ /**
10536
+ *
10537
+ * @author Vova Feldman (@svovaf)
10538
+ * @since 1.0.2
10539
+ *
10540
+ * @param bool $flush
10541
+ *
10542
+ * @return FS_Api
10543
+ */
10544
+ function get_api_site_scope( $flush = false ) {
10545
+ if ( ! isset( $this->_site_api ) || $flush ) {
10546
+ $this->_site_api = FS_Api::instance(
10547
+ $this->_slug,
10548
+ 'install',
10549
+ $this->_site->id,
10550
+ $this->_site->public_key,
10551
+ ! $this->is_live(),
10552
+ $this->_site->secret_key
10553
+ );
10554
+ }
10555
+
10556
+ return $this->_site_api;
10557
+ }
10558
+
10559
+ private $_plugin_api;
10560
+
10561
+ /**
10562
+ * Get plugin public API scope.
10563
+ *
10564
+ * @author Vova Feldman (@svovaf)
10565
+ * @since 1.0.7
10566
+ *
10567
+ * @return FS_Api
10568
+ */
10569
+ function get_api_plugin_scope() {
10570
+ if ( ! isset( $this->_plugin_api ) ) {
10571
+ $this->_plugin_api = FS_Api::instance(
10572
+ $this->_slug,
10573
+ 'plugin',
10574
+ $this->_plugin->id,
10575
+ $this->_plugin->public_key,
10576
+ ! $this->is_live()
10577
+ );
10578
+ }
10579
+
10580
+ return $this->_plugin_api;
10581
+ }
10582
+
10583
+ /**
10584
+ * Get site API scope object (fallback to public plugin scope when not registered).
10585
+ *
10586
+ * @author Vova Feldman (@svovaf)
10587
+ * @since 1.0.7
10588
+ *
10589
+ * @return FS_Api
10590
+ */
10591
+ function get_api_site_or_plugin_scope() {
10592
+ return $this->is_registered() ?
10593
+ $this->get_api_site_scope() :
10594
+ $this->get_api_plugin_scope();
10595
+ }
10596
+
10597
+ /**
10598
+ * Show trial promotional notice (if any trial exist).
10599
+ *
10600
+ * @author Vova Feldman (@svovaf)
10601
+ * @since 1.0.9
10602
+ *
10603
+ * @param $plans
10604
+ */
10605
+ function _check_for_trial_plans( $plans ) {
10606
+ $this->_storage->has_trial_plan = FS_Plan_Manager::instance()->has_trial_plan( $plans );
10607
+ }
10608
+
10609
+ /**
10610
+ * During trial promotion the "upgrade" submenu item turns to
10611
+ * "start trial" to encourage the trial. Since we want to keep
10612
+ * the same menu item handler and there's no robust way to
10613
+ * add new arguments to the menu item link's querystring,
10614
+ * use JavaScript to find the menu item and update the href of
10615
+ * the link.
10616
+ *
10617
+ * @author Vova Feldman (@svovaf)
10618
+ * @since 1.2.1.5
10619
+ */
10620
+ function _fix_start_trial_menu_item_url() {
10621
+ $template_args = array( 'slug' => $this->_slug );
10622
+ fs_require_template( 'add-trial-to-pricing.php', $template_args );
10623
+ }
10624
+
10625
+ /**
10626
+ * Show trial promotional notice (if any trial exist).
10627
+ *
10628
+ * @author Vova Feldman (@svovaf)
10629
+ * @since 1.0.9
10630
+ *
10631
+ * @return bool If trial notice added.
10632
+ */
10633
+ function _add_trial_notice() {
10634
+ if ( ! current_user_can( 'activate_plugins' ) ) {
10635
+ return false;
10636
+ }
10637
+
10638
+ if ( ! $this->is_user_in_admin() ) {
10639
+ return false;
10640
+ }
10641
+
10642
+ // Check if trial message is already shown.
10643
+ if ( $this->_admin_notices->has_sticky( 'trial_promotion' ) ) {
10644
+ add_action( 'admin_footer', array( &$this, '_fix_start_trial_menu_item_url' ) );
10645
+
10646
+ $this->_menu->add_counter_to_menu_item( 1, 'fs-trial' );
10647
+
10648
+ return false;
10649
+ }
10650
+
10651
+ if ( $this->is_premium() && ! WP_FS__DEV_MODE ) {
10652
+ // Don't show trial if running the premium code, unless running in DEV mode.
10653
+ return false;
10654
+ }
10655
+
10656
+ if ( ! $this->has_trial_plan() ) {
10657
+ // No plans with trial.
10658
+ return false;
10659
+ }
10660
+
10661
+ if ( ! $this->apply_filters( 'show_trial', true ) ) {
10662
+ // Developer explicitly asked not to show the trial promo.
10663
+ return false;
10664
+ }
10665
+
10666
+ if ( $this->is_registered() ) {
10667
+ // Check if trial already utilized.
10668
+ if ( $this->_site->is_trial_utilized() ) {
10669
+ return false;
10670
+ }
10671
+
10672
+ if ( $this->is_paying_or_trial() ) {
10673
+ // Don't show trial if paying or already in trial.
10674
+ return false;
10675
+ }
10676
+ }
10677
+
10678
+ if ( $this->is_activation_mode() || $this->is_pending_activation() ) {
10679
+ // If not yet opted-in/skipped, or pending activation, don't show trial.
10680
+ return false;
10681
+ }
10682
+
10683
+ $last_time_trial_promotion_shown = $this->_storage->get( 'trial_promotion_shown', false );
10684
+ $was_promotion_shown_before = ( false !== $last_time_trial_promotion_shown );
10685
+
10686
+ // Show promotion if never shown before and 24 hours after initial activation with FS.
10687
+ if ( ! $was_promotion_shown_before &&
10688
+ $this->_storage->install_timestamp > ( time() - WP_FS__TIME_24_HOURS_IN_SEC )
10689
+ ) {
10690
+ return false;
10691
+ }
10692
+
10693
+ // OR if promotion was shown before, try showing it every 30 days.
10694
+ if ( $was_promotion_shown_before &&
10695
+ 30 * WP_FS__TIME_24_HOURS_IN_SEC > time() - $last_time_trial_promotion_shown
10696
+ ) {
10697
+ return false;
10698
+ }
10699
+
10700
+ $trial_period = $this->_trial_days;
10701
+ $require_payment = $this->_is_trial_require_payment;
10702
+ $trial_url = $this->get_trial_url();
10703
+ $plans_string = strtolower( __fs( 'awesome', $this->_slug ) );
10704
+
10705
+ if ( $this->is_registered() ) {
10706
+ // If opted-in, override trial with up to date data from API.
10707
+ $trial_plans = FS_Plan_Manager::instance()->get_trial_plans( $this->_plans );
10708
+ $trial_plans_count = count( $trial_plans );
10709
+
10710
+ if ( 0 === $trial_plans_count ) {
10711
+ // If there's no plans with a trial just exit.
10712
+ return false;
10713
+ }
10714
+
10715
+ /**
10716
+ * @var FS_Plugin_Plan $paid_plan
10717
+ */
10718
+ $paid_plan = $trial_plans[0];
10719
+ $require_payment = $paid_plan->is_require_subscription;
10720
+ $trial_period = $paid_plan->trial_period;
10721
+
10722
+ $total_paid_plans = count( $this->_plans ) - ( FS_Plan_Manager::instance()->has_free_plan( $this->_plans ) ? 1 : 0 );
10723
+
10724
+ if ( $total_paid_plans !== $trial_plans_count ) {
10725
+ // Not all paid plans have a trial - generate a string of those that have it.
10726
+ for ( $i = 0; $i < $trial_plans_count; $i ++ ) {
10727
+ $plans_string .= sprintf(
10728
+ '<a href="%s">%s</a>',
10729
+ $trial_url,
10730
+ $trial_plans[ $i ]->title
10731
+ );
10732
+
10733
+ if ( $i < $trial_plans_count - 2 ) {
10734
+ $plans_string .= ', ';
10735
+ } else if ( $i == $trial_plans_count - 2 ) {
10736
+ $plans_string .= ' and ';
10737
+ }
10738
+ }
10739
+ }
10740
+ }
10741
+
10742
+ $message = sprintf(
10743
+ __fs( 'hey', $this->_slug ) . '! ' . __fs( 'trial-x-promotion-message', $this->_slug ),
10744
+ sprintf( '<b>%s</b>', $this->get_plugin_name() ),
10745
+ $plans_string,
10746
+ $trial_period
10747
+ );
10748
+
10749
+ // "No Credit-Card Required" or "No Commitment for N Days".
10750
+ $cc_string = $require_payment ?
10751
+ sprintf( __fs( 'no-commitment-for-x-days', $this->_slug ), $trial_period ) :
10752
+ __fs( 'no-cc-required', $this->_slug ) . '!';
10753
+
10754
+
10755
+ // Start trial button.
10756
+ $button = ' ' . sprintf(
10757
+ '<a style="margin-left: 10px; vertical-align: super;" href="%s"><button class="button button-primary">%s &nbsp;&#10140;</button></a>',
10758
+ $trial_url,
10759
+ __fs( 'start-free-trial', $this->_slug )
10760
+ );
10761
+
10762
+ $this->_admin_notices->add_sticky(
10763
+ $this->apply_filters( 'trial_promotion_message', "{$message} {$cc_string} {$button}" ),
10764
+ 'trial_promotion',
10765
+ '',
10766
+ 'promotion'
10767
+ );
10768
+
10769
+ $this->_storage->trial_promotion_shown = WP_FS__SCRIPT_START_TIME;
10770
+
10771
+ return true;
10772
+ }
10773
+
10774
+ /**
10775
+ * @author Vova Feldman (@svovaf)
10776
+ * @since 1.2.1.5
10777
+ */
10778
+ function _enqueue_common_css() {
10779
+ if ( $this->has_paid_plan() && ! $this->is_paying() ) {
10780
+ // Add basic CSS for admin-notices and menu-item colors.
10781
+ fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
10782
+ }
10783
+ }
10784
+
10785
+ /* Action Links
10786
+ ------------------------------------------------------------------------------------------------------------------*/
10787
+ private $_action_links_hooked = false;
10788
+ private $_action_links = array();
10789
+
10790
+ /**
10791
+ * Hook to plugin action links filter.
10792
+ *
10793
+ * @author Vova Feldman (@svovaf)
10794
+ * @since 1.0.0
10795
+ */
10796
+ private function hook_plugin_action_links() {
10797
+ $this->_logger->entrance();
10798
+
10799
+ $this->_action_links_hooked = true;
10800
+
10801
+ $this->_logger->log( 'Adding action links hooks.' );
10802
+
10803
+ // Add action link to settings page.
10804
+ add_filter( 'plugin_action_links_' . $this->_plugin_basename, array(
10805
+ &$this,
10806
+ '_modify_plugin_action_links_hook'
10807
+ ), WP_FS__DEFAULT_PRIORITY, 2 );
10808
+ add_filter( 'network_admin_plugin_action_links_' . $this->_plugin_basename, array(
10809
+ &$this,
10810
+ '_modify_plugin_action_links_hook'
10811
+ ), WP_FS__DEFAULT_PRIORITY, 2 );
10812
+ }
10813
+
10814
+ /**
10815
+ * Add plugin action link.
10816
+ *
10817
+ * @author Vova Feldman (@svovaf)
10818
+ * @since 1.0.0
10819
+ *
10820
+ * @param $label
10821
+ * @param $url
10822
+ * @param bool $external
10823
+ * @param int $priority
10824
+ * @param bool $key
10825
+ */
10826
+ function add_plugin_action_link( $label, $url, $external = false, $priority = WP_FS__DEFAULT_PRIORITY, $key = false ) {
10827
+ $this->_logger->entrance();
10828
+
10829
+ if ( ! isset( $this->_action_links[ $priority ] ) ) {
10830
+ $this->_action_links[ $priority ] = array();
10831
+ }
10832
+
10833
+ if ( false === $key ) {
10834
+ $key = preg_replace( "/[^A-Za-z0-9 ]/", '', strtolower( $label ) );
10835
+ }
10836
+
10837
+ $this->_action_links[ $priority ][] = array(
10838
+ 'label' => $label,
10839
+ 'href' => $url,
10840
+ 'key' => $key,
10841
+ 'external' => $external
10842
+ );
10843
+ }
10844
+
10845
+ /**
10846
+ * Adds Upgrade and Add-Ons links to the main Plugins page link actions collection.
10847
+ *
10848
+ * @author Vova Feldman (@svovaf)
10849
+ * @since 1.0.0
10850
+ */
10851
+ function _add_upgrade_action_link() {
10852
+ $this->_logger->entrance();
10853
+
10854
+ if ( $this->is_registered() ) {
10855
+ if ( ! $this->is_paying() && $this->has_paid_plan() ) {
10856
+ $this->add_plugin_action_link(
10857
+ __fs( 'upgrade', $this->_slug ),
10858
+ $this->get_upgrade_url(),
10859
+ false,
10860
+ 7,
10861
+ 'upgrade'
10862
+ );
10863
+ }
10864
+
10865
+ if ( $this->has_addons() ) {
10866
+ $this->add_plugin_action_link(
10867
+ __fs( 'add-ons', $this->_slug ),
10868
+ $this->_get_admin_page_url( 'addons' ),
10869
+ false,
10870
+ 9,
10871
+ 'addons'
10872
+ );
10873
+ }
10874
+ }
10875
+ }
10876
+
10877
+ /**
10878
+ * Adds "Activate License" or "Change License" link to the main Plugins page link actions collection.
10879
+ *
10880
+ * @author Leo Fajardo (@leorw)
10881
+ * @since 1.1.9
10882
+ */
10883
+ function _add_license_action_link() {
10884
+ $this->_logger->entrance();
10885
+
10886
+ if ( $this->is_free_plan() && $this->is_addon() ) {
10887
+ return;
10888
+ }
10889
+
10890
+ if ( ! $this->is_ajax() ) {
10891
+ // Inject license activation dialog UI and client side code.
10892
+ add_action( 'admin_footer', array( &$this, '_add_license_activation_dialog_box' ) );
10893
+ }
10894
+
10895
+ $link_text = __fs(
10896
+ $this->is_free_plan() ? 'activate-license' : 'change-license',
10897
+ $this->_slug
10898
+ );
10899
+
10900
+ $this->add_plugin_action_link(
10901
+ $link_text,
10902
+ '#',
10903
+ false,
10904
+ 11,
10905
+ ( 'activate-license ' . $this->_slug )
10906
+ );
10907
+ }
10908
+
10909
+ /**
10910
+ * Adds "Opt in" or "Opt out" link to the main "Plugins" page link actions collection.
10911
+ *
10912
+ * @author Leo Fajardo (@leorw)
10913
+ * @since 1.2.1.5
10914
+ */
10915
+ function _add_tracking_links() {
10916
+ if ( ! current_user_can( 'activate_plugins' ) ) {
10917
+ return;
10918
+ }
10919
+
10920
+ $this->_logger->entrance();
10921
+
10922
+ if ( ! $this->is_enable_anonymous() ) {
10923
+ // Don't allow to opt-out if anonymous mode is disabled.
10924
+ return;
10925
+ }
10926
+
10927
+ if ( ! $this->is_free_plan() ) {
10928
+ // Don't allow to opt-out if running in paid plan.
10929
+ return;
10930
+ }
10931
+
10932
+ if ( $this->add_ajax_action( 'stop_tracking', array( &$this, '_stop_tracking_callback' ) ) ) {
10933
+ return;
10934
+ }
10935
+
10936
+ if ( $this->add_ajax_action( 'allow_tracking', array( &$this, '_allow_tracking_callback' ) ) ) {
10937
+ return;
10938
+ }
10939
+
10940
+ if ( fs_request_is_action_secure( $this->_slug . '_reconnect' ) ) {
10941
+ if ( ! $this->is_registered() && $this->is_anonymous() ) {
10942
+ $this->connect_again();
10943
+
10944
+ return;
10945
+ }
10946
+ }
10947
+
10948
+ $url = '#';
10949
+
10950
+ if ( $this->is_registered() ) {
10951
+ if ( $this->is_tracking_allowed() ) {
10952
+ $link_text_id = 'opt-out';
10953
+ } else {
10954
+ $link_text_id = 'opt-in';
10955
+ }
10956
+
10957
+ add_action( 'admin_footer', array( &$this, '_add_optout_dialog' ) );
10958
+ } else {
10959
+ $link_text_id = 'opt-in';
10960
+
10961
+ $params = ! $this->is_anonymous() ?
10962
+ array() :
10963
+ array(
10964
+ 'nonce' => wp_create_nonce( $this->_slug . '_reconnect' ),
10965
+ 'fs_action' => ( $this->_slug . '_reconnect' ),
10966
+ );
10967
+
10968
+ $url = $this->get_activation_url( $params );
10969
+ }
10970
+
10971
+ $this->add_plugin_action_link(
10972
+ __fs( $link_text_id, $this->_slug ),
10973
+ $url,
10974
+ false,
10975
+ 13,
10976
+ "opt-in-or-opt-out {$this->_slug}"
10977
+ );
10978
+ }
10979
+
10980
+ /**
10981
+ * Get the URL of the page that should be loaded right after the plugin activation.
10982
+ *
10983
+ * @author Vova Feldman (@svovaf)
10984
+ * @since 1.1.7.4
10985
+ *
10986
+ * @return string
10987
+ */
10988
+ function get_after_plugin_activation_redirect_url() {
10989
+ $url = false;
10990
+ $plugin_fs = false;
10991
+
10992
+ if ( ! $this->is_addon() ) {
10993
+ $first_time_path = $this->_menu->get_first_time_path();
10994
+ $plugin_fs = $this;
10995
+ $url = $plugin_fs->is_activation_mode() ?
10996
+ $plugin_fs->get_activation_url() :
10997
+ ( empty( $first_time_path ) ?
10998
+ $this->_get_admin_page_url() :
10999
+ $first_time_path );
11000
+ } else {
11001
+ if ( $this->is_parent_plugin_installed() ) {
11002
+ $plugin_fs = self::get_parent_instance();
11003
+ }
11004
+
11005
+ if ( is_object( $plugin_fs ) ) {
11006
+ if ( ! $plugin_fs->is_registered() ) {
11007
+ // Forward to parent plugin connect when parent not registered.
11008
+ $url = $plugin_fs->get_activation_url();
11009
+ } else {
11010
+ // Forward to account page.
11011
+ $url = $plugin_fs->_get_admin_page_url( 'account' );
11012
+ }
11013
+ }
11014
+ }
11015
+
11016
+ return $url;
11017
+ }
11018
+
11019
+ /**
11020
+ * Forward page to activation page.
11021
+ *
11022
+ * @author Vova Feldman (@svovaf)
11023
+ * @since 1.0.3
11024
+ */
11025
+ function _redirect_on_activation_hook() {
11026
+ $url = $this->get_after_plugin_activation_redirect_url();
11027
+
11028
+ if ( is_string( $url ) ) {
11029
+ fs_redirect( $url );
11030
+ }
11031
+ }
11032
+
11033
+ /**
11034
+ * Modify plugin's page action links collection.
11035
+ *
11036
+ * @author Vova Feldman (@svovaf)
11037
+ * @since 1.0.0
11038
+ *
11039
+ * @param array $links
11040
+ * @param $file
11041
+ *
11042
+ * @return array
11043
+ */
11044
+ function _modify_plugin_action_links_hook( $links, $file ) {
11045
+ $this->_logger->entrance();
11046
+
11047
+ $passed_deactivate = false;
11048
+ $deactivate_link = '';
11049
+ $before_deactivate = array();
11050
+ $after_deactivate = array();
11051
+ foreach ( $links as $key => $link ) {
11052
+ if ( 'deactivate' === $key ) {
11053
+ $deactivate_link = $link;
11054
+ $passed_deactivate = true;
11055
+ continue;
11056
+ }
11057
+
11058
+ if ( ! $passed_deactivate ) {
11059
+ $before_deactivate[ $key ] = $link;
11060
+ } else {
11061
+ $after_deactivate[ $key ] = $link;
11062
+ }
11063
+ }
11064
+
11065
+ ksort( $this->_action_links );
11066
+
11067
+ foreach ( $this->_action_links as $new_links ) {
11068
+ foreach ( $new_links as $link ) {
11069
+ $before_deactivate[ $link['key'] ] = '<a href="' . $link['href'] . '"' . ( $link['external'] ? ' target="_blank"' : '' ) . '>' . $link['label'] . '</a>';
11070
+ }
11071
+ }
11072
+
11073
+ if ( ! empty( $deactivate_link ) ) {
11074
+ if ( ! $this->is_paying_or_trial() || $this->is_premium() ) {
11075
+ /*
11076
+ * This HTML element is used to identify the correct plugin when attaching an event to its Deactivate link.
11077
+ *
11078
+ * If user is paying or in trial and have the free version installed,
11079
+ * assume that the deactivation is for the upgrade process, so this is not needed.
11080
+ */
11081
+ $deactivate_link .= '<i class="fs-slug" data-slug="' . $this->_slug . '"></i>';
11082
+ }
11083
+
11084
+ // Append deactivation link.
11085
+ $before_deactivate['deactivate'] = $deactivate_link;
11086
+ }
11087
+
11088
+ return array_merge( $before_deactivate, $after_deactivate );
11089
+ }
11090
+
11091
+ /**
11092
+ * Adds admin message.
11093
+ *
11094
+ * @author Vova Feldman (@svovaf)
11095
+ * @since 1.0.4
11096
+ *
11097
+ * @param string $message
11098
+ * @param string $title
11099
+ * @param string $type
11100
+ */
11101
+ function add_admin_message( $message, $title = '', $type = 'success' ) {
11102
+ $this->_admin_notices->add( $message, $title, $type );
11103
+ }
11104
+
11105
+ /**
11106
+ * Adds sticky admin message.
11107
+ *
11108
+ * @author Vova Feldman (@svovaf)
11109
+ * @since 1.1.0
11110
+ *
11111
+ * @param string $message
11112
+ * @param string $id
11113
+ * @param string $title
11114
+ * @param string $type
11115
+ */
11116
+ function add_sticky_admin_message( $message, $id, $title = '', $type = 'success' ) {
11117
+ $this->_admin_notices->add_sticky( $message, $id, $title, $type );
11118
+ }
11119
+
11120
+ /**
11121
+ * Helper function that returns the final steps for the upgrade completion.
11122
+ *
11123
+ * If the module is already running the premium code, returns an empty string.
11124
+ *
11125
+ * @author Vova Feldman (@svovaf)
11126
+ * @since 1.2.1
11127
+ *
11128
+ * @param string $plan_title
11129
+ *
11130
+ * @return string
11131
+ */
11132
+ private function get_complete_upgrade_instructions( $plan_title = '' ) {
11133
+ if ( $this->is_premium() ) {
11134
+ return '';
11135
+ }
11136
+
11137
+ if ( empty( $plan_title ) ) {
11138
+ $plan_title = $this->_site->plan->title;
11139
+ }
11140
+
11141
+ // @since 1.2.1.5 The free version is auto deactivated.
11142
+ $deactivation_step = version_compare( $this->version, '1.2.1.5', '<' ) ?
11143
+ ( '<li>' . __fs( 'deactivate-free-version', $this->_slug ) . '.</li>' ) :
11144
+ '';
11145
+
11146
+ return sprintf(
11147
+ ' %s: <ol><li>%s.</li>%s<li>%s (<a href="%s" target="_blank">%s</a>).</li></ol>',
11148
+ __fs( 'follow-steps-to-complete-upgrade', $this->_slug ),
11149
+ $this->_get_latest_download_link( sprintf(
11150
+ __fs( 'download-latest-x-version', $this->_slug ),
11151
+ $plan_title
11152
+ ) ),
11153
+ $deactivation_step,
11154
+ __fs( 'upload-and-activate', $this->_slug ),
11155
+ '//bit.ly/upload-wp-plugin',
11156
+ __fs( 'howto-upload-activate', $this->_slug )
11157
+ );
11158
+ }
11159
+
11160
+ /* Plugin Auto-Updates (@since 1.0.4)
11161
+ ------------------------------------------------------------------------------------------------------------------*/
11162
+ /**
11163
+ * @var string[]
11164
+ */
11165
+ private static $_auto_updated_plugins;
11166
+
11167
+ /**
11168
+ * @todo TEST IF IT WORKS!!!
11169
+ *
11170
+ * Include plugins for automatic updates based on stored settings.
11171
+ *
11172
+ * @see http://wordpress.stackexchange.com/questions/131394/how-do-i-exclude-plugins-from-getting-automatically-updated/131404#131404
11173
+ *
11174
+ * @author Vova Feldman (@svovaf)
11175
+ * @since 1.0.4
11176
+ *
11177
+ * @param bool $update Whether to update (not used for plugins)
11178
+ * @param object $item The plugin's info
11179
+ *
11180
+ * @return bool
11181
+ */
11182
+ static function _include_plugins_in_auto_update( $update, $item ) {
11183
+ // Before version 3.8.2 the $item was the file name of the plugin,
11184
+ // while in 3.8.2 statistics were added (https://core.trac.wordpress.org/changeset/27905).
11185
+ $by_slug = ( (int) str_replace( '.', '', get_bloginfo( 'version' ) ) >= 382 );
11186
+
11187
+ if ( ! isset( self::$_auto_updated_plugins ) ) {
11188
+ $plugins = self::$_accounts->get_option( 'plugins', array() );
11189
+
11190
+ $identifiers = array();
11191
+ foreach ( $plugins as $p ) {
11192
+ /**
11193
+ * @var FS_Plugin $p
11194
+ */
11195
+ if ( isset( $p->auto_update ) && $p->auto_update ) {
11196
+ $identifiers[] = ( $by_slug ? $p->slug : plugin_basename( $p->file ) );
11197
+ }
11198
+ }
11199
+
11200
+ self::$_auto_updated_plugins = $identifiers;
11201
+ }
11202
+
11203
+ if ( in_array( $by_slug ? $item->slug : $item, self::$_auto_updated_plugins ) ) {
11204
+ return true;
11205
+ }
11206
+
11207
+ // Pass update decision to next filters
11208
+ return $update;
11209
+ }
11210
+
11211
+ #----------------------------------------------------------------------------------
11212
+ #region Versioning
11213
+ #----------------------------------------------------------------------------------
11214
+
11215
+ /**
11216
+ * Check if Freemius in SDK upgrade mode.
11217
+ *
11218
+ * @author Vova Feldman (@svovaf)
11219
+ * @since 1.0.9
11220
+ *
11221
+ * @return bool
11222
+ */
11223
+ function is_sdk_upgrade_mode() {
11224
+ return isset( $this->_storage->sdk_upgrade_mode ) ?
11225
+ $this->_storage->sdk_upgrade_mode :
11226
+ false;
11227
+ }
11228
+
11229
+ /**
11230
+ * Turn SDK upgrade mode off.
11231
+ *
11232
+ * @author Vova Feldman (@svovaf)
11233
+ * @since 1.0.9
11234
+ */
11235
+ function set_sdk_upgrade_complete() {
11236
+ $this->_storage->sdk_upgrade_mode = false;
11237
+ }
11238
+
11239
+ /**
11240
+ * Check if plugin upgrade mode.
11241
+ *
11242
+ * @author Vova Feldman (@svovaf)
11243
+ * @since 1.0.9
11244
+ *
11245
+ * @return bool
11246
+ */
11247
+ function is_plugin_upgrade_mode() {
11248
+ return isset( $this->_storage->plugin_upgrade_mode ) ?
11249
+ $this->_storage->plugin_upgrade_mode :
11250
+ false;
11251
+ }
11252
+
11253
+ /**
11254
+ * Turn plugin upgrade mode off.
11255
+ *
11256
+ * @author Vova Feldman (@svovaf)
11257
+ * @since 1.0.9
11258
+ *
11259
+ * @return bool
11260
+ */
11261
+ function set_plugin_upgrade_complete() {
11262
+ $this->_storage->plugin_upgrade_mode = false;
11263
+ }
11264
+
11265
+ #endregion
11266
+
11267
+ #----------------------------------------------------------------------------------
11268
+ #region Permissions
11269
+ #----------------------------------------------------------------------------------
11270
+
11271
+ /**
11272
+ * Check if specific permission requested.
11273
+ *
11274
+ * @author Vova Feldman (@svovaf)
11275
+ * @since 1.1.6
11276
+ *
11277
+ * @param string $permission
11278
+ *
11279
+ * @return bool
11280
+ */
11281
+ function is_permission_requested( $permission ) {
11282
+ return isset( $this->_permissions[ $permission ] ) && ( true === $this->_permissions[ $permission ] );
11283
+ }
11284
+
11285
+ #endregion
11286
+
11287
+ #----------------------------------------------------------------------------------
11288
+ #region Marketing
11289
+ #----------------------------------------------------------------------------------
11290
+
11291
+ /**
11292
+ * Check if current user purchased any other plugins before.
11293
+ *
11294
+ * @author Vova Feldman (@svovaf)
11295
+ * @since 1.0.9
11296
+ *
11297
+ * @return bool
11298
+ */
11299
+ function has_purchased_before() {
11300
+ // TODO: Implement has_purchased_before() method.
11301
+ throw new Exception( 'not implemented' );
11302
+ }
11303
+
11304
+ /**
11305
+ * Check if current user classified as an agency.
11306
+ *
11307
+ * @author Vova Feldman (@svovaf)
11308
+ * @since 1.0.9
11309
+ *
11310
+ * @return bool
11311
+ */
11312
+ function is_agency() {
11313
+ // TODO: Implement is_agency() method.
11314
+ throw new Exception( 'not implemented' );
11315
+ }
11316
+
11317
+ /**
11318
+ * Check if current user classified as a developer.
11319
+ *
11320
+ * @author Vova Feldman (@svovaf)
11321
+ * @since 1.0.9
11322
+ *
11323
+ * @return bool
11324
+ */
11325
+ function is_developer() {
11326
+ // TODO: Implement is_developer() method.
11327
+ throw new Exception( 'not implemented' );
11328
+ }
11329
+
11330
+ /**
11331
+ * Check if current user classified as a business.
11332
+ *
11333
+ * @author Vova Feldman (@svovaf)
11334
+ * @since 1.0.9
11335
+ *
11336
+ * @return bool
11337
+ */
11338
+ function is_business() {
11339
+ // TODO: Implement is_business() method.
11340
+ throw new Exception( 'not implemented' );
11341
+ }
11342
+
11343
+ #endregion
11344
+ }
freemius/includes/class-fs-api.php ADDED
@@ -0,0 +1,558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Api
15
+ *
16
+ * Wraps Freemius API SDK to handle:
17
+ * 1. Clock sync.
18
+ * 2. Fallback to HTTP when HTTPS fails.
19
+ * 3. Adds caching layer to GET requests.
20
+ * 4. Adds consistency for failed requests by using last cached version.
21
+ */
22
+ class FS_Api {
23
+ /**
24
+ * @var FS_Api[]
25
+ */
26
+ private static $_instances = array();
27
+
28
+ /**
29
+ * @var FS_Option_Manager Freemius options, options-manager.
30
+ */
31
+ private static $_options;
32
+
33
+ /**
34
+ * @var FS_Cache_Manager API Caching layer
35
+ */
36
+ private static $_cache;
37
+
38
+ /**
39
+ * @var int Clock diff in seconds between current server to API server.
40
+ */
41
+ private static $_clock_diff;
42
+
43
+ /**
44
+ * @var Freemius_Api
45
+ */
46
+ private $_api;
47
+
48
+ /**
49
+ * @var string
50
+ */
51
+ private $_slug;
52
+
53
+ /**
54
+ * @var FS_Logger
55
+ * @since 1.0.4
56
+ */
57
+ private $_logger;
58
+
59
+ /**
60
+ * @param string $slug
61
+ * @param string $scope 'app', 'developer', 'user' or 'install'.
62
+ * @param number $id Element's id.
63
+ * @param string $public_key Public key.
64
+ * @param bool $is_sandbox
65
+ * @param bool|string $secret_key Element's secret key.
66
+ *
67
+ * @return FS_Api
68
+ */
69
+ static function instance( $slug, $scope, $id, $public_key, $is_sandbox, $secret_key = false ) {
70
+ $identifier = md5( $slug . $scope . $id . $public_key . ( is_string( $secret_key ) ? $secret_key : '' ) . json_encode( $is_sandbox ) );
71
+
72
+ if ( ! isset( self::$_instances[ $identifier ] ) ) {
73
+ self::_init();
74
+
75
+ self::$_instances[ $identifier ] = new FS_Api( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox );
76
+ }
77
+
78
+ return self::$_instances[ $identifier ];
79
+ }
80
+
81
+ private static function _init() {
82
+ if ( isset( self::$_options ) ) {
83
+ return;
84
+ }
85
+
86
+ if ( ! class_exists( 'Freemius_Api' ) ) {
87
+ require_once( WP_FS__DIR_SDK . '/Freemius.php' );
88
+ }
89
+
90
+ self::$_options = FS_Option_Manager::get_manager( WP_FS__OPTIONS_OPTION_NAME, true );
91
+ self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
92
+
93
+ self::$_clock_diff = self::$_options->get_option( 'api_clock_diff', 0 );
94
+ Freemius_Api::SetClockDiff( self::$_clock_diff );
95
+
96
+ if ( self::$_options->get_option( 'api_force_http', false ) ) {
97
+ Freemius_Api::SetHttp();
98
+ }
99
+ }
100
+
101
+ /**
102
+ * @param string $slug
103
+ * @param string $scope 'app', 'developer', 'user' or 'install'.
104
+ * @param number $id Element's id.
105
+ * @param string $public_key Public key.
106
+ * @param bool|string $secret_key Element's secret key.
107
+ * @param bool $is_sandbox
108
+ */
109
+ private function __construct( $slug, $scope, $id, $public_key, $secret_key, $is_sandbox ) {
110
+ $this->_api = new Freemius_Api( $scope, $id, $public_key, $secret_key, $is_sandbox );
111
+
112
+ $this->_slug = $slug;
113
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_api', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
114
+ }
115
+
116
+ /**
117
+ * Find clock diff between server and API server, and store the diff locally.
118
+ *
119
+ * @param bool|int $diff
120
+ *
121
+ * @return bool|int False if clock diff didn't change, otherwise returns the clock diff in seconds.
122
+ */
123
+ private function _sync_clock_diff( $diff = false ) {
124
+ $this->_logger->entrance();
125
+
126
+ // Sync clock and store.
127
+ $new_clock_diff = ( false === $diff ) ?
128
+ Freemius_Api::FindClockDiff() :
129
+ $diff;
130
+
131
+ if ( $new_clock_diff === self::$_clock_diff ) {
132
+ return false;
133
+ }
134
+
135
+ self::$_clock_diff = $new_clock_diff;
136
+
137
+ // Update API clock's diff.
138
+ Freemius_Api::SetClockDiff( self::$_clock_diff );
139
+
140
+ // Store new clock diff in storage.
141
+ self::$_options->set_option( 'api_clock_diff', self::$_clock_diff, true );
142
+
143
+ return $new_clock_diff;
144
+ }
145
+
146
+ /**
147
+ * Override API call to enable retry with servers' clock auto sync method.
148
+ *
149
+ * @param string $path
150
+ * @param string $method
151
+ * @param array $params
152
+ * @param bool $retry Is in retry or first call attempt.
153
+ *
154
+ * @return array|mixed|string|void
155
+ */
156
+ private function _call( $path, $method = 'GET', $params = array(), $retry = false ) {
157
+ $this->_logger->entrance( $method . ':' . $path );
158
+
159
+ if ( self::is_temporary_down() ) {
160
+ $result = $this->get_temporary_unavailable_error();
161
+ } else {
162
+ $result = $this->_api->Api( $path, $method, $params );
163
+
164
+ if ( null !== $result &&
165
+ isset( $result->error ) &&
166
+ isset( $result->error->code ) &&
167
+ 'request_expired' === $result->error->code
168
+ ) {
169
+ if ( ! $retry ) {
170
+ $diff = isset( $result->error->timestamp ) ?
171
+ ( time() - strtotime( $result->error->timestamp ) ) :
172
+ false;
173
+
174
+ // Try to sync clock diff.
175
+ if ( false !== $this->_sync_clock_diff( $diff ) ) {
176
+ // Retry call with new synced clock.
177
+ return $this->_call( $path, $method, $params, true );
178
+ }
179
+ }
180
+ }
181
+ }
182
+
183
+ if ( $this->_logger->is_on() && self::is_api_error( $result ) ) {
184
+ // Log API errors.
185
+ $this->_logger->api_error( $result );
186
+ }
187
+
188
+ return $result;
189
+ }
190
+
191
+ /**
192
+ * Override API call to wrap it in servers' clock sync method.
193
+ *
194
+ * @param string $path
195
+ * @param string $method
196
+ * @param array $params
197
+ *
198
+ * @return array|mixed|string|void
199
+ * @throws Freemius_Exception
200
+ */
201
+ function call( $path, $method = 'GET', $params = array() ) {
202
+ return $this->_call( $path, $method, $params );
203
+ }
204
+
205
+ /**
206
+ * Get API request URL signed via query string.
207
+ *
208
+ * @param string $path
209
+ *
210
+ * @return string
211
+ */
212
+ function get_signed_url( $path ) {
213
+ return $this->_api->GetSignedUrl( $path );
214
+ }
215
+
216
+ /**
217
+ * @param string $path
218
+ * @param bool $flush
219
+ * @param int $expiration (optional) Time until expiration in seconds from now, defaults to 24 hours
220
+ *
221
+ * @return stdClass|mixed
222
+ */
223
+ function get( $path = '/', $flush = false, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
224
+ $this->_logger->entrance( $path );
225
+
226
+ $cache_key = $this->get_cache_key( $path );
227
+
228
+ // Always flush during development.
229
+ if ( WP_FS__DEV_MODE || $this->_api->IsSandbox() ) {
230
+ $flush = true;
231
+ }
232
+
233
+ $cached_result = self::$_cache->get( $cache_key );
234
+
235
+ if ( $flush || ! self::$_cache->has_valid( $cache_key ) ) {
236
+ $result = $this->call( $path );
237
+
238
+ if ( ! is_object( $result ) || isset( $result->error ) ) {
239
+ // Api returned an error.
240
+ if ( is_object( $cached_result ) &&
241
+ ! isset( $cached_result )
242
+ ) {
243
+ // If there was an error during a newer data fetch,
244
+ // fallback to older data version.
245
+ $result = $cached_result;
246
+
247
+ if ( $this->_logger->is_on() ) {
248
+ $this->_logger->warn( 'Fallback to cached API result: ' . var_export( $cached_result, true ) );
249
+ }
250
+ } else {
251
+ // If no older data version, return result without
252
+ // caching the error.
253
+ return $result;
254
+ }
255
+ }
256
+
257
+ self::$_cache->set( $cache_key, $result, $expiration );
258
+
259
+ $cached_result = $result;
260
+ } else {
261
+ $this->_logger->log( 'Using cached API result.' );
262
+ }
263
+
264
+ return $cached_result;
265
+ }
266
+
267
+ /**
268
+ * Check if there's a cached version of the API request.
269
+ *
270
+ * @author Vova Feldman (@svovaf)
271
+ * @since 1.2.1
272
+ *
273
+ * @param string $path
274
+ * @param string $method
275
+ * @param array $params
276
+ *
277
+ * @return bool
278
+ */
279
+ function is_cached( $path, $method = 'GET', $params = array() ) {
280
+ $cache_key = $this->get_cache_key( $path, $method, $params );
281
+
282
+ return self::$_cache->has_valid( $cache_key );
283
+ }
284
+
285
+ /**
286
+ * Invalidate a cached version of the API request.
287
+ *
288
+ * @author Vova Feldman (@svovaf)
289
+ * @since 1.2.1.5
290
+ *
291
+ * @param string $path
292
+ * @param string $method
293
+ * @param array $params
294
+ */
295
+ function purge_cache( $path, $method = 'GET', $params = array() ) {
296
+ $this->_logger->entrance( "{$method}:{$path}" );
297
+
298
+ $cache_key = $this->get_cache_key( $path, $method, $params );
299
+
300
+ self::$_cache->purge( $cache_key );
301
+ }
302
+
303
+ /**
304
+ * @param string $path
305
+ * @param string $method
306
+ * @param array $params
307
+ *
308
+ * @return string
309
+ * @throws \Freemius_Exception
310
+ */
311
+ private function get_cache_key( $path, $method = 'GET', $params = array() ) {
312
+ $canonized = $this->_api->CanonizePath( $path );
313
+ // $exploded = explode('/', $canonized);
314
+ // return $method . '_' . array_pop($exploded) . '_' . md5($canonized . json_encode($params));
315
+ return strtolower( $method . ':' . $canonized ) . ( ! empty( $params ) ? '#' . md5( json_encode( $params ) ) : '' );
316
+ }
317
+
318
+ /**
319
+ * Test API connectivity.
320
+ *
321
+ * @author Vova Feldman (@svovaf)
322
+ * @since 1.0.9 If fails, try to fallback to HTTP.
323
+ * @since 1.1.6 Added a 5-min caching mechanism, to prevent from overloading the server if the API if
324
+ * temporary down.
325
+ *
326
+ * @return bool True if successful connectivity to the API.
327
+ */
328
+ static function test() {
329
+ self::_init();
330
+
331
+ $cache_key = 'ping_test';
332
+
333
+ $test = self::$_cache->get_valid( $cache_key, null );
334
+
335
+ if ( is_null( $test ) ) {
336
+ $test = Freemius_Api::Test();
337
+
338
+ if ( false === $test && Freemius_Api::IsHttps() ) {
339
+ // Fallback to HTTP, since HTTPS fails.
340
+ Freemius_Api::SetHttp();
341
+
342
+ self::$_options->set_option( 'api_force_http', true, true );
343
+
344
+ $test = Freemius_Api::Test();
345
+
346
+ if ( false === $test ) {
347
+ /**
348
+ * API connectivity test fail also in HTTP request, therefore,
349
+ * fallback to HTTPS to keep connection secure.
350
+ *
351
+ * @since 1.1.6
352
+ */
353
+ self::$_options->set_option( 'api_force_http', false, true );
354
+ }
355
+ }
356
+
357
+ self::$_cache->set( $cache_key, $test, WP_FS__TIME_5_MIN_IN_SEC );
358
+ }
359
+
360
+ return $test;
361
+ }
362
+
363
+ /**
364
+ * Check if API is temporary down.
365
+ *
366
+ * @author Vova Feldman (@svovaf)
367
+ * @since 1.1.6
368
+ *
369
+ * @return bool
370
+ */
371
+ static function is_temporary_down() {
372
+ self::_init();
373
+
374
+ $test = self::$_cache->get_valid( 'ping_test', null );
375
+
376
+ return ( false === $test );
377
+ }
378
+
379
+ /**
380
+ * @author Vova Feldman (@svovaf)
381
+ * @since 1.1.6
382
+ *
383
+ * @return object
384
+ */
385
+ private function get_temporary_unavailable_error() {
386
+ return (object) array(
387
+ 'error' => (object) array(
388
+ 'type' => 'TemporaryUnavailable',
389
+ 'message' => 'API is temporary unavailable, please retry in ' . ( self::$_cache->get_record_expiration( 'ping_test' ) - WP_FS__SCRIPT_START_TIME ) . ' sec.',
390
+ 'code' => 'temporary_unavailable',
391
+ 'http' => 503
392
+ )
393
+ );
394
+ }
395
+
396
+ /**
397
+ * Ping API for connectivity test, and return result object.
398
+ *
399
+ * @author Vova Feldman (@svovaf)
400
+ * @since 1.0.9
401
+ *
402
+ * @param null|string $unique_anonymous_id
403
+ * @param array $params
404
+ *
405
+ * @return object
406
+ */
407
+ function ping( $unique_anonymous_id = null, $params = array() ) {
408
+ $this->_logger->entrance();
409
+
410
+ if ( self::is_temporary_down() ) {
411
+ return $this->get_temporary_unavailable_error();
412
+ }
413
+
414
+ $pong = is_null( $unique_anonymous_id ) ?
415
+ Freemius_Api::Ping() :
416
+ $this->_call( 'ping.json?' . http_build_query( array_merge(
417
+ array( 'uid' => $unique_anonymous_id ),
418
+ $params
419
+ ) ) );
420
+
421
+ if ( $this->is_valid_ping( $pong ) ) {
422
+ return $pong;
423
+ }
424
+
425
+ if ( self::should_try_with_http( $pong ) ) {
426
+ // Fallback to HTTP, since HTTPS fails.
427
+ Freemius_Api::SetHttp();
428
+
429
+ self::$_options->set_option( 'api_force_http', true, true );
430
+
431
+ $pong = is_null( $unique_anonymous_id ) ?
432
+ Freemius_Api::Ping() :
433
+ $this->_call( 'ping.json?' . http_build_query( array_merge(
434
+ array( 'uid' => $unique_anonymous_id ),
435
+ $params
436
+ ) ) );
437
+
438
+ if ( ! $this->is_valid_ping( $pong ) ) {
439
+ self::$_options->set_option( 'api_force_http', false, true );
440
+ }
441
+ }
442
+
443
+ return $pong;
444
+ }
445
+
446
+ /**
447
+ * Check if based on the API result we should try
448
+ * to re-run the same request with HTTP instead of HTTPS.
449
+ *
450
+ * @author Vova Feldman (@svovaf)
451
+ * @since 1.1.6
452
+ *
453
+ * @param $result
454
+ *
455
+ * @return bool
456
+ */
457
+ private static function should_try_with_http( $result ) {
458
+ if ( ! Freemius_Api::IsHttps() ) {
459
+ return false;
460
+ }
461
+
462
+ return ( ! is_object( $result ) ||
463
+ ! isset( $result->error ) ||
464
+ ! isset( $result->error->code ) ||
465
+ ! in_array( $result->error->code, array(
466
+ 'curl_missing',
467
+ 'cloudflare_ddos_protection',
468
+ 'maintenance_mode',
469
+ 'squid_cache_block',
470
+ 'too_many_requests',
471
+ ) ) );
472
+
473
+ }
474
+
475
+ /**
476
+ * Check if valid ping request result.
477
+ *
478
+ * @author Vova Feldman (@svovaf)
479
+ * @since 1.1.1
480
+ *
481
+ * @param mixed $pong
482
+ *
483
+ * @return bool
484
+ */
485
+ function is_valid_ping( $pong ) {
486
+ return Freemius_Api::Test( $pong );
487
+ }
488
+
489
+ function get_url( $path = '' ) {
490
+ return Freemius_Api::GetUrl( $path, $this->_api->IsSandbox() );
491
+ }
492
+
493
+ /**
494
+ * Clear API cache.
495
+ *
496
+ * @author Vova Feldman (@svovaf)
497
+ * @since 1.0.9
498
+ */
499
+ static function clear_cache() {
500
+ self::_init();
501
+
502
+ self::$_cache = FS_Cache_Manager::get_manager( WP_FS__API_CACHE_OPTION_NAME );
503
+ self::$_cache->clear();
504
+ }
505
+
506
+ #----------------------------------------------------------------------------------
507
+ #region Error Handling
508
+ #----------------------------------------------------------------------------------
509
+
510
+ /**
511
+ * @author Vova Feldman (@svovaf)
512
+ * @since 1.2.1.5
513
+ *
514
+ * @param mixed $result
515
+ *
516
+ * @return bool Is API result contains an error.
517
+ */
518
+ static function is_api_error( $result ) {
519
+ return ( is_object( $result ) && isset( $result->error ) ) ||
520
+ is_string( $result );
521
+ }
522
+
523
+ /**
524
+ * Checks if given API result is a non-empty and not an error object.
525
+ *
526
+ * @author Vova Feldman (@svovaf)
527
+ * @since 1.2.1.5
528
+ *
529
+ * @param mixed $result
530
+ * @param string|null $required_property Optional property we want to verify that is set.
531
+ *
532
+ * @return bool
533
+ */
534
+ static function is_api_result_object( $result, $required_property = null ) {
535
+ return (
536
+ is_object( $result ) &&
537
+ ! isset( $result->error ) &&
538
+ ( empty( $required_property ) || isset( $result->{$required_property} ) )
539
+ );
540
+ }
541
+
542
+ /**
543
+ * Checks if given API result is a non-empty entity object with non-empty ID.
544
+ *
545
+ * @author Vova Feldman (@svovaf)
546
+ * @since 1.2.1.5
547
+ *
548
+ * @param mixed $result
549
+ *
550
+ * @return bool
551
+ */
552
+ static function is_api_result_entity( $result ) {
553
+ return self::is_api_result_object( $result, 'id' ) &&
554
+ FS_Entity::is_valid_id( $result->id );
555
+ }
556
+
557
+ #endregion
558
+ }
freemius/includes/class-fs-logger.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Logger {
14
+ private $_id;
15
+ private $_on = false;
16
+ private $_echo = false;
17
+ private $_file_start = 0;
18
+
19
+ private static $LOGGERS = array();
20
+ private static $LOG = array();
21
+ private static $CNT = 0;
22
+ private static $_HOOKED_FOOTER = false;
23
+
24
+ private function __construct( $id, $on = false, $echo = false ) {
25
+ $this->_id = $id;
26
+
27
+ $bt = debug_backtrace();
28
+ $caller = $bt[2];
29
+
30
+ $this->_file_start = strpos( $caller['file'], 'plugins' ) + strlen( 'plugins/' );
31
+
32
+ if ( $on ) {
33
+ $this->on();
34
+ }
35
+ if ( $echo ) {
36
+ $this->echo_on();
37
+ }
38
+ }
39
+
40
+ /**
41
+ * @param string $id
42
+ * @param bool $on
43
+ * @param bool $echo
44
+ *
45
+ * @return FS_Logger
46
+ */
47
+ public static function get_logger( $id, $on = false, $echo = false ) {
48
+ $id = strtolower( $id );
49
+
50
+ if ( ! isset( self::$LOGGERS[ $id ] ) ) {
51
+ self::$LOGGERS[ $id ] = new FS_Logger( $id, $on, $echo );
52
+ }
53
+
54
+ return self::$LOGGERS[ $id ];
55
+ }
56
+
57
+ private static function _hook_footer() {
58
+ if ( self::$_HOOKED_FOOTER ) {
59
+ return;
60
+ }
61
+
62
+ if ( is_admin() ) {
63
+ add_action( 'admin_footer', 'FS_Logger::dump', 100 );
64
+ } else {
65
+ add_action( 'wp_footer', 'FS_Logger::dump', 100 );
66
+ }
67
+ }
68
+
69
+ function is_on() {
70
+ return $this->_on;
71
+ }
72
+
73
+ function on() {
74
+ $this->_on = true;
75
+
76
+ self::_hook_footer();
77
+ }
78
+
79
+ function echo_on() {
80
+ $this->on();
81
+
82
+ $this->_echo = true;
83
+ }
84
+
85
+ function is_echo_on() {
86
+ return $this->_echo;
87
+ }
88
+
89
+ function get_id() {
90
+ return $this->_id;
91
+ }
92
+
93
+ function get_file() {
94
+ return $this->_file_start;
95
+ }
96
+
97
+ private function _log( &$message, $type = 'log', $wrapper ) {
98
+ if ( ! $this->is_on() ) {
99
+ return;
100
+ }
101
+
102
+ $bt = debug_backtrace();
103
+ $depth = $wrapper ? 3 : 2;
104
+ while ( $depth < count( $bt ) - 1 && 'eval' === $bt[ $depth ]['function'] ) {
105
+ $depth ++;
106
+ }
107
+
108
+ $caller = $bt[ $depth ];
109
+
110
+ $log = array_merge( $caller, array(
111
+ 'cnt' => self::$CNT ++,
112
+ 'logger' => $this,
113
+ 'timestamp' => microtime(true),
114
+ 'type' => $type,
115
+ 'msg' => $message,
116
+ ) );
117
+
118
+ self::$LOG[] = $log;
119
+
120
+ if ( $this->is_echo_on() ) {
121
+ echo self::format_html( $log ) . "\n";
122
+ }
123
+ }
124
+
125
+ function log( $message, $wrapper = false ) {
126
+ $this->_log( $message, 'log', $wrapper );
127
+ }
128
+
129
+ function info( $message, $wrapper = false ) {
130
+ $this->_log( $message, 'info', $wrapper );
131
+ }
132
+
133
+ function warn( $message, $wrapper = false ) {
134
+ $this->_log( $message, 'warn', $wrapper );
135
+ }
136
+
137
+ function error( $message, $wrapper = false ) {
138
+ $this->_log( $message, 'error', $wrapper );
139
+ }
140
+
141
+ /**
142
+ * Log API error.
143
+ *
144
+ * @author Vova Feldman (@svovaf)
145
+ * @since 1.2.1.5
146
+ *
147
+ * @param mixed $api_result
148
+ * @param bool $wrapper
149
+ */
150
+ function api_error( $api_result, $wrapper = false ) {
151
+ $message = '';
152
+ if ( is_object( $api_result ) && isset( $api_result->error ) ) {
153
+ $message = $api_result->error->message;
154
+ } else if ( is_object( $api_result ) ) {
155
+ $message = var_export( $api_result, true );
156
+ } else if ( is_string( $api_result ) ) {
157
+ $message = $api_result;
158
+ } else if ( empty( $api_result ) ) {
159
+ $message = 'Empty API result.';
160
+ }
161
+
162
+ $message = 'API Error: ' . $message;
163
+
164
+ $this->_log( $message, 'error', $wrapper );
165
+ }
166
+
167
+ function entrance( $message = '', $wrapper = false ) {
168
+ $msg = 'Entrance' . ( empty( $message ) ? '' : ' > ' ) . $message;
169
+
170
+ $this->_log( $msg, 'log', $wrapper );
171
+ }
172
+
173
+ function departure( $message = '', $wrapper = false ) {
174
+ $msg = 'Departure' . ( empty( $message ) ? '' : ' > ' ) . $message;
175
+
176
+ $this->_log( $msg, 'log', $wrapper );
177
+ }
178
+
179
+ private static function format( $log, $show_type = true ) {
180
+ return '[' . str_pad( $log['cnt'], strlen( self::$CNT ), '0', STR_PAD_LEFT ) . '] [' . $log['logger']->_id . '] ' . ( $show_type ? '[' . $log['type'] . ']' : '' ) . $log['function'] . ' >> ' . $log['msg'] . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ') ' : '' ) . ' [' . $log['timestamp'] . ']';
181
+ }
182
+
183
+ private static function format_html( $log ) {
184
+ return '<div style="font-size: 13px; font-family: monospace; color: #7da767; padding: 8px 3px; background: #000; border-bottom: 1px solid #555;">[' . $log['cnt'] . '] [' . $log['logger']->_id . '] [' . $log['type'] . '] <b><code style="color: #c4b1e0;">' . $log['function'] . '</code> >> <b style="color: #f59330;">' . esc_html($log['msg']) . '</b></b>' . ( isset( $log['file'] ) ? ' (' . substr( $log['file'], $log['logger']->_file_start ) . ' ' . $log['line'] . ')' : '' ) . ' [' . $log['timestamp'] . ']</div>';
185
+ }
186
+
187
+ static function dump() {
188
+ ?>
189
+ <!-- BEGIN: Freemius PHP Console Log -->
190
+ <script type="text/javascript">
191
+ <?php
192
+ foreach (self::$LOG as $log)
193
+ {
194
+ echo 'console.' . $log['type'] . '(' . json_encode(self::format($log, false)) . ')' . "\n";
195
+ }
196
+ ?>
197
+ </script>
198
+ <!-- END: Freemius PHP Console Log -->
199
+ <?php
200
+ }
201
+
202
+ static function get_log() {
203
+ return self::$LOG;
204
+ }
205
+ }
freemius/includes/class-fs-plugin-updater.php ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ *
8
+ * @link https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php
9
+ */
10
+
11
+ if ( ! defined( 'ABSPATH' ) ) {
12
+ exit;
13
+ }
14
+
15
+ // Uncomment this line for testing.
16
+ // set_site_transient( 'update_plugins', null );
17
+
18
+ class FS_Plugin_Updater {
19
+
20
+ /**
21
+ * @var Freemius
22
+ * @since 1.0.4
23
+ */
24
+ private $_fs;
25
+ /**
26
+ * @var FS_Logger
27
+ * @since 1.0.4
28
+ */
29
+ private $_logger;
30
+ /**
31
+ * @var object
32
+ * @since 1.1.8.1
33
+ */
34
+ private $_update_details;
35
+
36
+ function __construct( Freemius $freemius ) {
37
+ $this->_fs = $freemius;
38
+
39
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $freemius->get_slug() . '_updater', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
40
+
41
+ $this->_filters();
42
+ }
43
+
44
+ /**
45
+ * Initiate required filters.
46
+ *
47
+ * @author Vova Feldman (@svovaf)
48
+ * @since 1.0.4
49
+ */
50
+ private function _filters() {
51
+ // Override request for plugin information
52
+ add_filter( 'plugins_api', array( &$this, 'plugins_api_filter' ), 10, 3 );
53
+
54
+ // WP 3.0+
55
+ add_filter( 'pre_set_site_transient_update_plugins', array(
56
+ &$this,
57
+ 'pre_set_site_transient_update_plugins_filter'
58
+ ) );
59
+
60
+ if ( ! $this->_fs->has_active_valid_license() ) {
61
+ /**
62
+ * If user has the premium plugin's code but do NOT have an active license,
63
+ * encourage him to upgrade by showing that there's a new release, but instead
64
+ * of showing an update link, show upgrade link to the pricing page.
65
+ *
66
+ * @since 1.1.6
67
+ *
68
+ */
69
+ // WP 2.9+
70
+ add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
71
+ &$this,
72
+ 'catch_plugin_update_row'
73
+ ), 9 );
74
+ add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
75
+ &$this,
76
+ 'edit_and_echo_plugin_update_row'
77
+ ), 11, 2 );
78
+ }
79
+
80
+ if ( ! WP_FS__IS_PRODUCTION_MODE ) {
81
+ add_filter( 'http_request_host_is_external', array(
82
+ $this,
83
+ 'http_request_host_is_external_filter'
84
+ ), 10, 3 );
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Capture plugin update row by turning output buffering.
90
+ *
91
+ * @author Vova Feldman (@svovaf)
92
+ * @since 1.1.6
93
+ */
94
+ function catch_plugin_update_row() {
95
+ ob_start();
96
+ }
97
+
98
+ /**
99
+ * Overrides default update message format with "renew your license" message.
100
+ *
101
+ * @author Vova Feldman (@svovaf)
102
+ * @since 1.1.6
103
+ *
104
+ * @param string $file
105
+ * @param array $plugin_data
106
+ */
107
+ function edit_and_echo_plugin_update_row( $file, $plugin_data ) {
108
+ $plugin_update_row = ob_get_clean();
109
+
110
+ $current = get_site_transient( 'update_plugins' );
111
+ if ( ! isset( $current->response[ $file ] ) ) {
112
+ echo $plugin_update_row;
113
+
114
+ return;
115
+ }
116
+
117
+ $r = $current->response[ $file ];
118
+
119
+ $plugin_update_row = preg_replace(
120
+ '/(\<div.+>)(.+)(\<a.+\<a.+)\<\/div\>/is',
121
+ '$1 $2 ' . sprintf(
122
+ __fs( 'renew-license-now' ),
123
+ '<a href="' . $this->_fs->pricing_url() . '">', '</a>',
124
+ $r->new_version ) .
125
+ '$4',
126
+ $plugin_update_row
127
+ );
128
+
129
+ echo $plugin_update_row;
130
+ }
131
+
132
+ /**
133
+ * Since WP version 3.6, a new security feature was added that denies access to repository with a local ip.
134
+ * During development mode we want to be able updating plugin versions via our localhost repository. This
135
+ * filter white-list all domains including "api.freemius".
136
+ *
137
+ * @link http://www.emanueletessore.com/wordpress-download-failed-valid-url-provided/
138
+ *
139
+ * @author Vova Feldman (@svovaf)
140
+ * @since 1.0.4
141
+ *
142
+ * @param bool $allow
143
+ * @param string $host
144
+ * @param string $url
145
+ *
146
+ * @return bool
147
+ */
148
+ function http_request_host_is_external_filter( $allow, $host, $url ) {
149
+ return ( false !== strpos( $host, 'freemius' ) ) ? true : $allow;
150
+ }
151
+
152
+ /**
153
+ * Check for Updates at the defined API endpoint and modify the update array.
154
+ *
155
+ * This function dives into the update api just when WordPress creates its update array,
156
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
157
+ * It is reassembled from parts of the native WordPress plugin update code.
158
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
159
+ *
160
+ * @author Vova Feldman (@svovaf)
161
+ * @since 1.0.4
162
+ *
163
+ * @uses FS_Api
164
+ *
165
+ * @param stdClass $transient_data Update array build by WordPress.
166
+ *
167
+ * @return array Modified update array with custom plugin data.
168
+ */
169
+ function pre_set_site_transient_update_plugins_filter( $transient_data ) {
170
+ $this->_logger->entrance();
171
+
172
+ if ( empty( $transient_data ) ||
173
+ defined( 'WP_FS__UNINSTALL_MODE' )
174
+ ) {
175
+ return $transient_data;
176
+ }
177
+
178
+ if ( ! isset( $this->_update_details ) ) {
179
+ // Get plugin's newest update.
180
+ $new_version = $this->_fs->get_update( false, false );
181
+
182
+ $this->_update_details = false;
183
+
184
+ if ( is_object( $new_version ) ) {
185
+ $this->_logger->log( 'Found newer plugin version ' . $new_version->version );
186
+
187
+ $plugin_details = new stdClass();
188
+ $plugin_details->slug = $this->_fs->get_slug();
189
+ $plugin_details->new_version = $new_version->version;
190
+ $plugin_details->url = WP_FS__ADDRESS;
191
+ $plugin_details->package = $new_version->url;
192
+ $plugin_details->plugin = $this->_fs->get_plugin_basename();
193
+
194
+ /**
195
+ * Cache plugin details locally since set_site_transient( 'update_plugins' )
196
+ * called multiple times and the non wp.org plugins are filtered after the
197
+ * call to .org.
198
+ *
199
+ * @since 1.1.8.1
200
+ */
201
+ $this->_update_details = $plugin_details;
202
+ }
203
+ }
204
+
205
+ if ( is_object( $this->_update_details ) ) {
206
+ // Add plugin to transient data.
207
+ $transient_data->response[ $this->_fs->get_plugin_basename() ] = $this->_update_details;
208
+ }
209
+
210
+ return $transient_data;
211
+ }
212
+
213
+ /**
214
+ * Try to fetch plugin's info from .org repository.
215
+ *
216
+ * @author Vova Feldman (@svovaf)
217
+ * @since 1.0.5
218
+ *
219
+ * @param string $action
220
+ * @param object $args
221
+ *
222
+ * @return bool|mixed
223
+ */
224
+ static function _fetch_plugin_info_from_repository( $action, $args ) {
225
+ $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
226
+ if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
227
+ $url = set_url_scheme( $url, 'https' );
228
+ }
229
+
230
+ $args = array(
231
+ 'timeout' => 15,
232
+ 'body' => array(
233
+ 'action' => $action,
234
+ 'request' => serialize( $args )
235
+ )
236
+ );
237
+
238
+ $request = wp_remote_post( $url, $args );
239
+
240
+ if ( is_wp_error( $request ) ) {
241
+ return false;
242
+ }
243
+
244
+ $res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
245
+
246
+ if ( ! is_object( $res ) && ! is_array( $res ) ) {
247
+ return false;
248
+ }
249
+
250
+ return $res;
251
+ }
252
+
253
+ /**
254
+ * Updates information on the "View version x.x details" page with custom data.
255
+ *
256
+ * @author Vova Feldman (@svovaf)
257
+ * @since 1.0.4
258
+ *
259
+ * @uses FS_Api
260
+ *
261
+ * @param object $data
262
+ * @param string $action
263
+ * @param mixed $args
264
+ *
265
+ * @return object
266
+ */
267
+ function plugins_api_filter( $data, $action = '', $args = null ) {
268
+ $this->_logger->entrance();
269
+
270
+ if ( ( 'plugin_information' !== $action ) ||
271
+ ! isset( $args->slug )
272
+ ) {
273
+ return $data;
274
+ }
275
+
276
+ $addon = false;
277
+ $is_addon = false;
278
+
279
+ if ( $this->_fs->get_slug() !== $args->slug ) {
280
+ $addon = $this->_fs->get_addon_by_slug( $args->slug );
281
+
282
+ if ( ! is_object( $addon ) ) {
283
+ return $data;
284
+ }
285
+
286
+ $is_addon = true;
287
+ }
288
+
289
+ $plugin_in_repo = false;
290
+ if ( ! $is_addon ) {
291
+ // Try to fetch info from .org repository.
292
+ $data = self::_fetch_plugin_info_from_repository( $action, $args );
293
+
294
+ $plugin_in_repo = ( false !== $data );
295
+ }
296
+
297
+ if ( ! $plugin_in_repo ) {
298
+ $data = $args;
299
+
300
+ // Fetch as much as possible info from local files.
301
+ $plugin_local_data = $this->_fs->get_plugin_data();
302
+ $data->name = $plugin_local_data['Name'];
303
+ $data->author = $plugin_local_data['Author'];
304
+ $data->sections = array(
305
+ 'description' => 'Upgrade ' . $plugin_local_data['Name'] . ' to latest.',
306
+ );
307
+
308
+ // @todo Store extra plugin info on Freemius or parse readme.txt markup.
309
+ /*$info = $this->_fs->get_api_site_scope()->call('/information.json');
310
+
311
+ if ( !isset($info->error) ) {
312
+ $data = $info;
313
+ }*/
314
+ }
315
+
316
+ // Get plugin's newest update.
317
+ $new_version = $this->_fs->_fetch_latest_version( $is_addon ? $addon->id : false );
318
+
319
+ if ( $is_addon ) {
320
+ $data->name = $addon->title . ' ' . __fs( 'addon', $this->_fs->get_slug() );
321
+ $data->slug = $addon->slug;
322
+ $data->url = WP_FS__ADDRESS;
323
+ $data->package = $new_version->url;
324
+ }
325
+
326
+ if ( ! $plugin_in_repo ) {
327
+ $data->last_updated = ! is_null( $new_version->updated ) ? $new_version->updated : $new_version->created;
328
+ $data->requires = $new_version->requires_platform_version;
329
+ $data->tested = $new_version->tested_up_to_version;
330
+ }
331
+
332
+ $data->version = $new_version->version;
333
+ $data->download_link = $new_version->url;
334
+
335
+ return $data;
336
+ }
337
+ }
freemius/includes/class-fs-security.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
14
+
15
+ class FS_Security {
16
+ /**
17
+ * @var FS_Security
18
+ * @since 1.0.3
19
+ */
20
+ private static $_instance;
21
+ /**
22
+ * @var FS_Logger
23
+ * @since 1.0.3
24
+ */
25
+ private static $_logger;
26
+
27
+ public static function instance() {
28
+ if ( ! isset( self::$_instance ) ) {
29
+ self::$_instance = new FS_Security();
30
+ self::$_logger = FS_Logger::get_logger(
31
+ WP_FS__SLUG,
32
+ WP_FS__DEBUG_SDK,
33
+ WP_FS__ECHO_DEBUG_SDK
34
+ );
35
+ }
36
+
37
+ return self::$_instance;
38
+ }
39
+
40
+ private function __construct() {
41
+ }
42
+
43
+ /**
44
+ * @param \FS_Scope_Entity $entity
45
+ * @param int $timestamp
46
+ * @param string $action
47
+ *
48
+ * @return string
49
+ */
50
+ function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
51
+ return md5(
52
+ $timestamp .
53
+ $entity->id .
54
+ $entity->secret_key .
55
+ $entity->public_key .
56
+ $action
57
+ );
58
+ }
59
+
60
+ /**
61
+ * @param \FS_Scope_Entity $entity
62
+ * @param int|bool $timestamp
63
+ * @param string $action
64
+ *
65
+ * @return array
66
+ */
67
+ function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
68
+ if ( false === $timestamp ) {
69
+ $timestamp = time();
70
+ }
71
+
72
+ return array(
73
+ 's_ctx_type' => $entity->get_type(),
74
+ 's_ctx_id' => $entity->id,
75
+ 's_ctx_ts' => $timestamp,
76
+ 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
77
+ );
78
+ }
79
+ }
freemius/includes/debug/class-fs-debug-bar-panel.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.7.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.1.7.3
18
+ *
19
+ * Class Freemius_Debug_Bar_Panel
20
+ */
21
+ class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
22
+ function init() {
23
+ $this->title( 'Freemius' );
24
+ }
25
+
26
+ static function requests_count() {
27
+ if ( class_exists( 'Freemius_Api' ) ) {
28
+ $logger = Freemius_Api::GetLogger();
29
+ } else {
30
+ $logger = array();
31
+ }
32
+
33
+ return number_format( count( $logger ) );
34
+ }
35
+
36
+ static function total_time() {
37
+ if ( class_exists( 'Freemius_Api' ) ) {
38
+ $logger = Freemius_Api::GetLogger();
39
+ } else {
40
+ $logger = array();
41
+ }
42
+
43
+ $total_time = .0;
44
+ foreach ( $logger as $l ) {
45
+ $total_time += $l['total'];
46
+ }
47
+
48
+ return number_format( 100 * $total_time, 2 ) . ' ' . __fs( 'ms' );
49
+ }
50
+
51
+ function render() {
52
+ ?>
53
+ <div id='debug-bar-php'>
54
+ <?php fs_require_template( '/debug/api-calls.php' ) ?>
55
+ <br>
56
+ <?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
57
+ <br>
58
+ <?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
59
+ <br>
60
+ <?php fs_require_template( '/debug/logger.php' ) ?>
61
+ </div>
62
+ <?php
63
+ }
64
+ }
freemius/includes/debug/debug-bar-start.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.7.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ if ( ! WP_FS__DEBUG_SDK ) {
14
+ return;
15
+ }
16
+
17
+ /**
18
+ * Initialize Freemius custom debug panels.
19
+ *
20
+ * @param array $panels Debug bar panels objects
21
+ *
22
+ * @return array Debug bar panels with your custom panels
23
+ */
24
+ function fs_custom_panels_init( $panels ) {
25
+ if ( class_exists( 'Debug_Bar_Panel' ) ) {
26
+ if ( FS_API__LOGGER_ON ) {
27
+ require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
28
+ $panels[] = new Freemius_Debug_Bar_Panel();
29
+ }
30
+ }
31
+
32
+ return $panels;
33
+ }
34
+
35
+ function fs_custom_status_init( $statuses ) {
36
+ if ( class_exists( 'Debug_Bar_Panel' ) ) {
37
+ if ( FS_API__LOGGER_ON ) {
38
+ require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
39
+ $statuses[] = array(
40
+ 'fs_api_requests',
41
+ __fs( 'Freemius API' ),
42
+ Freemius_Debug_Bar_Panel::requests_count() . ' ' . __fs( 'Requests' ) .
43
+ ' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
44
+ );
45
+ }
46
+ }
47
+
48
+ return $statuses;
49
+ }
50
+
51
+ add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
52
+ add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
freemius/includes/entities/class-fs-billing.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius for EDD Add-On
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Billing extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var int
19
+ */
20
+ public $entity_id;
21
+ /**
22
+ * @var string (Enum) Linked entity type. One of: developer, plugin, user, install
23
+ */
24
+ public $entity_type;
25
+ /**
26
+ * @var string
27
+ */
28
+ public $business_name;
29
+ /**
30
+ * @var string
31
+ */
32
+ public $first;
33
+ /**
34
+ * @var string
35
+ */
36
+ public $last;
37
+ /**
38
+ * @var string
39
+ */
40
+ public $email;
41
+ /**
42
+ * @var string
43
+ */
44
+ public $phone;
45
+ /**
46
+ * @var string
47
+ */
48
+ public $website;
49
+ /**
50
+ * @var string Tax or VAT ID.
51
+ */
52
+ public $tax_id;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $address_street;
57
+ /**
58
+ * @var string
59
+ */
60
+ public $address_apt;
61
+ /**
62
+ * @var string
63
+ */
64
+ public $address_city;
65
+ /**
66
+ * @var string
67
+ */
68
+ public $address_country;
69
+ /**
70
+ * @var string Two chars country code.
71
+ */
72
+ public $address_country_code;
73
+ /**
74
+ * @var string
75
+ */
76
+ public $address_state;
77
+ /**
78
+ * @var number Numeric ZIP code (cab be with leading zeros).
79
+ */
80
+ public $address_zip;
81
+
82
+ #endregion Properties
83
+
84
+
85
+ /**
86
+ * @param object|bool $event
87
+ */
88
+ function __construct( $event = false ) {
89
+ parent::__construct( $event );
90
+ }
91
+
92
+ static function get_type() {
93
+ return 'billing';
94
+ }
95
+ }
freemius/includes/entities/class-fs-entity.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Get object's public variables.
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.0.0
18
+ *
19
+ * @param object $object
20
+ *
21
+ * @return array
22
+ */
23
+ function fs_get_object_public_vars( $object ) {
24
+ return get_object_vars( $object );
25
+ }
26
+
27
+ class FS_Entity {
28
+ /**
29
+ * @var number
30
+ */
31
+ public $id;
32
+ /**
33
+ * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
34
+ */
35
+ public $updated;
36
+ /**
37
+ * @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
38
+ */
39
+ public $created;
40
+
41
+ /**
42
+ * @param bool|object $entity
43
+ */
44
+ function __construct( $entity = false ) {
45
+ if ( ! ( $entity instanceof stdClass ) ) {
46
+ return;
47
+ }
48
+
49
+ $props = fs_get_object_public_vars( $this );
50
+
51
+ foreach ( $props as $key => $def_value ) {
52
+ $this->{$key} = isset( $entity->{$key} ) ?
53
+ $entity->{$key} :
54
+ $def_value;
55
+ }
56
+ }
57
+
58
+ static function get_type() {
59
+ return 'type';
60
+ }
61
+
62
+ /**
63
+ * @author Vova Feldman (@svovaf)
64
+ * @since 1.0.6
65
+ *
66
+ * @param FS_Entity $entity1
67
+ * @param FS_Entity $entity2
68
+ *
69
+ * @return bool
70
+ */
71
+ static function equals( $entity1, $entity2 ) {
72
+ if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
73
+ return true;
74
+ } else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
75
+ return ( $entity1->id == $entity2->id );
76
+ } else if ( is_object( $entity1 ) ) {
77
+ return is_null( $entity1->id );
78
+ } else {
79
+ return is_null( $entity2->id );
80
+ }
81
+ }
82
+
83
+ private $_is_updated = false;
84
+
85
+ /**
86
+ * Update object property.
87
+ *
88
+ * @author Vova Feldman (@svovaf)
89
+ * @since 1.0.9
90
+ *
91
+ * @param string|array[string]mixed $key
92
+ * @param string|bool $val
93
+ *
94
+ * @return bool
95
+ */
96
+ function update( $key, $val = false ) {
97
+ if ( ! is_array( $key ) ) {
98
+ $key = array( $key => $val );
99
+ }
100
+
101
+ $is_updated = false;
102
+
103
+ foreach ( $key as $k => $v ) {
104
+ if ( $this->{$k} === $v ) {
105
+ continue;
106
+ }
107
+
108
+ if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
109
+ ( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
110
+ $this->{$k} == $v
111
+ ) {
112
+ continue;
113
+ }
114
+
115
+ // Update value.
116
+ $this->{$k} = $v;
117
+
118
+ $is_updated = true;
119
+ }
120
+
121
+ $this->_is_updated = $is_updated;
122
+
123
+ return $is_updated;
124
+ }
125
+
126
+ /**
127
+ * Checks if entity was updated.
128
+ *
129
+ * @author Vova Feldman (@svovaf)
130
+ * @since 1.0.9
131
+ *
132
+ * @return bool
133
+ */
134
+ function is_updated() {
135
+ return $this->_is_updated;
136
+ }
137
+
138
+ /**
139
+ * @param $id
140
+ *
141
+ * @author Vova Feldman (@svovaf)
142
+ * @since 1.1.2
143
+ *
144
+ * @return bool
145
+ */
146
+ static function is_valid_id($id){
147
+ return is_numeric($id);
148
+ }
149
+ }
freemius/includes/entities/class-fs-payment.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Payment extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $plugin_id;
21
+ /**
22
+ * @var number
23
+ */
24
+ public $user_id;
25
+ /**
26
+ * @var number
27
+ */
28
+ public $install_id;
29
+ /**
30
+ * @var number
31
+ */
32
+ public $subscription_id;
33
+ /**
34
+ * @var number
35
+ */
36
+ public $plan_id;
37
+ /**
38
+ * @var number
39
+ */
40
+ public $license_id;
41
+ /**
42
+ * @var float
43
+ */
44
+ public $gross;
45
+ /**
46
+ * @var number
47
+ */
48
+ public $bound_payment_id;
49
+ /**
50
+ * @var string
51
+ */
52
+ public $external_id;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $gateway;
57
+ /**
58
+ * @var string ISO 3166-1 alpha-2 - two-letter country code.
59
+ *
60
+ * @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
61
+ */
62
+ public $country_code;
63
+ /**
64
+ * @var string
65
+ */
66
+ public $vat_id;
67
+ /**
68
+ * @var float Actual Tax / VAT in $$$
69
+ */
70
+ public $vat;
71
+
72
+ #endregion Properties
73
+
74
+ /**
75
+ * @param object|bool $payment
76
+ */
77
+ function __construct( $payment = false ) {
78
+ parent::__construct( $payment );
79
+ }
80
+
81
+ static function get_type() {
82
+ return 'payment';
83
+ }
84
+
85
+ /**
86
+ * @author Vova Feldman (@svovaf)
87
+ * @since 1.0.0
88
+ *
89
+ * @return bool
90
+ */
91
+ function is_refund() {
92
+ return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
93
+ }
94
+ }
freemius/includes/entities/class-fs-plugin-info.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Info extends FS_Entity {
14
+ public $plugin_id;
15
+ public $description;
16
+ public $short_description;
17
+ public $banner_url;
18
+ public $card_banner_url;
19
+ public $selling_point_0;
20
+ public $selling_point_1;
21
+ public $selling_point_2;
22
+ public $screenshots;
23
+
24
+ /**
25
+ * @param stdClass|bool $plugin_info
26
+ */
27
+ function __construct( $plugin_info = false ) {
28
+ parent::__construct( $plugin_info );
29
+ }
30
+
31
+ static function get_type() {
32
+ return 'plugin';
33
+ }
34
+ }
freemius/includes/entities/class-fs-plugin-license.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.5
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_License extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $plugin_id;
21
+ /**
22
+ * @var number
23
+ */
24
+ public $user_id;
25
+ /**
26
+ * @var number
27
+ */
28
+ public $plan_id;
29
+ /**
30
+ * @var number
31
+ */
32
+ public $pricing_id;
33
+ /**
34
+ * @var int|null
35
+ */
36
+ public $quota;
37
+ /**
38
+ * @var int
39
+ */
40
+ public $activated;
41
+ /**
42
+ * @var int
43
+ */
44
+ public $activated_local;
45
+ /**
46
+ * @var string
47
+ */
48
+ public $expiration;
49
+ /**
50
+ * @var string
51
+ */
52
+ public $secret_key;
53
+ /**
54
+ * @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
55
+ * license.
56
+ */
57
+ public $is_free_localhost;
58
+ /**
59
+ * @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
60
+ * block updates and support.
61
+ */
62
+ public $is_block_features;
63
+ /**
64
+ * @var bool
65
+ */
66
+ public $is_cancelled;
67
+
68
+ #endregion Properties
69
+
70
+ /**
71
+ * @param stdClass|bool $license
72
+ */
73
+ function __construct( $license = false ) {
74
+ parent::__construct( $license );
75
+ }
76
+
77
+ static function get_type() {
78
+ return 'license';
79
+ }
80
+
81
+ /**
82
+ * Check how many site activations left.
83
+ *
84
+ * @author Vova Feldman (@svovaf)
85
+ * @since 1.0.5
86
+ *
87
+ * @return int
88
+ */
89
+ function left() {
90
+ if ( ! $this->is_active() || $this->is_expired() ) {
91
+ return 0;
92
+ }
93
+
94
+ if ( $this->is_unlimited() ) {
95
+ return 999;
96
+ }
97
+
98
+ return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
99
+ }
100
+
101
+ /**
102
+ * Check if single site license.
103
+ *
104
+ * @author Vova Feldman (@svovaf)
105
+ * @since 1.1.8.1
106
+ *
107
+ * @return bool
108
+ */
109
+ function is_single_site() {
110
+ return ( is_numeric( $this->quota ) && 1 == $this->quota );
111
+ }
112
+
113
+ /**
114
+ * @author Vova Feldman (@svovaf)
115
+ * @since 1.0.5
116
+ *
117
+ * @return bool
118
+ */
119
+ function is_expired() {
120
+ return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
121
+ }
122
+
123
+ /**
124
+ * Check if license is not expired.
125
+ *
126
+ * @author Vova Feldman (@svovaf)
127
+ * @since 1.2.1
128
+ *
129
+ * @return bool
130
+ */
131
+ function is_valid() {
132
+ return ! $this->is_expired();
133
+ }
134
+
135
+ /**
136
+ * @author Vova Feldman (@svovaf)
137
+ * @since 1.0.6
138
+ *
139
+ * @return bool
140
+ */
141
+ function is_lifetime() {
142
+ return is_null( $this->expiration );
143
+ }
144
+
145
+ /**
146
+ * @author Vova Feldman (@svovaf)
147
+ * @since 1.2.0
148
+ *
149
+ * @return bool
150
+ */
151
+ function is_unlimited() {
152
+ return is_null( $this->quota );
153
+ }
154
+
155
+ /**
156
+ * Check if license is fully utilized.
157
+ *
158
+ * @author Vova Feldman (@svovaf)
159
+ * @since 1.0.6
160
+ *
161
+ * @param bool $is_localhost
162
+ *
163
+ * @return bool
164
+ */
165
+ function is_utilized( $is_localhost = null ) {
166
+ if ( is_null( $is_localhost ) ) {
167
+ $is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
168
+ }
169
+
170
+ if ( $this->is_unlimited() ) {
171
+ return false;
172
+ }
173
+
174
+ return ! ( $this->is_free_localhost && $is_localhost ) &&
175
+ ( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
176
+ }
177
+
178
+ /**
179
+ * @author Vova Feldman (@svovaf)
180
+ * @since 1.2.1
181
+ *
182
+ * @return bool
183
+ */
184
+ function is_active() {
185
+ return ( ! $this->is_cancelled );
186
+ }
187
+
188
+ /**
189
+ * Check if license's plan features are enabled.
190
+ *
191
+ * - Either if plan not expired
192
+ * - If expired, based on the configuration to block features or not.
193
+ *
194
+ * @author Vova Feldman (@svovaf)
195
+ * @since 1.0.6
196
+ *
197
+ * @return bool
198
+ */
199
+ function is_features_enabled() {
200
+ return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
201
+ }
202
+
203
+ /**
204
+ * Subscription considered to be new without any payments
205
+ * if the license expires in less than 24 hours
206
+ * from the license creation.
207
+ *
208
+ * @author Vova Feldman (@svovaf)
209
+ * @since 1.0.9
210
+ *
211
+ * @return bool
212
+ */
213
+ function is_first_payment_pending() {
214
+ return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
215
+ }
216
+ }
freemius/includes/entities/class-fs-plugin-plan.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.5
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Plugin_Plan
15
+ *
16
+ * @property FS_Pricing[] $pricing
17
+ */
18
+ class FS_Plugin_Plan extends FS_Entity {
19
+
20
+ #region Properties
21
+
22
+ /**
23
+ * @var number
24
+ */
25
+ public $plugin_id;
26
+ /**
27
+ * @var string
28
+ */
29
+ public $name;
30
+ /**
31
+ * @var string
32
+ */
33
+ public $title;
34
+ /**
35
+ * @var string
36
+ */
37
+ public $description;
38
+ /**
39
+ * @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
40
+ */
41
+ public $is_free_localhost;
42
+ /**
43
+ * @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
44
+ * support.
45
+ */
46
+ public $is_block_features;
47
+ /**
48
+ * @var int
49
+ */
50
+ public $license_type;
51
+ /**
52
+ * @var bool
53
+ */
54
+ public $is_https_support;
55
+ /**
56
+ * @var int Trial days.
57
+ */
58
+ public $trial_period;
59
+ /**
60
+ * @var string If true, require payment for trial.
61
+ */
62
+ public $is_require_subscription;
63
+ /**
64
+ * @var string Knowledge Base URL.
65
+ */
66
+ public $support_kb;
67
+ /**
68
+ * @var string Support Forum URL.
69
+ */
70
+ public $support_forum;
71
+ /**
72
+ * @var string Support email address.
73
+ */
74
+ public $support_email;
75
+ /**
76
+ * @var string Support phone.
77
+ */
78
+ public $support_phone;
79
+ /**
80
+ * @var string Support skype username.
81
+ */
82
+ public $support_skype;
83
+ /**
84
+ * @var bool Is personal success manager supported with the plan.
85
+ */
86
+ public $is_success_manager;
87
+ /**
88
+ * @var bool Is featured plan.
89
+ */
90
+ public $is_featured;
91
+
92
+ #endregion Properties
93
+
94
+ /**
95
+ * @param object|bool $plan
96
+ */
97
+ function __construct( $plan = false ) {
98
+ parent::__construct( $plan );
99
+
100
+ if ( is_object( $plan ) ) {
101
+ $this->name = strtolower( $plan->name );
102
+ }
103
+ }
104
+
105
+ static function get_type() {
106
+ return 'plan';
107
+ }
108
+
109
+ /**
110
+ * @author Vova Feldman (@svovaf)
111
+ * @since 1.0.9
112
+ *
113
+ * @return bool
114
+ */
115
+ function is_free() {
116
+ return ( 'free' === $this->name );
117
+ }
118
+
119
+ /**
120
+ * Checks if this plan supports "Technical Support".
121
+ *
122
+ * @author Leo Fajardo (leorw)
123
+ * @since 1.2.0
124
+ *
125
+ * @return bool
126
+ */
127
+ function has_technical_support() {
128
+ return ( ! empty( $this->support_email ) ||
129
+ ! empty( $this->support_skype ) ||
130
+ ! empty( $this->support_phone ) ||
131
+ ! empty( $this->is_success_manager )
132
+ );
133
+ }
134
+
135
+ /**
136
+ * @author Vova Feldman (@svovaf)
137
+ * @since 1.0.9
138
+ *
139
+ * @return bool
140
+ */
141
+ function has_trial() {
142
+ return ! $this->is_free() &&
143
+ is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
144
+ }
145
+ }
freemius/includes/entities/class-fs-plugin-tag.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Tag extends FS_Entity {
14
+ public $version;
15
+ public $url;
16
+
17
+ function __construct( $tag = false ) {
18
+ parent::__construct( $tag );
19
+ }
20
+
21
+ static function get_type() {
22
+ return 'tag';
23
+ }
24
+ }
freemius/includes/entities/class-fs-plugin.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin extends FS_Scope_Entity {
14
+ /**
15
+ * @since 1.0.6
16
+ * @var null|number
17
+ */
18
+ public $parent_plugin_id;
19
+ /**
20
+ * @var string
21
+ */
22
+ public $title;
23
+ /**
24
+ * @var string
25
+ */
26
+ public $slug;
27
+ /**
28
+ * @var string 'plugin' or 'theme'
29
+ */
30
+ public $type;
31
+
32
+ #region Install Specific Properties
33
+
34
+ /**
35
+ * @var string
36
+ */
37
+ public $file;
38
+ /**
39
+ * @var string
40
+ */
41
+ public $version;
42
+ /**
43
+ * @var bool
44
+ */
45
+ public $auto_update;
46
+ /**
47
+ * @var FS_Plugin_Info
48
+ */
49
+ public $info;
50
+ /**
51
+ * @since 1.0.9
52
+ *
53
+ * @var bool
54
+ */
55
+ public $is_premium;
56
+ /**
57
+ * @since 1.0.9
58
+ *
59
+ * @var bool
60
+ */
61
+ public $is_live;
62
+
63
+ #endregion Install Specific Properties
64
+
65
+ /**
66
+ * @param stdClass|bool $plugin
67
+ */
68
+ function __construct( $plugin = false ) {
69
+ parent::__construct( $plugin );
70
+
71
+ $this->is_premium = false;
72
+ $this->is_live = true;
73
+
74
+ if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
75
+ $this->info = new FS_Plugin_Info( $plugin->info );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Check if plugin is an add-on (has parent).
81
+ *
82
+ * @author Vova Feldman (@svovaf)
83
+ * @since 1.0.6
84
+ *
85
+ * @return bool
86
+ */
87
+ function is_addon() {
88
+ return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
89
+ }
90
+
91
+ static function get_type() {
92
+ return 'plugin';
93
+ }
94
+ }
freemius/includes/entities/class-fs-pricing.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius for EDD Add-On
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Pricing extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $plan_id;
21
+ /**
22
+ * @var int
23
+ */
24
+ public $licenses;
25
+ /**
26
+ * @var null|float
27
+ */
28
+ public $monthly_price;
29
+ /**
30
+ * @var null|float
31
+ */
32
+ public $annual_price;
33
+ /**
34
+ * @var null|float
35
+ */
36
+ public $lifetime_price;
37
+
38
+ #endregion Properties
39
+
40
+ /**
41
+ * @param object|bool $pricing
42
+ */
43
+ function __construct( $pricing = false ) {
44
+ parent::__construct( $pricing );
45
+ }
46
+
47
+ static function get_type() {
48
+ return 'pricing';
49
+ }
50
+
51
+ /**
52
+ * @author Vova Feldman (@svovaf)
53
+ * @since 1.1.8
54
+ *
55
+ * @return bool
56
+ */
57
+ function has_monthly() {
58
+ return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
59
+ }
60
+
61
+ /**
62
+ * @author Vova Feldman (@svovaf)
63
+ * @since 1.1.8
64
+ *
65
+ * @return bool
66
+ */
67
+ function has_annual() {
68
+ return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
69
+ }
70
+
71
+ /**
72
+ * @author Vova Feldman (@svovaf)
73
+ * @since 1.1.8
74
+ *
75
+ * @return bool
76
+ */
77
+ function has_lifetime() {
78
+ return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
79
+ }
80
+
81
+ /**
82
+ * Check if unlimited licenses pricing.
83
+ *
84
+ * @author Vova Feldman (@svovaf)
85
+ * @since 1.1.8
86
+ *
87
+ * @return bool
88
+ */
89
+ function is_unlimited() {
90
+ return is_null( $this->licenses );
91
+ }
92
+
93
+
94
+ /**
95
+ * Check if pricing has more than one billing cycle.
96
+ *
97
+ * @author Vova Feldman (@svovaf)
98
+ * @since 1.1.8
99
+ *
100
+ * @return bool
101
+ */
102
+ function is_multi_cycle() {
103
+ $cycles = 0;
104
+ if ( $this->has_monthly() ) {
105
+ $cycles ++;
106
+ }
107
+ if ( $this->has_annual() ) {
108
+ $cycles ++;
109
+ }
110
+ if ( $this->has_lifetime() ) {
111
+ $cycles ++;
112
+ }
113
+
114
+ return $cycles > 1;
115
+ }
116
+
117
+ /**
118
+ * Get annual over monthly discount.
119
+ *
120
+ * @author Vova Feldman (@svovaf)
121
+ * @since 1.1.8
122
+ *
123
+ * @return int
124
+ */
125
+ function annual_discount_percentage() {
126
+ return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
127
+ }
128
+
129
+ /**
130
+ * Get annual over monthly savings.
131
+ *
132
+ * @author Vova Feldman (@svovaf)
133
+ * @since 1.1.8
134
+ *
135
+ * @return float
136
+ */
137
+ function annual_savings() {
138
+ return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
139
+ }
140
+
141
+ }
freemius/includes/entities/class-fs-scope-entity.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Scope_Entity extends FS_Entity {
14
+ /**
15
+ * @var string
16
+ */
17
+ public $public_key;
18
+ /**
19
+ * @var string
20
+ */
21
+ public $secret_key;
22
+
23
+ /**
24
+ * @param bool|stdClass $scope_entity
25
+ */
26
+ function __construct( $scope_entity = false ) {
27
+ parent::__construct( $scope_entity );
28
+ }
29
+ }
freemius/includes/entities/class-fs-site.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Site extends FS_Scope_Entity {
14
+ /**
15
+ * @var string
16
+ */
17
+ public $slug;
18
+ /**
19
+ * @var number
20
+ */
21
+ public $site_id;
22
+ /**
23
+ * @var number
24
+ */
25
+ public $plugin_id;
26
+ /**
27
+ * @var number
28
+ */
29
+ public $user_id;
30
+ /**
31
+ * @var string
32
+ */
33
+ public $title;
34
+ /**
35
+ * @var string
36
+ */
37
+ public $url;
38
+ /**
39
+ * @var string
40
+ */
41
+ public $version;
42
+ /**
43
+ * @var string E.g. en-GB
44
+ */
45
+ public $language;
46
+ /**
47
+ * @var string E.g. UTF-8
48
+ */
49
+ public $charset;
50
+ /**
51
+ * @var string Platform version (e.g WordPress version).
52
+ */
53
+ public $platform_version;
54
+ /**
55
+ * Freemius SDK version
56
+ *
57
+ * @author Leo Fajardo (@leorw)
58
+ * @since 1.2.2
59
+ *
60
+ * @var string SDK version (e.g.: 1.2.2)
61
+ */
62
+ public $sdk_version;
63
+ /**
64
+ * @var string Programming language version (e.g PHP version).
65
+ */
66
+ public $programming_language_version;
67
+ /**
68
+ * @var FS_Plugin_Plan $plan
69
+ */
70
+ public $plan;
71
+ /**
72
+ * @var number|null
73
+ */
74
+ public $license_id;
75
+ /**
76
+ * @var number|null
77
+ */
78
+ public $trial_plan_id;
79
+ /**
80
+ * @var string|null
81
+ */
82
+ public $trial_ends;
83
+ /**
84
+ * @since 1.0.9
85
+ *
86
+ * @var bool
87
+ */
88
+ public $is_premium = false;
89
+ /**
90
+ * @author Leo Fajardo (@leorw)
91
+ *
92
+ * @since 1.2.1.5
93
+ *
94
+ * @var bool
95
+ */
96
+ public $is_disconnected = false;
97
+
98
+ /**
99
+ * @param stdClass|bool $site
100
+ */
101
+ function __construct( $site = false ) {
102
+ $this->plan = new FS_Plugin_Plan();
103
+
104
+ parent::__construct( $site );
105
+
106
+ if ( is_object( $site ) ) {
107
+ $this->plan->id = $site->plan_id;
108
+ }
109
+
110
+ if ( ! is_bool( $this->is_disconnected ) ) {
111
+ $this->is_disconnected = false;
112
+ }
113
+ }
114
+
115
+ static function get_type() {
116
+ return 'install';
117
+ }
118
+
119
+ function is_localhost() {
120
+ // The server has no way to verify if localhost unless localhost appears in domain.
121
+ return WP_FS__IS_LOCALHOST_FOR_SERVER;
122
+ // return (substr($_SERVER['REMOTE_ADDR'], 0, 4) == '127.' || $_SERVER['REMOTE_ADDR'] == '::1');
123
+ }
124
+
125
+ /**
126
+ * Check if site in trial.
127
+ *
128
+ * @author Vova Feldman (@svovaf)
129
+ * @since 1.0.9
130
+ *
131
+ * @return bool
132
+ */
133
+ function is_trial() {
134
+ return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
135
+ }
136
+
137
+ /**
138
+ * Check if user already utilized the trial with the current install.
139
+ *
140
+ * @author Vova Feldman (@svovaf)
141
+ * @since 1.0.9
142
+ *
143
+ * @return bool
144
+ */
145
+ function is_trial_utilized() {
146
+ return is_numeric( $this->trial_plan_id );
147
+ }
148
+ }
freemius/includes/entities/class-fs-subscription.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.9
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Subscription extends FS_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var number
19
+ */
20
+ public $user_id;
21
+ /**
22
+ * @var number
23
+ */
24
+ public $install_id;
25
+ /**
26
+ * @var number
27
+ */
28
+ public $plan_id;
29
+ /**
30
+ * @var number
31
+ */
32
+ public $license_id;
33
+ /**
34
+ * @var float
35
+ */
36
+ public $total_gross;
37
+ /**
38
+ * @var float
39
+ */
40
+ public $amount_per_cycle;
41
+ /**
42
+ * @var int # of months
43
+ */
44
+ public $billing_cycle;
45
+ /**
46
+ * @var float
47
+ */
48
+ public $outstanding_balance;
49
+ /**
50
+ * @var int
51
+ */
52
+ public $failed_payments;
53
+ /**
54
+ * @var string
55
+ */
56
+ public $gateway;
57
+ /**
58
+ * @var string
59
+ */
60
+ public $external_id;
61
+ /**
62
+ * @var string|null
63
+ */
64
+ public $trial_ends;
65
+ /**
66
+ * @var string|null Datetime of the next payment, or null if cancelled
67
+ */
68
+ public $next_payment;
69
+ /**
70
+ * @var string|null
71
+ */
72
+ public $vat_id;
73
+ /**
74
+ * @var string Two characters country code
75
+ */
76
+ public $country_code;
77
+
78
+ #endregion Properties
79
+
80
+ /**
81
+ * @param object|bool $subscription
82
+ */
83
+ function __construct( $subscription = false ) {
84
+ parent::__construct( $subscription );
85
+ }
86
+
87
+ static function get_type() {
88
+ return 'subscription';
89
+ }
90
+
91
+ /**
92
+ * Check if subscription is active.
93
+ *
94
+ * @author Vova Feldman (@svovaf)
95
+ * @since 1.0.9
96
+ *
97
+ * @return bool
98
+ */
99
+ function is_active() {
100
+ return ! empty( $this->next_payment ) &&
101
+ ( strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME );
102
+ }
103
+
104
+ /**
105
+ * Subscription considered to be new without any payments
106
+ * if the next payment should be made within less than 24 hours
107
+ * from the subscription creation.
108
+ *
109
+ * @author Vova Feldman (@svovaf)
110
+ * @since 1.0.9
111
+ *
112
+ * @return bool
113
+ */
114
+ function is_first_payment_pending() {
115
+ return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
116
+ }
117
+
118
+ /**
119
+ * @author Vova Feldman (@svovaf)
120
+ * @since 1.1.7
121
+ */
122
+ function has_trial() {
123
+ return ! is_null( $this->trial_ends );
124
+ }
125
+ }
freemius/includes/entities/class-fs-user.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_User extends FS_Scope_Entity {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ public $email;
21
+ /**
22
+ * @var string
23
+ */
24
+ public $first;
25
+ /**
26
+ * @var string
27
+ */
28
+ public $last;
29
+ /**
30
+ * @var bool
31
+ */
32
+ public $is_verified;
33
+ /**
34
+ * @var string|null
35
+ */
36
+ public $customer_id;
37
+ /**
38
+ * @var float
39
+ */
40
+ public $gross;
41
+
42
+ #endregion Properties
43
+
44
+ /**
45
+ * @param object|bool $user
46
+ */
47
+ function __construct( $user = false ) {
48
+ parent::__construct( $user );
49
+ }
50
+
51
+ function get_name() {
52
+ return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
53
+ }
54
+
55
+ function is_verified() {
56
+ return ( isset( $this->is_verified ) && true === $this->is_verified );
57
+ }
58
+
59
+ static function get_type() {
60
+ return 'user';
61
+ }
62
+ }
freemius/includes/fs-core-functions.php ADDED
@@ -0,0 +1,505 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ global $fs_core_logger;
14
+
15
+ $fs_core_logger = FS_Logger::get_logger( WP_FS__SLUG . '_core', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
16
+
17
+ if ( ! function_exists( 'fs_dummy' ) ) {
18
+ function fs_dummy() {
19
+ }
20
+ }
21
+
22
+ /* Url.
23
+ --------------------------------------------------------------------------------------------*/
24
+ function fs_get_url_daily_cache_killer() {
25
+ return date( '\YY\Mm\Dd' );
26
+ }
27
+
28
+ /* Templates / Views.
29
+ --------------------------------------------------------------------------------------------*/
30
+ if ( ! function_exists( 'fs_get_template_path' ) ) {
31
+ function fs_get_template_path( $path ) {
32
+ return WP_FS__DIR_TEMPLATES . '/' . trim( $path, '/' );
33
+ }
34
+
35
+ function fs_include_template( $path, &$params = null ) {
36
+ $VARS = &$params;
37
+ include( fs_get_template_path( $path ) );
38
+ }
39
+
40
+ function fs_include_once_template( $path, &$params = null ) {
41
+ $VARS = &$params;
42
+ include_once( fs_get_template_path( $path ) );
43
+ }
44
+
45
+ function fs_require_template( $path, &$params = null ) {
46
+ $VARS = &$params;
47
+ require( fs_get_template_path( $path ) );
48
+ }
49
+
50
+ function fs_require_once_template( $path, &$params = null ) {
51
+ $VARS = &$params;
52
+ require_once( fs_get_template_path( $path ) );
53
+ }
54
+
55
+ function fs_get_template( $path, &$params = null ) {
56
+ ob_start();
57
+
58
+ $VARS = &$params;
59
+ require( fs_get_template_path( $path ) );
60
+
61
+ return ob_get_clean();
62
+ }
63
+ }
64
+
65
+ /* Scripts and styles including.
66
+ --------------------------------------------------------------------------------------------*/
67
+ function fs_enqueue_local_style( $handle, $path, $deps = array(), $ver = false, $media = 'all' ) {
68
+ global $fs_core_logger;
69
+ if ( $fs_core_logger->is_on() ) {
70
+ $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' );
71
+ $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_CSS . trim( $path, '/' ) ) );
72
+ $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ) );
73
+ }
74
+
75
+ wp_enqueue_style( $handle, plugins_url( plugin_basename( WP_FS__DIR_CSS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $media );
76
+ }
77
+
78
+ function fs_enqueue_local_script( $handle, $path, $deps = array(), $ver = false, $in_footer = 'all' ) {
79
+ global $fs_core_logger;
80
+ if ( $fs_core_logger->is_on() ) {
81
+ $fs_core_logger->info( 'handle = ' . $handle . '; path = ' . $path . ';' );
82
+ $fs_core_logger->info( 'plugin_basename = ' . plugins_url( WP_FS__DIR_JS . trim( $path, '/' ) ) );
83
+ $fs_core_logger->info( 'plugins_url = ' . plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ) );
84
+ }
85
+
86
+ wp_enqueue_script( $handle, plugins_url( plugin_basename( WP_FS__DIR_JS . '/' . trim( $path, '/' ) ) ), $deps, $ver, $in_footer );
87
+ }
88
+
89
+ function fs_img_url( $path, $img_dir = WP_FS__DIR_IMG ) {
90
+ return plugins_url( plugin_basename( $img_dir . '/' . trim( $path, '/' ) ) );
91
+ }
92
+
93
+ /* Request handlers.
94
+ --------------------------------------------------------------------------------------------*/
95
+ /**
96
+ * @param string $key
97
+ * @param mixed $def
98
+ *
99
+ * @return mixed
100
+ */
101
+ function fs_request_get( $key, $def = false ) {
102
+ return isset( $_REQUEST[ $key ] ) ? $_REQUEST[ $key ] : $def;
103
+ }
104
+
105
+ function fs_request_has( $key ) {
106
+ return isset( $_REQUEST[ $key ] );
107
+ }
108
+
109
+ function fs_request_get_bool( $key, $def = false ) {
110
+ if ( ! isset( $_REQUEST[ $key ] ) ) {
111
+ return $def;
112
+ }
113
+
114
+ if ( 1 == $_REQUEST[ $key ] || 'true' === strtolower( $_REQUEST[ $key ] ) ) {
115
+ return true;
116
+ }
117
+
118
+ if ( 0 == $_REQUEST[ $key ] || 'false' === strtolower( $_REQUEST[ $key ] ) ) {
119
+ return false;
120
+ }
121
+
122
+ return $def;
123
+ }
124
+
125
+ function fs_request_is_post() {
126
+ return ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) );
127
+ }
128
+
129
+ function fs_request_is_get() {
130
+ return ( 'get' === strtolower( $_SERVER['REQUEST_METHOD'] ) );
131
+ }
132
+
133
+ function fs_get_action( $action_key = 'action' ) {
134
+ if ( ! empty( $_REQUEST[ $action_key ] ) ) {
135
+ return strtolower( $_REQUEST[ $action_key ] );
136
+ }
137
+
138
+ if ( 'action' == $action_key ) {
139
+ $action_key = 'fs_action';
140
+
141
+ if ( ! empty( $_REQUEST[ $action_key ] ) ) {
142
+ return strtolower( $_REQUEST[ $action_key ] );
143
+ }
144
+ }
145
+
146
+ return false;
147
+ }
148
+
149
+ function fs_request_is_action( $action, $action_key = 'action' ) {
150
+ return ( strtolower( $action ) === fs_get_action( $action_key ) );
151
+ }
152
+
153
+ /**
154
+ * @author Vova Feldman (@svovaf)
155
+ * @since 1.0.0
156
+ *
157
+ * @since 1.2.1.5 Allow nonce verification.
158
+ *
159
+ * @param string $action
160
+ * @param string $action_key
161
+ * @param string $nonce_key
162
+ *
163
+ * @return bool
164
+ */
165
+ function fs_request_is_action_secure(
166
+ $action,
167
+ $action_key = 'action',
168
+ $nonce_key = 'nonce'
169
+ ) {
170
+ if ( strtolower( $action ) !== fs_get_action( $action_key ) ) {
171
+ return false;
172
+ }
173
+
174
+ $nonce = ! empty( $_REQUEST[ $nonce_key ] ) ?
175
+ $_REQUEST[ $nonce_key ] :
176
+ '';
177
+
178
+ if ( empty( $nonce ) ||
179
+ ( false === wp_verify_nonce( $nonce, $action ) )
180
+ ) {
181
+ return false;
182
+ }
183
+
184
+ return true;
185
+ }
186
+
187
+ function fs_is_plugin_page( $menu_slug ) {
188
+ return ( is_admin() && $_REQUEST['page'] === $menu_slug );
189
+ }
190
+
191
+ /* Core UI.
192
+ --------------------------------------------------------------------------------------------*/
193
+ /**
194
+ * @param string $slug
195
+ * @param string $page
196
+ * @param string $action
197
+ * @param string $title
198
+ * @param array $params
199
+ * @param bool $is_primary
200
+ * @param string|bool $icon_class Optional class for an icon (since 1.1.7).
201
+ * @param string|bool $confirmation Optional confirmation message before submit (since 1.1.7).
202
+ * @param string $method Since 1.1.7
203
+ *
204
+ * @uses fs_ui_get_action_button()
205
+ */
206
+ function fs_ui_action_button(
207
+ $slug,
208
+ $page,
209
+ $action,
210
+ $title,
211
+ $params = array(),
212
+ $is_primary = true,
213
+ $icon_class = false,
214
+ $confirmation = false,
215
+ $method = 'GET'
216
+ ) {
217
+ echo fs_ui_get_action_button(
218
+ $slug,
219
+ $page,
220
+ $action,
221
+ $title,
222
+ $params,
223
+ $is_primary,
224
+ $icon_class,
225
+ $confirmation,
226
+ $method
227
+ );
228
+ }
229
+
230
+ /**
231
+ * @author Vova Feldman (@svovaf)
232
+ * @since 1.1.7
233
+ *
234
+ * @param string $slug
235
+ * @param string $page
236
+ * @param string $action
237
+ * @param string $title
238
+ * @param array $params
239
+ * @param bool $is_primary
240
+ * @param string|bool $icon_class Optional class for an icon.
241
+ * @param string|bool $confirmation Optional confirmation message before submit.
242
+ * @param string $method
243
+ *
244
+ * @return string
245
+ */
246
+ function fs_ui_get_action_button(
247
+ $slug,
248
+ $page,
249
+ $action,
250
+ $title,
251
+ $params = array(),
252
+ $is_primary = true,
253
+ $icon_class = false,
254
+ $confirmation = false,
255
+ $method = 'GET'
256
+ ) {
257
+ // Prepend icon (if set).
258
+ $title = ( is_string( $icon_class ) ? '<i class="' . $icon_class . '"></i> ' : '' ) . $title;
259
+
260
+ if ( is_string( $confirmation ) ) {
261
+ return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="if (confirm(\'%s\')) this.parentNode.submit(); return false;">%s</a></form>',
262
+ freemius( $slug )->_get_admin_page_url( $page, $params ),
263
+ $method,
264
+ $action,
265
+ wp_nonce_field( $action, '_wpnonce', true, false ),
266
+ 'button' . ( $is_primary ? ' button-primary' : '' ),
267
+ $confirmation,
268
+ $title
269
+ );
270
+ } else if ( 'GET' !== strtoupper( $method ) ) {
271
+ return sprintf( '<form action="%s" method="%s"><input type="hidden" name="fs_action" value="%s">%s<a href="#" class="%s" onclick="this.parentNode.submit(); return false;">%s</a></form>',
272
+ freemius( $slug )->_get_admin_page_url( $page, $params ),
273
+ $method,
274
+ $action,
275
+ wp_nonce_field( $action, '_wpnonce', true, false ),
276
+ 'button' . ( $is_primary ? ' button-primary' : '' ),
277
+ $title
278
+ );
279
+ } else {
280
+ return sprintf( '<a href="%s" class="%s">%s</a></form>',
281
+ wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ),
282
+ 'button' . ( $is_primary ? ' button-primary' : '' ),
283
+ $title
284
+ );
285
+ }
286
+ }
287
+
288
+ function fs_ui_action_link( $slug, $page, $action, $title, $params = array() ) {
289
+ ?><a class=""
290
+ href="<?php echo wp_nonce_url( freemius( $slug )->_get_admin_page_url( $page, array_merge( $params, array( 'fs_action' => $action ) ) ), $action ) ?>"><?php echo $title ?></a><?php
291
+ }
292
+
293
+ /*function fs_error_handler($errno, $errstr, $errfile, $errline)
294
+ {
295
+ if (false === strpos($errfile, 'freemius/'))
296
+ {
297
+ // @todo Dump Freemius errors to local log.
298
+ }
299
+
300
+ // switch ($errno) {
301
+ // case E_USER_ERROR:
302
+ // break;
303
+ // case E_WARNING:
304
+ // case E_USER_WARNING:
305
+ // break;
306
+ // case E_NOTICE:
307
+ // case E_USER_NOTICE:
308
+ // break;
309
+ // default:
310
+ // break;
311
+ // }
312
+ }
313
+
314
+ set_error_handler('fs_error_handler');*/
315
+
316
+ if ( ! function_exists( 'fs_nonce_url' ) ) {
317
+ /**
318
+ * Retrieve URL with nonce added to URL query.
319
+ *
320
+ * Originally was using `wp_nonce_url()` but the new version
321
+ * changed the return value to escaped URL, that's not the expected
322
+ * behaviour.
323
+ *
324
+ * @author Vova Feldman (@svovaf)
325
+ * @since ~1.1.3
326
+ *
327
+ * @param string $actionurl URL to add nonce action.
328
+ * @param int|string $action Optional. Nonce action name. Default -1.
329
+ * @param string $name Optional. Nonce name. Default '_wpnonce'.
330
+ *
331
+ * @return string Escaped URL with nonce action added.
332
+ */
333
+ function fs_nonce_url( $actionurl, $action = - 1, $name = '_wpnonce' ) {
334
+ return add_query_arg( $name, wp_create_nonce( $action ), $actionurl );
335
+ }
336
+ }
337
+
338
+ if ( ! function_exists( 'fs_starts_with' ) ) {
339
+ /**
340
+ * Check if string starts with.
341
+ *
342
+ * @author Vova Feldman (@svovaf)
343
+ * @since 1.1.3
344
+ *
345
+ * @param string $haystack
346
+ * @param string $needle
347
+ *
348
+ * @return bool
349
+ */
350
+ function fs_starts_with( $haystack, $needle ) {
351
+ $length = strlen( $needle );
352
+
353
+ return ( substr( $haystack, 0, $length ) === $needle );
354
+ }
355
+ }
356
+
357
+ #region Url Canonization ------------------------------------------------------------------
358
+
359
+ if ( ! function_exists( 'fs_canonize_url' ) ) {
360
+ /**
361
+ * @author Vova Feldman (@svovaf)
362
+ * @since 1.1.3
363
+ *
364
+ * @param string $url
365
+ * @param bool $omit_host
366
+ * @param array $ignore_params
367
+ *
368
+ * @return string
369
+ */
370
+ function fs_canonize_url( $url, $omit_host = false, $ignore_params = array() ) {
371
+ $parsed_url = parse_url( strtolower( $url ) );
372
+
373
+ // if ( ! isset( $parsed_url['host'] ) ) {
374
+ // return $url;
375
+ // }
376
+
377
+ $canonical = ( ( $omit_host || ! isset( $parsed_url['host'] ) ) ? '' : $parsed_url['host'] ) . $parsed_url['path'];
378
+
379
+ if ( isset( $parsed_url['query'] ) ) {
380
+ parse_str( $parsed_url['query'], $queryString );
381
+ $canonical .= '?' . fs_canonize_query_string( $queryString, $ignore_params );
382
+ }
383
+
384
+ return $canonical;
385
+ }
386
+ }
387
+
388
+ if ( ! function_exists( 'fs_canonize_query_string' ) ) {
389
+ /**
390
+ * @author Vova Feldman (@svovaf)
391
+ * @since 1.1.3
392
+ *
393
+ * @param array $params
394
+ * @param array $ignore_params
395
+ * @param bool $params_prefix
396
+ *
397
+ * @return string
398
+ */
399
+ function fs_canonize_query_string( array $params, array &$ignore_params, $params_prefix = false ) {
400
+ if ( ! is_array( $params ) || 0 === count( $params ) ) {
401
+ return '';
402
+ }
403
+
404
+ // Url encode both keys and values
405
+ $keys = fs_urlencode_rfc3986( array_keys( $params ) );
406
+ $values = fs_urlencode_rfc3986( array_values( $params ) );
407
+ $params = array_combine( $keys, $values );
408
+
409
+ // Parameters are sorted by name, using lexicographical byte value ordering.
410
+ // Ref: Spec: 9.1.1 (1)
411
+ uksort( $params, 'strcmp' );
412
+
413
+ $pairs = array();
414
+ foreach ( $params as $parameter => $value ) {
415
+ $lower_param = strtolower( $parameter );
416
+
417
+ // Skip ignore params.
418
+ if ( in_array( $lower_param, $ignore_params ) ||
419
+ ( false !== $params_prefix && fs_starts_with( $lower_param, $params_prefix ) )
420
+ ) {
421
+ continue;
422
+ }
423
+
424
+ if ( is_array( $value ) ) {
425
+ // If two or more parameters share the same name, they are sorted by their value
426
+ // Ref: Spec: 9.1.1 (1)
427
+ natsort( $value );
428
+ foreach ( $value as $duplicate_value ) {
429
+ $pairs[] = $lower_param . '=' . $duplicate_value;
430
+ }
431
+ } else {
432
+ $pairs[] = $lower_param . '=' . $value;
433
+ }
434
+ }
435
+
436
+ if ( 0 === count( $pairs ) ) {
437
+ return '';
438
+ }
439
+
440
+ return implode( "&", $pairs );
441
+ }
442
+ }
443
+
444
+ if ( ! function_exists( 'fs_urlencode_rfc3986' ) ) {
445
+ /**
446
+ * @author Vova Feldman (@svovaf)
447
+ * @since 1.1.3
448
+ *
449
+ * @param string|string[] $input
450
+ *
451
+ * @return array|mixed|string
452
+ */
453
+ function fs_urlencode_rfc3986( $input ) {
454
+ if ( is_array( $input ) ) {
455
+ return array_map( 'fs_urlencode_rfc3986', $input );
456
+ } else if ( is_scalar( $input ) ) {
457
+ return str_replace( '+', ' ', str_replace( '%7E', '~', rawurlencode( $input ) ) );
458
+ }
459
+
460
+ return '';
461
+ }
462
+ }
463
+
464
+ #endregion Url Canonization ------------------------------------------------------------------
465
+
466
+ function fs_download_image( $from, $to ) {
467
+ $ch = curl_init( $from );
468
+ $fp = fopen( fs_normalize_path( $to ), 'wb' );
469
+ curl_setopt( $ch, CURLOPT_FILE, $fp );
470
+ curl_setopt( $ch, CURLOPT_HEADER, 0 );
471
+ curl_exec( $ch );
472
+ curl_close( $ch );
473
+ fclose( $fp );
474
+ }
475
+
476
+ /* General Utilities
477
+ --------------------------------------------------------------------------------------------*/
478
+
479
+ /**
480
+ * Sorts an array by the value of the priority key.
481
+ *
482
+ * @author Daniel Iser (@danieliser)
483
+ * @since 1.1.7
484
+ *
485
+ * @param $a
486
+ * @param $b
487
+ *
488
+ * @return int
489
+ */
490
+ function fs_sort_by_priority( $a, $b ) {
491
+
492
+ // If b has a priority and a does not, b wins.
493
+ if ( ! isset( $a['priority'] ) && isset( $b['priority'] ) ) {
494
+ return 1;
495
+ } // If b has a priority and a does not, b wins.
496
+ elseif ( isset( $a['priority'] ) && ! isset( $b['priority'] ) ) {
497
+ return - 1;
498
+ } // If neither has a priority or both priorities are equal its a tie.
499
+ elseif ( ( ! isset( $a['priority'] ) && ! isset( $b['priority'] ) ) || $a['priority'] === $b['priority'] ) {
500
+ return 0;
501
+ }
502
+
503
+ // If both have priority return the winner.
504
+ return ( $a['priority'] < $b['priority'] ) ? - 1 : 1;
505
+ }
freemius/includes/fs-essential-functions.php ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.5
7
+ */
8
+
9
+ if ( ! function_exists( 'fs_normalize_path' ) ) {
10
+ if ( function_exists( 'wp_normalize_path' ) ) {
11
+ /**
12
+ * Normalize a filesystem path.
13
+ *
14
+ * Replaces backslashes with forward slashes for Windows systems, and ensures
15
+ * no duplicate slashes exist.
16
+ *
17
+ * @param string $path Path to normalize.
18
+ *
19
+ * @return string Normalized path.
20
+ */
21
+ function fs_normalize_path( $path ) {
22
+ return wp_normalize_path( $path );
23
+ }
24
+ } else {
25
+ function fs_normalize_path( $path ) {
26
+ $path = str_replace( '\\', '/', $path );
27
+ $path = preg_replace( '|/+|', '/', $path );
28
+
29
+ return $path;
30
+ }
31
+ }
32
+ }
33
+
34
+ #region Core Redirect (copied from BuddyPress) -----------------------------------------
35
+
36
+ if ( ! function_exists( 'fs_redirect' ) ) {
37
+ /**
38
+ * Redirects to another page, with a workaround for the IIS Set-Cookie bug.
39
+ *
40
+ * @link http://support.microsoft.com/kb/q176113/
41
+ * @since 1.5.1
42
+ * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status.
43
+ *
44
+ * @param string $location The path to redirect to.
45
+ * @param bool $exit If true, exit after redirect (Since 1.2.1.5).
46
+ * @param int $status Status code to use.
47
+ *
48
+ * @return bool False if $location is not set
49
+ */
50
+ function fs_redirect( $location, $exit = true, $status = 302 ) {
51
+ global $is_IIS;
52
+
53
+ $file = '';
54
+ $line = '';
55
+ if ( headers_sent($file, $line) ) {
56
+ if ( WP_FS__DEBUG_SDK && class_exists( 'FS_Admin_Notice_Manager' ) ) {
57
+ $notices = FS_Admin_Notice_Manager::instance( 'global' );
58
+
59
+ $notices->add( "Freemius failed to redirect the page because the headers have been already sent from line <b><code>{$line}</code></b> in file <b><code>{$file}</code></b>. If it's unexpected, it usually happens due to invalid space and/or EOL character(s).", 'Oops...', 'error' );
60
+ }
61
+
62
+ return false;
63
+ }
64
+
65
+ if ( defined( 'DOING_AJAX' ) ) {
66
+ // Don't redirect on AJAX calls.
67
+ return false;
68
+ }
69
+
70
+ if ( ! $location ) // allows the wp_redirect filter to cancel a redirect
71
+ {
72
+ return false;
73
+ }
74
+
75
+ $location = fs_sanitize_redirect( $location );
76
+
77
+ if ( $is_IIS ) {
78
+ header( "Refresh: 0;url=$location" );
79
+ } else {
80
+ if ( php_sapi_name() != 'cgi-fcgi' ) {
81
+ status_header( $status );
82
+ } // This causes problems on IIS and some FastCGI setups
83
+ header( "Location: $location" );
84
+ }
85
+
86
+ if ( $exit ) {
87
+ exit();
88
+ }
89
+
90
+ return true;
91
+ }
92
+
93
+ if ( ! function_exists( 'fs_sanitize_redirect' ) ) {
94
+ /**
95
+ * Sanitizes a URL for use in a redirect.
96
+ *
97
+ * @since 2.3
98
+ *
99
+ * @param string $location
100
+ *
101
+ * @return string redirect-sanitized URL
102
+ */
103
+ function fs_sanitize_redirect( $location ) {
104
+ $location = preg_replace( '|[^a-z0-9-~+_.?#=&;,/:%!]|i', '', $location );
105
+ $location = fs_kses_no_null( $location );
106
+
107
+ // remove %0d and %0a from location
108
+ $strip = array( '%0d', '%0a' );
109
+ $found = true;
110
+ while ( $found ) {
111
+ $found = false;
112
+ foreach ( (array) $strip as $val ) {
113
+ while ( strpos( $location, $val ) !== false ) {
114
+ $found = true;
115
+ $location = str_replace( $val, '', $location );
116
+ }
117
+ }
118
+ }
119
+
120
+ return $location;
121
+ }
122
+ }
123
+
124
+ if ( ! function_exists( 'fs_kses_no_null' ) ) {
125
+ /**
126
+ * Removes any NULL characters in $string.
127
+ *
128
+ * @since 1.0.0
129
+ *
130
+ * @param string $string
131
+ *
132
+ * @return string
133
+ */
134
+ function fs_kses_no_null( $string ) {
135
+ $string = preg_replace( '/\0+/', '', $string );
136
+ $string = preg_replace( '/(\\\\0)+/', '', $string );
137
+
138
+ return $string;
139
+ }
140
+ }
141
+ }
142
+
143
+ #endregion Core Redirect (copied from BuddyPress) -----------------------------------------
144
+
145
+ if ( ! function_exists( '__fs' ) ) {
146
+ global $fs_text_overrides;
147
+
148
+ if ( ! isset( $fs_text_overrides ) ) {
149
+ $fs_text_overrides = array();
150
+ }
151
+
152
+ /**
153
+ * Retrieve a translated text by key.
154
+ *
155
+ * @author Vova Feldman (@svovaf)
156
+ * @since 1.1.4
157
+ *
158
+ * @param string $key
159
+ * @param string $slug
160
+ *
161
+ * @return string
162
+ *
163
+ * @global $fs_text , $fs_text_overrides
164
+ */
165
+ function __fs( $key, $slug = 'freemius' ) {
166
+ global $fs_text, $fs_text_overrides;
167
+
168
+ if ( ! isset( $fs_text ) ) {
169
+ require_once( ( defined( 'WP_FS__DIR_INCLUDES' ) ? WP_FS__DIR_INCLUDES : dirname( __FILE__ ) ) . '/i18n.php' );
170
+ }
171
+
172
+ if ( isset( $fs_text_overrides[ $slug ] ) ) {
173
+ if ( isset( $fs_text_overrides[ $slug ][ $key ] ) ) {
174
+ return $fs_text_overrides[ $slug ][ $key ];
175
+ }
176
+
177
+ $lower_key = strtolower( $key );
178
+ if ( isset( $fs_text_overrides[ $slug ][ $lower_key ] ) ) {
179
+ return $fs_text_overrides[ $slug ][ $lower_key ];
180
+ }
181
+ }
182
+
183
+ return isset( $fs_text[ $key ] ) ?
184
+ $fs_text[ $key ] :
185
+ $key;
186
+ }
187
+
188
+ /**
189
+ * Display a translated text by key.
190
+ *
191
+ * @author Vova Feldman (@svovaf)
192
+ * @since 1.1.4
193
+ *
194
+ * @param string $key
195
+ * @param string $slug
196
+ */
197
+ function _efs( $key, $slug = 'freemius' ) {
198
+ echo __fs( $key, $slug );
199
+ }
200
+
201
+ /**
202
+ * Override default i18n text phrases.
203
+ *
204
+ * @author Vova Feldman (@svovaf)
205
+ * @since 1.1.6
206
+ *
207
+ * @param string[] $key_value
208
+ * @param string $slug
209
+ *
210
+ * @global $fs_text_overrides
211
+ */
212
+ function fs_override_i18n( array $key_value, $slug = 'freemius' ) {
213
+ global $fs_text_overrides;
214
+
215
+ if ( ! isset( $fs_text_overrides[ $slug ] ) ) {
216
+ $fs_text_overrides[ $slug ] = array();
217
+ }
218
+
219
+ foreach ( $key_value as $key => $value ) {
220
+ $fs_text_overrides[ $slug ][ $key ] = $value;
221
+ }
222
+ }
223
+ }
224
+
225
+ if ( ! function_exists( 'fs_get_ip' ) ) {
226
+ /**
227
+ * Get client IP.
228
+ *
229
+ * @author Vova Feldman (@svovaf)
230
+ * @since 1.1.2
231
+ *
232
+ * @return string|null
233
+ */
234
+ function fs_get_ip() {
235
+ $fields = array(
236
+ 'HTTP_CF_CONNECTING_IP',
237
+ 'HTTP_CLIENT_IP',
238
+ 'HTTP_X_FORWARDED_FOR',
239
+ 'HTTP_X_FORWARDED',
240
+ 'HTTP_FORWARDED_FOR',
241
+ 'HTTP_FORWARDED',
242
+ 'REMOTE_ADDR',
243
+ );
244
+
245
+ foreach ( $fields as $ip_field ) {
246
+ if ( ! empty( $_SERVER[ $ip_field ] ) ) {
247
+ return $_SERVER[ $ip_field ];
248
+ }
249
+ }
250
+
251
+ return null;
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Leverage backtrace to find caller plugin main file path.
257
+ *
258
+ * @author Vova Feldman (@svovaf)
259
+ * @since 1.0.6
260
+ *
261
+ * @return string
262
+ */
263
+ function fs_find_caller_plugin_file() {
264
+ /**
265
+ * All the code below will be executed once on activation.
266
+ * If the user changes the main plugin's file name, the file_exists()
267
+ * will catch it.
268
+ */
269
+ if ( ! function_exists( 'get_plugins' ) ) {
270
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
271
+ }
272
+
273
+ $all_plugins = get_plugins();
274
+ $all_plugins_paths = array();
275
+
276
+ // Get active plugin's main files real full names (might be symlinks).
277
+ foreach ( $all_plugins as $relative_path => &$data ) {
278
+ $all_plugins_paths[] = fs_normalize_path( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) );
279
+ }
280
+
281
+ $plugin_file = null;
282
+ for ( $i = 1, $bt = debug_backtrace(), $len = count( $bt ); $i < $len; $i ++ ) {
283
+ if ( in_array( fs_normalize_path( $bt[ $i ]['file'] ), $all_plugins_paths ) ) {
284
+ $plugin_file = $bt[ $i ]['file'];
285
+ break;
286
+ }
287
+ }
288
+
289
+ if ( is_null( $plugin_file ) ) {
290
+ // Throw an error to the developer in case of some edge case dev environment.
291
+ wp_die( __fs( 'failed-finding-main-path' ), __fs( 'error' ), array( 'back_link' => true ) );
292
+ }
293
+
294
+ return $plugin_file;
295
+ }
296
+
297
+ require_once dirname( __FILE__ ) . '/supplements/fs-essential-functions-1.1.7.1.php';
298
+
299
+ /**
300
+ * Update SDK newest version reference.
301
+ *
302
+ * @author Vova Feldman (@svovaf)
303
+ * @since 1.1.6
304
+ *
305
+ * @param string $sdk_relative_path
306
+ * @param string|bool $plugin_file
307
+ *
308
+ * @global $fs_active_plugins
309
+ */
310
+ function fs_update_sdk_newest_version( $sdk_relative_path, $plugin_file = false ) {
311
+ global $fs_active_plugins;
312
+
313
+ if ( ! is_string( $plugin_file ) ) {
314
+ $plugin_file = plugin_basename( fs_find_caller_plugin_file() );
315
+ }
316
+
317
+ $fs_active_plugins->newest = (object) array(
318
+ 'plugin_path' => $plugin_file,
319
+ 'sdk_path' => $sdk_relative_path,
320
+ 'version' => $fs_active_plugins->plugins[ $sdk_relative_path ]->version,
321
+ 'in_activation' => ! is_plugin_active( $plugin_file ),
322
+ 'timestamp' => time(),
323
+ );
324
+
325
+ // Update DB with latest SDK version and path.
326
+ update_option( 'fs_active_plugins', $fs_active_plugins );
327
+ }
328
+
329
+ /**
330
+ * Reorder the plugins load order so the plugin with the newest Freemius SDK is loaded first.
331
+ *
332
+ * @author Vova Feldman (@svovaf)
333
+ * @since 1.1.6
334
+ *
335
+ * @return bool Was plugin order changed. Return false if plugin was loaded first anyways.
336
+ *
337
+ * @global $fs_active_plugins
338
+ */
339
+ function fs_newest_sdk_plugin_first() {
340
+ global $fs_active_plugins;
341
+
342
+ /**
343
+ * @todo Multi-site network activated plugin are always loaded prior to site plugins so if there's a a plugin activated in the network mode that has an older version of the SDK of another plugin which is site activated that has new SDK version, the fs-essential-functions.php will be loaded from the older SDK. Same thing about MU plugins (loaded even before network activated plugins).
344
+ *
345
+ * @link https://github.com/Freemius/wordpress-sdk/issues/26
346
+ */
347
+ // $active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
348
+
349
+ $active_plugins = get_option( 'active_plugins' );
350
+ $newest_sdk_plugin_key = array_search( $fs_active_plugins->newest->plugin_path, $active_plugins );
351
+ if ( 0 == $newest_sdk_plugin_key ) {
352
+ // if it's 0 it's the first plugin already, no need to continue
353
+ return false;
354
+ }
355
+
356
+ array_splice( $active_plugins, $newest_sdk_plugin_key, 1 );
357
+ array_unshift( $active_plugins, $fs_active_plugins->newest->plugin_path );
358
+ update_option( 'active_plugins', $active_plugins );
359
+
360
+ return true;
361
+ }
362
+
363
+ /**
364
+ * Go over all Freemius SDKs in the system and find and "remember"
365
+ * the newest SDK which is associated with an active plugin.
366
+ *
367
+ * @author Vova Feldman (@svovaf)
368
+ * @since 1.1.6
369
+ *
370
+ * @global $fs_active_plugins
371
+ */
372
+ function fs_fallback_to_newest_active_sdk() {
373
+ global $fs_active_plugins;
374
+
375
+ /**
376
+ * @var object $newest_sdk_data
377
+ */
378
+ $newest_sdk_data = null;
379
+ $newest_sdk_path = null;
380
+
381
+ foreach ( $fs_active_plugins->plugins as $sdk_relative_path => $data ) {
382
+ if ( is_null( $newest_sdk_data ) || version_compare( $data->version, $newest_sdk_data->version, '>' )
383
+ ) {
384
+ // If plugin inactive or SDK starter file doesn't exist, remove SDK reference.
385
+ if ( ! is_plugin_active( $data->plugin_path ) ||
386
+ ! file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $sdk_relative_path . '/start.php' ) )
387
+ ) {
388
+ unset( $fs_active_plugins->plugins[ $sdk_relative_path ] );
389
+
390
+ // No need to store the data since it will be stored in fs_update_sdk_newest_version()
391
+ // or explicitly with update_option().
392
+ } else {
393
+ $newest_sdk_data = $data;
394
+ $newest_sdk_path = $sdk_relative_path;
395
+ }
396
+ }
397
+ }
398
+
399
+ if ( is_null( $newest_sdk_data ) ) {
400
+ // Couldn't find any SDK reference.
401
+ $fs_active_plugins = new stdClass();
402
+ update_option( 'fs_active_plugins', $fs_active_plugins );
403
+ } else {
404
+ fs_update_sdk_newest_version( $newest_sdk_path, $newest_sdk_data->plugin_path );
405
+ }
406
+ }
407
+
408
+ #region Actions / Filters -----------------------------------------
409
+
410
+ /**
411
+ * Apply filter for specific plugin.
412
+ *
413
+ * @author Vova Feldman (@svovaf)
414
+ * @since 1.0.9
415
+ *
416
+ * @param string $slug Plugin slug
417
+ * @param string $tag The name of the filter hook.
418
+ * @param mixed $value The value on which the filters hooked to `$tag` are applied on.
419
+ *
420
+ * @return mixed The filtered value after all hooked functions are applied to it.
421
+ *
422
+ * @uses apply_filters()
423
+ */
424
+ function fs_apply_filter( $slug, $tag, $value ) {
425
+ $args = func_get_args();
426
+
427
+ return call_user_func_array( 'apply_filters', array_merge(
428
+ array( "fs_{$tag}_{$slug}" ),
429
+ array_slice( $args, 2 ) )
430
+ );
431
+ }
432
+
433
+ #endregion Actions / Filters -----------------------------------------
freemius/includes/fs-plugin-info-dialog.php ADDED
@@ -0,0 +1,930 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Plugin_Info_Dialog
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.1.7
18
+ */
19
+ class FS_Plugin_Info_Dialog {
20
+ /**
21
+ * @since 1.1.7
22
+ *
23
+ * @var FS_Logger
24
+ */
25
+ private $_logger;
26
+
27
+ /**
28
+ * @since 1.1.7
29
+ *
30
+ * @var Freemius
31
+ */
32
+ private $_fs;
33
+
34
+ function __construct( Freemius $fs ) {
35
+ $this->_fs = $fs;
36
+
37
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $fs->get_slug() . '_info', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
38
+
39
+ // Remove default plugin information action.
40
+ remove_all_actions( 'install_plugins_pre_plugin-information' );
41
+
42
+ // Override action with custom plugins function for add-ons.
43
+ add_action( 'install_plugins_pre_plugin-information', array( &$this, 'install_plugin_information' ) );
44
+
45
+ // Override request for plugin information for Add-ons.
46
+ add_filter(
47
+ 'fs_plugins_api',
48
+ array( &$this, '_get_addon_info_filter' ),
49
+ WP_FS__DEFAULT_PRIORITY, 3 );
50
+ }
51
+
52
+ /**
53
+ * Generate add-on plugin information.
54
+ *
55
+ * @author Vova Feldman (@svovaf)
56
+ * @since 1.0.6
57
+ *
58
+ * @param array $data
59
+ * @param string $action
60
+ * @param object|null $args
61
+ *
62
+ * @return array|null
63
+ */
64
+ function _get_addon_info_filter( $data, $action = '', $args = null ) {
65
+ $this->_logger->entrance();
66
+
67
+ $parent_plugin_id = fs_request_get( 'parent_plugin_id', false );
68
+
69
+ if ( $this->_fs->get_id() != $parent_plugin_id ||
70
+ ( 'plugin_information' !== $action ) ||
71
+ ! isset( $args->slug )
72
+ ) {
73
+ return $data;
74
+ }
75
+
76
+ // Find add-on by slug.
77
+ $selected_addon = $this->_fs->get_addon_by_slug($args->slug, WP_FS__DEV_MODE);
78
+
79
+ if ( false === $selected_addon ) {
80
+ return $data;
81
+ }
82
+
83
+ if ( ! isset( $selected_addon->info ) ) {
84
+ // Setup some default info.
85
+ $selected_addon->info = new stdClass();
86
+ $selected_addon->info->selling_point_0 = 'Selling Point 1';
87
+ $selected_addon->info->selling_point_1 = 'Selling Point 2';
88
+ $selected_addon->info->selling_point_2 = 'Selling Point 3';
89
+ $selected_addon->info->description = '<p>Tell your users all about your add-on</p>';
90
+ }
91
+
92
+ fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
93
+
94
+ $data = $args;
95
+
96
+ $is_free = true;
97
+
98
+ // Load add-on pricing.
99
+ $has_pricing = false;
100
+ $has_features = false;
101
+ $plans = false;
102
+ $plans_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans.json?type=visible" );
103
+ if ( ! isset( $plans_result->error ) ) {
104
+ $plans = $plans_result->plans;
105
+ if ( is_array( $plans ) ) {
106
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
107
+ $plans[ $i ] = new FS_Plugin_Plan( $plans[ $i ] );
108
+ $plan = $plans[ $i ];
109
+
110
+ $pricing_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans/{$plan->id}/pricing.json" );
111
+ if ( ! isset( $pricing_result->error ) ) {
112
+ // Update plan's pricing.
113
+ $plan->pricing = $pricing_result->pricing;
114
+
115
+ if ( is_array( $plan->pricing ) && ! empty( $plan->pricing ) ) {
116
+ $is_free = false;
117
+
118
+ foreach ( $plan->pricing as &$pricing ) {
119
+ $pricing = new FS_Pricing( $pricing );
120
+ }
121
+ }
122
+
123
+ $has_pricing = true;
124
+ }
125
+
126
+ $features_result = $this->_fs->get_api_site_or_plugin_scope()->get( "/addons/{$selected_addon->id}/plans/{$plan->id}/features.json" );
127
+ if ( ! isset( $features_result->error ) &&
128
+ is_array( $features_result->features ) &&
129
+ 0 < count( $features_result->features )
130
+ ) {
131
+ // Update plan's pricing.
132
+ $plan->features = $features_result->features;
133
+
134
+ $has_features = true;
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ // Fetch latest version from Freemius.
141
+ $latest = $this->_fs->_fetch_latest_version( $selected_addon->id );
142
+
143
+ if ( ! $is_free ) {
144
+ // If paid add-on, then it's not on wordpress.org
145
+ $is_wordpress_org = false;
146
+ } else {
147
+ // If no versions found, then assume it's a .org plugin.
148
+ $is_wordpress_org = ( false === $latest );
149
+ }
150
+
151
+ if ( $is_wordpress_org ) {
152
+ $repo_data = FS_Plugin_Updater::_fetch_plugin_info_from_repository(
153
+ 'plugin_information', (object) array(
154
+ 'slug' => $selected_addon->slug,
155
+ 'is_ssl' => is_ssl(),
156
+ 'fields' => array(
157
+ 'banners' => true,
158
+ 'reviews' => true,
159
+ 'downloaded' => false,
160
+ 'active_installs' => true
161
+ )
162
+ ) );
163
+
164
+ if ( ! empty( $repo_data ) ) {
165
+ $data = $repo_data;
166
+ $data->wp_org_missing = false;
167
+ } else {
168
+ // Couldn't find plugin on .org.
169
+ $is_wordpress_org = false;
170
+
171
+ // Plugin is missing, not on Freemius nor WP.org.
172
+ $data->wp_org_missing = true;
173
+ }
174
+ }
175
+
176
+ if ( ! $is_wordpress_org ) {
177
+ $data->checkout_link = $this->_fs->checkout_url();
178
+ $data->fs_missing = ( false === $latest );
179
+
180
+ if ( $is_free ) {
181
+ $data->download_link = $this->_fs->_get_latest_download_local_url( $selected_addon->id );
182
+ }
183
+ }
184
+
185
+ if ( ! $is_wordpress_org ) {
186
+ // Fetch as much as possible info from local files.
187
+ $plugin_local_data = $this->_fs->get_plugin_data();
188
+ $data->name = $selected_addon->title;
189
+ $data->author = $plugin_local_data['Author'];
190
+ $view_vars = array( 'plugin' => $selected_addon );
191
+ $data->sections = array(
192
+ 'description' => fs_get_template( '/plugin-info/description.php', $view_vars ),
193
+ );
194
+
195
+ if ( ! empty( $selected_addon->info->banner_url ) ) {
196
+ $data->banners = array(
197
+ 'low' => $selected_addon->info->banner_url,
198
+ );
199
+ }
200
+
201
+ if ( ! empty( $selected_addon->info->screenshots ) ) {
202
+ $view_vars = array(
203
+ 'screenshots' => $selected_addon->info->screenshots,
204
+ 'plugin' => $selected_addon,
205
+ );
206
+ $data->sections['screenshots'] = fs_get_template( '/plugin-info/screenshots.php', $view_vars );
207
+ }
208
+
209
+ if ( is_object( $latest ) ) {
210
+ $data->version = $latest->version;
211
+ $data->last_updated = ! is_null( $latest->updated ) ? $latest->updated : $latest->created;
212
+ $data->requires = $latest->requires_platform_version;
213
+ $data->tested = $latest->tested_up_to_version;
214
+ } else {
215
+ // Add dummy version.
216
+ $data->version = '1.0.0';
217
+
218
+ // Add message to developer to deploy the plugin through Freemius.
219
+ }
220
+ }
221
+
222
+ if ( $has_pricing ) {
223
+ // Add plans to data.
224
+ $data->plans = $plans;
225
+
226
+ if ( $has_features ) {
227
+ $view_vars = array(
228
+ 'plans' => $plans,
229
+ 'plugin' => $selected_addon,
230
+ );
231
+ $data->sections['features'] = fs_get_template( '/plugin-info/features.php', $view_vars );
232
+ }
233
+ }
234
+
235
+ $data->is_paid = ! $is_free;
236
+ $data->external = ! $is_wordpress_org;
237
+
238
+ return $data;
239
+ }
240
+
241
+ /**
242
+ * @author Vova Feldman (@svovaf)
243
+ * @since 1.1.7
244
+ *
245
+ * @param FS_Plugin_Plan $plan
246
+ *
247
+ * @return string
248
+ */
249
+ private function get_billing_cycle( FS_Plugin_Plan $plan ) {
250
+ $billing_cycle = null;
251
+
252
+ if ( 1 === count( $plan->pricing ) && 1 == $plan->pricing[0]->licenses ) {
253
+ $pricing = $plan->pricing[0];
254
+ if ( isset( $pricing->annual_price ) ) {
255
+ $billing_cycle = 'annual';
256
+ } else if ( isset( $pricing->monthly_price ) ) {
257
+ $billing_cycle = 'monthly';
258
+ } else if ( isset( $pricing->lifetime_price ) ) {
259
+ $billing_cycle = 'lifetime';
260
+ }
261
+ } else {
262
+ foreach ( $plan->pricing as $pricing ) {
263
+ if ( isset( $pricing->annual_price ) ) {
264
+ $billing_cycle = 'annual';
265
+ } else if ( isset( $pricing->monthly_price ) ) {
266
+ $billing_cycle = 'monthly';
267
+ } else if ( isset( $pricing->lifetime_price ) ) {
268
+ $billing_cycle = 'lifetime';
269
+ }
270
+
271
+ if ( ! is_null( $billing_cycle ) ) {
272
+ break;
273
+ }
274
+ }
275
+ }
276
+
277
+ return $billing_cycle;
278
+ }
279
+
280
+ /**
281
+ * @author Vova Feldman (@svovaf)
282
+ * @since 1.1.7
283
+ *
284
+ * @param FS_Plugin_Plan $plan
285
+ * @param FS_Pricing $pricing
286
+ *
287
+ * @return float|null|string
288
+ */
289
+ private function get_price_tag( FS_Plugin_Plan $plan, FS_Pricing $pricing ) {
290
+ $price_tag = '';
291
+ if ( isset( $pricing->annual_price ) ) {
292
+ $price_tag = $pricing->annual_price . ( $plan->is_block_features ? ' / year' : '' );
293
+ } else if ( isset( $pricing->monthly_price ) ) {
294
+ $price_tag = $pricing->monthly_price . ' / mo';
295
+ } else if ( isset( $pricing->lifetime_price ) ) {
296
+ $price_tag = $pricing->lifetime_price;
297
+ }
298
+
299
+ return '$' . $price_tag;
300
+ }
301
+
302
+ /**
303
+ * @author Vova Feldman (@svovaf)
304
+ * @since 1.1.7
305
+ *
306
+ * @param object $api
307
+ * @param FS_Plugin_Plan|null $plan
308
+ *
309
+ * @return string
310
+ */
311
+ private function get_plugin_cta( $api, $plan = null ) {
312
+ if ( ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
313
+
314
+ if ( ! empty( $api->checkout_link ) && isset( $api->plans ) && 0 < is_array( $api->plans ) ) {
315
+ if ( is_null( $plan ) ) {
316
+ $plan = $api->plans[0];
317
+ }
318
+
319
+ return ' <a class="button button-primary right" href="' . $this->_fs->addon_checkout_url(
320
+ $plan->plugin_id,
321
+ $plan->pricing[0]->id,
322
+ $this->get_billing_cycle( $plan ),
323
+ $plan->has_trial()
324
+ ) . '" target="_parent">' .
325
+ ( ! $plan->has_trial() ?
326
+ __fs( 'purchase', $api->slug ) :
327
+ sprintf( __fs( 'start-free-x', $api->slug ), $this->get_trial_period( $plan ) )
328
+ ) .
329
+ '</a>';
330
+
331
+ // @todo Add Cart concept.
332
+ // echo ' <a class="button right" href="' . $status['url'] . '" target="_parent">' . __( 'Add to Cart' ) . '</a>';
333
+
334
+ } else if ( ! empty( $api->download_link ) ) {
335
+ $status = install_plugin_install_status( $api );
336
+
337
+ // Hosted on WordPress.org.
338
+ switch ( $status['status'] ) {
339
+ case 'install':
340
+ if ( $api->external &&
341
+ $this->_fs->is_org_repo_compliant() ||
342
+ ! $this->_fs->is_premium()
343
+ ) {
344
+ /**
345
+ * Add-on hosted on Freemius, not yet installed, and core
346
+ * plugin is wordpress.org compliant. Therefore, require a download
347
+ * since installing external plugins is not allowed by the wp.org guidelines.
348
+ */
349
+ return ' <a class="button button-primary right" href="' . esc_url( $api->download_link ) . '" target="_blank">' . __fs( 'download-latest', $api->slug ) . '</a>';
350
+ } else {
351
+ if ( $status['url'] ) {
352
+ return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
353
+ }
354
+ }
355
+ break;
356
+ case 'update_available':
357
+ if ( $status['url'] ) {
358
+ return '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) . '</a>';
359
+ }
360
+ break;
361
+ case 'newer_installed':
362
+ return '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed' ), $status['version'] ) . '</a>';
363
+ break;
364
+ case 'latest_installed':
365
+ return '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
366
+ break;
367
+ }
368
+
369
+ }
370
+ }
371
+
372
+ return '';
373
+ }
374
+
375
+ /**
376
+ * @author Vova Feldman (@svovaf)
377
+ * @since 1.1.7
378
+ *
379
+ * @param FS_Plugin_Plan $plan
380
+ *
381
+ * @return string
382
+ */
383
+ private function get_trial_period( $plan ) {
384
+ $trial_period = (int) $plan->trial_period;
385
+
386
+ switch ( $trial_period ) {
387
+ case 30:
388
+ return 'month';
389
+ case 60:
390
+ return '2 months';
391
+ default:
392
+ return "{$plan->trial_period} days";
393
+ }
394
+ }
395
+
396
+ /**
397
+ * Display plugin information in dialog box form.
398
+ *
399
+ * Based on core install_plugin_information() function.
400
+ *
401
+ * @author Vova Feldman (@svovaf)
402
+ * @since 1.0.6
403
+ */
404
+ function install_plugin_information() {
405
+ global $tab;
406
+
407
+ if ( empty( $_REQUEST['plugin'] ) ) {
408
+ return;
409
+ }
410
+
411
+ $args = array(
412
+ 'slug' => wp_unslash( $_REQUEST['plugin'] ),
413
+ 'is_ssl' => is_ssl(),
414
+ 'fields' => array(
415
+ 'banners' => true,
416
+ 'reviews' => true,
417
+ 'downloaded' => false,
418
+ 'active_installs' => true
419
+ )
420
+ );
421
+
422
+ if ( is_array( $args ) ) {
423
+ $args = (object) $args;
424
+ }
425
+
426
+ if ( ! isset( $args->per_page ) ) {
427
+ $args->per_page = 24;
428
+ }
429
+
430
+ if ( ! isset( $args->locale ) ) {
431
+ $args->locale = get_locale();
432
+ }
433
+
434
+ $api = apply_filters( 'fs_plugins_api', false, 'plugin_information', $args );
435
+
436
+ if ( is_wp_error( $api ) ) {
437
+ wp_die( $api );
438
+ }
439
+
440
+ $plugins_allowedtags = array(
441
+ 'a' => array(
442
+ 'href' => array(),
443
+ 'title' => array(),
444
+ 'target' => array(),
445
+ // Add image style for screenshots.
446
+ 'class' => array()
447
+ ),
448
+ 'style' => array(),
449
+ 'abbr' => array( 'title' => array() ),
450
+ 'acronym' => array( 'title' => array() ),
451
+ 'code' => array(),
452
+ 'pre' => array(),
453
+ 'em' => array(),
454
+ 'strong' => array(),
455
+ 'div' => array( 'class' => array() ),
456
+ 'span' => array( 'class' => array() ),
457
+ 'p' => array(),
458
+ 'ul' => array(),
459
+ 'ol' => array(),
460
+ 'li' => array( 'class' => array() ),
461
+ 'i' => array( 'class' => array() ),
462
+ 'h1' => array(),
463
+ 'h2' => array(),
464
+ 'h3' => array(),
465
+ 'h4' => array(),
466
+ 'h5' => array(),
467
+ 'h6' => array(),
468
+ 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array() ),
469
+ // 'table' => array(),
470
+ // 'td' => array(),
471
+ // 'tr' => array(),
472
+ // 'th' => array(),
473
+ // 'thead' => array(),
474
+ // 'tbody' => array(),
475
+ );
476
+
477
+ $plugins_section_titles = array(
478
+ 'description' => _x( 'Description', 'Plugin installer section title' ),
479
+ 'installation' => _x( 'Installation', 'Plugin installer section title' ),
480
+ 'faq' => _x( 'FAQ', 'Plugin installer section title' ),
481
+ 'screenshots' => _x( 'Screenshots', 'Plugin installer section title' ),
482
+ 'changelog' => _x( 'Changelog', 'Plugin installer section title' ),
483
+ 'reviews' => _x( 'Reviews', 'Plugin installer section title' ),
484
+ 'other_notes' => _x( 'Other Notes', 'Plugin installer section title' ),
485
+ );
486
+
487
+ // Sanitize HTML
488
+ // foreach ( (array) $api->sections as $section_name => $content ) {
489
+ // $api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
490
+ // }
491
+
492
+ foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
493
+ if ( isset( $api->$key ) ) {
494
+ $api->$key = wp_kses( $api->$key, $plugins_allowedtags );
495
+ }
496
+ }
497
+
498
+ // Add after $api->slug is ready.
499
+ $plugins_section_titles['features'] = __fs( 'features-and-pricing', $api->slug );
500
+
501
+ $_tab = esc_attr( $tab );
502
+
503
+ $section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
504
+ if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
505
+ $section_titles = array_keys( (array) $api->sections );
506
+ $section = array_shift( $section_titles );
507
+ }
508
+
509
+ iframe_header( __( 'Plugin Install' ) );
510
+
511
+ $_with_banner = '';
512
+
513
+ // var_dump($api->banners);
514
+ if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
515
+ $_with_banner = 'with-banner';
516
+ $low = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
517
+ $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
518
+ ?>
519
+ <style type="text/css">
520
+ #plugin-information-title.with-banner
521
+ {
522
+ background-image: url( <?php echo esc_url( $low ); ?> );
523
+ }
524
+
525
+ @media only screen and ( -webkit-min-device-pixel-ratio: 1.5 )
526
+ {
527
+ #plugin-information-title.with-banner
528
+ {
529
+ background-image: url( <?php echo esc_url( $high ); ?> );
530
+ }
531
+ }
532
+ </style>
533
+ <?php
534
+ }
535
+
536
+ echo '<div id="plugin-information-scrollable">';
537
+ echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
538
+ echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
539
+
540
+ foreach ( (array) $api->sections as $section_name => $content ) {
541
+ if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
542
+ continue;
543
+ }
544
+
545
+ if ( isset( $plugins_section_titles[ $section_name ] ) ) {
546
+ $title = $plugins_section_titles[ $section_name ];
547
+ } else {
548
+ $title = ucwords( str_replace( '_', ' ', $section_name ) );
549
+ }
550
+
551
+ $class = ( $section_name === $section ) ? ' class="current"' : '';
552
+ $href = add_query_arg( array( 'tab' => $tab, 'section' => $section_name ) );
553
+ $href = esc_url( $href );
554
+ $san_section = esc_attr( $section_name );
555
+ echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
556
+ }
557
+
558
+ echo "</div>\n";
559
+
560
+ ?>
561
+ <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
562
+ <div class="fyi">
563
+ <?php if ( $api->is_paid ) : ?>
564
+ <?php if ( isset( $api->plans ) ) : ?>
565
+ <div class="plugin-information-pricing">
566
+ <?php foreach ( $api->plans as $plan ) : ?>
567
+ <?php
568
+ /**
569
+ * @var FS_Plugin_Plan $plan
570
+ */
571
+ ?>
572
+ <?php $first_pricing = $plan->pricing[0] ?>
573
+ <?php $is_multi_cycle = $first_pricing->is_multi_cycle() ?>
574
+ <div class="fs-plan<?php if ( ! $is_multi_cycle ) {
575
+ echo ' fs-single-cycle';
576
+ } ?>" data-plan-id="<?php echo $plan->id ?>">
577
+ <h3 data-plan="<?php echo $plan->id ?>"><?php printf( __fs( 'x-plan', $api->slug ), $plan->title ) ?></h3>
578
+ <?php $has_annual = $first_pricing->has_annual() ?>
579
+ <?php $has_monthly = $first_pricing->has_monthly() ?>
580
+ <div class="nav-tab-wrapper">
581
+ <?php $billing_cycles = array( 'monthly', 'annual', 'lifetime' ) ?>
582
+ <?php $i = 0;
583
+ foreach ( $billing_cycles as $cycle ) : ?>
584
+ <?php $prop = "{$cycle}_price";
585
+ if ( isset( $first_pricing->{$prop} ) ) : ?>
586
+ <?php $is_featured = ( 'annual' === $cycle && $is_multi_cycle ) ?>
587
+ <?php
588
+ $prices = array();
589
+ foreach ( $plan->pricing as $pricing ) {
590
+ if ( isset( $pricing->{$prop} ) ) {
591
+ $prices[] = array(
592
+ 'id' => $pricing->id,
593
+ 'licenses' => $pricing->licenses,
594
+ 'price' => $pricing->{$prop}
595
+ );
596
+ }
597
+ }
598
+ ?>
599
+ <a class="nav-tab" data-billing-cycle="<?php echo $cycle ?>"
600
+ data-pricing="<?php echo esc_attr( json_encode( $prices ) ) ?>">
601
+ <?php if ( $is_featured ) : ?>
602
+ <label>&#9733; <?php _efs( 'best', $api->slug ) ?> &#9733;</label>
603
+ <?php endif ?>
604
+ <?php _efs( $cycle, $api->slug ) ?>
605
+ </a>
606
+ <?php endif ?>
607
+ <?php $i ++; endforeach ?>
608
+ <?php wp_enqueue_script( 'jquery' ) ?>
609
+ <script type="text/javascript">
610
+ (function ($, undef) {
611
+ var
612
+ _formatBillingFrequency = function (cycle) {
613
+ switch (cycle) {
614
+ case 'monthly':
615
+ return '<?php printf(__fs('billed-x', $api->slug), __fs('monthly', $api->slug)) ?>';
616
+ case 'annual':
617
+ return '<?php printf(__fs('billed-x', $api->slug), __fs('annually', $api->slug)) ?>';
618
+ case 'lifetime':
619
+ return '<?php printf(__fs('billed-x', $api->slug), __fs('once', $api->slug)) ?>';
620
+ }
621
+ },
622
+ _formatLicensesTitle = function (pricing) {
623
+ switch (pricing.licenses) {
624
+ case 1:
625
+ return '<?php _efs( 'license-single-site', $api->slug ) ?>';
626
+ case null:
627
+ return '<?php _efs( 'license-unlimited', $api->slug ) ?>';
628
+ default:
629
+ return '<?php _efs( 'license-x-sites', $api->slug ) ?>'.replace('%s', pricing.licenses);
630
+ }
631
+ },
632
+ _formatPrice = function (pricing, cycle, multipleLicenses) {
633
+ if (undef === multipleLicenses)
634
+ multipleLicenses = true;
635
+
636
+ var priceCycle;
637
+ switch (cycle) {
638
+ case 'monthly':
639
+ priceCycle = ' / <?php _efs('mo', $api->slug) ?>';
640
+ break;
641
+ case 'lifetime':
642
+ priceCycle = '';
643
+ break;
644
+ case 'annual':
645
+ default:
646
+ priceCycle = ' / <?php _efs('year', $api->slug) ?>';
647
+ break;
648
+ }
649
+
650
+ if (!multipleLicenses && 1 == pricing.licenses) {
651
+ return '$' + pricing.price + priceCycle;
652
+ }
653
+
654
+ return _formatLicensesTitle(pricing) + ' - <var class="fs-price">$' + pricing.price + priceCycle + '</var>';
655
+ },
656
+ _checkoutUrl = function (plan, pricing, cycle) {
657
+ return '<?php echo esc_url_raw(remove_query_arg('billing_cycle', add_query_arg(array('plugin_id' => $plan->plugin_id), $api->checkout_link))) ?>' +
658
+ '&plan_id=' + plan +
659
+ '&pricing_id=' + pricing +
660
+ '&billing_cycle=' + cycle<?php if ($plan->has_trial()) { echo " + '&trial=true'"; }?>;
661
+ },
662
+ _updateCtaUrl = function (plan, pricing, cycle) {
663
+ $('.plugin-information-pricing .button, #plugin-information-footer .button').attr('href', _checkoutUrl(plan, pricing, cycle));
664
+ };
665
+
666
+ $(document).ready(function () {
667
+ var $plan = $('.plugin-information-pricing .fs-plan[data-plan-id=<?php echo $plan->id ?>]');
668
+ $plan.find('input[type=radio]').live('click', function () {
669
+ _updateCtaUrl(
670
+ $plan.attr('data-plan-id'),
671
+ $(this).val(),
672
+ $plan.find('.nav-tab-active').attr('data-billing-cycle')
673
+ );
674
+
675
+ $plan.find('.fs-trial-terms .fs-price').html(
676
+ $(this).parents('label').find('.fs-price').html()
677
+ );
678
+ });
679
+
680
+ $plan.find('.nav-tab').click(function () {
681
+ if ($(this).hasClass('nav-tab-active'))
682
+ return;
683
+
684
+ var $this = $(this),
685
+ billingCycle = $this.attr('data-billing-cycle'),
686
+ pricing = JSON.parse($this.attr('data-pricing')),
687
+ $pricesList = $this.parents('.fs-plan').find('.fs-pricing-body .fs-licenses'),
688
+ html = '';
689
+
690
+ // Un-select previously selected tab.
691
+ $plan.find('.nav-tab').removeClass('nav-tab-active');
692
+
693
+ // Select current tab.
694
+ $this.addClass('nav-tab-active');
695
+
696
+ // Render licenses prices.
697
+ if (1 == pricing.length) {
698
+ html = '<li><label><?php _efs( 'price', $api->slug ) ?>: ' + _formatPrice(pricing[0], billingCycle, false) + '</label></li>';
699
+ } else {
700
+ for (var i = 0; i < pricing.length; i++) {
701
+ html += '<li><label><input name="pricing-<?php echo $plan->id ?>" type="radio" value="' + pricing[i].id + '">' + _formatPrice(pricing[i], billingCycle) + '</label></li>';
702
+ }
703
+ }
704
+ $pricesList.html(html);
705
+
706
+ if (1 < pricing.length) {
707
+ // Select first license option.
708
+ $pricesList.find('li:first input').click();
709
+ }
710
+ else {
711
+ _updateCtaUrl(
712
+ $plan.attr('data-plan-id'),
713
+ pricing[0].id,
714
+ billingCycle
715
+ );
716
+ }
717
+
718
+ // Update billing frequency.
719
+ $plan.find('.fs-billing-frequency').html(_formatBillingFrequency(billingCycle));
720
+
721
+ if ('annual' === billingCycle) {
722
+ $plan.find('.fs-annual-discount').show();
723
+ } else {
724
+ $plan.find('.fs-annual-discount').hide();
725
+ }
726
+ });
727
+
728
+ <?php if ( $has_annual ) : ?>
729
+ // Select annual by default.
730
+ $plan.find('.nav-tab[data-billing-cycle=annual]').click();
731
+ <?php else : ?>
732
+ // Select first tab.
733
+ $plan.find('.nav-tab:first').click();
734
+ <?php endif ?>
735
+ });
736
+ }(jQuery));
737
+ </script>
738
+ </div>
739
+ <div class="fs-pricing-body">
740
+ <span class="fs-billing-frequency"></span>
741
+ <?php $annual_discount = ( $has_annual && $has_monthly ) ? $plan->pricing[0]->annual_discount_percentage() : 0 ?>
742
+ <?php if ( $annual_discount > 0 ) : ?>
743
+ <span
744
+ class="fs-annual-discount"><?php printf( __fs( 'save-x', $api->slug ), $annual_discount . '%' ) ?></span>
745
+ <?php endif ?>
746
+ <ul class="fs-licenses">
747
+ </ul>
748
+ <?php echo $this->get_plugin_cta( $api, $plan ) ?>
749
+ <div style="clear:both"></div>
750
+ <?php if ( $plan->has_trial() ) : ?>
751
+ <?php $trial_period = $this->get_trial_period( $plan ) ?>
752
+ <ul class="fs-trial-terms">
753
+ <li>
754
+ <i class="dashicons dashicons-yes"></i><?php printf( __fs( 'no-commitment-x', $api->slug ), $trial_period ) ?>
755
+ </li>
756
+ <li>
757
+ <i class="dashicons dashicons-yes"></i><?php printf( __fs( 'after-x-pay-as-little-y', $api->slug ), $trial_period, '<var class="fs-price">' . $this->get_price_tag( $plan, $plan->pricing[0] ) . '</var>' ) ?>
758
+ </li>
759
+ </ul>
760
+ <?php endif ?>
761
+ </div>
762
+ </div>
763
+ </div>
764
+ <?php endforeach ?>
765
+ <?php endif ?>
766
+ <?php endif ?>
767
+ <div>
768
+ <h3><?php _efs( 'details', $api->slug ) ?></h3>
769
+ <ul>
770
+ <?php if ( ! empty( $api->version ) ) { ?>
771
+ <li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
772
+ <?php
773
+ }
774
+ if ( ! empty( $api->author ) ) {
775
+ ?>
776
+ <li>
777
+ <strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?>
778
+ </li>
779
+ <?php
780
+ }
781
+ if ( ! empty( $api->last_updated ) ) {
782
+ ?>
783
+ <li><strong><?php _e( 'Last Updated:' ); ?></strong> <span
784
+ title="<?php echo $api->last_updated; ?>">
785
+ <?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
786
+ </span></li>
787
+ <?php
788
+ }
789
+ if ( ! empty( $api->requires ) ) {
790
+ ?>
791
+ <li>
792
+ <strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?>
793
+ </li>
794
+ <?php
795
+ }
796
+ if ( ! empty( $api->tested ) ) {
797
+ ?>
798
+ <li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?>
799
+ </li>
800
+ <?php
801
+ }
802
+ if ( ! empty( $api->downloaded ) ) {
803
+ ?>
804
+ <li>
805
+ <strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?>
806
+ </li>
807
+ <?php
808
+ }
809
+ if ( ! empty( $api->slug ) && empty( $api->external ) ) {
810
+ ?>
811
+ <li><a target="_blank"
812
+ href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page &#187;' ); ?></a>
813
+ </li>
814
+ <?php
815
+ }
816
+ if ( ! empty( $api->homepage ) ) {
817
+ ?>
818
+ <li><a target="_blank"
819
+ href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage &#187;' ); ?></a>
820
+ </li>
821
+ <?php
822
+ }
823
+ if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) {
824
+ ?>
825
+ <li><a target="_blank"
826
+ href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
827
+ </li>
828
+ <?php } ?>
829
+ </ul>
830
+ </div>
831
+ <?php if ( ! empty( $api->rating ) ) { ?>
832
+ <h3><?php _e( 'Average Rating' ); ?></h3>
833
+ <?php wp_star_rating( array(
834
+ 'rating' => $api->rating,
835
+ 'type' => 'percent',
836
+ 'number' => $api->num_ratings
837
+ ) ); ?>
838
+ <small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
839
+ <?php
840
+ }
841
+
842
+ if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
843
+ foreach ( $api->ratings as $key => $ratecount ) {
844
+ // Avoid div-by-zero.
845
+ $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
846
+ ?>
847
+ <div class="counter-container">
848
+ <span class="counter-label"><a
849
+ href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
850
+ target="_blank"
851
+ title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
852
+ <span class="counter-back">
853
+ <span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
854
+ </span>
855
+ <span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
856
+ </div>
857
+ <?php
858
+ }
859
+ }
860
+ if ( ! empty( $api->contributors ) ) {
861
+ ?>
862
+ <h3><?php _e( 'Contributors' ); ?></h3>
863
+ <ul class="contributors">
864
+ <?php
865
+ foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
866
+ if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
867
+ continue;
868
+ }
869
+ if ( empty( $contrib_username ) ) {
870
+ $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
871
+ }
872
+ $contrib_username = sanitize_user( $contrib_username );
873
+ if ( empty( $contrib_profile ) ) {
874
+ echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
875
+ } else {
876
+ echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
877
+ }
878
+ }
879
+ ?>
880
+ </ul>
881
+ <?php if ( ! empty( $api->donate_link ) ) { ?>
882
+ <a target="_blank"
883
+ href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
884
+ <?php } ?>
885
+ <?php } ?>
886
+ </div>
887
+ <div id="section-holder" class="wrap">
888
+ <?php
889
+ if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
890
+ echo '<div class="notice notice-warning"><p>' . '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'This plugin has not been tested with your current version of WordPress.' ) . '</p></div>';
891
+ } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
892
+ echo '<div class="notice notice-warning"><p>' . '<strong>' . __( 'Warning:' ) . '</strong> ' . __( 'This plugin has not been marked as compatible with your version of WordPress.' ) . '</p></div>';
893
+ }
894
+
895
+ foreach ( (array) $api->sections as $section_name => $content ) {
896
+ $content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
897
+ $content = links_add_target( $content, '_blank' );
898
+
899
+ $san_section = esc_attr( $section_name );
900
+
901
+ $display = ( $section_name === $section ) ? 'block' : 'none';
902
+
903
+ if ( 'description' === $section_name &&
904
+ ( ( ! $api->external && $api->wp_org_missing ) ||
905
+ ( $api->external && $api->fs_missing ) )
906
+ ) {
907
+ $missing_notice = array(
908
+ 'type' => 'error',
909
+ 'id' => md5( microtime() ),
910
+ 'message' => __fs( ( $api->is_paid ? 'paid-addon-not-deployed' : 'free-addon-not-deployed' ), $api->slug ),
911
+ );
912
+ fs_require_template( 'admin-notice.php', $missing_notice );
913
+ }
914
+ echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
915
+ echo $content;
916
+ echo "\t</div>\n";
917
+ }
918
+ echo "</div>\n";
919
+ echo "</div>\n";
920
+ echo "</div>\n"; // #plugin-information-scrollable
921
+ echo "<div id='$tab-footer'>\n";
922
+
923
+ echo $this->get_plugin_cta( $api );
924
+
925
+ echo "</div>\n";
926
+
927
+ iframe_footer();
928
+ exit;
929
+ }
930
+ }
freemius/includes/i18n.php ADDED
@@ -0,0 +1,534 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.4
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * All strings can now be overridden.
15
+ *
16
+ * For example, if we want to override:
17
+ * 'you-are-step-away' => 'You are just one step away - %s',
18
+ *
19
+ * We can use the filter:
20
+ * fs_override_i18n( array(
21
+ * 'opt-in-connect' => __( "Yes - I'm in!", '{your-text_domain}' ),
22
+ * 'skip' => __( 'Not today', '{your-text_domain}' ),
23
+ * ), '{plugin_slug}' );
24
+ *
25
+ * Or with the Freemius instance:
26
+ *
27
+ * my_freemius->override_i18n( array(
28
+ * 'opt-in-connect' => __( "Yes - I'm in!", '{your-text_domain}' ),
29
+ * 'skip' => __( 'Not today', '{your-text_domain}' ),
30
+ * );
31
+ */
32
+ global $fs_text;
33
+
34
+ $fs_text = array(
35
+ 'account' => __( 'Account', 'freemius' ),
36
+ 'addon' => __( 'Add On', 'freemius' ),
37
+ 'contact-us' => __( 'Contact Us', 'freemius' ),
38
+ 'contact-support' => __( 'Contact Support', 'freemius' ),
39
+ 'change-ownership' => __( 'Change Ownership', 'freemius' ),
40
+ 'support' => __( 'Support', 'freemius' ),
41
+ 'support-forum' => __( 'Support Forum', 'freemius' ),
42
+ 'add-ons' => __( 'Add Ons', 'freemius' ),
43
+ 'upgrade' => _x( 'Upgrade', 'verb', 'freemius' ),
44
+ 'awesome' => __( 'Awesome', 'freemius' ),
45
+ 'pricing' => _x( 'Pricing', 'noun', 'freemius' ),
46
+ 'price' => _x( 'Price', 'noun', 'freemius' ),
47
+ 'unlimited-updates' => __( 'Unlimited Updates', 'freemius' ),
48
+ 'downgrade' => _x( 'Downgrade', 'verb', 'freemius' ),
49
+ 'cancel-trial' => __( 'Cancel Trial', 'freemius' ),
50
+ 'free-trial' => __( 'Free Trial', 'freemius' ),
51
+ 'start-free-x' => __( 'Start my free %s', 'freemius' ),
52
+ 'no-commitment-x' => __( 'No commitment for %s - cancel anytime', 'freemius' ),
53
+ 'after-x-pay-as-little-y' => __( 'After your free %s, pay as little as %s', 'freemius' ),
54
+ 'details' => __( 'Details', 'freemius' ),
55
+ 'account-details' => __( 'Account Details', 'freemius' ),
56
+ 'delete' => _x( 'Delete', 'verb', 'freemius' ),
57
+ 'show' => _x( 'Show', 'verb', 'freemius' ),
58
+ 'hide' => _x( 'Hide', 'verb', 'freemius' ),
59
+ 'edit' => _x( 'Edit', 'verb', 'freemius' ),
60
+ 'update' => _x( 'Update', 'verb', 'freemius' ),
61
+ 'date' => __( 'Date', 'freemius' ),
62
+ 'amount' => __( 'Amount', 'freemius' ),
63
+ 'invoice' => __( 'Invoice', 'freemius' ),
64
+ 'billing' => __( 'Billing', 'freemius' ),
65
+ 'payments' => __( 'Payments', 'freemius' ),
66
+ 'delete-account' => __( 'Delete Account', 'freemius' ),
67
+ 'dismiss' => _x( 'Dismiss', 'as close a window', 'freemius' ),
68
+ 'plan' => _x( 'Plan', 'as product pricing plan', 'freemius' ),
69
+ 'change-plan' => __( 'Change Plan', 'freemius' ),
70
+ 'download-x-version' => _x( 'Download %s Version', 'as download professional version', 'freemius' ),
71
+ 'download-x-version-now' => _x( 'Download %s version now', 'as download professional version now',
72
+ 'freemius' ),
73
+ 'download-latest' => _x( 'Download Latest', 'as download latest version', 'freemius' ),
74
+ 'you-have-x-license' => _x( 'You have a %s license.', 'E.g. you have a professional license.',
75
+ 'freemius' ),
76
+ 'new' => __( 'New', 'freemius' ),
77
+ 'free' => __( 'Free', 'freemius' ),
78
+ 'trial' => _x( 'Trial', 'as trial plan', 'freemius' ),
79
+ 'start-trial' => _x( 'Start Trial', 'as starting a trial plan', 'freemius' ),
80
+ 'purchase' => _x( 'Purchase', 'verb', 'freemius' ),
81
+ 'purchase-license' => __( 'Purchase License', 'freemius' ),
82
+ 'buy' => _x( 'Buy', 'verb', 'freemius' ),
83
+ 'buy-license' => __( 'Buy License', 'freemius' ),
84
+ 'license-single-site' => __( 'Single Site License', 'freemius' ),
85
+ 'license-unlimited' => __( 'Unlimited Licenses', 'freemius' ),
86
+ 'license-x-sites' => __( 'Up to %s Sites', 'freemius' ),
87
+ 'renew-license-now' => __( '%sRenew your license now%s to access version %s features and support.',
88
+ 'freemius' ),
89
+ 'ask-for-upgrade-email-address' => __( "Enter the email address you've used for the upgrade below and we will resend you the license key.",
90
+ 'freemius' ),
91
+ 'x-plan' => _x( '%s Plan', 'e.g. Professional Plan', 'freemius' ),
92
+ 'you-are-step-away' => __( 'You are just one step away - %s', 'freemius' ),
93
+ 'activate-x-now' => _x( 'Complete "%s" Activation Now',
94
+ '%s - plugin name. As complete "Jetpack" activation now', 'freemius' ),
95
+ 'few-plugin-tweaks' => __( 'We made a few tweaks to the plugin, %s', 'freemius' ),
96
+ 'optin-x-now' => __( 'Opt-in to make "%s" Better!', 'freemius' ),
97
+ 'error' => __( 'Error', 'freemius' ),
98
+ 'failed-finding-main-path' => __( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.',
99
+ 'freemius' ),
100
+ #region Account
101
+
102
+ 'expiration' => _x( 'Expiration', 'as expiration date', 'freemius' ),
103
+ 'license' => _x( 'License', 'as software license', 'freemius' ),
104
+ 'not-verified' => __( 'not verified', 'freemius' ),
105
+ 'verify-email' => __( 'Verify Email', 'freemius' ),
106
+ 'expires-in' => _x( 'Expires in %s', 'e.g. expires in 2 months', 'freemius' ),
107
+ 'renews-in' => _x( 'Auto renews in %s', 'e.g. auto renews in 2 months', 'freemius' ),
108
+ 'no-expiration' => __( 'No expiration', 'freemius' ),
109
+ 'expired' => __( 'Expired', 'freemius' ),
110
+ 'cancelled' => __( 'Cancelled', 'freemius' ),
111
+ 'in-x' => _x( 'In %s', 'e.g. In 2 hours', 'freemius' ),
112
+ 'x-ago' => _x( '%s ago', 'e.g. 2 min ago', 'freemius' ),
113
+ 'version' => _x( 'Version', 'as plugin version', 'freemius' ),
114
+ 'name' => __( 'Name', 'freemius' ),
115
+ 'email' => __( 'Email', 'freemius' ),
116
+ 'email-address' => __( 'Email address', 'freemius' ),
117
+ 'verified' => __( 'Verified', 'freemius' ),
118
+ 'plugin' => __( 'Plugin', 'freemius' ),
119
+ 'plugins' => __( 'Plugins', 'freemius' ),
120
+ 'themes' => __( 'Themes', 'freemius' ),
121
+ 'path' => _x( 'Path', 'as file/folder path', 'freemius' ),
122
+ 'title' => __( 'Title', 'freemius' ),
123
+ 'free-version' => __( 'Free version', 'freemius' ),
124
+ 'premium-version' => __( 'Premium version', 'freemius' ),
125
+ 'slug' => _x( 'Slug', 'as WP plugin slug', 'freemius' ),
126
+ 'id' => __( 'ID', 'freemius' ),
127
+ 'users' => __( 'Users', 'freemius' ),
128
+ 'plugin-installs' => __( 'Plugin Installs', 'freemius' ),
129
+ 'sites' => _x( 'Sites', 'like websites', 'freemius' ),
130
+ 'user-id' => __( 'User ID', 'freemius' ),
131
+ 'site-id' => __( 'Site ID', 'freemius' ),
132
+ 'public-key' => __( 'Public Key', 'freemius' ),
133
+ 'secret-key' => __( 'Secret Key', 'freemius' ),
134
+ 'no-secret' => _x( 'No Secret', 'as secret encryption key missing', 'freemius' ),
135
+ 'no-id' => __( 'No ID', 'freemius' ),
136
+ 'sync-license' => _x( 'Sync License', 'as synchronize license', 'freemius' ),
137
+ 'sync' => _x( 'Sync', 'as synchronize', 'freemius' ),
138
+ 'activate-license' => __( 'Activate License', 'freemius' ),
139
+ 'activate-free-version' => __( 'Activate Free Version', 'freemius' ),
140
+ 'activate-license-message' => __( 'Please enter the license key that you received in the email right after the purchase:',
141
+ 'freemius' ),
142
+ 'activating-license' => __( 'Activating license...', 'freemius' ),
143
+ 'change-license' => __( 'Change License', 'freemius' ),
144
+ 'update-license' => __( 'Update License', 'freemius' ),
145
+ 'deactivate-license' => __( 'Deactivate License', 'freemius' ),
146
+ 'activate' => __( 'Activate', 'freemius' ),
147
+ 'deactivate' => __( 'Deactivate', 'freemius' ),
148
+ 'skip-deactivate' => __( 'Skip & Deactivate', 'freemius' ),
149
+ 'no-deactivate' => __( 'No - just deactivate', 'freemius' ),
150
+ 'yes-do-your-thing' => __( 'Yes - do your thing', 'freemius' ),
151
+ 'active' => _x( 'Active', 'active mode', 'freemius' ),
152
+ 'is-active' => _x( 'Is Active', 'is active mode?', 'freemius' ),
153
+ 'install-now' => __( 'Install Now', 'freemius' ),
154
+ 'install-update-now' => __( 'Install Update Now', 'freemius' ),
155
+ 'more-information-about-x' => __( 'More information about %s', 'freemius' ),
156
+ 'localhost' => __( 'Localhost', 'freemius' ),
157
+ 'activate-x-plan' => _x( 'Activate %s Plan', 'as activate Professional plan', 'freemius' ),
158
+ 'x-left' => _x( '%s left', 'as 5 licenses left', 'freemius' ),
159
+ 'last-license' => __( 'Last license', 'freemius' ),
160
+ 'what-is-your-x' => __( 'What is your %s?', 'freemius' ),
161
+ 'activate-this-addon' => __( 'Activate this add-on', 'freemius' ),
162
+ 'deactivate-license-confirm' => __( 'Deactivating your license will block all premium features, but will enable you to activate the license on another site. Are you sure you want to proceed?',
163
+ 'freemius' ),
164
+ 'delete-account-x-confirm' => __( 'Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the "Cancel" button, and first "Downgrade" your account. Are you sure you would like to continue with the deletion?',
165
+ 'freemius' ),
166
+ 'delete-account-confirm' => __( 'Deletion is not temporary. Only delete if you no longer want to use this plugin anymore. Are you sure you would like to continue with the deletion?',
167
+ 'freemius' ),
168
+ 'downgrade-x-confirm' => __( 'Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s.',
169
+ 'freemius' ),
170
+ 'cancel-trial-confirm' => __( 'Cancelling the trial will immediately block access to all premium features. Are you sure?',
171
+ 'freemius' ),
172
+ 'after-downgrade-non-blocking' => __( 'You can still enjoy all %s features but you will not have access to plugin updates and support.',
173
+ 'freemius' ),
174
+ 'after-downgrade-blocking' => __( 'Once your license expire you can still use the Free version but you will NOT have access to the %s features.',
175
+ 'freemius' ),
176
+ 'proceed-confirmation' => __( 'Are you sure you want to proceed?', 'freemius' ),
177
+ #endregion Account
178
+
179
+ 'add-ons-for-x' => __( 'Add Ons for %s', 'freemius' ),
180
+ 'add-ons-missing' => __( 'We could\'nt load the add-ons list. It\'s probably an issue on our side, please try to come back in few minutes.',
181
+ 'freemius' ),
182
+ #region Plugin Deactivation
183
+ 'anonymous-feedback' => __( 'Anonymous feedback', 'freemius' ),
184
+ 'quick-feedback' => __( 'Quick feedback', 'freemius' ),
185
+ 'deactivation-share-reason' => __( 'If you have a moment, please let us know why you are deactivating',
186
+ 'freemius' ),
187
+ 'deactivation-modal-button-confirm' => __( 'Yes - Deactivate', 'freemius' ),
188
+ 'deactivation-modal-button-submit' => __( 'Submit & Deactivate', 'freemius' ),
189
+ 'cancel' => __( 'Cancel', 'freemius' ),
190
+ 'reason-no-longer-needed' => __( 'I no longer need the plugin', 'freemius' ),
191
+ 'reason-found-a-better-plugin' => __( 'I found a better plugin', 'freemius' ),
192
+ 'reason-needed-for-a-short-period' => __( 'I only needed the plugin for a short period', 'freemius' ),
193
+ 'reason-broke-my-site' => __( 'The plugin broke my site', 'freemius' ),
194
+ 'reason-suddenly-stopped-working' => __( 'The plugin suddenly stopped working', 'freemius' ),
195
+ 'reason-cant-pay-anymore' => __( "I can't pay for it anymore", 'freemius' ),
196
+ 'reason-temporary-deactivation' => __( "It's a temporary deactivation. I'm just debugging an issue.",
197
+ 'freemius' ),
198
+ 'reason-other' => _x( 'Other',
199
+ 'the text of the "other" reason for deactivating the plugin that is shown in the modal box.', 'freemius' ),
200
+ 'ask-for-reason-message' => __( 'Kindly tell us the reason so we can improve.', 'freemius' ),
201
+ 'placeholder-plugin-name' => __( "What's the plugin's name?", 'freemius' ),
202
+ 'placeholder-comfortable-price' => __( 'What price would you feel comfortable paying?', 'freemius' ),
203
+ 'reason-couldnt-make-it-work' => __( "I couldn't understand how to make it work", 'freemius' ),
204
+ 'reason-great-but-need-specific-feature' => __( "The plugin is great, but I need specific feature that you don't support",
205
+ 'freemius' ),
206
+ 'reason-not-working' => __( 'The plugin is not working', 'freemius' ),
207
+ 'reason-not-what-i-was-looking-for' => __( "It's not what I was looking for", 'freemius' ),
208
+ 'reason-didnt-work-as-expected' => __( "The plugin didn't work as expected", 'freemius' ),
209
+ 'placeholder-feature' => __( 'What feature?', 'freemius' ),
210
+ 'placeholder-share-what-didnt-work' => __( "Kindly share what didn't work so we can fix it for future users...",
211
+ 'freemius' ),
212
+ 'placeholder-what-youve-been-looking-for' => __( "What you've been looking for?", 'freemius' ),
213
+ 'placeholder-what-did-you-expect' => __( "What did you expect?", 'freemius' ),
214
+ 'reason-didnt-work' => __( "The plugin didn't work", 'freemius' ),
215
+ 'reason-dont-like-to-share-my-information' => __( "I don't like to share my information with you", 'freemius' ),
216
+ 'dont-have-to-share-any-data' => __( "You might have missed it, but you don't have to share any data and can just %s the opt-in.",
217
+ 'freemius' ),
218
+ #endregion Plugin Deactivation
219
+
220
+ #region Connect
221
+ 'hey-x' => _x( 'Hey %s,', 'greeting', 'freemius' ),
222
+ 'thanks-x' => _x( 'Thanks %s!', 'a greeting. E.g. Thanks John!', 'freemius' ),
223
+ 'connect-message' => __( 'Never miss an important update - opt-in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s.',
224
+ 'freemius' ),
225
+ 'connect-message_on-update' => __( 'Please help us improve %1$s! If you opt-in, some data about your usage of %1$s will be sent to %4$s. If you skip this, that\'s okay! %1$s will still work just fine.',
226
+ 'freemius' ),
227
+ 'pending-activation-message' => __( '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.', 'freemius' ),
228
+ 'complete-the-install' => __( 'complete the install', 'freemius' ),
229
+ 'start-the-trial' => __( 'start the trial', 'freemius' ),
230
+ 'thanks-for-purchasing' => __( 'Thanks for purchasing %s! To get started, please enter your license key:',
231
+ 'freemius' ),
232
+ 'license-sync-disclaimer' => __( 'The plugin will be periodically sending data to %s to check for plugin updates and verify the validity of your license.',
233
+ 'freemius' ),
234
+ 'what-permissions' => __( 'What permissions are being granted?', 'freemius' ),
235
+ 'permissions-profile' => __( 'Your Profile Overview', 'freemius' ),
236
+ 'permissions-profile_desc' => __( 'Name and email address', 'freemius' ),
237
+ 'permissions-site' => __( 'Your Site Overview', 'freemius' ),
238
+ 'permissions-site_desc' => __( 'Site URL, WP version, PHP info, plugins & themes',
239
+ 'freemius' ),
240
+ 'permissions-events' => __( 'Current Plugin Events', 'freemius' ),
241
+ 'permissions-events_desc' => __( 'Activation, deactivation and uninstall', 'freemius' ),
242
+ 'permissions-plugins_themes' => __( 'Plugins & Themes', 'freemius' ),
243
+ 'permissions-plugins_themes_desc' => __( 'Titles, versions and state.', 'freemius' ),
244
+ 'permissions-admin-notices' => __( 'Admin Notices', 'freemius' ),
245
+ 'permissions-newsletter' => __( 'Newsletter', 'freemius' ),
246
+ 'permissions-newsletter_desc' => __( 'Updates, announcements, marketing, no spam', 'freemius' ),
247
+ 'privacy-policy' => __( 'Privacy Policy', 'freemius' ),
248
+ 'tos' => __( 'Terms of Service', 'freemius' ),
249
+ 'activating' => _x( 'Activating', 'as activating plugin', 'freemius' ),
250
+ 'sending-email' => _x( 'Sending email', 'as in the process of sending an email',
251
+ 'freemius' ),
252
+ 'opt-in-connect' => _x( 'Allow & Continue', 'button label', 'freemius' ),
253
+ 'agree-activate-license' => _x( 'Agree & Activate License', 'button label', 'freemius' ),
254
+ 'skip' => _x( 'Skip', 'verb', 'freemius' ),
255
+ 'click-here-to-use-plugin-anonymously' => __( 'Click here to use the plugin anonymously', 'freemius' ),
256
+ 'resend-activation-email' => __( 'Re-send activation email', 'freemius' ),
257
+ 'license-key' => __( 'License key', 'freemius' ),
258
+ 'send-license-key' => __( 'Send License Key', 'freemius' ),
259
+ 'sending-license-key' => __( 'Sending license key', 'freemius' ),
260
+ 'have-license-key' => __( 'Have a license key?', 'freemius' ),
261
+ 'dont-have-license-key' => __( 'Don\'t have a license key?', 'freemius' ),
262
+ 'cant-find-license-key' => __( "Can't find your license key?", 'freemius' ),
263
+ 'email-not-found' => __( "We couldn't find your email address in the system, are you sure it's the right address?",
264
+ 'freemius' ),
265
+ 'no-active-licenses' => __( "We can't see any active licenses associated with that email address, are you sure it's the right address?",
266
+ 'freemius' ),
267
+ 'opt-in' => __( 'Opt In', 'freemius' ),
268
+ 'opt-out' => __( 'Opt Out', 'freemius' ),
269
+ 'opt-out-cancel' => __( 'On second thought - I want to continue helping',
270
+ 'freemius' ),
271
+ 'opting-out' => __( 'Opting out...', 'freemius' ),
272
+ 'opting-in' => __( 'Opting in...', 'freemius' ),
273
+ 'opt-out-message-appreciation' => __( 'We appreciate your help in making the %s better by letting us track some usage data.',
274
+ 'freemius' ),
275
+ 'opt-out-message-usage-tracking' => __( "Usage tracking is done in the name of making %s better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking.",
276
+ 'freemius' ),
277
+ 'opt-out-message-clicking-opt-out' => __( 'By clicking "Opt Out", we will no longer be sending any data from %s to %s.',
278
+ 'freemius' ),
279
+ #endregion Connect
280
+
281
+ #region Screenshots
282
+ 'screenshots' => __( 'Screenshots', 'freemius' ),
283
+ 'view-full-size-x' => __( 'Click to view full-size screenshot %d', 'freemius' ),
284
+ #endregion Screenshots
285
+
286
+ #region Debug
287
+ 'freemius-debug' => __( 'Freemius Debug', 'freemius' ),
288
+ 'on' => _x( 'On', 'as turned on', 'freemius' ),
289
+ 'off' => _x( 'Off', 'as turned off', 'freemius' ),
290
+ 'debugging' => _x( 'Debugging', 'as code debugging', 'freemius' ),
291
+ 'freemius-state' => __( 'Freemius State', 'freemius' ),
292
+ 'connected' => _x( 'Connected', 'as connection was successful', 'freemius' ),
293
+ 'blocked' => _x( 'Blocked', 'as connection blocked', 'freemius' ),
294
+ 'api' => _x( 'API', 'as application program interface', 'freemius' ),
295
+ 'sdk' => _x( 'SDK', 'as software development kit versions', 'freemius' ),
296
+ 'sdk-versions' => _x( 'SDK Versions', 'as software development kit versions',
297
+ 'freemius' ),
298
+ 'plugin-path' => _x( 'Plugin Path', 'as plugin folder path', 'freemius' ),
299
+ 'sdk-path' => _x( 'SDK Path', 'as sdk path', 'freemius' ),
300
+ 'addons-of-x' => __( 'Add Ons of Plugin %s', 'freemius' ),
301
+ 'delete-all-confirm' => __( 'Are you sure you want to delete all Freemius data?',
302
+ 'freemius' ),
303
+ 'actions' => __( 'Actions', 'freemius' ),
304
+ 'delete-all-accounts' => __( 'Delete All Accounts', 'freemius' ),
305
+ 'start-fresh' => __( 'Start Fresh', 'freemius' ),
306
+ 'clear-api-cache' => __( 'Clear API Cache', 'freemius' ),
307
+ 'sync-data-from-server' => __( 'Sync Data From Server', 'freemius' ),
308
+ 'scheduled-crons' => __( 'Scheduled Crons', 'freemius' ),
309
+ 'plugins-themes-sync' => __( 'Plugins & Themes Sync', 'freemius' ),
310
+ #endregion Debug
311
+
312
+ #region Expressions
313
+ 'congrats' => _x( 'Congrats', 'as congratulations', 'freemius' ),
314
+ 'oops' => _x( 'Oops', 'exclamation', 'freemius' ),
315
+ 'yee-haw' => _x( 'Yee-haw', 'interjection expressing joy or exuberance',
316
+ 'freemius' ),
317
+ 'woot' => _x( 'W00t',
318
+ '(especially in electronic communication) used to express elation, enthusiasm, or triumph.', 'freemius' ),
319
+ 'right-on' => _x( 'Right on', 'a positive response', 'freemius' ),
320
+ 'hmm' => _x( 'Hmm',
321
+ 'something somebody says when they are thinking about what you have just said. ', 'freemius' ),
322
+ 'ok' => __( 'O.K', 'freemius' ),
323
+ 'hey' => _x( 'Hey', 'exclamation', 'freemius' ),
324
+ 'heads-up' => _x( 'Heads up',
325
+ 'advance notice of something that will need attention.', 'freemius' ),
326
+ #endregion Expressions
327
+
328
+ #region Admin Notices
329
+ 'you-have-latest' => __( 'Seems like you got the latest release.', 'freemius' ),
330
+ 'you-are-good' => __( 'You are all good!', 'freemius' ),
331
+ 'user-exist-message' => __( 'Sorry, we could not complete the email update. Another user with the same email is already registered.',
332
+ 'freemius' ),
333
+ 'user-exist-message_ownership' => __( 'If you would like to give up the ownership of the plugin\'s account to %s click the Change Ownership button.',
334
+ 'freemius' ),
335
+ 'email-updated-message' => __( 'Your email was successfully updated. You should receive an email with confirmation instructions in few moments.',
336
+ 'freemius' ),
337
+ 'name-updated-message' => __( 'Your name was successfully updated.', 'freemius' ),
338
+ 'x-updated' => __( 'You have successfully updated your %s.', 'freemius' ),
339
+ 'name-update-failed-message' => __( 'Please provide your full name.', 'freemius' ),
340
+ 'verification-email-sent-message' => __( 'Verification mail was just sent to %s. If you can\'t find it after 5 min, please check your spam box.',
341
+ 'freemius' ),
342
+ 'addons-info-external-message' => __( 'Just letting you know that the add-ons information of %s is being pulled from an external server.',
343
+ 'freemius' ),
344
+ 'no-cc-required' => __( 'No credit card required', 'freemius' ),
345
+ 'premium-activated-message' => __( 'Premium plugin version was successfully activated.',
346
+ 'freemius' ),
347
+ 'successful-version-upgrade-message' => __( 'The upgrade of %s was successfully completed.', 'freemius' ),
348
+ 'activation-with-plan-x-message' => __( 'Your account was successfully activated with the %s plan.',
349
+ 'freemius' ),
350
+ 'download-latest-x-version-now' => __( 'Download the latest %s version now', 'freemius' ),
351
+ 'follow-steps-to-complete-upgrade' => __( 'Please follow these steps to complete the upgrade',
352
+ 'freemius' ),
353
+ 'download-latest-x-version' => __( 'Download the latest %s version', 'freemius' ),
354
+ 'download-latest-version' => __( 'Download the latest version', 'freemius' ),
355
+ 'deactivate-free-version' => __( 'Deactivate the free version', 'freemius' ),
356
+ 'upload-and-activate' => __( 'Upload and activate the downloaded version', 'freemius' ),
357
+ 'howto-upload-activate' => __( 'How to upload and activate?', 'freemius' ),
358
+ 'addon-successfully-purchased-message' => _x( '%s Add-on was successfully purchased.',
359
+ '%s - product name, e.g. Facebook add-on was successfully...', 'freemius' ),
360
+ 'addon-successfully-upgraded-message' => __( 'Your %s Add-on plan was successfully upgraded.',
361
+ 'freemius' ),
362
+ 'email-verified-message' => __( 'Your email has been successfully verified - you are AWESOME!',
363
+ 'freemius' ),
364
+ 'plan-upgraded-message' => __( 'Your plan was successfully upgraded.', 'freemius' ),
365
+ 'plan-changed-to-x-message' => __( 'Your plan was successfully changed to %s.', 'freemius' ),
366
+ 'license-expired-blocking-message' => __( 'Your license has expired. You can still continue using the free plugin forever.',
367
+ 'freemius' ),
368
+ 'license-cancelled' => __( 'Your license has been cancelled. If you think it\'s a mistake, please contact support.',
369
+ 'freemius' ),
370
+ 'trial-started-message' => __( 'Your trial has been successfully started.', 'freemius' ),
371
+ 'license-activated-message' => __( 'Your license was successfully activated.', 'freemius' ),
372
+ 'no-active-license-message' => __( 'It looks like your site currently doesn\'t have an active license.',
373
+ 'freemius' ),
374
+ 'license-deactivation-message' => __( 'Your license was successfully deactivated, you are back to the %s plan.',
375
+ 'freemius' ),
376
+ 'license-deactivation-failed-message' => __( 'It looks like the license deactivation failed.',
377
+ 'freemius' ),
378
+ 'license-activation-failed-message' => __( 'It looks like the license could not be activated.',
379
+ 'freemius' ),
380
+ 'server-error-message' => __( 'Error received from the server:', 'freemius' ),
381
+ 'trial-expired-message' => __( 'Your trial has expired. You can still continue using all our free features.',
382
+ 'freemius' ),
383
+ 'plan-x-downgraded-message' => __( 'Your plan was successfully downgraded. Your %s plan license will expire in %s.',
384
+ 'freemius' ),
385
+ 'plan-downgraded-failure-message' => __( 'Seems like we are having some temporary issue with your plan downgrade. Please try again in few minutes.',
386
+ 'freemius' ),
387
+ 'trial-cancel-no-trial-message' => __( 'It looks like you are not in trial mode anymore so there\'s nothing to cancel :)',
388
+ 'freemius' ),
389
+ 'trial-cancel-message' => __( 'Your %s free trial was successfully cancelled.',
390
+ 'freemius' ),
391
+ 'version-x-released' => _x( 'Version %s was released.', '%s - numeric version number',
392
+ 'freemius' ),
393
+ 'please-download-x' => __( 'Please download %s.', 'freemius' ),
394
+ 'latest-x-version' => _x( 'the latest %s version here',
395
+ '%s - plan name, as the latest professional version here', 'freemius' ),
396
+ 'trial-x-promotion-message' => __( 'How do you like %s so far? Test all our %s premium features with a %d-day free trial.',
397
+ 'freemius' ),
398
+ 'start-free-trial' => _x( 'Start free trial', 'call to action', 'freemius' ),
399
+ 'starting-trial' => __( 'Starting trial', 'freemius' ),
400
+ 'please-wait' => __( 'Please wait', 'freemius' ),
401
+ 'trial-cancel-failure-message' => __( 'Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes.',
402
+ 'freemius' ),
403
+ 'trial-utilized' => __( 'You already utilized a trial before.', 'freemius' ),
404
+ 'in-trial-mode' => __( 'You are already running the plugin in a trial mode.',
405
+ 'freemius' ),
406
+ 'trial-plan-x-not-exist' => __( 'Plan %s do not exist, therefore, can\'t start a trial.',
407
+ 'freemius' ),
408
+ 'plan-x-no-trial' => __( 'Plan %s does not support a trial period.', 'freemius' ),
409
+ 'no-trials' => __( 'None of the plugin\'s plans supports a trial period.',
410
+ 'freemius' ),
411
+ 'unexpected-api-error' => __( 'Unexpected API error. Please contact the plugin\'s author with the following error.',
412
+ 'freemius' ),
413
+ 'no-commitment-for-x-days' => __( 'No commitment for %s days - cancel anytime!', 'freemius' ),
414
+ 'license-expired-non-blocking-message' => __( 'Your license has expired. You can still continue using all the %s features, but you\'ll need to renew your license to continue getting updates and support.',
415
+ 'freemius' ),
416
+ 'could-not-activate-x' => __( 'Couldn\'t activate %s.', 'freemius' ),
417
+ 'contact-us-with-error-message' => __( 'Please contact us with the following message:', 'freemius' ),
418
+ 'plan-did-not-change-message' => __( 'It looks like you are still on the %s plan. If you did upgrade or change your plan, it\'s probably an issue on our side - sorry.',
419
+ 'freemius' ),
420
+ 'contact-us-here' => __( 'Please contact us here', 'freemius' ),
421
+ 'plan-did-not-change-email-message' => __( 'I have upgraded my account but when I try to Sync the License, the plan remains %s.',
422
+ 'freemius' ),
423
+ #endregion Admin Notices
424
+ #region Connectivity Issues
425
+ 'connectivity-test-fails-message' => __( 'From unknown reason, the API connectivity test failed.',
426
+ 'freemius' ),
427
+ 'connectivity-test-maybe-temporary' => __( '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?',
428
+ 'freemius' ),
429
+ 'curl-missing-message' => __( 'We use PHP cURL library for the API calls, which is a very common library and usually installed out of the box. Unfortunately, cURL is not installed on your server.',
430
+ 'freemius' ),
431
+ 'cloudflare-blocks-connection-message' => __( 'From unknown reason, CloudFlare, the firewall we use, blocks the connection.',
432
+ 'freemius' ),
433
+ 'x-requires-access-to-api' => _x( '%s requires an access to our API.',
434
+ 'as pluginX requires an access to our API', 'freemius' ),
435
+ 'squid-blocks-connection-message' => __( 'It looks like your server is using Squid ACL (access control lists), which blocks the connection.',
436
+ 'freemius' ),
437
+ 'squid-no-clue-title' => __( 'I don\'t know what is Squid or ACL, help me!', 'freemius' ),
438
+ 'squid-no-clue-desc' => __( '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.',
439
+ 'freemius' ),
440
+ 'sysadmin-title' => __( 'I\'m a system administrator', 'freemius' ),
441
+ 'squid-sysadmin-desc' => __( 'Great, please whitelist the following domains: %s. Once you done, deactivate the plugin and activate it again.',
442
+ 'freemius' ),
443
+ 'curl-missing-no-clue-title' => __( 'I don\'t know what is cURL or how to install it, help me!',
444
+ 'freemius' ),
445
+ 'curl-missing-no-clue-desc' => __( '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.',
446
+ 'freemius' ),
447
+ 'curl-missing-sysadmin-desc' => __( 'Great, please install cURL and enable it in your php.ini file. To make sure it was successfully activated, use \'phpinfo()\'. Once activated, deactivate the plugin and reactivate it back again.',
448
+ 'freemius' ),
449
+ 'happy-to-resolve-issue-asap' => __( '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.',
450
+ 'freemius' ),
451
+ 'contact-support-before-deactivation' => __( 'Sorry for the inconvenience and we are here to help if you give us a chance.',
452
+ 'freemius' ),
453
+ 'fix-issue-title' => __( 'Yes - I\'m giving you a chance to fix it', 'freemius' ),
454
+ 'fix-issue-desc' => __( '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.',
455
+ 'freemius' ),
456
+ 'install-previous-title' => __( 'Let\'s try your previous version', 'freemius' ),
457
+ 'install-previous-desc' => __( 'Uninstall this version and install the previous one.',
458
+ 'freemius' ),
459
+ 'deactivate-plugin-title' => __( 'That\'s exhausting, please deactivate', 'freemius' ),
460
+ 'deactivate-plugin-desc' => __( 'We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future.',
461
+ 'freemius' ),
462
+ 'fix-request-sent-message' => __( '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.',
463
+ 'freemius' ),
464
+ 'server-blocking-access' => _x( 'Your server is blocking the access to Freemius\' API, which is crucial for %1s synchronization. Please contact your host to whitelist %2s',
465
+ '%1s - plugin title, %2s - API domain', 'freemius' ),
466
+ 'wrong-authentication-param-message' => __( 'It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again.',
467
+ 'freemius' ),
468
+ #endregion Connectivity Issues
469
+ #region Change Owner
470
+ 'change-owner-request-sent-x' => __( 'Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder.',
471
+ 'freemius' ),
472
+ 'change-owner-request_owner-confirmed' => __( 'Thanks for confirming the ownership change. An email was just sent to %s for final approval.',
473
+ 'freemius' ),
474
+ 'change-owner-request_candidate-confirmed' => __( '%s is the new owner of the account.', 'freemius' ),
475
+ #endregion Change Owner
476
+ 'addon-x-cannot-run-without-y' => _x( '%s cannot run without %s.',
477
+ 'addonX cannot run without pluginY', 'freemius' ),
478
+ 'addon-x-cannot-run-without-parent' => _x( '%s cannot run without the plugin.', 'addonX cannot run...',
479
+ 'freemius' ),
480
+ 'plugin-x-activation-message' => _x( '%s activation was successfully completed.',
481
+ 'pluginX activation was successfully...', 'freemius' ),
482
+ 'features-and-pricing' => _x( 'Features & Pricing', 'Plugin installer section title',
483
+ 'freemius' ),
484
+ 'free-addon-not-deployed' => __( 'Add-on must be deployed to WordPress.org or Freemius.',
485
+ 'freemius' ),
486
+ 'paid-addon-not-deployed' => __( 'Paid add-on must be deployed to Freemius.', 'freemius' ),
487
+ #--------------------------------------------------------------------------------
488
+ #region Add-On Licensing
489
+ #--------------------------------------------------------------------------------
490
+ 'addon-no-license-message' => __( '%s is a premium only add-on. You have to purchase a license first before activating the plugin.',
491
+ 'freemius' ),
492
+ 'addon-trial-cancelled-message' => __( '%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.',
493
+ 'freemius' ),
494
+ #endregion
495
+ #--------------------------------------------------------------------------------
496
+ #region Billing Cycles
497
+ #--------------------------------------------------------------------------------
498
+ 'monthly' => _x( 'Monthly', 'as every month', 'freemius' ),
499
+ 'mo' => _x( 'mo', 'as monthly period', 'freemius' ),
500
+ 'annual' => _x( 'Annual', 'as once a year', 'freemius' ),
501
+ 'annually' => _x( 'Annually', 'as once a year', 'freemius' ),
502
+ 'once' => _x( 'Once', 'as once a year', 'freemius' ),
503
+ 'year' => _x( 'year', 'as annual period', 'freemius' ),
504
+ 'lifetime' => __( 'Lifetime', 'freemius' ),
505
+ 'best' => _x( 'Best', 'e.g. the best product', 'freemius' ),
506
+ 'billed-x' => _x( 'Billed %s', 'e.g. billed monthly', 'freemius' ),
507
+ 'save-x' => _x( 'Save %s', 'as a discount of $5 or 10%', 'freemius' ),
508
+ #endregion Billing Cycles
509
+ 'view-details' => __( 'View details', 'freemius' ),
510
+ #--------------------------------------------------------------------------------
511
+ #region Trial
512
+ #--------------------------------------------------------------------------------
513
+ 'approve-start-trial' => _x( 'Approve & Start Trial', 'button label', 'freemius' ),
514
+ /* translators: %1$s: Number of trial days; %2$s: Plan name; */
515
+ 'start-trial-prompt-header' => __( 'You are 1-click away from starting your %1$s-day free trial of the %2$s plan.', 'freemius' ),
516
+ /* translators: %s: Link to freemius.com */
517
+ 'start-trial-prompt-message' => __( 'For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt-in with your user and non-sensitive site information, allowing the plugin to periodically send data to %s to check for version updates and to validate your trial.', 'freemius' ),
518
+
519
+ #endregion
520
+ #--------------------------------------------------------------------------------
521
+ #region Billing Details
522
+ #--------------------------------------------------------------------------------
523
+ 'business-name' => __( 'Business name', 'freemius' ),
524
+ 'tax-vat-id' => __( 'Tax / VAT ID', 'freemius' ),
525
+ 'address-line-n' => __( 'Address Line %d', 'freemius' ),
526
+ 'country' => __( 'Country', 'freemius' ),
527
+ 'select-country' => __( 'Select Country', 'freemius' ),
528
+ 'city' => __( 'City', 'freemius' ),
529
+ 'town' => __( 'Town', 'freemius' ),
530
+ 'state' => __( 'State', 'freemius' ),
531
+ 'province' => __( 'Province', 'freemius' ),
532
+ 'zip-postal-code' => __( 'ZIP / Postal Code', 'freemius' ),
533
+ #endregion
534
+ );
freemius/includes/managers/class-fs-admin-menu-manager.php ADDED
@@ -0,0 +1,571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Admin_Menu_Manager {
14
+
15
+ #region Properties
16
+
17
+ /**
18
+ * @var string
19
+ */
20
+ protected $_plugin_slug;
21
+
22
+ /**
23
+ * @since 1.0.6
24
+ *
25
+ * @var string
26
+ */
27
+ private $_menu_slug;
28
+ /**
29
+ * @since 1.1.3
30
+ *
31
+ * @var string
32
+ */
33
+ private $_parent_slug;
34
+ /**
35
+ * @since 1.1.3
36
+ *
37
+ * @var string
38
+ */
39
+ private $_parent_type;
40
+ /**
41
+ * @since 1.1.3
42
+ *
43
+ * @var string
44
+ */
45
+ private $_type;
46
+ /**
47
+ * @since 1.1.3
48
+ *
49
+ * @var bool
50
+ */
51
+ private $_is_top_level;
52
+ /**
53
+ * @since 1.1.3
54
+ *
55
+ * @var bool
56
+ */
57
+ private $_is_override_exact;
58
+ /**
59
+ * @since 1.1.3
60
+ *
61
+ * @var array<string,bool>
62
+ */
63
+ private $_default_submenu_items;
64
+ /**
65
+ * @since 1.1.3
66
+ *
67
+ * @var string
68
+ */
69
+ private $_first_time_path;
70
+
71
+ #endregion Properties
72
+
73
+ /**
74
+ * @var FS_Logger
75
+ */
76
+ protected $_logger;
77
+
78
+ #region Singleton
79
+
80
+ /**
81
+ * @var FS_Admin_Menu_Manager[]
82
+ */
83
+ private static $_instances = array();
84
+
85
+ /**
86
+ * @param string $plugin_slug
87
+ *
88
+ * @return FS_Admin_Notice_Manager
89
+ */
90
+ static function instance( $plugin_slug ) {
91
+ if ( ! isset( self::$_instances[ $plugin_slug ] ) ) {
92
+ self::$_instances[ $plugin_slug ] = new FS_Admin_Menu_Manager( $plugin_slug );
93
+ }
94
+
95
+ return self::$_instances[ $plugin_slug ];
96
+ }
97
+
98
+ protected function __construct( $plugin_slug ) {
99
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $plugin_slug . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
100
+
101
+ $this->_plugin_slug = $plugin_slug;
102
+ }
103
+
104
+ #endregion Singleton
105
+
106
+ #region Helpers
107
+
108
+ private function get_option( &$options, $key, $default = false ) {
109
+ return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
110
+ }
111
+
112
+ private function get_bool_option( &$options, $key, $default = false ) {
113
+ return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
114
+ }
115
+
116
+ #endregion Helpers
117
+
118
+ /**
119
+ * @param array $menu
120
+ * @param bool $is_addon
121
+ */
122
+ function init( $menu, $is_addon = false ) {
123
+ $this->_menu_slug = $menu['slug'];
124
+
125
+ $this->_default_submenu_items = array();
126
+ // @deprecated
127
+ $this->_type = 'page';
128
+ $this->_is_top_level = true;
129
+ $this->_is_override_exact = false;
130
+ $this->_parent_slug = false;
131
+ // @deprecated
132
+ $this->_parent_type = 'page';
133
+
134
+ if ( ! $is_addon && isset( $menu ) ) {
135
+ $this->_default_submenu_items = array(
136
+ 'contact' => $this->get_bool_option( $menu, 'contact', true ),
137
+ 'support' => $this->get_bool_option( $menu, 'support', true ),
138
+ 'account' => $this->get_bool_option( $menu, 'account', true ),
139
+ 'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
140
+ 'addons' => $this->get_bool_option( $menu, 'addons', true ),
141
+ );
142
+
143
+ // @deprecated
144
+ $this->_type = $this->get_option( $menu, 'type', 'page' );
145
+ $this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
146
+
147
+ if ( isset( $menu['parent'] ) ) {
148
+ $this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
149
+ // @deprecated
150
+ $this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
151
+
152
+ // If parent's slug is different, then it's NOT a top level menu item.
153
+ $this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
154
+ } else {
155
+ /**
156
+ * If no parent then top level if:
157
+ * - Has custom admin menu ('page')
158
+ * - CPT menu type ('cpt')
159
+ */
160
+ // $this->_is_top_level = in_array( $this->_type, array(
161
+ // 'cpt',
162
+ // 'page'
163
+ // ) );
164
+ }
165
+
166
+ $this->_first_time_path = $this->get_option( $menu, 'first-path', false );
167
+ if ( ! empty( $this->_first_time_path ) && is_string( $this->_first_time_path ) ) {
168
+ $this->_first_time_path = admin_url( $this->_first_time_path, 'admin' );
169
+ }
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Check if top level menu.
175
+ *
176
+ * @author Vova Feldman (@svovaf)
177
+ * @since 1.1.3
178
+ *
179
+ * @return bool False if submenu item.
180
+ */
181
+ function is_top_level() {
182
+ return $this->_is_top_level;
183
+ }
184
+
185
+ /**
186
+ * Check if the page should be override on exact URL match.
187
+ *
188
+ * @author Vova Feldman (@svovaf)
189
+ * @since 1.1.3
190
+ *
191
+ * @return bool False if submenu item.
192
+ */
193
+ function is_override_exact() {
194
+ return $this->_is_override_exact;
195
+ }
196
+
197
+
198
+ /**
199
+ * Get the path of the page the user should be forwarded to after first activation.
200
+ *
201
+ * @author Vova Feldman (@svovaf)
202
+ * @since 1.1.3
203
+ *
204
+ * @return string
205
+ */
206
+ function get_first_time_path() {
207
+ return $this->_first_time_path;
208
+ }
209
+
210
+ /**
211
+ * Check if plugin's menu item is part of a custom top level menu.
212
+ *
213
+ * @author Vova Feldman (@svovaf)
214
+ * @since 1.1.3
215
+ *
216
+ * @return bool
217
+ */
218
+ function has_custom_parent() {
219
+ return ! $this->_is_top_level && is_string( $this->_parent_slug );
220
+ }
221
+
222
+ /**
223
+ * @author Vova Feldman (@svovaf)
224
+ * @since 1.1.3
225
+ *
226
+ * @return string
227
+ */
228
+ // function slug(){
229
+ // return $this->_menu_slug;
230
+ // }
231
+
232
+ /**
233
+ * @author Vova Feldman (@svovaf)
234
+ * @since 1.1.3
235
+ *
236
+ * @param string $id
237
+ * @param bool $default
238
+ *
239
+ * @return bool
240
+ */
241
+ function is_submenu_item_visible( $id, $default = true ) {
242
+ return fs_apply_filter(
243
+ $this->_plugin_slug,
244
+ 'is_submenu_visible',
245
+ $this->get_bool_option( $this->_default_submenu_items, $id, $default ),
246
+ $id
247
+ );
248
+ }
249
+
250
+ /**
251
+ * Calculates admin settings menu slug.
252
+ * If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
253
+ *
254
+ * @author Vova Feldman (@svovaf)
255
+ * @since 1.1.3
256
+ *
257
+ * @param string $page
258
+ *
259
+ * @return string
260
+ */
261
+ function get_slug( $page = '' ) {
262
+ return ( ( false === strpos( $this->_menu_slug, '.php?' ) ) ?
263
+ $this->_menu_slug :
264
+ $this->_plugin_slug ) . ( empty( $page ) ? '' : ( '-' . $page ) );
265
+ }
266
+
267
+ /**
268
+ * @author Vova Feldman (@svovaf)
269
+ * @since 1.1.3
270
+ *
271
+ * @return string
272
+ */
273
+ function get_parent_slug() {
274
+ return $this->_parent_slug;
275
+ }
276
+
277
+ /**
278
+ * @author Vova Feldman (@svovaf)
279
+ * @since 1.1.3
280
+ *
281
+ * @return string
282
+ */
283
+ function get_type() {
284
+ return $this->_type;
285
+ }
286
+
287
+ /**
288
+ * @author Vova Feldman (@svovaf)
289
+ * @since 1.1.3
290
+ *
291
+ * @return bool
292
+ */
293
+ function is_cpt() {
294
+ return ( 0 === strpos( $this->_menu_slug, 'edit.php?post_type=' ) ||
295
+ // Back compatibility.
296
+ 'cpt' === $this->_type
297
+ );
298
+ }
299
+
300
+ /**
301
+ * @author Vova Feldman (@svovaf)
302
+ * @since 1.1.3
303
+ *
304
+ * @return string
305
+ */
306
+ function get_parent_type() {
307
+ return $this->_parent_type;
308
+ }
309
+
310
+ /**
311
+ * @author Vova Feldman (@svovaf)
312
+ * @since 1.1.3
313
+ *
314
+ * @return string
315
+ */
316
+ function get_raw_slug() {
317
+ return $this->_menu_slug;
318
+ }
319
+
320
+ /**
321
+ * Get plugin's original menu slug.
322
+ *
323
+ * @author Vova Feldman (@svovaf)
324
+ * @since 1.1.3
325
+ *
326
+ * @return string
327
+ */
328
+ function get_original_menu_slug() {
329
+ if ( 'cpt' === $this->_type ) {
330
+ return add_query_arg( array(
331
+ 'post_type' => $this->_menu_slug
332
+ ), 'edit.php' );
333
+ }
334
+
335
+ if ( false === strpos( $this->_menu_slug, '.php?' ) ) {
336
+ return $this->_menu_slug;
337
+ } else {
338
+ return $this->_plugin_slug;
339
+ }
340
+ }
341
+
342
+ /**
343
+ * @author Vova Feldman (@svovaf)
344
+ * @since 1.1.3
345
+ *
346
+ * @return string
347
+ */
348
+ function get_top_level_menu_slug() {
349
+ return $this->has_custom_parent() ?
350
+ $this->get_parent_slug() :
351
+ $this->get_raw_slug();
352
+ }
353
+
354
+ /**
355
+ * Is user on plugin's admin activation page.
356
+ *
357
+ * @author Vova Feldman (@svovaf)
358
+ * @since 1.0.8
359
+ *
360
+ * @return bool
361
+ */
362
+ function is_activation_page() {
363
+ return isset( $_GET['page'] ) &&
364
+ ( ( strtolower( $this->_menu_slug ) === strtolower( $_GET['page'] ) ) ||
365
+ ( strtolower( $this->_plugin_slug ) === strtolower( $_GET['page'] ) ) );
366
+ }
367
+
368
+ #region Submenu Override
369
+
370
+ /**
371
+ * Override submenu's action.
372
+ *
373
+ * @author Vova Feldman (@svovaf)
374
+ * @since 1.1.0
375
+ *
376
+ * @param string $parent_slug
377
+ * @param string $menu_slug
378
+ * @param callable $function
379
+ *
380
+ * @return false|string If submenu exist, will return the hook name.
381
+ */
382
+ function override_submenu_action( $parent_slug, $menu_slug, $function ) {
383
+ global $submenu;
384
+
385
+ $menu_slug = plugin_basename( $menu_slug );
386
+ $parent_slug = plugin_basename( $parent_slug );
387
+
388
+ if ( ! isset( $submenu[ $parent_slug ] ) ) {
389
+ // Parent menu not exist.
390
+ return false;
391
+ }
392
+
393
+ $found_submenu_item = false;
394
+ foreach ( $submenu[ $parent_slug ] as $submenu_item ) {
395
+ if ( $menu_slug === $submenu_item[2] ) {
396
+ $found_submenu_item = $submenu_item;
397
+ break;
398
+ }
399
+ }
400
+
401
+ if ( false === $found_submenu_item ) {
402
+ // Submenu item not found.
403
+ return false;
404
+ }
405
+
406
+ // Remove current function.
407
+ $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
408
+ remove_all_actions( $hookname );
409
+
410
+ // Attach new action.
411
+ add_action( $hookname, $function );
412
+
413
+ return $hookname;
414
+ }
415
+
416
+ #endregion Submenu Override
417
+
418
+ #region Top level menu Override
419
+
420
+ /**
421
+ * Find plugin's admin dashboard main menu item.
422
+ *
423
+ * @author Vova Feldman (@svovaf)
424
+ * @since 1.0.2
425
+ *
426
+ * @return string[]|false
427
+ */
428
+ private function find_top_level_menu() {
429
+ global $menu;
430
+
431
+ $position = - 1;
432
+ $found_menu = false;
433
+
434
+ $menu_slug = $this->get_raw_slug();
435
+
436
+ $hook_name = get_plugin_page_hookname( $menu_slug, '' );
437
+ foreach ( $menu as $pos => $m ) {
438
+ if ( $menu_slug === $m[2] ) {
439
+ $position = $pos;
440
+ $found_menu = $m;
441
+ break;
442
+ }
443
+ }
444
+
445
+ if ( false === $found_menu ) {
446
+ return false;
447
+ }
448
+
449
+ return array(
450
+ 'menu' => $found_menu,
451
+ 'position' => $position,
452
+ 'hook_name' => $hook_name
453
+ );
454
+ }
455
+
456
+ /**
457
+ * Remove all sub-menu items.
458
+ *
459
+ * @author Vova Feldman (@svovaf)
460
+ * @since 1.0.7
461
+ *
462
+ * @return bool If submenu with plugin's menu slug was found.
463
+ */
464
+ private function remove_all_submenu_items() {
465
+ global $submenu;
466
+
467
+ $menu_slug = $this->get_raw_slug();
468
+
469
+ if ( ! isset( $submenu[ $menu_slug ] ) ) {
470
+ return false;
471
+ }
472
+
473
+ $submenu[ $menu_slug ] = array();
474
+
475
+ return true;
476
+ }
477
+
478
+ /**
479
+ *
480
+ * @author Vova Feldman (@svovaf)
481
+ * @since 1.0.9
482
+ *
483
+ * @return array[string]mixed
484
+ */
485
+ function remove_menu_item() {
486
+ $this->_logger->entrance();
487
+
488
+ // Find main menu item.
489
+ $menu = $this->find_top_level_menu();
490
+
491
+ if ( false === $menu ) {
492
+ return false;
493
+ }
494
+
495
+ // Remove it with its actions.
496
+ remove_all_actions( $menu['hook_name'] );
497
+
498
+ // Remove all submenu items.
499
+ $this->remove_all_submenu_items();
500
+
501
+ return $menu;
502
+ }
503
+
504
+ /**
505
+ * @author Vova Feldman (@svovaf)
506
+ * @since 1.1.4
507
+ *
508
+ * @param callable $function
509
+ *
510
+ * @return array[string]mixed
511
+ */
512
+ function override_menu_item( $function ) {
513
+ $found_menu = $this->remove_menu_item();
514
+
515
+ if ( false === $found_menu ) {
516
+ return false;
517
+ }
518
+
519
+ if ( ! $this->is_top_level() || ! $this->is_cpt() ) {
520
+ $menu_slug = plugin_basename( $this->get_slug() );
521
+
522
+ $hookname = get_plugin_page_hookname( $menu_slug, '' );
523
+
524
+ // Override menu action.
525
+ add_action( $hookname, $function );
526
+ } else {
527
+ global $menu;
528
+
529
+ // Remove original CPT menu.
530
+ unset( $menu[ $found_menu['position'] ] );
531
+
532
+ // Create new top-level menu action.
533
+ $hookname = add_menu_page(
534
+ $found_menu['menu'][3],
535
+ $found_menu['menu'][0],
536
+ 'manage_options',
537
+ $this->get_slug(),
538
+ $function,
539
+ $found_menu['menu'][6],
540
+ $found_menu['position']
541
+ );
542
+ }
543
+
544
+ return $hookname;
545
+ }
546
+
547
+ /**
548
+ * Adds a counter to the module's top level menu item.
549
+ *
550
+ * @author Vova Feldman (@svovaf)
551
+ * @since 1.2.1.5
552
+ *
553
+ * @param int $counter
554
+ * @param string $class
555
+ */
556
+ function add_counter_to_menu_item( $counter = 1, $class = '' ) {
557
+ global $menu;
558
+
559
+ // Find main menu item.
560
+ $found_menu = $this->find_top_level_menu();
561
+
562
+ if ( false === $menu ) {
563
+ return;
564
+ }
565
+
566
+ // Override menu label.
567
+ $menu[ $found_menu['position'] ][0] = $found_menu['menu'][0] . ' <span class="update-plugins ' . $class . ' count-' . $counter . '"><span>' . $counter . '</span></span>';
568
+ }
569
+
570
+ #endregion Top level menu Override
571
+ }
freemius/includes/managers/class-fs-admin-notice-manager.php ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.7
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Admin_Notice_Manager {
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $_slug;
18
+ /**
19
+ * @var string
20
+ */
21
+ protected $_title;
22
+ /**
23
+ * @var array[]
24
+ */
25
+ private $_admin_messages = array();
26
+ /**
27
+ * @var FS_Key_Value_Storage
28
+ */
29
+ private $_sticky_storage;
30
+ /**
31
+ * @var FS_Plugin_Manager[]
32
+ */
33
+ private static $_instances = array();
34
+ /**
35
+ * @var FS_Logger
36
+ */
37
+ protected $_logger;
38
+
39
+ /**
40
+ * @param string $slug
41
+ * @param string $title
42
+ *
43
+ * @return FS_Admin_Notice_Manager
44
+ */
45
+ static function instance( $slug, $title = '' ) {
46
+ if ( ! isset( self::$_instances[ $slug ] ) ) {
47
+ self::$_instances[ $slug ] = new FS_Admin_Notice_Manager( $slug, $title );
48
+ }
49
+
50
+ return self::$_instances[ $slug ];
51
+ }
52
+
53
+ protected function __construct( $slug, $title = '' ) {
54
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_data', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
55
+
56
+ $this->_slug = $slug;
57
+ $this->_title = ! empty( $title ) ? $title : '';
58
+ $this->_sticky_storage = FS_Key_Value_Storage::instance( 'admin_notices', $this->_slug );
59
+
60
+ if ( is_admin() ) {
61
+ if ( 0 < count( $this->_sticky_storage ) ) {
62
+ // If there are sticky notices for the current slug, add a callback
63
+ // to the AJAX action that handles message dismiss.
64
+ add_action( "wp_ajax_fs_dismiss_notice_action_{$slug}", array(
65
+ &$this,
66
+ 'dismiss_notice_ajax_callback'
67
+ ) );
68
+
69
+ foreach ( $this->_sticky_storage as $id => $msg ) {
70
+ // Add admin notice.
71
+ $this->add(
72
+ $msg['message'],
73
+ $msg['title'],
74
+ $msg['type'],
75
+ true,
76
+ $msg['all'],
77
+ $msg['id'],
78
+ false
79
+ );
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Remove sticky message by ID.
87
+ *
88
+ * @author Vova Feldman (@svovaf)
89
+ * @since 1.0.7
90
+ *
91
+ */
92
+ function dismiss_notice_ajax_callback() {
93
+ $this->_sticky_storage->remove( $_POST['message_id'] );
94
+ wp_die();
95
+ }
96
+
97
+ /**
98
+ * Rendered sticky message dismiss JavaScript.
99
+ *
100
+ * @author Vova Feldman (@svovaf)
101
+ * @since 1.0.7
102
+ */
103
+ static function _add_sticky_dismiss_javascript() {
104
+ $params = array();
105
+ fs_require_once_template( 'sticky-admin-notice-js.php', $params );
106
+ }
107
+
108
+ private static $_added_sticky_javascript = false;
109
+
110
+ /**
111
+ * Hook to the admin_footer to add sticky message dismiss JavaScript handler.
112
+ *
113
+ * @author Vova Feldman (@svovaf)
114
+ * @since 1.0.7
115
+ */
116
+ private static function has_sticky_messages() {
117
+ if ( ! self::$_added_sticky_javascript ) {
118
+ add_action( 'admin_footer', array( 'FS_Admin_Notice_Manager', '_add_sticky_dismiss_javascript' ) );
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Handle admin_notices by printing the admin messages stacked in the queue.
124
+ *
125
+ * @author Vova Feldman (@svovaf)
126
+ * @since 1.0.4
127
+ *
128
+ */
129
+ function _admin_notices_hook() {
130
+ $notice_type = 'admin_notices';
131
+
132
+ if ( function_exists( 'current_user_can' ) &&
133
+ ! current_user_can( 'manage_options' )
134
+ ) {
135
+ // Only show messages to admins.
136
+ return;
137
+ }
138
+
139
+ if ( ! isset( $this->_admin_messages[ $notice_type ] ) || ! is_array( $this->_admin_messages[ $notice_type ] ) ) {
140
+ return;
141
+ }
142
+
143
+ foreach ( $this->_admin_messages[ $notice_type ] as $id => $msg ) {
144
+ fs_require_template( 'admin-notice.php', $msg );
145
+
146
+ if ( $msg['sticky'] ) {
147
+ self::has_sticky_messages();
148
+ }
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Handle all_admin_notices by printing the admin messages stacked in the queue.
154
+ *
155
+ * @author Vova Feldman (@svovaf)
156
+ * @since 1.0.4
157
+ *
158
+ */
159
+ function _all_admin_notices_hook() {
160
+ $notice_type = 'all_admin_notices';
161
+
162
+ if ( ! isset( $this->_admin_messages[ $notice_type ] ) || ! is_array( $this->_admin_messages[ $notice_type ] ) ) {
163
+ return;
164
+ }
165
+
166
+ foreach ( $this->_admin_messages[ $notice_type ] as $id => $msg ) {
167
+ fs_require_template( 'all-admin-notice.php', $msg );
168
+ }
169
+ }
170
+
171
+ /**
172
+ * Enqueue common stylesheet to style admin notice.
173
+ *
174
+ * @author Vova Feldman (@svovaf)
175
+ * @since 1.0.7
176
+ */
177
+ function _enqueue_styles() {
178
+ fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
179
+ }
180
+
181
+ /**
182
+ * Add admin message to admin messages queue, and hook to admin_notices / all_admin_notices if not yet hooked.
183
+ *
184
+ * @author Vova Feldman (@svovaf)
185
+ * @since 1.0.4
186
+ *
187
+ * @param string $message
188
+ * @param string $title
189
+ * @param string $type
190
+ * @param bool $is_sticky
191
+ * @param bool $all_admin
192
+ * @param string $id Message ID
193
+ * @param bool $store_if_sticky
194
+ *
195
+ * @uses add_action()
196
+ */
197
+ function add( $message, $title = '', $type = 'success', $is_sticky = false, $all_admin = false, $id = '', $store_if_sticky = true ) {
198
+ $key = ( $all_admin ? 'all_admin_notices' : 'admin_notices' );
199
+
200
+ if ( ! isset( $this->_admin_messages[ $key ] ) ) {
201
+ $this->_admin_messages[ $key ] = array();
202
+
203
+ add_action( $key, array( &$this, "_{$key}_hook" ) );
204
+ add_action( 'admin_enqueue_scripts', array( &$this, '_enqueue_styles' ) );
205
+
206
+ }
207
+
208
+ if ( '' === $id ) {
209
+ $id = md5( $title . ' ' . $message . ' ' . $type );
210
+ }
211
+
212
+ $message_object = array(
213
+ 'message' => $message,
214
+ 'title' => $title,
215
+ 'type' => $type,
216
+ 'sticky' => $is_sticky,
217
+ 'id' => $id,
218
+ 'all' => $all_admin,
219
+ 'slug' => $this->_slug,
220
+ 'plugin' => $this->_title,
221
+ );
222
+
223
+ if ( $is_sticky && $store_if_sticky ) {
224
+ $this->_sticky_storage->{$id} = $message_object;
225
+ }
226
+
227
+ $this->_admin_messages[ $key ][ $id ] = $message_object;
228
+ }
229
+
230
+ /**
231
+ * @author Vova Feldman (@svovaf)
232
+ * @since 1.0.7
233
+ *
234
+ * @param string|string[] $ids
235
+ */
236
+ function remove_sticky( $ids ) {
237
+ if ( ! is_array( $ids ) ) {
238
+ $ids = array( $ids );
239
+ }
240
+
241
+ foreach ( $ids as $id ) {
242
+ // Remove from sticky storage.
243
+ $this->_sticky_storage->remove( $id );
244
+
245
+ // Remove from current admin messages.
246
+ if ( isset( $this->_admin_messages['all_admin_notices'] ) && isset( $this->_admin_messages['all_admin_notices'][ $id ] ) ) {
247
+ unset( $this->_admin_messages['all_admin_notices'][ $id ] );
248
+ }
249
+ if ( isset( $this->_admin_messages['admin_notices'] ) && isset( $this->_admin_messages['admin_notices'][ $id ] ) ) {
250
+ unset( $this->_admin_messages['admin_notices'][ $id ] );
251
+ }
252
+ }
253
+ }
254
+
255
+ /**
256
+ * Check if sticky message exists by id.
257
+ *
258
+ * @author Vova Feldman (@svovaf)
259
+ * @since 1.0.9
260
+ *
261
+ * @param $id
262
+ *
263
+ * @return bool
264
+ */
265
+ function has_sticky( $id ) {
266
+ return isset( $this->_sticky_storage[ $id ] );
267
+ }
268
+
269
+ /**
270
+ * Adds sticky admin notification.
271
+ *
272
+ * @author Vova Feldman (@svovaf)
273
+ * @since 1.0.7
274
+ *
275
+ * @param string $message
276
+ * @param string $id Message ID
277
+ * @param string $title
278
+ * @param string $type
279
+ * @param bool $all_admin
280
+ */
281
+ function add_sticky( $message, $id, $title = '', $type = 'success', $all_admin = false ) {
282
+ $message = fs_apply_filter( $this->_slug, "sticky_message_{$id}", $message );
283
+ $title = fs_apply_filter( $this->_slug, "sticky_title_{$id}", $title );
284
+
285
+ $this->add( $message, $title, $type, true, $all_admin, $id );
286
+ }
287
+
288
+ /**
289
+ * Clear all sticky messages.
290
+ *
291
+ * @author Vova Feldman (@svovaf)
292
+ * @since 1.0.8
293
+ */
294
+ function clear_all_sticky() {
295
+ $this->_sticky_storage->clear_all();
296
+ }
297
+
298
+ /**
299
+ * Add admin message to all admin messages queue, and hook to all_admin_notices if not yet hooked.
300
+ *
301
+ * @author Vova Feldman (@svovaf)
302
+ * @since 1.0.4
303
+ *
304
+ * @param string $message
305
+ * @param string $title
306
+ * @param string $type
307
+ * @param bool $is_sticky
308
+ * @param string $id Message ID
309
+ */
310
+ function add_all( $message, $title = '', $type = 'success', $is_sticky = false, $id = '' ) {
311
+ $this->add( $message, $title, $type, $is_sticky, true, $id );
312
+ }
313
+ }
freemius/includes/managers/class-fs-cache-manager.php ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Cache_Manager {
14
+ /**
15
+ * @var FS_Option_Manager
16
+ */
17
+ private $_options;
18
+ /**
19
+ * @var FS_Logger
20
+ */
21
+ private $_logger;
22
+
23
+ /**
24
+ * @var FS_Cache_Manager[]
25
+ */
26
+ private static $_MANAGERS = array();
27
+
28
+ /**
29
+ * @author Vova Feldman (@svovaf)
30
+ * @since 1.1.3
31
+ *
32
+ * @param string $id
33
+ */
34
+ private function __construct( $id ) {
35
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
36
+
37
+ $this->_logger->entrance();
38
+ $this->_logger->log( 'id = ' . $id );
39
+
40
+ $this->_options = FS_Option_Manager::get_manager( $id, true );
41
+ }
42
+
43
+ /**
44
+ * @author Vova Feldman (@svovaf)
45
+ * @since 1.1.6
46
+ *
47
+ * @param $id
48
+ *
49
+ * @return FS_Cache_Manager
50
+ */
51
+ static function get_manager( $id ) {
52
+ $id = strtolower( $id );
53
+
54
+ if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
55
+ self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
56
+ }
57
+
58
+ return self::$_MANAGERS[ $id ];
59
+ }
60
+
61
+ /**
62
+ * @author Vova Feldman (@svovaf)
63
+ * @since 1.1.6
64
+ *
65
+ * @return bool
66
+ */
67
+ function is_empty() {
68
+ $this->_logger->entrance();
69
+
70
+ return $this->_options->is_empty();
71
+ }
72
+
73
+ /**
74
+ * @author Vova Feldman (@svovaf)
75
+ * @since 1.1.6
76
+ */
77
+ function clear() {
78
+ $this->_logger->entrance();
79
+
80
+ $this->_options->clear( true );
81
+ }
82
+
83
+ /**
84
+ * Delete cache manager from DB.
85
+ *
86
+ * @author Vova Feldman (@svovaf)
87
+ * @since 1.0.9
88
+ */
89
+ function delete() {
90
+ $this->_options->delete();
91
+ }
92
+
93
+ /**
94
+ * Check if there's a cached item.
95
+ *
96
+ * @author Vova Feldman (@svovaf)
97
+ * @since 1.1.6
98
+ *
99
+ * @param string $key
100
+ *
101
+ * @return bool
102
+ */
103
+ function has( $key ) {
104
+ $cache_entry = $this->_options->get_option( $key, false );
105
+
106
+ return ( is_object( $cache_entry ) &&
107
+ isset( $cache_entry->timestamp ) &&
108
+ is_numeric( $cache_entry->timestamp )
109
+ );
110
+ }
111
+
112
+ /**
113
+ * Check if there's a valid cached item.
114
+ *
115
+ * @author Vova Feldman (@svovaf)
116
+ * @since 1.1.6
117
+ *
118
+ * @param string $key
119
+ *
120
+ * @return bool
121
+ */
122
+ function has_valid( $key ) {
123
+ $cache_entry = $this->_options->get_option( $key, false );
124
+
125
+ return ( is_object( $cache_entry ) &&
126
+ isset( $cache_entry->timestamp ) &&
127
+ is_numeric( $cache_entry->timestamp ) &&
128
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
129
+ );
130
+ }
131
+
132
+ /**
133
+ * @author Vova Feldman (@svovaf)
134
+ * @since 1.1.6
135
+ *
136
+ * @param string $key
137
+ * @param mixed $default
138
+ *
139
+ * @return mixed
140
+ */
141
+ function get( $key, $default = null ) {
142
+ $this->_logger->entrance( 'key = ' . $key );
143
+
144
+ $cache_entry = $this->_options->get_option( $key, false );
145
+
146
+ if ( is_object( $cache_entry ) &&
147
+ isset( $cache_entry->timestamp ) &&
148
+ is_numeric( $cache_entry->timestamp )
149
+ ) {
150
+ return $cache_entry->result;
151
+ }
152
+
153
+ return $default;
154
+ }
155
+
156
+ /**
157
+ * @author Vova Feldman (@svovaf)
158
+ * @since 1.1.6
159
+ *
160
+ * @param string $key
161
+ * @param mixed $default
162
+ *
163
+ * @return mixed
164
+ */
165
+ function get_valid( $key, $default = null ) {
166
+ $this->_logger->entrance( 'key = ' . $key );
167
+
168
+ $cache_entry = $this->_options->get_option( $key, false );
169
+
170
+ if ( is_object( $cache_entry ) &&
171
+ isset( $cache_entry->timestamp ) &&
172
+ is_numeric( $cache_entry->timestamp ) &&
173
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
174
+ ) {
175
+ return $cache_entry->result;
176
+ }
177
+
178
+ return $default;
179
+ }
180
+
181
+ /**
182
+ * @author Vova Feldman (@svovaf)
183
+ * @since 1.1.6
184
+ *
185
+ * @param string $key
186
+ * @param mixed $value
187
+ * @param int $expiration
188
+ */
189
+ function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
190
+ $this->_logger->entrance( 'key = ' . $key );
191
+
192
+ $cache_entry = new stdClass();
193
+ $cache_entry->result = $value;
194
+ $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME + $expiration;
195
+ $this->_options->set_option( $key, $cache_entry, true );
196
+ }
197
+
198
+ /**
199
+ * Get cached record expiration, or false if not cached or expired.
200
+ *
201
+ * @author Vova Feldman (@svovaf)
202
+ * @since 1.1.7.3
203
+ *
204
+ * @param string $key
205
+ *
206
+ * @return bool|int
207
+ */
208
+ function get_record_expiration( $key ) {
209
+ $this->_logger->entrance( 'key = ' . $key );
210
+
211
+ $cache_entry = $this->_options->get_option( $key, false );
212
+
213
+ if ( is_object( $cache_entry ) &&
214
+ isset( $cache_entry->timestamp ) &&
215
+ is_numeric( $cache_entry->timestamp ) &&
216
+ $cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
217
+ ) {
218
+ return $cache_entry->timestamp;
219
+ }
220
+
221
+ return false;
222
+ }
223
+
224
+ /**
225
+ * Purge cached item.
226
+ *
227
+ * @author Vova Feldman (@svovaf)
228
+ * @since 1.1.6
229
+ *
230
+ * @param string $key
231
+ */
232
+ function purge( $key ) {
233
+ $this->_logger->entrance( 'key = ' . $key );
234
+
235
+ $this->_options->unset_option( $key, true );
236
+ }
237
+ }
freemius/includes/managers/class-fs-key-value-storage.php ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.7
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Class FS_Key_Value_Storage
15
+ *
16
+ * @property int $install_timestamp
17
+ * @property int $activation_timestamp
18
+ * @property int $sync_timestamp
19
+ * @property object $sync_cron
20
+ * @property int $install_sync_timestamp
21
+ * @property array $connectivity_test
22
+ * @property array $is_on
23
+ * @property object $trial_plan
24
+ * @property bool $has_trial_plan
25
+ * @property bool $trial_promotion_shown
26
+ * @property string $sdk_version
27
+ * @property string $sdk_last_version
28
+ * @property bool $sdk_upgrade_mode
29
+ * @property bool $sdk_downgrade_mode
30
+ * @property bool $plugin_upgrade_mode
31
+ * @property bool $plugin_downgrade_mode
32
+ * @property string $plugin_version
33
+ * @property string $plugin_last_version
34
+ * @property bool $is_plugin_new_install
35
+ * @property bool $was_plugin_loaded
36
+ * @property object $plugin_main_file
37
+ * @property bool $prev_is_premium
38
+ * @property array $is_anonymous
39
+ * @property bool $is_pending_activation
40
+ * @property bool $sticky_optin_added
41
+ * @property object $uninstall_reason
42
+ * @property object $subscription
43
+ */
44
+ class FS_Key_Value_Storage implements ArrayAccess, Iterator, Countable {
45
+ /**
46
+ * @var string
47
+ */
48
+ protected $_id;
49
+ /**
50
+ * @var string
51
+ */
52
+ protected $_slug;
53
+ /**
54
+ * @var array
55
+ */
56
+ protected $_data;
57
+
58
+ /**
59
+ * @var FS_Plugin_Manager[]
60
+ */
61
+ private static $_instances = array();
62
+ /**
63
+ * @var FS_Logger
64
+ */
65
+ protected $_logger;
66
+
67
+ /**
68
+ * @param string $id
69
+ * @param string $slug
70
+ *
71
+ * @return FS_Key_Value_Storage
72
+ */
73
+ static function instance( $id, $slug ) {
74
+ $key = $id . ':' . $slug;
75
+ if ( ! isset( self::$_instances[ $key ] ) ) {
76
+ self::$_instances[ $key ] = new FS_Key_Value_Storage( $id, $slug );
77
+ }
78
+
79
+ return self::$_instances[ $key ];
80
+ }
81
+
82
+ protected function __construct( $id, $slug ) {
83
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
84
+
85
+ $this->_slug = $slug;
86
+ $this->_id = $id;
87
+ $this->load();
88
+ }
89
+
90
+ protected function get_option_manager() {
91
+ return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
92
+ }
93
+
94
+ protected function get_all_data() {
95
+ return $this->get_option_manager()->get_option( $this->_id, array() );
96
+ }
97
+
98
+ /**
99
+ * Load plugin data from local DB.
100
+ *
101
+ * @author Vova Feldman (@svovaf)
102
+ * @since 1.0.7
103
+ */
104
+ function load() {
105
+ $all_plugins_data = $this->get_all_data();
106
+ $this->_data = isset( $all_plugins_data[ $this->_slug ] ) ?
107
+ $all_plugins_data[ $this->_slug ] :
108
+ array();
109
+ }
110
+
111
+ /**
112
+ * @author Vova Feldman (@svovaf)
113
+ * @since 1.0.7
114
+ *
115
+ * @param string $key
116
+ * @param mixed $value
117
+ * @param bool $flush
118
+ */
119
+ function store( $key, $value, $flush = true ) {
120
+ if ( $this->_logger->is_on() ) {
121
+ $this->_logger->entrance( $key . ' = ' . var_export( $value, true ) );
122
+ }
123
+
124
+ if ( array_key_exists( $key, $this->_data ) && $value === $this->_data[ $key ] ) {
125
+ // No need to store data if the value wasn't changed.
126
+ return;
127
+ }
128
+
129
+ $all_data = $this->get_all_data();
130
+
131
+ $this->_data[ $key ] = $value;
132
+
133
+ $all_data[ $this->_slug ] = $this->_data;
134
+
135
+ $options_manager = $this->get_option_manager();
136
+ $options_manager->set_option( $this->_id, $all_data, $flush );
137
+ }
138
+
139
+ /**
140
+ * @author Vova Feldman (@svovaf)
141
+ * @since 1.0.7
142
+ *
143
+ * @param bool $store
144
+ * @param string[] $exceptions Set of keys to keep and not clear.
145
+ */
146
+ function clear_all( $store = true, $exceptions = array() ) {
147
+ $new_data = array();
148
+ foreach ( $exceptions as $key ) {
149
+ if ( isset( $this->_data[ $key ] ) ) {
150
+ $new_data[ $key ] = $this->_data[ $key ];
151
+ }
152
+ }
153
+
154
+ $this->_data = $new_data;
155
+
156
+ if ( $store ) {
157
+ $all_data = $this->get_all_data();
158
+ $all_data[ $this->_slug ] = $this->_data;
159
+ $options_manager = $this->get_option_manager();
160
+ $options_manager->set_option( $this->_id, $all_data, true );
161
+ }
162
+ }
163
+
164
+ /**
165
+ * Delete key-value storage.
166
+ *
167
+ * @author Vova Feldman (@svovaf)
168
+ * @since 1.0.9
169
+ */
170
+ function delete() {
171
+ $this->_data = array();
172
+
173
+ $all_data = $this->get_all_data();
174
+ unset( $all_data[ $this->_slug ] );
175
+ $options_manager = $this->get_option_manager();
176
+ $options_manager->set_option( $this->_id, $all_data, true );
177
+ }
178
+
179
+ /**
180
+ * @author Vova Feldman (@svovaf)
181
+ * @since 1.0.7
182
+ *
183
+ * @param string $key
184
+ * @param bool $store
185
+ */
186
+ function remove( $key, $store = true ) {
187
+ if ( ! array_key_exists( $key, $this->_data ) ) {
188
+ return;
189
+ }
190
+
191
+ unset( $this->_data[ $key ] );
192
+
193
+ if ( $store ) {
194
+ $all_data = $this->get_all_data();
195
+ $all_data[ $this->_slug ] = $this->_data;
196
+ $options_manager = $this->get_option_manager();
197
+ $options_manager->set_option( $this->_id, $all_data, true );
198
+ }
199
+ }
200
+
201
+ /**
202
+ * @author Vova Feldman (@svovaf)
203
+ * @since 1.0.7
204
+ *
205
+ * @param string $key
206
+ * @param mixed $default
207
+ *
208
+ * @return bool|\FS_Plugin
209
+ */
210
+ function get( $key, $default = false ) {
211
+ return array_key_exists( $key, $this->_data ) ?
212
+ $this->_data[ $key ] :
213
+ $default;
214
+ }
215
+
216
+
217
+ /* ArrayAccess + Magic Access (better for refactoring)
218
+ -----------------------------------------------------------------------------------*/
219
+ function __set( $k, $v ) {
220
+ $this->store( $k, $v );
221
+ }
222
+
223
+ function __isset( $k ) {
224
+ return array_key_exists( $k, $this->_data );
225
+ }
226
+
227
+ function __unset( $k ) {
228
+ $this->remove( $k );
229
+ }
230
+
231
+ function __get( $k ) {
232
+ return $this->get( $k, null );
233
+ }
234
+
235
+ function offsetSet( $k, $v ) {
236
+ if ( is_null( $k ) ) {
237
+ throw new Exception( 'Can\'t append value to request params.' );
238
+ } else {
239
+ $this->{$k} = $v;
240
+ }
241
+ }
242
+
243
+ function offsetExists( $k ) {
244
+ return array_key_exists( $k, $this->_data );
245
+ }
246
+
247
+ function offsetUnset( $k ) {
248
+ unset( $this->$k );
249
+ }
250
+
251
+ function offsetGet( $k ) {
252
+ return $this->get( $k, null );
253
+ }
254
+
255
+ /**
256
+ * (PHP 5 &gt;= 5.0.0)<br/>
257
+ * Return the current element
258
+ *
259
+ * @link http://php.net/manual/en/iterator.current.php
260
+ * @return mixed Can return any type.
261
+ */
262
+ public function current() {
263
+ return current( $this->_data );
264
+ }
265
+
266
+ /**
267
+ * (PHP 5 &gt;= 5.0.0)<br/>
268
+ * Move forward to next element
269
+ *
270
+ * @link http://php.net/manual/en/iterator.next.php
271
+ * @return void Any returned value is ignored.
272
+ */
273
+ public function next() {
274
+ next( $this->_data );
275
+ }
276
+
277
+ /**
278
+ * (PHP 5 &gt;= 5.0.0)<br/>
279
+ * Return the key of the current element
280
+ *
281
+ * @link http://php.net/manual/en/iterator.key.php
282
+ * @return mixed scalar on success, or null on failure.
283
+ */
284
+ public function key() {
285
+ return key( $this->_data );
286
+ }
287
+
288
+ /**
289
+ * (PHP 5 &gt;= 5.0.0)<br/>
290
+ * Checks if current position is valid
291
+ *
292
+ * @link http://php.net/manual/en/iterator.valid.php
293
+ * @return boolean The return value will be casted to boolean and then evaluated.
294
+ * Returns true on success or false on failure.
295
+ */
296
+ public function valid() {
297
+ $key = key( $this->_data );
298
+
299
+ return ( $key !== null && $key !== false );
300
+ }
301
+
302
+ /**
303
+ * (PHP 5 &gt;= 5.0.0)<br/>
304
+ * Rewind the Iterator to the first element
305
+ *
306
+ * @link http://php.net/manual/en/iterator.rewind.php
307
+ * @return void Any returned value is ignored.
308
+ */
309
+ public function rewind() {
310
+ reset( $this->_data );
311
+ }
312
+
313
+ /**
314
+ * (PHP 5 &gt;= 5.1.0)<br/>
315
+ * Count elements of an object
316
+ *
317
+ * @link http://php.net/manual/en/countable.count.php
318
+ * @return int The custom count as an integer.
319
+ * </p>
320
+ * <p>
321
+ * The return value is cast to an integer.
322
+ */
323
+ public function count() {
324
+ return count( $this->_data );
325
+ }
326
+ }
freemius/includes/managers/class-fs-license-manager.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_License_Manager /*extends FS_Abstract_Manager*/
14
+ {
15
+ //
16
+ //
17
+ // /**
18
+ // * @var FS_License_Manager[]
19
+ // */
20
+ // private static $_instances = array();
21
+ //
22
+ // static function instance( Freemius $fs ) {
23
+ // $slug = strtolower( $fs->get_slug() );
24
+ //
25
+ // if ( ! isset( self::$_instances[ $slug ] ) ) {
26
+ // self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
27
+ // }
28
+ //
29
+ // return self::$_instances[ $slug ];
30
+ // }
31
+ //
32
+ //// private function __construct($slug) {
33
+ //// parent::__construct($slug);
34
+ //// }
35
+ //
36
+ // function entry_id() {
37
+ // return 'licenses';
38
+ // }
39
+ //
40
+ // function sync( $id ) {
41
+ //
42
+ // }
43
+ //
44
+ // /**
45
+ // * @author Vova Feldman (@svovaf)
46
+ // * @since 1.0.5
47
+ // * @uses FS_Api
48
+ // *
49
+ // * @param number|bool $plugin_id
50
+ // *
51
+ // * @return FS_Plugin_License[]|stdClass Licenses or API error.
52
+ // */
53
+ // function api_get_user_plugin_licenses( $plugin_id = false ) {
54
+ // $api = $this->_fs->get_api_user_scope();
55
+ //
56
+ // if ( ! is_numeric( $plugin_id ) ) {
57
+ // $plugin_id = $this->_fs->get_id();
58
+ // }
59
+ //
60
+ // $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
61
+ //
62
+ // if ( ! isset( $result->error ) ) {
63
+ // for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
64
+ // $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
65
+ // }
66
+ //
67
+ // $result = $result->licenses;
68
+ // }
69
+ //
70
+ // return $result;
71
+ // }
72
+ //
73
+ // function api_get_many() {
74
+ //
75
+ // }
76
+ //
77
+ // function api_activate( $id ) {
78
+ //
79
+ // }
80
+ //
81
+ // function api_deactivate( $id ) {
82
+ //
83
+ // }
84
+
85
+ /**
86
+ * @param FS_Plugin_License[] $licenses
87
+ *
88
+ * @return bool
89
+ */
90
+ static function has_premium_license( $licenses ) {
91
+ if ( is_array( $licenses ) ) {
92
+ foreach ( $licenses as $license ) {
93
+ /**
94
+ * @var FS_Plugin_License $license
95
+ */
96
+ if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
97
+ return true;
98
+ }
99
+ }
100
+ }
101
+
102
+ return false;
103
+ }
104
+ }
freemius/includes/managers/class-fs-option-manager.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * 3-layer lazy options manager.
15
+ * layer 3: Memory
16
+ * layer 2: Cache (if there's any caching plugin and if WP_FS__DEBUG_SDK is FALSE)
17
+ * layer 1: Database (options table). All options stored as one option record in the DB to reduce number of DB
18
+ * queries.
19
+ *
20
+ * If load() is not explicitly called, starts as empty manager. Same thing about saving the data - you have to
21
+ * explicitly call store().
22
+ *
23
+ * Class Freemius_Option_Manager
24
+ */
25
+ class FS_Option_Manager {
26
+ /**
27
+ * @var string
28
+ */
29
+ private $_id;
30
+ /**
31
+ * @var array
32
+ */
33
+ private $_options;
34
+ /**
35
+ * @var FS_Logger
36
+ */
37
+ private $_logger;
38
+
39
+ /**
40
+ * @var FS_Option_Manager[]
41
+ */
42
+ private static $_MANAGERS = array();
43
+
44
+ /**
45
+ * @author Vova Feldman (@svovaf)
46
+ * @since 1.0.3
47
+ *
48
+ * @param string $id
49
+ * @param bool $load
50
+ */
51
+ private function __construct( $id, $load = false ) {
52
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
53
+
54
+ $this->_logger->entrance();
55
+ $this->_logger->log( 'id = ' . $id );
56
+
57
+ $this->_id = $id;
58
+
59
+ if ( $load ) {
60
+ $this->load();
61
+ }
62
+ }
63
+
64
+ /**
65
+ * @author Vova Feldman (@svovaf)
66
+ * @since 1.0.3
67
+ *
68
+ * @param $id
69
+ * @param $load
70
+ *
71
+ * @return FS_Option_Manager
72
+ */
73
+ static function get_manager( $id, $load = false ) {
74
+ $id = strtolower( $id );
75
+
76
+ if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
77
+ self::$_MANAGERS[ $id ] = new FS_Option_Manager( $id, $load );
78
+ } // If load required but not yet loaded, load.
79
+ else if ( $load && ! self::$_MANAGERS[ $id ]->is_loaded() ) {
80
+ self::$_MANAGERS[ $id ]->load();
81
+ }
82
+
83
+ return self::$_MANAGERS[ $id ];
84
+ }
85
+
86
+ private function _get_option_manager_name() {
87
+ // return WP_FS__SLUG . '_' . $this->_id;
88
+ return $this->_id;
89
+ }
90
+
91
+ /**
92
+ * @author Vova Feldman (@svovaf)
93
+ * @since 1.0.3
94
+ *
95
+ * @param bool $flush
96
+ */
97
+ function load( $flush = false ) {
98
+ $this->_logger->entrance();
99
+
100
+ $option_name = $this->_get_option_manager_name();
101
+
102
+ if ( $flush || ! isset( $this->_options ) ) {
103
+ if ( isset( $this->_options ) ) {
104
+ // Clear prev options.
105
+ $this->clear();
106
+ }
107
+
108
+ if ( ! WP_FS__DEBUG_SDK ) {
109
+ $this->_options = wp_cache_get( $option_name, WP_FS__SLUG );
110
+ }
111
+
112
+ // $this->_logger->info('wp_cache_get = ' . var_export($this->_options, true));
113
+
114
+ // if ( is_array( $this->_options ) ) {
115
+ // $this->clear();
116
+ // }
117
+
118
+ $cached = true;
119
+
120
+ if ( empty( $this->_options ) ) {
121
+ $this->_options = get_option( $option_name );
122
+
123
+ if ( is_string( $this->_options ) ) {
124
+ $this->_options = json_decode( $this->_options );
125
+ }
126
+
127
+ // $this->_logger->info('get_option = ' . var_export($this->_options, true));
128
+
129
+ if ( false === $this->_options ) {
130
+ $this->clear();
131
+ }
132
+
133
+ $cached = false;
134
+ }
135
+
136
+ if ( ! WP_FS__DEBUG_SDK && ! $cached ) // Set non encoded cache.
137
+ {
138
+ wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
139
+ }
140
+ }
141
+ }
142
+
143
+ /**
144
+ * @author Vova Feldman (@svovaf)
145
+ * @since 1.0.3
146
+ *
147
+ * @return bool
148
+ */
149
+ function is_loaded() {
150
+ return isset( $this->_options );
151
+ }
152
+
153
+ /**
154
+ * @author Vova Feldman (@svovaf)
155
+ * @since 1.0.3
156
+ *
157
+ * @return bool
158
+ */
159
+ function is_empty() {
160
+ return ( $this->is_loaded() && false === $this->_options );
161
+ }
162
+
163
+ /**
164
+ * @author Vova Feldman (@svovaf)
165
+ * @since 1.0.6
166
+ *
167
+ * @param bool $flush
168
+ */
169
+ function clear( $flush = false ) {
170
+ $this->_logger->entrance();
171
+
172
+ $this->_options = array();
173
+
174
+ if ( $flush ) {
175
+ $this->store();
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Delete options manager from DB.
181
+ *
182
+ * @author Vova Feldman (@svovaf)
183
+ * @since 1.0.9
184
+ */
185
+ function delete() {
186
+ delete_option( $this->_get_option_manager_name() );
187
+ }
188
+
189
+ /**
190
+ * @author Vova Feldman (@svovaf)
191
+ * @since 1.0.6
192
+ *
193
+ * @param string $option
194
+ *
195
+ * @return bool
196
+ */
197
+ function has_option( $option ) {
198
+ return array_key_exists( $option, $this->_options );
199
+ }
200
+
201
+ /**
202
+ * @author Vova Feldman (@svovaf)
203
+ * @since 1.0.3
204
+ *
205
+ * @param string $option
206
+ * @param mixed $default
207
+ *
208
+ * @return mixed
209
+ */
210
+ function get_option( $option, $default = null ) {
211
+ $this->_logger->entrance( 'option = ' . $option );
212
+
213
+ if ( is_array( $this->_options ) ) {
214
+ return isset( $this->_options[ $option ] ) ? $this->_options[ $option ] : $default;
215
+ } else if ( is_object( $this->_options ) ) {
216
+ return isset( $this->_options->{$option} ) ? $this->_options->{$option} : $default;
217
+ }
218
+
219
+ return $default;
220
+ }
221
+
222
+ /**
223
+ * @author Vova Feldman (@svovaf)
224
+ * @since 1.0.3
225
+ *
226
+ * @param string $option
227
+ * @param mixed $value
228
+ * @param bool $flush
229
+ */
230
+ function set_option( $option, $value, $flush = false ) {
231
+ $this->_logger->entrance( 'option = ' . $option );
232
+
233
+ if ( ! $this->is_loaded() ) {
234
+ $this->clear();
235
+ }
236
+
237
+ if ( is_array( $this->_options ) ) {
238
+ $this->_options[ $option ] = $value;
239
+ } else if ( is_object( $this->_options ) ) {
240
+ $this->_options->{$option} = $value;
241
+ }
242
+
243
+ if ( $flush ) {
244
+ $this->store();
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Unset option.
250
+ *
251
+ * @author Vova Feldman (@svovaf)
252
+ * @since 1.0.3
253
+ *
254
+ * @param string $option
255
+ * @param bool $flush
256
+ */
257
+ function unset_option( $option, $flush = false ) {
258
+ $this->_logger->entrance( 'option = ' . $option );
259
+
260
+ if ( is_array( $this->_options ) ) {
261
+ if ( ! isset( $this->_options[ $option ] ) ) {
262
+ return;
263
+ }
264
+
265
+ unset( $this->_options[ $option ] );
266
+
267
+ } else if ( is_object( $this->_options ) ) {
268
+ if ( ! isset( $this->_options->{$option} ) ) {
269
+ return;
270
+ }
271
+
272
+ unset( $this->_options->{$option} );
273
+ }
274
+
275
+ if ( $flush ) {
276
+ $this->store();
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Dump options to database.
282
+ *
283
+ * @author Vova Feldman (@svovaf)
284
+ * @since 1.0.3
285
+ */
286
+ function store() {
287
+ $this->_logger->entrance();
288
+
289
+ $option_name = $this->_get_option_manager_name();
290
+
291
+ if ( $this->_logger->is_on() ) {
292
+ $this->_logger->info( $option_name . ' = ' . var_export( $this->_options, true ) );
293
+ }
294
+
295
+ // Update DB.
296
+ update_option( $option_name, $this->_options );
297
+
298
+ if ( ! WP_FS__DEBUG_SDK ) {
299
+ wp_cache_set( $option_name, $this->_options, WP_FS__SLUG );
300
+ }
301
+ }
302
+ }
freemius/includes/managers/class-fs-plan-manager.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plan_Manager {
14
+ /**
15
+ * @var FS_Plan_Manager
16
+ */
17
+ private static $_instance;
18
+
19
+ /**
20
+ * @return FS_Plan_Manager
21
+ */
22
+ static function instance() {
23
+ if ( ! isset( self::$_instance ) ) {
24
+ self::$_instance = new FS_Plan_Manager();
25
+ }
26
+
27
+ return self::$_instance;
28
+ }
29
+
30
+ private function __construct() {
31
+ }
32
+
33
+ /**
34
+ * @param FS_Plugin_License[] $licenses
35
+ *
36
+ * @return bool
37
+ */
38
+ function has_premium_license( $licenses ) {
39
+ if ( is_array( $licenses ) ) {
40
+ /**
41
+ * @var FS_Plugin_License[] $licenses
42
+ */
43
+ foreach ( $licenses as $license ) {
44
+ if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
45
+ return true;
46
+ }
47
+ }
48
+ }
49
+
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * Check if plugin has any paid plans.
55
+ *
56
+ * @author Vova Feldman (@svovaf)
57
+ * @since 1.0.7
58
+ *
59
+ * @param FS_Plugin_Plan[] $plans
60
+ *
61
+ * @return bool
62
+ */
63
+ function has_paid_plan( $plans ) {
64
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
65
+ return false;
66
+ }
67
+
68
+ /**
69
+ * @var FS_Plugin_Plan[] $plans
70
+ */
71
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
72
+ if ( ! $plans[ $i ]->is_free() ) {
73
+ return true;
74
+ }
75
+ }
76
+
77
+ return false;
78
+ }
79
+
80
+ /**
81
+ * Check if plugin has any free plan, or is it premium only.
82
+ *
83
+ * Note: If no plans configured, assume plugin is free.
84
+ *
85
+ * @author Vova Feldman (@svovaf)
86
+ * @since 1.0.7
87
+ *
88
+ * @param FS_Plugin_Plan[] $plans
89
+ *
90
+ * @return bool
91
+ */
92
+ function has_free_plan( $plans ) {
93
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
94
+ return true;
95
+ }
96
+
97
+ /**
98
+ * @var FS_Plugin_Plan[] $plans
99
+ */
100
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
101
+ if ( $plans[ $i ]->is_free() ) {
102
+ return true;
103
+ }
104
+ }
105
+
106
+ return false;
107
+ }
108
+
109
+ /**
110
+ * Find all plans that have trial.
111
+ *
112
+ * @author Vova Feldman (@svovaf)
113
+ * @since 1.0.9
114
+ *
115
+ * @param FS_Plugin_Plan[] $plans
116
+ *
117
+ * @return FS_Plugin_Plan[]
118
+ */
119
+ function get_trial_plans( $plans ) {
120
+ $trial_plans = array();
121
+
122
+ if ( is_array( $plans ) && 0 < count( $plans ) ) {
123
+ /**
124
+ * @var FS_Plugin_Plan[] $plans
125
+ */
126
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
127
+ if ( $plans[ $i ]->has_trial() ) {
128
+ $trial_plans[] = $plans[ $i ];
129
+ }
130
+ }
131
+ }
132
+
133
+ return $trial_plans;
134
+ }
135
+
136
+ /**
137
+ * Check if plugin has any trial plan.
138
+ *
139
+ * @author Vova Feldman (@svovaf)
140
+ * @since 1.0.9
141
+ *
142
+ * @param FS_Plugin_Plan[] $plans
143
+ *
144
+ * @return bool
145
+ */
146
+ function has_trial_plan( $plans ) {
147
+ if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
148
+ return true;
149
+ }
150
+
151
+ /**
152
+ * @var FS_Plugin_Plan[] $plans
153
+ */
154
+ for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
155
+ if ( $plans[ $i ]->has_trial() ) {
156
+ return true;
157
+ }
158
+ }
159
+
160
+ return false;
161
+ }
162
+ }
freemius/includes/managers/class-fs-plugin-manager.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.6
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ class FS_Plugin_Manager {
14
+ /**
15
+ * @var string
16
+ */
17
+ protected $_slug;
18
+ /**
19
+ * @var FS_Plugin
20
+ */
21
+ protected $_plugin;
22
+
23
+ /**
24
+ * @var FS_Plugin_Manager[]
25
+ */
26
+ private static $_instances = array();
27
+ /**
28
+ * @var FS_Logger
29
+ */
30
+ protected $_logger;
31
+
32
+ /**
33
+ * @param string $slug
34
+ *
35
+ * @return FS_Plugin_Manager
36
+ */
37
+ static function instance( $slug ) {
38
+ if ( ! isset( self::$_instances[ $slug ] ) ) {
39
+ self::$_instances[ $slug ] = new FS_Plugin_Manager( $slug );
40
+ }
41
+
42
+ return self::$_instances[ $slug ];
43
+ }
44
+
45
+ protected function __construct( $slug ) {
46
+ $this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $slug . '_' . 'plugins', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
47
+
48
+ $this->_slug = $slug;
49
+ $this->load();
50
+ }
51
+
52
+ protected function get_option_manager() {
53
+ return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true );
54
+ }
55
+
56
+ protected function get_all_plugins() {
57
+ return $this->get_option_manager()->get_option( 'plugins', array() );
58
+ }
59
+
60
+ /**
61
+ * Load plugin data from local DB.
62
+ *
63
+ * @author Vova Feldman (@svovaf)
64
+ * @since 1.0.6
65
+ */
66
+ function load() {
67
+ $all_plugins = $this->get_all_plugins();
68
+ $this->_plugin = isset( $all_plugins[ $this->_slug ] ) ?
69
+ $all_plugins[ $this->_slug ] :
70
+ null;
71
+ }
72
+
73
+ /**
74
+ * Store plugin on local DB.
75
+ *
76
+ * @author Vova Feldman (@svovaf)
77
+ * @since 1.0.6
78
+ *
79
+ * @param bool|FS_Plugin $plugin
80
+ * @param bool $flush
81
+ *
82
+ * @return bool|\FS_Plugin
83
+ */
84
+ function store( $plugin = false, $flush = true ) {
85
+ $all_plugins = $this->get_all_plugins();
86
+
87
+ if ( false !== $plugin ) {
88
+ $this->_plugin = $plugin;
89
+ }
90
+
91
+ $all_plugins[ $this->_slug ] = $this->_plugin;
92
+
93
+ $options_manager = $this->get_option_manager();
94
+ $options_manager->set_option( 'plugins', $all_plugins, $flush );
95
+
96
+ return $this->_plugin;
97
+ }
98
+
99
+ /**
100
+ * Update local plugin data if different.
101
+ *
102
+ * @author Vova Feldman (@svovaf)
103
+ * @since 1.0.6
104
+ *
105
+ * @param \FS_Plugin $plugin
106
+ * @param bool $store
107
+ *
108
+ * @return bool True if plugin was updated.
109
+ */
110
+ function update( FS_Plugin $plugin, $store = true ) {
111
+ if ( ! ( $this->_plugin instanceof FS_Plugin ) ||
112
+ $this->_plugin->slug != $plugin->slug ||
113
+ $this->_plugin->public_key != $plugin->public_key ||
114
+ $this->_plugin->secret_key != $plugin->secret_key ||
115
+ $this->_plugin->parent_plugin_id != $plugin->parent_plugin_id ||
116
+ $this->_plugin->title != $plugin->title
117
+ ) {
118
+ $this->store( $plugin, $store );
119
+
120
+ return true;
121
+ }
122
+
123
+ return false;
124
+ }
125
+
126
+ /**
127
+ * @author Vova Feldman (@svovaf)
128
+ * @since 1.0.6
129
+ *
130
+ * @param FS_Plugin $plugin
131
+ * @param bool $store
132
+ */
133
+ function set( FS_Plugin $plugin, $store = false ) {
134
+ $this->_plugin = $plugin;
135
+
136
+ if ( $store ) {
137
+ $this->store();
138
+ }
139
+ }
140
+
141
+ /**
142
+ * @author Vova Feldman (@svovaf)
143
+ * @since 1.0.6
144
+ *
145
+ * @return bool|\FS_Plugin
146
+ */
147
+ function get() {
148
+ return isset( $this->_plugin ) ?
149
+ $this->_plugin :
150
+ false;
151
+ }
152
+
153
+
154
+ }
freemius/includes/sdk/Exceptions/ArgumentNotExistException.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
+ exit;
4
+ }
5
+
6
+ if ( ! class_exists( 'Freemius_ArgumentNotExistException' ) ) {
7
+ class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException {
8
+ }
9
+ }
freemius/includes/sdk/Exceptions/EmptyArgumentException.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
3
+ exit;
4
+ }
5
+
6
+ if ( ! class_exists( 'Freemius_EmptyArgumentException' ) ) {
7
+ class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException {
8
+ }
9
+ }
freemius/includes/sdk/Exceptions/Exception.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Freemius_Exception' ) ) {
3
+ /**
4
+ * Thrown when an API call returns an exception.
5
+ *
6
+ */
7
+ class Freemius_Exception extends Exception {
8
+ protected $_result;
9
+ protected $_type;
10
+ protected $_code;
11
+
12
+ /**
13
+ * Make a new API Exception with the given result.
14
+ *
15
+ * @param array $result The result from the API server.
16
+ */
17
+ public function __construct( $result ) {
18
+ $this->_result = $result;
19
+
20
+ $code = 0;
21
+ $message = 'Unknown error, please check GetResult().';
22
+ $type = '';
23
+
24
+ if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
25
+ if ( isset( $result['error']['code'] ) ) {
26
+ $code = $result['error']['code'];
27
+ }
28
+ if ( isset( $result['error']['message'] ) ) {
29
+ $message = $result['error']['message'];
30
+ }
31
+ if ( isset( $result['error']['type'] ) ) {
32
+ $type = $result['error']['type'];
33
+ }
34
+ }
35
+
36
+ $this->_type = $type;
37
+ $this->_code = $code;
38
+
39
+ parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
40
+ }
41
+
42
+ /**
43
+ * Return the associated result object returned by the API server.
44
+ *
45
+ * @return array The result from the API server
46
+ */
47
+ public function getResult() {
48
+ return $this->_result;
49
+ }
50
+
51
+ public function getStringCode() {
52
+ return $this->_code;
53
+ }
54
+
55
+ public function getType() {
56
+ return $this->_type;
57
+ }
58
+
59
+ /**
60
+ * To make debugging easier.
61
+ *
62
+ * @return string The string representation of the error
63
+ */
64
+ public function __toString() {
65
+ $str = $this->getType() . ': ';
66
+
67
+ if ( $this->code != 0 ) {
68
+ $str .= $this->getStringCode() . ': ';
69
+ }
70
+
71
+ return $str . $this->getMessage();
72
+ }
73
+ }
74
+ }
freemius/includes/sdk/Exceptions/InvalidArgumentException.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Freemius_Exception' ) ) {
3
+ exit;
4
+ }
5
+
6
+ if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
7
+ class Freemius_InvalidArgumentException extends Freemius_Exception { }
8
+ }
freemius/includes/sdk/Exceptions/OAuthException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! class_exists( 'Freemius_Exception' ) ) {
3
+ exit;
4
+ }
5
+
6
+ if ( ! class_exists( 'Freemius_OAuthException' ) ) {
7
+ class Freemius_OAuthException extends Freemius_Exception {
8
+ public function __construct( $pResult ) {
9
+ parent::__construct( $pResult );
10
+ }
11
+ }
12
+ }
freemius/includes/sdk/Freemius.php ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Freemius, Inc.
4
+ *
5
+ * Licensed under the GPL v2 (the "License"); you may
6
+ * not use this file except in compliance with the License. You may obtain
7
+ * a copy of the License at
8
+ *
9
+ * http://choosealicense.com/licenses/gpl-v2/
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations
15
+ * under the License.
16
+ */
17
+
18
+ require_once( dirname( __FILE__ ) . '/FreemiusBase.php' );
19
+
20
+ if ( ! defined( 'FS_SDK__USER_AGENT' ) ) {
21
+ define( 'FS_SDK__USER_AGENT', 'fs-php-' . Freemius_Api_Base::VERSION );
22
+ }
23
+
24
+ if ( ! defined( 'FS_SDK__SIMULATE_NO_CURL' ) ) {
25
+ define( 'FS_SDK__SIMULATE_NO_CURL', false );
26
+ }
27
+
28
+ if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE' ) ) {
29
+ define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE', false );
30
+ }
31
+
32
+ if ( ! defined( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL' ) ) {
33
+ define( 'FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL', false );
34
+ }
35
+
36
+ if ( ! defined( 'FS_SDK__HAS_CURL' ) ) {
37
+ define( 'FS_SDK__HAS_CURL', ! FS_SDK__SIMULATE_NO_CURL && function_exists( 'curl_version' ) );
38
+ }
39
+
40
+ if ( ! FS_SDK__HAS_CURL ) {
41
+ $curl_version = array( 'version' => '7.0.0' );
42
+ } else {
43
+ $curl_version = curl_version();
44
+ }
45
+
46
+ if ( ! defined( 'FS_API__PROTOCOL' ) ) {
47
+ define( 'FS_API__PROTOCOL', version_compare( $curl_version['version'], '7.37', '>=' ) ? 'https' : 'http' );
48
+ }
49
+
50
+ if ( ! defined( 'FS_API__LOGGER_ON' ) ) {
51
+ define( 'FS_API__LOGGER_ON', false );
52
+ }
53
+
54
+ if ( ! defined( 'FS_API__ADDRESS' ) ) {
55
+ define( 'FS_API__ADDRESS', '://api.freemius.com' );
56
+ }
57
+ if ( ! defined( 'FS_API__SANDBOX_ADDRESS' ) ) {
58
+ define( 'FS_API__SANDBOX_ADDRESS', '://sandbox-api.freemius.com' );
59
+ }
60
+
61
+ if ( class_exists( 'Freemius_Api' ) ) {
62
+ return;
63
+ }
64
+
65
+ class Freemius_Api extends Freemius_Api_Base {
66
+ private static $_logger = array();
67
+
68
+ /**
69
+ * @param string $pScope 'app', 'developer', 'user' or 'install'.
70
+ * @param number $pID Element's id.
71
+ * @param string $pPublic Public key.
72
+ * @param string|bool $pSecret Element's secret key.
73
+ * @param bool $pSandbox Whether or not to run API in sandbox mode.
74
+ */
75
+ public function __construct( $pScope, $pID, $pPublic, $pSecret = false, $pSandbox = false ) {
76
+ // If secret key not provided, use public key encryption.
77
+ if ( is_bool( $pSecret ) ) {
78
+ $pSecret = $pPublic;
79
+ }
80
+
81
+ parent::Init( $pScope, $pID, $pPublic, $pSecret, $pSandbox );
82
+ }
83
+
84
+ public static function GetUrl( $pCanonizedPath = '', $pIsSandbox = false ) {
85
+ $address = ( $pIsSandbox ? FS_API__SANDBOX_ADDRESS : FS_API__ADDRESS );
86
+
87
+ if ( ':' === $address[0] ) {
88
+ $address = self::$_protocol . $address;
89
+ }
90
+
91
+ return $address . $pCanonizedPath;
92
+ }
93
+
94
+ #region Servers Clock Diff ------------------------------------------------------
95
+
96
+ /**
97
+ * @var int Clock diff in seconds between current server to API server.
98
+ */
99
+ private static $_clock_diff = 0;
100
+
101
+ /**
102
+ * Set clock diff for all API calls.
103
+ *
104
+ * @since 1.0.3
105
+ *
106
+ * @param $pSeconds
107
+ */
108
+ public static function SetClockDiff( $pSeconds ) {
109
+ self::$_clock_diff = $pSeconds;
110
+ }
111
+
112
+ /**
113
+ * Find clock diff between current server to API server.
114
+ *
115
+ * @since 1.0.2
116
+ * @return int Clock diff in seconds.
117
+ */
118
+ public static function FindClockDiff() {
119
+ $time = time();
120
+ $pong = self::Ping();
121
+
122
+ return ( $time - strtotime( $pong->timestamp ) );
123
+ }
124
+
125
+ #endregion Servers Clock Diff ------------------------------------------------------
126
+
127
+ /**
128
+ * @var string http or https
129
+ */
130
+ private static $_protocol = FS_API__PROTOCOL;
131
+
132
+ /**
133
+ * Set API connection protocol.
134
+ *
135
+ * @since 1.0.4
136
+ */
137
+ public static function SetHttp() {
138
+ self::$_protocol = 'http';
139
+ }
140
+
141
+ /**
142
+ * @since 1.0.4
143
+ *
144
+ * @return bool
145
+ */
146
+ public static function IsHttps() {
147
+ return ( 'https' === self::$_protocol );
148
+ }
149
+
150
+ /**
151
+ * Sign request with the following HTTP headers:
152
+ * Content-MD5: MD5(HTTP Request body)
153
+ * Date: Current date (i.e Sat, 14 Feb 2015 20:24:46 +0000)
154
+ * Authorization: FS {scope_entity_id}:{scope_entity_public_key}:base64encode(sha256(string_to_sign,
155
+ * {scope_entity_secret_key}))
156
+ *
157
+ * @param string $pResourceUrl
158
+ * @param array $pCurlOptions
159
+ *
160
+ * @return array
161
+ */
162
+ function SignRequest( $pResourceUrl, $pCurlOptions ) {
163
+ $eol = "\n";
164
+ $content_md5 = '';
165
+ $now = ( time() - self::$_clock_diff );
166
+ $date = date( 'r', $now );
167
+ $content_type = '';
168
+
169
+ if ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] ) {
170
+ $content_md5 = md5( $pCurlOptions[ CURLOPT_POSTFIELDS ] );
171
+ $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Content-MD5: ' . $content_md5;
172
+ $content_type = 'application/json';
173
+ }
174
+
175
+ $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Date: ' . $date;
176
+
177
+ $string_to_sign = implode( $eol, array(
178
+ $pCurlOptions[ CURLOPT_CUSTOMREQUEST ],
179
+ $content_md5,
180
+ $content_type,
181
+ $date,
182
+ $pResourceUrl
183
+ ) );
184
+
185
+ // If secret and public keys are identical, it means that
186
+ // the signature uses public key hash encoding.
187
+ $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP';
188
+
189
+ // Add authorization header.
190
+ $pCurlOptions[ CURLOPT_HTTPHEADER ][] = 'Authorization: ' .
191
+ $auth_type . ' ' .
192
+ $this->_id . ':' .
193
+ $this->_public . ':' .
194
+ self::Base64UrlEncode(
195
+ hash_hmac( 'sha256', $string_to_sign, $this->_secret )
196
+ );
197
+
198
+ return $pCurlOptions;
199
+ }
200
+
201
+ /**
202
+ * Get API request URL signed via query string.
203
+ *
204
+ * @param string $pPath
205
+ *
206
+ * @throws Freemius_Exception
207
+ *
208
+ * @return string
209
+ */
210
+ function GetSignedUrl( $pPath ) {
211
+ $resource = explode( '?', $this->CanonizePath( $pPath ) );
212
+ $pResourceUrl = $resource[0];
213
+
214
+ $eol = "\n";
215
+ $content_md5 = '';
216
+ $content_type = '';
217
+ $now = ( time() - self::$_clock_diff );
218
+ $date = date( 'r', $now );
219
+
220
+ $string_to_sign = implode( $eol, array(
221
+ 'GET',
222
+ $content_md5,
223
+ $content_type,
224
+ $date,
225
+ $pResourceUrl
226
+ ) );
227
+
228
+ // If secret and public keys are identical, it means that
229
+ // the signature uses public key hash encoding.
230
+ $auth_type = ( $this->_secret !== $this->_public ) ? 'FS' : 'FSP';
231
+
232
+ return Freemius_Api::GetUrl(
233
+ $pResourceUrl . '?' .
234
+ ( 1 < count( $resource ) && ! empty( $resource[1] ) ? $resource[1] . '&' : '' ) .
235
+ http_build_query( array(
236
+ 'auth_date' => $date,
237
+ 'authorization' => $auth_type . ' ' . $this->_id . ':' .
238
+ $this->_public . ':' .
239
+ self::Base64UrlEncode( hash_hmac(
240
+ 'sha256', $string_to_sign, $this->_secret
241
+ ) )
242
+ ) ), $this->_isSandbox );
243
+ }
244
+
245
+ /**
246
+ * @param resource $pCurlHandler
247
+ * @param array $pCurlOptions
248
+ *
249
+ * @return mixed
250
+ */
251
+ private static function ExecuteRequest( &$pCurlHandler, &$pCurlOptions ) {
252
+ $start = microtime( true );
253
+
254
+ $result = curl_exec( $pCurlHandler );
255
+
256
+ if ( FS_API__LOGGER_ON ) {
257
+ $end = microtime( true );
258
+
259
+ $has_body = ( isset( $pCurlOptions[ CURLOPT_POST ] ) && 0 < $pCurlOptions[ CURLOPT_POST ] );
260
+
261
+ self::$_logger[] = array(
262
+ 'id' => count( self::$_logger ),
263
+ 'start' => $start,
264
+ 'end' => $end,
265
+ 'total' => ( $end - $start ),
266
+ 'method' => $pCurlOptions[ CURLOPT_CUSTOMREQUEST ],
267
+ 'path' => $pCurlOptions[ CURLOPT_URL ],
268
+ 'body' => $has_body ? $pCurlOptions[ CURLOPT_POSTFIELDS ] : null,
269
+ 'result' => $result,
270
+ 'code' => curl_getinfo( $pCurlHandler, CURLINFO_HTTP_CODE ),
271
+ 'backtrace' => debug_backtrace(),
272
+ );
273
+ }
274
+
275
+ return $result;
276
+ }
277
+
278
+ /**
279
+ * @return array
280
+ */
281
+ static function GetLogger() {
282
+ return self::$_logger;
283
+ }
284
+
285
+ /**
286
+ * @param string $pCanonizedPath
287
+ * @param string $pMethod
288
+ * @param array $pParams
289
+ * @param null|resource $pCurlHandler
290
+ * @param bool $pIsSandbox
291
+ * @param null|callable $pBeforeExecutionFunction
292
+ *
293
+ * @return object[]|object|null
294
+ *
295
+ * @throws \Freemius_Exception
296
+ */
297
+ private static function MakeStaticRequest(
298
+ $pCanonizedPath,
299
+ $pMethod = 'GET',
300
+ $pParams = array(),
301
+ $pCurlHandler = null,
302
+ $pIsSandbox = false,
303
+ $pBeforeExecutionFunction = null
304
+ ) {
305
+ if ( ! FS_SDK__HAS_CURL ) {
306
+ self::ThrowNoCurlException();
307
+ }
308
+
309
+ // Connectivity errors simulation.
310
+ if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_CLOUDFLARE ) {
311
+ self::ThrowCloudFlareDDoSException();
312
+ } else if ( FS_SDK__SIMULATE_NO_API_CONNECTIVITY_SQUID_ACL ) {
313
+ self::ThrowSquidAclException();
314
+ }
315
+
316
+ if ( ! $pCurlHandler ) {
317
+ $pCurlHandler = curl_init();
318
+ }
319
+
320
+ $opts = array(
321
+ CURLOPT_CONNECTTIMEOUT => 10,
322
+ CURLOPT_RETURNTRANSFER => true,
323
+ CURLOPT_TIMEOUT => 60,
324
+ CURLOPT_USERAGENT => FS_SDK__USER_AGENT,
325
+ CURLOPT_HTTPHEADER => array(),
326
+ );
327
+
328
+ if ( 'POST' === $pMethod || 'PUT' === $pMethod ) {
329
+ if ( is_array( $pParams ) && 0 < count( $pParams ) ) {
330
+ $opts[ CURLOPT_HTTPHEADER ][] = 'Content-Type: application/json';
331
+ $opts[ CURLOPT_POST ] = count( $pParams );
332
+ $opts[ CURLOPT_POSTFIELDS ] = json_encode( $pParams );
333
+ }
334
+
335
+ $opts[ CURLOPT_RETURNTRANSFER ] = true;
336
+ }
337
+
338
+ $request_url = self::GetUrl( $pCanonizedPath, $pIsSandbox );
339
+
340
+ $opts[ CURLOPT_URL ] = $request_url;
341
+ $opts[ CURLOPT_CUSTOMREQUEST ] = $pMethod;
342
+
343
+ $resource = explode( '?', $pCanonizedPath );
344
+
345
+ // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
346
+ // for 2 seconds if the server does not support this header.
347
+ $opts[ CURLOPT_HTTPHEADER ][] = 'Expect:';
348
+
349
+ if ( 'https' === substr( strtolower( $request_url ), 0, 5 ) ) {
350
+ $opts[ CURLOPT_SSL_VERIFYHOST ] = false;
351
+ $opts[ CURLOPT_SSL_VERIFYPEER ] = false;
352
+ }
353
+
354
+ if ( false !== $pBeforeExecutionFunction &&
355
+ is_callable( $pBeforeExecutionFunction )
356
+ ) {
357
+ $opts = call_user_func( $pBeforeExecutionFunction, $resource[0], $opts );
358
+ }
359
+
360
+ curl_setopt_array( $pCurlHandler, $opts );
361
+ $result = self::ExecuteRequest( $pCurlHandler, $opts );
362
+
363
+ /*if (curl_errno($ch) == 60) // CURLE_SSL_CACERT
364
+ {
365
+ self::errorLog('Invalid or no certificate authority found, using bundled information');
366
+ curl_setopt($ch, CURLOPT_CAINFO,
367
+ dirname(__FILE__) . '/fb_ca_chain_bundle.crt');
368
+ $result = curl_exec($ch);
369
+ }*/
370
+
371
+ // With dual stacked DNS responses, it's possible for a server to
372
+ // have IPv6 enabled but not have IPv6 connectivity. If this is
373
+ // the case, curl will try IPv4 first and if that fails, then it will
374
+ // fall back to IPv6 and the error EHOSTUNREACH is returned by the
375
+ // operating system.
376
+ if ( false === $result && empty( $opts[ CURLOPT_IPRESOLVE ] ) ) {
377
+ $matches = array();
378
+ $regex = '/Failed to connect to ([^:].*): Network is unreachable/';
379
+ if ( preg_match( $regex, curl_error( $pCurlHandler ), $matches ) ) {
380
+ if ( strlen( @inet_pton( $matches[1] ) ) === 16 ) {
381
+ // self::errorLog('Invalid IPv6 configuration on server, Please disable or get native IPv6 on your server.');
382
+ $opts[ CURLOPT_IPRESOLVE ] = CURL_IPRESOLVE_V4;
383
+ curl_setopt( $pCurlHandler, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
384
+ $result = self::ExecuteRequest( $pCurlHandler, $opts );
385
+ }
386
+ }
387
+ }
388
+
389
+ if ( $result === false ) {
390
+ self::ThrowCurlException( $pCurlHandler );
391
+ }
392
+
393
+ curl_close( $pCurlHandler );
394
+
395
+ if ( empty( $result ) ) {
396
+ return null;
397
+ }
398
+
399
+ $decoded = json_decode( $result );
400
+
401
+ if ( is_null( $decoded ) ) {
402
+ if ( preg_match( '/Please turn JavaScript on/i', $result ) &&
403
+ preg_match( '/text\/javascript/', $result )
404
+ ) {
405
+ self::ThrowCloudFlareDDoSException( $result );
406
+ } else if ( preg_match( '/Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect./', $result ) &&
407
+ preg_match( '/squid/', $result )
408
+ ) {
409
+ self::ThrowSquidAclException( $result );
410
+ } else {
411
+ $decoded = (object) array(
412
+ 'error' => (object) array(
413
+ 'type' => 'Unknown',
414
+ 'message' => $result,
415
+ 'code' => 'unknown',
416
+ 'http' => 402
417
+ )
418
+ );
419
+ }
420
+ }
421
+
422
+ return $decoded;
423
+ }
424
+
425
+
426
+ /**
427
+ * Makes an HTTP request. This method can be overridden by subclasses if
428
+ * developers want to do fancier things or use something other than curl to
429
+ * make the request.
430
+ *
431
+ * @param string $pCanonizedPath The URL to make the request to
432
+ * @param string $pMethod HTTP method
433
+ * @param array $pParams The parameters to use for the POST body
434
+ * @param null|resource $pCurlHandler Initialized curl handle
435
+ *
436
+ * @return object[]|object|null
437
+ *
438
+ * @throws Freemius_Exception
439
+ */
440
+ public function MakeRequest(
441
+ $pCanonizedPath,
442
+ $pMethod = 'GET',
443
+ $pParams = array(),
444
+ $pCurlHandler = null
445
+ ) {
446
+ $resource = explode( '?', $pCanonizedPath );
447
+
448
+ // Only sign request if not ping.json connectivity test.
449
+ $sign_request = ( '/v1/ping.json' !== strtolower( substr( $resource[0], - strlen( '/v1/ping.json' ) ) ) );
450
+
451
+ return self::MakeStaticRequest(
452
+ $pCanonizedPath,
453
+ $pMethod,
454
+ $pParams,
455
+ $pCurlHandler,
456
+ $this->_isSandbox,
457
+ $sign_request ? array( &$this, 'SignRequest' ) : null
458
+ );
459
+ }
460
+
461
+ #region Connectivity Test ------------------------------------------------------
462
+
463
+ /**
464
+ * If successful connectivity to the API endpoint using ping.json endpoint.
465
+ *
466
+ * - OR -
467
+ *
468
+ * Validate if ping result object is valid.
469
+ *
470
+ * @param mixed $pPong
471
+ *
472
+ * @return bool
473
+ */
474
+ public static function Test( $pPong = null ) {
475
+ $pong = is_null( $pPong ) ?
476
+ self::Ping() :
477
+ $pPong;
478
+
479
+ return (
480
+ is_object( $pong ) &&
481
+ isset( $pong->api ) &&
482
+ 'pong' === $pong->api
483
+ );
484
+ }
485
+
486
+ /**
487
+ * Ping API to test connectivity.
488
+ *
489
+ * @return object
490
+ */
491
+ public static function Ping() {
492
+ try {
493
+ $result = self::MakeStaticRequest( '/v' . FS_API__VERSION . '/ping.json' );
494
+ } catch ( Freemius_Exception $e ) {
495
+ // Map to error object.
496
+ $result = (object) $e->getResult();
497
+ } catch ( Exception $e ) {
498
+ // Map to error object.
499
+ $result = (object) array(
500
+ 'error' => array(
501
+ 'type' => 'Unknown',
502
+ 'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
503
+ 'code' => 'unknown',
504
+ 'http' => 402
505
+ )
506
+ );
507
+ }
508
+
509
+ return $result;
510
+ }
511
+
512
+ #endregion Connectivity Test ------------------------------------------------------
513
+
514
+ #region Connectivity Exceptions ------------------------------------------------------
515
+
516
+ /**
517
+ * @param resource $pCurlHandler
518
+ *
519
+ * @throws Freemius_Exception
520
+ */
521
+ private static function ThrowCurlException( $pCurlHandler ) {
522
+ $e = new Freemius_Exception( array(
523
+ 'error' => array(
524
+ 'code' => curl_errno( $pCurlHandler ),
525
+ 'message' => curl_error( $pCurlHandler ),
526
+ 'type' => 'CurlException',
527
+ ),
528
+ ) );
529
+
530
+ curl_close( $pCurlHandler );
531
+ throw $e;
532
+ }
533
+
534
+ /**
535
+ * @param string $pResult
536
+ *
537
+ * @throws Freemius_Exception
538
+ */
539
+ private static function ThrowNoCurlException( $pResult = '' ) {
540
+ throw new Freemius_Exception( array(
541
+ 'error' => (object) array(
542
+ 'type' => 'cUrlMissing',
543
+ 'message' => $pResult,
544
+ 'code' => 'curl_missing',
545
+ 'http' => 402
546
+ )
547
+ ) );
548
+ }
549
+
550
+ /**
551
+ * @param string $pResult
552
+ *
553
+ * @throws Freemius_Exception
554
+ */
555
+ private static function ThrowCloudFlareDDoSException( $pResult = '' ) {
556
+ throw new Freemius_Exception( array(
557
+ 'error' => (object) array(
558
+ 'type' => 'CloudFlareDDoSProtection',
559
+ 'message' => $pResult,
560
+ 'code' => 'cloudflare_ddos_protection',
561
+ 'http' => 402
562
+ )
563
+ ) );
564
+ }
565
+
566
+ /**
567
+ * @param string $pResult
568
+ *
569
+ * @throws Freemius_Exception
570
+ */
571
+ private static function ThrowSquidAclException( $pResult = '' ) {
572
+ throw new Freemius_Exception( array(
573
+ 'error' => (object) array(
574
+ 'type' => 'SquidCacheBlock',
575
+ 'message' => $pResult,
576
+ 'code' => 'squid_cache_block',
577
+ 'http' => 402
578
+ )
579
+ ) );
580
+ }
581
+
582
+ #endregion Connectivity Exceptions ------------------------------------------------------
583
+ }
freemius/includes/sdk/FreemiusBase.php ADDED
@@ -0,0 +1,188 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2014 Freemius, Inc.
4
+ *
5
+ * Licensed under the GPL v2 (the "License"); you may
6
+ * not use this file except in compliance with the License. You may obtain
7
+ * a copy of the License at
8
+ *
9
+ * http://choosealicense.com/licenses/gpl-v2/
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ * License for the specific language governing permissions and limitations
15
+ * under the License.
16
+ */
17
+
18
+ if ( ! defined( 'FS_API__VERSION' ) ) {
19
+ define( 'FS_API__VERSION', '1' );
20
+ }
21
+ if ( ! defined( 'FS_SDK__PATH' ) ) {
22
+ define( 'FS_SDK__PATH', dirname( __FILE__ ) );
23
+ }
24
+ if ( ! defined( 'FS_SDK__EXCEPTIONS_PATH' ) ) {
25
+ define( 'FS_SDK__EXCEPTIONS_PATH', FS_SDK__PATH . '/Exceptions/' );
26
+ }
27
+
28
+ if ( ! function_exists( 'json_decode' ) ) {
29
+ throw new Exception( 'Freemius needs the JSON PHP extension.' );
30
+ }
31
+
32
+ // Include all exception files.
33
+ $exceptions = array(
34
+ 'Exception',
35
+ 'InvalidArgumentException',
36
+ 'ArgumentNotExistException',
37
+ 'EmptyArgumentException',
38
+ 'OAuthException'
39
+ );
40
+
41
+ foreach ( $exceptions as $e ) {
42
+ require_once FS_SDK__EXCEPTIONS_PATH . $e . '.php';
43
+ }
44
+
45
+ if ( class_exists( 'Freemius_Api_Base' ) ) {
46
+ return;
47
+ }
48
+
49
+ abstract class Freemius_Api_Base {
50
+ const VERSION = '1.0.4';
51
+ const FORMAT = 'json';
52
+
53
+ protected $_id;
54
+ protected $_public;
55
+ protected $_secret;
56
+ protected $_scope;
57
+ protected $_isSandbox;
58
+
59
+ /**
60
+ * @param string $pScope 'app', 'developer', 'plugin', 'user' or 'install'.
61
+ * @param number $pID Element's id.
62
+ * @param string $pPublic Public key.
63
+ * @param string $pSecret Element's secret key.
64
+ * @param bool $pIsSandbox Whether or not to run API in sandbox mode.
65
+ */
66
+ public function Init( $pScope, $pID, $pPublic, $pSecret, $pIsSandbox = false ) {
67
+ $this->_id = $pID;
68
+ $this->_public = $pPublic;
69
+ $this->_secret = $pSecret;
70
+ $this->_scope = $pScope;
71
+ $this->_isSandbox = $pIsSandbox;
72
+ }
73
+
74
+ public function IsSandbox() {
75
+ return $this->_isSandbox;
76
+ }
77
+
78
+ function CanonizePath( $pPath ) {
79
+ $pPath = trim( $pPath, '/' );
80
+ $query_pos = strpos( $pPath, '?' );
81
+ $query = '';
82
+
83
+ if ( false !== $query_pos ) {
84
+ $query = substr( $pPath, $query_pos );
85
+ $pPath = substr( $pPath, 0, $query_pos );
86
+ }
87
+
88
+ // Trim '.json' suffix.
89
+ $format_length = strlen( '.' . self::FORMAT );
90
+ $start = $format_length * ( - 1 ); //negative
91
+ if ( substr( strtolower( $pPath ), $start ) === ( '.' . self::FORMAT ) ) {
92
+ $pPath = substr( $pPath, 0, strlen( $pPath ) - $format_length );
93
+ }
94
+
95
+ switch ( $this->_scope ) {
96
+ case 'app':
97
+ $base = '/apps/' . $this->_id;
98
+ break;
99
+ case 'developer':
100
+ $base = '/developers/' . $this->_id;
101
+ break;
102
+ case 'user':
103
+ $base = '/users/' . $this->_id;
104
+ break;
105
+ case 'plugin':
106
+ $base = '/plugins/' . $this->_id;
107
+ break;
108
+ case 'install':
109
+ $base = '/installs/' . $this->_id;
110
+ break;
111
+ default:
112
+ throw new Freemius_Exception( 'Scope not implemented.' );
113
+ }
114
+
115
+ return '/v' . FS_API__VERSION . $base .
116
+ ( ! empty( $pPath ) ? '/' : '' ) . $pPath .
117
+ ( ( false === strpos( $pPath, '.' ) ) ? '.' . self::FORMAT : '' ) . $query;
118
+ }
119
+
120
+ abstract function MakeRequest( $pCanonizedPath, $pMethod = 'GET', $pParams = array() );
121
+
122
+ /**
123
+ * @param string $pPath
124
+ * @param string $pMethod
125
+ * @param array $pParams
126
+ *
127
+ * @return object[]|object|null
128
+ */
129
+ private function _Api( $pPath, $pMethod = 'GET', $pParams = array() ) {
130
+ $pMethod = strtoupper( $pMethod );
131
+
132
+ try {
133
+ $result = $this->MakeRequest( $pPath, $pMethod, $pParams );
134
+ } catch ( Freemius_Exception $e ) {
135
+ // Map to error object.
136
+ $result = (object) $e->getResult();
137
+ } catch ( Exception $e ) {
138
+ // Map to error object.
139
+ $result = (object) array(
140
+ 'error' => array(
141
+ 'type' => 'Unknown',
142
+ 'message' => $e->getMessage() . ' (' . $e->getFile() . ': ' . $e->getLine() . ')',
143
+ 'code' => 'unknown',
144
+ 'http' => 402
145
+ )
146
+ );
147
+ }
148
+
149
+ return $result;
150
+ }
151
+
152
+ public function Api( $pPath, $pMethod = 'GET', $pParams = array() ) {
153
+ return $this->_Api( $this->CanonizePath( $pPath ), $pMethod, $pParams );
154
+ }
155
+
156
+ /**
157
+ * Base64 encoding that does not need to be urlencode()ed.
158
+ * Exactly the same as base64_encode except it uses
159
+ * - instead of +
160
+ * _ instead of /
161
+ * No padded =
162
+ *
163
+ * @param string $input base64UrlEncoded string
164
+ *
165
+ * @return string
166
+ */
167
+ protected static function Base64UrlDecode( $input ) {
168
+ return base64_decode( strtr( $input, '-_', '+/' ) );
169
+ }
170
+
171
+ /**
172
+ * Base64 encoding that does not need to be urlencode()ed.
173
+ * Exactly the same as base64_encode except it uses
174
+ * - instead of +
175
+ * _ instead of /
176
+ *
177
+ * @param string $input string
178
+ *
179
+ * @return string base64Url encoded string
180
+ */
181
+ protected static function Base64UrlEncode( $input ) {
182
+ $str = strtr( base64_encode( $input ), '+/', '-_' );
183
+ $str = str_replace( '=', '', $str );
184
+
185
+ return $str;
186
+ }
187
+
188
+ }
freemius/includes/sdk/LICENSE.txt ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ {description}
294
+ Copyright (C) {year} {fullname}
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ {signature of Ty Coon}, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
340
+
freemius/includes/supplements/fs-essential-functions-1.1.7.1.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.7
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Find the plugin main file path based on any give file inside the plugin's folder.
15
+ *
16
+ * @author Vova Feldman (@svovaf)
17
+ * @since 1.1.7.1
18
+ *
19
+ * @param string $file Absolute path to a file inside a plugin's folder.
20
+ *
21
+ * @return string
22
+ */
23
+ function fs_find_direct_caller_plugin_file( $file ) {
24
+ /**
25
+ * All the code below will be executed once on activation.
26
+ * If the user changes the main plugin's file name, the file_exists()
27
+ * will catch it.
28
+ */
29
+ if ( ! function_exists( 'get_plugins' ) ) {
30
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
31
+ }
32
+
33
+ $all_plugins = get_plugins();
34
+
35
+ $file_real_path = fs_normalize_path( realpath( $file ) );
36
+
37
+ // Get active plugin's main files real full names (might be symlinks).
38
+ foreach ( $all_plugins as $relative_path => &$data ) {
39
+ if ( 0 === strpos( $file_real_path, fs_normalize_path( dirname( realpath( WP_PLUGIN_DIR . '/' . $relative_path ) ) ) ) ) {
40
+ if ( '.' !== dirname( trailingslashit( $relative_path ) ) ) {
41
+ return $relative_path;
42
+ }
43
+ }
44
+ }
45
+
46
+ return null;
47
+ }
freemius/languages/freemius-da_DK.mo ADDED
Binary file
freemius/languages/freemius-da_DK.po ADDED
@@ -0,0 +1,1661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 freemius
2
+ # This file is distributed under the same license as the freemius package.
3
+ # Translators:
4
+ # Joachim Jensen <jv@intox.dk>, 2016
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WordPress SDK\n"
8
+ "Report-Msgid-Bugs-To: https://github.com/Freemius/wordpress-sdk/issues\n"
9
+ "PO-Revision-Date: 2016-12-07 01:29+0000\n"
10
+ "Last-Translator: Vova Feldman <vova@freemius.com>\n"
11
+ "Language-Team: Danish (Denmark) (http://www.transifex.com/freemius/wordpress-sdk/language/da_DK/)\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Language: da_DK\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Poedit-Basepath: ..\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
21
+ "X-Poedit-SourceCharset: UTF-8\n"
22
+
23
+ #: includes/i18n.php41, includes/i18n.php:55
24
+ msgid "Yes - I'm in!"
25
+ msgstr "Ja - jeg er med!"
26
+
27
+ #: includes/i18n.php43, includes/i18n.php:57
28
+ msgid "Not today"
29
+ msgstr "Ikke i dag"
30
+
31
+ #: includes/i18n.php:69
32
+ msgid "Account"
33
+ msgstr "Konto"
34
+
35
+ #: includes/i18n.php:71
36
+ msgid "Add On"
37
+ msgstr "Tilføjelse"
38
+
39
+ #: includes/i18n.php:73
40
+ msgid "Contact Us"
41
+ msgstr "Kontakt os"
42
+
43
+ #: includes/i18n.php:75
44
+ msgid "Contact Support"
45
+ msgstr "Kontakt support"
46
+
47
+ #: includes/i18n.php:77
48
+ msgid "Change Ownership"
49
+ msgstr "Skift ejerskab"
50
+
51
+ #: includes/i18n.php:79
52
+ msgid "Support"
53
+ msgstr "Support"
54
+
55
+ #: includes/i18n.php:81
56
+ msgid "Support Forum"
57
+ msgstr "Supportforum"
58
+
59
+ #: includes/i18n.php:83
60
+ msgid "Add Ons"
61
+ msgstr "Tilføjelser"
62
+
63
+ #: includes/i18n.php:85
64
+ msgctxt "verb"
65
+ msgid "Upgrade"
66
+ msgstr "Opgrader"
67
+
68
+ #: includes/i18n.php:87
69
+ msgid "Awesome"
70
+ msgstr "Sejt"
71
+
72
+ #: includes/i18n.php:89
73
+ msgctxt "noun"
74
+ msgid "Pricing"
75
+ msgstr "Priser"
76
+
77
+ #: includes/i18n.php:91
78
+ msgctxt "noun"
79
+ msgid "Price"
80
+ msgstr "Pris"
81
+
82
+ #: includes/i18n.php:93
83
+ msgid "Unlimited Updates"
84
+ msgstr "Ubegrænsede opdateringer"
85
+
86
+ #: includes/i18n.php:95
87
+ msgctxt "verb"
88
+ msgid "Downgrade"
89
+ msgstr "Nedgrader"
90
+
91
+ #: includes/i18n.php:97
92
+ msgid "Cancel Trial"
93
+ msgstr "Annuller prøveperiode"
94
+
95
+ #: includes/i18n.php:99
96
+ msgid "Free Trial"
97
+ msgstr "Gratis prøveperiode"
98
+
99
+ #: includes/i18n.php:101
100
+ msgid "Start my free %s"
101
+ msgstr "Start min gratis %s"
102
+
103
+ #: includes/i18n.php:103
104
+ msgid "No commitment for %s - cancel anytime"
105
+ msgstr "Ingen bindinger ved %s - annuller når som helst"
106
+
107
+ #: includes/i18n.php:105
108
+ msgid "After your free %s, pay as little as %s"
109
+ msgstr "Efter din gratis %s er prisen kun %s"
110
+
111
+ #: includes/i18n.php:107
112
+ msgid "Details"
113
+ msgstr "Detaljer"
114
+
115
+ #: includes/i18n.php:109
116
+ msgid "Account Details"
117
+ msgstr "Kontodetaljer"
118
+
119
+ #: includes/i18n.php:111
120
+ msgctxt "verb"
121
+ msgid "Delete"
122
+ msgstr "Slet"
123
+
124
+ #: includes/i18n.php:113
125
+ msgctxt "verb"
126
+ msgid "Show"
127
+ msgstr "Vis"
128
+
129
+ #: includes/i18n.php:115
130
+ msgctxt "verb"
131
+ msgid "Hide"
132
+ msgstr "Skjul"
133
+
134
+ #: includes/i18n.php:117
135
+ msgctxt "verb"
136
+ msgid "Edit"
137
+ msgstr "Rediger"
138
+
139
+ #: includes/i18n.php:119
140
+ msgctxt "verb"
141
+ msgid "Update"
142
+ msgstr ""
143
+
144
+ #: includes/i18n.php:121
145
+ msgid "Date"
146
+ msgstr "Dato"
147
+
148
+ #: includes/i18n.php:123
149
+ msgid "Amount"
150
+ msgstr "Beløb"
151
+
152
+ #: includes/i18n.php:125
153
+ msgid "Invoice"
154
+ msgstr "Faktura"
155
+
156
+ #: includes/i18n.php:127
157
+ msgid "Billing"
158
+ msgstr "Betaling"
159
+
160
+ #: includes/i18n.php:129
161
+ msgid "Payments"
162
+ msgstr "Betalinger"
163
+
164
+ #: includes/i18n.php:131
165
+ msgid "Delete Account"
166
+ msgstr "Slet konto"
167
+
168
+ #: includes/i18n.php:133
169
+ msgctxt "as close a window"
170
+ msgid "Dismiss"
171
+ msgstr "Fjern"
172
+
173
+ #: includes/i18n.php:135
174
+ msgctxt "as product pricing plan"
175
+ msgid "Plan"
176
+ msgstr "Plan"
177
+
178
+ #: includes/i18n.php:137
179
+ msgid "Change Plan"
180
+ msgstr "Skift plan"
181
+
182
+ #: includes/i18n.php:139
183
+ msgctxt "as download professional version"
184
+ msgid "Download %s Version"
185
+ msgstr ""
186
+
187
+ #: includes/i18n.php:141
188
+ msgctxt "as download professional version now"
189
+ msgid "Download %s version now"
190
+ msgstr ""
191
+
192
+ #: includes/i18n.php:145
193
+ msgctxt "as download latest version"
194
+ msgid "Download Latest"
195
+ msgstr "Download seneste"
196
+
197
+ #: includes/i18n.php:147
198
+ msgctxt "E.g. you have a professional license."
199
+ msgid "You have a %s license."
200
+ msgstr "Du har en %s licens."
201
+
202
+ #: includes/i18n.php:151
203
+ msgid "New"
204
+ msgstr "Ny"
205
+
206
+ #: includes/i18n.php:153
207
+ msgid "Free"
208
+ msgstr "Gratis"
209
+
210
+ #: includes/i18n.php:155
211
+ msgctxt "as trial plan"
212
+ msgid "Trial"
213
+ msgstr "Prøveperiode"
214
+
215
+ #: includes/i18n.php:157
216
+ msgctxt "as starting a trial plan"
217
+ msgid "Start Trial"
218
+ msgstr ""
219
+
220
+ #: includes/i18n.php:159
221
+ msgctxt "verb"
222
+ msgid "Purchase"
223
+ msgstr "Køb"
224
+
225
+ #: includes/i18n.php:161
226
+ msgid "Purchase License"
227
+ msgstr "Køb licens"
228
+
229
+ #: includes/i18n.php:163
230
+ msgctxt "verb"
231
+ msgid "Buy"
232
+ msgstr "Køb"
233
+
234
+ #: includes/i18n.php:165
235
+ msgid "Buy License"
236
+ msgstr "Køb licens"
237
+
238
+ #: includes/i18n.php:167
239
+ msgid "Single Site License"
240
+ msgstr ""
241
+
242
+ #: includes/i18n.php:169
243
+ msgid "Unlimited Licenses"
244
+ msgstr "Ubegrænsede licenser"
245
+
246
+ #: includes/i18n.php:171
247
+ msgid "Up to %s Sites"
248
+ msgstr "Op til %s websteder"
249
+
250
+ #: includes/i18n.php:173
251
+ msgid "%sRenew your license now%s to access version %s features and support."
252
+ msgstr ""
253
+
254
+ #: includes/i18n.php:177
255
+ msgid ""
256
+ "Enter the email address you've used for the upgrade below and we will resend"
257
+ " you the license key."
258
+ msgstr ""
259
+
260
+ #: includes/i18n.php:181
261
+ msgctxt "e.g. Professional Plan"
262
+ msgid "%s Plan"
263
+ msgstr "%s Plan"
264
+
265
+ #: includes/i18n.php:183
266
+ msgid "You are just one step away - %s"
267
+ msgstr "Du mangler kun ét skridt - %s"
268
+
269
+ #: includes/i18n.php:185
270
+ msgctxt "%s - plugin name. As complete \"Jetpack\" activation now"
271
+ msgid "Complete \"%s\" Activation Now"
272
+ msgstr "Færdiggør aktivering af \"%s\" nu"
273
+
274
+ #: includes/i18n.php:189
275
+ msgid "We made a few tweaks to the plugin, %s"
276
+ msgstr ""
277
+
278
+ #: includes/i18n.php:191
279
+ msgid "Opt-in to make \"%s\" Better!"
280
+ msgstr ""
281
+
282
+ #: includes/i18n.php:193
283
+ msgid "Error"
284
+ msgstr "Fejl"
285
+
286
+ #: includes/i18n.php:195
287
+ msgid ""
288
+ "Freemius SDK couldn't find the plugin's main file. Please contact "
289
+ "sdk@freemius.com with the current error."
290
+ msgstr ""
291
+
292
+ #: includes/i18n.php:203
293
+ msgctxt "as expiration date"
294
+ msgid "Expiration"
295
+ msgstr ""
296
+
297
+ #: includes/i18n.php:205
298
+ msgctxt "as software license"
299
+ msgid "License"
300
+ msgstr "Licens"
301
+
302
+ #: includes/i18n.php:207
303
+ msgid "not verified"
304
+ msgstr "ikke verificeret"
305
+
306
+ #: includes/i18n.php:209
307
+ msgid "Verify Email"
308
+ msgstr "Verificer e-mail"
309
+
310
+ #: includes/i18n.php:211
311
+ msgctxt "e.g. expires in 2 months"
312
+ msgid "Expires in %s"
313
+ msgstr "Udløber om %s"
314
+
315
+ #: includes/i18n.php:213
316
+ msgctxt "e.g. auto renews in 2 months"
317
+ msgid "Auto renews in %s"
318
+ msgstr ""
319
+
320
+ #: includes/i18n.php:215
321
+ msgid "No expiration"
322
+ msgstr "Udløber ikke"
323
+
324
+ #: includes/i18n.php:217
325
+ msgid "Expired"
326
+ msgstr "Udløbet"
327
+
328
+ #: includes/i18n.php:219
329
+ msgid "Cancelled"
330
+ msgstr "Annulleret"
331
+
332
+ #: includes/i18n.php:221
333
+ msgctxt "e.g. In 2 hours"
334
+ msgid "In %s"
335
+ msgstr "Om %s"
336
+
337
+ #: includes/i18n.php:223
338
+ msgctxt "e.g. 2 min ago"
339
+ msgid "%s ago"
340
+ msgstr "%s siden"
341
+
342
+ #: includes/i18n.php:225
343
+ msgctxt "as plugin version"
344
+ msgid "Version"
345
+ msgstr "Version"
346
+
347
+ #: includes/i18n.php:227
348
+ msgid "Name"
349
+ msgstr "Navn"
350
+
351
+ #: includes/i18n.php:229
352
+ msgid "Email"
353
+ msgstr "E-mail"
354
+
355
+ #: includes/i18n.php:231
356
+ msgid "Email address"
357
+ msgstr "E-mailadresse"
358
+
359
+ #: includes/i18n.php:233
360
+ msgid "Verified"
361
+ msgstr "Verificeret"
362
+
363
+ #: includes/i18n.php:235
364
+ msgid "Plugin"
365
+ msgstr "Plugin"
366
+
367
+ #: includes/i18n.php:237
368
+ msgid "Plugins"
369
+ msgstr "Plugins"
370
+
371
+ #: includes/i18n.php:239
372
+ msgid "Themes"
373
+ msgstr "Temaer"
374
+
375
+ #: includes/i18n.php:241
376
+ msgctxt "as file/folder path"
377
+ msgid "Path"
378
+ msgstr "Sti"
379
+
380
+ #: includes/i18n.php:243
381
+ msgid "Title"
382
+ msgstr "Titel"
383
+
384
+ #: includes/i18n.php:245
385
+ msgid "Free version"
386
+ msgstr "Gratis version"
387
+
388
+ #: includes/i18n.php:247
389
+ msgid "Premium version"
390
+ msgstr ""
391
+
392
+ #: includes/i18n.php:249
393
+ msgctxt "as WP plugin slug"
394
+ msgid "Slug"
395
+ msgstr "Kortnavn"
396
+
397
+ #: includes/i18n.php:251
398
+ msgid "ID"
399
+ msgstr "ID"
400
+
401
+ #: includes/i18n.php:253
402
+ msgid "Users"
403
+ msgstr "Brugere"
404
+
405
+ #: includes/i18n.php:255
406
+ msgid "Plugin Installs"
407
+ msgstr "Plugin-installationer"
408
+
409
+ #: includes/i18n.php:257
410
+ msgctxt "like websites"
411
+ msgid "Sites"
412
+ msgstr "Websteder"
413
+
414
+ #: includes/i18n.php:259
415
+ msgid "User ID"
416
+ msgstr "Bruger-ID"
417
+
418
+ #: includes/i18n.php:261
419
+ msgid "Site ID"
420
+ msgstr "Websteds-ID"
421
+
422
+ #: includes/i18n.php:263
423
+ msgid "Public Key"
424
+ msgstr "Offentlig nøgle"
425
+
426
+ #: includes/i18n.php:265
427
+ msgid "Secret Key"
428
+ msgstr "Privat nøgle"
429
+
430
+ #: includes/i18n.php:267
431
+ msgctxt "as secret encryption key missing"
432
+ msgid "No Secret"
433
+ msgstr "Ingen privat nøgle"
434
+
435
+ #: includes/i18n.php:269
436
+ msgid "No ID"
437
+ msgstr "Intet ID"
438
+
439
+ #: includes/i18n.php:271
440
+ msgctxt "as synchronize license"
441
+ msgid "Sync License"
442
+ msgstr "Synkroniser licens"
443
+
444
+ #: includes/i18n.php:273
445
+ msgctxt "as synchronize"
446
+ msgid "Sync"
447
+ msgstr "Synkroniser"
448
+
449
+ #: includes/i18n.php:275
450
+ msgid "Activate License"
451
+ msgstr "Aktiver licens"
452
+
453
+ #: includes/i18n.php:277
454
+ msgid "Activate Free Version"
455
+ msgstr "Aktiver gratis version"
456
+
457
+ #: includes/i18n.php:279
458
+ msgid ""
459
+ "Please enter the license key that you received in the email right after the "
460
+ "purchase:"
461
+ msgstr ""
462
+
463
+ #: includes/i18n.php:283
464
+ msgid "Activating license..."
465
+ msgstr "Aktiverer licens..."
466
+
467
+ #: includes/i18n.php:285
468
+ msgid "Change License"
469
+ msgstr "Skift licens"
470
+
471
+ #: includes/i18n.php:287
472
+ msgid "Update License"
473
+ msgstr "Opdater licens"
474
+
475
+ #: includes/i18n.php:289
476
+ msgid "Deactivate License"
477
+ msgstr "Deaktiver licens"
478
+
479
+ #: includes/i18n.php:291
480
+ msgid "Activate"
481
+ msgstr "Aktiver"
482
+
483
+ #: includes/i18n.php:293
484
+ msgid "Deactivate"
485
+ msgstr "Deaktiver"
486
+
487
+ #: includes/i18n.php:295
488
+ msgid "Skip & Deactivate"
489
+ msgstr "Spring over & deaktiver"
490
+
491
+ #: includes/i18n.php:297
492
+ msgid "No - just deactivate"
493
+ msgstr "Nej - bare deaktiver"
494
+
495
+ #: includes/i18n.php:299
496
+ msgid "Yes - do your thing"
497
+ msgstr ""
498
+
499
+ #: includes/i18n.php:301
500
+ msgctxt "active mode"
501
+ msgid "Active"
502
+ msgstr "Aktiv"
503
+
504
+ #: includes/i18n.php:303
505
+ msgctxt "is active mode?"
506
+ msgid "Is Active"
507
+ msgstr "Er aktiv"
508
+
509
+ #: includes/i18n.php:305
510
+ msgid "Install Now"
511
+ msgstr "Installer nu"
512
+
513
+ #: includes/i18n.php:307
514
+ msgid "Install Update Now"
515
+ msgstr "Installer opdatering nu"
516
+
517
+ #: includes/i18n.php:309
518
+ msgid "More information about %s"
519
+ msgstr "Mere information om %s"
520
+
521
+ #: includes/i18n.php:311
522
+ msgid "Localhost"
523
+ msgstr "Localhost"
524
+
525
+ #: includes/i18n.php:313
526
+ msgctxt "as activate Professional plan"
527
+ msgid "Activate %s Plan"
528
+ msgstr "Aktiver plan %s"
529
+
530
+ #: includes/i18n.php:315
531
+ msgctxt "as 5 licenses left"
532
+ msgid "%s left"
533
+ msgstr "%s tilbage"
534
+
535
+ #: includes/i18n.php:317
536
+ msgid "Last license"
537
+ msgstr ""
538
+
539
+ #: includes/i18n.php:319
540
+ msgid "What is your %s?"
541
+ msgstr ""
542
+
543
+ #: includes/i18n.php:321
544
+ msgid "Activate this add-on"
545
+ msgstr "Aktiver denne tilføjelse"
546
+
547
+ #: includes/i18n.php:323
548
+ msgid ""
549
+ "Deactivating your license will block all premium features, but will enable "
550
+ "you to activate the license on another site. Are you sure you want to "
551
+ "proceed?"
552
+ msgstr ""
553
+
554
+ #: includes/i18n.php:327
555
+ msgid ""
556
+ "Deleting the account will automatically deactivate your %s plan license so "
557
+ "you can use it on other sites. If you want to terminate the recurring "
558
+ "payments as well, click the \"Cancel\" button, and first \"Downgrade\" your "
559
+ "account. Are you sure you would like to continue with the deletion?"
560
+ msgstr ""
561
+
562
+ #: includes/i18n.php:331
563
+ msgid ""
564
+ "Deletion is not temporary. Only delete if you no longer want to use this "
565
+ "plugin anymore. Are you sure you would like to continue with the deletion?"
566
+ msgstr ""
567
+
568
+ #: includes/i18n.php:335
569
+ msgid ""
570
+ "Downgrading your plan will immediately stop all future recurring payments "
571
+ "and your %s plan license will expire in %s."
572
+ msgstr ""
573
+
574
+ #: includes/i18n.php:339
575
+ msgid ""
576
+ "Cancelling the trial will immediately block access to all premium features. "
577
+ "Are you sure?"
578
+ msgstr ""
579
+
580
+ #: includes/i18n.php:343
581
+ msgid ""
582
+ "You can still enjoy all %s features but you will not have access to plugin "
583
+ "updates and support."
584
+ msgstr ""
585
+
586
+ #: includes/i18n.php:347
587
+ msgid ""
588
+ "Once your license expire you can still use the Free version but you will NOT"
589
+ " have access to the %s features."
590
+ msgstr ""
591
+
592
+ #: includes/i18n.php:351
593
+ msgid "Are you sure you want to proceed?"
594
+ msgstr ""
595
+
596
+ #: includes/i18n.php:357
597
+ msgid "Add Ons for %s"
598
+ msgstr "Tilføjelser til %s"
599
+
600
+ #: includes/i18n.php:359
601
+ msgid ""
602
+ "We could'nt load the add-ons list. It's probably an issue on our side, "
603
+ "please try to come back in few minutes."
604
+ msgstr ""
605
+
606
+ #: includes/i18n.php:365
607
+ msgid "Anonymous feedback"
608
+ msgstr "Anonym feedback"
609
+
610
+ #: includes/i18n.php:367
611
+ msgid "Quick feedback"
612
+ msgstr "Hurtig feedback"
613
+
614
+ #: includes/i18n.php:369
615
+ msgid "If you have a moment, please let us know why you are deactivating"
616
+ msgstr ""
617
+
618
+ #: includes/i18n.php:373
619
+ msgid "Yes - Deactivate"
620
+ msgstr "Ja - deaktiver"
621
+
622
+ #: includes/i18n.php:375
623
+ msgid "Submit & Deactivate"
624
+ msgstr "Send & deaktiver"
625
+
626
+ #: includes/i18n.php:377
627
+ msgid "Cancel"
628
+ msgstr "Annuller"
629
+
630
+ #: includes/i18n.php:379
631
+ msgid "I no longer need the plugin"
632
+ msgstr ""
633
+
634
+ #: includes/i18n.php:381
635
+ msgid "I found a better plugin"
636
+ msgstr "Jeg har fundet et bedre plugin"
637
+
638
+ #: includes/i18n.php:383
639
+ msgid "I only needed the plugin for a short period"
640
+ msgstr ""
641
+
642
+ #: includes/i18n.php:385
643
+ msgid "The plugin broke my site"
644
+ msgstr "Pluginnet ødelagde mit websted"
645
+
646
+ #: includes/i18n.php:387
647
+ msgid "The plugin suddenly stopped working"
648
+ msgstr "Pluginnet virker ikke længere"
649
+
650
+ #: includes/i18n.php:389
651
+ msgid "I can't pay for it anymore"
652
+ msgstr "Jeg kan ikke længere betale for det"
653
+
654
+ #: includes/i18n.php:391
655
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
656
+ msgstr ""
657
+
658
+ #: includes/i18n.php:395
659
+ msgctxt ""
660
+ "the text of the \"other\" reason for deactivating the plugin that is shown "
661
+ "in the modal box."
662
+ msgid "Other"
663
+ msgstr "Andet"
664
+
665
+ #: includes/i18n.php:399
666
+ msgid "Kindly tell us the reason so we can improve."
667
+ msgstr ""
668
+
669
+ #: includes/i18n.php:401
670
+ msgid "What's the plugin's name?"
671
+ msgstr ""
672
+
673
+ #: includes/i18n.php:403
674
+ msgid "What price would you feel comfortable paying?"
675
+ msgstr ""
676
+
677
+ #: includes/i18n.php:405
678
+ msgid "I couldn't understand how to make it work"
679
+ msgstr ""
680
+
681
+ #: includes/i18n.php:407
682
+ msgid ""
683
+ "The plugin is great, but I need specific feature that you don't support"
684
+ msgstr ""
685
+
686
+ #: includes/i18n.php:411
687
+ msgid "The plugin is not working"
688
+ msgstr "Pluginnet virker ikke"
689
+
690
+ #: includes/i18n.php:413
691
+ msgid "It's not what I was looking for"
692
+ msgstr ""
693
+
694
+ #: includes/i18n.php:415
695
+ msgid "The plugin didn't work as expected"
696
+ msgstr ""
697
+
698
+ #: includes/i18n.php:417
699
+ msgid "What feature?"
700
+ msgstr ""
701
+
702
+ #: includes/i18n.php:419
703
+ msgid "Kindly share what didn't work so we can fix it for future users..."
704
+ msgstr ""
705
+
706
+ #: includes/i18n.php:423
707
+ msgid "What you've been looking for?"
708
+ msgstr ""
709
+
710
+ #: includes/i18n.php:425
711
+ msgid "What did you expect?"
712
+ msgstr "Hvad forventede du?"
713
+
714
+ #: includes/i18n.php:427
715
+ msgid "The plugin didn't work"
716
+ msgstr "Pluginnet virkede ikke"
717
+
718
+ #: includes/i18n.php:429
719
+ msgid "I don't like to share my information with you"
720
+ msgstr ""
721
+
722
+ #: includes/i18n.php:431
723
+ msgid ""
724
+ "You might have missed it, but you don't have to share any data and can just "
725
+ "%s the opt-in."
726
+ msgstr ""
727
+
728
+ #: includes/i18n.php:441
729
+ msgctxt "greeting"
730
+ msgid "Hey %s,"
731
+ msgstr "Hey %s,"
732
+
733
+ #: includes/i18n.php:443
734
+ msgctxt "a greeting. E.g. Thanks John!"
735
+ msgid "Thanks %s!"
736
+ msgstr "Tak %s!"
737
+
738
+ #: includes/i18n.php:445
739
+ msgid ""
740
+ "Never miss an important update - opt-in to our security and feature updates "
741
+ "notifications, and non-sensitive diagnostic tracking with %4$s."
742
+ msgstr ""
743
+
744
+ #: includes/i18n.php:449
745
+ msgid ""
746
+ "Please help us improve %1$s! If you opt-in, some data about your usage of "
747
+ "%1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still "
748
+ "work just fine."
749
+ msgstr ""
750
+
751
+ #: includes/i18n.php:453
752
+ msgid ""
753
+ "You should receive an activation email for %s to your mailbox at %s. Please "
754
+ "make sure you click the activation button in that email to %s."
755
+ msgstr ""
756
+
757
+ #: includes/i18n.php:455
758
+ msgid "complete the install"
759
+ msgstr ""
760
+
761
+ #: includes/i18n.php:457
762
+ msgid "start the trial"
763
+ msgstr ""
764
+
765
+ #: includes/i18n.php:459
766
+ msgid ""
767
+ "Thanks for purchasing %s! To get started, please enter your license key:"
768
+ msgstr ""
769
+
770
+ #: includes/i18n.php:463
771
+ msgid ""
772
+ "The plugin will be periodically sending data to %s to check for plugin "
773
+ "updates and verify the validity of your license."
774
+ msgstr ""
775
+
776
+ #: includes/i18n.php:467
777
+ msgid "What permissions are being granted?"
778
+ msgstr "Hvilke tilladelser bliver givet?"
779
+
780
+ #: includes/i18n.php:469
781
+ msgid "Your Profile Overview"
782
+ msgstr "Overblik af din profil"
783
+
784
+ #: includes/i18n.php:471
785
+ msgid "Name and email address"
786
+ msgstr "Navn og e-mailadresse"
787
+
788
+ #: includes/i18n.php:473
789
+ msgid "Your Site Overview"
790
+ msgstr "Overblik af dit websted"
791
+
792
+ #: includes/i18n.php:475
793
+ msgid "Site URL, WP version, PHP info, plugins & themes"
794
+ msgstr ""
795
+
796
+ #: includes/i18n.php:479
797
+ msgid "Current Plugin Events"
798
+ msgstr "Nuværende plugin-begivenheder"
799
+
800
+ #: includes/i18n.php:481
801
+ msgid "Activation, deactivation and uninstall"
802
+ msgstr "Aktivering, deaktivering og afinstallering"
803
+
804
+ #: includes/i18n.php:483
805
+ msgid "Plugins & Themes"
806
+ msgstr "Plugins & Temaer"
807
+
808
+ #: includes/i18n.php:485
809
+ msgid "Titles, versions and state."
810
+ msgstr "Titler, versioner og tilstand."
811
+
812
+ #: includes/i18n.php:487
813
+ msgid "Admin Notices"
814
+ msgstr ""
815
+
816
+ #: includes/i18n.php:489
817
+ msgid "Newsletter"
818
+ msgstr "Nyhedsbrev"
819
+
820
+ #: includes/i18n.php:491
821
+ msgid "Updates, announcements, marketing, no spam"
822
+ msgstr ""
823
+
824
+ #: includes/i18n.php:493
825
+ msgid "Privacy Policy"
826
+ msgstr "Privatlivspolitik"
827
+
828
+ #: includes/i18n.php:495
829
+ msgid "Terms of Service"
830
+ msgstr "Servicevilkår"
831
+
832
+ #: includes/i18n.php:497
833
+ msgctxt "as activating plugin"
834
+ msgid "Activating"
835
+ msgstr "Aktiverer"
836
+
837
+ #: includes/i18n.php:499
838
+ msgctxt "as in the process of sending an email"
839
+ msgid "Sending email"
840
+ msgstr "Sender e-mail"
841
+
842
+ #: includes/i18n.php:503
843
+ msgctxt "button label"
844
+ msgid "Allow & Continue"
845
+ msgstr "Tillad & Fortsæt"
846
+
847
+ #: includes/i18n.php:505
848
+ msgctxt "button label"
849
+ msgid "Agree & Activate License"
850
+ msgstr "Accepter & aktiver licens"
851
+
852
+ #: includes/i18n.php:507
853
+ msgctxt "verb"
854
+ msgid "Skip"
855
+ msgstr "Spring over"
856
+
857
+ #: includes/i18n.php:509
858
+ msgid "Click here to use the plugin anonymously"
859
+ msgstr "Klik her for at benytte pluginnet anonymt"
860
+
861
+ #: includes/i18n.php:511
862
+ msgid "Re-send activation email"
863
+ msgstr "Gensend e-mail om aktivering"
864
+
865
+ #: includes/i18n.php:513
866
+ msgid "License key"
867
+ msgstr "Licensnøgle"
868
+
869
+ #: includes/i18n.php:515
870
+ msgid "Send License Key"
871
+ msgstr "Send licensnøgle"
872
+
873
+ #: includes/i18n.php:517
874
+ msgid "Sending license key"
875
+ msgstr "Sender licensnøgle"
876
+
877
+ #: includes/i18n.php:519
878
+ msgid "Have a license key?"
879
+ msgstr "Har du en licensnøgle?"
880
+
881
+ #: includes/i18n.php:521
882
+ msgid "Don't have a license key?"
883
+ msgstr "Har du ikke en licensnøgle?"
884
+
885
+ #: includes/i18n.php:523
886
+ msgid "Can't find your license key?"
887
+ msgstr "Kan du ikke finde din licensnøgle?"
888
+
889
+ #: includes/i18n.php:525
890
+ msgid ""
891
+ "We couldn't find your email address in the system, are you sure it's the "
892
+ "right address?"
893
+ msgstr ""
894
+
895
+ #: includes/i18n.php:529
896
+ msgid ""
897
+ "We can't see any active licenses associated with that email address, are you"
898
+ " sure it's the right address?"
899
+ msgstr ""
900
+
901
+ #: includes/i18n.php:533
902
+ msgid "Opt In"
903
+ msgstr ""
904
+
905
+ #: includes/i18n.php:535
906
+ msgid "Opt Out"
907
+ msgstr ""
908
+
909
+ #: includes/i18n.php:537
910
+ msgid "On second thought - I want to continue helping"
911
+ msgstr ""
912
+
913
+ #: includes/i18n.php:541
914
+ msgid "Opting out..."
915
+ msgstr ""
916
+
917
+ #: includes/i18n.php:543
918
+ msgid "Opting in..."
919
+ msgstr ""
920
+
921
+ #: includes/i18n.php:545
922
+ msgid ""
923
+ "We appreciate your help in making the %s better by letting us track some "
924
+ "usage data."
925
+ msgstr ""
926
+
927
+ #: includes/i18n.php:549
928
+ msgid ""
929
+ "Usage tracking is done in the name of making %s better. Making a better user"
930
+ " experience, prioritizing new features, and more good things. We'd really "
931
+ "appreciate if you'll reconsider letting us continue with the tracking."
932
+ msgstr ""
933
+
934
+ #: includes/i18n.php:553
935
+ msgid ""
936
+ "By clicking \"Opt Out\", we will no longer be sending any data from %s to "
937
+ "%s."
938
+ msgstr ""
939
+
940
+ #: includes/i18n.php:563
941
+ msgid "Screenshots"
942
+ msgstr "Skærmbilleder"
943
+
944
+ #: includes/i18n.php:565
945
+ msgid "Click to view full-size screenshot %d"
946
+ msgstr ""
947
+
948
+ #: includes/i18n.php:573
949
+ msgid "Freemius Debug"
950
+ msgstr "Freemius Debug"
951
+
952
+ #: includes/i18n.php:575
953
+ msgctxt "as turned on"
954
+ msgid "On"
955
+ msgstr "Til"
956
+
957
+ #: includes/i18n.php:577
958
+ msgctxt "as turned off"
959
+ msgid "Off"
960
+ msgstr "Fra"
961
+
962
+ #: includes/i18n.php:579
963
+ msgctxt "as code debugging"
964
+ msgid "Debugging"
965
+ msgstr "Fejlfinding"
966
+
967
+ #: includes/i18n.php:581
968
+ msgid "Freemius State"
969
+ msgstr "Freemius tilstand"
970
+
971
+ #: includes/i18n.php:583
972
+ msgctxt "as connection was successful"
973
+ msgid "Connected"
974
+ msgstr "Forbundet"
975
+
976
+ #: includes/i18n.php:585
977
+ msgctxt "as connection blocked"
978
+ msgid "Blocked"
979
+ msgstr "Blokeret"
980
+
981
+ #: includes/i18n.php:587
982
+ msgctxt "as application program interface"
983
+ msgid "API"
984
+ msgstr "API"
985
+
986
+ #: includes/i18n.php:589
987
+ msgctxt "as software development kit versions"
988
+ msgid "SDK"
989
+ msgstr "SDK"
990
+
991
+ #: includes/i18n.php:591
992
+ msgctxt "as software development kit versions"
993
+ msgid "SDK Versions"
994
+ msgstr "SDK-versioner"
995
+
996
+ #: includes/i18n.php:595
997
+ msgctxt "as plugin folder path"
998
+ msgid "Plugin Path"
999
+ msgstr "Plugin-sti"
1000
+
1001
+ #: includes/i18n.php:597
1002
+ msgctxt "as sdk path"
1003
+ msgid "SDK Path"
1004
+ msgstr "SDK-sti"
1005
+
1006
+ #: includes/i18n.php:599
1007
+ msgid "Add Ons of Plugin %s"
1008
+ msgstr "Tilføjelser til plugin %s"
1009
+
1010
+ #: includes/i18n.php:601
1011
+ msgid "Are you sure you want to delete all Freemius data?"
1012
+ msgstr ""
1013
+
1014
+ #: includes/i18n.php:605
1015
+ msgid "Actions"
1016
+ msgstr "Handlinger"
1017
+
1018
+ #: includes/i18n.php:607
1019
+ msgid "Delete All Accounts"
1020
+ msgstr "Slet alle konti"
1021
+
1022
+ #: includes/i18n.php:609
1023
+ msgid "Start Fresh"
1024
+ msgstr "Start forfra"
1025
+
1026
+ #: includes/i18n.php:611
1027
+ msgid "Clear API Cache"
1028
+ msgstr "Ryd API-cache"
1029
+
1030
+ #: includes/i18n.php:613
1031
+ msgid "Sync Data From Server"
1032
+ msgstr "Synkroniser data fra server"
1033
+
1034
+ #: includes/i18n.php:615
1035
+ msgid "Scheduled Crons"
1036
+ msgstr "Planlagte cron jobs"
1037
+
1038
+ #: includes/i18n.php:617
1039
+ msgid "Plugins & Themes Sync"
1040
+ msgstr "Synkronisering af plugins og temaer"
1041
+
1042
+ #: includes/i18n.php:625
1043
+ msgctxt "as congratulations"
1044
+ msgid "Congrats"
1045
+ msgstr "Tillykke"
1046
+
1047
+ #: includes/i18n.php:627
1048
+ msgctxt "exclamation"
1049
+ msgid "Oops"
1050
+ msgstr "Ups"
1051
+
1052
+ #: includes/i18n.php:629
1053
+ msgctxt "interjection expressing joy or exuberance"
1054
+ msgid "Yee-haw"
1055
+ msgstr ""
1056
+
1057
+ #: includes/i18n.php:633
1058
+ msgctxt ""
1059
+ "(especially in electronic communication) used to express elation, "
1060
+ "enthusiasm, or triumph."
1061
+ msgid "W00t"
1062
+ msgstr ""
1063
+
1064
+ #: includes/i18n.php:637
1065
+ msgctxt "a positive response"
1066
+ msgid "Right on"
1067
+ msgstr "Sådan"
1068
+
1069
+ #: includes/i18n.php:639
1070
+ msgctxt ""
1071
+ "something somebody says when they are thinking about what you have just "
1072
+ "said. "
1073
+ msgid "Hmm"
1074
+ msgstr "Hmm"
1075
+
1076
+ #: includes/i18n.php:643
1077
+ msgid "O.K"
1078
+ msgstr "O.K"
1079
+
1080
+ #: includes/i18n.php:645
1081
+ msgctxt "exclamation"
1082
+ msgid "Hey"
1083
+ msgstr "Hey"
1084
+
1085
+ #: includes/i18n.php:647
1086
+ msgctxt "advance notice of something that will need attention."
1087
+ msgid "Heads up"
1088
+ msgstr "Se her"
1089
+
1090
+ #: includes/i18n.php:657
1091
+ msgid "Seems like you got the latest release."
1092
+ msgstr ""
1093
+
1094
+ #: includes/i18n.php:659
1095
+ msgid "You are all good!"
1096
+ msgstr "Det var det!"
1097
+
1098
+ #: includes/i18n.php:661
1099
+ msgid ""
1100
+ "Sorry, we could not complete the email update. Another user with the same "
1101
+ "email is already registered."
1102
+ msgstr ""
1103
+
1104
+ #: includes/i18n.php:665
1105
+ msgid ""
1106
+ "If you would like to give up the ownership of the plugin's account to %s "
1107
+ "click the Change Ownership button."
1108
+ msgstr ""
1109
+
1110
+ #: includes/i18n.php:669
1111
+ msgid ""
1112
+ "Your email was successfully updated. You should receive an email with "
1113
+ "confirmation instructions in few moments."
1114
+ msgstr ""
1115
+
1116
+ #: includes/i18n.php:673
1117
+ msgid "Your name was successfully updated."
1118
+ msgstr "Dit navn er blevet opdateret."
1119
+
1120
+ #: includes/i18n.php:675
1121
+ msgid "You have successfully updated your %s."
1122
+ msgstr "Opdatering af %s blev gennemført."
1123
+
1124
+ #: includes/i18n.php:677
1125
+ msgid "Please provide your full name."
1126
+ msgstr "Indtast venligst dit fulde navn."
1127
+
1128
+ #: includes/i18n.php:679
1129
+ msgid ""
1130
+ "Verification mail was just sent to %s. If you can't find it after 5 min, "
1131
+ "please check your spam box."
1132
+ msgstr ""
1133
+
1134
+ #: includes/i18n.php:683
1135
+ msgid ""
1136
+ "Just letting you know that the add-ons information of %s is being pulled "
1137
+ "from an external server."
1138
+ msgstr ""
1139
+
1140
+ #: includes/i18n.php:687
1141
+ msgid "No credit card required"
1142
+ msgstr "Betalingskort ikke påkrævet"
1143
+
1144
+ #: includes/i18n.php:689
1145
+ msgid "Premium plugin version was successfully activated."
1146
+ msgstr ""
1147
+
1148
+ #: includes/i18n.php:693
1149
+ msgid "The upgrade of %s was successfully completed."
1150
+ msgstr ""
1151
+
1152
+ #: includes/i18n.php:695
1153
+ msgid "Your account was successfully activated with the %s plan."
1154
+ msgstr ""
1155
+
1156
+ #: includes/i18n.php:699
1157
+ msgid "Download the latest %s version now"
1158
+ msgstr "Download den seneste version af %s nu"
1159
+
1160
+ #: includes/i18n.php:701
1161
+ msgid "Please follow these steps to complete the upgrade"
1162
+ msgstr ""
1163
+
1164
+ #: includes/i18n.php:705
1165
+ msgid "Download the latest %s version"
1166
+ msgstr "Download den seneste version af %s"
1167
+
1168
+ #: includes/i18n.php:707
1169
+ msgid "Deactivate the free version"
1170
+ msgstr "Deaktiver den gratis version"
1171
+
1172
+ #: includes/i18n.php:709
1173
+ msgid "Upload and activate the downloaded version"
1174
+ msgstr "Upload og aktiver den downloadede version"
1175
+
1176
+ #: includes/i18n.php:711
1177
+ msgid "How to upload and activate?"
1178
+ msgstr "Upload og aktivering, hvordan?"
1179
+
1180
+ #: includes/i18n.php:713
1181
+ msgctxt "%s - product name, e.g. Facebook add-on was successfully..."
1182
+ msgid "%s Add-on was successfully purchased."
1183
+ msgstr "Betalingen for tilføjelsen %s blev gennemført."
1184
+
1185
+ #: includes/i18n.php:717
1186
+ msgid "Your %s Add-on plan was successfully upgraded."
1187
+ msgstr ""
1188
+
1189
+ #: includes/i18n.php:721
1190
+ msgid "Your email has been successfully verified - you are AWESOME!"
1191
+ msgstr ""
1192
+
1193
+ #: includes/i18n.php:725
1194
+ msgid "Your plan was successfully upgraded."
1195
+ msgstr "Din plan er blevet opgraderet."
1196
+
1197
+ #: includes/i18n.php:727
1198
+ msgid "Your plan was successfully changed to %s."
1199
+ msgstr "Din plan er blevet ændret til %s."
1200
+
1201
+ #: includes/i18n.php:729
1202
+ msgid ""
1203
+ "Your license has expired. You can still continue using the free plugin "
1204
+ "forever."
1205
+ msgstr ""
1206
+
1207
+ #: includes/i18n.php:733
1208
+ msgid ""
1209
+ "Your license has been cancelled. If you think it's a mistake, please contact"
1210
+ " support."
1211
+ msgstr ""
1212
+
1213
+ #: includes/i18n.php:737
1214
+ msgid "Your trial has been successfully started."
1215
+ msgstr "Din prøveperiode er begyndt."
1216
+
1217
+ #: includes/i18n.php:739
1218
+ msgid "Your license was successfully activated."
1219
+ msgstr "Din licens er blevet aktiveret."
1220
+
1221
+ #: includes/i18n.php:741
1222
+ msgid "It looks like your site currently doesn't have an active license."
1223
+ msgstr "Det ser ud til, at dit websted endnu ikke har en aktiv licens."
1224
+
1225
+ #: includes/i18n.php:745
1226
+ msgid ""
1227
+ "Your license was successfully deactivated, you are back to the %s plan."
1228
+ msgstr ""
1229
+
1230
+ #: includes/i18n.php:749
1231
+ msgid "It looks like the license deactivation failed."
1232
+ msgstr "Det ser ud til, at licens-deaktiveringen mislykkedes."
1233
+
1234
+ #: includes/i18n.php:753
1235
+ msgid "It looks like the license could not be activated."
1236
+ msgstr "Det ser ud til, at licensen ikke kunne aktiveres."
1237
+
1238
+ #: includes/i18n.php:757
1239
+ msgid "Error received from the server:"
1240
+ msgstr "Fejl modtager fra serveren:"
1241
+
1242
+ #: includes/i18n.php:759
1243
+ msgid ""
1244
+ "Your trial has expired. You can still continue using all our free features."
1245
+ msgstr "Din prøveperiode er udløbet. Du kan fortsat bruge alle vores gratis funktioner."
1246
+
1247
+ #: includes/i18n.php:763
1248
+ msgid ""
1249
+ "Your plan was successfully downgraded. Your %s plan license will expire in "
1250
+ "%s."
1251
+ msgstr ""
1252
+
1253
+ #: includes/i18n.php:767
1254
+ msgid ""
1255
+ "Seems like we are having some temporary issue with your plan downgrade. "
1256
+ "Please try again in few minutes."
1257
+ msgstr ""
1258
+
1259
+ #: includes/i18n.php:771
1260
+ msgid ""
1261
+ "It looks like you are not in trial mode anymore so there's nothing to cancel"
1262
+ " :)"
1263
+ msgstr ""
1264
+
1265
+ #: includes/i18n.php:775
1266
+ msgid "Your %s free trial was successfully cancelled."
1267
+ msgstr ""
1268
+
1269
+ #: includes/i18n.php:779
1270
+ msgctxt "%s - numeric version number"
1271
+ msgid "Version %s was released."
1272
+ msgstr "Version %s er blevet udgivet."
1273
+
1274
+ #: includes/i18n.php:783
1275
+ msgid "Please download %s."
1276
+ msgstr "Download venligst %s."
1277
+
1278
+ #: includes/i18n.php:785
1279
+ msgctxt "%s - plan name, as the latest professional version here"
1280
+ msgid "the latest %s version here"
1281
+ msgstr "den seneste version af %s her"
1282
+
1283
+ #: includes/i18n.php:789
1284
+ msgid ""
1285
+ "How do you like %s so far? Test all our %s premium features with a %d-day "
1286
+ "free trial."
1287
+ msgstr ""
1288
+
1289
+ #: includes/i18n.php:793
1290
+ msgctxt "call to action"
1291
+ msgid "Start free trial"
1292
+ msgstr "Start gratis prøveperiode"
1293
+
1294
+ #: includes/i18n.php:795
1295
+ msgid "Starting trial"
1296
+ msgstr ""
1297
+
1298
+ #: includes/i18n.php:797
1299
+ msgid "Please wait"
1300
+ msgstr ""
1301
+
1302
+ #: includes/i18n.php:799
1303
+ msgid ""
1304
+ "Seems like we are having some temporary issue with your trial cancellation. "
1305
+ "Please try again in few minutes."
1306
+ msgstr ""
1307
+
1308
+ #: includes/i18n.php:803
1309
+ msgid "You already utilized a trial before."
1310
+ msgstr "Du har allerede brugt din prøveperiode."
1311
+
1312
+ #: includes/i18n.php:805
1313
+ msgid "You are already running the plugin in a trial mode."
1314
+ msgstr ""
1315
+
1316
+ #: includes/i18n.php:809
1317
+ msgid "Plan %s do not exist, therefore, can't start a trial."
1318
+ msgstr ""
1319
+
1320
+ #: includes/i18n.php:813
1321
+ msgid "Plan %s does not support a trial period."
1322
+ msgstr "Plan %s understøtter ikke en prøveperiode."
1323
+
1324
+ #: includes/i18n.php:815
1325
+ msgid "None of the plugin's plans supports a trial period."
1326
+ msgstr ""
1327
+
1328
+ #: includes/i18n.php:819
1329
+ msgid ""
1330
+ "Unexpected API error. Please contact the plugin's author with the following "
1331
+ "error."
1332
+ msgstr ""
1333
+
1334
+ #: includes/i18n.php:823
1335
+ msgid "No commitment for %s days - cancel anytime!"
1336
+ msgstr "Ingen bindinger i %s dage - annuller når som helst!"
1337
+
1338
+ #: includes/i18n.php:825
1339
+ msgid ""
1340
+ "Your license has expired. You can still continue using all the %s features, "
1341
+ "but you'll need to renew your license to continue getting updates and "
1342
+ "support."
1343
+ msgstr ""
1344
+
1345
+ #: includes/i18n.php:829
1346
+ msgid "Couldn't activate %s."
1347
+ msgstr "Kunne ikke aktivere %s."
1348
+
1349
+ #: includes/i18n.php:831
1350
+ msgid "Please contact us with the following message:"
1351
+ msgstr "Kontakt os venligst med følgende besked:"
1352
+
1353
+ #: includes/i18n.php:833
1354
+ msgid ""
1355
+ "It looks like you are still on the %s plan. If you did upgrade or change "
1356
+ "your plan, it's probably an issue on our side - sorry."
1357
+ msgstr ""
1358
+
1359
+ #: includes/i18n.php:837
1360
+ msgid "Please contact us here"
1361
+ msgstr "Kontakt os her"
1362
+
1363
+ #: includes/i18n.php:839
1364
+ msgid ""
1365
+ "I have upgraded my account but when I try to Sync the License, the plan "
1366
+ "remains %s."
1367
+ msgstr ""
1368
+
1369
+ #: includes/i18n.php:847
1370
+ msgid "From unknown reason, the API connectivity test failed."
1371
+ msgstr ""
1372
+
1373
+ #: includes/i18n.php:851
1374
+ msgid ""
1375
+ "It's probably a temporary issue on our end. Just to be sure, with your "
1376
+ "permission, would it be o.k to run another connectivity test?"
1377
+ msgstr ""
1378
+
1379
+ #: includes/i18n.php:855
1380
+ msgid ""
1381
+ "We use PHP cURL library for the API calls, which is a very common library "
1382
+ "and usually installed out of the box. Unfortunately, cURL is not installed "
1383
+ "on your server."
1384
+ msgstr ""
1385
+
1386
+ #: includes/i18n.php:859
1387
+ msgid ""
1388
+ "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1389
+ msgstr ""
1390
+
1391
+ #: includes/i18n.php:863
1392
+ msgctxt "as pluginX requires an access to our API"
1393
+ msgid "%s requires an access to our API."
1394
+ msgstr ""
1395
+
1396
+ #: includes/i18n.php:867
1397
+ msgid ""
1398
+ "It looks like your server is using Squid ACL (access control lists), which "
1399
+ "blocks the connection."
1400
+ msgstr ""
1401
+
1402
+ #: includes/i18n.php:871
1403
+ msgid "I don't know what is Squid or ACL, help me!"
1404
+ msgstr ""
1405
+
1406
+ #: includes/i18n.php873, includes/i18n.php:887
1407
+ msgid ""
1408
+ "We'll make sure to contact your hosting company and resolve the issue. You "
1409
+ "will get a follow-up email to %s once we have an update."
1410
+ msgstr ""
1411
+
1412
+ #: includes/i18n.php:877
1413
+ msgid "I'm a system administrator"
1414
+ msgstr "Jeg er en system-administrator"
1415
+
1416
+ #: includes/i18n.php:879
1417
+ msgid ""
1418
+ "Great, please whitelist the following domains: %s. Once you done, deactivate"
1419
+ " the plugin and activate it again."
1420
+ msgstr ""
1421
+
1422
+ #: includes/i18n.php:883
1423
+ msgid "I don't know what is cURL or how to install it, help me!"
1424
+ msgstr ""
1425
+
1426
+ #: includes/i18n.php:891
1427
+ msgid ""
1428
+ "Great, please install cURL and enable it in your php.ini file. To make sure "
1429
+ "it was successfully activated, use 'phpinfo()'. Once activated, deactivate "
1430
+ "the plugin and reactivate it back again."
1431
+ msgstr ""
1432
+
1433
+ #: includes/i18n.php:895
1434
+ msgid ""
1435
+ "We are sure it's an issue on our side and more than happy to resolve it for "
1436
+ "you ASAP if you give us a chance."
1437
+ msgstr ""
1438
+
1439
+ #: includes/i18n.php:899
1440
+ msgid ""
1441
+ "Sorry for the inconvenience and we are here to help if you give us a chance."
1442
+ msgstr ""
1443
+
1444
+ #: includes/i18n.php:903
1445
+ msgid "Yes - I'm giving you a chance to fix it"
1446
+ msgstr "Ja - jeg giver jer en chance for at rette det"
1447
+
1448
+ #: includes/i18n.php:905
1449
+ msgid ""
1450
+ "We will do our best to whitelist your server and resolve this issue ASAP. "
1451
+ "You will get a follow-up email to %s once we have an update."
1452
+ msgstr ""
1453
+
1454
+ #: includes/i18n.php:909
1455
+ msgid "Let's try your previous version"
1456
+ msgstr "Lad os prøve din forrige version"
1457
+
1458
+ #: includes/i18n.php:911
1459
+ msgid "Uninstall this version and install the previous one."
1460
+ msgstr "Afinstaller denne version og installer den forrige."
1461
+
1462
+ #: includes/i18n.php:915
1463
+ msgid "That's exhausting, please deactivate"
1464
+ msgstr ""
1465
+
1466
+ #: includes/i18n.php:917
1467
+ msgid ""
1468
+ "We feel your frustration and sincerely apologize for the inconvenience. Hope"
1469
+ " to see you again in the future."
1470
+ msgstr ""
1471
+
1472
+ #: includes/i18n.php:921
1473
+ msgid ""
1474
+ "Thank for giving us the chance to fix it! A message was just sent to our "
1475
+ "technical staff. We will get back to you as soon as we have an update to %s."
1476
+ " Appreciate your patience."
1477
+ msgstr ""
1478
+
1479
+ #: includes/i18n.php:925
1480
+ msgctxt "%1s - plugin title, %2s - API domain"
1481
+ msgid ""
1482
+ "Your server is blocking the access to Freemius' API, which is crucial for "
1483
+ "%1s synchronization. Please contact your host to whitelist %2s"
1484
+ msgstr ""
1485
+
1486
+ #: includes/i18n.php:929
1487
+ msgid ""
1488
+ "It seems like one of the authentication parameters is wrong. Update your "
1489
+ "Public Key, Secret Key & User ID, and try again."
1490
+ msgstr ""
1491
+
1492
+ #: includes/i18n.php:937
1493
+ msgid ""
1494
+ "Please check your mailbox, you should receive an email via %s to confirm the"
1495
+ " ownership change. From security reasons, you must confirm the change within"
1496
+ " the next 15 min. If you cannot find the email, please check your spam "
1497
+ "folder."
1498
+ msgstr ""
1499
+
1500
+ #: includes/i18n.php:941
1501
+ msgid ""
1502
+ "Thanks for confirming the ownership change. An email was just sent to %s for"
1503
+ " final approval."
1504
+ msgstr ""
1505
+
1506
+ #: includes/i18n.php:945
1507
+ msgid "%s is the new owner of the account."
1508
+ msgstr "%s er den nye ejer af kontoen."
1509
+
1510
+ #: includes/i18n.php:949
1511
+ msgctxt "addonX cannot run without pluginY"
1512
+ msgid "%s cannot run without %s."
1513
+ msgstr "%s virker ikke uden %s."
1514
+
1515
+ #: includes/i18n.php:953
1516
+ msgctxt "addonX cannot run..."
1517
+ msgid "%s cannot run without the plugin."
1518
+ msgstr "%s virker ikke uden pluginnet."
1519
+
1520
+ #: includes/i18n.php:957
1521
+ msgctxt "pluginX activation was successfully..."
1522
+ msgid "%s activation was successfully completed."
1523
+ msgstr "Aktivering af %s blev gennemført."
1524
+
1525
+ #: includes/i18n.php:961
1526
+ msgctxt "Plugin installer section title"
1527
+ msgid "Features & Pricing"
1528
+ msgstr "Funktioner og priser"
1529
+
1530
+ #: includes/i18n.php:965
1531
+ msgid "Add-on must be deployed to WordPress.org or Freemius."
1532
+ msgstr ""
1533
+
1534
+ #: includes/i18n.php:969
1535
+ msgid "Paid add-on must be deployed to Freemius."
1536
+ msgstr ""
1537
+
1538
+ #: includes/i18n.php:977
1539
+ msgid ""
1540
+ "%s is a premium only add-on. You have to purchase a license first before "
1541
+ "activating the plugin."
1542
+ msgstr ""
1543
+
1544
+ #: includes/i18n.php:981
1545
+ msgid ""
1546
+ "%s free trial was successfully cancelled. Since the add-on is premium only "
1547
+ "it was automatically deactivated. If you like to use it in the future, "
1548
+ "you'll have to purchase a license."
1549
+ msgstr ""
1550
+
1551
+ #: includes/i18n.php:993
1552
+ msgctxt "as every month"
1553
+ msgid "Monthly"
1554
+ msgstr "Månedligt"
1555
+
1556
+ #: includes/i18n.php:995
1557
+ msgctxt "as monthly period"
1558
+ msgid "mo"
1559
+ msgstr "md"
1560
+
1561
+ #: includes/i18n.php:997
1562
+ msgctxt "as once a year"
1563
+ msgid "Annual"
1564
+ msgstr "Årligt"
1565
+
1566
+ #: includes/i18n.php:999
1567
+ msgctxt "as once a year"
1568
+ msgid "Annually"
1569
+ msgstr "Årligt"
1570
+
1571
+ #: includes/i18n.php:1001
1572
+ msgctxt "as once a year"
1573
+ msgid "Once"
1574
+ msgstr "Engangsbeløb"
1575
+
1576
+ #: includes/i18n.php:1003
1577
+ msgctxt "as annual period"
1578
+ msgid "year"
1579
+ msgstr "år"
1580
+
1581
+ #: includes/i18n.php:1005
1582
+ msgid "Lifetime"
1583
+ msgstr ""
1584
+
1585
+ #: includes/i18n.php:1007
1586
+ msgctxt "e.g. the best product"
1587
+ msgid "Best"
1588
+ msgstr "Bedste"
1589
+
1590
+ #: includes/i18n.php:1009
1591
+ msgctxt "e.g. billed monthly"
1592
+ msgid "Billed %s"
1593
+ msgstr ""
1594
+
1595
+ #: includes/i18n.php:1011
1596
+ msgctxt "as a discount of $5 or 10%"
1597
+ msgid "Save %s"
1598
+ msgstr "Spar %s"
1599
+
1600
+ #: includes/i18n.php:1015
1601
+ msgid "View details"
1602
+ msgstr "Vis detaljer"
1603
+
1604
+ #: includes/i18n.php:1023
1605
+ msgctxt "button label"
1606
+ msgid "Approve & Start Trial"
1607
+ msgstr ""
1608
+
1609
+ #: includes/i18n.php:1027
1610
+ msgid ""
1611
+ "You are 1-click away from starting your %1$s-day free trial of the %2$s "
1612
+ "plan."
1613
+ msgstr ""
1614
+
1615
+ #: includes/i18n.php:1031
1616
+ msgid ""
1617
+ "For compliance with the WordPress.org guidelines, before we start the trial "
1618
+ "we ask that you opt-in with your user and non-sensitive site information, "
1619
+ "allowing the plugin to periodically send data to %s to check for version "
1620
+ "updates and to validate your trial."
1621
+ msgstr ""
1622
+
1623
+ #: includes/i18n.php:1043
1624
+ msgid "Business name"
1625
+ msgstr ""
1626
+
1627
+ #: includes/i18n.php:1045
1628
+ msgid "Tax / VAT ID"
1629
+ msgstr ""
1630
+
1631
+ #: includes/i18n.php:1047
1632
+ msgid "Address Line %d"
1633
+ msgstr ""
1634
+
1635
+ #: includes/i18n.php:1049
1636
+ msgid "Country"
1637
+ msgstr ""
1638
+
1639
+ #: includes/i18n.php:1051
1640
+ msgid "Select Country"
1641
+ msgstr ""
1642
+
1643
+ #: includes/i18n.php:1053
1644
+ msgid "City"
1645
+ msgstr ""
1646
+
1647
+ #: includes/i18n.php:1055
1648
+ msgid "Town"
1649
+ msgstr ""
1650
+
1651
+ #: includes/i18n.php:1057
1652
+ msgid "State"
1653
+ msgstr ""
1654
+
1655
+ #: includes/i18n.php:1059
1656
+ msgid "Province"
1657
+ msgstr ""
1658
+
1659
+ #: includes/i18n.php:1061
1660
+ msgid "ZIP / Postal Code"
1661
+ msgstr ""
freemius/languages/freemius-en.mo ADDED
Binary file
freemius/languages/freemius-en.po ADDED
@@ -0,0 +1,1522 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+ # Copyright (C) 2016 freemius
15
+ # This file is distributed under the same license as the freemius package.
16
+ #: includes/i18n.php:41, includes/i18n.php:55
17
+ msgid "Yes - I'm in!"
18
+ msgstr "Yes - I'm in!"
19
+
20
+ #: includes/i18n.php:43, includes/i18n.php:57
21
+ msgid "Not today"
22
+ msgstr "Not today"
23
+
24
+ #: includes/i18n.php:69
25
+ msgid "Account"
26
+ msgstr "Account"
27
+
28
+ #: includes/i18n.php:71
29
+ msgid "Add On"
30
+ msgstr "Add On"
31
+
32
+ #: includes/i18n.php:73
33
+ msgid "Contact Us"
34
+ msgstr "Contact Us"
35
+
36
+ #: includes/i18n.php:75
37
+ msgid "Contact Support"
38
+ msgstr "Contact Support"
39
+
40
+ #: includes/i18n.php:77
41
+ msgid "Change Ownership"
42
+ msgstr "Change Ownership"
43
+
44
+ #: includes/i18n.php:79
45
+ msgid "Support"
46
+ msgstr "Support"
47
+
48
+ #: includes/i18n.php:81
49
+ msgid "Support Forum"
50
+ msgstr "Support Forum"
51
+
52
+ #: includes/i18n.php:83
53
+ msgid "Add Ons"
54
+ msgstr "Add Ons"
55
+
56
+ #: includes/i18n.php:85
57
+ msgctxt "verb"
58
+ msgid "Upgrade"
59
+ msgstr "Upgrade"
60
+
61
+ #: includes/i18n.php:87
62
+ msgid "Awesome"
63
+ msgstr "Awesome"
64
+
65
+ #: includes/i18n.php:89
66
+ msgctxt "noun"
67
+ msgid "Pricing"
68
+ msgstr "Pricing"
69
+
70
+ #: includes/i18n.php:91
71
+ msgctxt "noun"
72
+ msgid "Price"
73
+ msgstr "Price"
74
+
75
+ #: includes/i18n.php:93
76
+ msgid "Unlimited Updates"
77
+ msgstr "Unlimited Updates"
78
+
79
+ #: includes/i18n.php:95
80
+ msgctxt "verb"
81
+ msgid "Downgrade"
82
+ msgstr "Downgrade"
83
+
84
+ #: includes/i18n.php:97
85
+ msgid "Cancel Trial"
86
+ msgstr "Cancel Trial"
87
+
88
+ #: includes/i18n.php:99
89
+ msgid "Free Trial"
90
+ msgstr "Free Trial"
91
+
92
+ #: includes/i18n.php:101
93
+ msgid "Start my free %s"
94
+ msgstr "Start my free %s"
95
+
96
+ #: includes/i18n.php:103
97
+ msgid "No commitment for %s - cancel anytime"
98
+ msgstr "No commitment for %s - cancel anytime"
99
+
100
+ #: includes/i18n.php:105
101
+ msgid "After your free %s, pay as little as %s"
102
+ msgstr "After your free %s, pay as little as %s"
103
+
104
+ #: includes/i18n.php:107
105
+ msgid "Details"
106
+ msgstr "Details"
107
+
108
+ #: includes/i18n.php:109
109
+ msgid "Account Details"
110
+ msgstr "Account Details"
111
+
112
+ #: includes/i18n.php:111
113
+ msgctxt "verb"
114
+ msgid "Delete"
115
+ msgstr "Delete"
116
+
117
+ #: includes/i18n.php:113
118
+ msgctxt "verb"
119
+ msgid "Show"
120
+ msgstr "Show"
121
+
122
+ #: includes/i18n.php:115
123
+ msgctxt "verb"
124
+ msgid "Hide"
125
+ msgstr "Hide"
126
+
127
+ #: includes/i18n.php:117
128
+ msgctxt "verb"
129
+ msgid "Edit"
130
+ msgstr "Edit"
131
+
132
+ #: includes/i18n.php:119
133
+ msgctxt "verb"
134
+ msgid "Update"
135
+ msgstr "Update"
136
+
137
+ #: includes/i18n.php:121
138
+ msgid "Date"
139
+ msgstr "Date"
140
+
141
+ #: includes/i18n.php:123
142
+ msgid "Amount"
143
+ msgstr "Amount"
144
+
145
+ #: includes/i18n.php:125
146
+ msgid "Invoice"
147
+ msgstr "Invoice"
148
+
149
+ #: includes/i18n.php:127
150
+ msgid "Billing"
151
+ msgstr "Billing"
152
+
153
+ #: includes/i18n.php:129
154
+ msgid "Payments"
155
+ msgstr "Payments"
156
+
157
+ #: includes/i18n.php:131
158
+ msgid "Delete Account"
159
+ msgstr "Delete Account"
160
+
161
+ #: includes/i18n.php:133
162
+ msgctxt "as close a window"
163
+ msgid "Dismiss"
164
+ msgstr "Dismiss"
165
+
166
+ #: includes/i18n.php:135
167
+ msgctxt "as product pricing plan"
168
+ msgid "Plan"
169
+ msgstr "Plan"
170
+
171
+ #: includes/i18n.php:137
172
+ msgid "Change Plan"
173
+ msgstr "Change Plan"
174
+
175
+ #: includes/i18n.php:139
176
+ msgctxt "as download professional version"
177
+ msgid "Download %s Version"
178
+ msgstr "Download %s Version"
179
+
180
+ #: includes/i18n.php:141
181
+ msgctxt "as download professional version now"
182
+ msgid "Download %s version now"
183
+ msgstr "Download %s version now"
184
+
185
+ #: includes/i18n.php:145
186
+ msgctxt "as download latest version"
187
+ msgid "Download Latest"
188
+ msgstr "Download Latest"
189
+
190
+ #: includes/i18n.php:147
191
+ msgctxt "E.g. you have a professional license."
192
+ msgid "You have a %s license."
193
+ msgstr "You have a %s license."
194
+
195
+ #: includes/i18n.php:151
196
+ msgid "New"
197
+ msgstr "New"
198
+
199
+ #: includes/i18n.php:153
200
+ msgid "Free"
201
+ msgstr "Free"
202
+
203
+ #: includes/i18n.php:155
204
+ msgctxt "as trial plan"
205
+ msgid "Trial"
206
+ msgstr "Trial"
207
+
208
+ #: includes/i18n.php:157
209
+ msgctxt "as starting a trial plan"
210
+ msgid "Start Trial"
211
+ msgstr "Start Trial"
212
+
213
+ #: includes/i18n.php:159
214
+ msgctxt "verb"
215
+ msgid "Purchase"
216
+ msgstr "Purchase"
217
+
218
+ #: includes/i18n.php:161
219
+ msgid "Purchase License"
220
+ msgstr "Purchase License"
221
+
222
+ #: includes/i18n.php:163
223
+ msgctxt "verb"
224
+ msgid "Buy"
225
+ msgstr "Buy"
226
+
227
+ #: includes/i18n.php:165
228
+ msgid "Buy License"
229
+ msgstr "Buy License"
230
+
231
+ #: includes/i18n.php:167
232
+ msgid "Single Site License"
233
+ msgstr "Single Site License"
234
+
235
+ #: includes/i18n.php:169
236
+ msgid "Unlimited Licenses"
237
+ msgstr "Unlimited Licenses"
238
+
239
+ #: includes/i18n.php:171
240
+ msgid "Up to %s Sites"
241
+ msgstr "Up to %s Sites"
242
+
243
+ #: includes/i18n.php:173
244
+ msgid "%sRenew your license now%s to access version %s features and support."
245
+ msgstr "%sRenew your license now%s to access version %s features and support."
246
+
247
+ #: includes/i18n.php:177
248
+ msgid "Enter the email address you've used for the upgrade below and we will resend you the license key."
249
+ msgstr "Enter the email address you've used for the upgrade below and we will resend you the license key."
250
+
251
+ #: includes/i18n.php:181
252
+ msgctxt "e.g. Professional Plan"
253
+ msgid "%s Plan"
254
+ msgstr "%s Plan"
255
+
256
+ #: includes/i18n.php:183
257
+ msgid "You are just one step away - %s"
258
+ msgstr "You are just one step away - %s"
259
+
260
+ #: includes/i18n.php:185
261
+ msgctxt "%s - plugin name. As complete \"Jetpack\" activation now"
262
+ msgid "Complete \"%s\" Activation Now"
263
+ msgstr "Complete \"%s\" Activation Now"
264
+
265
+ #: includes/i18n.php:189
266
+ msgid "We made a few tweaks to the plugin, %s"
267
+ msgstr "We made a few tweaks to the plugin, %s"
268
+
269
+ #: includes/i18n.php:191
270
+ msgid "Opt-in to make \"%s\" Better!"
271
+ msgstr "Opt-in to make \"%s\" Better!"
272
+
273
+ #: includes/i18n.php:193
274
+ msgid "Error"
275
+ msgstr "Error"
276
+
277
+ #: includes/i18n.php:195
278
+ msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
279
+ msgstr "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
280
+
281
+ #: includes/i18n.php:203
282
+ msgctxt "as expiration date"
283
+ msgid "Expiration"
284
+ msgstr "Expiration"
285
+
286
+ #: includes/i18n.php:205
287
+ msgctxt "as software license"
288
+ msgid "License"
289
+ msgstr "License"
290
+
291
+ #: includes/i18n.php:207
292
+ msgid "not verified"
293
+ msgstr "not verified"
294
+
295
+ #: includes/i18n.php:209
296
+ msgid "Verify Email"
297
+ msgstr "Verify Email"
298
+
299
+ #: includes/i18n.php:211
300
+ msgctxt "e.g. expires in 2 months"
301
+ msgid "Expires in %s"
302
+ msgstr "Expires in %s"
303
+
304
+ #: includes/i18n.php:213
305
+ msgctxt "e.g. auto renews in 2 months"
306
+ msgid "Auto renews in %s"
307
+ msgstr "Auto renews in %s"
308
+
309
+ #: includes/i18n.php:215
310
+ msgid "No expiration"
311
+ msgstr "No expiration"
312
+
313
+ #: includes/i18n.php:217
314
+ msgid "Expired"
315
+ msgstr "Expired"
316
+
317
+ #: includes/i18n.php:219
318
+ msgid "Cancelled"
319
+ msgstr "Cancelled"
320
+
321
+ #: includes/i18n.php:221
322
+ msgctxt "e.g. In 2 hours"
323
+ msgid "In %s"
324
+ msgstr "In %s"
325
+
326
+ #: includes/i18n.php:223
327
+ msgctxt "e.g. 2 min ago"
328
+ msgid "%s ago"
329
+ msgstr "%s ago"
330
+
331
+ #: includes/i18n.php:225
332
+ msgctxt "as plugin version"
333
+ msgid "Version"
334
+ msgstr "Version"
335
+
336
+ #: includes/i18n.php:227
337
+ msgid "Name"
338
+ msgstr "Name"
339
+
340
+ #: includes/i18n.php:229
341
+ msgid "Email"
342
+ msgstr "Email"
343
+
344
+ #: includes/i18n.php:231
345
+ msgid "Email address"
346
+ msgstr "Email address"
347
+
348
+ #: includes/i18n.php:233
349
+ msgid "Verified"
350
+ msgstr "Verified"
351
+
352
+ #: includes/i18n.php:235
353
+ msgid "Plugin"
354
+ msgstr "Plugin"
355
+
356
+ #: includes/i18n.php:237
357
+ msgid "Plugins"
358
+ msgstr "Plugins"
359
+
360
+ #: includes/i18n.php:239
361
+ msgid "Themes"
362
+ msgstr "Themes"
363
+
364
+ #: includes/i18n.php:241
365
+ msgctxt "as file/folder path"
366
+ msgid "Path"
367
+ msgstr "Path"
368
+
369
+ #: includes/i18n.php:243
370
+ msgid "Title"
371
+ msgstr "Title"
372
+
373
+ #: includes/i18n.php:245
374
+ msgid "Free version"
375
+ msgstr "Free version"
376
+
377
+ #: includes/i18n.php:247
378
+ msgid "Premium version"
379
+ msgstr "Premium version"
380
+
381
+ #: includes/i18n.php:249
382
+ msgctxt "as WP plugin slug"
383
+ msgid "Slug"
384
+ msgstr "Slug"
385
+
386
+ #: includes/i18n.php:251
387
+ msgid "ID"
388
+ msgstr "ID"
389
+
390
+ #: includes/i18n.php:253
391
+ msgid "Users"
392
+ msgstr "Users"
393
+
394
+ #: includes/i18n.php:255
395
+ msgid "Plugin Installs"
396
+ msgstr "Plugin Installs"
397
+
398
+ #: includes/i18n.php:257
399
+ msgctxt "like websites"
400
+ msgid "Sites"
401
+ msgstr "Sites"
402
+
403
+ #: includes/i18n.php:259
404
+ msgid "User ID"
405
+ msgstr "User ID"
406
+
407
+ #: includes/i18n.php:261
408
+ msgid "Site ID"
409
+ msgstr "Site ID"
410
+
411
+ #: includes/i18n.php:263
412
+ msgid "Public Key"
413
+ msgstr "Public Key"
414
+
415
+ #: includes/i18n.php:265
416
+ msgid "Secret Key"
417
+ msgstr "Secret Key"
418
+
419
+ #: includes/i18n.php:267
420
+ msgctxt "as secret encryption key missing"
421
+ msgid "No Secret"
422
+ msgstr "No Secret"
423
+
424
+ #: includes/i18n.php:269
425
+ msgid "No ID"
426
+ msgstr "No ID"
427
+
428
+ #: includes/i18n.php:271
429
+ msgctxt "as synchronize license"
430
+ msgid "Sync License"
431
+ msgstr "Sync License"
432
+
433
+ #: includes/i18n.php:273
434
+ msgctxt "as synchronize"
435
+ msgid "Sync"
436
+ msgstr "Sync"
437
+
438
+ #: includes/i18n.php:275
439
+ msgid "Activate License"
440
+ msgstr "Activate License"
441
+
442
+ #: includes/i18n.php:277
443
+ msgid "Activate Free Version"
444
+ msgstr "Activate Free Version"
445
+
446
+ #: includes/i18n.php:279
447
+ msgid "Please enter the license key that you received in the email right after the purchase:"
448
+ msgstr "Please enter the license key that you received in the email right after the purchase:"
449
+
450
+ #: includes/i18n.php:283
451
+ msgid "Activating license..."
452
+ msgstr "Activating license..."
453
+
454
+ #: includes/i18n.php:285
455
+ msgid "Change License"
456
+ msgstr "Change License"
457
+
458
+ #: includes/i18n.php:287
459
+ msgid "Update License"
460
+ msgstr "Update License"
461
+
462
+ #: includes/i18n.php:289
463
+ msgid "Deactivate License"
464
+ msgstr "Deactivate License"
465
+
466
+ #: includes/i18n.php:291
467
+ msgid "Activate"
468
+ msgstr "Activate"
469
+
470
+ #: includes/i18n.php:293
471
+ msgid "Deactivate"
472
+ msgstr "Deactivate"
473
+
474
+ #: includes/i18n.php:295
475
+ msgid "Skip & Deactivate"
476
+ msgstr "Skip & Deactivate"
477
+
478
+ #: includes/i18n.php:297
479
+ msgid "No - just deactivate"
480
+ msgstr "No - just deactivate"
481
+
482
+ #: includes/i18n.php:299
483
+ msgid "Yes - do your thing"
484
+ msgstr "Yes - do your thing"
485
+
486
+ #: includes/i18n.php:301
487
+ msgctxt "active mode"
488
+ msgid "Active"
489
+ msgstr "Active"
490
+
491
+ #: includes/i18n.php:303
492
+ msgctxt "is active mode?"
493
+ msgid "Is Active"
494
+ msgstr "Is Active"
495
+
496
+ #: includes/i18n.php:305
497
+ msgid "Install Now"
498
+ msgstr "Install Now"
499
+
500
+ #: includes/i18n.php:307
501
+ msgid "Install Update Now"
502
+ msgstr "Install Update Now"
503
+
504
+ #: includes/i18n.php:309
505
+ msgid "More information about %s"
506
+ msgstr "More information about %s"
507
+
508
+ #: includes/i18n.php:311
509
+ msgid "Localhost"
510
+ msgstr "Localhost"
511
+
512
+ #: includes/i18n.php:313
513
+ msgctxt "as activate Professional plan"
514
+ msgid "Activate %s Plan"
515
+ msgstr "Activate %s Plan"
516
+
517
+ #: includes/i18n.php:315
518
+ msgctxt "as 5 licenses left"
519
+ msgid "%s left"
520
+ msgstr "%s left"
521
+
522
+ #: includes/i18n.php:317
523
+ msgid "Last license"
524
+ msgstr "Last license"
525
+
526
+ #: includes/i18n.php:319
527
+ msgid "What is your %s?"
528
+ msgstr "What is your %s?"
529
+
530
+ #: includes/i18n.php:321
531
+ msgid "Activate this add-on"
532
+ msgstr "Activate this add-on"
533
+
534
+ #: includes/i18n.php:323
535
+ msgid "Deactivating your license will block all premium features, but will enable you to activate the license on another site. Are you sure you want to proceed?"
536
+ msgstr "Deactivating your license will block all premium features, but will enable you to activate the license on another site. Are you sure you want to proceed?"
537
+
538
+ #: includes/i18n.php:327
539
+ msgid "Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the \"Cancel\" button, and first \"Downgrade\" your account. Are you sure you would like to continue with the deletion?"
540
+ msgstr "Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the \"Cancel\" button, and first \"Downgrade\" your account. Are you sure you would like to continue with the deletion?"
541
+
542
+ #: includes/i18n.php:331
543
+ msgid "Deletion is not temporary. Only delete if you no longer want to use this plugin anymore. Are you sure you would like to continue with the deletion?"
544
+ msgstr "Deletion is not temporary. Only delete if you no longer want to use this plugin anymore. Are you sure you would like to continue with the deletion?"
545
+
546
+ #: includes/i18n.php:335
547
+ msgid "Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s."
548
+ msgstr "Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s."
549
+
550
+ #: includes/i18n.php:339
551
+ msgid "Cancelling the trial will immediately block access to all premium features. Are you sure?"
552
+ msgstr "Cancelling the trial will immediately block access to all premium features. Are you sure?"
553
+
554
+ #: includes/i18n.php:343
555
+ msgid "You can still enjoy all %s features but you will not have access to plugin updates and support."
556
+ msgstr "You can still enjoy all %s features but you will not have access to plugin updates and support."
557
+
558
+ #: includes/i18n.php:347
559
+ msgid "Once your license expire you can still use the Free version but you will NOT have access to the %s features."
560
+ msgstr "Once your license expire you can still use the Free version but you will NOT have access to the %s features."
561
+
562
+ #: includes/i18n.php:351
563
+ msgid "Are you sure you want to proceed?"
564
+ msgstr "Are you sure you want to proceed?"
565
+
566
+ #: includes/i18n.php:357
567
+ msgid "Add Ons for %s"
568
+ msgstr "Add Ons for %s"
569
+
570
+ #: includes/i18n.php:359
571
+ msgid "We could'nt load the add-ons list. It's probably an issue on our side, please try to come back in few minutes."
572
+ msgstr "We could'nt load the add-ons list. It's probably an issue on our side, please try to come back in few minutes."
573
+
574
+ #: includes/i18n.php:365
575
+ msgid "Anonymous feedback"
576
+ msgstr "Anonymous feedback"
577
+
578
+ #: includes/i18n.php:367
579
+ msgid "Quick feedback"
580
+ msgstr "Quick feedback"
581
+
582
+ #: includes/i18n.php:369
583
+ msgid "If you have a moment, please let us know why you are deactivating"
584
+ msgstr "If you have a moment, please let us know why you are deactivating"
585
+
586
+ #: includes/i18n.php:373
587
+ msgid "Yes - Deactivate"
588
+ msgstr "Yes - Deactivate"
589
+
590
+ #: includes/i18n.php:375
591
+ msgid "Submit & Deactivate"
592
+ msgstr "Submit & Deactivate"
593
+
594
+ #: includes/i18n.php:377
595
+ msgid "Cancel"
596
+ msgstr "Cancel"
597
+
598
+ #: includes/i18n.php:379
599
+ msgid "I no longer need the plugin"
600
+ msgstr "I no longer need the plugin"
601
+
602
+ #: includes/i18n.php:381
603
+ msgid "I found a better plugin"
604
+ msgstr "I found a better plugin"
605
+
606
+ #: includes/i18n.php:383
607
+ msgid "I only needed the plugin for a short period"
608
+ msgstr "I only needed the plugin for a short period"
609
+
610
+ #: includes/i18n.php:385
611
+ msgid "The plugin broke my site"
612
+ msgstr "The plugin broke my site"
613
+
614
+ #: includes/i18n.php:387
615
+ msgid "The plugin suddenly stopped working"
616
+ msgstr "The plugin suddenly stopped working"
617
+
618
+ #: includes/i18n.php:389
619
+ msgid "I can't pay for it anymore"
620
+ msgstr "I can't pay for it anymore"
621
+
622
+ #: includes/i18n.php:391
623
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
624
+ msgstr "It's a temporary deactivation. I'm just debugging an issue."
625
+
626
+ #: includes/i18n.php:395
627
+ msgctxt "the text of the \"other\" reason for deactivating the plugin that is shown in the modal box."
628
+ msgid "Other"
629
+ msgstr "Other"
630
+
631
+ #: includes/i18n.php:399
632
+ msgid "Kindly tell us the reason so we can improve."
633
+ msgstr "Kindly tell us the reason so we can improve."
634
+
635
+ #: includes/i18n.php:401
636
+ msgid "What's the plugin's name?"
637
+ msgstr "What's the plugin's name?"
638
+
639
+ #: includes/i18n.php:403
640
+ msgid "What price would you feel comfortable paying?"
641
+ msgstr "What price would you feel comfortable paying?"
642
+
643
+ #: includes/i18n.php:405
644
+ msgid "I couldn't understand how to make it work"
645
+ msgstr "I couldn't understand how to make it work"
646
+
647
+ #: includes/i18n.php:407
648
+ msgid "The plugin is great, but I need specific feature that you don't support"
649
+ msgstr "The plugin is great, but I need specific feature that you don't support"
650
+
651
+ #: includes/i18n.php:411
652
+ msgid "The plugin is not working"
653
+ msgstr "The plugin is not working"
654
+
655
+ #: includes/i18n.php:413
656
+ msgid "It's not what I was looking for"
657
+ msgstr "It's not what I was looking for"
658
+
659
+ #: includes/i18n.php:415
660
+ msgid "The plugin didn't work as expected"
661
+ msgstr "The plugin didn't work as expected"
662
+
663
+ #: includes/i18n.php:417
664
+ msgid "What feature?"
665
+ msgstr "What feature?"
666
+
667
+ #: includes/i18n.php:419
668
+ msgid "Kindly share what didn't work so we can fix it for future users..."
669
+ msgstr "Kindly share what didn't work so we can fix it for future users..."
670
+
671
+ #: includes/i18n.php:423
672
+ msgid "What you've been looking for?"
673
+ msgstr "What you've been looking for?"
674
+
675
+ #: includes/i18n.php:425
676
+ msgid "What did you expect?"
677
+ msgstr "What did you expect?"
678
+
679
+ #: includes/i18n.php:427
680
+ msgid "The plugin didn't work"
681
+ msgstr "The plugin didn't work"
682
+
683
+ #: includes/i18n.php:429
684
+ msgid "I don't like to share my information with you"
685
+ msgstr "I don't like to share my information with you"
686
+
687
+ #: includes/i18n.php:431
688
+ msgid "You might have missed it, but you don't have to share any data and can just %s the opt-in."
689
+ msgstr "You might have missed it, but you don't have to share any data and can just %s the opt-in."
690
+
691
+ #: includes/i18n.php:441
692
+ msgctxt "greeting"
693
+ msgid "Hey %s,"
694
+ msgstr "Hey %s,"
695
+
696
+ #: includes/i18n.php:443
697
+ msgctxt "a greeting. E.g. Thanks John!"
698
+ msgid "Thanks %s!"
699
+ msgstr "Thanks %s!"
700
+
701
+ #: includes/i18n.php:445
702
+ msgid "Never miss an important update - opt-in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s."
703
+ msgstr "Never miss an important update - opt-in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s."
704
+
705
+ #: includes/i18n.php:449
706
+ msgid "Please help us improve %1$s! If you opt-in, some data about your usage of %1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still work just fine."
707
+ msgstr "Please help us improve %1$s! If you opt-in, some data about your usage of %1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still work just fine."
708
+
709
+ #: includes/i18n.php:453
710
+ msgid "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."
711
+ msgstr "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."
712
+
713
+ #: includes/i18n.php:455
714
+ msgid "complete the install"
715
+ msgstr "complete the install"
716
+
717
+ #: includes/i18n.php:457
718
+ msgid "start the trial"
719
+ msgstr "start the trial"
720
+
721
+ #: includes/i18n.php:459
722
+ msgid "Thanks for purchasing %s! To get started, please enter your license key:"
723
+ msgstr "Thanks for purchasing %s! To get started, please enter your license key:"
724
+
725
+ #: includes/i18n.php:463
726
+ msgid "The plugin will be periodically sending data to %s to check for plugin updates and verify the validity of your license."
727
+ msgstr "The plugin will be periodically sending data to %s to check for plugin updates and verify the validity of your license."
728
+
729
+ #: includes/i18n.php:467
730
+ msgid "What permissions are being granted?"
731
+ msgstr "What permissions are being granted?"
732
+
733
+ #: includes/i18n.php:469
734
+ msgid "Your Profile Overview"
735
+ msgstr "Your Profile Overview"
736
+
737
+ #: includes/i18n.php:471
738
+ msgid "Name and email address"
739
+ msgstr "Name and email address"
740
+
741
+ #: includes/i18n.php:473
742
+ msgid "Your Site Overview"
743
+ msgstr "Your Site Overview"
744
+
745
+ #: includes/i18n.php:475
746
+ msgid "Site URL, WP version, PHP info, plugins & themes"
747
+ msgstr "Site URL, WP version, PHP info, plugins & themes"
748
+
749
+ #: includes/i18n.php:479
750
+ msgid "Current Plugin Events"
751
+ msgstr "Current Plugin Events"
752
+
753
+ #: includes/i18n.php:481
754
+ msgid "Activation, deactivation and uninstall"
755
+ msgstr "Activation, deactivation and uninstall"
756
+
757
+ #: includes/i18n.php:483
758
+ msgid "Plugins & Themes"
759
+ msgstr "Plugins & Themes"
760
+
761
+ #: includes/i18n.php:485
762
+ msgid "Titles, versions and state."
763
+ msgstr "Titles, versions and state."
764
+
765
+ #: includes/i18n.php:487
766
+ msgid "Admin Notices"
767
+ msgstr "Admin Notices"
768
+
769
+ #: includes/i18n.php:489
770
+ msgid "Newsletter"
771
+ msgstr "Newsletter"
772
+
773
+ #: includes/i18n.php:491
774
+ msgid "Updates, announcements, marketing, no spam"
775
+ msgstr "Updates, announcements, marketing, no spam"
776
+
777
+ #: includes/i18n.php:493
778
+ msgid "Privacy Policy"
779
+ msgstr "Privacy Policy"
780
+
781
+ #: includes/i18n.php:495
782
+ msgid "Terms of Service"
783
+ msgstr "Terms of Service"
784
+
785
+ #: includes/i18n.php:497
786
+ msgctxt "as activating plugin"
787
+ msgid "Activating"
788
+ msgstr "Activating"
789
+
790
+ #: includes/i18n.php:499
791
+ msgctxt "as in the process of sending an email"
792
+ msgid "Sending email"
793
+ msgstr "Sending email"
794
+
795
+ #: includes/i18n.php:503
796
+ msgctxt "button label"
797
+ msgid "Allow & Continue"
798
+ msgstr "Allow & Continue"
799
+
800
+ #: includes/i18n.php:505
801
+ msgctxt "button label"
802
+ msgid "Agree & Activate License"
803
+ msgstr "Agree & Activate License"
804
+
805
+ #: includes/i18n.php:507
806
+ msgctxt "verb"
807
+ msgid "Skip"
808
+ msgstr "Skip"
809
+
810
+ #: includes/i18n.php:509
811
+ msgid "Click here to use the plugin anonymously"
812
+ msgstr "Click here to use the plugin anonymously"
813
+
814
+ #: includes/i18n.php:511
815
+ msgid "Re-send activation email"
816
+ msgstr "Re-send activation email"
817
+
818
+ #: includes/i18n.php:513
819
+ msgid "License key"
820
+ msgstr "License key"
821
+
822
+ #: includes/i18n.php:515
823
+ msgid "Send License Key"
824
+ msgstr "Send License Key"
825
+
826
+ #: includes/i18n.php:517
827
+ msgid "Sending license key"
828
+ msgstr "Sending license key"
829
+
830
+ #: includes/i18n.php:519
831
+ msgid "Have a license key?"
832
+ msgstr "Have a license key?"
833
+
834
+ #: includes/i18n.php:521
835
+ msgid "Don't have a license key?"
836
+ msgstr "Don't have a license key?"
837
+
838
+ #: includes/i18n.php:523
839
+ msgid "Can't find your license key?"
840
+ msgstr "Can't find your license key?"
841
+
842
+ #: includes/i18n.php:525
843
+ msgid "We couldn't find your email address in the system, are you sure it's the right address?"
844
+ msgstr "We couldn't find your email address in the system, are you sure it's the right address?"
845
+
846
+ #: includes/i18n.php:529
847
+ msgid "We can't see any active licenses associated with that email address, are you sure it's the right address?"
848
+ msgstr "We can't see any active licenses associated with that email address, are you sure it's the right address?"
849
+
850
+ #: includes/i18n.php:533
851
+ msgid "Opt In"
852
+ msgstr "Opt In"
853
+
854
+ #: includes/i18n.php:535
855
+ msgid "Opt Out"
856
+ msgstr "Opt Out"
857
+
858
+ #: includes/i18n.php:537
859
+ msgid "On second thought - I want to continue helping"
860
+ msgstr "On second thought - I want to continue helping"
861
+
862
+ #: includes/i18n.php:541
863
+ msgid "Opting out..."
864
+ msgstr "Opting out..."
865
+
866
+ #: includes/i18n.php:543
867
+ msgid "Opting in..."
868
+ msgstr "Opting in..."
869
+
870
+ #: includes/i18n.php:545
871
+ msgid "We appreciate your help in making the %s better by letting us track some usage data."
872
+ msgstr "We appreciate your help in making the %s better by letting us track some usage data."
873
+
874
+ #: includes/i18n.php:549
875
+ msgid "Usage tracking is done in the name of making %s better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking."
876
+ msgstr "Usage tracking is done in the name of making %s better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking."
877
+
878
+ #: includes/i18n.php:553
879
+ msgid "By clicking \"Opt Out\", we will no longer be sending any data from %s to %s."
880
+ msgstr "By clicking \"Opt Out\", we will no longer be sending any data from %s to %s."
881
+
882
+ #: includes/i18n.php:563
883
+ msgid "Screenshots"
884
+ msgstr "Screenshots"
885
+
886
+ #: includes/i18n.php:565
887
+ msgid "Click to view full-size screenshot %d"
888
+ msgstr "Click to view full-size screenshot %d"
889
+
890
+ #: includes/i18n.php:573
891
+ msgid "Freemius Debug"
892
+ msgstr "Freemius Debug"
893
+
894
+ #: includes/i18n.php:575
895
+ msgctxt "as turned on"
896
+ msgid "On"
897
+ msgstr "On"
898
+
899
+ #: includes/i18n.php:577
900
+ msgctxt "as turned off"
901
+ msgid "Off"
902
+ msgstr "Off"
903
+
904
+ #: includes/i18n.php:579
905
+ msgctxt "as code debugging"
906
+ msgid "Debugging"
907
+ msgstr "Debugging"
908
+
909
+ #: includes/i18n.php:581
910
+ msgid "Freemius State"
911
+ msgstr "Freemius State"
912
+
913
+ #: includes/i18n.php:583
914
+ msgctxt "as connection was successful"
915
+ msgid "Connected"
916
+ msgstr "Connected"
917
+
918
+ #: includes/i18n.php:585
919
+ msgctxt "as connection blocked"
920
+ msgid "Blocked"
921
+ msgstr "Blocked"
922
+
923
+ #: includes/i18n.php:587
924
+ msgctxt "as application program interface"
925
+ msgid "API"
926
+ msgstr "API"
927
+
928
+ #: includes/i18n.php:589
929
+ msgctxt "as software development kit versions"
930
+ msgid "SDK"
931
+ msgstr "SDK"
932
+
933
+ #: includes/i18n.php:591
934
+ msgctxt "as software development kit versions"
935
+ msgid "SDK Versions"
936
+ msgstr "SDK Versions"
937
+
938
+ #: includes/i18n.php:595
939
+ msgctxt "as plugin folder path"
940
+ msgid "Plugin Path"
941
+ msgstr "Plugin Path"
942
+
943
+ #: includes/i18n.php:597
944
+ msgctxt "as sdk path"
945
+ msgid "SDK Path"
946
+ msgstr "SDK Path"
947
+
948
+ #: includes/i18n.php:599
949
+ msgid "Add Ons of Plugin %s"
950
+ msgstr "Add Ons of Plugin %s"
951
+
952
+ #: includes/i18n.php:601
953
+ msgid "Are you sure you want to delete all Freemius data?"
954
+ msgstr "Are you sure you want to delete all Freemius data?"
955
+
956
+ #: includes/i18n.php:605
957
+ msgid "Actions"
958
+ msgstr "Actions"
959
+
960
+ #: includes/i18n.php:607
961
+ msgid "Delete All Accounts"
962
+ msgstr "Delete All Accounts"
963
+
964
+ #: includes/i18n.php:609
965
+ msgid "Start Fresh"
966
+ msgstr "Start Fresh"
967
+
968
+ #: includes/i18n.php:611
969
+ msgid "Clear API Cache"
970
+ msgstr "Clear API Cache"
971
+
972
+ #: includes/i18n.php:613
973
+ msgid "Sync Data From Server"
974
+ msgstr "Sync Data From Server"
975
+
976
+ #: includes/i18n.php:615
977
+ msgid "Scheduled Crons"
978
+ msgstr "Scheduled Crons"
979
+
980
+ #: includes/i18n.php:617
981
+ msgid "Plugins & Themes Sync"
982
+ msgstr "Plugins & Themes Sync"
983
+
984
+ #: includes/i18n.php:625
985
+ msgctxt "as congratulations"
986
+ msgid "Congrats"
987
+ msgstr "Congrats"
988
+
989
+ #: includes/i18n.php:627
990
+ msgctxt "exclamation"
991
+ msgid "Oops"
992
+ msgstr "Oops"
993
+
994
+ #: includes/i18n.php:629
995
+ msgctxt "interjection expressing joy or exuberance"
996
+ msgid "Yee-haw"
997
+ msgstr "Yee-haw"
998
+
999
+ #: includes/i18n.php:633
1000
+ msgctxt "(especially in electronic communication) used to express elation, enthusiasm, or triumph."
1001
+ msgid "W00t"
1002
+ msgstr "W00t"
1003
+
1004
+ #: includes/i18n.php:637
1005
+ msgctxt "a positive response"
1006
+ msgid "Right on"
1007
+ msgstr "Right on"
1008
+
1009
+ #: includes/i18n.php:639
1010
+ msgctxt "something somebody says when they are thinking about what you have just said. "
1011
+ msgid "Hmm"
1012
+ msgstr "Hmm"
1013
+
1014
+ #: includes/i18n.php:643
1015
+ msgid "O.K"
1016
+ msgstr "O.K"
1017
+
1018
+ #: includes/i18n.php:645
1019
+ msgctxt "exclamation"
1020
+ msgid "Hey"
1021
+ msgstr "Hey"
1022
+
1023
+ #: includes/i18n.php:647
1024
+ msgctxt "advance notice of something that will need attention."
1025
+ msgid "Heads up"
1026
+ msgstr "Heads up"
1027
+
1028
+ #: includes/i18n.php:657
1029
+ msgid "Seems like you got the latest release."
1030
+ msgstr "Seems like you got the latest release."
1031
+
1032
+ #: includes/i18n.php:659
1033
+ msgid "You are all good!"
1034
+ msgstr "You are all good!"
1035
+
1036
+ #: includes/i18n.php:661
1037
+ msgid "Sorry, we could not complete the email update. Another user with the same email is already registered."
1038
+ msgstr "Sorry, we could not complete the email update. Another user with the same email is already registered."
1039
+
1040
+ #: includes/i18n.php:665
1041
+ msgid "If you would like to give up the ownership of the plugin's account to %s click the Change Ownership button."
1042
+ msgstr "If you would like to give up the ownership of the plugin's account to %s click the Change Ownership button."
1043
+
1044
+ #: includes/i18n.php:669
1045
+ msgid "Your email was successfully updated. You should receive an email with confirmation instructions in few moments."
1046
+ msgstr "Your email was successfully updated. You should receive an email with confirmation instructions in few moments."
1047
+
1048
+ #: includes/i18n.php:673
1049
+ msgid "Your name was successfully updated."
1050
+ msgstr "Your name was successfully updated."
1051
+
1052
+ #: includes/i18n.php:675
1053
+ msgid "You have successfully updated your %s."
1054
+ msgstr "You have successfully updated your %s."
1055
+
1056
+ #: includes/i18n.php:677
1057
+ msgid "Please provide your full name."
1058
+ msgstr "Please provide your full name."
1059
+
1060
+ #: includes/i18n.php:679
1061
+ msgid "Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box."
1062
+ msgstr "Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box."
1063
+
1064
+ #: includes/i18n.php:683
1065
+ msgid "Just letting you know that the add-ons information of %s is being pulled from an external server."
1066
+ msgstr "Just letting you know that the add-ons information of %s is being pulled from an external server."
1067
+
1068
+ #: includes/i18n.php:687
1069
+ msgid "No credit card required"
1070
+ msgstr "No credit card required"
1071
+
1072
+ #: includes/i18n.php:689
1073
+ msgid "Premium plugin version was successfully activated."
1074
+ msgstr "Premium plugin version was successfully activated."
1075
+
1076
+ #: includes/i18n.php:693
1077
+ msgid "The upgrade of %s was successfully completed."
1078
+ msgstr "The upgrade of %s was successfully completed."
1079
+
1080
+ #: includes/i18n.php:695
1081
+ msgid "Your account was successfully activated with the %s plan."
1082
+ msgstr "Your account was successfully activated with the %s plan."
1083
+
1084
+ #: includes/i18n.php:699
1085
+ msgid "Download the latest %s version now"
1086
+ msgstr "Download the latest %s version now"
1087
+
1088
+ #: includes/i18n.php:701
1089
+ msgid "Please follow these steps to complete the upgrade"
1090
+ msgstr "Please follow these steps to complete the upgrade"
1091
+
1092
+ #: includes/i18n.php:705
1093
+ msgid "Download the latest %s version"
1094
+ msgstr "Download the latest %s version"
1095
+
1096
+ #: includes/i18n.php:707
1097
+ msgid "Download the latest version"
1098
+ msgstr "Download the latest version"
1099
+
1100
+ #: includes/i18n.php:709
1101
+ msgid "Deactivate the free version"
1102
+ msgstr "Deactivate the free version"
1103
+
1104
+ #: includes/i18n.php:711
1105
+ msgid "Upload and activate the downloaded version"
1106
+ msgstr "Upload and activate the downloaded version"
1107
+
1108
+ #: includes/i18n.php:713
1109
+ msgid "How to upload and activate?"
1110
+ msgstr "How to upload and activate?"
1111
+
1112
+ #: includes/i18n.php:715
1113
+ msgctxt "%s - product name, e.g. Facebook add-on was successfully..."
1114
+ msgid "%s Add-on was successfully purchased."
1115
+ msgstr "%s Add-on was successfully purchased."
1116
+
1117
+ #: includes/i18n.php:719
1118
+ msgid "Your %s Add-on plan was successfully upgraded."
1119
+ msgstr "Your %s Add-on plan was successfully upgraded."
1120
+
1121
+ #: includes/i18n.php:723
1122
+ msgid "Your email has been successfully verified - you are AWESOME!"
1123
+ msgstr "Your email has been successfully verified - you are AWESOME!"
1124
+
1125
+ #: includes/i18n.php:727
1126
+ msgid "Your plan was successfully upgraded."
1127
+ msgstr "Your plan was successfully upgraded."
1128
+
1129
+ #: includes/i18n.php:729
1130
+ msgid "Your plan was successfully changed to %s."
1131
+ msgstr "Your plan was successfully changed to %s."
1132
+
1133
+ #: includes/i18n.php:731
1134
+ msgid "Your license has expired. You can still continue using the free plugin forever."
1135
+ msgstr "Your license has expired. You can still continue using the free plugin forever."
1136
+
1137
+ #: includes/i18n.php:735
1138
+ msgid "Your license has been cancelled. If you think it's a mistake, please contact support."
1139
+ msgstr "Your license has been cancelled. If you think it's a mistake, please contact support."
1140
+
1141
+ #: includes/i18n.php:739
1142
+ msgid "Your trial has been successfully started."
1143
+ msgstr "Your trial has been successfully started."
1144
+
1145
+ #: includes/i18n.php:741
1146
+ msgid "Your license was successfully activated."
1147
+ msgstr "Your license was successfully activated."
1148
+
1149
+ #: includes/i18n.php:743
1150
+ msgid "It looks like your site currently doesn't have an active license."
1151
+ msgstr "It looks like your site currently doesn't have an active license."
1152
+
1153
+ #: includes/i18n.php:747
1154
+ msgid "Your license was successfully deactivated, you are back to the %s plan."
1155
+ msgstr "Your license was successfully deactivated, you are back to the %s plan."
1156
+
1157
+ #: includes/i18n.php:751
1158
+ msgid "It looks like the license deactivation failed."
1159
+ msgstr "It looks like the license deactivation failed."
1160
+
1161
+ #: includes/i18n.php:755
1162
+ msgid "It looks like the license could not be activated."
1163
+ msgstr "It looks like the license could not be activated."
1164
+
1165
+ #: includes/i18n.php:759
1166
+ msgid "Error received from the server:"
1167
+ msgstr "Error received from the server:"
1168
+
1169
+ #: includes/i18n.php:761
1170
+ msgid "Your trial has expired. You can still continue using all our free features."
1171
+ msgstr "Your trial has expired. You can still continue using all our free features."
1172
+
1173
+ #: includes/i18n.php:765
1174
+ msgid "Your plan was successfully downgraded. Your %s plan license will expire in %s."
1175
+ msgstr "Your plan was successfully downgraded. Your %s plan license will expire in %s."
1176
+
1177
+ #: includes/i18n.php:769
1178
+ msgid "Seems like we are having some temporary issue with your plan downgrade. Please try again in few minutes."
1179
+ msgstr "Seems like we are having some temporary issue with your plan downgrade. Please try again in few minutes."
1180
+
1181
+ #: includes/i18n.php:773
1182
+ msgid "It looks like you are not in trial mode anymore so there's nothing to cancel :)"
1183
+ msgstr "It looks like you are not in trial mode anymore so there's nothing to cancel :)"
1184
+
1185
+ #: includes/i18n.php:777
1186
+ msgid "Your %s free trial was successfully cancelled."
1187
+ msgstr "Your %s free trial was successfully cancelled."
1188
+
1189
+ #: includes/i18n.php:781
1190
+ msgctxt "%s - numeric version number"
1191
+ msgid "Version %s was released."
1192
+ msgstr "Version %s was released."
1193
+
1194
+ #: includes/i18n.php:785
1195
+ msgid "Please download %s."
1196
+ msgstr "Please download %s."
1197
+
1198
+ #: includes/i18n.php:787
1199
+ msgctxt "%s - plan name, as the latest professional version here"
1200
+ msgid "the latest %s version here"
1201
+ msgstr "the latest %s version here"
1202
+
1203
+ #: includes/i18n.php:791
1204
+ msgid "How do you like %s so far? Test all our %s premium features with a %d-day free trial."
1205
+ msgstr "How do you like %s so far? Test all our %s premium features with a %d-day free trial."
1206
+
1207
+ #: includes/i18n.php:795
1208
+ msgctxt "call to action"
1209
+ msgid "Start free trial"
1210
+ msgstr "Start free trial"
1211
+
1212
+ #: includes/i18n.php:797
1213
+ msgid "Starting trial"
1214
+ msgstr "Starting trial"
1215
+
1216
+ #: includes/i18n.php:799
1217
+ msgid "Please wait"
1218
+ msgstr "Please wait"
1219
+
1220
+ #: includes/i18n.php:801
1221
+ msgid "Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes."
1222
+ msgstr "Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes."
1223
+
1224
+ #: includes/i18n.php:805
1225
+ msgid "You already utilized a trial before."
1226
+ msgstr "You already utilized a trial before."
1227
+
1228
+ #: includes/i18n.php:807
1229
+ msgid "You are already running the plugin in a trial mode."
1230
+ msgstr "You are already running the plugin in a trial mode."
1231
+
1232
+ #: includes/i18n.php:811
1233
+ msgid "Plan %s do not exist, therefore, can't start a trial."
1234
+ msgstr "Plan %s do not exist, therefore, can't start a trial."
1235
+
1236
+ #: includes/i18n.php:815
1237
+ msgid "Plan %s does not support a trial period."
1238
+ msgstr "Plan %s does not support a trial period."
1239
+
1240
+ #: includes/i18n.php:817
1241
+ msgid "None of the plugin's plans supports a trial period."
1242
+ msgstr "None of the plugin's plans supports a trial period."
1243
+
1244
+ #: includes/i18n.php:821
1245
+ msgid "Unexpected API error. Please contact the plugin's author with the following error."
1246
+ msgstr "Unexpected API error. Please contact the plugin's author with the following error."
1247
+
1248
+ #: includes/i18n.php:825
1249
+ msgid "No commitment for %s days - cancel anytime!"
1250
+ msgstr "No commitment for %s days - cancel anytime!"
1251
+
1252
+ #: includes/i18n.php:827
1253
+ msgid "Your license has expired. You can still continue using all the %s features, but you'll need to renew your license to continue getting updates and support."
1254
+ msgstr "Your license has expired. You can still continue using all the %s features, but you'll need to renew your license to continue getting updates and support."
1255
+
1256
+ #: includes/i18n.php:831
1257
+ msgid "Couldn't activate %s."
1258
+ msgstr "Couldn't activate %s."
1259
+
1260
+ #: includes/i18n.php:833
1261
+ msgid "Please contact us with the following message:"
1262
+ msgstr "Please contact us with the following message:"
1263
+
1264
+ #: includes/i18n.php:835
1265
+ msgid "It looks like you are still on the %s plan. If you did upgrade or change your plan, it's probably an issue on our side - sorry."
1266
+ msgstr "It looks like you are still on the %s plan. If you did upgrade or change your plan, it's probably an issue on our side - sorry."
1267
+
1268
+ #: includes/i18n.php:839
1269
+ msgid "Please contact us here"
1270
+ msgstr "Please contact us here"
1271
+
1272
+ #: includes/i18n.php:841
1273
+ msgid "I have upgraded my account but when I try to Sync the License, the plan remains %s."
1274
+ msgstr "I have upgraded my account but when I try to Sync the License, the plan remains %s."
1275
+
1276
+ #: includes/i18n.php:849
1277
+ msgid "From unknown reason, the API connectivity test failed."
1278
+ msgstr "From unknown reason, the API connectivity test failed."
1279
+
1280
+ #: includes/i18n.php:853
1281
+ msgid "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?"
1282
+ msgstr "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?"
1283
+
1284
+ #: includes/i18n.php:857
1285
+ msgid "We use PHP cURL library for the API calls, which is a very common library and usually installed out of the box. Unfortunately, cURL is not installed on your server."
1286
+ msgstr "We use PHP cURL library for the API calls, which is a very common library and usually installed out of the box. Unfortunately, cURL is not installed on your server."
1287
+
1288
+ #: includes/i18n.php:861
1289
+ msgid "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1290
+ msgstr "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1291
+
1292
+ #: includes/i18n.php:865
1293
+ msgctxt "as pluginX requires an access to our API"
1294
+ msgid "%s requires an access to our API."
1295
+ msgstr "%s requires an access to our API."
1296
+
1297
+ #: includes/i18n.php:869
1298
+ msgid "It looks like your server is using Squid ACL (access control lists), which blocks the connection."
1299
+ msgstr "It looks like your server is using Squid ACL (access control lists), which blocks the connection."
1300
+
1301
+ #: includes/i18n.php:873
1302
+ msgid "I don't know what is Squid or ACL, help me!"
1303
+ msgstr "I don't know what is Squid or ACL, help me!"
1304
+
1305
+ #: includes/i18n.php:875, includes/i18n.php:889
1306
+ msgid "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."
1307
+ msgstr "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."
1308
+
1309
+ #: includes/i18n.php:879
1310
+ msgid "I'm a system administrator"
1311
+ msgstr "I'm a system administrator"
1312
+
1313
+ #: includes/i18n.php:881
1314
+ msgid "Great, please whitelist the following domains: %s. Once you done, deactivate the plugin and activate it again."
1315
+ msgstr "Great, please whitelist the following domains: %s. Once you done, deactivate the plugin and activate it again."
1316
+
1317
+ #: includes/i18n.php:885
1318
+ msgid "I don't know what is cURL or how to install it, help me!"
1319
+ msgstr "I don't know what is cURL or how to install it, help me!"
1320
+
1321
+ #: includes/i18n.php:893
1322
+ msgid "Great, please install cURL and enable it in your php.ini file. To make sure it was successfully activated, use 'phpinfo()'. Once activated, deactivate the plugin and reactivate it back again."
1323
+ msgstr "Great, please install cURL and enable it in your php.ini file. To make sure it was successfully activated, use 'phpinfo()'. Once activated, deactivate the plugin and reactivate it back again."
1324
+
1325
+ #: includes/i18n.php:897
1326
+ msgid "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."
1327
+ msgstr "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."
1328
+
1329
+ #: includes/i18n.php:901
1330
+ msgid "Sorry for the inconvenience and we are here to help if you give us a chance."
1331
+ msgstr "Sorry for the inconvenience and we are here to help if you give us a chance."
1332
+
1333
+ #: includes/i18n.php:905
1334
+ msgid "Yes - I'm giving you a chance to fix it"
1335
+ msgstr "Yes - I'm giving you a chance to fix it"
1336
+
1337
+ #: includes/i18n.php:907
1338
+ msgid "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."
1339
+ msgstr "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."
1340
+
1341
+ #: includes/i18n.php:911
1342
+ msgid "Let's try your previous version"
1343
+ msgstr "Let's try your previous version"
1344
+
1345
+ #: includes/i18n.php:913
1346
+ msgid "Uninstall this version and install the previous one."
1347
+ msgstr "Uninstall this version and install the previous one."
1348
+
1349
+ #: includes/i18n.php:917
1350
+ msgid "That's exhausting, please deactivate"
1351
+ msgstr "That's exhausting, please deactivate"
1352
+
1353
+ #: includes/i18n.php:919
1354
+ msgid "We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future."
1355
+ msgstr "We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future."
1356
+
1357
+ #: includes/i18n.php:923
1358
+ msgid "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."
1359
+ msgstr "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."
1360
+
1361
+ #: includes/i18n.php:927
1362
+ msgctxt "%1s - plugin title, %2s - API domain"
1363
+ msgid "Your server is blocking the access to Freemius' API, which is crucial for %1s synchronization. Please contact your host to whitelist %2s"
1364
+ msgstr "Your server is blocking the access to Freemius' API, which is crucial for %1s synchronization. Please contact your host to whitelist %2s"
1365
+
1366
+ #: includes/i18n.php:931
1367
+ msgid "It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again."
1368
+ msgstr "It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again."
1369
+
1370
+ #: includes/i18n.php:939
1371
+ msgid "Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder."
1372
+ msgstr "Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder."
1373
+
1374
+ #: includes/i18n.php:943
1375
+ msgid "Thanks for confirming the ownership change. An email was just sent to %s for final approval."
1376
+ msgstr "Thanks for confirming the ownership change. An email was just sent to %s for final approval."
1377
+
1378
+ #: includes/i18n.php:947
1379
+ msgid "%s is the new owner of the account."
1380
+ msgstr "%s is the new owner of the account."
1381
+
1382
+ #: includes/i18n.php:951
1383
+ msgctxt "addonX cannot run without pluginY"
1384
+ msgid "%s cannot run without %s."
1385
+ msgstr "%s cannot run without %s."
1386
+
1387
+ #: includes/i18n.php:955
1388
+ msgctxt "addonX cannot run..."
1389
+ msgid "%s cannot run without the plugin."
1390
+ msgstr "%s cannot run without the plugin."
1391
+
1392
+ #: includes/i18n.php:959
1393
+ msgctxt "pluginX activation was successfully..."
1394
+ msgid "%s activation was successfully completed."
1395
+ msgstr "%s activation was successfully completed."
1396
+
1397
+ #: includes/i18n.php:963
1398
+ msgctxt "Plugin installer section title"
1399
+ msgid "Features & Pricing"
1400
+ msgstr "Features & Pricing"
1401
+
1402
+ #: includes/i18n.php:967
1403
+ msgid "Add-on must be deployed to WordPress.org or Freemius."
1404
+ msgstr "Add-on must be deployed to WordPress.org or Freemius."
1405
+
1406
+ #: includes/i18n.php:971
1407
+ msgid "Paid add-on must be deployed to Freemius."
1408
+ msgstr "Paid add-on must be deployed to Freemius."
1409
+
1410
+ #: includes/i18n.php:979
1411
+ msgid "%s is a premium only add-on. You have to purchase a license first before activating the plugin."
1412
+ msgstr "%s is a premium only add-on. You have to purchase a license first before activating the plugin."
1413
+
1414
+ #: includes/i18n.php:983
1415
+ msgid "%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."
1416
+ msgstr "%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."
1417
+
1418
+ #: includes/i18n.php:995
1419
+ msgctxt "as every month"
1420
+ msgid "Monthly"
1421
+ msgstr "Monthly"
1422
+
1423
+ #: includes/i18n.php:997
1424
+ msgctxt "as monthly period"
1425
+ msgid "mo"
1426
+ msgstr "mo"
1427
+
1428
+ #: includes/i18n.php:999
1429
+ msgctxt "as once a year"
1430
+ msgid "Annual"
1431
+ msgstr "Annual"
1432
+
1433
+ #: includes/i18n.php:1001
1434
+ msgctxt "as once a year"
1435
+ msgid "Annually"
1436
+ msgstr "Annually"
1437
+
1438
+ #: includes/i18n.php:1003
1439
+ msgctxt "as once a year"
1440
+ msgid "Once"
1441
+ msgstr "Once"
1442
+
1443
+ #: includes/i18n.php:1005
1444
+ msgctxt "as annual period"
1445
+ msgid "year"
1446
+ msgstr "year"
1447
+
1448
+ #: includes/i18n.php:1007
1449
+ msgid "Lifetime"
1450
+ msgstr "Lifetime"
1451
+
1452
+ #: includes/i18n.php:1009
1453
+ msgctxt "e.g. the best product"
1454
+ msgid "Best"
1455
+ msgstr "Best"
1456
+
1457
+ #: includes/i18n.php:1011
1458
+ msgctxt "e.g. billed monthly"
1459
+ msgid "Billed %s"
1460
+ msgstr "Billed %s"
1461
+
1462
+ #: includes/i18n.php:1013
1463
+ msgctxt "as a discount of $5 or 10%"
1464
+ msgid "Save %s"
1465
+ msgstr "Save %s"
1466
+
1467
+ #: includes/i18n.php:1017
1468
+ msgid "View details"
1469
+ msgstr "View details"
1470
+
1471
+ #: includes/i18n.php:1025
1472
+ msgctxt "button label"
1473
+ msgid "Approve & Start Trial"
1474
+ msgstr "Approve & Start Trial"
1475
+
1476
+ #: includes/i18n.php:1029
1477
+ msgid "You are 1-click away from starting your %1$s-day free trial of the %2$s plan."
1478
+ msgstr "You are 1-click away from starting your %1$s-day free trial of the %2$s plan."
1479
+
1480
+ #: includes/i18n.php:1033
1481
+ msgid "For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt-in with your user and non-sensitive site information, allowing the plugin to periodically send data to %s to check for version updates and to validate your trial."
1482
+ msgstr "For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt-in with your user and non-sensitive site information, allowing the plugin to periodically send data to %s to check for version updates and to validate your trial."
1483
+
1484
+ #: includes/i18n.php:1045
1485
+ msgid "Business name"
1486
+ msgstr "Business name"
1487
+
1488
+ #: includes/i18n.php:1047
1489
+ msgid "Tax / VAT ID"
1490
+ msgstr "Tax / VAT ID"
1491
+
1492
+ #: includes/i18n.php:1049
1493
+ msgid "Address Line %d"
1494
+ msgstr "Address Line %d"
1495
+
1496
+ #: includes/i18n.php:1051
1497
+ msgid "Country"
1498
+ msgstr "Country"
1499
+
1500
+ #: includes/i18n.php:1053
1501
+ msgid "Select Country"
1502
+ msgstr "Select Country"
1503
+
1504
+ #: includes/i18n.php:1055
1505
+ msgid "City"
1506
+ msgstr "City"
1507
+
1508
+ #: includes/i18n.php:1057
1509
+ msgid "Town"
1510
+ msgstr "Town"
1511
+
1512
+ #: includes/i18n.php:1059
1513
+ msgid "State"
1514
+ msgstr "State"
1515
+
1516
+ #: includes/i18n.php:1061
1517
+ msgid "Province"
1518
+ msgstr "Province"
1519
+
1520
+ #: includes/i18n.php:1063
1521
+ msgid "ZIP / Postal Code"
1522
+ msgstr "ZIP / Postal Code"
freemius/languages/freemius-he.mo ADDED
Binary file
freemius/languages/freemius-he.po ADDED
@@ -0,0 +1,1661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 freemius
2
+ # This file is distributed under the same license as the freemius package.
3
+ # Translators:
4
+ # Vova Feldman <vova@freemius.com>, 2016
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: WordPress SDK\n"
8
+ "Report-Msgid-Bugs-To: https://github.com/Freemius/wordpress-sdk/issues\n"
9
+ "PO-Revision-Date: 2016-12-07 01:29+0000\n"
10
+ "Last-Translator: Vova Feldman <vova@freemius.com>\n"
11
+ "Language-Team: Hebrew (http://www.transifex.com/freemius/wordpress-sdk/language/he/)\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Language: he\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Poedit-Basepath: ..\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
21
+ "X-Poedit-SourceCharset: UTF-8\n"
22
+
23
+ #: includes/i18n.php41, includes/i18n.php:55
24
+ msgid "Yes - I'm in!"
25
+ msgstr ""
26
+
27
+ #: includes/i18n.php43, includes/i18n.php:57
28
+ msgid "Not today"
29
+ msgstr "לא היום"
30
+
31
+ #: includes/i18n.php:69
32
+ msgid "Account"
33
+ msgstr "חשבון"
34
+
35
+ #: includes/i18n.php:71
36
+ msgid "Add On"
37
+ msgstr "תוסף"
38
+
39
+ #: includes/i18n.php:73
40
+ msgid "Contact Us"
41
+ msgstr "יצירת קשר"
42
+
43
+ #: includes/i18n.php:75
44
+ msgid "Contact Support"
45
+ msgstr "צור קשר"
46
+
47
+ #: includes/i18n.php:77
48
+ msgid "Change Ownership"
49
+ msgstr "עדכון בעלות"
50
+
51
+ #: includes/i18n.php:79
52
+ msgid "Support"
53
+ msgstr "תמיכה"
54
+
55
+ #: includes/i18n.php:81
56
+ msgid "Support Forum"
57
+ msgstr "פורום תמיכה"
58
+
59
+ #: includes/i18n.php:83
60
+ msgid "Add Ons"
61
+ msgstr "תוספים"
62
+
63
+ #: includes/i18n.php:85
64
+ msgctxt "verb"
65
+ msgid "Upgrade"
66
+ msgstr "שדרג"
67
+
68
+ #: includes/i18n.php:87
69
+ msgid "Awesome"
70
+ msgstr "אדיר"
71
+
72
+ #: includes/i18n.php:89
73
+ msgctxt "noun"
74
+ msgid "Pricing"
75
+ msgstr "מחירון"
76
+
77
+ #: includes/i18n.php:91
78
+ msgctxt "noun"
79
+ msgid "Price"
80
+ msgstr "מחיר"
81
+
82
+ #: includes/i18n.php:93
83
+ msgid "Unlimited Updates"
84
+ msgstr "עדכונים ללא הגבלה"
85
+
86
+ #: includes/i18n.php:95
87
+ msgctxt "verb"
88
+ msgid "Downgrade"
89
+ msgstr "שנמך"
90
+
91
+ #: includes/i18n.php:97
92
+ msgid "Cancel Trial"
93
+ msgstr "ביט"
94
+
95
+ #: includes/i18n.php:99
96
+ msgid "Free Trial"
97
+ msgstr "ניסיון חינם"
98
+
99
+ #: includes/i18n.php:101
100
+ msgid "Start my free %s"
101
+ msgstr "התחל את %s הניסיון שלי"
102
+
103
+ #: includes/i18n.php:103
104
+ msgid "No commitment for %s - cancel anytime"
105
+ msgstr ""
106
+
107
+ #: includes/i18n.php:105
108
+ msgid "After your free %s, pay as little as %s"
109
+ msgstr ""
110
+
111
+ #: includes/i18n.php:107
112
+ msgid "Details"
113
+ msgstr "פרטים"
114
+
115
+ #: includes/i18n.php:109
116
+ msgid "Account Details"
117
+ msgstr "פרטי חשבון"
118
+
119
+ #: includes/i18n.php:111
120
+ msgctxt "verb"
121
+ msgid "Delete"
122
+ msgstr "מחק"
123
+
124
+ #: includes/i18n.php:113
125
+ msgctxt "verb"
126
+ msgid "Show"
127
+ msgstr "הצג"
128
+
129
+ #: includes/i18n.php:115
130
+ msgctxt "verb"
131
+ msgid "Hide"
132
+ msgstr "הסתר"
133
+
134
+ #: includes/i18n.php:117
135
+ msgctxt "verb"
136
+ msgid "Edit"
137
+ msgstr "ערוך"
138
+
139
+ #: includes/i18n.php:119
140
+ msgctxt "verb"
141
+ msgid "Update"
142
+ msgstr ""
143
+
144
+ #: includes/i18n.php:121
145
+ msgid "Date"
146
+ msgstr "תאריך"
147
+
148
+ #: includes/i18n.php:123
149
+ msgid "Amount"
150
+ msgstr "סכום"
151
+
152
+ #: includes/i18n.php:125
153
+ msgid "Invoice"
154
+ msgstr "חשבונית"
155
+
156
+ #: includes/i18n.php:127
157
+ msgid "Billing"
158
+ msgstr "בילינג"
159
+
160
+ #: includes/i18n.php:129
161
+ msgid "Payments"
162
+ msgstr "תשלומים"
163
+
164
+ #: includes/i18n.php:131
165
+ msgid "Delete Account"
166
+ msgstr "מחיקת חשבון"
167
+
168
+ #: includes/i18n.php:133
169
+ msgctxt "as close a window"
170
+ msgid "Dismiss"
171
+ msgstr "סגירה"
172
+
173
+ #: includes/i18n.php:135
174
+ msgctxt "as product pricing plan"
175
+ msgid "Plan"
176
+ msgstr "חבילה"
177
+
178
+ #: includes/i18n.php:137
179
+ msgid "Change Plan"
180
+ msgstr "שינוי חבילה"
181
+
182
+ #: includes/i18n.php:139
183
+ msgctxt "as download professional version"
184
+ msgid "Download %s Version"
185
+ msgstr ""
186
+
187
+ #: includes/i18n.php:141
188
+ msgctxt "as download professional version now"
189
+ msgid "Download %s version now"
190
+ msgstr ""
191
+
192
+ #: includes/i18n.php:145
193
+ msgctxt "as download latest version"
194
+ msgid "Download Latest"
195
+ msgstr "הורד גרסה אחרונה"
196
+
197
+ #: includes/i18n.php:147
198
+ msgctxt "E.g. you have a professional license."
199
+ msgid "You have a %s license."
200
+ msgstr ""
201
+
202
+ #: includes/i18n.php:151
203
+ msgid "New"
204
+ msgstr "חדש"
205
+
206
+ #: includes/i18n.php:153
207
+ msgid "Free"
208
+ msgstr "חינם"
209
+
210
+ #: includes/i18n.php:155
211
+ msgctxt "as trial plan"
212
+ msgid "Trial"
213
+ msgstr "ניסיון"
214
+
215
+ #: includes/i18n.php:157
216
+ msgctxt "as starting a trial plan"
217
+ msgid "Start Trial"
218
+ msgstr ""
219
+
220
+ #: includes/i18n.php:159
221
+ msgctxt "verb"
222
+ msgid "Purchase"
223
+ msgstr "רכישה"
224
+
225
+ #: includes/i18n.php:161
226
+ msgid "Purchase License"
227
+ msgstr "קניית רישיון"
228
+
229
+ #: includes/i18n.php:163
230
+ msgctxt "verb"
231
+ msgid "Buy"
232
+ msgstr "קנייה"
233
+
234
+ #: includes/i18n.php:165
235
+ msgid "Buy License"
236
+ msgstr "קניית רישיון"
237
+
238
+ #: includes/i18n.php:167
239
+ msgid "Single Site License"
240
+ msgstr "רשיון לאתר אחד"
241
+
242
+ #: includes/i18n.php:169
243
+ msgid "Unlimited Licenses"
244
+ msgstr "רשיונות ללא הגבלה"
245
+
246
+ #: includes/i18n.php:171
247
+ msgid "Up to %s Sites"
248
+ msgstr "עד %s אתרים"
249
+
250
+ #: includes/i18n.php:173
251
+ msgid "%sRenew your license now%s to access version %s features and support."
252
+ msgstr ""
253
+
254
+ #: includes/i18n.php:177
255
+ msgid ""
256
+ "Enter the email address you've used for the upgrade below and we will resend"
257
+ " you the license key."
258
+ msgstr ""
259
+
260
+ #: includes/i18n.php:181
261
+ msgctxt "e.g. Professional Plan"
262
+ msgid "%s Plan"
263
+ msgstr ""
264
+
265
+ #: includes/i18n.php:183
266
+ msgid "You are just one step away - %s"
267
+ msgstr ""
268
+
269
+ #: includes/i18n.php:185
270
+ msgctxt "%s - plugin name. As complete \"Jetpack\" activation now"
271
+ msgid "Complete \"%s\" Activation Now"
272
+ msgstr ""
273
+
274
+ #: includes/i18n.php:189
275
+ msgid "We made a few tweaks to the plugin, %s"
276
+ msgstr "ביצענו מספר שינויים לתוסף, %s"
277
+
278
+ #: includes/i18n.php:191
279
+ msgid "Opt-in to make \"%s\" Better!"
280
+ msgstr ""
281
+
282
+ #: includes/i18n.php:193
283
+ msgid "Error"
284
+ msgstr "שגיאה"
285
+
286
+ #: includes/i18n.php:195
287
+ msgid ""
288
+ "Freemius SDK couldn't find the plugin's main file. Please contact "
289
+ "sdk@freemius.com with the current error."
290
+ msgstr ""
291
+
292
+ #: includes/i18n.php:203
293
+ msgctxt "as expiration date"
294
+ msgid "Expiration"
295
+ msgstr "תפוגה"
296
+
297
+ #: includes/i18n.php:205
298
+ msgctxt "as software license"
299
+ msgid "License"
300
+ msgstr "רישיון"
301
+
302
+ #: includes/i18n.php:207
303
+ msgid "not verified"
304
+ msgstr "לא מאומת"
305
+
306
+ #: includes/i18n.php:209
307
+ msgid "Verify Email"
308
+ msgstr "אמת כתובת דוא\"ל"
309
+
310
+ #: includes/i18n.php:211
311
+ msgctxt "e.g. expires in 2 months"
312
+ msgid "Expires in %s"
313
+ msgstr ""
314
+
315
+ #: includes/i18n.php:213
316
+ msgctxt "e.g. auto renews in 2 months"
317
+ msgid "Auto renews in %s"
318
+ msgstr ""
319
+
320
+ #: includes/i18n.php:215
321
+ msgid "No expiration"
322
+ msgstr "ללא תפוגה"
323
+
324
+ #: includes/i18n.php:217
325
+ msgid "Expired"
326
+ msgstr "פג תוקף"
327
+
328
+ #: includes/i18n.php:219
329
+ msgid "Cancelled"
330
+ msgstr "בוטל"
331
+
332
+ #: includes/i18n.php:221
333
+ msgctxt "e.g. In 2 hours"
334
+ msgid "In %s"
335
+ msgstr "בעוד %s"
336
+
337
+ #: includes/i18n.php:223
338
+ msgctxt "e.g. 2 min ago"
339
+ msgid "%s ago"
340
+ msgstr ""
341
+
342
+ #: includes/i18n.php:225
343
+ msgctxt "as plugin version"
344
+ msgid "Version"
345
+ msgstr "גרסה"
346
+
347
+ #: includes/i18n.php:227
348
+ msgid "Name"
349
+ msgstr "שם"
350
+
351
+ #: includes/i18n.php:229
352
+ msgid "Email"
353
+ msgstr "דוא\"ל"
354
+
355
+ #: includes/i18n.php:231
356
+ msgid "Email address"
357
+ msgstr "כתובת דוא\"ל"
358
+
359
+ #: includes/i18n.php:233
360
+ msgid "Verified"
361
+ msgstr "מאומת"
362
+
363
+ #: includes/i18n.php:235
364
+ msgid "Plugin"
365
+ msgstr "תוסף"
366
+
367
+ #: includes/i18n.php:237
368
+ msgid "Plugins"
369
+ msgstr "תוספים"
370
+
371
+ #: includes/i18n.php:239
372
+ msgid "Themes"
373
+ msgstr "תבניות"
374
+
375
+ #: includes/i18n.php:241
376
+ msgctxt "as file/folder path"
377
+ msgid "Path"
378
+ msgstr ""
379
+
380
+ #: includes/i18n.php:243
381
+ msgid "Title"
382
+ msgstr "כותרת"
383
+
384
+ #: includes/i18n.php:245
385
+ msgid "Free version"
386
+ msgstr "גירסה חינאמית"
387
+
388
+ #: includes/i18n.php:247
389
+ msgid "Premium version"
390
+ msgstr "גירסת פרימיום"
391
+
392
+ #: includes/i18n.php:249
393
+ msgctxt "as WP plugin slug"
394
+ msgid "Slug"
395
+ msgstr ""
396
+
397
+ #: includes/i18n.php:251
398
+ msgid "ID"
399
+ msgstr "מזהה"
400
+
401
+ #: includes/i18n.php:253
402
+ msgid "Users"
403
+ msgstr "משתמשים"
404
+
405
+ #: includes/i18n.php:255
406
+ msgid "Plugin Installs"
407
+ msgstr "התקנות תוסף"
408
+
409
+ #: includes/i18n.php:257
410
+ msgctxt "like websites"
411
+ msgid "Sites"
412
+ msgstr "אתרים"
413
+
414
+ #: includes/i18n.php:259
415
+ msgid "User ID"
416
+ msgstr "מזהה משתמש"
417
+
418
+ #: includes/i18n.php:261
419
+ msgid "Site ID"
420
+ msgstr "מזהה אתר"
421
+
422
+ #: includes/i18n.php:263
423
+ msgid "Public Key"
424
+ msgstr "מפתח פומבי"
425
+
426
+ #: includes/i18n.php:265
427
+ msgid "Secret Key"
428
+ msgstr "מפתח סודי"
429
+
430
+ #: includes/i18n.php:267
431
+ msgctxt "as secret encryption key missing"
432
+ msgid "No Secret"
433
+ msgstr "אין מפתח סודי"
434
+
435
+ #: includes/i18n.php:269
436
+ msgid "No ID"
437
+ msgstr "אין מזהה"
438
+
439
+ #: includes/i18n.php:271
440
+ msgctxt "as synchronize license"
441
+ msgid "Sync License"
442
+ msgstr "סינכרן רישיון"
443
+
444
+ #: includes/i18n.php:273
445
+ msgctxt "as synchronize"
446
+ msgid "Sync"
447
+ msgstr "סינכרון"
448
+
449
+ #: includes/i18n.php:275
450
+ msgid "Activate License"
451
+ msgstr "הפעלת רישיון"
452
+
453
+ #: includes/i18n.php:277
454
+ msgid "Activate Free Version"
455
+ msgstr "הפעלת גירסה חינאמית"
456
+
457
+ #: includes/i18n.php:279
458
+ msgid ""
459
+ "Please enter the license key that you received in the email right after the "
460
+ "purchase:"
461
+ msgstr ""
462
+
463
+ #: includes/i18n.php:283
464
+ msgid "Activating license..."
465
+ msgstr "מפעיל רישיון..."
466
+
467
+ #: includes/i18n.php:285
468
+ msgid "Change License"
469
+ msgstr "שינוי רישיון"
470
+
471
+ #: includes/i18n.php:287
472
+ msgid "Update License"
473
+ msgstr "עדכון רישיון"
474
+
475
+ #: includes/i18n.php:289
476
+ msgid "Deactivate License"
477
+ msgstr "שיחרור רישיון"
478
+
479
+ #: includes/i18n.php:291
480
+ msgid "Activate"
481
+ msgstr "הפעלה"
482
+
483
+ #: includes/i18n.php:293
484
+ msgid "Deactivate"
485
+ msgstr "כיבוי"
486
+
487
+ #: includes/i18n.php:295
488
+ msgid "Skip & Deactivate"
489
+ msgstr "דלג והמשך כיבוי"
490
+
491
+ #: includes/i18n.php:297
492
+ msgid "No - just deactivate"
493
+ msgstr "לא - פשוט כבה"
494
+
495
+ #: includes/i18n.php:299
496
+ msgid "Yes - do your thing"
497
+ msgstr "כן - בצעו את מה שצריך"
498
+
499
+ #: includes/i18n.php:301
500
+ msgctxt "active mode"
501
+ msgid "Active"
502
+ msgstr "מופעל"
503
+
504
+ #: includes/i18n.php:303
505
+ msgctxt "is active mode?"
506
+ msgid "Is Active"
507
+ msgstr "האם פעיל"
508
+
509
+ #: includes/i18n.php:305
510
+ msgid "Install Now"
511
+ msgstr "התקן עכשיו"
512
+
513
+ #: includes/i18n.php:307
514
+ msgid "Install Update Now"
515
+ msgstr "התקן עדכון במיידי"
516
+
517
+ #: includes/i18n.php:309
518
+ msgid "More information about %s"
519
+ msgstr ""
520
+
521
+ #: includes/i18n.php:311
522
+ msgid "Localhost"
523
+ msgstr "שרת לוקאלי"
524
+
525
+ #: includes/i18n.php:313
526
+ msgctxt "as activate Professional plan"
527
+ msgid "Activate %s Plan"
528
+ msgstr ""
529
+
530
+ #: includes/i18n.php:315
531
+ msgctxt "as 5 licenses left"
532
+ msgid "%s left"
533
+ msgstr "נשארו %s"
534
+
535
+ #: includes/i18n.php:317
536
+ msgid "Last license"
537
+ msgstr "רישיון אחרון"
538
+
539
+ #: includes/i18n.php:319
540
+ msgid "What is your %s?"
541
+ msgstr ""
542
+
543
+ #: includes/i18n.php:321
544
+ msgid "Activate this add-on"
545
+ msgstr "הפעל את התוסף"
546
+
547
+ #: includes/i18n.php:323
548
+ msgid ""
549
+ "Deactivating your license will block all premium features, but will enable "
550
+ "you to activate the license on another site. Are you sure you want to "
551
+ "proceed?"
552
+ msgstr ""
553
+
554
+ #: includes/i18n.php:327
555
+ msgid ""
556
+ "Deleting the account will automatically deactivate your %s plan license so "
557
+ "you can use it on other sites. If you want to terminate the recurring "
558
+ "payments as well, click the \"Cancel\" button, and first \"Downgrade\" your "
559
+ "account. Are you sure you would like to continue with the deletion?"
560
+ msgstr ""
561
+
562
+ #: includes/i18n.php:331
563
+ msgid ""
564
+ "Deletion is not temporary. Only delete if you no longer want to use this "
565
+ "plugin anymore. Are you sure you would like to continue with the deletion?"
566
+ msgstr ""
567
+
568
+ #: includes/i18n.php:335
569
+ msgid ""
570
+ "Downgrading your plan will immediately stop all future recurring payments "
571
+ "and your %s plan license will expire in %s."
572
+ msgstr ""
573
+
574
+ #: includes/i18n.php:339
575
+ msgid ""
576
+ "Cancelling the trial will immediately block access to all premium features. "
577
+ "Are you sure?"
578
+ msgstr ""
579
+
580
+ #: includes/i18n.php:343
581
+ msgid ""
582
+ "You can still enjoy all %s features but you will not have access to plugin "
583
+ "updates and support."
584
+ msgstr ""
585
+
586
+ #: includes/i18n.php:347
587
+ msgid ""
588
+ "Once your license expire you can still use the Free version but you will NOT"
589
+ " have access to the %s features."
590
+ msgstr ""
591
+
592
+ #: includes/i18n.php:351
593
+ msgid "Are you sure you want to proceed?"
594
+ msgstr "האם את/ה בטוח רוצה להמשיך?"
595
+
596
+ #: includes/i18n.php:357
597
+ msgid "Add Ons for %s"
598
+ msgstr ""
599
+
600
+ #: includes/i18n.php:359
601
+ msgid ""
602
+ "We could'nt load the add-ons list. It's probably an issue on our side, "
603
+ "please try to come back in few minutes."
604
+ msgstr ""
605
+
606
+ #: includes/i18n.php:365
607
+ msgid "Anonymous feedback"
608
+ msgstr "פידבק אנונימי"
609
+
610
+ #: includes/i18n.php:367
611
+ msgid "Quick feedback"
612
+ msgstr "פידבק זריז"
613
+
614
+ #: includes/i18n.php:369
615
+ msgid "If you have a moment, please let us know why you are deactivating"
616
+ msgstr ""
617
+
618
+ #: includes/i18n.php:373
619
+ msgid "Yes - Deactivate"
620
+ msgstr "כן - "
621
+
622
+ #: includes/i18n.php:375
623
+ msgid "Submit & Deactivate"
624
+ msgstr "שלח וכבה"
625
+
626
+ #: includes/i18n.php:377
627
+ msgid "Cancel"
628
+ msgstr "בטל"
629
+
630
+ #: includes/i18n.php:379
631
+ msgid "I no longer need the plugin"
632
+ msgstr "אין לי צורך יותר בתוסף"
633
+
634
+ #: includes/i18n.php:381
635
+ msgid "I found a better plugin"
636
+ msgstr "מצאתי תוסף טוב יותר"
637
+
638
+ #: includes/i18n.php:383
639
+ msgid "I only needed the plugin for a short period"
640
+ msgstr "השתמשתי בתוסף לתקופה קצרה"
641
+
642
+ #: includes/i18n.php:385
643
+ msgid "The plugin broke my site"
644
+ msgstr "התוסף הרס לי את האתר"
645
+
646
+ #: includes/i18n.php:387
647
+ msgid "The plugin suddenly stopped working"
648
+ msgstr "התוסף לפתע הפסיק לעבוד"
649
+
650
+ #: includes/i18n.php:389
651
+ msgid "I can't pay for it anymore"
652
+ msgstr "אני לא יכול/ה להמשיך לשלם על זה"
653
+
654
+ #: includes/i18n.php:391
655
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
656
+ msgstr "כיבוי זמני לשם דיבאג."
657
+
658
+ #: includes/i18n.php:395
659
+ msgctxt ""
660
+ "the text of the \"other\" reason for deactivating the plugin that is shown "
661
+ "in the modal box."
662
+ msgid "Other"
663
+ msgstr "אחר"
664
+
665
+ #: includes/i18n.php:399
666
+ msgid "Kindly tell us the reason so we can improve."
667
+ msgstr "אנא שתף את הסיבה כדי שנוכל להשתפר."
668
+
669
+ #: includes/i18n.php:401
670
+ msgid "What's the plugin's name?"
671
+ msgstr "מהו שם התוסף?"
672
+
673
+ #: includes/i18n.php:403
674
+ msgid "What price would you feel comfortable paying?"
675
+ msgstr "מה המחיר שכן תרגיש\\י בנוח לשלם?"
676
+
677
+ #: includes/i18n.php:405
678
+ msgid "I couldn't understand how to make it work"
679
+ msgstr "לא הצלחתי להבין איך לגרום לזה לעבוד"
680
+
681
+ #: includes/i18n.php:407
682
+ msgid ""
683
+ "The plugin is great, but I need specific feature that you don't support"
684
+ msgstr "התוסף מעולה, אבל אני צריכ\\ה פיצ'ר ספציפי שלא נתמך"
685
+
686
+ #: includes/i18n.php:411
687
+ msgid "The plugin is not working"
688
+ msgstr "התוסף לא עובד"
689
+
690
+ #: includes/i18n.php:413
691
+ msgid "It's not what I was looking for"
692
+ msgstr "חיפשתי משהו אחר"
693
+
694
+ #: includes/i18n.php:415
695
+ msgid "The plugin didn't work as expected"
696
+ msgstr "התוסף לא עבד כמצופה"
697
+
698
+ #: includes/i18n.php:417
699
+ msgid "What feature?"
700
+ msgstr "איזה פיטצ'ר?"
701
+
702
+ #: includes/i18n.php:419
703
+ msgid "Kindly share what didn't work so we can fix it for future users..."
704
+ msgstr "אנא שתפ\\י מה לא עבד כדי שנוכל לתקן זאת עבור משתמשים עתידיים..."
705
+
706
+ #: includes/i18n.php:423
707
+ msgid "What you've been looking for?"
708
+ msgstr "מה חיפשת?"
709
+
710
+ #: includes/i18n.php:425
711
+ msgid "What did you expect?"
712
+ msgstr "למה ציפית?"
713
+
714
+ #: includes/i18n.php:427
715
+ msgid "The plugin didn't work"
716
+ msgstr "התוסף לא עבד"
717
+
718
+ #: includes/i18n.php:429
719
+ msgid "I don't like to share my information with you"
720
+ msgstr "אני לא אוהב את הרעיון של שיתוף מידע איתכם"
721
+
722
+ #: includes/i18n.php:431
723
+ msgid ""
724
+ "You might have missed it, but you don't have to share any data and can just "
725
+ "%s the opt-in."
726
+ msgstr "אולי פספסת את זה אבל אינך חייב\\ת לשתף כל מידע איתנו, ביכולתך %s על שיתוף המידע."
727
+
728
+ #: includes/i18n.php:441
729
+ msgctxt "greeting"
730
+ msgid "Hey %s,"
731
+ msgstr "היי %s,"
732
+
733
+ #: includes/i18n.php:443
734
+ msgctxt "a greeting. E.g. Thanks John!"
735
+ msgid "Thanks %s!"
736
+ msgstr "תודה %s!"
737
+
738
+ #: includes/i18n.php:445
739
+ msgid ""
740
+ "Never miss an important update - opt-in to our security and feature updates "
741
+ "notifications, and non-sensitive diagnostic tracking with %4$s."
742
+ msgstr ""
743
+
744
+ #: includes/i18n.php:449
745
+ msgid ""
746
+ "Please help us improve %1$s! If you opt-in, some data about your usage of "
747
+ "%1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still "
748
+ "work just fine."
749
+ msgstr ""
750
+
751
+ #: includes/i18n.php:453
752
+ msgid ""
753
+ "You should receive an activation email for %s to your mailbox at %s. Please "
754
+ "make sure you click the activation button in that email to %s."
755
+ msgstr ""
756
+
757
+ #: includes/i18n.php:455
758
+ msgid "complete the install"
759
+ msgstr ""
760
+
761
+ #: includes/i18n.php:457
762
+ msgid "start the trial"
763
+ msgstr ""
764
+
765
+ #: includes/i18n.php:459
766
+ msgid ""
767
+ "Thanks for purchasing %s! To get started, please enter your license key:"
768
+ msgstr ""
769
+
770
+ #: includes/i18n.php:463
771
+ msgid ""
772
+ "The plugin will be periodically sending data to %s to check for plugin "
773
+ "updates and verify the validity of your license."
774
+ msgstr ""
775
+
776
+ #: includes/i18n.php:467
777
+ msgid "What permissions are being granted?"
778
+ msgstr "מהן ההרשאות המוענקות?"
779
+
780
+ #: includes/i18n.php:469
781
+ msgid "Your Profile Overview"
782
+ msgstr "פרטים כלליים על הפרופיל"
783
+
784
+ #: includes/i18n.php:471
785
+ msgid "Name and email address"
786
+ msgstr "שם וכתובת דו\"אל"
787
+
788
+ #: includes/i18n.php:473
789
+ msgid "Your Site Overview"
790
+ msgstr "פרטים כלליים על האתר"
791
+
792
+ #: includes/i18n.php:475
793
+ msgid "Site URL, WP version, PHP info, plugins & themes"
794
+ msgstr "כתובת אתר, גרסת וורדפרס, פרטי PHP, תוספים ותבניות"
795
+
796
+ #: includes/i18n.php:479
797
+ msgid "Current Plugin Events"
798
+ msgstr "שינויי מצב בתוסף הנוכחי"
799
+
800
+ #: includes/i18n.php:481
801
+ msgid "Activation, deactivation and uninstall"
802
+ msgstr "הפעלה, כיבוי והסרה"
803
+
804
+ #: includes/i18n.php:483
805
+ msgid "Plugins & Themes"
806
+ msgstr "תוספים ותבניות"
807
+
808
+ #: includes/i18n.php:485
809
+ msgid "Titles, versions and state."
810
+ msgstr "שמות, גרסאות וסטאטוס."
811
+
812
+ #: includes/i18n.php:487
813
+ msgid "Admin Notices"
814
+ msgstr ""
815
+
816
+ #: includes/i18n.php:489
817
+ msgid "Newsletter"
818
+ msgstr "ניוסלטר"
819
+
820
+ #: includes/i18n.php:491
821
+ msgid "Updates, announcements, marketing, no spam"
822
+ msgstr ""
823
+
824
+ #: includes/i18n.php:493
825
+ msgid "Privacy Policy"
826
+ msgstr "מדיניות פרטיות"
827
+
828
+ #: includes/i18n.php:495
829
+ msgid "Terms of Service"
830
+ msgstr "תנאי השירות"
831
+
832
+ #: includes/i18n.php:497
833
+ msgctxt "as activating plugin"
834
+ msgid "Activating"
835
+ msgstr "מפעיל"
836
+
837
+ #: includes/i18n.php:499
838
+ msgctxt "as in the process of sending an email"
839
+ msgid "Sending email"
840
+ msgstr "שולח דוא\"ל"
841
+
842
+ #: includes/i18n.php:503
843
+ msgctxt "button label"
844
+ msgid "Allow & Continue"
845
+ msgstr "אפשר\\י והמשכ\\י"
846
+
847
+ #: includes/i18n.php:505
848
+ msgctxt "button label"
849
+ msgid "Agree & Activate License"
850
+ msgstr "הסכמה והפעלת רישיון"
851
+
852
+ #: includes/i18n.php:507
853
+ msgctxt "verb"
854
+ msgid "Skip"
855
+ msgstr "דלג"
856
+
857
+ #: includes/i18n.php:509
858
+ msgid "Click here to use the plugin anonymously"
859
+ msgstr ""
860
+
861
+ #: includes/i18n.php:511
862
+ msgid "Re-send activation email"
863
+ msgstr "שליחה חוזרת של מייל האקטיבציה"
864
+
865
+ #: includes/i18n.php:513
866
+ msgid "License key"
867
+ msgstr "מפתח רישיון"
868
+
869
+ #: includes/i18n.php:515
870
+ msgid "Send License Key"
871
+ msgstr "שליחת מפתח רישיון"
872
+
873
+ #: includes/i18n.php:517
874
+ msgid "Sending license key"
875
+ msgstr "שולח מפתח רישיון"
876
+
877
+ #: includes/i18n.php:519
878
+ msgid "Have a license key?"
879
+ msgstr "האם ברשותך רישיון?"
880
+
881
+ #: includes/i18n.php:521
882
+ msgid "Don't have a license key?"
883
+ msgstr "האם אין ברשותך מפתח רישיון?"
884
+
885
+ #: includes/i18n.php:523
886
+ msgid "Can't find your license key?"
887
+ msgstr "האם אינך מוצא את מפתח הרישיון?"
888
+
889
+ #: includes/i18n.php:525
890
+ msgid ""
891
+ "We couldn't find your email address in the system, are you sure it's the "
892
+ "right address?"
893
+ msgstr ""
894
+
895
+ #: includes/i18n.php:529
896
+ msgid ""
897
+ "We can't see any active licenses associated with that email address, are you"
898
+ " sure it's the right address?"
899
+ msgstr ""
900
+
901
+ #: includes/i18n.php:533
902
+ msgid "Opt In"
903
+ msgstr ""
904
+
905
+ #: includes/i18n.php:535
906
+ msgid "Opt Out"
907
+ msgstr ""
908
+
909
+ #: includes/i18n.php:537
910
+ msgid "On second thought - I want to continue helping"
911
+ msgstr ""
912
+
913
+ #: includes/i18n.php:541
914
+ msgid "Opting out..."
915
+ msgstr ""
916
+
917
+ #: includes/i18n.php:543
918
+ msgid "Opting in..."
919
+ msgstr ""
920
+
921
+ #: includes/i18n.php:545
922
+ msgid ""
923
+ "We appreciate your help in making the %s better by letting us track some "
924
+ "usage data."
925
+ msgstr ""
926
+
927
+ #: includes/i18n.php:549
928
+ msgid ""
929
+ "Usage tracking is done in the name of making %s better. Making a better user"
930
+ " experience, prioritizing new features, and more good things. We'd really "
931
+ "appreciate if you'll reconsider letting us continue with the tracking."
932
+ msgstr ""
933
+
934
+ #: includes/i18n.php:553
935
+ msgid ""
936
+ "By clicking \"Opt Out\", we will no longer be sending any data from %s to "
937
+ "%s."
938
+ msgstr ""
939
+
940
+ #: includes/i18n.php:563
941
+ msgid "Screenshots"
942
+ msgstr "צילומי מסך"
943
+
944
+ #: includes/i18n.php:565
945
+ msgid "Click to view full-size screenshot %d"
946
+ msgstr ""
947
+
948
+ #: includes/i18n.php:573
949
+ msgid "Freemius Debug"
950
+ msgstr ""
951
+
952
+ #: includes/i18n.php:575
953
+ msgctxt "as turned on"
954
+ msgid "On"
955
+ msgstr "דלוק"
956
+
957
+ #: includes/i18n.php:577
958
+ msgctxt "as turned off"
959
+ msgid "Off"
960
+ msgstr "כבוי"
961
+
962
+ #: includes/i18n.php:579
963
+ msgctxt "as code debugging"
964
+ msgid "Debugging"
965
+ msgstr "דיבוג"
966
+
967
+ #: includes/i18n.php:581
968
+ msgid "Freemius State"
969
+ msgstr ""
970
+
971
+ #: includes/i18n.php:583
972
+ msgctxt "as connection was successful"
973
+ msgid "Connected"
974
+ msgstr "מחובר"
975
+
976
+ #: includes/i18n.php:585
977
+ msgctxt "as connection blocked"
978
+ msgid "Blocked"
979
+ msgstr "חסום"
980
+
981
+ #: includes/i18n.php:587
982
+ msgctxt "as application program interface"
983
+ msgid "API"
984
+ msgstr "API"
985
+
986
+ #: includes/i18n.php:589
987
+ msgctxt "as software development kit versions"
988
+ msgid "SDK"
989
+ msgstr "SDK"
990
+
991
+ #: includes/i18n.php:591
992
+ msgctxt "as software development kit versions"
993
+ msgid "SDK Versions"
994
+ msgstr "גרסאות SDK"
995
+
996
+ #: includes/i18n.php:595
997
+ msgctxt "as plugin folder path"
998
+ msgid "Plugin Path"
999
+ msgstr ""
1000
+
1001
+ #: includes/i18n.php:597
1002
+ msgctxt "as sdk path"
1003
+ msgid "SDK Path"
1004
+ msgstr "מיקום SDK"
1005
+
1006
+ #: includes/i18n.php:599
1007
+ msgid "Add Ons of Plugin %s"
1008
+ msgstr ""
1009
+
1010
+ #: includes/i18n.php:601
1011
+ msgid "Are you sure you want to delete all Freemius data?"
1012
+ msgstr ""
1013
+
1014
+ #: includes/i18n.php:605
1015
+ msgid "Actions"
1016
+ msgstr "פעולות"
1017
+
1018
+ #: includes/i18n.php:607
1019
+ msgid "Delete All Accounts"
1020
+ msgstr "מחיקת כל החשבונות"
1021
+
1022
+ #: includes/i18n.php:609
1023
+ msgid "Start Fresh"
1024
+ msgstr "התחל מחדש"
1025
+
1026
+ #: includes/i18n.php:611
1027
+ msgid "Clear API Cache"
1028
+ msgstr "ניקוי מטמון ה-API"
1029
+
1030
+ #: includes/i18n.php:613
1031
+ msgid "Sync Data From Server"
1032
+ msgstr "סנכרון מידע מהשרת"
1033
+
1034
+ #: includes/i18n.php:615
1035
+ msgid "Scheduled Crons"
1036
+ msgstr ""
1037
+
1038
+ #: includes/i18n.php:617
1039
+ msgid "Plugins & Themes Sync"
1040
+ msgstr ""
1041
+
1042
+ #: includes/i18n.php:625
1043
+ msgctxt "as congratulations"
1044
+ msgid "Congrats"
1045
+ msgstr "מזל טוב"
1046
+
1047
+ #: includes/i18n.php:627
1048
+ msgctxt "exclamation"
1049
+ msgid "Oops"
1050
+ msgstr "אופס"
1051
+
1052
+ #: includes/i18n.php:629
1053
+ msgctxt "interjection expressing joy or exuberance"
1054
+ msgid "Yee-haw"
1055
+ msgstr ""
1056
+
1057
+ #: includes/i18n.php:633
1058
+ msgctxt ""
1059
+ "(especially in electronic communication) used to express elation, "
1060
+ "enthusiasm, or triumph."
1061
+ msgid "W00t"
1062
+ msgstr ""
1063
+
1064
+ #: includes/i18n.php:637
1065
+ msgctxt "a positive response"
1066
+ msgid "Right on"
1067
+ msgstr ""
1068
+
1069
+ #: includes/i18n.php:639
1070
+ msgctxt ""
1071
+ "something somebody says when they are thinking about what you have just "
1072
+ "said. "
1073
+ msgid "Hmm"
1074
+ msgstr "הממ"
1075
+
1076
+ #: includes/i18n.php:643
1077
+ msgid "O.K"
1078
+ msgstr "אוקיי"
1079
+
1080
+ #: includes/i18n.php:645
1081
+ msgctxt "exclamation"
1082
+ msgid "Hey"
1083
+ msgstr "היי"
1084
+
1085
+ #: includes/i18n.php:647
1086
+ msgctxt "advance notice of something that will need attention."
1087
+ msgid "Heads up"
1088
+ msgstr "לתשמות לבך"
1089
+
1090
+ #: includes/i18n.php:657
1091
+ msgid "Seems like you got the latest release."
1092
+ msgstr ""
1093
+
1094
+ #: includes/i18n.php:659
1095
+ msgid "You are all good!"
1096
+ msgstr "את\\ה מסודר!"
1097
+
1098
+ #: includes/i18n.php:661
1099
+ msgid ""
1100
+ "Sorry, we could not complete the email update. Another user with the same "
1101
+ "email is already registered."
1102
+ msgstr ""
1103
+
1104
+ #: includes/i18n.php:665
1105
+ msgid ""
1106
+ "If you would like to give up the ownership of the plugin's account to %s "
1107
+ "click the Change Ownership button."
1108
+ msgstr ""
1109
+
1110
+ #: includes/i18n.php:669
1111
+ msgid ""
1112
+ "Your email was successfully updated. You should receive an email with "
1113
+ "confirmation instructions in few moments."
1114
+ msgstr ""
1115
+
1116
+ #: includes/i18n.php:673
1117
+ msgid "Your name was successfully updated."
1118
+ msgstr "שמך עודכן בהצלחה."
1119
+
1120
+ #: includes/i18n.php:675
1121
+ msgid "You have successfully updated your %s."
1122
+ msgstr ""
1123
+
1124
+ #: includes/i18n.php:677
1125
+ msgid "Please provide your full name."
1126
+ msgstr "נא למלא את שמך המלא."
1127
+
1128
+ #: includes/i18n.php:679
1129
+ msgid ""
1130
+ "Verification mail was just sent to %s. If you can't find it after 5 min, "
1131
+ "please check your spam box."
1132
+ msgstr ""
1133
+
1134
+ #: includes/i18n.php:683
1135
+ msgid ""
1136
+ "Just letting you know that the add-ons information of %s is being pulled "
1137
+ "from an external server."
1138
+ msgstr ""
1139
+
1140
+ #: includes/i18n.php:687
1141
+ msgid "No credit card required"
1142
+ msgstr "לא נדרש כרטיס אשראי"
1143
+
1144
+ #: includes/i18n.php:689
1145
+ msgid "Premium plugin version was successfully activated."
1146
+ msgstr ""
1147
+
1148
+ #: includes/i18n.php:693
1149
+ msgid "The upgrade of %s was successfully completed."
1150
+ msgstr ""
1151
+
1152
+ #: includes/i18n.php:695
1153
+ msgid "Your account was successfully activated with the %s plan."
1154
+ msgstr "חשבונך הופעל בהצלחה עם חבילת ה-%s."
1155
+
1156
+ #: includes/i18n.php:699
1157
+ msgid "Download the latest %s version now"
1158
+ msgstr "הורדת גרסת ה-%s העדכנית - עכשיו"
1159
+
1160
+ #: includes/i18n.php:701
1161
+ msgid "Please follow these steps to complete the upgrade"
1162
+ msgstr "נא לבצע את הצעדים הבאים להשלמת השידרוג"
1163
+
1164
+ #: includes/i18n.php:705
1165
+ msgid "Download the latest %s version"
1166
+ msgstr "הורד\\י את גרסת ה-%s העדכנית"
1167
+
1168
+ #: includes/i18n.php:707
1169
+ msgid "Deactivate the free version"
1170
+ msgstr "כבה\\י את הגרסה החינאמית"
1171
+
1172
+ #: includes/i18n.php:709
1173
+ msgid "Upload and activate the downloaded version"
1174
+ msgstr "העלה\\י והפעיל\\י את הגרסה שהורדת"
1175
+
1176
+ #: includes/i18n.php:711
1177
+ msgid "How to upload and activate?"
1178
+ msgstr "איך להעלות ולהפעיל?"
1179
+
1180
+ #: includes/i18n.php:713
1181
+ msgctxt "%s - product name, e.g. Facebook add-on was successfully..."
1182
+ msgid "%s Add-on was successfully purchased."
1183
+ msgstr ""
1184
+
1185
+ #: includes/i18n.php:717
1186
+ msgid "Your %s Add-on plan was successfully upgraded."
1187
+ msgstr ""
1188
+
1189
+ #: includes/i18n.php:721
1190
+ msgid "Your email has been successfully verified - you are AWESOME!"
1191
+ msgstr ""
1192
+
1193
+ #: includes/i18n.php:725
1194
+ msgid "Your plan was successfully upgraded."
1195
+ msgstr "החבילה הופעלה בהצלחה."
1196
+
1197
+ #: includes/i18n.php:727
1198
+ msgid "Your plan was successfully changed to %s."
1199
+ msgstr ""
1200
+
1201
+ #: includes/i18n.php:729
1202
+ msgid ""
1203
+ "Your license has expired. You can still continue using the free plugin "
1204
+ "forever."
1205
+ msgstr "פג תוקפו של הרישיון. עדיין ניתן להמשיך להשתמש בגרסה החינאמית של התוסף ללא מגבלת זמן."
1206
+
1207
+ #: includes/i18n.php:733
1208
+ msgid ""
1209
+ "Your license has been cancelled. If you think it's a mistake, please contact"
1210
+ " support."
1211
+ msgstr "רשיונך בוטל. אם לדעתך זו טעות, נא ליצור קשר עם התמיכה."
1212
+
1213
+ #: includes/i18n.php:737
1214
+ msgid "Your trial has been successfully started."
1215
+ msgstr "הניסיון שלך הופעל בהצלחה."
1216
+
1217
+ #: includes/i18n.php:739
1218
+ msgid "Your license was successfully activated."
1219
+ msgstr "הרישיון הופעל בהצלחה."
1220
+
1221
+ #: includes/i18n.php:741
1222
+ msgid "It looks like your site currently doesn't have an active license."
1223
+ msgstr "נראה לאתר עדיין אין רישיון פעיל."
1224
+
1225
+ #: includes/i18n.php:745
1226
+ msgid ""
1227
+ "Your license was successfully deactivated, you are back to the %s plan."
1228
+ msgstr "רישיונך נותק בהצלחה, חזרת לחבילת ה-%s"
1229
+
1230
+ #: includes/i18n.php:749
1231
+ msgid "It looks like the license deactivation failed."
1232
+ msgstr "נראה שניתוק הרישיון נכשל."
1233
+
1234
+ #: includes/i18n.php:753
1235
+ msgid "It looks like the license could not be activated."
1236
+ msgstr "נראה שלא ניתן להפעיל את הרישיון."
1237
+
1238
+ #: includes/i18n.php:757
1239
+ msgid "Error received from the server:"
1240
+ msgstr "הוחזרה שגיאה מהשרת:"
1241
+
1242
+ #: includes/i18n.php:759
1243
+ msgid ""
1244
+ "Your trial has expired. You can still continue using all our free features."
1245
+ msgstr "תקופת הניסיון נגמרה. ביכולתך להמשיך להשתמש בכל הפיטצ'רים החינאמיים."
1246
+
1247
+ #: includes/i18n.php:763
1248
+ msgid ""
1249
+ "Your plan was successfully downgraded. Your %s plan license will expire in "
1250
+ "%s."
1251
+ msgstr ""
1252
+
1253
+ #: includes/i18n.php:767
1254
+ msgid ""
1255
+ "Seems like we are having some temporary issue with your plan downgrade. "
1256
+ "Please try again in few minutes."
1257
+ msgstr ""
1258
+
1259
+ #: includes/i18n.php:771
1260
+ msgid ""
1261
+ "It looks like you are not in trial mode anymore so there's nothing to cancel"
1262
+ " :)"
1263
+ msgstr ""
1264
+
1265
+ #: includes/i18n.php:775
1266
+ msgid "Your %s free trial was successfully cancelled."
1267
+ msgstr ""
1268
+
1269
+ #: includes/i18n.php:779
1270
+ msgctxt "%s - numeric version number"
1271
+ msgid "Version %s was released."
1272
+ msgstr "גרסה %s הושקה."
1273
+
1274
+ #: includes/i18n.php:783
1275
+ msgid "Please download %s."
1276
+ msgstr ""
1277
+
1278
+ #: includes/i18n.php:785
1279
+ msgctxt "%s - plan name, as the latest professional version here"
1280
+ msgid "the latest %s version here"
1281
+ msgstr "גרסת ה-%s האחרונה כאן"
1282
+
1283
+ #: includes/i18n.php:789
1284
+ msgid ""
1285
+ "How do you like %s so far? Test all our %s premium features with a %d-day "
1286
+ "free trial."
1287
+ msgstr ""
1288
+
1289
+ #: includes/i18n.php:793
1290
+ msgctxt "call to action"
1291
+ msgid "Start free trial"
1292
+ msgstr "התחלת ניסיון חינם"
1293
+
1294
+ #: includes/i18n.php:795
1295
+ msgid "Starting trial"
1296
+ msgstr ""
1297
+
1298
+ #: includes/i18n.php:797
1299
+ msgid "Please wait"
1300
+ msgstr ""
1301
+
1302
+ #: includes/i18n.php:799
1303
+ msgid ""
1304
+ "Seems like we are having some temporary issue with your trial cancellation. "
1305
+ "Please try again in few minutes."
1306
+ msgstr ""
1307
+
1308
+ #: includes/i18n.php:803
1309
+ msgid "You already utilized a trial before."
1310
+ msgstr "הניסיון כבר נוצל בעבר."
1311
+
1312
+ #: includes/i18n.php:805
1313
+ msgid "You are already running the plugin in a trial mode."
1314
+ msgstr "התוסף כבר עכשיו בתקופת ניסיון."
1315
+
1316
+ #: includes/i18n.php:809
1317
+ msgid "Plan %s do not exist, therefore, can't start a trial."
1318
+ msgstr ""
1319
+
1320
+ #: includes/i18n.php:813
1321
+ msgid "Plan %s does not support a trial period."
1322
+ msgstr ""
1323
+
1324
+ #: includes/i18n.php:815
1325
+ msgid "None of the plugin's plans supports a trial period."
1326
+ msgstr "אף אחת מחבילות התוסף מאפשרת תקופת ניסיון."
1327
+
1328
+ #: includes/i18n.php:819
1329
+ msgid ""
1330
+ "Unexpected API error. Please contact the plugin's author with the following "
1331
+ "error."
1332
+ msgstr "שגיאת API בלתי צפוייה. נא לפנות למפתח התוסף עם השגיאה הבאה."
1333
+
1334
+ #: includes/i18n.php:823
1335
+ msgid "No commitment for %s days - cancel anytime!"
1336
+ msgstr ""
1337
+
1338
+ #: includes/i18n.php:825
1339
+ msgid ""
1340
+ "Your license has expired. You can still continue using all the %s features, "
1341
+ "but you'll need to renew your license to continue getting updates and "
1342
+ "support."
1343
+ msgstr ""
1344
+
1345
+ #: includes/i18n.php:829
1346
+ msgid "Couldn't activate %s."
1347
+ msgstr ""
1348
+
1349
+ #: includes/i18n.php:831
1350
+ msgid "Please contact us with the following message:"
1351
+ msgstr "אנא צור איתנו קשר יחד עם ההודעה הבאה:"
1352
+
1353
+ #: includes/i18n.php:833
1354
+ msgid ""
1355
+ "It looks like you are still on the %s plan. If you did upgrade or change "
1356
+ "your plan, it's probably an issue on our side - sorry."
1357
+ msgstr ""
1358
+
1359
+ #: includes/i18n.php:837
1360
+ msgid "Please contact us here"
1361
+ msgstr "אנא צור איתנו קשר כאן"
1362
+
1363
+ #: includes/i18n.php:839
1364
+ msgid ""
1365
+ "I have upgraded my account but when I try to Sync the License, the plan "
1366
+ "remains %s."
1367
+ msgstr "שידרגתי את החשבון שלי אבל כשאני מנסה לבצע סנכרון לרישיון החבילה נשארת %s"
1368
+
1369
+ #: includes/i18n.php:847
1370
+ msgid "From unknown reason, the API connectivity test failed."
1371
+ msgstr "יש בעיית תקשורת ל-API מסיבה בלתי ברורה."
1372
+
1373
+ #: includes/i18n.php:851
1374
+ msgid ""
1375
+ "It's probably a temporary issue on our end. Just to be sure, with your "
1376
+ "permission, would it be o.k to run another connectivity test?"
1377
+ msgstr "ככל הנראה זאת בעיה זמנית בצד שלנו. ברשותך, ורק כדי להיות בטוחים שזאת הבעיה, האם זה יהיה בסדר לבצע בדיקת תקשורת נוספת?"
1378
+
1379
+ #: includes/i18n.php:855
1380
+ msgid ""
1381
+ "We use PHP cURL library for the API calls, which is a very common library "
1382
+ "and usually installed out of the box. Unfortunately, cURL is not installed "
1383
+ "on your server."
1384
+ msgstr ""
1385
+
1386
+ #: includes/i18n.php:859
1387
+ msgid ""
1388
+ "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1389
+ msgstr "מסיבה בלתי ברורה, CloudFlare, חומת האש שאנחנו משתמשים בה, חוסמת את התקשורת."
1390
+
1391
+ #: includes/i18n.php:863
1392
+ msgctxt "as pluginX requires an access to our API"
1393
+ msgid "%s requires an access to our API."
1394
+ msgstr "%s מחייב גישה ל-API שלנו."
1395
+
1396
+ #: includes/i18n.php:867
1397
+ msgid ""
1398
+ "It looks like your server is using Squid ACL (access control lists), which "
1399
+ "blocks the connection."
1400
+ msgstr ""
1401
+
1402
+ #: includes/i18n.php:871
1403
+ msgid "I don't know what is Squid or ACL, help me!"
1404
+ msgstr "אין לי מושג מה זה Squid או ACL - אשמח לעזרה!"
1405
+
1406
+ #: includes/i18n.php873, includes/i18n.php:887
1407
+ msgid ""
1408
+ "We'll make sure to contact your hosting company and resolve the issue. You "
1409
+ "will get a follow-up email to %s once we have an update."
1410
+ msgstr ""
1411
+
1412
+ #: includes/i18n.php:877
1413
+ msgid "I'm a system administrator"
1414
+ msgstr ""
1415
+
1416
+ #: includes/i18n.php:879
1417
+ msgid ""
1418
+ "Great, please whitelist the following domains: %s. Once you done, deactivate"
1419
+ " the plugin and activate it again."
1420
+ msgstr ""
1421
+
1422
+ #: includes/i18n.php:883
1423
+ msgid "I don't know what is cURL or how to install it, help me!"
1424
+ msgstr "אין לי מושג מה זה cURL או איך להתקין אותו - אשמח לעזרה!"
1425
+
1426
+ #: includes/i18n.php:891
1427
+ msgid ""
1428
+ "Great, please install cURL and enable it in your php.ini file. To make sure "
1429
+ "it was successfully activated, use 'phpinfo()'. Once activated, deactivate "
1430
+ "the plugin and reactivate it back again."
1431
+ msgstr ""
1432
+
1433
+ #: includes/i18n.php:895
1434
+ msgid ""
1435
+ "We are sure it's an issue on our side and more than happy to resolve it for "
1436
+ "you ASAP if you give us a chance."
1437
+ msgstr "זו בטח בעיה בצד שלנו ואנחנו נשמח לעזור כדי לפתור את העניין בהקדם האפשר, רק במידה ותאפשר\\י זאת."
1438
+
1439
+ #: includes/i18n.php:899
1440
+ msgid ""
1441
+ "Sorry for the inconvenience and we are here to help if you give us a chance."
1442
+ msgstr "מצטערים על חוסר הנעימות, אנחנו כאן כדי לעזור אם תאפשר\\י זאת."
1443
+
1444
+ #: includes/i18n.php:903
1445
+ msgid "Yes - I'm giving you a chance to fix it"
1446
+ msgstr "כן - אני נותן לך צ'אנס לתקן את זה"
1447
+
1448
+ #: includes/i18n.php:905
1449
+ msgid ""
1450
+ "We will do our best to whitelist your server and resolve this issue ASAP. "
1451
+ "You will get a follow-up email to %s once we have an update."
1452
+ msgstr ""
1453
+
1454
+ #: includes/i18n.php:909
1455
+ msgid "Let's try your previous version"
1456
+ msgstr "בוא ננסה את הגירסה הקודמת"
1457
+
1458
+ #: includes/i18n.php:911
1459
+ msgid "Uninstall this version and install the previous one."
1460
+ msgstr "הסר את הגרסה הנוכחית והתקן את הגרסה קודמת."
1461
+
1462
+ #: includes/i18n.php:915
1463
+ msgid "That's exhausting, please deactivate"
1464
+ msgstr "זה מתיש, אנא לכבות"
1465
+
1466
+ #: includes/i18n.php:917
1467
+ msgid ""
1468
+ "We feel your frustration and sincerely apologize for the inconvenience. Hope"
1469
+ " to see you again in the future."
1470
+ msgstr ""
1471
+
1472
+ #: includes/i18n.php:921
1473
+ msgid ""
1474
+ "Thank for giving us the chance to fix it! A message was just sent to our "
1475
+ "technical staff. We will get back to you as soon as we have an update to %s."
1476
+ " Appreciate your patience."
1477
+ msgstr ""
1478
+
1479
+ #: includes/i18n.php:925
1480
+ msgctxt "%1s - plugin title, %2s - API domain"
1481
+ msgid ""
1482
+ "Your server is blocking the access to Freemius' API, which is crucial for "
1483
+ "%1s synchronization. Please contact your host to whitelist %2s"
1484
+ msgstr ""
1485
+
1486
+ #: includes/i18n.php:929
1487
+ msgid ""
1488
+ "It seems like one of the authentication parameters is wrong. Update your "
1489
+ "Public Key, Secret Key & User ID, and try again."
1490
+ msgstr ""
1491
+
1492
+ #: includes/i18n.php:937
1493
+ msgid ""
1494
+ "Please check your mailbox, you should receive an email via %s to confirm the"
1495
+ " ownership change. From security reasons, you must confirm the change within"
1496
+ " the next 15 min. If you cannot find the email, please check your spam "
1497
+ "folder."
1498
+ msgstr ""
1499
+
1500
+ #: includes/i18n.php:941
1501
+ msgid ""
1502
+ "Thanks for confirming the ownership change. An email was just sent to %s for"
1503
+ " final approval."
1504
+ msgstr "תודה על אישור ביצוע החלפת הבעלות. הרגע נשלח מייל ל-%s כדי לקבל אישור סופי."
1505
+
1506
+ #: includes/i18n.php:945
1507
+ msgid "%s is the new owner of the account."
1508
+ msgstr "%s הינו הבעלים החד של חשבון זה."
1509
+
1510
+ #: includes/i18n.php:949
1511
+ msgctxt "addonX cannot run without pluginY"
1512
+ msgid "%s cannot run without %s."
1513
+ msgstr "%s לא יכול לעבוד ללא %s."
1514
+
1515
+ #: includes/i18n.php:953
1516
+ msgctxt "addonX cannot run..."
1517
+ msgid "%s cannot run without the plugin."
1518
+ msgstr ""
1519
+
1520
+ #: includes/i18n.php:957
1521
+ msgctxt "pluginX activation was successfully..."
1522
+ msgid "%s activation was successfully completed."
1523
+ msgstr ""
1524
+
1525
+ #: includes/i18n.php:961
1526
+ msgctxt "Plugin installer section title"
1527
+ msgid "Features & Pricing"
1528
+ msgstr "פיטצ'רים ומחירים"
1529
+
1530
+ #: includes/i18n.php:965
1531
+ msgid "Add-on must be deployed to WordPress.org or Freemius."
1532
+ msgstr ""
1533
+
1534
+ #: includes/i18n.php:969
1535
+ msgid "Paid add-on must be deployed to Freemius."
1536
+ msgstr ""
1537
+
1538
+ #: includes/i18n.php:977
1539
+ msgid ""
1540
+ "%s is a premium only add-on. You have to purchase a license first before "
1541
+ "activating the plugin."
1542
+ msgstr ""
1543
+
1544
+ #: includes/i18n.php:981
1545
+ msgid ""
1546
+ "%s free trial was successfully cancelled. Since the add-on is premium only "
1547
+ "it was automatically deactivated. If you like to use it in the future, "
1548
+ "you'll have to purchase a license."
1549
+ msgstr ""
1550
+
1551
+ #: includes/i18n.php:993
1552
+ msgctxt "as every month"
1553
+ msgid "Monthly"
1554
+ msgstr "חודשי"
1555
+
1556
+ #: includes/i18n.php:995
1557
+ msgctxt "as monthly period"
1558
+ msgid "mo"
1559
+ msgstr ""
1560
+
1561
+ #: includes/i18n.php:997
1562
+ msgctxt "as once a year"
1563
+ msgid "Annual"
1564
+ msgstr "שנתי"
1565
+
1566
+ #: includes/i18n.php:999
1567
+ msgctxt "as once a year"
1568
+ msgid "Annually"
1569
+ msgstr "שנתי"
1570
+
1571
+ #: includes/i18n.php:1001
1572
+ msgctxt "as once a year"
1573
+ msgid "Once"
1574
+ msgstr "פעם אחת"
1575
+
1576
+ #: includes/i18n.php:1003
1577
+ msgctxt "as annual period"
1578
+ msgid "year"
1579
+ msgstr "שנה"
1580
+
1581
+ #: includes/i18n.php:1005
1582
+ msgid "Lifetime"
1583
+ msgstr "לכל החיים"
1584
+
1585
+ #: includes/i18n.php:1007
1586
+ msgctxt "e.g. the best product"
1587
+ msgid "Best"
1588
+ msgstr "הכי טוב"
1589
+
1590
+ #: includes/i18n.php:1009
1591
+ msgctxt "e.g. billed monthly"
1592
+ msgid "Billed %s"
1593
+ msgstr "מחוייב על בסיס %s"
1594
+
1595
+ #: includes/i18n.php:1011
1596
+ msgctxt "as a discount of $5 or 10%"
1597
+ msgid "Save %s"
1598
+ msgstr "שמירת %s"
1599
+
1600
+ #: includes/i18n.php:1015
1601
+ msgid "View details"
1602
+ msgstr "פרטים נוספים"
1603
+
1604
+ #: includes/i18n.php:1023
1605
+ msgctxt "button label"
1606
+ msgid "Approve & Start Trial"
1607
+ msgstr ""
1608
+
1609
+ #: includes/i18n.php:1027
1610
+ msgid ""
1611
+ "You are 1-click away from starting your %1$s-day free trial of the %2$s "
1612
+ "plan."
1613
+ msgstr ""
1614
+
1615
+ #: includes/i18n.php:1031
1616
+ msgid ""
1617
+ "For compliance with the WordPress.org guidelines, before we start the trial "
1618
+ "we ask that you opt-in with your user and non-sensitive site information, "
1619
+ "allowing the plugin to periodically send data to %s to check for version "
1620
+ "updates and to validate your trial."
1621
+ msgstr ""
1622
+
1623
+ #: includes/i18n.php:1043
1624
+ msgid "Business name"
1625
+ msgstr ""
1626
+
1627
+ #: includes/i18n.php:1045
1628
+ msgid "Tax / VAT ID"
1629
+ msgstr ""
1630
+
1631
+ #: includes/i18n.php:1047
1632
+ msgid "Address Line %d"
1633
+ msgstr ""
1634
+
1635
+ #: includes/i18n.php:1049
1636
+ msgid "Country"
1637
+ msgstr ""
1638
+
1639
+ #: includes/i18n.php:1051
1640
+ msgid "Select Country"
1641
+ msgstr ""
1642
+
1643
+ #: includes/i18n.php:1053
1644
+ msgid "City"
1645
+ msgstr ""
1646
+
1647
+ #: includes/i18n.php:1055
1648
+ msgid "Town"
1649
+ msgstr ""
1650
+
1651
+ #: includes/i18n.php:1057
1652
+ msgid "State"
1653
+ msgstr ""
1654
+
1655
+ #: includes/i18n.php:1059
1656
+ msgid "Province"
1657
+ msgstr ""
1658
+
1659
+ #: includes/i18n.php:1061
1660
+ msgid "ZIP / Postal Code"
1661
+ msgstr ""
freemius/languages/freemius-it_IT.mo ADDED
Binary file
freemius/languages/freemius-it_IT.po ADDED
@@ -0,0 +1,1668 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 freemius
2
+ # This file is distributed under the same license as the freemius package.
3
+ # Translators:
4
+ # Pelly Benassi <plasmax@gmail.com>, 2016
5
+ # Daniele Scasciafratte Mte90 <mte90net@gmail.com>, 2015
6
+ # Pelly Benassi <plasmax@gmail.com>, 2016
7
+ # Vova Feldman <vova@freemius.com>, 2015-2016
8
+ msgid ""
9
+ msgstr ""
10
+ "Project-Id-Version: WordPress SDK\n"
11
+ "Report-Msgid-Bugs-To: https://github.com/Freemius/wordpress-sdk/issues\n"
12
+ "PO-Revision-Date: 2016-12-12 02:13+0000\n"
13
+ "Last-Translator: Vova Feldman <vova@freemius.com>\n"
14
+ "Language-Team: Italian (Italy) (http://www.transifex.com/freemius/wordpress-sdk/language/it_IT/)\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Language: it_IT\n"
19
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
+ "X-Poedit-Basepath: ..\n"
21
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
22
+ "X-Poedit-SearchPath-0: .\n"
23
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
24
+ "X-Poedit-SourceCharset: UTF-8\n"
25
+
26
+ #: includes/i18n.php41, includes/i18n.php:55
27
+ msgid "Yes - I'm in!"
28
+ msgstr "Sì, ci sto!"
29
+
30
+ #: includes/i18n.php43, includes/i18n.php:57
31
+ msgid "Not today"
32
+ msgstr "Non oggi"
33
+
34
+ #: includes/i18n.php:69
35
+ msgid "Account"
36
+ msgstr "Account"
37
+
38
+ #: includes/i18n.php:71
39
+ msgid "Add On"
40
+ msgstr "Add-on"
41
+
42
+ #: includes/i18n.php:73
43
+ msgid "Contact Us"
44
+ msgstr "Contattaci"
45
+
46
+ #: includes/i18n.php:75
47
+ msgid "Contact Support"
48
+ msgstr "Contatta il supporto"
49
+
50
+ #: includes/i18n.php:77
51
+ msgid "Change Ownership"
52
+ msgstr "Cambia Proprietario"
53
+
54
+ #: includes/i18n.php:79
55
+ msgid "Support"
56
+ msgstr "Supporto"
57
+
58
+ #: includes/i18n.php:81
59
+ msgid "Support Forum"
60
+ msgstr "Forum di supporto"
61
+
62
+ #: includes/i18n.php:83
63
+ msgid "Add Ons"
64
+ msgstr "Add-on"
65
+
66
+ #: includes/i18n.php:85
67
+ msgctxt "verb"
68
+ msgid "Upgrade"
69
+ msgstr "Aggiornamento"
70
+
71
+ #: includes/i18n.php:87
72
+ msgid "Awesome"
73
+ msgstr "Fantastico"
74
+
75
+ #: includes/i18n.php:89
76
+ msgctxt "noun"
77
+ msgid "Pricing"
78
+ msgstr "Prezzi"
79
+
80
+ #: includes/i18n.php:91
81
+ msgctxt "noun"
82
+ msgid "Price"
83
+ msgstr "Prezzo"
84
+
85
+ #: includes/i18n.php:93
86
+ msgid "Unlimited Updates"
87
+ msgstr "Aggiornamenti Illimitati"
88
+
89
+ #: includes/i18n.php:95
90
+ msgctxt "verb"
91
+ msgid "Downgrade"
92
+ msgstr "Downgrade"
93
+
94
+ #: includes/i18n.php:97
95
+ msgid "Cancel Trial"
96
+ msgstr "Annulla prova gratuita"
97
+
98
+ #: includes/i18n.php:99
99
+ msgid "Free Trial"
100
+ msgstr "Prova gratuita"
101
+
102
+ #: includes/i18n.php:101
103
+ msgid "Start my free %s"
104
+ msgstr "Inizia la mia %s"
105
+
106
+ #: includes/i18n.php:103
107
+ msgid "No commitment for %s - cancel anytime"
108
+ msgstr "Nessun impegno con %s - cancella quando vuoi"
109
+
110
+ #: includes/i18n.php:105
111
+ msgid "After your free %s, pay as little as %s"
112
+ msgstr "Dopo il tuo %s gratuito, paghi solamente %s"
113
+
114
+ #: includes/i18n.php:107
115
+ msgid "Details"
116
+ msgstr "Dettagli"
117
+
118
+ #: includes/i18n.php:109
119
+ msgid "Account Details"
120
+ msgstr "Dettagli dell'account"
121
+
122
+ #: includes/i18n.php:111
123
+ msgctxt "verb"
124
+ msgid "Delete"
125
+ msgstr "Elimina"
126
+
127
+ #: includes/i18n.php:113
128
+ msgctxt "verb"
129
+ msgid "Show"
130
+ msgstr "Mostra"
131
+
132
+ #: includes/i18n.php:115
133
+ msgctxt "verb"
134
+ msgid "Hide"
135
+ msgstr "Nascondi"
136
+
137
+ #: includes/i18n.php:117
138
+ msgctxt "verb"
139
+ msgid "Edit"
140
+ msgstr "Modifica"
141
+
142
+ #: includes/i18n.php:119
143
+ msgctxt "verb"
144
+ msgid "Update"
145
+ msgstr "Aggiorna"
146
+
147
+ #: includes/i18n.php:121
148
+ msgid "Date"
149
+ msgstr "Data"
150
+
151
+ #: includes/i18n.php:123
152
+ msgid "Amount"
153
+ msgstr "Importo"
154
+
155
+ #: includes/i18n.php:125
156
+ msgid "Invoice"
157
+ msgstr "Fattura"
158
+
159
+ #: includes/i18n.php:127
160
+ msgid "Billing"
161
+ msgstr "Fatturazione"
162
+
163
+ #: includes/i18n.php:129
164
+ msgid "Payments"
165
+ msgstr "Pagamenti"
166
+
167
+ #: includes/i18n.php:131
168
+ msgid "Delete Account"
169
+ msgstr "Elimina Account"
170
+
171
+ #: includes/i18n.php:133
172
+ msgctxt "as close a window"
173
+ msgid "Dismiss"
174
+ msgstr "Chiudi"
175
+
176
+ #: includes/i18n.php:135
177
+ msgctxt "as product pricing plan"
178
+ msgid "Plan"
179
+ msgstr "Piano"
180
+
181
+ #: includes/i18n.php:137
182
+ msgid "Change Plan"
183
+ msgstr "Cambia piano"
184
+
185
+ #: includes/i18n.php:139
186
+ msgctxt "as download professional version"
187
+ msgid "Download %s Version"
188
+ msgstr "Scarica la versione %s"
189
+
190
+ #: includes/i18n.php:141
191
+ msgctxt "as download professional version now"
192
+ msgid "Download %s version now"
193
+ msgstr "Scarica la versione %s ora"
194
+
195
+ #: includes/i18n.php:145
196
+ msgctxt "as download latest version"
197
+ msgid "Download Latest"
198
+ msgstr "Scarica l'ultima versione"
199
+
200
+ #: includes/i18n.php:147
201
+ msgctxt "E.g. you have a professional license."
202
+ msgid "You have a %s license."
203
+ msgstr "Hai la licenza %s."
204
+
205
+ #: includes/i18n.php:151
206
+ msgid "New"
207
+ msgstr "Nuovo"
208
+
209
+ #: includes/i18n.php:153
210
+ msgid "Free"
211
+ msgstr "Gratuito"
212
+
213
+ #: includes/i18n.php:155
214
+ msgctxt "as trial plan"
215
+ msgid "Trial"
216
+ msgstr "Prova gratuita"
217
+
218
+ #: includes/i18n.php:157
219
+ msgctxt "as starting a trial plan"
220
+ msgid "Start Trial"
221
+ msgstr "Inizia il periodo di prova gratuito"
222
+
223
+ #: includes/i18n.php:159
224
+ msgctxt "verb"
225
+ msgid "Purchase"
226
+ msgstr "Acquisto"
227
+
228
+ #: includes/i18n.php:161
229
+ msgid "Purchase License"
230
+ msgstr "Acquista licenza"
231
+
232
+ #: includes/i18n.php:163
233
+ msgctxt "verb"
234
+ msgid "Buy"
235
+ msgstr "Compra"
236
+
237
+ #: includes/i18n.php:165
238
+ msgid "Buy License"
239
+ msgstr "Compra licenza"
240
+
241
+ #: includes/i18n.php:167
242
+ msgid "Single Site License"
243
+ msgstr "Licenza per sito singolo"
244
+
245
+ #: includes/i18n.php:169
246
+ msgid "Unlimited Licenses"
247
+ msgstr "Licenze illimitate"
248
+
249
+ #: includes/i18n.php:171
250
+ msgid "Up to %s Sites"
251
+ msgstr "Fino a %s siti"
252
+
253
+ #: includes/i18n.php:173
254
+ msgid "%sRenew your license now%s to access version %s features and support."
255
+ msgstr "%sRinnova la tua licenza ora%s per accedere a funzionalità e supporto della versione %s."
256
+
257
+ #: includes/i18n.php:177
258
+ msgid ""
259
+ "Enter the email address you've used for the upgrade below and we will resend"
260
+ " you the license key."
261
+ msgstr "Inserisci qui sotto l'indirizzo email che hai usato per registrare l'aggiornamento e ti invieremo di nuovo la chiave di licenza."
262
+
263
+ #: includes/i18n.php:181
264
+ msgctxt "e.g. Professional Plan"
265
+ msgid "%s Plan"
266
+ msgstr "Piano %s"
267
+
268
+ #: includes/i18n.php:183
269
+ msgid "You are just one step away - %s"
270
+ msgstr "Sei a un passo dalla fine - %s"
271
+
272
+ #: includes/i18n.php:185
273
+ msgctxt "%s - plugin name. As complete \"Jetpack\" activation now"
274
+ msgid "Complete \"%s\" Activation Now"
275
+ msgstr "Completa l'attivazione di \"%s\" ora"
276
+
277
+ #: includes/i18n.php:189
278
+ msgid "We made a few tweaks to the plugin, %s"
279
+ msgstr "Abbiamo apportato alcune modifiche al plugin, %s"
280
+
281
+ #: includes/i18n.php:191
282
+ msgid "Opt-in to make \"%s\" Better!"
283
+ msgstr "Contribuisci a rendere \"%s\" migliore!"
284
+
285
+ #: includes/i18n.php:193
286
+ msgid "Error"
287
+ msgstr "Errore"
288
+
289
+ #: includes/i18n.php:195
290
+ msgid ""
291
+ "Freemius SDK couldn't find the plugin's main file. Please contact "
292
+ "sdk@freemius.com with the current error."
293
+ msgstr "L'SDK di Freemius non è riuscito a trovare il file principale del plugin. Per favore contatta sdk@freemius.com riportando l'errore."
294
+
295
+ #: includes/i18n.php:203
296
+ msgctxt "as expiration date"
297
+ msgid "Expiration"
298
+ msgstr "Scadenza"
299
+
300
+ #: includes/i18n.php:205
301
+ msgctxt "as software license"
302
+ msgid "License"
303
+ msgstr "Licenza"
304
+
305
+ #: includes/i18n.php:207
306
+ msgid "not verified"
307
+ msgstr "non verificato"
308
+
309
+ #: includes/i18n.php:209
310
+ msgid "Verify Email"
311
+ msgstr "Verifica email"
312
+
313
+ #: includes/i18n.php:211
314
+ msgctxt "e.g. expires in 2 months"
315
+ msgid "Expires in %s"
316
+ msgstr "Scade in %s"
317
+
318
+ #: includes/i18n.php:213
319
+ msgctxt "e.g. auto renews in 2 months"
320
+ msgid "Auto renews in %s"
321
+ msgstr "Rinnovo automatico in %s"
322
+
323
+ #: includes/i18n.php:215
324
+ msgid "No expiration"
325
+ msgstr "Nessuna scadenza"
326
+
327
+ #: includes/i18n.php:217
328
+ msgid "Expired"
329
+ msgstr "Scaduto"
330
+
331
+ #: includes/i18n.php:219
332
+ msgid "Cancelled"
333
+ msgstr "Annullato"
334
+
335
+ #: includes/i18n.php:221
336
+ msgctxt "e.g. In 2 hours"
337
+ msgid "In %s"
338
+ msgstr "In %s"
339
+
340
+ #: includes/i18n.php:223
341
+ msgctxt "e.g. 2 min ago"
342
+ msgid "%s ago"
343
+ msgstr "%s fa"
344
+
345
+ #: includes/i18n.php:225
346
+ msgctxt "as plugin version"
347
+ msgid "Version"
348
+ msgstr "Versione"
349
+
350
+ #: includes/i18n.php:227
351
+ msgid "Name"
352
+ msgstr "Nome"
353
+
354
+ #: includes/i18n.php:229
355
+ msgid "Email"
356
+ msgstr "Email"
357
+
358
+ #: includes/i18n.php:231
359
+ msgid "Email address"
360
+ msgstr "Indirizzo email"
361
+
362
+ #: includes/i18n.php:233
363
+ msgid "Verified"
364
+ msgstr "Verificato"
365
+
366
+ #: includes/i18n.php:235
367
+ msgid "Plugin"
368
+ msgstr "Plugin"
369
+
370
+ #: includes/i18n.php:237
371
+ msgid "Plugins"
372
+ msgstr "Plugin"
373
+
374
+ #: includes/i18n.php:239
375
+ msgid "Themes"
376
+ msgstr "Temi"
377
+
378
+ #: includes/i18n.php:241
379
+ msgctxt "as file/folder path"
380
+ msgid "Path"
381
+ msgstr "Percorso"
382
+
383
+ #: includes/i18n.php:243
384
+ msgid "Title"
385
+ msgstr "Titolo"
386
+
387
+ #: includes/i18n.php:245
388
+ msgid "Free version"
389
+ msgstr "Versione gratuita"
390
+
391
+ #: includes/i18n.php:247
392
+ msgid "Premium version"
393
+ msgstr "Versione premium"
394
+
395
+ #: includes/i18n.php:249
396
+ msgctxt "as WP plugin slug"
397
+ msgid "Slug"
398
+ msgstr "Slug"
399
+
400
+ #: includes/i18n.php:251
401
+ msgid "ID"
402
+ msgstr "ID"
403
+
404
+ #: includes/i18n.php:253
405
+ msgid "Users"
406
+ msgstr "Utenti"
407
+
408
+ #: includes/i18n.php:255
409
+ msgid "Plugin Installs"
410
+ msgstr "Installazioni Plugin"
411
+
412
+ #: includes/i18n.php:257
413
+ msgctxt "like websites"
414
+ msgid "Sites"
415
+ msgstr "Siti"
416
+
417
+ #: includes/i18n.php:259
418
+ msgid "User ID"
419
+ msgstr "ID utente"
420
+
421
+ #: includes/i18n.php:261
422
+ msgid "Site ID"
423
+ msgstr "ID del sito"
424
+
425
+ #: includes/i18n.php:263
426
+ msgid "Public Key"
427
+ msgstr "Chiave pubblica"
428
+
429
+ #: includes/i18n.php:265
430
+ msgid "Secret Key"
431
+ msgstr "Chiave segreta"
432
+
433
+ #: includes/i18n.php:267
434
+ msgctxt "as secret encryption key missing"
435
+ msgid "No Secret"
436
+ msgstr "Nessuna chiave"
437
+
438
+ #: includes/i18n.php:269
439
+ msgid "No ID"
440
+ msgstr "Nessun ID"
441
+
442
+ #: includes/i18n.php:271
443
+ msgctxt "as synchronize license"
444
+ msgid "Sync License"
445
+ msgstr "Sincronizza la licenza"
446
+
447
+ #: includes/i18n.php:273
448
+ msgctxt "as synchronize"
449
+ msgid "Sync"
450
+ msgstr "Sincronizza"
451
+
452
+ #: includes/i18n.php:275
453
+ msgid "Activate License"
454
+ msgstr "Attiva licenza"
455
+
456
+ #: includes/i18n.php:277
457
+ msgid "Activate Free Version"
458
+ msgstr "Attiva versione gratuita"
459
+
460
+ #: includes/i18n.php:279
461
+ msgid ""
462
+ "Please enter the license key that you received in the email right after the "
463
+ "purchase:"
464
+ msgstr "Per favore inserisci la chiave di licenza che hai ricevuto via mail subito dopo l'acquisto:"
465
+
466
+ #: includes/i18n.php:283
467
+ msgid "Activating license..."
468
+ msgstr "Sto attivando la licenza..."
469
+
470
+ #: includes/i18n.php:285
471
+ msgid "Change License"
472
+ msgstr "Cambia licenza"
473
+
474
+ #: includes/i18n.php:287
475
+ msgid "Update License"
476
+ msgstr "Aggiorna licenza"
477
+
478
+ #: includes/i18n.php:289
479
+ msgid "Deactivate License"
480
+ msgstr "Disattiva licenza"
481
+
482
+ #: includes/i18n.php:291
483
+ msgid "Activate"
484
+ msgstr "Attiva"
485
+
486
+ #: includes/i18n.php:293
487
+ msgid "Deactivate"
488
+ msgstr "Disattiva"
489
+
490
+ #: includes/i18n.php:295
491
+ msgid "Skip & Deactivate"
492
+ msgstr "Salta e disattiva"
493
+
494
+ #: includes/i18n.php:297
495
+ msgid "No - just deactivate"
496
+ msgstr "No - disattiva e basta"
497
+
498
+ #: includes/i18n.php:299
499
+ msgid "Yes - do your thing"
500
+ msgstr "Sì - fai pure"
501
+
502
+ #: includes/i18n.php:301
503
+ msgctxt "active mode"
504
+ msgid "Active"
505
+ msgstr "Attiva"
506
+
507
+ #: includes/i18n.php:303
508
+ msgctxt "is active mode?"
509
+ msgid "Is Active"
510
+ msgstr "è attiva"
511
+
512
+ #: includes/i18n.php:305
513
+ msgid "Install Now"
514
+ msgstr "Installa ora"
515
+
516
+ #: includes/i18n.php:307
517
+ msgid "Install Update Now"
518
+ msgstr "Installa l'aggiornamento ora"
519
+
520
+ #: includes/i18n.php:309
521
+ msgid "More information about %s"
522
+ msgstr "Ulteriori informazioni su %s"
523
+
524
+ #: includes/i18n.php:311
525
+ msgid "Localhost"
526
+ msgstr "Localhost"
527
+
528
+ #: includes/i18n.php:313
529
+ msgctxt "as activate Professional plan"
530
+ msgid "Activate %s Plan"
531
+ msgstr "Attivare il piano %s"
532
+
533
+ #: includes/i18n.php:315
534
+ msgctxt "as 5 licenses left"
535
+ msgid "%s left"
536
+ msgstr "%s rimanenti"
537
+
538
+ #: includes/i18n.php:317
539
+ msgid "Last license"
540
+ msgstr "Ultima licenza"
541
+
542
+ #: includes/i18n.php:319
543
+ msgid "What is your %s?"
544
+ msgstr "Qual è il tuo %s?"
545
+
546
+ #: includes/i18n.php:321
547
+ msgid "Activate this add-on"
548
+ msgstr "Attivare questo addon"
549
+
550
+ #: includes/i18n.php:323
551
+ msgid ""
552
+ "Deactivating your license will block all premium features, but will enable "
553
+ "you to activate the license on another site. Are you sure you want to "
554
+ "proceed?"
555
+ msgstr "La disattivazione della licenza bloccherà tutte le funzionalità premium, ma vi permetterà di attivare la licenza su un altro sito. Sei sicuro di voler procedere?"
556
+
557
+ #: includes/i18n.php:327
558
+ msgid ""
559
+ "Deleting the account will automatically deactivate your %s plan license so "
560
+ "you can use it on other sites. If you want to terminate the recurring "
561
+ "payments as well, click the \"Cancel\" button, and first \"Downgrade\" your "
562
+ "account. Are you sure you would like to continue with the deletion?"
563
+ msgstr "L'eliminazione dell'account disattiva automaticamente la tua licenza del piano %s quindi è possibile utilizzarlo su altri siti. Se si desidera anche terminare i pagamenti ricorrenti, fare clic sul pulsante \"Annulla\" ed effettuare il \"Downgrade\" del tuo account. Sei sicuro di voler continuare con l'eliminazione?"
564
+
565
+ #: includes/i18n.php:331
566
+ msgid ""
567
+ "Deletion is not temporary. Only delete if you no longer want to use this "
568
+ "plugin anymore. Are you sure you would like to continue with the deletion?"
569
+ msgstr "L'eliminazione non è temporanea. Cancella solo se non si desidera più utilizzare questo plugin. Sei sicuro di voler continuare con l'eliminazione?"
570
+
571
+ #: includes/i18n.php:335
572
+ msgid ""
573
+ "Downgrading your plan will immediately stop all future recurring payments "
574
+ "and your %s plan license will expire in %s."
575
+ msgstr "Effettuare il downgrade del piano interromperà immediatamente tutti i futuri pagamenti ricorrenti e la licenza del piano %s scadrà in %s."
576
+
577
+ #: includes/i18n.php:339
578
+ msgid ""
579
+ "Cancelling the trial will immediately block access to all premium features. "
580
+ "Are you sure?"
581
+ msgstr "Cancellando il periodo di prova gratuito bloccherai immediatamente l'accesso a tutte le funzionalità premium. Vuoi continuare?"
582
+
583
+ #: includes/i18n.php:343
584
+ msgid ""
585
+ "You can still enjoy all %s features but you will not have access to plugin "
586
+ "updates and support."
587
+ msgstr "Puoi ancora sfruttare tutte le funzionalità di %s, ma non avrai accesso al supporto ed agli aggiornamenti del plugin."
588
+
589
+ #: includes/i18n.php:347
590
+ msgid ""
591
+ "Once your license expire you can still use the Free version but you will NOT"
592
+ " have access to the %s features."
593
+ msgstr "Una volta scaduta la licenza, sarà possibile ancora utilizzare la versione gratuita ma non avrete accesso alle funzionalità di %s."
594
+
595
+ #: includes/i18n.php:351
596
+ msgid "Are you sure you want to proceed?"
597
+ msgstr "Sei sicuro di voler procedere?"
598
+
599
+ #: includes/i18n.php:357
600
+ msgid "Add Ons for %s"
601
+ msgstr "Add-on per %s"
602
+
603
+ #: includes/i18n.php:359
604
+ msgid ""
605
+ "We could'nt load the add-ons list. It's probably an issue on our side, "
606
+ "please try to come back in few minutes."
607
+ msgstr "Non siamo riusciti a caricare la lista degli add-on. Si tratta probabilmente di un problema nel nostro sistema, per favore riprova tra qualche minuto."
608
+
609
+ #: includes/i18n.php:365
610
+ msgid "Anonymous feedback"
611
+ msgstr "Feedback anonimo"
612
+
613
+ #: includes/i18n.php:367
614
+ msgid "Quick feedback"
615
+ msgstr "Feedback veloce"
616
+
617
+ #: includes/i18n.php:369
618
+ msgid "If you have a moment, please let us know why you are deactivating"
619
+ msgstr "Se hai un momento, potresti dirci perché lo hai disattivato?"
620
+
621
+ #: includes/i18n.php:373
622
+ msgid "Yes - Deactivate"
623
+ msgstr "Si - Disattiva"
624
+
625
+ #: includes/i18n.php:375
626
+ msgid "Submit & Deactivate"
627
+ msgstr "Invia & Disattiva"
628
+
629
+ #: includes/i18n.php:377
630
+ msgid "Cancel"
631
+ msgstr "Annulla"
632
+
633
+ #: includes/i18n.php:379
634
+ msgid "I no longer need the plugin"
635
+ msgstr "Non ho piú bisogno di questo plugin"
636
+
637
+ #: includes/i18n.php:381
638
+ msgid "I found a better plugin"
639
+ msgstr "Ho trovato un plugin migliore"
640
+
641
+ #: includes/i18n.php:383
642
+ msgid "I only needed the plugin for a short period"
643
+ msgstr "Avevo bisogno del plugin solo per un breve periodo"
644
+
645
+ #: includes/i18n.php:385
646
+ msgid "The plugin broke my site"
647
+ msgstr "Il plugin ha causato problemi al mio sito"
648
+
649
+ #: includes/i18n.php:387
650
+ msgid "The plugin suddenly stopped working"
651
+ msgstr "Il plugin ha smesso di funzionare"
652
+
653
+ #: includes/i18n.php:389
654
+ msgid "I can't pay for it anymore"
655
+ msgstr "Non posso piú pagarlo"
656
+
657
+ #: includes/i18n.php:391
658
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
659
+ msgstr "È una disattivazione temporanea. Sto solo cercando di risolvere un problema."
660
+
661
+ #: includes/i18n.php:395
662
+ msgctxt ""
663
+ "the text of the \"other\" reason for deactivating the plugin that is shown "
664
+ "in the modal box."
665
+ msgid "Other"
666
+ msgstr "Altro"
667
+
668
+ #: includes/i18n.php:399
669
+ msgid "Kindly tell us the reason so we can improve."
670
+ msgstr "Spiegandoci il motivo ci aiuterai a migliorare."
671
+
672
+ #: includes/i18n.php:401
673
+ msgid "What's the plugin's name?"
674
+ msgstr "Qual è il nome del plugin?"
675
+
676
+ #: includes/i18n.php:403
677
+ msgid "What price would you feel comfortable paying?"
678
+ msgstr "Che prezzo ritieni opportuno pagare?"
679
+
680
+ #: includes/i18n.php:405
681
+ msgid "I couldn't understand how to make it work"
682
+ msgstr "Non capisco come farlo funzionare"
683
+
684
+ #: includes/i18n.php:407
685
+ msgid ""
686
+ "The plugin is great, but I need specific feature that you don't support"
687
+ msgstr "Il plugin é ottimo ma ho bisogno di una funzionalitá specifica che non é supportata"
688
+
689
+ #: includes/i18n.php:411
690
+ msgid "The plugin is not working"
691
+ msgstr "Il plugin non funziona"
692
+
693
+ #: includes/i18n.php:413
694
+ msgid "It's not what I was looking for"
695
+ msgstr "Non é quello che stavo cercando"
696
+
697
+ #: includes/i18n.php:415
698
+ msgid "The plugin didn't work as expected"
699
+ msgstr "Il plugin non funziona come mi aspettavo"
700
+
701
+ #: includes/i18n.php:417
702
+ msgid "What feature?"
703
+ msgstr "Quale funzionalitá?"
704
+
705
+ #: includes/i18n.php:419
706
+ msgid "Kindly share what didn't work so we can fix it for future users..."
707
+ msgstr "Condividi cosa non ha funzionato in modo da migliorare il prodotto per gli utenti futuri..."
708
+
709
+ #: includes/i18n.php:423
710
+ msgid "What you've been looking for?"
711
+ msgstr "Che cosa stai cercando?"
712
+
713
+ #: includes/i18n.php:425
714
+ msgid "What did you expect?"
715
+ msgstr "Che cosa ti aspettavi?"
716
+
717
+ #: includes/i18n.php:427
718
+ msgid "The plugin didn't work"
719
+ msgstr "Il plugin non funziona"
720
+
721
+ #: includes/i18n.php:429
722
+ msgid "I don't like to share my information with you"
723
+ msgstr "Non voglio condividere i miei dati con te"
724
+
725
+ #: includes/i18n.php:431
726
+ msgid ""
727
+ "You might have missed it, but you don't have to share any data and can just "
728
+ "%s the opt-in."
729
+ msgstr "Potresti non averci fatto caso, ma non sei obbligato a condividere i tuoi dati e puoi semplicemente %s la tua partecipazione."
730
+
731
+ #: includes/i18n.php:441
732
+ msgctxt "greeting"
733
+ msgid "Hey %s,"
734
+ msgstr "Hey %s,"
735
+
736
+ #: includes/i18n.php:443
737
+ msgctxt "a greeting. E.g. Thanks John!"
738
+ msgid "Thanks %s!"
739
+ msgstr "Grazie %s!"
740
+
741
+ #: includes/i18n.php:445
742
+ msgid ""
743
+ "Never miss an important update - opt-in to our security and feature updates "
744
+ "notifications, and non-sensitive diagnostic tracking with %4$s."
745
+ msgstr "Non perdere nessun aggiornamento importante - iscriviti per ricevere notifiche su aggiornamenti relativi alla sicurezza e nuove versioni, oltre al tracciamento di diagnostica non sensibile con %4$s."
746
+
747
+ #: includes/i18n.php:449
748
+ msgid ""
749
+ "Please help us improve %1$s! If you opt-in, some data about your usage of "
750
+ "%1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still "
751
+ "work just fine."
752
+ msgstr "Aiutaci a migliorare %1$s! Se ti iscrivi, alcuni dati riguardanti il tuo utilizzo di %1$s verranno inviati a %4$s. Se salti questo passaggio, non c'è problema! %1$s funzionerà ugualmente."
753
+
754
+ #: includes/i18n.php:453
755
+ msgid ""
756
+ "You should receive an activation email for %s to your mailbox at %s. Please "
757
+ "make sure you click the activation button in that email to %s."
758
+ msgstr "Dovresti ricevere un'email di attivazione di %s all'indirizzo %s. Assicurati di fare clic sul pulsante di attivazione nell'email per &s."
759
+
760
+ #: includes/i18n.php:455
761
+ msgid "complete the install"
762
+ msgstr "completa l'installazione"
763
+
764
+ #: includes/i18n.php:457
765
+ msgid "start the trial"
766
+ msgstr "Inizia il periodo di prova gratuito"
767
+
768
+ #: includes/i18n.php:459
769
+ msgid ""
770
+ "Thanks for purchasing %s! To get started, please enter your license key:"
771
+ msgstr "Grazie per aver acquistato %s! Per iniziare, per favore inserisci la tua chiave di licenza:"
772
+
773
+ #: includes/i18n.php:463
774
+ msgid ""
775
+ "The plugin will be periodically sending data to %s to check for plugin "
776
+ "updates and verify the validity of your license."
777
+ msgstr "Il plugin invierà dati periodicamente a %s per controllare l'esistenza di aggiornamenti e verificare la validità della tua licenza."
778
+
779
+ #: includes/i18n.php:467
780
+ msgid "What permissions are being granted?"
781
+ msgstr "Quali autorizzazioni vengono concesse?"
782
+
783
+ #: includes/i18n.php:469
784
+ msgid "Your Profile Overview"
785
+ msgstr "Panoramica del tuo profilo"
786
+
787
+ #: includes/i18n.php:471
788
+ msgid "Name and email address"
789
+ msgstr "Nome ed indirizzo email"
790
+
791
+ #: includes/i18n.php:473
792
+ msgid "Your Site Overview"
793
+ msgstr "Panoramica del tuo sito"
794
+
795
+ #: includes/i18n.php:475
796
+ msgid "Site URL, WP version, PHP info, plugins & themes"
797
+ msgstr "URL del sito, versione di WP, informazioni PHP, plugin e temi"
798
+
799
+ #: includes/i18n.php:479
800
+ msgid "Current Plugin Events"
801
+ msgstr "Eventi correnti del plugin"
802
+
803
+ #: includes/i18n.php:481
804
+ msgid "Activation, deactivation and uninstall"
805
+ msgstr "Attiva, disattivazione e disinstallazione"
806
+
807
+ #: includes/i18n.php:483
808
+ msgid "Plugins & Themes"
809
+ msgstr "Plugin e temi"
810
+
811
+ #: includes/i18n.php:485
812
+ msgid "Titles, versions and state."
813
+ msgstr "Titoli, versioni e stato."
814
+
815
+ #: includes/i18n.php:487
816
+ msgid "Admin Notices"
817
+ msgstr "Avvisi amministratore"
818
+
819
+ #: includes/i18n.php:489
820
+ msgid "Newsletter"
821
+ msgstr "Newsletter"
822
+
823
+ #: includes/i18n.php:491
824
+ msgid "Updates, announcements, marketing, no spam"
825
+ msgstr "Aggiornamenti, annunci, marketing, no spam"
826
+
827
+ #: includes/i18n.php:493
828
+ msgid "Privacy Policy"
829
+ msgstr "Politica sulla privacy"
830
+
831
+ #: includes/i18n.php:495
832
+ msgid "Terms of Service"
833
+ msgstr "Termini del Servizio"
834
+
835
+ #: includes/i18n.php:497
836
+ msgctxt "as activating plugin"
837
+ msgid "Activating"
838
+ msgstr "Attivazione"
839
+
840
+ #: includes/i18n.php:499
841
+ msgctxt "as in the process of sending an email"
842
+ msgid "Sending email"
843
+ msgstr "Invio email"
844
+
845
+ #: includes/i18n.php:503
846
+ msgctxt "button label"
847
+ msgid "Allow & Continue"
848
+ msgstr "Consenti & Continua"
849
+
850
+ #: includes/i18n.php:505
851
+ msgctxt "button label"
852
+ msgid "Agree & Activate License"
853
+ msgstr "Accetta e attiva la licenza"
854
+
855
+ #: includes/i18n.php:507
856
+ msgctxt "verb"
857
+ msgid "Skip"
858
+ msgstr "Salta"
859
+
860
+ #: includes/i18n.php:509
861
+ msgid "Click here to use the plugin anonymously"
862
+ msgstr "Fai clic qui per usare il plugin anonimamente"
863
+
864
+ #: includes/i18n.php:511
865
+ msgid "Re-send activation email"
866
+ msgstr "Invia nuovamente l'email di attivazione"
867
+
868
+ #: includes/i18n.php:513
869
+ msgid "License key"
870
+ msgstr "Chiave di licenza"
871
+
872
+ #: includes/i18n.php:515
873
+ msgid "Send License Key"
874
+ msgstr "Invia chiave di licenza"
875
+
876
+ #: includes/i18n.php:517
877
+ msgid "Sending license key"
878
+ msgstr "Invio chiave di licenza"
879
+
880
+ #: includes/i18n.php:519
881
+ msgid "Have a license key?"
882
+ msgstr "Hai una chiave di licenza?"
883
+
884
+ #: includes/i18n.php:521
885
+ msgid "Don't have a license key?"
886
+ msgstr "Non hai una chiave di licenza?"
887
+
888
+ #: includes/i18n.php:523
889
+ msgid "Can't find your license key?"
890
+ msgstr "Non trovi la tua chiave di licenza?"
891
+
892
+ #: includes/i18n.php:525
893
+ msgid ""
894
+ "We couldn't find your email address in the system, are you sure it's the "
895
+ "right address?"
896
+ msgstr "Non siamo riusciti a trovare il tuo indirizzo email nel sistema, sei sicuro che sia l'indirizzo giusto?"
897
+
898
+ #: includes/i18n.php:529
899
+ msgid ""
900
+ "We can't see any active licenses associated with that email address, are you"
901
+ " sure it's the right address?"
902
+ msgstr "Non siamo riusciti a trovare alcuna licenza attiva associata al tuo indirizzo email, sei sicuro che sia l'indirizzo giusto?"
903
+
904
+ #: includes/i18n.php:533
905
+ msgid "Opt In"
906
+ msgstr "Iscriviti"
907
+
908
+ #: includes/i18n.php:535
909
+ msgid "Opt Out"
910
+ msgstr "Cancella iscrizione"
911
+
912
+ #: includes/i18n.php:537
913
+ msgid "On second thought - I want to continue helping"
914
+ msgstr "Ci ho ripensato, voglio continuare a fornire il mio aiuto"
915
+
916
+ #: includes/i18n.php:541
917
+ msgid "Opting out..."
918
+ msgstr "Cancellamento dell'iscrizione..."
919
+
920
+ #: includes/i18n.php:543
921
+ msgid "Opting in..."
922
+ msgstr "Iscrizione in corso..."
923
+
924
+ #: includes/i18n.php:545
925
+ msgid ""
926
+ "We appreciate your help in making the %s better by letting us track some "
927
+ "usage data."
928
+ msgstr "Ti ringraziamo per averci concesso di tracciare alcuni dati di utilizzo al fine di migliorare %s"
929
+
930
+ #: includes/i18n.php:549
931
+ msgid ""
932
+ "Usage tracking is done in the name of making %s better. Making a better user"
933
+ " experience, prioritizing new features, and more good things. We'd really "
934
+ "appreciate if you'll reconsider letting us continue with the tracking."
935
+ msgstr "Tracciamo l'utilizzo esclusivamente per rendere %s migliore, creando una migliore esperienza utente e dando priorità a nuove funzionalità, oltre a molte altre buone cose. Saremmo veramente felici di vederti cambiare idea e lasciarci continuare con il tracciamento."
936
+
937
+ #: includes/i18n.php:553
938
+ msgid ""
939
+ "By clicking \"Opt Out\", we will no longer be sending any data from %s to "
940
+ "%s."
941
+ msgstr "Cliccando su \"Cancella iscrizione\", non invieremo più nessuna informazione da %s a %s."
942
+
943
+ #: includes/i18n.php:563
944
+ msgid "Screenshots"
945
+ msgstr "Screenshots"
946
+
947
+ #: includes/i18n.php:565
948
+ msgid "Click to view full-size screenshot %d"
949
+ msgstr "Fare clic per visualizzare lo screenshot in grandi dimensioni %d"
950
+
951
+ #: includes/i18n.php:573
952
+ msgid "Freemius Debug"
953
+ msgstr "Debug Freemius"
954
+
955
+ #: includes/i18n.php:575
956
+ msgctxt "as turned on"
957
+ msgid "On"
958
+ msgstr "Attivo"
959
+
960
+ #: includes/i18n.php:577
961
+ msgctxt "as turned off"
962
+ msgid "Off"
963
+ msgstr "Non attivo"
964
+
965
+ #: includes/i18n.php:579
966
+ msgctxt "as code debugging"
967
+ msgid "Debugging"
968
+ msgstr "Debugging"
969
+
970
+ #: includes/i18n.php:581
971
+ msgid "Freemius State"
972
+ msgstr "Stato di Freemius"
973
+
974
+ #: includes/i18n.php:583
975
+ msgctxt "as connection was successful"
976
+ msgid "Connected"
977
+ msgstr "Connesso"
978
+
979
+ #: includes/i18n.php:585
980
+ msgctxt "as connection blocked"
981
+ msgid "Blocked"
982
+ msgstr "Bloccato"
983
+
984
+ #: includes/i18n.php:587
985
+ msgctxt "as application program interface"
986
+ msgid "API"
987
+ msgstr "API"
988
+
989
+ #: includes/i18n.php:589
990
+ msgctxt "as software development kit versions"
991
+ msgid "SDK"
992
+ msgstr "SDK"
993
+
994
+ #: includes/i18n.php:591
995
+ msgctxt "as software development kit versions"
996
+ msgid "SDK Versions"
997
+ msgstr "Versioni SDK"
998
+
999
+ #: includes/i18n.php:595
1000
+ msgctxt "as plugin folder path"
1001
+ msgid "Plugin Path"
1002
+ msgstr "Percorso del plugin"
1003
+
1004
+ #: includes/i18n.php:597
1005
+ msgctxt "as sdk path"
1006
+ msgid "SDK Path"
1007
+ msgstr "Percorso SDK"
1008
+
1009
+ #: includes/i18n.php:599
1010
+ msgid "Add Ons of Plugin %s"
1011
+ msgstr "Add-on del Plugin %s"
1012
+
1013
+ #: includes/i18n.php:601
1014
+ msgid "Are you sure you want to delete all Freemius data?"
1015
+ msgstr "Sei sicuro di voler eliminare tutti i dati di Freemius?"
1016
+
1017
+ #: includes/i18n.php:605
1018
+ msgid "Actions"
1019
+ msgstr "Azioni"
1020
+
1021
+ #: includes/i18n.php:607
1022
+ msgid "Delete All Accounts"
1023
+ msgstr "Eliminare tutti gli account"
1024
+
1025
+ #: includes/i18n.php:609
1026
+ msgid "Start Fresh"
1027
+ msgstr "Inizia da capo"
1028
+
1029
+ #: includes/i18n.php:611
1030
+ msgid "Clear API Cache"
1031
+ msgstr "Elimina cache API"
1032
+
1033
+ #: includes/i18n.php:613
1034
+ msgid "Sync Data From Server"
1035
+ msgstr "Sincronizza i dati dal server"
1036
+
1037
+ #: includes/i18n.php:615
1038
+ msgid "Scheduled Crons"
1039
+ msgstr "Azioni programmate"
1040
+
1041
+ #: includes/i18n.php:617
1042
+ msgid "Plugins & Themes Sync"
1043
+ msgstr "Sincronizzazione plugin e temi"
1044
+
1045
+ #: includes/i18n.php:625
1046
+ msgctxt "as congratulations"
1047
+ msgid "Congrats"
1048
+ msgstr "Congratulazioni"
1049
+
1050
+ #: includes/i18n.php:627
1051
+ msgctxt "exclamation"
1052
+ msgid "Oops"
1053
+ msgstr "Ops"
1054
+
1055
+ #: includes/i18n.php:629
1056
+ msgctxt "interjection expressing joy or exuberance"
1057
+ msgid "Yee-haw"
1058
+ msgstr "Evvai"
1059
+
1060
+ #: includes/i18n.php:633
1061
+ msgctxt ""
1062
+ "(especially in electronic communication) used to express elation, "
1063
+ "enthusiasm, or triumph."
1064
+ msgid "W00t"
1065
+ msgstr "Forte"
1066
+
1067
+ #: includes/i18n.php:637
1068
+ msgctxt "a positive response"
1069
+ msgid "Right on"
1070
+ msgstr "Sì"
1071
+
1072
+ #: includes/i18n.php:639
1073
+ msgctxt ""
1074
+ "something somebody says when they are thinking about what you have just "
1075
+ "said. "
1076
+ msgid "Hmm"
1077
+ msgstr "Uhm"
1078
+
1079
+ #: includes/i18n.php:643
1080
+ msgid "O.K"
1081
+ msgstr "OK"
1082
+
1083
+ #: includes/i18n.php:645
1084
+ msgctxt "exclamation"
1085
+ msgid "Hey"
1086
+ msgstr "Hey"
1087
+
1088
+ #: includes/i18n.php:647
1089
+ msgctxt "advance notice of something that will need attention."
1090
+ msgid "Heads up"
1091
+ msgstr "Attenzione"
1092
+
1093
+ #: includes/i18n.php:657
1094
+ msgid "Seems like you got the latest release."
1095
+ msgstr "Sembra che tu abbia la versione più recente."
1096
+
1097
+ #: includes/i18n.php:659
1098
+ msgid "You are all good!"
1099
+ msgstr "Sei fantastico!"
1100
+
1101
+ #: includes/i18n.php:661
1102
+ msgid ""
1103
+ "Sorry, we could not complete the email update. Another user with the same "
1104
+ "email is already registered."
1105
+ msgstr "Siamo spiacenti, non siamo riusciti a completare l'aggiornamento via email. Un altro utente con lo stesso indirizzo email è già registrato."
1106
+
1107
+ #: includes/i18n.php:665
1108
+ msgid ""
1109
+ "If you would like to give up the ownership of the plugin's account to %s "
1110
+ "click the Change Ownership button."
1111
+ msgstr "Se vuoi cedere la proprietá dell'account del plugin a %s clicca su Cambia Proprietà."
1112
+
1113
+ #: includes/i18n.php:669
1114
+ msgid ""
1115
+ "Your email was successfully updated. You should receive an email with "
1116
+ "confirmation instructions in few moments."
1117
+ msgstr "Il tuo indirizzo email è stato aggiornato correttamente. Riceverai un'email con le istruzioni di conferma in pochi istanti."
1118
+
1119
+ #: includes/i18n.php:673
1120
+ msgid "Your name was successfully updated."
1121
+ msgstr "Il tuo nome è stato aggiornato correttamente."
1122
+
1123
+ #: includes/i18n.php:675
1124
+ msgid "You have successfully updated your %s."
1125
+ msgstr "Hai aggiornato con successo il tuo %s."
1126
+
1127
+ #: includes/i18n.php:677
1128
+ msgid "Please provide your full name."
1129
+ msgstr "Per favore inserisci il tuo nome completo."
1130
+
1131
+ #: includes/i18n.php:679
1132
+ msgid ""
1133
+ "Verification mail was just sent to %s. If you can't find it after 5 min, "
1134
+ "please check your spam box."
1135
+ msgstr "L'email di verifica è stata inviata a %s. Se dopo 5 minuti non è ancora arrivata, per favore controlla nella tua casella di posta indesiderata."
1136
+
1137
+ #: includes/i18n.php:683
1138
+ msgid ""
1139
+ "Just letting you know that the add-ons information of %s is being pulled "
1140
+ "from an external server."
1141
+ msgstr "Le informazioni sugli add-on di %s vengono scaricate da un server esterno."
1142
+
1143
+ #: includes/i18n.php:687
1144
+ msgid "No credit card required"
1145
+ msgstr "Nessuna carta di credito richiesta"
1146
+
1147
+ #: includes/i18n.php:689
1148
+ msgid "Premium plugin version was successfully activated."
1149
+ msgstr "La versione Premium del plugin è stata attivata correttamente."
1150
+
1151
+ #: includes/i18n.php:693
1152
+ msgid "The upgrade of %s was successfully completed."
1153
+ msgstr "L'aggiornamento di %s è stato completato con successo."
1154
+
1155
+ #: includes/i18n.php:695
1156
+ msgid "Your account was successfully activated with the %s plan."
1157
+ msgstr "Il tuo account è stato attivato correttamente con il piano %s."
1158
+
1159
+ #: includes/i18n.php:699
1160
+ msgid "Download the latest %s version now"
1161
+ msgstr "Scarica l'ultima versione di %s"
1162
+
1163
+ #: includes/i18n.php:701
1164
+ msgid "Please follow these steps to complete the upgrade"
1165
+ msgstr "Segui i passi seguenti per completare l'aggiornamento"
1166
+
1167
+ #: includes/i18n.php:705
1168
+ msgid "Download the latest %s version"
1169
+ msgstr "Scarica l'ultima versione di %s"
1170
+
1171
+ #: includes/i18n.php:707
1172
+ msgid "Download the latest version"
1173
+ msgstr "Scarica l'ultima versione"
1174
+
1175
+ #: includes/i18n.php:709
1176
+ msgid "Deactivate the free version"
1177
+ msgstr "Disattiva la versione gratuita"
1178
+
1179
+ #: includes/i18n.php:711
1180
+ msgid "Upload and activate the downloaded version"
1181
+ msgstr "Carica e attiva la versione scaricata"
1182
+
1183
+ #: includes/i18n.php:713
1184
+ msgid "How to upload and activate?"
1185
+ msgstr "Come faccio a caricare ed attivare?"
1186
+
1187
+ #: includes/i18n.php:715
1188
+ msgctxt "%s - product name, e.g. Facebook add-on was successfully..."
1189
+ msgid "%s Add-on was successfully purchased."
1190
+ msgstr "L' add-on %s è stato acquistato con successo."
1191
+
1192
+ #: includes/i18n.php:719
1193
+ msgid "Your %s Add-on plan was successfully upgraded."
1194
+ msgstr "Il piano del tuo add-on %s è stato aggiornato con successo."
1195
+
1196
+ #: includes/i18n.php:723
1197
+ msgid "Your email has been successfully verified - you are AWESOME!"
1198
+ msgstr "Il tuo indirizzo email è stato verificato con successo - SEI UN GRANDE!"
1199
+
1200
+ #: includes/i18n.php:727
1201
+ msgid "Your plan was successfully upgraded."
1202
+ msgstr "Il piano è stato aggiornato con successo."
1203
+
1204
+ #: includes/i18n.php:729
1205
+ msgid "Your plan was successfully changed to %s."
1206
+ msgstr "Il piano è stato cambiato con successo a %s."
1207
+
1208
+ #: includes/i18n.php:731
1209
+ msgid ""
1210
+ "Your license has expired. You can still continue using the free plugin "
1211
+ "forever."
1212
+ msgstr "La licenza è scaduta. È comunque possibile continuare ad utilizzare il plugin gratuito per sempre."
1213
+
1214
+ #: includes/i18n.php:735
1215
+ msgid ""
1216
+ "Your license has been cancelled. If you think it's a mistake, please contact"
1217
+ " support."
1218
+ msgstr "La tua licenza è stata cancellata. Se credi sia un errore, per favore contatta il supporto."
1219
+
1220
+ #: includes/i18n.php:739
1221
+ msgid "Your trial has been successfully started."
1222
+ msgstr "La versione di prova è stata avviata correttamente."
1223
+
1224
+ #: includes/i18n.php:741
1225
+ msgid "Your license was successfully activated."
1226
+ msgstr "La tua licenza è stata attivata correttamente."
1227
+
1228
+ #: includes/i18n.php:743
1229
+ msgid "It looks like your site currently doesn't have an active license."
1230
+ msgstr "Sembra che il tuo sito non disponga di alcuna licenza attiva."
1231
+
1232
+ #: includes/i18n.php:747
1233
+ msgid ""
1234
+ "Your license was successfully deactivated, you are back to the %s plan."
1235
+ msgstr "La tua licenza é stata disattivata con successo, sei tornato al piano %s."
1236
+
1237
+ #: includes/i18n.php:751
1238
+ msgid "It looks like the license deactivation failed."
1239
+ msgstr "Sembra che la disattivazione della licenza non sia riuscita."
1240
+
1241
+ #: includes/i18n.php:755
1242
+ msgid "It looks like the license could not be activated."
1243
+ msgstr "Sembra che la licenza non possa essere attivata."
1244
+
1245
+ #: includes/i18n.php:759
1246
+ msgid "Error received from the server:"
1247
+ msgstr "Errore ricevuto dal server:"
1248
+
1249
+ #: includes/i18n.php:761
1250
+ msgid ""
1251
+ "Your trial has expired. You can still continue using all our free features."
1252
+ msgstr "La versione di prova è scaduta. Si può comunque continuare a utilizzare tutte le nostre funzioni gratuite."
1253
+
1254
+ #: includes/i18n.php:765
1255
+ msgid ""
1256
+ "Your plan was successfully downgraded. Your %s plan license will expire in "
1257
+ "%s."
1258
+ msgstr "Il tuo piano è stato declassato con successo. La licenza del piano %s scadrà in %s."
1259
+
1260
+ #: includes/i18n.php:769
1261
+ msgid ""
1262
+ "Seems like we are having some temporary issue with your plan downgrade. "
1263
+ "Please try again in few minutes."
1264
+ msgstr "Stiamo avendo qualche problema temporaneo con il downgrade del piano. Riprova tra qualche minuto."
1265
+
1266
+ #: includes/i18n.php:773
1267
+ msgid ""
1268
+ "It looks like you are not in trial mode anymore so there's nothing to cancel"
1269
+ " :)"
1270
+ msgstr "Sembra che tu non stia più usando la prova gratuita, quindi non c'è niente che tu debba annullare :)"
1271
+
1272
+ #: includes/i18n.php:777
1273
+ msgid "Your %s free trial was successfully cancelled."
1274
+ msgstr "Il tuo periodo di prova gratuito %s è stato annullato con successo."
1275
+
1276
+ #: includes/i18n.php:781
1277
+ msgctxt "%s - numeric version number"
1278
+ msgid "Version %s was released."
1279
+ msgstr "La versione %s é stata rilasciata."
1280
+
1281
+ #: includes/i18n.php:785
1282
+ msgid "Please download %s."
1283
+ msgstr "Scarica %s."
1284
+
1285
+ #: includes/i18n.php:787
1286
+ msgctxt "%s - plan name, as the latest professional version here"
1287
+ msgid "the latest %s version here"
1288
+ msgstr "l'ultima versione %s é quì"
1289
+
1290
+ #: includes/i18n.php:791
1291
+ msgid ""
1292
+ "How do you like %s so far? Test all our %s premium features with a %d-day "
1293
+ "free trial."
1294
+ msgstr "Come sta andando con %s? Prova tutte le funzionalità premium di %s con una prova gratuita di %d giorni."
1295
+
1296
+ #: includes/i18n.php:795
1297
+ msgctxt "call to action"
1298
+ msgid "Start free trial"
1299
+ msgstr "Inizia il periodo di prova gratuito"
1300
+
1301
+ #: includes/i18n.php:797
1302
+ msgid "Starting trial"
1303
+ msgstr "Inizio del periodo di prova gratuito"
1304
+
1305
+ #: includes/i18n.php:799
1306
+ msgid "Please wait"
1307
+ msgstr "Attendere"
1308
+
1309
+ #: includes/i18n.php:801
1310
+ msgid ""
1311
+ "Seems like we are having some temporary issue with your trial cancellation. "
1312
+ "Please try again in few minutes."
1313
+ msgstr "Stiamo avendo qualche problema temporaneo con l'annullamento del periodo di prova. Riprova tra qualche minuto."
1314
+
1315
+ #: includes/i18n.php:805
1316
+ msgid "You already utilized a trial before."
1317
+ msgstr "Hai già utilizzato una prova gratuita in passato."
1318
+
1319
+ #: includes/i18n.php:807
1320
+ msgid "You are already running the plugin in a trial mode."
1321
+ msgstr "Stai già usando il plugin in modalità di prova gratuita."
1322
+
1323
+ #: includes/i18n.php:811
1324
+ msgid "Plan %s do not exist, therefore, can't start a trial."
1325
+ msgstr "Il piano %s non esiste, per questo motivo non è possibile iniziare il periodo di prova."
1326
+
1327
+ #: includes/i18n.php:815
1328
+ msgid "Plan %s does not support a trial period."
1329
+ msgstr "Il piano %s non supporta il periodo di prova."
1330
+
1331
+ #: includes/i18n.php:817
1332
+ msgid "None of the plugin's plans supports a trial period."
1333
+ msgstr "Non esiste alcun piano del plugin che offra il periodo di prova."
1334
+
1335
+ #: includes/i18n.php:821
1336
+ msgid ""
1337
+ "Unexpected API error. Please contact the plugin's author with the following "
1338
+ "error."
1339
+ msgstr "Errore inaspettato dell'API. Per favore contatta l'autore del plugin riportando il seguente errore."
1340
+
1341
+ #: includes/i18n.php:825
1342
+ msgid "No commitment for %s days - cancel anytime!"
1343
+ msgstr "Nessun impegno per %s giorni - puoi annullare in qualsiasi momento!"
1344
+
1345
+ #: includes/i18n.php:827
1346
+ msgid ""
1347
+ "Your license has expired. You can still continue using all the %s features, "
1348
+ "but you'll need to renew your license to continue getting updates and "
1349
+ "support."
1350
+ msgstr "La licenza è scaduta. È comunque possibile continuare a utilizzare tutte le funzionalità di %s, ma sarà necessario rinnovare la licenza per continuare a ricevere gli aggiornamenti ed il supporto."
1351
+
1352
+ #: includes/i18n.php:831
1353
+ msgid "Couldn't activate %s."
1354
+ msgstr "Non é stato possibile attivare %s."
1355
+
1356
+ #: includes/i18n.php:833
1357
+ msgid "Please contact us with the following message:"
1358
+ msgstr "Contattaci con il seguente messaggio:"
1359
+
1360
+ #: includes/i18n.php:835
1361
+ msgid ""
1362
+ "It looks like you are still on the %s plan. If you did upgrade or change "
1363
+ "your plan, it's probably an issue on our side - sorry."
1364
+ msgstr "Sembra che tu sia ancora usando il piano %s. Se hai effettuato un upgrade o cambiato il piano, è probabile che ci sia un problema nei nostri sistemi."
1365
+
1366
+ #: includes/i18n.php:839
1367
+ msgid "Please contact us here"
1368
+ msgstr "Contattaci qui"
1369
+
1370
+ #: includes/i18n.php:841
1371
+ msgid ""
1372
+ "I have upgraded my account but when I try to Sync the License, the plan "
1373
+ "remains %s."
1374
+ msgstr "Ho aggiornato il mio account, ma quando cerco di sincronizzare la licenza, il piano rimane %s."
1375
+
1376
+ #: includes/i18n.php:849
1377
+ msgid "From unknown reason, the API connectivity test failed."
1378
+ msgstr "Il test di connettività dell'API ha fallito per motivi sconosciuti."
1379
+
1380
+ #: includes/i18n.php:853
1381
+ msgid ""
1382
+ "It's probably a temporary issue on our end. Just to be sure, with your "
1383
+ "permission, would it be o.k to run another connectivity test?"
1384
+ msgstr "Si tratta probabilmente di un problema nei nostri sistemi. Per esserne sicuri, potresti darci il permesso di effettuare un ulteriore test della connettività? "
1385
+
1386
+ #: includes/i18n.php:857
1387
+ msgid ""
1388
+ "We use PHP cURL library for the API calls, which is a very common library "
1389
+ "and usually installed out of the box. Unfortunately, cURL is not installed "
1390
+ "on your server."
1391
+ msgstr "Utilizziamo la libreria PHP cURL per le chiamate alla nostra API. Questa libreria è molto comune ed è installata di base. Sfortunatamente cURL non è presente nel tuo server."
1392
+
1393
+ #: includes/i18n.php:861
1394
+ msgid ""
1395
+ "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1396
+ msgstr "Per un motivo sconosciuto, CloudFlare, il firewall che utilizziamo, blocca la connessione."
1397
+
1398
+ #: includes/i18n.php:865
1399
+ msgctxt "as pluginX requires an access to our API"
1400
+ msgid "%s requires an access to our API."
1401
+ msgstr "%s richiede un accesso alla nostra API."
1402
+
1403
+ #: includes/i18n.php:869
1404
+ msgid ""
1405
+ "It looks like your server is using Squid ACL (access control lists), which "
1406
+ "blocks the connection."
1407
+ msgstr "Sembra che il tuo server stia usando Squid ACL (lista per il controllo degli accessi) il quale blocca la connessione."
1408
+
1409
+ #: includes/i18n.php:873
1410
+ msgid "I don't know what is Squid or ACL, help me!"
1411
+ msgstr "Non ho idea di cosa sia Squid o ACL, aiutami!"
1412
+
1413
+ #: includes/i18n.php875, includes/i18n.php:889
1414
+ msgid ""
1415
+ "We'll make sure to contact your hosting company and resolve the issue. You "
1416
+ "will get a follow-up email to %s once we have an update."
1417
+ msgstr "Contatteremo il tuo hosting e risolveremo il problema. Riceverai un' email a %s non appena ci saranno aggiornamenti."
1418
+
1419
+ #: includes/i18n.php:879
1420
+ msgid "I'm a system administrator"
1421
+ msgstr "Sono un sistemista"
1422
+
1423
+ #: includes/i18n.php:881
1424
+ msgid ""
1425
+ "Great, please whitelist the following domains: %s. Once you done, deactivate"
1426
+ " the plugin and activate it again."
1427
+ msgstr "Perfetto, aggiungi alla whitelist i seguenti domini: %s. Una volta che hai fatto, disattiva il plugin e attivalo di nuovo."
1428
+
1429
+ #: includes/i18n.php:885
1430
+ msgid "I don't know what is cURL or how to install it, help me!"
1431
+ msgstr "Non ho idea di cosa sia cURL o come installarlo, aiutami!"
1432
+
1433
+ #: includes/i18n.php:893
1434
+ msgid ""
1435
+ "Great, please install cURL and enable it in your php.ini file. To make sure "
1436
+ "it was successfully activated, use 'phpinfo()'. Once activated, deactivate "
1437
+ "the plugin and reactivate it back again."
1438
+ msgstr "Perfetto, installa cURL ed attivalo nel tuo file php.ini. Per essere sicuro di averlo attivato con successo, usa \"phpinfo()\". Una volta attivato disattva il plugin e attivalo di nuovo."
1439
+
1440
+ #: includes/i18n.php:897
1441
+ msgid ""
1442
+ "We are sure it's an issue on our side and more than happy to resolve it for "
1443
+ "you ASAP if you give us a chance."
1444
+ msgstr "Siamo sicuri che sia un nostro problema e siamo più che felici di risolverlo per te al più presto. Per poter procedere abbiamo bisogno del tuo consenso."
1445
+
1446
+ #: includes/i18n.php:901
1447
+ msgid ""
1448
+ "Sorry for the inconvenience and we are here to help if you give us a chance."
1449
+ msgstr "Siamo spiacenti per l'inconveniente e siamo qui per aiutarti con il tuo permesso."
1450
+
1451
+ #: includes/i18n.php:905
1452
+ msgid "Yes - I'm giving you a chance to fix it"
1453
+ msgstr "Sì - sto dandovi la possibilità di risolvere il problema"
1454
+
1455
+ #: includes/i18n.php:907
1456
+ msgid ""
1457
+ "We will do our best to whitelist your server and resolve this issue ASAP. "
1458
+ "You will get a follow-up email to %s once we have an update."
1459
+ msgstr "Faremo del nostro meglio per mettere il server in whitelist e risolvere il problema il prima possibile. Avrai un aggiornamento dello stato tramite email all'indirizzo %s."
1460
+
1461
+ #: includes/i18n.php:911
1462
+ msgid "Let's try your previous version"
1463
+ msgstr "Proviamo con la versione precedente"
1464
+
1465
+ #: includes/i18n.php:913
1466
+ msgid "Uninstall this version and install the previous one."
1467
+ msgstr "Disinstalla questa versione e installa quella precedente."
1468
+
1469
+ #: includes/i18n.php:917
1470
+ msgid "That's exhausting, please deactivate"
1471
+ msgstr "È estenuante, disattivalo"
1472
+
1473
+ #: includes/i18n.php:919
1474
+ msgid ""
1475
+ "We feel your frustration and sincerely apologize for the inconvenience. Hope"
1476
+ " to see you again in the future."
1477
+ msgstr "Capiamo la tua frustrazione e ci scusiamo per l'inconveniente. Speriamo di rivederti nuovamente in futuro."
1478
+
1479
+ #: includes/i18n.php:923
1480
+ msgid ""
1481
+ "Thank for giving us the chance to fix it! A message was just sent to our "
1482
+ "technical staff. We will get back to you as soon as we have an update to %s."
1483
+ " Appreciate your patience."
1484
+ msgstr "Grazie per averci dato la possibilità di risolvere il problema! È stato appena inviato un messaggio al nostro staff tecnico. Ti risponderemo non appena avremo un aggiornamento riguardante %s. Grazie per la tua pazienza."
1485
+
1486
+ #: includes/i18n.php:927
1487
+ msgctxt "%1s - plugin title, %2s - API domain"
1488
+ msgid ""
1489
+ "Your server is blocking the access to Freemius' API, which is crucial for "
1490
+ "%1s synchronization. Please contact your host to whitelist %2s"
1491
+ msgstr "Il tuo server sta bloccando l'accesso all'API di Freemius. L'accesso è cruciale per quanto riguarda la la sincronizzazione di %1s. Per favore contatta il tuo host per aggiungere %2s alla whitelist."
1492
+
1493
+ #: includes/i18n.php:931
1494
+ msgid ""
1495
+ "It seems like one of the authentication parameters is wrong. Update your "
1496
+ "Public Key, Secret Key & User ID, and try again."
1497
+ msgstr "Sembra che uno dei parametri di autenticazione sia sbagliato. Aggiorna la tua chiave pubblica, Secret Key & User ID e riprova."
1498
+
1499
+ #: includes/i18n.php:939
1500
+ msgid ""
1501
+ "Please check your mailbox, you should receive an email via %s to confirm the"
1502
+ " ownership change. From security reasons, you must confirm the change within"
1503
+ " the next 15 min. If you cannot find the email, please check your spam "
1504
+ "folder."
1505
+ msgstr "Verifica di aver ricevuto l'email da %s per confermare il cambiamento del proprietario. Per ragioni di sicurezza devi confermare il cambiamento entro 15 minuti. Se non trovi l'email controlla nella posta indesiderata."
1506
+
1507
+ #: includes/i18n.php:943
1508
+ msgid ""
1509
+ "Thanks for confirming the ownership change. An email was just sent to %s for"
1510
+ " final approval."
1511
+ msgstr "Grazie per aver confermato il cambiamento del proprietario. Un' email è stata appena inviata a %s per la conferma finale."
1512
+
1513
+ #: includes/i18n.php:947
1514
+ msgid "%s is the new owner of the account."
1515
+ msgstr "%s è il nuovo proprietario dell'account."
1516
+
1517
+ #: includes/i18n.php:951
1518
+ msgctxt "addonX cannot run without pluginY"
1519
+ msgid "%s cannot run without %s."
1520
+ msgstr "%s non può funzionare senza %s."
1521
+
1522
+ #: includes/i18n.php:955
1523
+ msgctxt "addonX cannot run..."
1524
+ msgid "%s cannot run without the plugin."
1525
+ msgstr "%s non può funzionare senza il plugin."
1526
+
1527
+ #: includes/i18n.php:959
1528
+ msgctxt "pluginX activation was successfully..."
1529
+ msgid "%s activation was successfully completed."
1530
+ msgstr "%s è stato attivato con successo."
1531
+
1532
+ #: includes/i18n.php:963
1533
+ msgctxt "Plugin installer section title"
1534
+ msgid "Features & Pricing"
1535
+ msgstr "Caratteristiche & prezzi"
1536
+
1537
+ #: includes/i18n.php:967
1538
+ msgid "Add-on must be deployed to WordPress.org or Freemius."
1539
+ msgstr "L'add-on dev'essere distribuito da WordPress.org o Freemius."
1540
+
1541
+ #: includes/i18n.php:971
1542
+ msgid "Paid add-on must be deployed to Freemius."
1543
+ msgstr "Gli add-on a pagamento devono essere distribuiti da Freemius."
1544
+
1545
+ #: includes/i18n.php:979
1546
+ msgid ""
1547
+ "%s is a premium only add-on. You have to purchase a license first before "
1548
+ "activating the plugin."
1549
+ msgstr "%s è un add-on premium. Devi comprare una licenza prima di poter attivare il plugin."
1550
+
1551
+ #: includes/i18n.php:983
1552
+ msgid ""
1553
+ "%s free trial was successfully cancelled. Since the add-on is premium only "
1554
+ "it was automatically deactivated. If you like to use it in the future, "
1555
+ "you'll have to purchase a license."
1556
+ msgstr "Il periodo di prova gratuito %s è stato annullato con successo. Siccome l'add-on è premium, è stato disattivato automaticamente. Se vorrai usarlo in futuro, dovrai comprare una licenza."
1557
+
1558
+ #: includes/i18n.php:995
1559
+ msgctxt "as every month"
1560
+ msgid "Monthly"
1561
+ msgstr "Mensilmente"
1562
+
1563
+ #: includes/i18n.php:997
1564
+ msgctxt "as monthly period"
1565
+ msgid "mo"
1566
+ msgstr "mese"
1567
+
1568
+ #: includes/i18n.php:999
1569
+ msgctxt "as once a year"
1570
+ msgid "Annual"
1571
+ msgstr "Annuale"
1572
+
1573
+ #: includes/i18n.php:1001
1574
+ msgctxt "as once a year"
1575
+ msgid "Annually"
1576
+ msgstr "Annualmente"
1577
+
1578
+ #: includes/i18n.php:1003
1579
+ msgctxt "as once a year"
1580
+ msgid "Once"
1581
+ msgstr "Una volta"
1582
+
1583
+ #: includes/i18n.php:1005
1584
+ msgctxt "as annual period"
1585
+ msgid "year"
1586
+ msgstr "anno"
1587
+
1588
+ #: includes/i18n.php:1007
1589
+ msgid "Lifetime"
1590
+ msgstr "Tutta la vita"
1591
+
1592
+ #: includes/i18n.php:1009
1593
+ msgctxt "e.g. the best product"
1594
+ msgid "Best"
1595
+ msgstr "Migliore"
1596
+
1597
+ #: includes/i18n.php:1011
1598
+ msgctxt "e.g. billed monthly"
1599
+ msgid "Billed %s"
1600
+ msgstr "Fatturato %s"
1601
+
1602
+ #: includes/i18n.php:1013
1603
+ msgctxt "as a discount of $5 or 10%"
1604
+ msgid "Save %s"
1605
+ msgstr "Risparmia %s"
1606
+
1607
+ #: includes/i18n.php:1017
1608
+ msgid "View details"
1609
+ msgstr "Visualizza dettagli"
1610
+
1611
+ #: includes/i18n.php:1025
1612
+ msgctxt "button label"
1613
+ msgid "Approve & Start Trial"
1614
+ msgstr "Approva e inizia il periodo di prova gratuito"
1615
+
1616
+ #: includes/i18n.php:1029
1617
+ msgid ""
1618
+ "You are 1-click away from starting your %1$s-day free trial of the %2$s "
1619
+ "plan."
1620
+ msgstr "Sei a un clic di distanza dall'iniziare il tuo periodo di prova gratuito di %1$s giorni per il piano %2$s."
1621
+
1622
+ #: includes/i18n.php:1033
1623
+ msgid ""
1624
+ "For compliance with the WordPress.org guidelines, before we start the trial "
1625
+ "we ask that you opt-in with your user and non-sensitive site information, "
1626
+ "allowing the plugin to periodically send data to %s to check for version "
1627
+ "updates and to validate your trial."
1628
+ msgstr "Per seguire le linee guida di WordPress, prima di iniziare il periodo di prova ti chiediamo di iscriverti con il tuo utente e i dati non sensibili inerenti al tuo sito, così da permettere periodicamente al plugin di inviare dati a %s per poter controllare la presenza di nuove versioni e convalidare il tuo periodo di prova gratuito."
1629
+
1630
+ #: includes/i18n.php:1045
1631
+ msgid "Business name"
1632
+ msgstr "Nome della compagnia"
1633
+
1634
+ #: includes/i18n.php:1047
1635
+ msgid "Tax / VAT ID"
1636
+ msgstr "Numero Partita Iva o VAT"
1637
+
1638
+ #: includes/i18n.php:1049
1639
+ msgid "Address Line %d"
1640
+ msgstr "Riga indirizzo %d"
1641
+
1642
+ #: includes/i18n.php:1051
1643
+ msgid "Country"
1644
+ msgstr "Nazione"
1645
+
1646
+ #: includes/i18n.php:1053
1647
+ msgid "Select Country"
1648
+ msgstr "Seleziona Nazione"
1649
+
1650
+ #: includes/i18n.php:1055
1651
+ msgid "City"
1652
+ msgstr "Città"
1653
+
1654
+ #: includes/i18n.php:1057
1655
+ msgid "Town"
1656
+ msgstr "Cittadina"
1657
+
1658
+ #: includes/i18n.php:1059
1659
+ msgid "State"
1660
+ msgstr "Stato"
1661
+
1662
+ #: includes/i18n.php:1061
1663
+ msgid "Province"
1664
+ msgstr "Provincia"
1665
+
1666
+ #: includes/i18n.php:1063
1667
+ msgid "ZIP / Postal Code"
1668
+ msgstr "CAP"
freemius/languages/freemius.pot ADDED
@@ -0,0 +1,1525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2016 freemius
2
+ # This file is distributed under the same license as the freemius package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: freemius\n"
6
+ "Report-Msgid-Bugs-To: https://github.com/Freemius/wordpress-sdk/issues\n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=UTF-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
11
+ "Last-Translator: Vova Feldman <vova@freemius.com>\n"
12
+ "Language-Team: Freemius Team <admin@freemius.com>\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+ #: includes/i18n.php:41, includes/i18n.php:55
20
+ msgid "Yes - I'm in!"
21
+ msgstr ""
22
+
23
+ #: includes/i18n.php:43, includes/i18n.php:57
24
+ msgid "Not today"
25
+ msgstr ""
26
+
27
+ #: includes/i18n.php:69
28
+ msgid "Account"
29
+ msgstr ""
30
+
31
+ #: includes/i18n.php:71
32
+ msgid "Add On"
33
+ msgstr ""
34
+
35
+ #: includes/i18n.php:73
36
+ msgid "Contact Us"
37
+ msgstr ""
38
+
39
+ #: includes/i18n.php:75
40
+ msgid "Contact Support"
41
+ msgstr ""
42
+
43
+ #: includes/i18n.php:77
44
+ msgid "Change Ownership"
45
+ msgstr ""
46
+
47
+ #: includes/i18n.php:79
48
+ msgid "Support"
49
+ msgstr ""
50
+
51
+ #: includes/i18n.php:81
52
+ msgid "Support Forum"
53
+ msgstr ""
54
+
55
+ #: includes/i18n.php:83
56
+ msgid "Add Ons"
57
+ msgstr ""
58
+
59
+ #: includes/i18n.php:85
60
+ msgctxt "verb"
61
+ msgid "Upgrade"
62
+ msgstr ""
63
+
64
+ #: includes/i18n.php:87
65
+ msgid "Awesome"
66
+ msgstr ""
67
+
68
+ #: includes/i18n.php:89
69
+ msgctxt "noun"
70
+ msgid "Pricing"
71
+ msgstr ""
72
+
73
+ #: includes/i18n.php:91
74
+ msgctxt "noun"
75
+ msgid "Price"
76
+ msgstr ""
77
+
78
+ #: includes/i18n.php:93
79
+ msgid "Unlimited Updates"
80
+ msgstr ""
81
+
82
+ #: includes/i18n.php:95
83
+ msgctxt "verb"
84
+ msgid "Downgrade"
85
+ msgstr ""
86
+
87
+ #: includes/i18n.php:97
88
+ msgid "Cancel Trial"
89
+ msgstr ""
90
+
91
+ #: includes/i18n.php:99
92
+ msgid "Free Trial"
93
+ msgstr ""
94
+
95
+ #: includes/i18n.php:101
96
+ msgid "Start my free %s"
97
+ msgstr ""
98
+
99
+ #: includes/i18n.php:103
100
+ msgid "No commitment for %s - cancel anytime"
101
+ msgstr ""
102
+
103
+ #: includes/i18n.php:105
104
+ msgid "After your free %s, pay as little as %s"
105
+ msgstr ""
106
+
107
+ #: includes/i18n.php:107
108
+ msgid "Details"
109
+ msgstr ""
110
+
111
+ #: includes/i18n.php:109
112
+ msgid "Account Details"
113
+ msgstr ""
114
+
115
+ #: includes/i18n.php:111
116
+ msgctxt "verb"
117
+ msgid "Delete"
118
+ msgstr ""
119
+
120
+ #: includes/i18n.php:113
121
+ msgctxt "verb"
122
+ msgid "Show"
123
+ msgstr ""
124
+
125
+ #: includes/i18n.php:115
126
+ msgctxt "verb"
127
+ msgid "Hide"
128
+ msgstr ""
129
+
130
+ #: includes/i18n.php:117
131
+ msgctxt "verb"
132
+ msgid "Edit"
133
+ msgstr ""
134
+
135
+ #: includes/i18n.php:119
136
+ msgctxt "verb"
137
+ msgid "Update"
138
+ msgstr ""
139
+
140
+ #: includes/i18n.php:121
141
+ msgid "Date"
142
+ msgstr ""
143
+
144
+ #: includes/i18n.php:123
145
+ msgid "Amount"
146
+ msgstr ""
147
+
148
+ #: includes/i18n.php:125
149
+ msgid "Invoice"
150
+ msgstr ""
151
+
152
+ #: includes/i18n.php:127
153
+ msgid "Billing"
154
+ msgstr ""
155
+
156
+ #: includes/i18n.php:129
157
+ msgid "Payments"
158
+ msgstr ""
159
+
160
+ #: includes/i18n.php:131
161
+ msgid "Delete Account"
162
+ msgstr ""
163
+
164
+ #: includes/i18n.php:133
165
+ msgctxt "as close a window"
166
+ msgid "Dismiss"
167
+ msgstr ""
168
+
169
+ #: includes/i18n.php:135
170
+ msgctxt "as product pricing plan"
171
+ msgid "Plan"
172
+ msgstr ""
173
+
174
+ #: includes/i18n.php:137
175
+ msgid "Change Plan"
176
+ msgstr ""
177
+
178
+ #: includes/i18n.php:139
179
+ msgctxt "as download professional version"
180
+ msgid "Download %s Version"
181
+ msgstr ""
182
+
183
+ #: includes/i18n.php:141
184
+ msgctxt "as download professional version now"
185
+ msgid "Download %s version now"
186
+ msgstr ""
187
+
188
+ #: includes/i18n.php:145
189
+ msgctxt "as download latest version"
190
+ msgid "Download Latest"
191
+ msgstr ""
192
+
193
+ #: includes/i18n.php:147
194
+ msgctxt "E.g. you have a professional license."
195
+ msgid "You have a %s license."
196
+ msgstr ""
197
+
198
+ #: includes/i18n.php:151
199
+ msgid "New"
200
+ msgstr ""
201
+
202
+ #: includes/i18n.php:153
203
+ msgid "Free"
204
+ msgstr ""
205
+
206
+ #: includes/i18n.php:155
207
+ msgctxt "as trial plan"
208
+ msgid "Trial"
209
+ msgstr ""
210
+
211
+ #: includes/i18n.php:157
212
+ msgctxt "as starting a trial plan"
213
+ msgid "Start Trial"
214
+ msgstr ""
215
+
216
+ #: includes/i18n.php:159
217
+ msgctxt "verb"
218
+ msgid "Purchase"
219
+ msgstr ""
220
+
221
+ #: includes/i18n.php:161
222
+ msgid "Purchase License"
223
+ msgstr ""
224
+
225
+ #: includes/i18n.php:163
226
+ msgctxt "verb"
227
+ msgid "Buy"
228
+ msgstr ""
229
+
230
+ #: includes/i18n.php:165
231
+ msgid "Buy License"
232
+ msgstr ""
233
+
234
+ #: includes/i18n.php:167
235
+ msgid "Single Site License"
236
+ msgstr ""
237
+
238
+ #: includes/i18n.php:169
239
+ msgid "Unlimited Licenses"
240
+ msgstr ""
241
+
242
+ #: includes/i18n.php:171
243
+ msgid "Up to %s Sites"
244
+ msgstr ""
245
+
246
+ #: includes/i18n.php:173
247
+ msgid "%sRenew your license now%s to access version %s features and support."
248
+ msgstr ""
249
+
250
+ #: includes/i18n.php:177
251
+ msgid "Enter the email address you've used for the upgrade below and we will resend you the license key."
252
+ msgstr ""
253
+
254
+ #: includes/i18n.php:181
255
+ msgctxt "e.g. Professional Plan"
256
+ msgid "%s Plan"
257
+ msgstr ""
258
+
259
+ #: includes/i18n.php:183
260
+ msgid "You are just one step away - %s"
261
+ msgstr ""
262
+
263
+ #: includes/i18n.php:185
264
+ msgctxt "%s - plugin name. As complete \"Jetpack\" activation now"
265
+ msgid "Complete \"%s\" Activation Now"
266
+ msgstr ""
267
+
268
+ #: includes/i18n.php:189
269
+ msgid "We made a few tweaks to the plugin, %s"
270
+ msgstr ""
271
+
272
+ #: includes/i18n.php:191
273
+ msgid "Opt-in to make \"%s\" Better!"
274
+ msgstr ""
275
+
276
+ #: includes/i18n.php:193
277
+ msgid "Error"
278
+ msgstr ""
279
+
280
+ #: includes/i18n.php:195
281
+ msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
282
+ msgstr ""
283
+
284
+ #: includes/i18n.php:203
285
+ msgctxt "as expiration date"
286
+ msgid "Expiration"
287
+ msgstr ""
288
+
289
+ #: includes/i18n.php:205
290
+ msgctxt "as software license"
291
+ msgid "License"
292
+ msgstr ""
293
+
294
+ #: includes/i18n.php:207
295
+ msgid "not verified"
296
+ msgstr ""
297
+
298
+ #: includes/i18n.php:209
299
+ msgid "Verify Email"
300
+ msgstr ""
301
+
302
+ #: includes/i18n.php:211
303
+ msgctxt "e.g. expires in 2 months"
304
+ msgid "Expires in %s"
305
+ msgstr ""
306
+
307
+ #: includes/i18n.php:213
308
+ msgctxt "e.g. auto renews in 2 months"
309
+ msgid "Auto renews in %s"
310
+ msgstr ""
311
+
312
+ #: includes/i18n.php:215
313
+ msgid "No expiration"
314
+ msgstr ""
315
+
316
+ #: includes/i18n.php:217
317
+ msgid "Expired"
318
+ msgstr ""
319
+
320
+ #: includes/i18n.php:219
321
+ msgid "Cancelled"
322
+ msgstr ""
323
+
324
+ #: includes/i18n.php:221
325
+ msgctxt "e.g. In 2 hours"
326
+ msgid "In %s"
327
+ msgstr ""
328
+
329
+ #: includes/i18n.php:223
330
+ msgctxt "e.g. 2 min ago"
331
+ msgid "%s ago"
332
+ msgstr ""
333
+
334
+ #: includes/i18n.php:225
335
+ msgctxt "as plugin version"
336
+ msgid "Version"
337
+ msgstr ""
338
+
339
+ #: includes/i18n.php:227
340
+ msgid "Name"
341
+ msgstr ""
342
+
343
+ #: includes/i18n.php:229
344
+ msgid "Email"
345
+ msgstr ""
346
+
347
+ #: includes/i18n.php:231
348
+ msgid "Email address"
349
+ msgstr ""
350
+
351
+ #: includes/i18n.php:233
352
+ msgid "Verified"
353
+ msgstr ""
354
+
355
+ #: includes/i18n.php:235
356
+ msgid "Plugin"
357
+ msgstr ""
358
+
359
+ #: includes/i18n.php:237
360
+ msgid "Plugins"
361
+ msgstr ""
362
+
363
+ #: includes/i18n.php:239
364
+ msgid "Themes"
365
+ msgstr ""
366
+
367
+ #: includes/i18n.php:241
368
+ msgctxt "as file/folder path"
369
+ msgid "Path"
370
+ msgstr ""
371
+
372
+ #: includes/i18n.php:243
373
+ msgid "Title"
374
+ msgstr ""
375
+
376
+ #: includes/i18n.php:245
377
+ msgid "Free version"
378
+ msgstr ""
379
+
380
+ #: includes/i18n.php:247
381
+ msgid "Premium version"
382
+ msgstr ""
383
+
384
+ #: includes/i18n.php:249
385
+ msgctxt "as WP plugin slug"
386
+ msgid "Slug"
387
+ msgstr ""
388
+
389
+ #: includes/i18n.php:251
390
+ msgid "ID"
391
+ msgstr ""
392
+
393
+ #: includes/i18n.php:253
394
+ msgid "Users"
395
+ msgstr ""
396
+
397
+ #: includes/i18n.php:255
398
+ msgid "Plugin Installs"
399
+ msgstr ""
400
+
401
+ #: includes/i18n.php:257
402
+ msgctxt "like websites"
403
+ msgid "Sites"
404
+ msgstr ""
405
+
406
+ #: includes/i18n.php:259
407
+ msgid "User ID"
408
+ msgstr ""
409
+
410
+ #: includes/i18n.php:261
411
+ msgid "Site ID"
412
+ msgstr ""
413
+
414
+ #: includes/i18n.php:263
415
+ msgid "Public Key"
416
+ msgstr ""
417
+
418
+ #: includes/i18n.php:265
419
+ msgid "Secret Key"
420
+ msgstr ""
421
+
422
+ #: includes/i18n.php:267
423
+ msgctxt "as secret encryption key missing"
424
+ msgid "No Secret"
425
+ msgstr ""
426
+
427
+ #: includes/i18n.php:269
428
+ msgid "No ID"
429
+ msgstr ""
430
+
431
+ #: includes/i18n.php:271
432
+ msgctxt "as synchronize license"
433
+ msgid "Sync License"
434
+ msgstr ""
435
+
436
+ #: includes/i18n.php:273
437
+ msgctxt "as synchronize"
438
+ msgid "Sync"
439
+ msgstr ""
440
+
441
+ #: includes/i18n.php:275
442
+ msgid "Activate License"
443
+ msgstr ""
444
+
445
+ #: includes/i18n.php:277
446
+ msgid "Activate Free Version"
447
+ msgstr ""
448
+
449
+ #: includes/i18n.php:279
450
+ msgid "Please enter the license key that you received in the email right after the purchase:"
451
+ msgstr ""
452
+
453
+ #: includes/i18n.php:283
454
+ msgid "Activating license..."
455
+ msgstr ""
456
+
457
+ #: includes/i18n.php:285
458
+ msgid "Change License"
459
+ msgstr ""
460
+
461
+ #: includes/i18n.php:287
462
+ msgid "Update License"
463
+ msgstr ""
464
+
465
+ #: includes/i18n.php:289
466
+ msgid "Deactivate License"
467
+ msgstr ""
468
+
469
+ #: includes/i18n.php:291
470
+ msgid "Activate"
471
+ msgstr ""
472
+
473
+ #: includes/i18n.php:293
474
+ msgid "Deactivate"
475
+ msgstr ""
476
+
477
+ #: includes/i18n.php:295
478
+ msgid "Skip & Deactivate"
479
+ msgstr ""
480
+
481
+ #: includes/i18n.php:297
482
+ msgid "No - just deactivate"
483
+ msgstr ""
484
+
485
+ #: includes/i18n.php:299
486
+ msgid "Yes - do your thing"
487
+ msgstr ""
488
+
489
+ #: includes/i18n.php:301
490
+ msgctxt "active mode"
491
+ msgid "Active"
492
+ msgstr ""
493
+
494
+ #: includes/i18n.php:303
495
+ msgctxt "is active mode?"
496
+ msgid "Is Active"
497
+ msgstr ""
498
+
499
+ #: includes/i18n.php:305
500
+ msgid "Install Now"
501
+ msgstr ""
502
+
503
+ #: includes/i18n.php:307
504
+ msgid "Install Update Now"
505
+ msgstr ""
506
+
507
+ #: includes/i18n.php:309
508
+ msgid "More information about %s"
509
+ msgstr ""
510
+
511
+ #: includes/i18n.php:311
512
+ msgid "Localhost"
513
+ msgstr ""
514
+
515
+ #: includes/i18n.php:313
516
+ msgctxt "as activate Professional plan"
517
+ msgid "Activate %s Plan"
518
+ msgstr ""
519
+
520
+ #: includes/i18n.php:315
521
+ msgctxt "as 5 licenses left"
522
+ msgid "%s left"
523
+ msgstr ""
524
+
525
+ #: includes/i18n.php:317
526
+ msgid "Last license"
527
+ msgstr ""
528
+
529
+ #: includes/i18n.php:319
530
+ msgid "What is your %s?"
531
+ msgstr ""
532
+
533
+ #: includes/i18n.php:321
534
+ msgid "Activate this add-on"
535
+ msgstr ""
536
+
537
+ #: includes/i18n.php:323
538
+ msgid "Deactivating your license will block all premium features, but will enable you to activate the license on another site. Are you sure you want to proceed?"
539
+ msgstr ""
540
+
541
+ #: includes/i18n.php:327
542
+ msgid "Deleting the account will automatically deactivate your %s plan license so you can use it on other sites. If you want to terminate the recurring payments as well, click the \"Cancel\" button, and first \"Downgrade\" your account. Are you sure you would like to continue with the deletion?"
543
+ msgstr ""
544
+
545
+ #: includes/i18n.php:331
546
+ msgid "Deletion is not temporary. Only delete if you no longer want to use this plugin anymore. Are you sure you would like to continue with the deletion?"
547
+ msgstr ""
548
+
549
+ #: includes/i18n.php:335
550
+ msgid "Downgrading your plan will immediately stop all future recurring payments and your %s plan license will expire in %s."
551
+ msgstr ""
552
+
553
+ #: includes/i18n.php:339
554
+ msgid "Cancelling the trial will immediately block access to all premium features. Are you sure?"
555
+ msgstr ""
556
+
557
+ #: includes/i18n.php:343
558
+ msgid "You can still enjoy all %s features but you will not have access to plugin updates and support."
559
+ msgstr ""
560
+
561
+ #: includes/i18n.php:347
562
+ msgid "Once your license expire you can still use the Free version but you will NOT have access to the %s features."
563
+ msgstr ""
564
+
565
+ #: includes/i18n.php:351
566
+ msgid "Are you sure you want to proceed?"
567
+ msgstr ""
568
+
569
+ #: includes/i18n.php:357
570
+ msgid "Add Ons for %s"
571
+ msgstr ""
572
+
573
+ #: includes/i18n.php:359
574
+ msgid "We could'nt load the add-ons list. It's probably an issue on our side, please try to come back in few minutes."
575
+ msgstr ""
576
+
577
+ #: includes/i18n.php:365
578
+ msgid "Anonymous feedback"
579
+ msgstr ""
580
+
581
+ #: includes/i18n.php:367
582
+ msgid "Quick feedback"
583
+ msgstr ""
584
+
585
+ #: includes/i18n.php:369
586
+ msgid "If you have a moment, please let us know why you are deactivating"
587
+ msgstr ""
588
+
589
+ #: includes/i18n.php:373
590
+ msgid "Yes - Deactivate"
591
+ msgstr ""
592
+
593
+ #: includes/i18n.php:375
594
+ msgid "Submit & Deactivate"
595
+ msgstr ""
596
+
597
+ #: includes/i18n.php:377
598
+ msgid "Cancel"
599
+ msgstr ""
600
+
601
+ #: includes/i18n.php:379
602
+ msgid "I no longer need the plugin"
603
+ msgstr ""
604
+
605
+ #: includes/i18n.php:381
606
+ msgid "I found a better plugin"
607
+ msgstr ""
608
+
609
+ #: includes/i18n.php:383
610
+ msgid "I only needed the plugin for a short period"
611
+ msgstr ""
612
+
613
+ #: includes/i18n.php:385
614
+ msgid "The plugin broke my site"
615
+ msgstr ""
616
+
617
+ #: includes/i18n.php:387
618
+ msgid "The plugin suddenly stopped working"
619
+ msgstr ""
620
+
621
+ #: includes/i18n.php:389
622
+ msgid "I can't pay for it anymore"
623
+ msgstr ""
624
+
625
+ #: includes/i18n.php:391
626
+ msgid "It's a temporary deactivation. I'm just debugging an issue."
627
+ msgstr ""
628
+
629
+ #: includes/i18n.php:395
630
+ msgctxt "the text of the \"other\" reason for deactivating the plugin that is shown in the modal box."
631
+ msgid "Other"
632
+ msgstr ""
633
+
634
+ #: includes/i18n.php:399
635
+ msgid "Kindly tell us the reason so we can improve."
636
+ msgstr ""
637
+
638
+ #: includes/i18n.php:401
639
+ msgid "What's the plugin's name?"
640
+ msgstr ""
641
+
642
+ #: includes/i18n.php:403
643
+ msgid "What price would you feel comfortable paying?"
644
+ msgstr ""
645
+
646
+ #: includes/i18n.php:405
647
+ msgid "I couldn't understand how to make it work"
648
+ msgstr ""
649
+
650
+ #: includes/i18n.php:407
651
+ msgid "The plugin is great, but I need specific feature that you don't support"
652
+ msgstr ""
653
+
654
+ #: includes/i18n.php:411
655
+ msgid "The plugin is not working"
656
+ msgstr ""
657
+
658
+ #: includes/i18n.php:413
659
+ msgid "It's not what I was looking for"
660
+ msgstr ""
661
+
662
+ #: includes/i18n.php:415
663
+ msgid "The plugin didn't work as expected"
664
+ msgstr ""
665
+
666
+ #: includes/i18n.php:417
667
+ msgid "What feature?"
668
+ msgstr ""
669
+
670
+ #: includes/i18n.php:419
671
+ msgid "Kindly share what didn't work so we can fix it for future users..."
672
+ msgstr ""
673
+
674
+ #: includes/i18n.php:423
675
+ msgid "What you've been looking for?"
676
+ msgstr ""
677
+
678
+ #: includes/i18n.php:425
679
+ msgid "What did you expect?"
680
+ msgstr ""
681
+
682
+ #: includes/i18n.php:427
683
+ msgid "The plugin didn't work"
684
+ msgstr ""
685
+
686
+ #: includes/i18n.php:429
687
+ msgid "I don't like to share my information with you"
688
+ msgstr ""
689
+
690
+ #: includes/i18n.php:431
691
+ msgid "You might have missed it, but you don't have to share any data and can just %s the opt-in."
692
+ msgstr ""
693
+
694
+ #: includes/i18n.php:441
695
+ msgctxt "greeting"
696
+ msgid "Hey %s,"
697
+ msgstr ""
698
+
699
+ #: includes/i18n.php:443
700
+ msgctxt "a greeting. E.g. Thanks John!"
701
+ msgid "Thanks %s!"
702
+ msgstr ""
703
+
704
+ #: includes/i18n.php:445
705
+ msgid "Never miss an important update - opt-in to our security and feature updates notifications, and non-sensitive diagnostic tracking with %4$s."
706
+ msgstr ""
707
+
708
+ #: includes/i18n.php:449
709
+ msgid "Please help us improve %1$s! If you opt-in, some data about your usage of %1$s will be sent to %4$s. If you skip this, that's okay! %1$s will still work just fine."
710
+ msgstr ""
711
+
712
+ #: includes/i18n.php:453
713
+ msgid "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."
714
+ msgstr ""
715
+
716
+ #: includes/i18n.php:455
717
+ msgid "complete the install"
718
+ msgstr ""
719
+
720
+ #: includes/i18n.php:457
721
+ msgid "start the trial"
722
+ msgstr ""
723
+
724
+ #: includes/i18n.php:459
725
+ msgid "Thanks for purchasing %s! To get started, please enter your license key:"
726
+ msgstr ""
727
+
728
+ #: includes/i18n.php:463
729
+ msgid "The plugin will be periodically sending data to %s to check for plugin updates and verify the validity of your license."
730
+ msgstr ""
731
+
732
+ #: includes/i18n.php:467
733
+ msgid "What permissions are being granted?"
734
+ msgstr ""
735
+
736
+ #: includes/i18n.php:469
737
+ msgid "Your Profile Overview"
738
+ msgstr ""
739
+
740
+ #: includes/i18n.php:471
741
+ msgid "Name and email address"
742
+ msgstr ""
743
+
744
+ #: includes/i18n.php:473
745
+ msgid "Your Site Overview"
746
+ msgstr ""
747
+
748
+ #: includes/i18n.php:475
749
+ msgid "Site URL, WP version, PHP info, plugins & themes"
750
+ msgstr ""
751
+
752
+ #: includes/i18n.php:479
753
+ msgid "Current Plugin Events"
754
+ msgstr ""
755
+
756
+ #: includes/i18n.php:481
757
+ msgid "Activation, deactivation and uninstall"
758
+ msgstr ""
759
+
760
+ #: includes/i18n.php:483
761
+ msgid "Plugins & Themes"
762
+ msgstr ""
763
+
764
+ #: includes/i18n.php:485
765
+ msgid "Titles, versions and state."
766
+ msgstr ""
767
+
768
+ #: includes/i18n.php:487
769
+ msgid "Admin Notices"
770
+ msgstr ""
771
+
772
+ #: includes/i18n.php:489
773
+ msgid "Newsletter"
774
+ msgstr ""
775
+
776
+ #: includes/i18n.php:491
777
+ msgid "Updates, announcements, marketing, no spam"
778
+ msgstr ""
779
+
780
+ #: includes/i18n.php:493
781
+ msgid "Privacy Policy"
782
+ msgstr ""
783
+
784
+ #: includes/i18n.php:495
785
+ msgid "Terms of Service"
786
+ msgstr ""
787
+
788
+ #: includes/i18n.php:497
789
+ msgctxt "as activating plugin"
790
+ msgid "Activating"
791
+ msgstr ""
792
+
793
+ #: includes/i18n.php:499
794
+ msgctxt "as in the process of sending an email"
795
+ msgid "Sending email"
796
+ msgstr ""
797
+
798
+ #: includes/i18n.php:503
799
+ msgctxt "button label"
800
+ msgid "Allow & Continue"
801
+ msgstr ""
802
+
803
+ #: includes/i18n.php:505
804
+ msgctxt "button label"
805
+ msgid "Agree & Activate License"
806
+ msgstr ""
807
+
808
+ #: includes/i18n.php:507
809
+ msgctxt "verb"
810
+ msgid "Skip"
811
+ msgstr ""
812
+
813
+ #: includes/i18n.php:509
814
+ msgid "Click here to use the plugin anonymously"
815
+ msgstr ""
816
+
817
+ #: includes/i18n.php:511
818
+ msgid "Re-send activation email"
819
+ msgstr ""
820
+
821
+ #: includes/i18n.php:513
822
+ msgid "License key"
823
+ msgstr ""
824
+
825
+ #: includes/i18n.php:515
826
+ msgid "Send License Key"
827
+ msgstr ""
828
+
829
+ #: includes/i18n.php:517
830
+ msgid "Sending license key"
831
+ msgstr ""
832
+
833
+ #: includes/i18n.php:519
834
+ msgid "Have a license key?"
835
+ msgstr ""
836
+
837
+ #: includes/i18n.php:521
838
+ msgid "Don't have a license key?"
839
+ msgstr ""
840
+
841
+ #: includes/i18n.php:523
842
+ msgid "Can't find your license key?"
843
+ msgstr ""
844
+
845
+ #: includes/i18n.php:525
846
+ msgid "We couldn't find your email address in the system, are you sure it's the right address?"
847
+ msgstr ""
848
+
849
+ #: includes/i18n.php:529
850
+ msgid "We can't see any active licenses associated with that email address, are you sure it's the right address?"
851
+ msgstr ""
852
+
853
+ #: includes/i18n.php:533
854
+ msgid "Opt In"
855
+ msgstr ""
856
+
857
+ #: includes/i18n.php:535
858
+ msgid "Opt Out"
859
+ msgstr ""
860
+
861
+ #: includes/i18n.php:537
862
+ msgid "On second thought - I want to continue helping"
863
+ msgstr ""
864
+
865
+ #: includes/i18n.php:541
866
+ msgid "Opting out..."
867
+ msgstr ""
868
+
869
+ #: includes/i18n.php:543
870
+ msgid "Opting in..."
871
+ msgstr ""
872
+
873
+ #: includes/i18n.php:545
874
+ msgid "We appreciate your help in making the %s better by letting us track some usage data."
875
+ msgstr ""
876
+
877
+ #: includes/i18n.php:549
878
+ msgid "Usage tracking is done in the name of making %s better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking."
879
+ msgstr ""
880
+
881
+ #: includes/i18n.php:553
882
+ msgid "By clicking \"Opt Out\", we will no longer be sending any data from %s to %s."
883
+ msgstr ""
884
+
885
+ #: includes/i18n.php:563
886
+ msgid "Screenshots"
887
+ msgstr ""
888
+
889
+ #: includes/i18n.php:565
890
+ msgid "Click to view full-size screenshot %d"
891
+ msgstr ""
892
+
893
+ #: includes/i18n.php:573
894
+ msgid "Freemius Debug"
895
+ msgstr ""
896
+
897
+ #: includes/i18n.php:575
898
+ msgctxt "as turned on"
899
+ msgid "On"
900
+ msgstr ""
901
+
902
+ #: includes/i18n.php:577
903
+ msgctxt "as turned off"
904
+ msgid "Off"
905
+ msgstr ""
906
+
907
+ #: includes/i18n.php:579
908
+ msgctxt "as code debugging"
909
+ msgid "Debugging"
910
+ msgstr ""
911
+
912
+ #: includes/i18n.php:581
913
+ msgid "Freemius State"
914
+ msgstr ""
915
+
916
+ #: includes/i18n.php:583
917
+ msgctxt "as connection was successful"
918
+ msgid "Connected"
919
+ msgstr ""
920
+
921
+ #: includes/i18n.php:585
922
+ msgctxt "as connection blocked"
923
+ msgid "Blocked"
924
+ msgstr ""
925
+
926
+ #: includes/i18n.php:587
927
+ msgctxt "as application program interface"
928
+ msgid "API"
929
+ msgstr ""
930
+
931
+ #: includes/i18n.php:589
932
+ msgctxt "as software development kit versions"
933
+ msgid "SDK"
934
+ msgstr ""
935
+
936
+ #: includes/i18n.php:591
937
+ msgctxt "as software development kit versions"
938
+ msgid "SDK Versions"
939
+ msgstr ""
940
+
941
+ #: includes/i18n.php:595
942
+ msgctxt "as plugin folder path"
943
+ msgid "Plugin Path"
944
+ msgstr ""
945
+
946
+ #: includes/i18n.php:597
947
+ msgctxt "as sdk path"
948
+ msgid "SDK Path"
949
+ msgstr ""
950
+
951
+ #: includes/i18n.php:599
952
+ msgid "Add Ons of Plugin %s"
953
+ msgstr ""
954
+
955
+ #: includes/i18n.php:601
956
+ msgid "Are you sure you want to delete all Freemius data?"
957
+ msgstr ""
958
+
959
+ #: includes/i18n.php:605
960
+ msgid "Actions"
961
+ msgstr ""
962
+
963
+ #: includes/i18n.php:607
964
+ msgid "Delete All Accounts"
965
+ msgstr ""
966
+
967
+ #: includes/i18n.php:609
968
+ msgid "Start Fresh"
969
+ msgstr ""
970
+
971
+ #: includes/i18n.php:611
972
+ msgid "Clear API Cache"
973
+ msgstr ""
974
+
975
+ #: includes/i18n.php:613
976
+ msgid "Sync Data From Server"
977
+ msgstr ""
978
+
979
+ #: includes/i18n.php:615
980
+ msgid "Scheduled Crons"
981
+ msgstr ""
982
+
983
+ #: includes/i18n.php:617
984
+ msgid "Plugins & Themes Sync"
985
+ msgstr ""
986
+
987
+ #: includes/i18n.php:625
988
+ msgctxt "as congratulations"
989
+ msgid "Congrats"
990
+ msgstr ""
991
+
992
+ #: includes/i18n.php:627
993
+ msgctxt "exclamation"
994
+ msgid "Oops"
995
+ msgstr ""
996
+
997
+ #: includes/i18n.php:629
998
+ msgctxt "interjection expressing joy or exuberance"
999
+ msgid "Yee-haw"
1000
+ msgstr ""
1001
+
1002
+ #: includes/i18n.php:633
1003
+ msgctxt "(especially in electronic communication) used to express elation, enthusiasm, or triumph."
1004
+ msgid "W00t"
1005
+ msgstr ""
1006
+
1007
+ #: includes/i18n.php:637
1008
+ msgctxt "a positive response"
1009
+ msgid "Right on"
1010
+ msgstr ""
1011
+
1012
+ #: includes/i18n.php:639
1013
+ msgctxt "something somebody says when they are thinking about what you have just said. "
1014
+ msgid "Hmm"
1015
+ msgstr ""
1016
+
1017
+ #: includes/i18n.php:643
1018
+ msgid "O.K"
1019
+ msgstr ""
1020
+
1021
+ #: includes/i18n.php:645
1022
+ msgctxt "exclamation"
1023
+ msgid "Hey"
1024
+ msgstr ""
1025
+
1026
+ #: includes/i18n.php:647
1027
+ msgctxt "advance notice of something that will need attention."
1028
+ msgid "Heads up"
1029
+ msgstr ""
1030
+
1031
+ #: includes/i18n.php:657
1032
+ msgid "Seems like you got the latest release."
1033
+ msgstr ""
1034
+
1035
+ #: includes/i18n.php:659
1036
+ msgid "You are all good!"
1037
+ msgstr ""
1038
+
1039
+ #: includes/i18n.php:661
1040
+ msgid "Sorry, we could not complete the email update. Another user with the same email is already registered."
1041
+ msgstr ""
1042
+
1043
+ #: includes/i18n.php:665
1044
+ msgid "If you would like to give up the ownership of the plugin's account to %s click the Change Ownership button."
1045
+ msgstr ""
1046
+
1047
+ #: includes/i18n.php:669
1048
+ msgid "Your email was successfully updated. You should receive an email with confirmation instructions in few moments."
1049
+ msgstr ""
1050
+
1051
+ #: includes/i18n.php:673
1052
+ msgid "Your name was successfully updated."
1053
+ msgstr ""
1054
+
1055
+ #: includes/i18n.php:675
1056
+ msgid "You have successfully updated your %s."
1057
+ msgstr ""
1058
+
1059
+ #: includes/i18n.php:677
1060
+ msgid "Please provide your full name."
1061
+ msgstr ""
1062
+
1063
+ #: includes/i18n.php:679
1064
+ msgid "Verification mail was just sent to %s. If you can't find it after 5 min, please check your spam box."
1065
+ msgstr ""
1066
+
1067
+ #: includes/i18n.php:683
1068
+ msgid "Just letting you know that the add-ons information of %s is being pulled from an external server."
1069
+ msgstr ""
1070
+
1071
+ #: includes/i18n.php:687
1072
+ msgid "No credit card required"
1073
+ msgstr ""
1074
+
1075
+ #: includes/i18n.php:689
1076
+ msgid "Premium plugin version was successfully activated."
1077
+ msgstr ""
1078
+
1079
+ #: includes/i18n.php:693
1080
+ msgid "The upgrade of %s was successfully completed."
1081
+ msgstr ""
1082
+
1083
+ #: includes/i18n.php:695
1084
+ msgid "Your account was successfully activated with the %s plan."
1085
+ msgstr ""
1086
+
1087
+ #: includes/i18n.php:699
1088
+ msgid "Download the latest %s version now"
1089
+ msgstr ""
1090
+
1091
+ #: includes/i18n.php:701
1092
+ msgid "Please follow these steps to complete the upgrade"
1093
+ msgstr ""
1094
+
1095
+ #: includes/i18n.php:705
1096
+ msgid "Download the latest %s version"
1097
+ msgstr ""
1098
+
1099
+ #: includes/i18n.php:707
1100
+ msgid "Download the latest version"
1101
+ msgstr ""
1102
+
1103
+ #: includes/i18n.php:709
1104
+ msgid "Deactivate the free version"
1105
+ msgstr ""
1106
+
1107
+ #: includes/i18n.php:711
1108
+ msgid "Upload and activate the downloaded version"
1109
+ msgstr ""
1110
+
1111
+ #: includes/i18n.php:713
1112
+ msgid "How to upload and activate?"
1113
+ msgstr ""
1114
+
1115
+ #: includes/i18n.php:715
1116
+ msgctxt "%s - product name, e.g. Facebook add-on was successfully..."
1117
+ msgid "%s Add-on was successfully purchased."
1118
+ msgstr ""
1119
+
1120
+ #: includes/i18n.php:719
1121
+ msgid "Your %s Add-on plan was successfully upgraded."
1122
+ msgstr ""
1123
+
1124
+ #: includes/i18n.php:723
1125
+ msgid "Your email has been successfully verified - you are AWESOME!"
1126
+ msgstr ""
1127
+
1128
+ #: includes/i18n.php:727
1129
+ msgid "Your plan was successfully upgraded."
1130
+ msgstr ""
1131
+
1132
+ #: includes/i18n.php:729
1133
+ msgid "Your plan was successfully changed to %s."
1134
+ msgstr ""
1135
+
1136
+ #: includes/i18n.php:731
1137
+ msgid "Your license has expired. You can still continue using the free plugin forever."
1138
+ msgstr ""
1139
+
1140
+ #: includes/i18n.php:735
1141
+ msgid "Your license has been cancelled. If you think it's a mistake, please contact support."
1142
+ msgstr ""
1143
+
1144
+ #: includes/i18n.php:739
1145
+ msgid "Your trial has been successfully started."
1146
+ msgstr ""
1147
+
1148
+ #: includes/i18n.php:741
1149
+ msgid "Your license was successfully activated."
1150
+ msgstr ""
1151
+
1152
+ #: includes/i18n.php:743
1153
+ msgid "It looks like your site currently doesn't have an active license."
1154
+ msgstr ""
1155
+
1156
+ #: includes/i18n.php:747
1157
+ msgid "Your license was successfully deactivated, you are back to the %s plan."
1158
+ msgstr ""
1159
+
1160
+ #: includes/i18n.php:751
1161
+ msgid "It looks like the license deactivation failed."
1162
+ msgstr ""
1163
+
1164
+ #: includes/i18n.php:755
1165
+ msgid "It looks like the license could not be activated."
1166
+ msgstr ""
1167
+
1168
+ #: includes/i18n.php:759
1169
+ msgid "Error received from the server:"
1170
+ msgstr ""
1171
+
1172
+ #: includes/i18n.php:761
1173
+ msgid "Your trial has expired. You can still continue using all our free features."
1174
+ msgstr ""
1175
+
1176
+ #: includes/i18n.php:765
1177
+ msgid "Your plan was successfully downgraded. Your %s plan license will expire in %s."
1178
+ msgstr ""
1179
+
1180
+ #: includes/i18n.php:769
1181
+ msgid "Seems like we are having some temporary issue with your plan downgrade. Please try again in few minutes."
1182
+ msgstr ""
1183
+
1184
+ #: includes/i18n.php:773
1185
+ msgid "It looks like you are not in trial mode anymore so there's nothing to cancel :)"
1186
+ msgstr ""
1187
+
1188
+ #: includes/i18n.php:777
1189
+ msgid "Your %s free trial was successfully cancelled."
1190
+ msgstr ""
1191
+
1192
+ #: includes/i18n.php:781
1193
+ msgctxt "%s - numeric version number"
1194
+ msgid "Version %s was released."
1195
+ msgstr ""
1196
+
1197
+ #: includes/i18n.php:785
1198
+ msgid "Please download %s."
1199
+ msgstr ""
1200
+
1201
+ #: includes/i18n.php:787
1202
+ msgctxt "%s - plan name, as the latest professional version here"
1203
+ msgid "the latest %s version here"
1204
+ msgstr ""
1205
+
1206
+ #: includes/i18n.php:791
1207
+ msgid "How do you like %s so far? Test all our %s premium features with a %d-day free trial."
1208
+ msgstr ""
1209
+
1210
+ #: includes/i18n.php:795
1211
+ msgctxt "call to action"
1212
+ msgid "Start free trial"
1213
+ msgstr ""
1214
+
1215
+ #: includes/i18n.php:797
1216
+ msgid "Starting trial"
1217
+ msgstr ""
1218
+
1219
+ #: includes/i18n.php:799
1220
+ msgid "Please wait"
1221
+ msgstr ""
1222
+
1223
+ #: includes/i18n.php:801
1224
+ msgid "Seems like we are having some temporary issue with your trial cancellation. Please try again in few minutes."
1225
+ msgstr ""
1226
+
1227
+ #: includes/i18n.php:805
1228
+ msgid "You already utilized a trial before."
1229
+ msgstr ""
1230
+
1231
+ #: includes/i18n.php:807
1232
+ msgid "You are already running the plugin in a trial mode."
1233
+ msgstr ""
1234
+
1235
+ #: includes/i18n.php:811
1236
+ msgid "Plan %s do not exist, therefore, can't start a trial."
1237
+ msgstr ""
1238
+
1239
+ #: includes/i18n.php:815
1240
+ msgid "Plan %s does not support a trial period."
1241
+ msgstr ""
1242
+
1243
+ #: includes/i18n.php:817
1244
+ msgid "None of the plugin's plans supports a trial period."
1245
+ msgstr ""
1246
+
1247
+ #: includes/i18n.php:821
1248
+ msgid "Unexpected API error. Please contact the plugin's author with the following error."
1249
+ msgstr ""
1250
+
1251
+ #: includes/i18n.php:825
1252
+ msgid "No commitment for %s days - cancel anytime!"
1253
+ msgstr ""
1254
+
1255
+ #: includes/i18n.php:827
1256
+ msgid "Your license has expired. You can still continue using all the %s features, but you'll need to renew your license to continue getting updates and support."
1257
+ msgstr ""
1258
+
1259
+ #: includes/i18n.php:831
1260
+ msgid "Couldn't activate %s."
1261
+ msgstr ""
1262
+
1263
+ #: includes/i18n.php:833
1264
+ msgid "Please contact us with the following message:"
1265
+ msgstr ""
1266
+
1267
+ #: includes/i18n.php:835
1268
+ msgid "It looks like you are still on the %s plan. If you did upgrade or change your plan, it's probably an issue on our side - sorry."
1269
+ msgstr ""
1270
+
1271
+ #: includes/i18n.php:839
1272
+ msgid "Please contact us here"
1273
+ msgstr ""
1274
+
1275
+ #: includes/i18n.php:841
1276
+ msgid "I have upgraded my account but when I try to Sync the License, the plan remains %s."
1277
+ msgstr ""
1278
+
1279
+ #: includes/i18n.php:849
1280
+ msgid "From unknown reason, the API connectivity test failed."
1281
+ msgstr ""
1282
+
1283
+ #: includes/i18n.php:853
1284
+ msgid "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?"
1285
+ msgstr ""
1286
+
1287
+ #: includes/i18n.php:857
1288
+ msgid "We use PHP cURL library for the API calls, which is a very common library and usually installed out of the box. Unfortunately, cURL is not installed on your server."
1289
+ msgstr ""
1290
+
1291
+ #: includes/i18n.php:861
1292
+ msgid "From unknown reason, CloudFlare, the firewall we use, blocks the connection."
1293
+ msgstr ""
1294
+
1295
+ #: includes/i18n.php:865
1296
+ msgctxt "as pluginX requires an access to our API"
1297
+ msgid "%s requires an access to our API."
1298
+ msgstr ""
1299
+
1300
+ #: includes/i18n.php:869
1301
+ msgid "It looks like your server is using Squid ACL (access control lists), which blocks the connection."
1302
+ msgstr ""
1303
+
1304
+ #: includes/i18n.php:873
1305
+ msgid "I don't know what is Squid or ACL, help me!"
1306
+ msgstr ""
1307
+
1308
+ #: includes/i18n.php:875, includes/i18n.php:889
1309
+ msgid "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."
1310
+ msgstr ""
1311
+
1312
+ #: includes/i18n.php:879
1313
+ msgid "I'm a system administrator"
1314
+ msgstr ""
1315
+
1316
+ #: includes/i18n.php:881
1317
+ msgid "Great, please whitelist the following domains: %s. Once you done, deactivate the plugin and activate it again."
1318
+ msgstr ""
1319
+
1320
+ #: includes/i18n.php:885
1321
+ msgid "I don't know what is cURL or how to install it, help me!"
1322
+ msgstr ""
1323
+
1324
+ #: includes/i18n.php:893
1325
+ msgid "Great, please install cURL and enable it in your php.ini file. To make sure it was successfully activated, use 'phpinfo()'. Once activated, deactivate the plugin and reactivate it back again."
1326
+ msgstr ""
1327
+
1328
+ #: includes/i18n.php:897
1329
+ msgid "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."
1330
+ msgstr ""
1331
+
1332
+ #: includes/i18n.php:901
1333
+ msgid "Sorry for the inconvenience and we are here to help if you give us a chance."
1334
+ msgstr ""
1335
+
1336
+ #: includes/i18n.php:905
1337
+ msgid "Yes - I'm giving you a chance to fix it"
1338
+ msgstr ""
1339
+
1340
+ #: includes/i18n.php:907
1341
+ msgid "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."
1342
+ msgstr ""
1343
+
1344
+ #: includes/i18n.php:911
1345
+ msgid "Let's try your previous version"
1346
+ msgstr ""
1347
+
1348
+ #: includes/i18n.php:913
1349
+ msgid "Uninstall this version and install the previous one."
1350
+ msgstr ""
1351
+
1352
+ #: includes/i18n.php:917
1353
+ msgid "That's exhausting, please deactivate"
1354
+ msgstr ""
1355
+
1356
+ #: includes/i18n.php:919
1357
+ msgid "We feel your frustration and sincerely apologize for the inconvenience. Hope to see you again in the future."
1358
+ msgstr ""
1359
+
1360
+ #: includes/i18n.php:923
1361
+ msgid "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."
1362
+ msgstr ""
1363
+
1364
+ #: includes/i18n.php:927
1365
+ msgctxt "%1s - plugin title, %2s - API domain"
1366
+ msgid "Your server is blocking the access to Freemius' API, which is crucial for %1s synchronization. Please contact your host to whitelist %2s"
1367
+ msgstr ""
1368
+
1369
+ #: includes/i18n.php:931
1370
+ msgid "It seems like one of the authentication parameters is wrong. Update your Public Key, Secret Key & User ID, and try again."
1371
+ msgstr ""
1372
+
1373
+ #: includes/i18n.php:939
1374
+ msgid "Please check your mailbox, you should receive an email via %s to confirm the ownership change. From security reasons, you must confirm the change within the next 15 min. If you cannot find the email, please check your spam folder."
1375
+ msgstr ""
1376
+
1377
+ #: includes/i18n.php:943
1378
+ msgid "Thanks for confirming the ownership change. An email was just sent to %s for final approval."
1379
+ msgstr ""
1380
+
1381
+ #: includes/i18n.php:947
1382
+ msgid "%s is the new owner of the account."
1383
+ msgstr ""
1384
+
1385
+ #: includes/i18n.php:951
1386
+ msgctxt "addonX cannot run without pluginY"
1387
+ msgid "%s cannot run without %s."
1388
+ msgstr ""
1389
+
1390
+ #: includes/i18n.php:955
1391
+ msgctxt "addonX cannot run..."
1392
+ msgid "%s cannot run without the plugin."
1393
+ msgstr ""
1394
+
1395
+ #: includes/i18n.php:959
1396
+ msgctxt "pluginX activation was successfully..."
1397
+ msgid "%s activation was successfully completed."
1398
+ msgstr ""
1399
+
1400
+ #: includes/i18n.php:963
1401
+ msgctxt "Plugin installer section title"
1402
+ msgid "Features & Pricing"
1403
+ msgstr ""
1404
+
1405
+ #: includes/i18n.php:967
1406
+ msgid "Add-on must be deployed to WordPress.org or Freemius."
1407
+ msgstr ""
1408
+
1409
+ #: includes/i18n.php:971
1410
+ msgid "Paid add-on must be deployed to Freemius."
1411
+ msgstr ""
1412
+
1413
+ #: includes/i18n.php:979
1414
+ msgid "%s is a premium only add-on. You have to purchase a license first before activating the plugin."
1415
+ msgstr ""
1416
+
1417
+ #: includes/i18n.php:983
1418
+ msgid "%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."
1419
+ msgstr ""
1420
+
1421
+ #: includes/i18n.php:995
1422
+ msgctxt "as every month"
1423
+ msgid "Monthly"
1424
+ msgstr ""
1425
+
1426
+ #: includes/i18n.php:997
1427
+ msgctxt "as monthly period"
1428
+ msgid "mo"
1429
+ msgstr ""
1430
+
1431
+ #: includes/i18n.php:999
1432
+ msgctxt "as once a year"
1433
+ msgid "Annual"
1434
+ msgstr ""
1435
+
1436
+ #: includes/i18n.php:1001
1437
+ msgctxt "as once a year"
1438
+ msgid "Annually"
1439
+ msgstr ""
1440
+
1441
+ #: includes/i18n.php:1003
1442
+ msgctxt "as once a year"
1443
+ msgid "Once"
1444
+ msgstr ""
1445
+
1446
+ #: includes/i18n.php:1005
1447
+ msgctxt "as annual period"
1448
+ msgid "year"
1449
+ msgstr ""
1450
+
1451
+ #: includes/i18n.php:1007
1452
+ msgid "Lifetime"
1453
+ msgstr ""
1454
+
1455
+ #: includes/i18n.php:1009
1456
+ msgctxt "e.g. the best product"
1457
+ msgid "Best"
1458
+ msgstr ""
1459
+
1460
+ #: includes/i18n.php:1011
1461
+ msgctxt "e.g. billed monthly"
1462
+ msgid "Billed %s"
1463
+ msgstr ""
1464
+
1465
+ #: includes/i18n.php:1013
1466
+ msgctxt "as a discount of $5 or 10%"
1467
+ msgid "Save %s"
1468
+ msgstr ""
1469
+
1470
+ #: includes/i18n.php:1017
1471
+ msgid "View details"
1472
+ msgstr ""
1473
+
1474
+ #: includes/i18n.php:1025
1475
+ msgctxt "button label"
1476
+ msgid "Approve & Start Trial"
1477
+ msgstr ""
1478
+
1479
+ #: includes/i18n.php:1029
1480
+ msgid "You are 1-click away from starting your %1$s-day free trial of the %2$s plan."
1481
+ msgstr ""
1482
+
1483
+ #: includes/i18n.php:1033
1484
+ msgid "For compliance with the WordPress.org guidelines, before we start the trial we ask that you opt-in with your user and non-sensitive site information, allowing the plugin to periodically send data to %s to check for version updates and to validate your trial."
1485
+ msgstr ""
1486
+
1487
+ #: includes/i18n.php:1045
1488
+ msgid "Business name"
1489
+ msgstr ""
1490
+
1491
+ #: includes/i18n.php:1047
1492
+ msgid "Tax / VAT ID"
1493
+ msgstr ""
1494
+
1495
+ #: includes/i18n.php:1049
1496
+ msgid "Address Line %d"
1497
+ msgstr ""
1498
+
1499
+ #: includes/i18n.php:1051
1500
+ msgid "Country"
1501
+ msgstr ""
1502
+
1503
+ #: includes/i18n.php:1053
1504
+ msgid "Select Country"
1505
+ msgstr ""
1506
+
1507
+ #: includes/i18n.php:1055
1508
+ msgid "City"
1509
+ msgstr ""
1510
+
1511
+ #: includes/i18n.php:1057
1512
+ msgid "Town"
1513
+ msgstr ""
1514
+
1515
+ #: includes/i18n.php:1059
1516
+ msgid "State"
1517
+ msgstr ""
1518
+
1519
+ #: includes/i18n.php:1061
1520
+ msgid "Province"
1521
+ msgstr ""
1522
+
1523
+ #: includes/i18n.php:1063
1524
+ msgid "ZIP / Postal Code"
1525
+ msgstr ""
freemius/require.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.1.9
7
+ */
8
+
9
+ // Configuration should be loaded first.
10
+ require_once dirname( __FILE__ ) . '/config.php';
11
+
12
+ // Logger must be loaded before any other.
13
+ require_once WP_FS__DIR_INCLUDES . '/class-fs-logger.php';
14
+ require_once WP_FS__DIR_INCLUDES . '/debug/debug-bar-start.php';
15
+
16
+ require_once WP_FS__DIR_INCLUDES . '/fs-core-functions.php';
17
+ // require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-abstract-manager.php';
18
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-option-manager.php';
19
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-cache-manager.php';
20
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-notice-manager.php';
21
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-admin-menu-manager.php';
22
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-key-value-storage.php';
23
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-license-manager.php';
24
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plan-manager.php';
25
+ require_once WP_FS__DIR_INCLUDES . '/managers/class-fs-plugin-manager.php';
26
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-entity.php';
27
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-scope-entity.php';
28
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-user.php';
29
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-site.php';
30
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin.php';
31
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-info.php';
32
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-tag.php';
33
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-plan.php';
34
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-pricing.php';
35
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-payment.php';
36
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-plugin-license.php';
37
+ require_once WP_FS__DIR_INCLUDES . '/entities/class-fs-subscription.php';
38
+ require_once WP_FS__DIR_INCLUDES . '/class-fs-api.php';
39
+ require_once WP_FS__DIR_INCLUDES . '/class-fs-plugin-updater.php';
40
+ require_once WP_FS__DIR_INCLUDES . '/class-fs-security.php';
41
+ require_once WP_FS__DIR_INCLUDES . '/class-freemius-abstract.php';
42
+ require_once WP_FS__DIR_INCLUDES . '/sdk/Exceptions/Exception.php';
43
+ require_once WP_FS__DIR_INCLUDES . '/class-freemius.php';
freemius/start.php ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Freemius SDK Version.
15
+ *
16
+ * @var string
17
+ */
18
+ $this_sdk_version = '1.2.1.5';
19
+
20
+ #region SDK Selection Logic --------------------------------------------------------------------
21
+
22
+ /**
23
+ * Special logic added on 1.1.6 to make sure that every Freemius powered plugin
24
+ * will ALWAYS be loaded with the newest SDK from the active Freemius powered plugins.
25
+ *
26
+ * Since Freemius SDK is backward compatible, this will make sure that all Freemius powered
27
+ * plugins will run correctly.
28
+ *
29
+ * @since 1.1.6
30
+ */
31
+
32
+ global $fs_active_plugins;
33
+
34
+ $this_sdk_relative_path = plugin_basename( dirname( __FILE__ ) );
35
+
36
+ if ( ! isset( $fs_active_plugins ) ) {
37
+ // Require SDK essentials.
38
+ require_once dirname( __FILE__ ) . '/includes/fs-essential-functions.php';
39
+
40
+ // Load all Freemius powered active plugins.
41
+ $fs_active_plugins = get_option( 'fs_active_plugins', new stdClass() );
42
+
43
+ if ( ! isset( $fs_active_plugins->plugins ) ) {
44
+ $fs_active_plugins->plugins = array();
45
+ }
46
+ }
47
+
48
+ if ( ! function_exists( 'fs_find_direct_caller_plugin_file' ) ) {
49
+ require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-1.1.7.1.php';
50
+ }
51
+
52
+ // Update current SDK info based on the SDK path.
53
+ if ( ! isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) ||
54
+ $this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
55
+ ) {
56
+ $fs_active_plugins->plugins[ $this_sdk_relative_path ] = (object) array(
57
+ 'version' => $this_sdk_version,
58
+ 'timestamp' => time(),
59
+ 'plugin_path' => plugin_basename( fs_find_direct_caller_plugin_file( __FILE__ ) ),
60
+ );
61
+ }
62
+
63
+ $is_current_sdk_newest = isset( $fs_active_plugins->newest ) && ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path );
64
+
65
+ if ( ! isset( $fs_active_plugins->newest ) ) {
66
+ /**
67
+ * This will be executed only once, for the first time a Freemius powered plugin is activated.
68
+ */
69
+ fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
70
+
71
+ $is_current_sdk_newest = true;
72
+ } else if ( version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '<' ) ) {
73
+ /**
74
+ * Current SDK is newer than the newest stored SDK.
75
+ */
76
+ fs_update_sdk_newest_version( $this_sdk_relative_path, $fs_active_plugins->plugins[ $this_sdk_relative_path ]->plugin_path );
77
+
78
+ if ( class_exists( 'Freemius' ) ) {
79
+ // Older SDK version was already loaded.
80
+
81
+ if ( ! $fs_active_plugins->newest->in_activation ) {
82
+ // Re-order plugins to load this plugin first.
83
+ fs_newest_sdk_plugin_first();
84
+ }
85
+
86
+ // Refresh page.
87
+ fs_redirect( $_SERVER['REQUEST_URI'] );
88
+ }
89
+ } else {
90
+ if ( ! function_exists( 'get_plugins' ) ) {
91
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
92
+ }
93
+
94
+ $is_newest_sdk_plugin_activate = is_plugin_active( $fs_active_plugins->newest->plugin_path );
95
+
96
+ if ( $is_current_sdk_newest &&
97
+ ! $is_newest_sdk_plugin_activate &&
98
+ ! $fs_active_plugins->newest->in_activation
99
+ ) {
100
+ // If current SDK is the newest and the plugin is NOT active, it means
101
+ // that the current plugin in activation mode.
102
+ $fs_active_plugins->newest->in_activation = true;
103
+ update_option( 'fs_active_plugins', $fs_active_plugins );
104
+ }
105
+
106
+ $is_newest_sdk_path_valid = ( $is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation ) && file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $this_sdk_relative_path . '/start.php' ) );
107
+
108
+ if ( ! $is_newest_sdk_path_valid && ! $is_current_sdk_newest ) {
109
+ // Plugin with newest SDK is no longer active, or SDK was moved to a different location.
110
+ unset( $fs_active_plugins->plugins[ $fs_active_plugins->newest->sdk_path ] );
111
+ }
112
+
113
+ if ( ! ( $is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation ) ||
114
+ ! $is_newest_sdk_path_valid ||
115
+ // Is newest SDK downgraded.
116
+ ( $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
117
+ version_compare( $fs_active_plugins->newest->version, $this_sdk_version, '>' ) )
118
+ ) {
119
+ /**
120
+ * Plugin with newest SDK is no longer active.
121
+ * OR
122
+ * The newest SDK was in the current plugin. BUT, seems like the version of
123
+ * the SDK was downgraded to a lower SDK.
124
+ */
125
+ // Find the active plugin with the newest SDK version and update the newest reference.
126
+ fs_fallback_to_newest_active_sdk();
127
+ } else {
128
+ if ( $is_newest_sdk_plugin_activate &&
129
+ $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path &&
130
+ ( $fs_active_plugins->newest->in_activation ||
131
+ ( class_exists( 'Freemius' ) && ( ! defined( 'WP_FS__SDK_VERSION' ) || version_compare( WP_FS__SDK_VERSION, $this_sdk_version, '<' ) ) )
132
+ )
133
+
134
+ ) {
135
+ if ( $fs_active_plugins->newest->in_activation ) {
136
+ // Plugin no more in activation.
137
+ $fs_active_plugins->newest->in_activation = false;
138
+ update_option( 'fs_active_plugins', $fs_active_plugins );
139
+ }
140
+
141
+ // Reorder plugins to load plugin with newest SDK first.
142
+ if ( fs_newest_sdk_plugin_first() ) {
143
+ // Refresh page after re-order to make sure activated plugin loads newest SDK.
144
+ if ( class_exists( 'Freemius' ) ) {
145
+ fs_redirect( $_SERVER['REQUEST_URI'] );
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+
152
+ if ( class_exists( 'Freemius' ) ) {
153
+ // SDK was already loaded.
154
+ return;
155
+ }
156
+
157
+ if ( version_compare( $this_sdk_version, $fs_active_plugins->newest->version, '<' ) ) {
158
+ $newest_sdk_starter = fs_normalize_path( WP_PLUGIN_DIR . '/' . $fs_active_plugins->newest->sdk_path . '/start.php' );
159
+
160
+ if ( file_exists( $newest_sdk_starter ) ) {
161
+ // Reorder plugins to load plugin with newest SDK first.
162
+ fs_newest_sdk_plugin_first();
163
+
164
+ // There's a newer SDK version, load it instead of the current one!
165
+ require_once $newest_sdk_starter;
166
+
167
+ return;
168
+ }
169
+ }
170
+
171
+ #endregion SDK Selection Logic --------------------------------------------------------------------
172
+
173
+ #region Hooks & Filters Collection --------------------------------------------------------------------
174
+
175
+ /**
176
+ * Freemius hooks (actions & filters) tags structure:
177
+ *
178
+ * fs_{filter/action_name}_{plugin_slug}
179
+ *
180
+ * --------------------------------------------------------
181
+ *
182
+ * Usage with WordPress' add_action() / add_filter():
183
+ *
184
+ * add_action('fs_{filter/action_name}_{plugin_slug}', $callable);
185
+ *
186
+ * --------------------------------------------------------
187
+ *
188
+ * Usage with Freemius' instance add_action() / add_filter():
189
+ *
190
+ * // No need to add 'fs_' prefix nor '_{plugin_slug}' suffix.
191
+ * my_freemius()->add_action('{action_name}', $callable);
192
+ *
193
+ * --------------------------------------------------------
194
+ *
195
+ * Freemius filters collection:
196
+ *
197
+ * fs_connect_url_{plugin_slug}
198
+ * fs_trial_promotion_message_{plugin_slug}
199
+ * fs_is_long_term_user_{plugin_slug}
200
+ * fs_uninstall_reasons_{plugin_slug}
201
+ * fs_is_plugin_update_{plugin_slug}
202
+ * fs_api_domains_{plugin_slug}
203
+ * fs_email_template_sections_{plugin_slug}
204
+ * fs_support_forum_submenu_{plugin_slug}
205
+ * fs_support_forum_url_{plugin_slug}
206
+ * fs_connect_message_{plugin_slug}
207
+ * fs_connect_message_on_update_{plugin_slug}
208
+ * fs_uninstall_confirmation_message_{plugin_slug}
209
+ * fs_pending_activation_message_{plugin_slug}
210
+ * fs_is_submenu_visible_{plugin_slug}
211
+ * fs_plugin_icon_{plugin_slug}
212
+ * fs_show_trial_{plugin_slug}
213
+ *
214
+ * --------------------------------------------------------
215
+ *
216
+ * Freemius actions collection:
217
+ *
218
+ * fs_after_license_loaded_{plugin_slug}
219
+ * fs_after_license_change_{plugin_slug}
220
+ * fs_after_plans_sync_{plugin_slug}
221
+ *
222
+ * fs_after_account_details_{plugin_slug}
223
+ * fs_after_account_user_sync_{plugin_slug}
224
+ * fs_after_account_plan_sync_{plugin_slug}
225
+ * fs_before_account_load_{plugin_slug}
226
+ * fs_after_account_connection_{plugin_slug}
227
+ * fs_account_property_edit_{plugin_slug}
228
+ * fs_account_email_verified_{plugin_slug}
229
+ * fs_account_page_load_before_departure_{plugin_slug}
230
+ * fs_before_account_delete_{plugin_slug}
231
+ * fs_after_account_delete_{plugin_slug}
232
+ *
233
+ * fs_sdk_version_update_{plugin_slug}
234
+ * fs_plugin_version_update_{plugin_slug}
235
+ *
236
+ * fs_initiated_{plugin_slug}
237
+ * fs_after_init_plugin_registered_{plugin_slug}
238
+ * fs_after_init_plugin_anonymous_{plugin_slug}
239
+ * fs_after_init_plugin_pending_activations_{plugin_slug}
240
+ * fs_after_init_addon_registered_{plugin_slug}
241
+ * fs_after_init_addon_anonymous_{plugin_slug}
242
+ * fs_after_init_addon_pending_activations_{plugin_slug}
243
+ *
244
+ * fs_after_premium_version_activation_{plugin_slug}
245
+ * fs_after_free_version_reactivation_{plugin_slug}
246
+ *
247
+ * fs_after_uninstall_{plugin_slug}
248
+ * fs_before_admin_menu_init_{plugin_slug}
249
+ */
250
+
251
+ #endregion Hooks & Filters Collection --------------------------------------------------------------------
252
+
253
+ if ( ! class_exists( 'Freemius' ) ) {
254
+
255
+ if ( ! defined( 'WP_FS__SDK_VERSION' ) ) {
256
+ define( 'WP_FS__SDK_VERSION', $this_sdk_version );
257
+ }
258
+
259
+ // Load SDK files.
260
+ require_once dirname( __FILE__ ) . '/require.php';
261
+
262
+ /**
263
+ * Quick shortcut to get Freemius for specified plugin.
264
+ * Used by various templates.
265
+ *
266
+ * @param string $slug
267
+ *
268
+ * @return Freemius
269
+ */
270
+ function freemius( $slug ) {
271
+ return Freemius::instance( $slug );
272
+ }
273
+
274
+ /**
275
+ * @param string $slug
276
+ * @param number $plugin_id
277
+ * @param string $public_key
278
+ * @param bool $is_live Is live or test plugin.
279
+ * @param bool $is_premium Hints freemius if running the premium plugin or not.
280
+ *
281
+ * @return Freemius
282
+ *
283
+ * @deprecated Please use fs_dynamic_init().
284
+ */
285
+ function fs_init( $slug, $plugin_id, $public_key, $is_live = true, $is_premium = true ) {
286
+ $fs = Freemius::instance( $slug, true );
287
+ $fs->init( $plugin_id, $public_key, $is_live, $is_premium );
288
+
289
+ return $fs;
290
+ }
291
+
292
+ /**
293
+ * @param array<string,string> $module Plugin or Theme details.
294
+ *
295
+ * @return Freemius
296
+ * @throws Freemius_Exception
297
+ */
298
+ function fs_dynamic_init( $module ) {
299
+ $fs = Freemius::instance( $module['slug'], true );
300
+ $fs->dynamic_init( $module );
301
+
302
+ return $fs;
303
+ }
304
+
305
+ function fs_dump_log() {
306
+ FS_Logger::dump();
307
+ }
308
+ }
freemius/templates/account.php ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $slug = $VARS['slug'];
17
+ /**
18
+ * @var Freemius $fs
19
+ */
20
+ $fs = freemius( $slug );
21
+
22
+ /**
23
+ * @var FS_Plugin_Tag $update
24
+ */
25
+ $update = $fs->get_update( false, false );
26
+
27
+ $is_paying = $fs->is_paying();
28
+ $user = $fs->get_user();
29
+ $site = $fs->get_site();
30
+ $name = $user->get_name();
31
+ $license = $fs->_get_license();
32
+ $subscription = $fs->_get_subscription();
33
+ $plan = $fs->get_plan();
34
+ $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
35
+ $is_paid_trial = $fs->is_paid_trial();
36
+ $show_upgrade = ( $fs->has_paid_plan() && ! $is_paying && ! $is_paid_trial );
37
+
38
+ if ( $show_upgrade ) {
39
+ $fs->_add_license_activation_dialog_box();
40
+ }
41
+ ?>
42
+ <div class="wrap">
43
+ <h2 class="nav-tab-wrapper">
44
+ <a href="<?php echo $fs->get_account_url() ?>"
45
+ class="nav-tab nav-tab-active"><?php _efs( 'account', $slug ) ?></a>
46
+ <?php if ( $fs->has_addons() ) : ?>
47
+ <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
48
+ class="nav-tab"><?php _efs( 'add-ons', $slug ) ?></a>
49
+ <?php endif ?>
50
+ <?php if ( $show_upgrade ) : ?>
51
+ <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade', $slug ) ?></a>
52
+ <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
53
+ <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php _efs( 'free-trial', $slug ) ?></a>
54
+ <?php endif ?>
55
+ <?php endif ?>
56
+ <?php if ( ! $plan->is_free() ) : ?>
57
+ <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
58
+ class="nav-tab"><?php _efs( 'billing', $slug ) ?></a>
59
+ <?php endif ?>
60
+ </h2>
61
+
62
+ <div id="poststuff">
63
+ <div id="fs_account">
64
+ <div class="has-sidebar has-right-sidebar">
65
+ <div class="has-sidebar-content">
66
+ <div class="postbox">
67
+ <h3><?php _efs( 'account-details', $slug ) ?></h3>
68
+
69
+ <div class="fs-header-actions">
70
+ <ul>
71
+ <li>
72
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
73
+ <input type="hidden" name="fs_action" value="delete_account">
74
+ <?php wp_nonce_field( 'delete_account' ) ?>
75
+ <a href="#" onclick="if (confirm('<?php
76
+ if ( $is_active_subscription ) {
77
+ echo esc_attr( sprintf( __fs( 'delete-account-x-confirm', $slug ), $plan->title ) );
78
+ } else {
79
+ _efs( 'delete-account-confirm', $slug );
80
+ }
81
+ ?>')) this.parentNode.submit(); return false;"><i
82
+ class="dashicons dashicons-no"></i> <?php _efs( 'delete-account', $slug ) ?></a>
83
+ </form>
84
+ </li>
85
+ <?php if ( $is_paying ) : ?>
86
+ <li>
87
+ &nbsp;&bull;&nbsp;
88
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
89
+ <input type="hidden" name="fs_action" value="deactivate_license">
90
+ <?php wp_nonce_field( 'deactivate_license' ) ?>
91
+ <a href="#"
92
+ onclick="if (confirm('<?php _efs( 'deactivate-license-confirm', $slug ) ?>')) this.parentNode.submit(); return false;"><i
93
+ class="dashicons dashicons-admin-network"></i> <?php _efs( 'deactivate-license', $slug ) ?>
94
+ </a>
95
+ </form>
96
+ </li>
97
+ <?php if ( ! $license->is_lifetime() &&
98
+ $is_active_subscription
99
+ ) : ?>
100
+ <li>
101
+ &nbsp;&bull;&nbsp;
102
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
103
+ <input type="hidden" name="fs_action" value="downgrade_account">
104
+ <?php wp_nonce_field( 'downgrade_account' ) ?>
105
+ <a href="#"
106
+ onclick="if (confirm('<?php printf( __fs( 'downgrade-x-confirm', $slug ), $plan->title, human_time_diff( time(), strtotime( $license->expiration ) ) ) ?> <?php if ( ! $license->is_block_features ) {
107
+ printf( __fs( 'after-downgrade-non-blocking', $slug ), $plan->title );
108
+ } else {
109
+ printf( __fs( 'after-downgrade-blocking', $slug ), $plan->title );
110
+ }?> <?php _efs( 'proceed-confirmation', $slug ) ?>')) this.parentNode.submit(); return false;"><i
111
+ class="dashicons dashicons-download"></i> <?php _efs( 'downgrade', $slug ) ?></a>
112
+ </form>
113
+ </li>
114
+ <?php endif ?>
115
+ <li>
116
+ &nbsp;&bull;&nbsp;
117
+ <a href="<?php echo $fs->get_upgrade_url() ?>"><i
118
+ class="dashicons dashicons-grid-view"></i> <?php _efs( 'change-plan', $slug ) ?></a>
119
+ </li>
120
+ <?php elseif ( $is_paid_trial ) : ?>
121
+ <li>
122
+ &nbsp;&bull;&nbsp;
123
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
124
+ <input type="hidden" name="fs_action" value="cancel_trial">
125
+ <?php wp_nonce_field( 'cancel_trial' ) ?>
126
+ <a href="#"
127
+ onclick="if (confirm('<?php _efs( 'cancel-trial-confirm' ) ?>')) this.parentNode.submit(); return false;"><i
128
+ class="dashicons dashicons-download"></i> <?php _efs( 'cancel-trial', $slug ) ?></a>
129
+ </form>
130
+ </li>
131
+ <?php endif ?>
132
+ <li>
133
+ &nbsp;&bull;&nbsp;
134
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
135
+ <input type="hidden" name="fs_action" value="<?php echo $slug ?>_sync_license">
136
+ <?php wp_nonce_field( $slug . '_sync_license' ) ?>
137
+ <a href="#" onclick="this.parentNode.submit(); return false;"><i
138
+ class="dashicons dashicons-image-rotate"></i> <?php _efs( 'sync', $slug ) ?></a>
139
+ </form>
140
+ </li>
141
+
142
+ </ul>
143
+ </div>
144
+ <div class="inside">
145
+ <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
146
+ <?php
147
+ $profile = array();
148
+ $profile[] = array(
149
+ 'id' => 'user_name',
150
+ 'title' => __fs( 'name', $slug ),
151
+ 'value' => $name
152
+ );
153
+ // if (isset($user->email) && false !== strpos($user->email, '@'))
154
+ $profile[] = array(
155
+ 'id' => 'email',
156
+ 'title' => __fs( 'email', $slug ),
157
+ 'value' => $user->email
158
+ );
159
+
160
+ if ( is_numeric( $user->id ) ) {
161
+ $profile[] = array(
162
+ 'id' => 'user_id',
163
+ 'title' => __fs( 'user-id', $slug ),
164
+ 'value' => $user->id
165
+ );
166
+ }
167
+
168
+ $profile[] = array(
169
+ 'id' => 'site_id',
170
+ 'title' => __fs( 'site-id', $slug ),
171
+ 'value' => is_string( $site->id ) ?
172
+ $site->id :
173
+ __fs( 'no-id', $slug )
174
+ );
175
+
176
+ $profile[] = array(
177
+ 'id' => 'site_public_key',
178
+ 'title' => __fs( 'public-key', $slug ),
179
+ 'value' => $site->public_key
180
+ );
181
+
182
+ $profile[] = array(
183
+ 'id' => 'site_secret_key',
184
+ 'title' => __fs( 'secret-key', $slug ),
185
+ 'value' => ( ( is_string( $site->secret_key ) ) ?
186
+ $site->secret_key :
187
+ __fs( 'no-secret', $slug )
188
+ )
189
+ );
190
+
191
+ $profile[] = array(
192
+ 'id' => 'version',
193
+ 'title' => __fs( 'version', $slug ),
194
+ 'value' => $fs->get_plugin_version()
195
+ );
196
+
197
+ if ( $fs->has_paid_plan() ) {
198
+ if ( $fs->is_trial() ) {
199
+ $trial_plan = $fs->get_trial_plan();
200
+
201
+ $profile[] = array(
202
+ 'id' => 'plan',
203
+ 'title' => __fs( 'plan', $slug ),
204
+ 'value' => ( is_string( $trial_plan->name ) ?
205
+ strtoupper( $trial_plan->title ) :
206
+ __fs( 'trial', $slug ) )
207
+ );
208
+ } else {
209
+ $profile[] = array(
210
+ 'id' => 'plan',
211
+ 'title' => __fs( 'plan', $slug ),
212
+ 'value' => is_string( $site->plan->name ) ?
213
+ strtoupper( $site->plan->title ) :
214
+ strtoupper( __fs( 'free', $slug ) )
215
+ );
216
+
217
+ if ( is_object( $license ) ) {
218
+ $profile[] = array(
219
+ 'id' => 'license_key',
220
+ 'title' => __fs( 'License Key', $slug ),
221
+ 'value' => $license->secret_key,
222
+ );
223
+ }
224
+ }
225
+ }
226
+ ?>
227
+ <?php $odd = true;
228
+ foreach ( $profile as $p ) : ?>
229
+ <?php
230
+ if ( 'plan' === $p['id'] && ! $fs->has_paid_plan() ) {
231
+ // If plugin don't have any paid plans, there's no reason
232
+ // to show current plan.
233
+ continue;
234
+ }
235
+ ?>
236
+ <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
237
+ <td>
238
+ <nobr><?php echo $p['title'] ?>:</nobr>
239
+ </td>
240
+ <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
241
+ <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
242
+ <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
243
+ <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
244
+ readonly/>
245
+ <?php else : ?>
246
+ <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
247
+ <?php endif ?>
248
+ <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
249
+ <label class="fs-tag fs-warn"><?php _efs( 'not-verified', $slug ) ?></label>
250
+ <?php endif ?>
251
+ <?php if ( 'plan' === $p['id'] ) : ?>
252
+ <?php if ( $fs->is_trial() ) : ?>
253
+ <label class="fs-tag fs-success"><?php _efs( 'trial', $slug ) ?></label>
254
+ <?php endif ?>
255
+ <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
256
+ <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
257
+ <label
258
+ class="fs-tag fs-warn"><?php printf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ) ?></label>
259
+ <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
260
+ <label
261
+ class="fs-tag fs-success"><?php printf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ?></label>
262
+ <?php endif ?>
263
+ <?php elseif ( $fs->is_trial() ) : ?>
264
+ <label
265
+ class="fs-tag fs-warn"><?php printf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ?></label>
266
+ <?php endif ?>
267
+ <div class="button-group">
268
+ <?php $available_license = $fs->is_free_plan() ? $fs->_get_available_premium_license() : false ?>
269
+ <?php if ( false !== $available_license && ( $available_license->left() > 0 || ( $site->is_localhost() && $available_license->is_free_localhost ) ) ) : ?>
270
+ <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
271
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
272
+ method="POST">
273
+ <input type="hidden" name="fs_action" value="activate_license">
274
+ <input type="hidden" name="license_id" value="<?php echo $available_license->id ?>">
275
+ <?php wp_nonce_field( 'activate_license' ) ?>
276
+ <input type="submit" class="button button-primary"
277
+ value="<?php printf(
278
+ __fs( 'activate-x-plan', $slug ) . '%s',
279
+ $premium_plan->title,
280
+ ( $site->is_localhost() && $available_license->is_free_localhost ) ?
281
+ ' [' . __fs( 'localhost', $slug ) . ']' :
282
+ ( $available_license->is_single_site() ?
283
+ '' :
284
+ ' [' . ( 1 < $available_license->left() ?
285
+ sprintf( __fs( 'x-left', $slug ), $available_license->left() ) :
286
+ strtolower( __fs( 'last-license', $slug ) ) ) . ']'
287
+ )
288
+ ) ?> ">
289
+ </form>
290
+ <?php else : ?>
291
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
292
+ method="POST" class="button-group">
293
+ <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
294
+ <a class="button activate-license-trigger <?php echo $slug ?>" href="#"><?php _efs( 'activate-license', $slug ) ?></a>
295
+ <?php endif ?>
296
+ <input type="submit" class="button"
297
+ value="<?php _efs( 'sync-license', $slug ) ?>">
298
+ <input type="hidden" name="fs_action"
299
+ value="<?php echo $slug ?>_sync_license">
300
+ <?php wp_nonce_field( $slug . '_sync_license' ) ?>
301
+ <a href="<?php echo $fs->get_upgrade_url() ?>"
302
+ class="button<?php if ( $show_upgrade ) {
303
+ echo ' button-primary';
304
+ } ?> button-upgrade"><i
305
+ class="dashicons dashicons-cart"></i> <?php ( $show_upgrade ) ?
306
+ _efs( 'upgrade', $slug ) :
307
+ _efs( 'change-plan', $slug )
308
+ ?></a>
309
+ </form>
310
+ <?php endif ?>
311
+ </div>
312
+ <?php elseif ( 'version' === $p['id'] && $fs->has_paid_plan() ) : ?>
313
+ <?php if ( $fs->is_premium() ) : ?>
314
+ <label
315
+ class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php _efs( 'premium-version' ) ?></label>
316
+ <?php elseif ( $fs->can_use_premium_code() ) : ?>
317
+ <label class="fs-tag fs-warn"><?php _efs( 'free-version' ) ?></label>
318
+ <?php endif ?>
319
+ <?php endif ?>
320
+ </td>
321
+ <?php if ( 'plan' !== $p['id'] ) : ?>
322
+ <td class="fs-right">
323
+ <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
324
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
325
+ <input type="hidden" name="fs_action" value="verify_email">
326
+ <?php wp_nonce_field( 'verify_email' ) ?>
327
+ <input type="submit" class="button button-small"
328
+ value="<?php _efs( 'verify-email', $slug ) ?>">
329
+ </form>
330
+ <?php endif ?>
331
+ <?php if ( 'version' === $p['id'] ) : ?>
332
+ <div class="button-group">
333
+ <?php if ( $is_paying || $fs->is_trial() ) : ?>
334
+ <?php if ( ! $fs->is_allowed_to_install() ) : ?>
335
+ <a target="_blank" class="button button-primary"
336
+ href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf( __fs( 'download-x-version', $slug ), ( $fs->is_trial() ? $trial_plan->title : $site->plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
337
+ <?php elseif ( is_object( $update ) ) : ?>
338
+ <a class="button button-primary"
339
+ href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $fs->get_plugin_basename() ), 'upgrade-plugin_' . $fs->get_plugin_basename() ) ?>"><?php echo __fs( 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
340
+ <?php endif ?>
341
+ <?php endif; ?>
342
+ </div>
343
+ <?php
344
+ elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
345
+ <button class="button button-small"><?php _efs( 'show', $slug ) ?></button>
346
+ <?php
347
+ elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
348
+ ( is_string( $user->secret_key ) && in_array( $p['id'], array(
349
+ 'email',
350
+ 'user_name'
351
+ ) ) )
352
+ ) : ?>
353
+ <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
354
+ onsubmit="var val = prompt('<?php printf( __fs( 'what-is-your-x', $slug ), $p['title'] ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $slug ?>]').val(val); return true;">
355
+ <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
356
+ <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $slug ?>"
357
+ value="">
358
+ <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
359
+ <input type="submit" class="button button-small"
360
+ value="<?php _efs( 'edit', $slug ) ?>">
361
+ </form>
362
+ <?php endif ?>
363
+ </td>
364
+ <?php endif ?>
365
+ </tr>
366
+ <?php $odd = ! $odd;
367
+ endforeach ?>
368
+ </table>
369
+ </div>
370
+ </div>
371
+ <script type="text/javascript">
372
+ (function ($) {
373
+ $('.fs-field-license_key button, .fs-field-site_secret_key button').click(function () {
374
+ var
375
+ $this = $(this),
376
+ $parent = $this.closest('tr'),
377
+ $input = $parent.find('input');
378
+
379
+ $parent.find('code').toggle();
380
+ $input.toggle();
381
+
382
+ if ($input.is(':visible')) {
383
+ $this.html('<?php _efs( 'hide', $slug ) ?>');
384
+ setTimeout(function () {
385
+ $input.select().focus();
386
+ }, 100);
387
+ }
388
+ else {
389
+ $this.html('<?php _efs( 'show', $slug ) ?>');
390
+ }
391
+ });
392
+ }(jQuery));
393
+
394
+ </script>
395
+
396
+ <?php
397
+ $account_addons = $fs->get_account_addons();
398
+ if ( ! is_array( $account_addons ) ) {
399
+ $account_addons = array();
400
+ }
401
+
402
+ $installed_addons = $fs->get_installed_addons();
403
+ $installed_addons_ids = array();
404
+ foreach ( $installed_addons as $fs_addon ) {
405
+ $installed_addons_ids[] = $fs_addon->get_id();
406
+ }
407
+
408
+ $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
409
+ ?>
410
+ <?php if ( 0 < count( $addons_to_show ) ) : ?>
411
+ <!-- Add-Ons -->
412
+ <div class="postbox">
413
+ <div class="">
414
+ <!-- <div class="inside">-->
415
+ <table id="fs_addons" class="widefat">
416
+ <thead>
417
+ <tr>
418
+ <th><h3><?php _efs( 'add-ons', $slug ) ?></h3></th>
419
+ <th><?php _efs( 'id', $slug ) ?></th>
420
+ <th><?php _efs( 'version', $slug ) ?></th>
421
+ <th><?php _efs( 'plan', $slug ) ?></th>
422
+ <th><?php _efs( 'license', $slug ) ?></th>
423
+ <th></th>
424
+ <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
425
+ <th></th>
426
+ <?php endif ?>
427
+ </tr>
428
+ </thead>
429
+ <tbody>
430
+ <?php $odd = true;
431
+ foreach ( $addons_to_show as $addon_id ) : ?>
432
+ <?php
433
+ $addon = $fs->get_addon( $addon_id );
434
+ $is_addon_activated = $fs->is_addon_activated( $addon->slug );
435
+ $is_addon_connected = $fs->is_addon_connected( $addon->slug );
436
+
437
+ $fs_addon = $is_addon_connected ? freemius( $addon->slug ) : false;
438
+ if ( is_object( $fs_addon ) ) {
439
+ $is_paying = $fs_addon->is_paying();
440
+ $user = $fs_addon->get_user();
441
+ $site = $fs_addon->get_site();
442
+ $license = $fs_addon->_get_license();
443
+ $subscription = $fs_addon->_get_subscription();
444
+ $plan = $fs_addon->get_plan();
445
+ $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
446
+ $is_paid_trial = $fs_addon->is_paid_trial();
447
+ $show_upgrade = ( ! $is_paying && ! $is_paid_trial && ! $fs_addon->_has_premium_license() );
448
+ $is_current_license_expired = is_object( $license ) && $license->is_expired();
449
+ }
450
+
451
+ // var_dump( $is_paid_trial, $license, $site, $subscription );
452
+
453
+ ?>
454
+ <tr<?php if ( $odd ) {
455
+ echo ' class="alternate"';
456
+ } ?>>
457
+ <td>
458
+ <!-- Title -->
459
+ <?php echo $addon->title ?>
460
+ </td>
461
+ <?php if ( $is_addon_connected ) : ?>
462
+ <?php // Add-on Installed ?>
463
+ <?php $addon_site = $fs_addon->get_site(); ?>
464
+ <td>
465
+ <!-- ID -->
466
+ <?php echo $addon_site->id ?>
467
+ </td>
468
+ <td>
469
+ <!-- Version -->
470
+ <?php echo $fs_addon->get_plugin_version() ?>
471
+ </td>
472
+ <td>
473
+ <!-- Plan Title -->
474
+ <?php echo is_string( $addon_site->plan->name ) ? strtoupper( $addon_site->plan->title ) : 'FREE' ?>
475
+ </td>
476
+ <td>
477
+ <!-- Expiration -->
478
+ <?php
479
+ $tags = array();
480
+
481
+ if ( $fs_addon->is_trial() ) {
482
+ $tags[] = array( 'label' => __fs( 'trial', $slug ), 'type' => 'success' );
483
+
484
+ $tags[] = array(
485
+ 'label' => sprintf( __fs( ( $is_paid_trial ? 'renews-in' : 'expires-in' ), $slug ), human_time_diff( time(), strtotime( $site->trial_ends ) ) ),
486
+ 'type' => ( $is_paid_trial ? 'success' : 'warn' )
487
+ );
488
+ } else {
489
+ if ( is_object( $license ) ) {
490
+ if ( $license->is_cancelled ) {
491
+ $tags[] = array(
492
+ 'label' => __fs( 'cancelled', $slug ),
493
+ 'type' => 'error'
494
+ );
495
+ } else if ( $license->is_expired() ) {
496
+ $tags[] = array(
497
+ 'label' => __fs( 'expired', $slug ),
498
+ 'type' => 'error'
499
+ );
500
+ } else if ( $license->is_lifetime() ) {
501
+ $tags[] = array(
502
+ 'label' => __fs( 'no-expiration', $slug ),
503
+ 'type' => 'success'
504
+ );
505
+ } else if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) {
506
+ $tags[] = array(
507
+ 'label' => sprintf( __fs( 'expires-in', $slug ), human_time_diff( time(), strtotime( $license->expiration ) ) ),
508
+ 'type' => 'warn'
509
+ );
510
+ } else if ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) {
511
+ $tags[] = array(
512
+ 'label' => sprintf( __fs( 'renews-in', $slug ), human_time_diff( time(), strtotime( $subscription->next_payment ) ) ),
513
+ 'type' => 'success'
514
+ );
515
+ }
516
+ }
517
+ }
518
+
519
+ foreach ( $tags as $t ) {
520
+ printf( '<label class="fs-tag fs-%s">%s</label>' . "\n", $t['type'], $t['label'] );
521
+ }
522
+ ?>
523
+ </td>
524
+ <?php
525
+ $buttons = array();
526
+ if ( $is_addon_activated ) {
527
+ if ( $is_paying ) {
528
+ $buttons[] = fs_ui_get_action_button(
529
+ $slug,
530
+ 'account',
531
+ 'deactivate_license',
532
+ __fs( 'deactivate-license', $slug ),
533
+ array( 'plugin_id' => $addon_id ),
534
+ false
535
+ );
536
+
537
+ $human_readable_license_expiration = human_time_diff( time(), strtotime( $license->expiration ) );
538
+ $downgrade_confirmation_message = sprintf( __fs( 'downgrade-x-confirm', $slug ),
539
+ $plan->title,
540
+ $human_readable_license_expiration );
541
+
542
+ $after_downgrade_message_id = ( ! $license->is_block_features ?
543
+ 'after-downgrade-non-blocking' :
544
+ 'after-downgrade-blocking' );
545
+
546
+ $after_downgrade_message = sprintf( __fs( $after_downgrade_message_id, $slug ), $plan->title );
547
+
548
+ if ( ! $license->is_lifetime() && $is_active_subscription ) {
549
+ $buttons[] = fs_ui_get_action_button(
550
+ $slug,
551
+ 'account',
552
+ 'downgrade_account',
553
+ __fs( 'downgrade', $slug ),
554
+ array( 'plugin_id' => $addon_id ),
555
+ false,
556
+ false,
557
+ ( $downgrade_confirmation_message . ' ' . $after_downgrade_message ),
558
+ 'POST'
559
+ );
560
+ }
561
+ } else if ( $is_paid_trial ) {
562
+ $buttons[] = fs_ui_get_action_button(
563
+ $slug,
564
+ 'account',
565
+ 'cancel_trial',
566
+ __fs( 'cancel-trial', $slug ),
567
+ array( 'plugin_id' => $addon_id ),
568
+ false,
569
+ 'dashicons dashicons-download',
570
+ __fs( 'cancel-trial-confirm', $slug ),
571
+ 'POST'
572
+ );
573
+ } else {
574
+ $premium_license = $fs_addon->_get_available_premium_license();
575
+
576
+ if ( is_object( $premium_license ) ) {
577
+ $site = $fs_addon->get_site();
578
+
579
+ $buttons[] = fs_ui_get_action_button(
580
+ $slug,
581
+ 'account',
582
+ 'activate_license',
583
+ sprintf( __fs( 'activate-x-plan', $slug ), $fs_addon->get_plan_title(), ( $site->is_localhost() && $premium_license->is_free_localhost ) ? '[localhost]' : ( 1 < $premium_license->left() ? $premium_license->left() . ' left' : '' ) ),
584
+ array(
585
+ 'plugin_id' => $addon_id,
586
+ 'license_id' => $premium_license->id,
587
+ )
588
+ );
589
+ }
590
+ }
591
+
592
+ if ( 0 == count( $buttons ) ) {
593
+ // Add sync license only if non of the other CTAs are visible.
594
+ $buttons[] = fs_ui_get_action_button(
595
+ $slug,
596
+ 'account',
597
+ $slug . '_sync_license',
598
+ __fs( 'sync-license', $slug ),
599
+ array( 'plugin_id' => $addon_id ),
600
+ false
601
+ );
602
+
603
+ }
604
+ } else if ( ! $show_upgrade ) {
605
+ if ( $fs->is_addon_installed( $addon->slug ) ) {
606
+ $addon_file = $fs->get_addon_basename( $addon->slug );
607
+ $buttons[] = sprintf(
608
+ '<a class="button button-primary" href="%s" title="%s" class="edit">%s</a>',
609
+ wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ),
610
+ esc_attr( __fs( 'activate-this-addon', $slug ) ),
611
+ __fs( 'activate', $slug )
612
+ );
613
+ } else {
614
+ if ( $fs->is_allowed_to_install() ) {
615
+ $buttons[] = sprintf(
616
+ '<a class="button button-primary" href="%s" class="edit">%s</a>',
617
+ wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ),
618
+ __fs( 'install-now', $slug )
619
+ );
620
+ } else {
621
+ $buttons[] = sprintf(
622
+ '<a target="_blank" class="button button-primary" href="%s" class="edit">%s</a>',
623
+ $fs->_get_latest_download_local_url( $addon_id ),
624
+ __fs( 'download-latest', $slug )
625
+ );
626
+ }
627
+ }
628
+ }
629
+
630
+ if ( $show_upgrade ) {
631
+ $buttons[] = sprintf( '<a href="%s" class="thickbox button button-primary" aria-label="%s" data-title="%s"><i class="dashicons dashicons-cart"></i> %s</a>',
632
+ esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
633
+ '&TB_iframe=true&width=600&height=550' ) ),
634
+ esc_attr( sprintf( __fs( 'more-information-about-x', $slug ), $addon->title ) ),
635
+ esc_attr( $addon->title ),
636
+ __fs( ( $fs_addon->has_free_plan() ? 'upgrade' : 'purchase' ), $slug )
637
+ );
638
+ }
639
+
640
+ $buttons_count = count( $buttons );
641
+ ?>
642
+
643
+ <td>
644
+ <!-- Actions -->
645
+ <?php if ($buttons_count > 1) : ?>
646
+ <div class="button-group">
647
+ <?php endif ?>
648
+ <?php foreach ( $buttons as $button ) : ?>
649
+ <?php echo $button ?>
650
+ <?php endforeach ?>
651
+ <?php if ($buttons_count > 1) : ?>
652
+ </div>
653
+ <?php endif ?>
654
+ </td>
655
+ <?php else : ?>
656
+ <?php // Add-on NOT Installed or was never connected.
657
+ ?>
658
+ <td colspan="4">
659
+ <!-- Action -->
660
+ <?php if ( $fs->is_addon_installed( $addon->slug ) ) : ?>
661
+ <?php $addon_file = $fs->get_addon_basename( $addon->slug ) ?>
662
+ <a class="button button-primary"
663
+ href="<?php echo wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file ) ?>"
664
+ title="<?php esc_attr( __fs( 'activate-this-addon', $slug ) ) ?>"
665
+ class="edit"><?php _efs( 'activate', $slug ) ?></a>
666
+ <?php else : ?>
667
+ <?php if ( $fs->is_allowed_to_install() ) : ?>
668
+ <a class="button button-primary"
669
+ href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $addon->slug ), 'install-plugin_' . $addon->slug ) ?>"><?php _efs( 'install-now', $slug ) ?></a>
670
+ <?php else : ?>
671
+ <a target="_blank" class="button button-primary"
672
+ href="<?php echo $fs->_get_latest_download_local_url( $addon_id ) ?>"><?php _efs( 'download-latest', $slug ) ?></a>
673
+ <?php endif ?>
674
+ <?php endif ?>
675
+ </td>
676
+ <?php endif ?>
677
+ <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
678
+ <td>
679
+ <!-- Optional Delete Action -->
680
+ <?php
681
+ if ( $is_addon_activated ) {
682
+ fs_ui_action_button(
683
+ $slug, 'account',
684
+ 'delete_account',
685
+ __fs( 'delete', $slug ),
686
+ array( 'plugin_id' => $addon_id ),
687
+ false
688
+ );
689
+ }
690
+ ?>
691
+ </td>
692
+ <?php endif ?>
693
+ </tr>
694
+ <?php $odd = ! $odd;
695
+ endforeach ?>
696
+ </tbody>
697
+ </table>
698
+ </div>
699
+ </div>
700
+ <?php endif ?>
701
+
702
+ <?php $fs->do_action( 'after_account_details' ) ?>
703
+ </div>
704
+ </div>
705
+ </div>
706
+ </div>
707
+ </div>
708
+ <?php
709
+ $params = array(
710
+ 'page' => 'account',
711
+ 'module_id' => $fs->get_id(),
712
+ 'module_slug' => $slug,
713
+ 'module_version' => $fs->get_plugin_version(),
714
+ );
715
+ fs_require_template( 'powered-by.php', $params );
716
+ ?>
freemius/templates/add-ons.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $slug = $VARS['slug'];
17
+ /**
18
+ * @var Freemius
19
+ */
20
+ $fs = freemius( $slug );
21
+
22
+ $open_addon_slug = fs_request_get( 'slug' );
23
+
24
+ $open_addon = false;
25
+
26
+ /**
27
+ * @var FS_Plugin[]
28
+ */
29
+ $addons = $fs->get_addons();
30
+
31
+ $has_addons = ( is_array( $addons ) && 0 < count( $addons ) );
32
+ ?>
33
+ <div id="fs_addons" class="wrap">
34
+ <h2><?php printf( __fs( 'add-ons-for-x', $slug ), $fs->get_plugin_name() ) ?></h2>
35
+
36
+ <div id="poststuff">
37
+ <?php if ( ! $has_addons ) : ?>
38
+ <h3><?php printf(
39
+ '%s... %s',
40
+ __fs( 'oops', $slug ),
41
+ __fs( 'add-ons-missing', $slug )
42
+ ) ?></h3>
43
+ <?php endif ?>
44
+ <ul class="fs-cards-list">
45
+ <?php if ( $has_addons ) : ?>
46
+ <?php foreach ( $addons as $addon ) : ?>
47
+ <?php
48
+ $open_addon = ( $open_addon || ( $open_addon_slug === $addon->slug ) );
49
+
50
+ $price = 0;
51
+ $plan = null;
52
+ $plans_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans.json" );
53
+ if ( ! isset( $plans_result->error ) ) {
54
+ $plans = $plans_result->plans;
55
+ if ( is_array( $plans ) && 0 < count( $plans ) ) {
56
+ $plan = new FS_Plugin_Plan( $plans[0] );
57
+ $pricing_result = $fs->get_api_site_or_plugin_scope()->get( "/addons/{$addon->id}/plans/{$plan->id}/pricing.json" );
58
+ if ( ! isset( $pricing_result->error ) ) {
59
+ // Update plan's pricing.
60
+ $plan->pricing = $pricing_result->pricing;
61
+
62
+ if ( is_array( $plan->pricing ) && 0 < count( $plan->pricing ) ) {
63
+ $min_price = 999999;
64
+ foreach ( $plan->pricing as $pricing ) {
65
+ if ( ! is_null( $pricing->annual_price ) && $pricing->annual_price > 0 ) {
66
+ $min_price = min( $min_price, $pricing->annual_price );
67
+ } else if ( ! is_null( $pricing->monthly_price ) && $pricing->monthly_price > 0 ) {
68
+ $min_price = min( $min_price, 12 * $pricing->monthly_price );
69
+ }
70
+ }
71
+
72
+ if ( $min_price < 999999 ) {
73
+ $price = $min_price;
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ?>
80
+ <li class="fs-card fs-addon" data-slug="<?php echo $addon->slug ?>">
81
+ <?php
82
+ echo sprintf( '<a href="%s" class="thickbox fs-overlay" aria-label="%s" data-title="%s"></a>',
83
+ esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
84
+ '&TB_iframe=true&width=600&height=550' ) ),
85
+ esc_attr( sprintf( __fs( 'more-information-about-x', $slug ), $addon->title ) ),
86
+ esc_attr( $addon->title )
87
+ );
88
+ ?>
89
+ <?php
90
+ if ( is_null( $addon->info ) ) {
91
+ $addon->info = new stdClass();
92
+ }
93
+ if ( ! isset( $addon->info->card_banner_url ) ) {
94
+ $addon->info->card_banner_url = '//dashboard.freemius.com/assets/img/marketing/blueprint-300x100.jpg';
95
+ }
96
+ if ( ! isset( $addon->info->short_description ) ) {
97
+ $addon->info->short_description = 'What\'s the one thing your add-on does really, really well?';
98
+ }
99
+ ?>
100
+ <div class="fs-inner">
101
+ <ul>
102
+ <li class="fs-card-banner"
103
+ style="background-image: url('<?php echo $addon->info->card_banner_url ?>');"></li>
104
+ <!-- <li class="fs-tag"></li>-->
105
+ <li class="fs-title"><?php echo $addon->title ?></li>
106
+ <li class="fs-offer">
107
+ <span
108
+ class="fs-price"><?php echo ( 0 == $price ) ? __fs( 'free', $slug ) : ('$' . number_format( $price, 2 ) . ($plan->has_trial() ? ' - ' . __fs('trial', $slug) : '')) ?></span>
109
+ </li>
110
+ <li class="fs-description"><?php echo ! empty( $addon->info->short_description ) ? $addon->info->short_description : 'SHORT DESCRIPTION' ?></li>
111
+ <li class="fs-cta"><a class="button"><?php _efs( 'view-details', $slug ) ?></a></li>
112
+ </ul>
113
+ </div>
114
+ </li>
115
+ <?php endforeach ?>
116
+ <?php endif ?>
117
+ </ul>
118
+ </div>
119
+ </div>
120
+ <script type="text/javascript">
121
+ (function ($) {
122
+ <?php if ( $open_addon ) : ?>
123
+
124
+ var interval = setInterval(function () {
125
+ // Open add-on information page.
126
+ $('.fs-card[data-slug=<?php echo $open_addon_slug ?>] a').click();
127
+ if ($('#TB_iframeContent').length > 0) {
128
+ clearInterval(interval);
129
+ interval = null;
130
+ }
131
+ }, 200);
132
+
133
+ <?php else : ?>
134
+
135
+
136
+ $('.fs-card.fs-addon')
137
+ .mouseover(function () {
138
+ $(this).find('.fs-cta .button').addClass('button-primary');
139
+ }).mouseout(function () {
140
+ $(this).find('.fs-cta .button').removeClass('button-primary');
141
+ });
142
+
143
+ <?php endif ?>
144
+ })(jQuery);
145
+ </script>
146
+ <?php
147
+ $params = array(
148
+ 'page' => 'addons',
149
+ 'module_id' => $fs->get_id(),
150
+ 'module_slug' => $slug,
151
+ 'module_version' => $fs->get_plugin_version(),
152
+ );
153
+ fs_require_template( 'powered-by.php', $params );
154
+ ?>
freemius/templates/add-trial-to-pricing.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add "&trial=true" to pricing menu item href when running in trial
4
+ * promotion context.
5
+ *
6
+ * @package Freemius
7
+ * @copyright Copyright (c) 2016, Freemius, Inc.
8
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+ * @since 1.2.1.5
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ /**
17
+ * @var array $VARS
18
+ */
19
+ $slug = $VARS['slug'];
20
+ ?>
21
+ <script type="text/javascript">
22
+ (function ($) {
23
+ $(document).ready(function () {
24
+ var $pricingMenu = $('.fs-submenu-item.<?php echo $slug ?>.pricing'),
25
+ $pricingMenuLink = $pricingMenu.parents('a');
26
+
27
+ // Add trial querystring param.
28
+ $pricingMenuLink.attr('href', $pricingMenuLink.attr('href') + '&trial=true');
29
+ });
30
+ })(jQuery);
31
+ </script>
freemius/templates/admin-notice.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+ ?>
13
+ <div<?php if ( ! empty( $VARS['id'] ) ) : ?> data-id="<?php echo $VARS['id'] ?>"<?php endif ?><?php if ( ! empty( $VARS['slug'] ) ) : ?> data-slug="<?php echo $VARS['slug'] ?>"<?php endif ?>
14
+ class="<?php
15
+ switch ( $VARS['type'] ) {
16
+ case 'error':
17
+ echo 'error form-invalid';
18
+ break;
19
+ case 'promotion':
20
+ echo 'updated promotion';
21
+ break;
22
+ case 'update':
23
+ // echo 'update-nag update';
24
+ // break;
25
+ case 'success':
26
+ default:
27
+ echo 'updated success';
28
+ break;
29
+ }
30
+ ?> fs-notice<?php if ( ! empty( $VARS['sticky'] ) ) {
31
+ echo ' fs-sticky';
32
+ } ?><?php if ( ! empty( $VARS['plugin'] ) ) {
33
+ echo ' fs-has-title';
34
+ } ?>"><?php if ( ! empty( $VARS['plugin'] ) ) : ?>
35
+ <label class="fs-plugin-title"><?php echo $VARS['plugin'] ?></label>
36
+ <?php endif ?>
37
+ <?php if ( ! empty( $VARS['sticky'] ) ) : ?>
38
+ <div class="fs-close"><i class="dashicons dashicons-no"
39
+ title="<?php _efs( 'dismiss' ) ?>"></i> <span><?php _efs( 'dismiss' ) ?></span>
40
+ </div>
41
+ <?php endif ?>
42
+ <div class="fs-notice-body">
43
+ <?php if ( ! empty( $VARS['title'] ) ) : ?><b><?php echo $VARS['title'] ?></b> <?php endif ?>
44
+ <?php echo $VARS['message'] ?>
45
+ </div>
46
+ </div>
freemius/templates/all-admin-notice.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2015, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.0.3
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ ?>
17
+ <div class="<?php
18
+ switch ($VARS['type']) {
19
+ case 'error':
20
+ echo 'error form-invalid';
21
+ break;
22
+ case 'update-nag':
23
+ echo 'update-nag ';
24
+ break;
25
+ case 'update':
26
+ case 'success':
27
+ default:
28
+ echo 'updated success';
29
+ break;
30
+ }
31
+ ?> fs-notice">
32
+ <?php if ('update-nag' !== $VARS['type']) : ?><p><?php endif ?>
33
+ <?php if (!empty($VARS['title'])) : ?>
34
+ <b><?php echo $VARS['title'] ?></b>
35
+ <?php endif ?>
36
+ <?php echo $VARS['message'] ?>
37
+ <?php if ('update-nag' !== $VARS['type']) : ?></p><?php endif ?>
38
+ <?php if ($VARS['sticky']) : ?><i class="dashicons dashicons-no"></i><?php endif ?>
39
+ </div>
freemius/templates/billing.php ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Freemius
4
+ * @copyright Copyright (c) 2016, Freemius, Inc.
5
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6
+ * @since 1.2.0
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * @var array $VARS
15
+ */
16
+ $slug = $VARS['slug'];
17
+ /**
18
+ * @var Freemius $fs
19
+ */
20
+ $fs = freemius( $slug );
21
+
22
+ /**
23
+ * @var FS_Plugin_Tag $update
24
+ */
25
+ $update = $fs->get_update( false, false );
26
+
27
+ $is_paying = $fs->is_paying();
28
+ $user = $fs->get_user();
29
+ $site = $fs->get_site();
30
+ $name = $user->get_name();
31
+ $license = $fs->_get_license();
32
+ $subscription = $fs->_get_subscription();
33
+ $plan = $fs->get_plan();
34
+ $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
35
+ $is_paid_trial = $fs->is_paid_trial();
36
+ $show_upgrade = ( ! $is_paying && ! $is_paid_trial );
37
+
38
+ $billing = $fs->_fetch_billing();
39
+ $has_billing = ( $billing instanceof FS_Billing );
40
+ if ( ! $has_billing ) {
41
+ $billing = new FS_Billing();
42
+ }
43
+
44
+ $readonly_attr = $has_billing ? 'readonly' : '';
45
+ ?>
46
+
47
+ <div id="fs_account" class="wrap">
48
+ <h2 class="nav-tab-wrapper">
49
+ <a href="<?php echo $fs->get_account_url() ?>" class="nav-tab"><?php _efs( 'account', $slug ) ?></a>
50
+ <?php if ( $fs->has_addons() ) : ?>
51
+ <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
52
+ class="nav-tab"><?php _efs( 'add-ons', $slug ) ?></a>
53
+ <?php endif ?>
54
+ <?php if ( $fs->is_not_paying() && $fs->has_paid_plan() ) : ?>
55
+ <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php _efs( 'upgrade', $slug ) ?></a>
56
+ <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
57
+ <a href="<?php echo $fs->get_trial_url() ?>"
58
+ class="nav-tab"><?php _efs( 'free-trial', $slug ) ?></a>
59
+ <?php endif ?>
60
+ <?php endif ?>
61
+ <?php if ( ! $plan->is_free() ) : ?>
62
+ <a href="<?php echo $fs->get_account_tab_url( 'billing' ) ?>"
63
+ class="nav-tab nav-tab-active"><?php _efs( 'billing', $slug ) ?></a>
64
+ <?php endif ?>
65
+ </h2>
66
+
67
+ <div id="poststuff">
68
+ <div id="fs_billing">
69
+ <div class="has-sidebar has-right-sidebar">
70
+ <div class="has-sidebar-content">
71
+ <div class="postbox">
72
+ <h3><span class="dashicons dashicons-businessman"></span> <?php _efs( 'billing', $slug ) ?></h3>
73
+ <table id="fs_billing_address"<?php if ( $has_billing ) {
74
+ echo ' class="fs-read-mode"';
75
+ } ?>>
76
+ <tr>
77
+ <td><label><span><?php _efs( 'business-name', $slug ) ?>:</span> <input id="business_name" value="<?php echo $billing->business_name ?>" placeholder="<?php _efs( 'business-name', $slug ) ?>"></label></td>
78
+ <td><label><span><?php _efs( 'tax-vat-id', $slug ) ?>:</span> <input id="tax_id" value="<?php echo $billing->tax_id ?>" placeholder="<?php _efs( 'tax-vat-id', $slug ) ?>"></label></td>
79
+ </tr>
80
+ <tr>
81
+ <td><label><span><?php printf( __fs( 'address-line-n', $slug ), 1 ) ?>:</span> <input id="address_street" value="<?php echo $billing->address_street ?>" placeholder="<?php printf( __fs( 'address-line-n', $slug ), 1 ) ?>"></label></td>
82
+ <td><label><span><?php printf( __fs( 'address-line-n', $slug ), 2 ) ?>:</span> <input id="address_apt" value="<?php echo $billing->address_apt ?>" placeholder="<?php printf( __fs( 'address-line-n', $slug ), 2 ) ?>"></label></td>
83
+ </tr>
84
+ <tr>
85
+ <td><label><span><?php _efs( 'city', $slug ) ?> / <?php _efs( 'town', $slug ) ?>:</span> <input id="address_city" value="<?php echo $billing->address_city ?>" placeholder="<?php _efs( 'city', $slug ) ?> / <?php _efs( 'town', $slug ) ?>"></label></td>
86
+ <td><label><span><?php _efs( 'zip-postal-code', $slug ) ?>:</span> <input id="address_zip" value="<?php echo $billing->address_zip ?>" placeholder="<?php _efs( 'zip-postal-code', $slug ) ?>"></label></td>
87
+ </tr>
88
+ <tr>
89
+ <?php $countries = array(
90
+ 'AF' => 'Afghanistan',
91
+ 'AX' => 'Aland Islands',
92
+ 'AL' => 'Albania',
93
+ 'DZ' => 'Algeria',
94
+ 'AS' => 'American Samoa',
95
+ 'AD' => 'Andorra',
96
+ 'AO' => 'Angola',
97
+ 'AI' => 'Anguilla',
98
+ 'AQ' => 'Antarctica',
99
+ 'AG' => 'Antigua and Barbuda',
100
+ 'AR' => 'Argentina',
101
+ 'AM' => 'Armenia',
102
+ 'AW' => 'Aruba',
103
+ 'AU' => 'Australia',
104
+ 'AT' => 'Austria',
105
+ 'AZ' => 'Azerbaijan',
106
+ 'BS' => 'Bahamas',
107
+ 'BH' => 'Bahrain',
108
+ 'BD' => 'Bangladesh',
109
+ 'BB' => 'Barbados',
110
+ 'BY' => 'Belarus',
111
+ 'BE' => 'Belgium',
112
+ 'BZ' => 'Belize',
113
+ 'BJ' => 'Benin',
114
+ 'BM' => 'Bermuda',
115
+ 'BT' => 'Bhutan',
116
+ 'BO' => 'Bolivia',
117
+ 'BQ' => 'Bonaire, Saint Eustatius and Saba',
118
+ 'BA' => 'Bosnia and Herzegovina',
119
+ 'BW' => 'Botswana',
120
+ 'BV' => 'Bouvet Island',
121
+ 'BR' => 'Brazil',
122
+ 'IO' => 'British Indian Ocean Territory',
123
+ 'VG' => 'British Virgin Islands',
124
+ 'BN' => 'Brunei',
125
+ 'BG' => 'Bulgaria',
126
+ 'BF' => 'Burkina Faso',
127
+ 'BI' => 'Burundi',
128
+ 'KH' => 'Cambodia',
129
+ 'CM' => 'Cameroon',
130
+ 'CA' => 'Canada',
131
+ 'CV' => 'Cape Verde',
132
+ 'KY' => 'Cayman Islands',
133
+ 'CF' => 'Central African Republic',
134
+ 'TD' => 'Chad',
135
+ 'CL' => 'Chile',
136
+ 'CN' => 'China',
137
+ 'CX' => 'Christmas Island',
138
+ 'CC' => 'Cocos Islands',
139
+ 'CO' => 'Colombia',
140
+ 'KM' => 'Comoros',
141
+ 'CK' => 'Cook Islands',
142
+ 'CR' => 'Costa Rica',
143
+ 'HR' => 'Croatia',
144
+ 'CU' => 'Cuba',
145
+ 'CW' => 'Curacao',
146
+ 'CY' => 'Cyprus',
147
+ 'CZ' => 'Czech Republic',
148
+ 'CD' => 'Democratic Republic of the Congo',
149
+ 'DK' => 'Denmark',
150
+ 'DJ' => 'Djibouti',
151
+ 'DM' => 'Dominica',
152
+ 'DO' => 'Dominican Republic',
153
+ 'TL' => 'East Timor',
154
+ 'EC' => 'Ecuador',
155
+ 'EG' => 'Egypt',
156
+ 'SV' => 'El Salvador',
157
+ 'GQ' => 'Equatorial Guinea',
158
+ 'ER' => 'Eritrea',
159
+ 'EE' => 'Estonia',
160
+ 'ET' => 'Ethiopia',
161
+ 'FK' => 'Falkland Islands',
162
+ 'FO' => 'Faroe Islands',
163
+ 'FJ' => 'Fiji',
164
+ 'FI' => 'Finland',
165
+ 'FR' => 'France',
166
+ 'GF' => 'French Guiana',
167
+ 'PF' => 'French Polynesia',
168
+ 'TF' => 'French Southern Territories',
169
+ 'GA' => 'Gabon',
170
+ 'GM' => 'Gambia',
171
+ 'GE' => 'Georgia',
172
+ 'DE' => 'Germany',
173
+ 'GH' => 'Ghana',
174
+ 'GI' => 'Gibraltar',
175
+ 'GR' => 'Greece',
176
+ 'GL' => 'Greenland',
177
+ 'GD' => 'Grenada',
178
+ 'GP' => 'Guadeloupe',
179
+ 'GU' => 'Guam',
180
+ 'GT' => 'Guatemala',
181
+ 'GG' => 'Guernsey',
182
+ 'GN' => 'Guinea',
183
+ 'GW' => 'Guinea-Bissau',
184
+ 'GY' => 'Guyana',
185
+ 'HT' => 'Haiti',
186
+ 'HM' => 'Heard Island and McDonald Islands',
187
+ 'HN' => 'Honduras',
188
+ 'HK' => 'Hong Kong',
189
+ 'HU' => 'Hungary',
190
+ 'IS' => 'Iceland',
191
+ 'IN' => 'India',
192
+ 'ID' => 'Indonesia',
193
+ 'IR' => 'Iran',
194
+ 'IQ' => 'Iraq',
195
+ 'IE' => 'Ireland',
196
+ 'IM' => 'Isle of Man',
197
+ 'IL' => 'Israel',
198
+ 'IT' => 'Italy',
199
+ 'CI' => 'Ivory Coast',
200
+ 'JM' => 'Jamaica',
201
+ 'JP' => 'Japan',
202
+ 'JE' => 'Jersey',
203
+ 'JO' => 'Jordan',
204
+ 'KZ' => 'Kazakhstan',
205
+ 'KE' => 'Kenya',
206
+ 'KI' => 'Kiribati',
207
+ 'XK' => 'Kosovo',
208
+ 'KW' => 'Kuwait',
209
+ 'KG' => 'Kyrgyzstan',
210
+ 'LA' => 'Laos',
211
+ 'LV' => 'Latvia',
212
+ 'LB' => 'Lebanon',
213
+ 'LS' => 'Lesotho',
214
+ 'LR' => 'Liberia',
215
+ 'LY' => 'Libya',
216
+ 'LI' => 'Liechtenstein',
217
+ 'LT' => 'Lithuania',
218
+ 'LU' => 'Luxembourg',
219
+ 'MO' => 'Macao',
220
+ 'MK' => 'Macedonia',
221
+ 'MG' => 'Madagascar',
222
+ 'MW' => 'Malawi',
223
+ 'MY' => 'Malaysia',
224
+ 'MV' => 'Maldives',
225
+ 'ML' => 'Mali',
226
+ 'MT' => 'Malta',
227
+ 'MH' => 'Marshall Islands',
228
+ 'MQ' => 'Martinique',
229
+ 'MR' => 'Mauritania',
230
+ 'MU' => 'Mauritius',
231
+ 'YT' => 'Mayotte',
232
+ 'MX' => 'Mexico',
233
+ 'FM' => 'Micronesia',
234
+ 'MD' => 'Moldova',
235
+ 'MC' => 'Monaco',
236
+ 'MN' => 'Mongolia',
237
+ 'ME' => 'Montenegro',
238
+ 'MS' => 'Montserrat',
239
+ 'MA' => 'Morocco',
240
+ 'MZ' => 'Mozambique',
241
+ 'MM' => 'Myanmar',
242
+ 'NA' => 'Namibia',
243
+ 'NR' => 'Nauru',
244
+ 'NP' => 'Nepal',
245
+ 'NL' => 'Netherlands',
246
+ 'NC' => 'New Caledonia',
247
+ 'NZ' => 'New Zealand',
248
+ 'NI' => 'Nicaragua',
249
+ 'NE' => 'Niger',
250
+ 'NG' => 'Nigeria',
251
+ 'NU' => 'Niue',
252
+ 'NF' => 'Norfolk Island',
253
+ 'KP' => 'North Korea',
254
+ 'MP' => 'Northern Mariana Islands',
255
+ 'NO' => 'Norway',
256
+ 'OM' => 'Oman',
257
+ 'PK' => 'Pakistan',
258
+ 'PW' => 'Palau',
259
+ 'PS' => 'Palestinian Territory',
260
+ 'PA' => 'Panama',
261
+ 'PG' => 'Papua New Guinea',
262
+ 'PY' => 'Paraguay',
263
+ 'PE' => 'Peru',
264
+ 'PH' => 'Philippines',
265
+ 'PN' => 'Pitcairn',
266
+ 'PL' => 'Poland',
267
+ 'PT' => 'Portugal',
268
+ 'PR' => 'Puerto Rico',
269
+ 'QA' => 'Qatar',
270
+ 'CG' => 'Republic of the Congo',
271
+ 'RE' => 'Reunion',
272
+ 'RO' => 'Romania',
273
+ 'RU' => 'Russia',
274
+ 'RW' => 'Rwanda',
275
+ 'BL' => 'Saint Barthelemy',
276
+ 'SH' => 'Saint Helena',
277
+ 'KN' => 'Saint Kitts and Nevis',
278
+ 'LC' => 'Saint Lucia',
279
+ 'MF' => 'Saint Martin',
280
+ 'PM' => 'Saint Pierre and Miquelon',
281
+ 'VC' => 'Saint Vincent and the Grenadines',
282
+ 'WS' => 'Samoa',
283
+ 'SM' => 'San Marino',
284
+ 'ST' => 'Sao Tome and Principe',
285
+ 'SA' => 'Saudi Arabia',
286
+ 'SN' => 'Senegal',
287
+ 'RS' => 'Serbia',
288
+ 'SC' => 'Seychelles',
289
+ 'SL' => 'Sierra Leone',
290
+ 'SG' => 'Singapore',
291
+ 'SX' => 'Sint Maarten',
292
+ 'SK' => 'Slovakia',
293
+ 'SI' => 'Slovenia',
294
+ 'SB' => 'Solomon Islands',
295
+ 'SO' => 'Somalia',
296
+ 'ZA' => 'South Africa',
297
+ 'GS' => 'South Georgia and the South Sandwich Islands',
298
+ 'KR' => 'South Korea',
299
+ 'SS' => 'South Sudan',
300
+ 'ES' => 'Spain',
301
+ 'LK' => 'Sri Lanka',
302
+ 'SD' => 'Sudan',
303
+ 'SR' => 'Suriname',
304
+ 'SJ' => 'Svalbard and Jan Mayen',
305
+ 'SZ' => 'Swaziland',
306
+ 'SE' => 'Sweden',
307
+ 'CH' => 'Switzerland',
308
+ 'SY' => 'Syria',
309
+ 'TW' => 'Taiwan',
310
+ 'TJ' => 'Tajikistan',
311
+ 'TZ' => 'Tanzania',
312
+ 'TH' => 'Thailand',
313
+ 'TG' => 'Togo',
314
+ 'TK' => 'Tokelau',
315
+ 'TO' => 'Tonga',
316
+ 'TT' => 'Trinidad and Tobago',
317
+ 'TN' => 'Tunisia',
318
+ 'TR' => 'Turkey',
319
+ 'TM' => 'Turkmenistan',
320
+ 'TC' => 'Turks and Caicos Islands',
321
+ 'TV' => 'Tuvalu',
322
+ 'VI' => 'U.S. Virgin Islands',
323
+ 'UG' => 'Uganda',
324
+ 'UA' => 'Ukraine',
325
+ 'AE' => 'United Arab Emirates',
326
+ 'GB' => 'United Kingdom',
327
+ 'US' => 'United States',
328
+ 'UM' => 'United States Minor Outlying Islands',
329
+ 'UY' => 'Uruguay',
330
+ 'UZ' => 'Uzbekistan',
331
+ 'VU' => 'Vanuatu',
332
+ 'VA' => 'Vatican',
333
+ 'VE' => 'Venezuela',
334
+ 'VN' => 'Vietnam',
335
+ 'WF' => 'Wallis and Futuna',
336
+ 'EH' => 'Western Sahara',
337
+ 'YE' => 'Yemen',
338
+ 'ZM' => 'Zambia',
339
+ 'ZW' => 'Zimbabwe',
340
+ ) ?>
341
+ <td><label><span><?php _efs( 'country', $slug ) ?>:</span> <select id="address_country_code">
342
+ <?php if ( empty( $billing->address_country_code ) ) : ?>
343
+ <option value=""
344
+ selected><?php _efs( 'select-country', $slug ) ?></option>
345
+ <?php endif ?>
346
+ <?php foreach ( $countries as $code => $country ) : ?>
347
+ <option
348
+ value="<?php echo $code ?>" <?php selected( $billing->address_country_code, $code ) ?>><?php echo $country ?></option>
349
+ <?php endforeach ?>
350
+ </select></label></td>
351
+ <td><label><span><?php _efs( 'state', $slug ) ?> / <?php _efs( 'province', $slug ) ?>:</span>
352
+ <input id="address_state" value="<?php echo $billing->address_state ?>" placeholder="<?php _efs( 'state', $slug ) ?> / <?php _efs( 'province', $slug ) ?>"></label></td>
353
+ </tr>
354
+ <tr>
355
+ <td colspan="2">
356
+ <button
357
+ class="button"><?php _efs( $has_billing ? 'edit' : 'update', $slug ) ?></button>
358
+ </td>
359
+ </tr>
360
+ </table>
361
+ </div>
362
+ <div class="postbox">
363
+ <h3><span class="dashicons dashicons-paperclip"></span> <?php _efs( 'payments', $slug ) ?></h3>
364
+
365
+ <?php
366
+ $payments = $fs->_fetch_payments();
367
+ ?>
368
+
369
+ <div class="inside">
370
+ <table class="widefat">
371
+ <thead>
372
+ <tr>
373
+ <th><?php _efs( 'id', $slug ) ?></th>
374
+ <th><?php _efs( 'date', $slug ) ?></th>
375
+ <!-- <th>--><?php //_efs( 'transaction' ) ?><!--</th>-->
376
+ <th><?php _efs( 'amount', $slug ) ?></th>
377
+ <th><?php _efs( 'invoice', $slug ) ?></th>
378
+ </tr>
379
+ </thead>
380
+ <tbody>
381
+ <?php $odd = true ?>
382
+ <?php foreach ( $payments as $payment ) : ?>
383
+ <tr<?php echo $odd ? ' class="alternate"' : '' ?>>
384
+ <td><?php echo $payment->id ?></td>
385
+ <td><?php echo date( 'M j, Y', strtotime( $payment->created ) ) ?></td>
386
+ <td>$<?php echo $payment->gross ?></td>
387
+ <td><a href="<?php echo $fs->_get_invoice_api_url( $payment->id ) ?>"
388
+ class="button button-small"
389
+ target="_blank"><?php _efs( 'invoice', $slug ) ?></a></td>
390
+ </tr>
391
+ <?php $odd = ! $odd; endforeach ?>
392
+ </tbody>
393
+ </table>
394
+ </div>
395
+ </div>
396
+ </div>
397
+ </div>
398
+ </div>
399
+ </div>
400
+ </div>
401
+ <script type="text/javascript">
402
+ (function($){
403
+ var $billingAddress = $('#fs_billing_address'),
404
+ $billingInputs = $billingAddress.find('input, select');
405
+
406
+ var setPrevValues = functi