PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | freemius/templates/account.php +1132 -1133 2.5.0 → 5.0.1 View file →
@@ -1,1133 +1,1132 @@
1 -<?php
2 - /**
3 - * @package Freemius
4 - * @copyright Copyright (c) 2015, Freemius, Inc.
5 - * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 - * @since 1.0.3
7 - */
8 -
9 - if ( ! defined( 'ABSPATH' ) ) {
10 - exit;
11 - }
12 -
13 - /**
14 - * @var array $VARS
15 - * @var Freemius $fs
16 - */
17 - $fs = freemius( $VARS['id'] );
18 -
19 - $slug = $fs->get_slug();
20 -
21 - /**
22 - * @var FS_Plugin_Tag $update
23 - */
24 - $update = $fs->has_release_on_freemius() ?
25 - $fs->get_update( false, false, WP_FS__TIME_24_HOURS_IN_SEC / 24 ) :
26 - null;
27 -
28 - if ( is_object($update) ) {
29 - /**
30 - * This logic is particularly required for multisite environment.
31 - * If a module is site activated (not network) and not on the main site,
32 - * the module will NOT be executed on the network level, therefore, the
33 - * custom updates logic will not be executed as well, so unless we force
34 - * the injection of the update into the updates transient, premium updates
35 - * will not work.
36 - *
37 - * @author Vova Feldman (@svovaf)
38 - * @since 2.0.0
39 - */
40 - $updater = FS_Plugin_Updater::instance( $fs );
41 - $updater->set_update_data( $update );
42 - }
43 -
44 - $is_paying = $fs->is_paying();
45 - $user = $fs->get_user();
46 - $site = $fs->get_site();
47 - $name = $user->get_name();
48 - $license = $fs->_get_license();
49 - $is_license_foreign = ( is_object( $license ) && $user->id != $license->user_id );
50 - $is_data_debug_mode = $fs->is_data_debug_mode();
51 - $is_whitelabeled = $fs->is_whitelabeled();
52 - $subscription = ( is_object( $license ) ?
53 - $fs->_get_subscription( $license->id ) :
54 - null );
55 - $plan = $fs->get_plan();
56 - $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
57 - $is_paid_trial = $fs->is_paid_trial();
58 - $has_paid_plan = $fs->apply_filters( 'has_paid_plan_account', $fs->has_paid_plan() );
59 - $show_upgrade = ( ! $is_whitelabeled && $has_paid_plan && ! $is_paying && ! $is_paid_trial );
60 - $trial_plan = $fs->get_trial_plan();
61 -
62 - $is_plan_change_supported = (
63 - ! $fs->is_single_plan() &&
64 - ! $fs->apply_filters( 'hide_plan_change', false )
65 - );
66 -
67 - if ( $has_paid_plan ) {
68 - $fs->_add_license_activation_dialog_box();
69 - }
70 -
71 - if ( $fs->should_handle_user_change() ) {
72 - $fs->_add_email_address_update_dialog_box();
73 - }
74 -
75 - $ids_of_installs_activated_with_foreign_licenses = $fs->should_handle_user_change() ?
76 - $fs->get_installs_ids_with_foreign_licenses() :
77 - array();
78 -
79 - if ( ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) {
80 - $fs->_add_user_change_dialog_box( $ids_of_installs_activated_with_foreign_licenses );
81 - }
82 -
83 - if ( $fs->is_whitelabeled( true ) || $fs->is_data_debug_mode() ) {
84 - $fs->_add_data_debug_mode_dialog_box();
85 - }
86 -
87 - if ( fs_request_get_bool( 'auto_install' ) ) {
88 - $fs->_add_auto_installation_dialog_box();
89 - }
90 -
91 - if ( fs_request_get_bool( 'activate_license' ) ) {
92 - // Open the license activation dialog box on the account page.
93 - add_action( 'admin_footer', array(
94 - &$fs,
95 - '_open_license_activation_dialog_box'
96 - ) );
97 - }
98 -
99 - $show_billing = ( ! $is_whitelabeled && ! $fs->apply_filters( 'hide_billing_and_payments_info', false ) );
100 - if ( $show_billing ) {
101 - $payments = $fs->_fetch_payments();
102 -
103 - $show_billing = ( is_array( $payments ) && 0 < count( $payments ) );
104 - }
105 -
106 -
107 - $has_tabs = $fs->_add_tabs_before_content();
108 -
109 - if ( $has_tabs ) {
110 - $query_params['tabs'] = 'true';
111 - }
112 -
113 - // Aliases.
114 - $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
115 - $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
116 - $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
117 - /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
118 - $downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
119 - $prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
120 - $cancel_trial_confirm_text = fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug );
121 - $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
122 - $after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
123 - /* translators: %s: Plan title (e.g. "Professional") */
124 - $activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
125 - $version_text = fs_text_x_inline( 'Version', 'product version', 'version', $slug );
126 - /* translators: %s: Time period (e.g. Auto renews in "2 months") */
127 - $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
128 - /* translators: %s: Time period (e.g. Expires in "2 months") */
129 - $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
130 - $sync_license_text = fs_text_x_inline( 'Sync License', 'as synchronize license', 'sync-license', $slug );
131 - $cancel_trial_text = fs_text_inline( 'Cancel Trial', 'cancel-trial', $slug );
132 - $change_plan_text = fs_text_inline( 'Change Plan', 'change-plan', $slug );
133 - $upgrade_text = fs_text_x_inline( 'Upgrade', 'verb', 'upgrade', $slug );
134 - $addons_text = fs_text_inline( 'Add-Ons', 'add-ons', $slug );
135 - $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
136 - $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
137 - $free_text = fs_text_inline( 'Free', 'free', $slug );
138 - $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
139 - $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
140 - $bundle_plan_text = fs_text_inline( 'Bundle Plan', 'bundle-plan', $slug );
141 -
142 - $show_plan_row = true;
143 - $show_license_row = is_object( $license );
144 -
145 - $site_view_params = array();
146 -
147 - if ( fs_is_network_admin() ) {
148 - $sites = Freemius::get_sites();
149 - $all_installs_plan_id = null;
150 - $all_installs_license_id = ( $show_license_row ? $license->id : null );
151 - foreach ( $sites as $s ) {
152 - $site_info = $fs->get_site_info( $s );
153 - $install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
154 - $view_params = array(
155 - 'freemius' => $fs,
156 - 'user' => $fs->get_user(),
157 - 'license' => $license,
158 - 'site' => $site_info,
159 - 'install' => $install,
160 - );
161 -
162 - $site_view_params[] = $view_params;
163 -
164 - if ( empty( $install ) ) {
165 - continue;
166 - }
167 -
168 - if ( $show_plan_row ) {
169 - if ( is_null( $all_installs_plan_id ) ) {
170 - $all_installs_plan_id = $install->plan_id;
171 - } else if ( $all_installs_plan_id != $install->plan_id ) {
172 - $show_plan_row = false;
173 - }
174 - }
175 -
176 - if ( $show_license_row && $all_installs_license_id != $install->license_id ) {
177 - $show_license_row = false;
178 - }
179 - }
180 - }
181 -
182 - $has_bundle_license = false;
183 -
184 - if ( is_object( $license ) &&
185 - FS_Plugin_License::is_valid_id( $license->parent_license_id )
186 - ) {
187 - // Context license has a parent license, therefore, the account has a bundle license.
188 - $has_bundle_license = true;
189 - }
190 -
191 - $bundle_subscription = null;
192 - $is_bundle_first_payment_pending = false;
193 -
194 - if (
195 - $show_plan_row &&
196 - is_object( $license ) &&
197 - $has_bundle_license
198 - ) {
199 - $bundle_plan_title = strtoupper( $license->parent_plan_title );
200 - $bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
201 - $is_bundle_first_payment_pending = $license->is_first_payment_pending();
202 - }
203 -
204 - $fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
205 - get_current_blog_id() :
206 - 0;
207 -
208 - $active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
209 -
210 - $is_premium = $fs->is_premium();
211 -
212 - $account_addons = $fs->get_updated_account_addons();
213 - $installed_addons = $fs->get_installed_addons();
214 - $installed_addons_ids = array();
215 -
216 - /**
217 - * Store the installed add-ons' IDs into a collection which will be used in determining the add-ons to show on the "Account" page, and at the same time try to find an add-on that is activated with a bundle license if the core product is not.
218 - *
219 - * @author Leo Fajardo
220 - *
221 - * @since 2.4.0
222 - */
223 - foreach ( $installed_addons as $fs_addon ) {
224 - $installed_addons_ids[] = $fs_addon->get_id();
225 -
226 - if ( $has_bundle_license ) {
227 - // We already have the context bundle license details, skip.
228 - continue;
229 - }
230 -
231 - if (
232 - $show_plan_row &&
233 - $fs_addon->has_active_valid_license()
234 - ) {
235 - $addon_license = $fs_addon->_get_license();
236 -
237 - if ( FS_Plugin_License::is_valid_id( $addon_license->parent_license_id ) ) {
238 - // Add-on's license is associated with a parent/bundle license.
239 - $has_bundle_license = true;
240 -
241 - $bundle_plan_title = strtoupper( $addon_license->parent_plan_title );
242 - $bundle_subscription = $fs_addon->_get_subscription( $addon_license->parent_license_id );
243 - $is_bundle_first_payment_pending = $addon_license->is_first_payment_pending();
244 - }
245 - }
246 - }
247 -
248 - $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
249 -
250 - $is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
251 -
252 - $available_license = ( $fs->is_free_plan() && ! fs_is_network_admin() ) ?
253 - $fs->_get_available_premium_license( $site->is_localhost() ) :
254 - null;
255 -
256 - $available_license_paid_plan = is_object( $available_license ) ?
257 - $fs->_get_plan_by_id( $available_license->plan_id ) :
258 - null;
259 -?>
260 - <div class="wrap fs-section">
261 - <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
262 - <h2 class="nav-tab-wrapper">
263 - <a href="<?php echo $fs->get_account_url() ?>"
264 - class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
265 - <?php if ( $fs->has_addons() ) : ?>
266 - <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
267 - class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
268 - <?php endif ?>
269 - <?php if ( $show_upgrade ) : ?>
270 - <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
271 - <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
272 - <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
273 - <?php endif ?>
274 - <?php endif ?>
275 - </h2>
276 - <?php endif ?>
277 -
278 - <div id="poststuff">
279 - <div id="fs_account">
280 - <div class="has-sidebar has-right-sidebar">
281 - <div class="has-sidebar-content">
282 - <div class="postbox">
283 - <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
284 - <div class="fs-header-actions">
285 - <ul>
286 - <?php if ( $fs->is_whitelabeled( true ) ) : ?>
287 - <li>
288 - <a href="#" class="debug-license-trigger"><i class="dashicons dashicons-<?php echo $is_whitelabeled ? 'editor-code' : 'controls-pause' ?>"></i> <span><?php
289 - if ( $is_whitelabeled ) {
290 - fs_esc_html_echo_inline( 'Start Debug', 'start-debug-license', $slug );
291 - } else {
292 - fs_esc_html_echo_inline( 'Stop Debug', 'stop-debug-license', $slug );
293 - }
294 - ?></span></a>
295 - </li>
296 - <li>&nbsp;&bull;&nbsp;</li>
297 - <?php endif ?>
298 - <?php if ( $show_billing ) : ?>
299 - <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></a></li>
300 - <li>&nbsp;&bull;&nbsp;</li>
301 - <?php endif ?>
302 - <?php if ( ! $is_whitelabeled ) : ?>
303 - <?php if ( ! $is_paying ) : ?>
304 - <li>
305 - <?php
306 - $view_params = array(
307 - 'freemius' => $fs,
308 - 'license' => $available_license,
309 - 'license_paid_plan' => $available_license_paid_plan,
310 - );
311 - fs_require_template( 'account/partials/disconnect-button.php', $view_params ); ?>
312 - </li>
313 - <li>&nbsp;&bull;&nbsp;</li>
314 - <?php endif ?>
315 - <?php if ( $is_paying ) : ?>
316 - <?php if ( ! fs_is_network_admin() ) : ?>
317 - <li>
318 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
319 - <input type="hidden" name="fs_action" value="deactivate_license">
320 - <?php wp_nonce_field( 'deactivate_license' ) ?>
321 - <a href="#" class="fs-deactivate-license"><i
322 - class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
323 - </a>
324 - </form>
325 - </li>
326 - <li>&nbsp;&bull;&nbsp;</li>
327 - <?php endif ?>
328 - <?php if ( ! $license->is_lifetime() &&
329 - $is_active_subscription
330 - ) : ?>
331 - <li>
332 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
333 - <input type="hidden" name="fs_action" value="downgrade_account">
334 - <?php wp_nonce_field( 'downgrade_account' ) ?>
335 - <a href="#"
336 - onclick="if ( confirm('<?php echo esc_attr( sprintf(
337 - $downgrade_x_confirm_text,
338 - ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
339 - $plan->title,
340 - human_time_diff( time(), strtotime( $license->expiration ) )
341 - ) ) ?> <?php if ( ! $license->is_block_features ) {
342 - echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
343 - } else {
344 - echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
345 - }?> <?php echo esc_attr( $prices_increase_text ) ?> <?php fs_esc_attr_echo_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug ) ?>') ) this.parentNode.submit(); return false;"><i class="dashicons dashicons-download"></i> <?php echo esc_html( $fs->is_only_premium() ? fs_text_inline( 'Cancel Subscription', 'cancel-subscription', $slug ) : $downgrade_text ) ?></a>
346 - </form>
347 - </li>
348 - <li>&nbsp;&bull;&nbsp;</li>
349 - <?php endif ?>
350 - <?php if ( $is_plan_change_supported ) : ?>
351 - <li>
352 - <a href="<?php echo $fs->get_upgrade_url() ?>"><i
353 - class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
354 - </li>
355 - <li>&nbsp;&bull;&nbsp;</li>
356 - <?php endif ?>
357 - <?php elseif ( $is_paid_trial ) : ?>
358 - <li>
359 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
360 - <input type="hidden" name="fs_action" value="cancel_trial">
361 - <?php wp_nonce_field( 'cancel_trial' ) ?>
362 - <a href="#" class="fs-cancel-trial"><i
363 - class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
364 - </form>
365 - </li>
366 - <li>&nbsp;&bull;&nbsp;</li>
367 - <?php endif ?>
368 - <?php endif ?>
369 - <li>
370 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
371 - <input type="hidden" name="fs_action" value="<?php echo $fs->get_unique_affix() ?>_sync_license">
372 - <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
373 - <a href="#" onclick="this.parentNode.submit(); return false;"><i
374 - class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
375 - </form>
376 - </li>
377 - </ul>
378 - </div>
379 - <div class="inside">
380 - <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
381 - <?php
382 - $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
383 -
384 - $profile = array();
385 -
386 - if ( ! $is_whitelabeled ) {
387 - $profile[] = array(
388 - 'id' => 'user_name',
389 - 'title' => fs_text_inline( 'Name', 'name', $slug ),
390 - 'value' => $name
391 - );
392 - // if (isset($user->email) && false !== strpos($user->email, '@'))
393 - $profile[] = array(
394 - 'id' => 'email',
395 - 'title' => fs_text_inline( 'Email', 'email', $slug ),
396 - 'value' => $user->email
397 - );
398 -
399 - if ( is_numeric( $user->id ) ) {
400 - $profile[] = array(
401 - 'id' => 'user_id',
402 - 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
403 - 'value' => $user->id
404 - );
405 - }
406 - }
407 -
408 - $profile[] = array(
409 - 'id' => 'product',
410 - 'title' => ( $fs->is_plugin() ?
411 - fs_text_inline( 'Plugin', 'plugin', $slug ) :
412 - fs_text_inline( 'Theme', 'theme', $slug ) ),
413 - 'value' => $fs->get_plugin_title()
414 - );
415 -
416 - $profile[] = array(
417 - 'id' => 'product_id',
418 - 'title' => ( $fs->is_plugin() ?
419 - fs_text_inline( 'Plugin', 'plugin', $slug ) :
420 - fs_text_inline( 'Theme', 'theme', $slug ) ) . ' ' . fs_text_inline( 'ID', 'id', $slug ),
421 - 'value' => $fs->get_id()
422 - );
423 -
424 - if ( ! fs_is_network_admin()) {
425 - $profile[] = array(
426 - 'id' => 'site_id',
427 - 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
428 - 'value' => is_string( $site->id ) ?
429 - $site->id :
430 - fs_text_inline( 'No ID', 'no-id', $slug )
431 - );
432 -
433 - $profile[] = array(
434 - 'id' => 'site_public_key',
435 - 'title' => fs_text_inline( 'Public Key', 'public-key', $slug ),
436 - 'value' => $site->public_key
437 - );
438 -
439 - $profile[] = array(
440 - 'id' => 'site_secret_key',
441 - 'title' => fs_text_inline( 'Secret Key', 'secret-key', $slug ),
442 - 'value' => ( ( is_string( $site->secret_key ) ) ?
443 - $site->secret_key :
444 - fs_text_x_inline( 'No Secret', 'as secret encryption key missing', 'no-secret', $slug )
445 - )
446 - );
447 - }
448 -
449 - $profile[] = array(
450 - 'id' => 'version',
451 - 'title' => $version_text,
452 - 'value' => $fs->get_plugin_version()
453 - );
454 -
455 - if ( ! fs_is_network_admin() && $is_premium ) {
456 - $profile[] = array(
457 - 'id' => 'beta_program',
458 - 'title' => '',
459 - 'value' => $site->is_beta
460 - );
461 - }
462 -
463 - if ( $has_paid_plan || $has_bundle_license ) {
464 - if ( $fs->is_trial() ) {
465 - if ( $show_plan_row ) {
466 - $profile[] = array(
467 - 'id' => 'plan',
468 - 'title' => $plan_text,
469 - 'value' => ( is_string( $trial_plan->name ) ?
470 - strtoupper( $trial_plan->title ) :
471 - fs_text_inline( 'Trial', 'trial', $slug ) )
472 - );
473 - }
474 - } else {
475 - if ( $show_plan_row ) {
476 - $profile[] = array(
477 - 'id' => 'plan',
478 - 'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
479 - 'value' => strtoupper( is_string( $plan->name ) ?
480 - $plan->title :
481 - strtoupper( $free_text )
482 - )
483 - );
484 -
485 - if ( $has_bundle_license ) {
486 - $profile[] = array(
487 - 'id' => 'bundle_plan',
488 - 'title' => $bundle_plan_text,
489 - 'value' => $bundle_plan_title
490 - );
491 - }
492 - }
493 -
494 - if ( is_object( $license ) ) {
495 - if ( ! $hide_license_key ) {
496 - $profile[] = array(
497 - 'id' => 'license_key',
498 - 'title' => fs_text_inline( 'License Key', $slug ),
499 - 'value' => $license->secret_key,
500 - );
501 - }
502 - }
503 - }
504 - }
505 - ?>
506 - <?php $odd = true;
507 - foreach ( $profile as $p ) : ?>
508 - <?php
509 - if ( 'plan' === $p['id'] && ! $has_paid_plan ) {
510 - // If plugin don't have any paid plans, there's no reason
511 - // to show current plan.
512 - continue;
513 - }
514 - ?>
515 - <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
516 - <td>
517 - <nobr><?php echo $p['title'] ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
518 - </td>
519 - <td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
520 - <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
521 - <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $p['value'] ) ?></code>
522 - <?php if ( ! $is_whitelabeled ) : ?>
523 - <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
524 - readonly/>
525 - <?php endif ?>
526 - <?php elseif ( 'beta_program' === $p['id'] ) : ?>
527 - <label>
528 - <input type="checkbox" class="fs-toggle-beta-mode" <?php checked( true, $p['value'] ) ?>/><span><?php
529 - fs_esc_html_echo_inline( 'Join the Beta program', 'join-beta', $slug )
530 - ?></span></label>
531 - <?php else : ?>
532 - <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
533 - <?php endif ?>
534 - <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
535 - <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'not verified', 'not-verified', $slug ) ?></label>
536 - <?php endif ?>
537 - <?php if ( 'plan' === $p['id'] ) : ?>
538 - <?php if ( $fs->is_trial() ) : ?>
539 - <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
540 - <?php endif ?>
541 - <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
542 - <?php if ( ! $is_active_subscription && ! $is_active_bundle_subscription && ! $license->is_first_payment_pending() ) : ?>
543 - <?php $is_license_expired = $license->is_expired() ?>
544 - <?php $expired_ago_text = ( fs_text_inline( 'Expired', 'expired', $slug ) . ' ' . fs_text_x_inline( '%s ago', 'x-ago', $slug ) ) ?>
545 - <label
546 - class="fs-tag <?php echo $is_license_expired ? 'fs-error' : 'fs-warn' ?>"><?php
547 - echo esc_html( sprintf( $is_license_expired ? $expired_ago_text : $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) )
548 - ?></label>
549 - <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
550 - <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
551 - <?php endif ?>
552 - <?php elseif ( $fs->is_trial() ) : ?>
553 - <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
554 - <?php endif ?>
555 - <?php if ( ! $is_whitelabeled ) : ?>
556 - <div class="button-group">
557 - <?php if ( is_object( $available_license ) ) : ?>
558 - <?php
559 - $view_params = array(
560 - 'freemius' => $fs,
561 - 'slug' => $slug,
562 - 'license' => $available_license,
563 - 'plan' => $available_license_paid_plan,
564 - 'is_localhost' => $site->is_localhost(),
565 - 'install_id' => $site->id,
566 - 'class' => 'button-primary',
567 - );
568 - fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
569 - <?php else : ?>
570 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
571 - method="POST" class="button-group">
572 - <?php if ( $show_upgrade && $is_premium ) : ?>
573 - <a class="button activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a>
574 - <?php endif ?>
575 - <input type="submit" class="button"
576 - value="<?php echo esc_attr( $sync_license_text ) ?>">
577 - <input type="hidden" name="fs_action"
578 - value="<?php echo $fs->get_unique_affix() ?>_sync_license">
579 - <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
580 - <?php if ( $show_upgrade || $is_plan_change_supported ) : ?>
581 - <a href="<?php echo $fs->get_upgrade_url() ?>"
582 - class="button<?php
583 - echo $show_upgrade ?
584 - ' button-primary fs-upgrade' :
585 - ' fs-change-plan'; ?> button-upgrade"><i
586 - class="dashicons dashicons-cart"></i> <?php echo esc_html( $show_upgrade ? $upgrade_text : $change_plan_text ) ?></a>
587 - <?php endif ?>
588 - </form>
589 - <?php endif ?>
590 - </div>
591 - <?php endif ?>
592 - <?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
593 - <?php if ( is_object( $bundle_subscription ) ) : ?>
594 - <?php if ( $is_active_bundle_subscription && ! $is_bundle_first_payment_pending ) : ?>
595 - <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
596 - <?php endif ?>
597 - <?php endif ?>
598 - <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
599 - <?php if ( $fs->has_premium_version() ) : ?>
600 - <?php if ( $is_premium ) : ?>
601 - <label
602 - class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php fs_esc_html_echo_inline( 'Premium version', 'premium-version', $slug ) ?></label>
603 - <?php elseif ( $fs->can_use_premium_code() ) : ?>
604 - <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
605 - <?php endif ?>
606 - <?php endif ?>
607 - <?php endif ?>
608 - </td>
609 - <?php if ( 'plan' !== $p['id'] && 'bundle_plan' !== $p['id'] ) : ?>
610 - <td class="fs-right">
611 - <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
612 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
613 - <input type="hidden" name="fs_action" value="verify_email">
614 - <?php wp_nonce_field( 'verify_email' ) ?>
615 - <input type="submit" class="button button-small"
616 - value="<?php fs_esc_attr_echo_inline( 'Verify Email', 'verify-email', $slug ) ?>">
617 - </form>
618 - <?php endif ?>
619 - <?php if ( 'version' === $p['id'] ) : ?>
620 - <?php if ( $fs->has_release_on_freemius() ) : ?>
621 - <div class="button-group">
622 - <?php if ( $is_paying || $fs->is_trial() ) : ?>
623 - <?php if ( ! $fs->is_allowed_to_install() ) : ?>
624 - <a target="_blank" rel="noopener" class="button button-primary"
625 - href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php
626 - $download_version_text_suffix = ( is_object( $update ) ? ' [' . $update->version . ']' : '' );
627 -
628 - $download_version_text = sprintf(
629 - /* translators: %s: plan name (e.g. Download "Professional" Version) */
630 - fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
631 - ( $fs->is_trial() ? $trial_plan->title : $plan->title )
632 - ) .
633 - $download_version_text_suffix;
634 -
635 - $download_version_text_length = function_exists( 'mb_strlen' ) ?
636 - mb_strlen( $download_version_text ) :
637 - strlen( $download_version_text );
638 -
639 - if ( $download_version_text_length > 31 ) {
640 - /**
641 - * Try to limit the number of characters to 31 for now.
642 - *
643 - * @author Leo Fajardo (@leorw)
644 - * @aince 2.3.2
645 - */
646 - $download_version_text = fs_text_inline( 'Download Paid Version', 'download-paid-version', $slug ) . $download_version_text_suffix;
647 - }
648 -
649 - echo $download_version_text;
650 - ?></a>
651 - <?php elseif ( is_object( $update ) ) : ?>
652 - <?php
653 - $module_type = $fs->get_module_type();
654 - ?>
655 - <a class="button button-primary"
656 - href="<?php echo wp_nonce_url( self_admin_url( "update.php?action=upgrade-{$module_type}&{$module_type}=" . $fs->get_plugin_basename() ), "upgrade-{$module_type}_" . $fs->get_plugin_basename() ) ?>"><?php echo fs_esc_html_inline( 'Install Update Now', 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
657 - <?php endif ?>
658 - <?php endif; ?>
659 - </div>
660 - <?php endif ?>
661 - <?php
662 - elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
663 - <?php if ( ! $is_whitelabeled && ( 'site_secret_key' === $p['id'] || ! $is_license_foreign ) ) : ?>
664 - <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
665 - <?php endif ?>
666 - <?php if ('license_key' === $p['id']) : ?>
667 - <button class="button button-small activate-license-trigger <?php echo $fs->get_unique_affix() ?>"><?php fs_esc_html_echo_inline( 'Change License', 'change-license', $slug ) ?></button>
668 - <?php endif ?>
669 - <?php
670 - elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
671 - ( is_string( $user->secret_key ) && in_array( $p['id'], array(
672 - 'email',
673 - 'user_name'
674 - ) ) )
675 - ) : ?>
676 - <?php if ( 'email' !== $p['id'] || ! fs_is_network_admin() ) : ?>
677 - <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
678 - onsubmit="var val = prompt('<?php echo esc_attr( sprintf(
679 - /* translators: %s: User's account property (e.g. name, email) */
680 - fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ),
681 - $p['title']
682 - ) ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>]').val(val); return true;">
683 - <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
684 - <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>"
685 - value="">
686 - <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
687 - <input type="submit" class="button button-small <?php if ( 'email' === $p['id'] ) echo 'button-edit-email-address' ?>"
688 - value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>">
689 - </form>
690 - <?php endif ?>
691 - <?php elseif ( 'user_id' === $p['id'] && ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) : ?>
692 - <input id="fs_change_user" type="submit" class="button button-small"
693 - value="<?php echo fs_esc_attr_inline( 'Change User', 'change-user', $slug ) ?>">
694 - <?php endif ?>
695 - </td>
696 - <?php endif ?>
697 - </tr>
698 - <?php
699 - if ( 'version' === $p['id'] && $is_premium ) {
700 - /**
701 - * If there's a row for the beta program, keep its background color
702 - * the same as the version info row.
703 - *
704 - * @author Leo Fajardo (@leorw)
705 - * @since 2.3.0
706 - */
707 - continue;
708 - }
709 -
710 - $odd = ! $odd;
711 - endforeach ?>
712 - </table>
713 - </div>
714 - </div>
715 - <?php if ( fs_is_network_admin() ) : ?>
716 - <div id="fs_sites" class="postbox">
717 - <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
718 - <div class="fs-header-actions">
719 - <?php if ( ! $is_whitelabeled ) : ?>
720 - <?php $has_license = is_object( $license ) ?>
721 - <?php if ( $has_license || ( $show_upgrade && $is_premium ) ) : ?>
722 - <?php
723 - $activate_license_button_text = $has_license ?
724 - fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
725 - fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
726 - ?>
727 - <a class="button<?php echo ( ! $has_license ? ' button-primary' : '' ) ?> activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php echo $activate_license_button_text ?></a>
728 - <?php endif ?>
729 - <?php endif ?>
730 - <input class="fs-search" type="text" placeholder="<?php fs_esc_attr_echo_inline( 'Search by address', 'search-by-address', $slug ) ?>..."><span class="dashicons dashicons-search"></span>
731 - </div>
732 - <div class="inside">
733 - <div id="" class="fs-scrollable-table">
734 - <div class="fs-table-head">
735 - <table class="widefat">
736 - <thead>
737 - <tr>
738 - <td><?php fs_esc_html_echo_inline('ID', 'id', $slug) ?></td>
739 - <td><?php fs_esc_html_echo_inline('Address', 'address', $slug) ?></td>
740 - <td><?php fs_esc_html_echo_inline('License', 'license', $slug) ?></td>
741 - <td><?php fs_esc_html_echo_inline('Plan', 'plan', $slug) ?></td>
742 - <td></td>
743 - </tr>
744 - </thead>
745 - </table>
746 - </div>
747 - <div class="fs-table-body">
748 - <table class="widefat">
749 - <?php
750 - $current_blog_id = get_current_blog_id();
751 -
752 - foreach ( $site_view_params as $view_params ) {
753 - fs_require_template(
754 - 'account/partials/site.php',
755 - $view_params
756 - );
757 - }
758 -
759 - /**
760 - * It's possible for the `Freemius::switch_to_blog()` method to be called within the `site.php` template and this changes the Freemius instance's context, so this check is for restoring the previous context based on the previously retrieved site.
761 - *
762 - * @author Leo Fajardo (@leorw)
763 - * @since 2.5.0
764 - */
765 - $current_install = $fs->get_site();
766 -
767 - if (
768 - is_object( $site ) &&
769 - ( ! is_object( $current_install ) || $current_install->id != $site->id )
770 - ) {
771 - $fs->switch_to_blog( $current_blog_id, $site, true );
772 - }
773 - ?>
774 - </table>
775 - </div>
776 - </div>
777 - </div>
778 - </div>
779 - <?php endif ?>
780 - <?php if ( 0 < count( $addons_to_show ) ) : ?>
781 - <!-- Add-Ons -->
782 - <div class="postbox">
783 - <div class="">
784 - <!-- <div class="inside">-->
785 - <table id="fs_addons" class="widefat">
786 - <thead>
787 - <tr>
788 - <th><h3><?php echo esc_html( $addons_text ) ?></h3></th>
789 - <th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
790 - <th><?php echo esc_html( $version_text ) ?></th>
791 - <th><?php echo esc_html( $plan_text ) ?></th>
792 - <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th>
793 - <th></th>
794 - <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
795 - <th></th>
796 - <?php endif ?>
797 - </tr>
798 - </thead>
799 - <tbody>
800 - <?php
801 - $odd = true;
802 -
803 - $installed_addons_ids_map = array_flip( $installed_addons_ids );
804 -
805 - $addon_info_by_id = array();
806 - $hide_all_addons_data = false;
807 -
808 - if ( $fs->is_whitelabeled_by_flag() ) {
809 - $hide_all_addons_data = true;
810 -
811 - foreach ( $addons_to_show as $addon_id ) {
812 - $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
813 - $addon_info = $fs->_get_addon_info( $addon_id, $is_addon_installed );
814 - $is_addon_connected = $addon_info['is_connected'];
815 -
816 - $fs_addon = ( $is_addon_connected && $is_addon_installed ) ?
817 - freemius( $addon_id ) :
818 - null;
819 -
820 - $is_whitelabeled = is_object( $fs_addon ) ?
821 - $fs_addon->is_whitelabeled( true ) :
822 - $addon_info['is_whitelabeled'];
823 -
824 - if ( ! $is_whitelabeled ) {
825 - $hide_all_addons_data = false;
826 - }
827 -
828 - if ( $is_data_debug_mode ) {
829 - $is_whitelabeled = false;
830 - }
831 -
832 - $addon_info_by_id[ $addon_id ] = $addon_info;
833 - }
834 - }
835 -
836 - foreach ( $addons_to_show as $addon_id ) {
837 - $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
838 -
839 - if (
840 - $hide_all_addons_data &&
841 - ! $is_addon_installed &&
842 - ! file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $fs->get_addon_basename( $addon_id ) ) )
843 - ) {
844 - continue;
845 - }
846 -
847 - $addon_view_params = array(
848 - 'parent_fs' => $fs,
849 - 'addon_id' => $addon_id,
850 - 'odd' => $odd,
851 - 'fs_blog_id' => $fs_blog_id,
852 - 'active_plugins_directories_map' => &$active_plugins_directories_map,
853 - 'is_addon_installed' => $is_addon_installed,
854 - 'addon_info' => isset( $addon_info_by_id[ $addon_id ] ) ?
855 - $addon_info_by_id[ $addon_id ] :
856 - $fs->_get_addon_info( $addon_id, $is_addon_installed ),
857 - 'is_whitelabeled' => ( $is_whitelabeled && ! $is_data_debug_mode )
858 - );
859 -
860 - fs_require_template(
861 - 'account/partials/addon.php',
862 - $addon_view_params
863 - );
864 -
865 - $odd = ! $odd;
866 - } ?>
867 - </tbody>
868 - </table>
869 - </div>
870 - </div>
871 - <?php endif ?>
872 -
873 - <?php $fs->do_action( 'after_account_details' ) ?>
874 -
875 - <?php
876 - if ( $show_billing ) {
877 - $view_params = array( 'id' => $VARS['id'], 'payments' => $payments );
878 - fs_require_once_template( 'account/billing.php', $view_params );
879 - fs_require_once_template( 'account/payments.php', $view_params );
880 - }
881 - ?>
882 - </div>
883 - </div>
884 - </div>
885 - </div>
886 - </div>
887 - <?php
888 - $subscription_cancellation_dialog_box_template_params = $fs->_get_subscription_cancellation_dialog_box_template_params( true );
889 - if ( ! empty( $subscription_cancellation_dialog_box_template_params ) ) {
890 - fs_require_template( 'forms/subscription-cancellation.php', $subscription_cancellation_dialog_box_template_params );
891 - }
892 - ?>
893 - <script type="text/javascript">
894 - (function ($) {
895 - var setLoading = function ($this, label) {
896 - // Set loading mode.
897 - $(document.body).css({'cursor': 'wait'});
898 -
899 - $this.css({'cursor': 'wait'});
900 -
901 - if ($this.is('input'))
902 - $this.val(label);
903 - else
904 - $this.html(label);
905 -
906 - setTimeout(function () {
907 - $this.attr('disabled', 'disabled');
908 - }, 200);
909 - };
910 -
911 - $('.fs-toggle-visibility').click(function () {
912 - var
913 - $this = $(this),
914 - $parent = $this.closest('tr'),
915 - $input = $parent.find('input');
916 -
917 - $parent.find('code').toggle();
918 - $input.toggle();
919 -
920 - if ($input.is(':visible')) {
921 - $this.html('<?php fs_esc_js_echo_x_inline( 'Hide', 'verb', 'hide', $slug ) ?>');
922 - setTimeout(function () {
923 - $input.select().focus();
924 - }, 100);
925 - }
926 - else {
927 - $this.html( '<?php fs_esc_js_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?>' );
928 - }
929 - });
930 -
931 - $('.fs-toggle-tracking').click(function () {
932 - setLoading(
933 - $(this),
934 - ($(this).data('is-disconnected') ?
935 - '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>' :
936 - '<?php fs_esc_js_echo_inline('Opting out', 'opting-out' ) ?>') +
937 - '...'
938 - );
939 - });
940 -
941 - <?php
942 - $plugin_title = $fs->get_plugin_title();
943 - $processing_text = fs_esc_js_inline( 'Processing', 'processing' );
944 - $confirmation_message = sprintf(
945 - '%s %s',
946 - sprintf( fs_esc_attr_inline( 'Get updates for bleeding edge Beta versions of %s.', 'get-beta-versions', $slug ), $plugin_title ),
947 - sprintf( fs_esc_attr_inline( 'An update to a Beta version will replace your installed version of %s with the latest Beta release - use with caution, and not on production sites. You have been warned.', 'beta-version-update-caution', $slug ), $plugin_title )
948 - );
949 - ?>
950 -
951 - $( '.fs-toggle-beta-mode' ).click( function () {
952 - var $checkbox = $( this ),
953 - isChecked = $checkbox.is( ':checked' );
954 -
955 - if ( ! isChecked || confirm( '<?php echo $confirmation_message ?>' ) ) {
956 - $.ajax( {
957 - url : <?php echo Freemius::ajax_url() ?>,
958 - method: 'POST',
959 - data : {
960 - action : '<?php echo $fs->get_ajax_action( 'set_beta_mode' ) ?>',
961 - security : '<?php echo $fs->get_ajax_security( 'set_beta_mode' ) ?>',
962 - is_beta : isChecked,
963 - module_id: <?php echo $fs->get_id() ?>
964 - },
965 - beforeSend: function () {
966 - $checkbox.prop( 'disabled', true );
967 - $checkbox.parent().find( 'span' ).text( '<?php echo $processing_text ?>' + '...' );
968 - },
969 - complete: function () {
970 - $checkbox.prop( 'disabled', false );
971 - $checkbox.parent().find( 'span' ).text( '<?php fs_esc_js_echo_inline( 'Join the Beta Program', 'join-beta', $slug ) ?>' );
972 - }
973 - } );
974 -
975 - return true;
976 - }
977 -
978 - return false;
979 - });
980 -
981 - $('.fs-opt-in').click(function () {
982 - setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');
983 - });
984 -
985 - $( '#fs_downgrade' ).submit(function( event ) {
986 - event.preventDefault();
987 -
988 - setLoading( $( this ).find( '.button' ), '<?php fs_esc_js_echo_inline( 'Downgrading', 'downgrading' ) ?>...' );
989 - });
990 -
991 - $('.fs-activate-license').click(function () {
992 - setLoading($(this), '<?php fs_esc_js_echo_inline('Activating', 'activating' ) ?>...');
993 - });
994 -
995 - var $deactivateLicenseOrCancelTrial = $( '.fs-deactivate-license, .fs-cancel-trial' ),
996 - $subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' );
997 -
998 - if ( 0 !== $subscriptionCancellationModal.length ) {
999 - $subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
1000 - setLoading(
1001 - $deactivateLicenseOrCancelTrial,
1002 - ( ! $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ?
1003 - '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>' :
1004 - '<?php echo esc_html( sprintf( fs_text_inline( 'Cancelling %s', 'cancelling-x', $slug ), fs_text_inline( 'trial', 'trial', $slug ) ) ) ?>' ) + '...'
1005 - );
1006 -
1007 - $subscriptionCancellationModal.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
1008 - $deactivateLicenseOrCancelTrial.unbind( 'click' );
1009 -
1010 - if ( false === cancelSubscription || $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ) {
1011 - $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( $deactivateLicenseOrCancelTrial.text() );
1012 -
1013 - $deactivateLicenseOrCancelTrial[0].parentNode.submit();
1014 - } else {
1015 - var $form = $( 'input[value="downgrade_account"],input[value="cancel_trial"]' ).parent();
1016 - $form.prepend( '<input type="hidden" name="deactivate_license" value="true" />' );
1017 -
1018 - $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( '<?php echo esc_js( sprintf(
1019 - fs_text_inline( 'Cancelling %s...', 'cancelling-x' , $slug ),
1020 - $is_paid_trial ?
1021 - fs_text_inline( 'trial', 'trial', $slug ) :
1022 - fs_text_inline( 'subscription', 'subscription', $slug )
1023 - ) ) ?>' );
1024 -
1025 - $form.submit();
1026 - }
1027 - });
1028 - }
1029 -
1030 - $deactivateLicenseOrCancelTrial.click(function() {
1031 - var $this = $( this );
1032 - if ( $this.hasClass( 'fs-cancel-trial' ) ) {
1033 - $subscriptionCancellationModal.find( '.fs-modal-panel' ).find( 'ul.subscription-actions, .fs-price-increase-warning' ).remove();
1034 - $subscriptionCancellationModal.find( '.fs-modal-panel > p' ).text( <?php echo json_encode( $cancel_trial_confirm_text ) ?> );
1035 - $subscriptionCancellationModal.trigger( 'showModal' );
1036 - } else if (confirm('<?php fs_esc_attr_echo_inline( 'Deactivating your license will block all premium features, but will enable activating the license on another site. Are you sure you want to proceed?', 'deactivate-license-confirm', $slug ) ?>')) {
1037 - var $this = $(this);
1038 -
1039 - if ( 0 !== $subscriptionCancellationModal.length ) {
1040 - $subscriptionCancellationModal.trigger( 'showModal' );
1041 - } else {
1042 - setLoading( $this, '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>...' );
1043 - $this[0].parentNode.submit();
1044 - }
1045 - }
1046 -
1047 - return false;
1048 - });
1049 -
1050 - var $sitesSection = $('#fs_sites'),
1051 - $sitesTable = $sitesSection.find('.fs-scrollable-table'),
1052 - $sitesTableRows = $sitesTable.find('.fs-site-details');
1053 -
1054 - $('.fs-show-install-details').click(function(){
1055 - var installID = $(this).parents('.fs-site-details').attr('data-install-id');
1056 - $sitesSection.find('.fs-install-details[data-install-id=' + installID + ']').toggle();
1057 - });
1058 -
1059 -
1060 - var adjustColumnWidth = function($table) {
1061 - var $headerColumns = $table.find('.fs-table-head td'),
1062 - $bodyColumns = $table.find('.fs-table-body tr:first > td');
1063 -
1064 - for (var i = 0, len = $headerColumns.length; i < len; i++) {
1065 - $($headerColumns[i]).width($($bodyColumns[i]).width());
1066 - }
1067 - for (i = 0, len = $headerColumns.length; i < len; i++) {
1068 - $($bodyColumns[i]).width($($headerColumns[i]).width());
1069 - }
1070 - };
1071 -
1072 - adjustColumnWidth($sitesTable);
1073 -
1074 - $sitesSection.find('.fs-search').keyup(function(){
1075 - var search = $(this).val().trim();
1076 -
1077 - if ('' === search){
1078 - // Show all.
1079 - $sitesTableRows.show();
1080 - return;
1081 - }
1082 -
1083 - var url;
1084 -
1085 - $sitesTableRows.each(function(index){
1086 - url = $(this).find('.fs-field-url').html();
1087 -
1088 - if (-1 < url.indexOf(search)){
1089 - $(this).show();
1090 - } else {
1091 - $(this).hide();
1092 - }
1093 - });
1094 - });
1095 -
1096 - $( '.fs-toggle-whitelabel-mode' ).click( function () {
1097 - var $toggleLink = $( this );
1098 -
1099 - $.ajax( {
1100 - url : <?php echo Freemius::ajax_url() ?>,
1101 - method: 'POST',
1102 - data : {
1103 - action : '<?php echo $fs->get_ajax_action( 'toggle_whitelabel_mode' ) ?>',
1104 - security : '<?php echo $fs->get_ajax_security( 'toggle_whitelabel_mode' ) ?>',
1105 - module_id: <?php echo $fs->get_id() ?>
1106 - },
1107 - beforeSend: function () {
1108 - $toggleLink.parent().text( '<?php
1109 - $is_whitelabeled ?
1110 - fs_esc_html_echo_inline( 'Disabling white-label mode', 'disabling-whitelabel-mode' ) :
1111 - fs_esc_html_echo_inline( 'Enabling white-label mode', 'enabling-whitelabel-mode' )
1112 - ?>' + '...' );
1113 - },
1114 - complete: function () {
1115 - location.reload();
1116 - }
1117 - } );
1118 - });
1119 - })(jQuery);
1120 - </script>
1121 -<?php
1122 - if ( $has_tabs ) {
1123 - $fs->_add_tabs_after_content();
1124 - }
1125 -
1126 - $params = array(
1127 - 'page' => 'account',
1128 - 'module_id' => $fs->get_id(),
1129 - 'module_type' => $fs->get_module_type(),
1130 - 'module_slug' => $slug,
1131 - 'module_version' => $fs->get_plugin_version(),
1132 - );
1133 - fs_require_template( 'powered-by.php', $params );
1 +<?php
2 + /**
3 + * @package Freemius
4 + * @copyright Copyright (c) 2015, Freemius, Inc.
5 + * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 + * @since 1.0.3
7 + */
8 +
9 + if ( ! defined( 'ABSPATH' ) ) {
10 + exit;
11 + }
12 +
13 + /**
14 + * @var array $VARS
15 + * @var Freemius $fs
16 + */
17 + $fs = freemius( $VARS['id'] );
18 +
19 + $slug = $fs->get_slug();
20 +
21 + /**
22 + * @var FS_Plugin_Tag $update
23 + */
24 + $update = $fs->has_release_on_freemius() ?
25 + $fs->get_update( false, false ) :
26 + null;
27 +
28 + if ( is_object($update) ) {
29 + /**
30 + * This logic is particularly required for multisite environment.
31 + * If a module is site activated (not network) and not on the main site,
32 + * the module will NOT be executed on the network level, therefore, the
33 + * custom updates logic will not be executed as well, so unless we force
34 + * the injection of the update into the updates transient, premium updates
35 + * will not work.
36 + *
37 + * @author Vova Feldman (@svovaf)
38 + * @since 2.0.0
39 + */
40 + $updater = FS_Plugin_Updater::instance( $fs );
41 + $updater->set_update_data( $update );
42 + }
43 +
44 + $is_paying = $fs->is_paying();
45 + $user = $fs->get_user();
46 + $site = $fs->get_site();
47 + $name = $user->get_name();
48 + $license = $fs->_get_license();
49 + $is_license_foreign = ( is_object( $license ) && $user->id != $license->user_id );
50 + $is_data_debug_mode = $fs->is_data_debug_mode();
51 + $is_whitelabeled = $fs->is_whitelabeled();
52 + $subscription = ( is_object( $license ) ?
53 + $fs->_get_subscription( $license->id ) :
54 + null );
55 + $plan = $fs->get_plan();
56 + $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
57 + $is_paid_trial = $fs->is_paid_trial();
58 + $has_paid_plan = $fs->apply_filters( 'has_paid_plan_account', $fs->has_paid_plan() );
59 + $show_upgrade = ( ! $is_whitelabeled && $has_paid_plan && ! $is_paying && ! $is_paid_trial );
60 + $trial_plan = $fs->get_trial_plan();
61 +
62 + $is_plan_change_supported = (
63 + ! $fs->is_single_plan() &&
64 + ! $fs->apply_filters( 'hide_plan_change', false )
65 + );
66 +
67 + if ( $has_paid_plan ) {
68 + $fs->_add_license_activation_dialog_box();
69 + }
70 +
71 + if ( $fs->should_handle_user_change() ) {
72 + $fs->_add_email_address_update_dialog_box();
73 + }
74 +
75 + $ids_of_installs_activated_with_foreign_licenses = $fs->should_handle_user_change() ?
76 + $fs->get_installs_ids_with_foreign_licenses() :
77 + array();
78 +
79 + if ( ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) {
80 + $fs->_add_user_change_dialog_box( $ids_of_installs_activated_with_foreign_licenses );
81 + }
82 +
83 + if ( $fs->is_whitelabeled( true ) || $fs->is_data_debug_mode() ) {
84 + $fs->_add_data_debug_mode_dialog_box();
85 + }
86 +
87 + if ( fs_request_get_bool( 'auto_install' ) ) {
88 + $fs->_add_auto_installation_dialog_box();
89 + }
90 +
91 + if ( fs_request_get_bool( 'activate_license' ) ) {
92 + // Open the license activation dialog box on the account page.
93 + add_action( 'admin_footer', array(
94 + &$fs,
95 + '_open_license_activation_dialog_box'
96 + ) );
97 + }
98 +
99 + $show_billing = ( ! $is_whitelabeled && ! $fs->apply_filters( 'hide_billing_and_payments_info', false ) );
100 + if ( $show_billing ) {
101 + $payments = $fs->_fetch_payments();
102 +
103 + $show_billing = ( is_array( $payments ) && 0 < count( $payments ) );
104 + }
105 +
106 +
107 + $has_tabs = $fs->_add_tabs_before_content();
108 +
109 + // Aliases.
110 + $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
111 + $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
112 + $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
113 + /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
114 + $downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
115 + $prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
116 + $cancel_trial_confirm_text = fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug );
117 + $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
118 + $after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
119 + /* translators: %s: Plan title (e.g. "Professional") */
120 + $activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
121 + $version_text = fs_text_x_inline( 'Version', 'product version', 'version', $slug );
122 + /* translators: %s: Time period (e.g. Auto renews in "2 months") */
123 + $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
124 + /* translators: %s: Time period (e.g. Expires in "2 months") */
125 + $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
126 + $sync_license_text = fs_text_x_inline( 'Sync License', 'as synchronize license', 'sync-license', $slug );
127 + $cancel_trial_text = fs_text_inline( 'Cancel Trial', 'cancel-trial', $slug );
128 + $change_plan_text = fs_text_inline( 'Change Plan', 'change-plan', $slug );
129 + $upgrade_text = fs_text_x_inline( 'Upgrade', 'verb', 'upgrade', $slug );
130 + $addons_text = fs_text_inline( 'Add-Ons', 'add-ons', $slug );
131 + $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
132 + $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
133 + $free_text = fs_text_inline( 'Free', 'free', $slug );
134 + $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
135 + $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
136 + $bundle_plan_text = fs_text_inline( 'Bundle Plan', 'bundle-plan', $slug );
137 +
138 + $show_plan_row = true;
139 + $show_license_row = is_object( $license );
140 +
141 + $site_view_params = array();
142 +
143 + if ( fs_is_network_admin() ) {
144 + $sites = Freemius::get_sites();
145 + $all_installs_plan_id = null;
146 + $all_installs_license_id = ( $show_license_row ? $license->id : null );
147 + foreach ( $sites as $s ) {
148 + $site_info = $fs->get_site_info( $s );
149 + $install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
150 + $view_params = array(
151 + 'freemius' => $fs,
152 + 'user' => $fs->get_user(),
153 + 'license' => $license,
154 + 'site' => $site_info,
155 + 'install' => $install,
156 + );
157 +
158 + $site_view_params[] = $view_params;
159 +
160 + if ( empty( $install ) ) {
161 + continue;
162 + }
163 +
164 + if ( $show_plan_row ) {
165 + if ( is_null( $all_installs_plan_id ) ) {
166 + $all_installs_plan_id = $install->plan_id;
167 + } else if ( $all_installs_plan_id != $install->plan_id ) {
168 + $show_plan_row = false;
169 + }
170 + }
171 +
172 + if ( $show_license_row && $all_installs_license_id != $install->license_id ) {
173 + $show_license_row = false;
174 + }
175 + }
176 + }
177 +
178 + $has_bundle_license = false;
179 +
180 + if ( is_object( $license ) &&
181 + FS_Plugin_License::is_valid_id( $license->parent_license_id )
182 + ) {
183 + // Context license has a parent license, therefore, the account has a bundle license.
184 + $has_bundle_license = true;
185 + }
186 +
187 + $bundle_subscription = null;
188 + $is_bundle_first_payment_pending = false;
189 +
190 + if (
191 + $show_plan_row &&
192 + is_object( $license ) &&
193 + $has_bundle_license
194 + ) {
195 + $bundle_plan_title = strtoupper( $license->parent_plan_title );
196 + $bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
197 + $is_bundle_first_payment_pending = $license->is_first_payment_pending();
198 + }
199 +
200 + $fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
201 + get_current_blog_id() :
202 + 0;
203 +
204 + $active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
205 +
206 + $is_premium = $fs->is_premium();
207 +
208 + $account_addons = $fs->get_updated_account_addons();
209 + $installed_addons = $fs->get_installed_addons();
210 + $installed_addons_ids = array();
211 +
212 + /**
213 + * Store the installed add-ons' IDs into a collection which will be used in determining the add-ons to show on the "Account" page, and at the same time try to find an add-on that is activated with a bundle license if the core product is not.
214 + *
215 + * @author Leo Fajardo
216 + *
217 + * @since 2.4.0
218 + */
219 + foreach ( $installed_addons as $fs_addon ) {
220 + $installed_addons_ids[] = $fs_addon->get_id();
221 +
222 + if ( $has_bundle_license ) {
223 + // We already have the context bundle license details, skip.
224 + continue;
225 + }
226 +
227 + if (
228 + $show_plan_row &&
229 + $fs_addon->has_active_valid_license()
230 + ) {
231 + $addon_license = $fs_addon->_get_license();
232 +
233 + if ( FS_Plugin_License::is_valid_id( $addon_license->parent_license_id ) ) {
234 + // Add-on's license is associated with a parent/bundle license.
235 + $has_bundle_license = true;
236 +
237 + $bundle_plan_title = strtoupper( $addon_license->parent_plan_title );
238 + $bundle_subscription = $fs_addon->_get_subscription( $addon_license->parent_license_id );
239 + $is_bundle_first_payment_pending = $addon_license->is_first_payment_pending();
240 + }
241 + }
242 + }
243 +
244 + $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
245 +
246 + $is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
247 +
248 + $available_license = ( $fs->is_free_plan() && ! fs_is_network_admin() ) ?
249 + $fs->_get_available_premium_license( $site->is_localhost() ) :
250 + null;
251 +
252 + $available_license_paid_plan = is_object( $available_license ) ?
253 + $fs->_get_plan_by_id( $available_license->plan_id ) :
254 + null;
255 +
256 + $is_dev_mode = ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE );
257 +?>
258 + <div class="wrap fs-section">
259 + <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
260 + <h2 class="nav-tab-wrapper">
261 + <a href="<?php echo esc_url( $fs->get_account_url() ) ?>"
262 + class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
263 + <?php if ( $fs->has_addons() ) : ?>
264 + <a href="<?php echo esc_url( $fs->_get_admin_page_url( 'addons' ) ) ?>"
265 + class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
266 + <?php endif ?>
267 + <?php if ( $show_upgrade ) : ?>
268 + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
269 + <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
270 + <a href="<?php echo esc_url( $fs->get_trial_url() ) ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
271 + <?php endif ?>
272 + <?php endif ?>
273 + </h2>
274 + <?php endif ?>
275 +
276 + <div id="poststuff">
277 + <div id="fs_account">
278 + <div class="has-sidebar has-right-sidebar">
279 + <div class="has-sidebar-content">
280 + <div class="postbox">
281 + <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
282 + <div class="fs-header-actions">
283 + <ul>
284 + <?php if ( $fs->is_whitelabeled( true ) ) : ?>
285 + <li>
286 + <a href="#" class="debug-license-trigger"><i class="dashicons dashicons-<?php echo $is_whitelabeled ? 'editor-code' : 'controls-pause' ?>"></i> <span><?php
287 + if ( $is_whitelabeled ) {
288 + fs_esc_html_echo_inline( 'Start Debug', 'start-debug-license', $slug );
289 + } else {
290 + fs_esc_html_echo_inline( 'Stop Debug', 'stop-debug-license', $slug );
291 + }
292 + ?></span></a>
293 + </li>
294 + <li>&nbsp;&bull;&nbsp;</li>
295 + <?php endif ?>
296 + <?php if ( $show_billing ) : ?>
297 + <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></a></li>
298 + <li>&nbsp;&bull;&nbsp;</li>
299 + <?php endif ?>
300 + <?php if ( ! $is_whitelabeled ) : ?>
301 + <?php if ( ! $is_paying ) : ?>
302 + <li>
303 + <?php
304 + $view_params = array(
305 + 'freemius' => $fs,
306 + 'license' => $available_license,
307 + 'license_paid_plan' => $available_license_paid_plan,
308 + );
309 + fs_require_template( 'account/partials/disconnect-button.php', $view_params ); ?>
310 + </li>
311 + <li>&nbsp;&bull;&nbsp;</li>
312 + <?php endif ?>
313 + <?php if ( $is_paying ) : ?>
314 + <?php if ( ! fs_is_network_admin() ) : ?>
315 + <li>
316 + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
317 + <input type="hidden" name="fs_action" value="deactivate_license">
318 + <?php wp_nonce_field( 'deactivate_license' ) ?>
319 + <a href="#" class="fs-deactivate-license"><i
320 + class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
321 + </a>
322 + </form>
323 + </li>
324 + <li>&nbsp;&bull;&nbsp;</li>
325 + <?php endif ?>
326 + <?php if ( ! $license->is_lifetime() &&
327 + $is_active_subscription
328 + ) : ?>
329 + <li>
330 + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
331 + <input type="hidden" name="fs_action" value="downgrade_account">
332 + <?php wp_nonce_field( 'downgrade_account' ) ?>
333 + <a href="#"
334 + onclick="if ( confirm('<?php echo esc_attr( sprintf(
335 + $downgrade_x_confirm_text,
336 + ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
337 + $plan->title,
338 + human_time_diff( time(), strtotime( $license->expiration ) )
339 + ) ) ?> <?php if ( ! $license->is_block_features ) {
340 + echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
341 + } else {
342 + echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
343 + }?> <?php echo esc_attr( $prices_increase_text ) ?> <?php fs_esc_attr_echo_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug ) ?>') ) this.parentNode.submit(); return false;"><i class="dashicons dashicons-download"></i> <?php echo esc_html( $fs->is_only_premium() ? fs_text_inline( 'Cancel Subscription', 'cancel-subscription', $slug ) : $downgrade_text ) ?></a>
344 + </form>
345 + </li>
346 + <li>&nbsp;&bull;&nbsp;</li>
347 + <?php endif ?>
348 + <?php if ( $is_plan_change_supported ) : ?>
349 + <li>
350 + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"><i
351 + class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
352 + </li>
353 + <li>&nbsp;&bull;&nbsp;</li>
354 + <?php endif ?>
355 + <?php elseif ( $is_paid_trial ) : ?>
356 + <li>
357 + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
358 + <input type="hidden" name="fs_action" value="cancel_trial">
359 + <?php wp_nonce_field( 'cancel_trial' ) ?>
360 + <a href="#" class="fs-cancel-trial"><i
361 + class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
362 + </form>
363 + </li>
364 + <li>&nbsp;&bull;&nbsp;</li>
365 + <?php endif ?>
366 + <?php endif ?>
367 + <li>
368 + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>" method="POST">
369 + <input type="hidden" name="fs_action" value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license">
370 + <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
371 + <a href="#" onclick="this.parentNode.submit(); return false;"><i
372 + class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
373 + </form>
374 + </li>
375 + </ul>
376 + </div>
377 + <div class="inside">
378 + <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
379 + <?php
380 + $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
381 +
382 + $profile = array();
383 +
384 + if ( ! $is_whitelabeled ) {
385 + $profile[] = array(
386 + 'id' => 'user_name',
387 + 'title' => fs_text_inline( 'Name', 'name', $slug ),
388 + 'value' => $name
389 + );
390 + // if (isset($user->email) && false !== strpos($user->email, '@'))
391 + $profile[] = array(
392 + 'id' => 'email',
393 + 'title' => fs_text_inline( 'Email', 'email', $slug ),
394 + 'value' => $user->email
395 + );
396 +
397 + if ( is_numeric( $user->id ) ) {
398 + $profile[] = array(
399 + 'id' => 'user_id',
400 + 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
401 + 'value' => $user->id
402 + );
403 + }
404 + }
405 +
406 + $profile[] = array(
407 + 'id' => 'product',
408 + 'title' => ( $fs->is_plugin() ?
409 + fs_text_inline( 'Plugin', 'plugin', $slug ) :
410 + fs_text_inline( 'Theme', 'theme', $slug ) ),
411 + 'value' => $fs->get_plugin_title()
412 + );
413 +
414 + $profile[] = array(
415 + 'id' => 'product_id',
416 + 'title' => ( $fs->is_plugin() ?
417 + fs_text_inline( 'Plugin', 'plugin', $slug ) :
418 + fs_text_inline( 'Theme', 'theme', $slug ) ) . ' ' . fs_text_inline( 'ID', 'id', $slug ),
419 + 'value' => $fs->get_id()
420 + );
421 +
422 + if ( ! fs_is_network_admin()) {
423 + $profile[] = array(
424 + 'id' => 'site_id',
425 + 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
426 + 'value' => is_string( $site->id ) ?
427 + $site->id :
428 + fs_text_inline( 'No ID', 'no-id', $slug )
429 + );
430 +
431 + $profile[] = array(
432 + 'id' => 'site_public_key',
433 + 'title' => fs_text_inline( 'Public Key', 'public-key', $slug ),
434 + 'value' => $site->public_key
435 + );
436 +
437 + $profile[] = array(
438 + 'id' => 'site_secret_key',
439 + 'title' => fs_text_inline( 'Secret Key', 'secret-key', $slug ),
440 + 'value' => ( ( is_string( $site->secret_key ) ) ?
441 + $site->secret_key :
442 + fs_text_x_inline( 'No Secret', 'as secret encryption key missing', 'no-secret', $slug )
443 + )
444 + );
445 + }
446 +
447 + $profile[] = array(
448 + 'id' => 'version',
449 + 'title' => $version_text,
450 + 'value' => $fs->get_plugin_version()
451 + );
452 +
453 + if ( ! fs_is_network_admin() && $is_premium ) {
454 + $profile[] = array(
455 + 'id' => 'beta_program',
456 + 'title' => '',
457 + 'value' => $site->is_beta
458 + );
459 + }
460 +
461 + if ( $has_paid_plan || $has_bundle_license ) {
462 + if ( $fs->is_trial() ) {
463 + if ( $show_plan_row ) {
464 + $profile[] = array(
465 + 'id' => 'plan',
466 + 'title' => $plan_text,
467 + 'value' => ( is_string( $trial_plan->name ) ?
468 + strtoupper( $trial_plan->title ) :
469 + fs_text_inline( 'Trial', 'trial', $slug ) )
470 + );
471 + }
472 + } else {
473 + if ( $show_plan_row ) {
474 + $profile[] = array(
475 + 'id' => 'plan',
476 + 'title' => ( $has_bundle_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
477 + 'value' => strtoupper( is_string( $plan->name ) ?
478 + $plan->title :
479 + strtoupper( $free_text )
480 + )
481 + );
482 +
483 + if ( $has_bundle_license ) {
484 + $profile[] = array(
485 + 'id' => 'bundle_plan',
486 + 'title' => $bundle_plan_text,
487 + 'value' => $bundle_plan_title
488 + );
489 + }
490 + }
491 +
492 + if ( is_object( $license ) ) {
493 + if ( ! $hide_license_key ) {
494 + $profile[] = array(
495 + 'id' => 'license_key',
496 + 'title' => fs_text_inline( 'License Key', $slug ),
497 + 'value' => $license->secret_key,
498 + );
499 + }
500 + }
501 + }
502 + }
503 + ?>
504 + <?php $odd = true;
505 + foreach ( $profile as $p ) : ?>
506 + <?php
507 + if ( 'plan' === $p['id'] && ! $has_paid_plan ) {
508 + // If plugin don't have any paid plans, there's no reason
509 + // to show current plan.
510 + continue;
511 + }
512 + ?>
513 + <tr class="fs-field-<?php echo esc_attr( $p['id'] ) ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
514 + <td>
515 + <nobr><?php echo esc_html( $p['title'] ) ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
516 + </td>
517 + <td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
518 + <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
519 + <code><?php echo FS_Plugin_License::mask_secret_key_for_html( $p['value'] ) ?></code>
520 + <?php if ( ! $is_whitelabeled ) : ?>
521 + <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
522 + readonly/>
523 + <?php endif ?>
524 + <?php elseif ( 'beta_program' === $p['id'] ) : ?>
525 + <label>
526 + <input type="checkbox" class="fs-toggle-beta-mode" <?php checked( true, $p['value'] ) ?>/><span><?php
527 + fs_esc_html_echo_inline( 'Join the Beta program', 'join-beta', $slug )
528 + ?></span></label>
529 + <?php else : ?>
530 + <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
531 + <?php endif ?>
532 + <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
533 + <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'not verified', 'not-verified', $slug ) ?></label>
534 + <?php endif ?>
535 + <?php if ( 'plan' === $p['id'] ) : ?>
536 + <?php if ( $fs->is_trial() ) : ?>
537 + <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
538 + <?php endif ?>
539 + <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
540 + <?php if ( ! $is_active_subscription && ! $is_active_bundle_subscription && ! $license->is_first_payment_pending() ) : ?>
541 + <?php $is_license_expired = $license->is_expired() ?>
542 + <?php $expired_ago_text = ( fs_text_inline( 'Expired', 'expired', $slug ) . ' ' . fs_text_x_inline( '%s ago', 'x-ago', $slug ) ) ?>
543 + <label
544 + class="fs-tag <?php echo $is_license_expired ? 'fs-error' : 'fs-warn' ?>"><?php
545 + echo esc_html( sprintf( $is_license_expired ? $expired_ago_text : $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) )
546 + ?></label>
547 + <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
548 + <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
549 + <?php endif ?>
550 + <?php elseif ( $fs->is_trial() ) : ?>
551 + <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
552 + <?php endif ?>
553 + <?php if ( ! $is_whitelabeled ) : ?>
554 + <div class="button-group">
555 + <?php if ( is_object( $available_license ) ) : ?>
556 + <?php
557 + $view_params = array(
558 + 'freemius' => $fs,
559 + 'slug' => $slug,
560 + 'license' => $available_license,
561 + 'plan' => $available_license_paid_plan,
562 + 'is_localhost' => $site->is_localhost(),
563 + 'install_id' => $site->id,
564 + 'class' => 'button-primary',
565 + );
566 + fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
567 + <?php else : ?>
568 + <form action="<?php echo esc_url( $fs->_get_admin_page_url( 'account' ) ) ?>"
569 + method="POST" class="button-group">
570 + <?php if ( $show_upgrade && $is_premium ) : ?>
571 + <a class="button activate-license-trigger <?php echo esc_attr( $fs->get_unique_affix() ) ?>" href="#"><?php fs_esc_html_echo_inline( 'Activate License', 'activate-license', $slug ) ?></a>
572 + <?php endif ?>
573 + <input type="submit" class="button"
574 + value="<?php echo esc_attr( $sync_license_text ) ?>">
575 + <input type="hidden" name="fs_action"
576 + value="<?php echo esc_attr( $fs->get_unique_affix() ) ?>_sync_license">
577 + <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
578 + <?php if ( $show_upgrade || $is_plan_change_supported ) : ?>
579 + <a href="<?php echo esc_url( $fs->get_upgrade_url() ) ?>"
580 + class="button<?php
581 + echo $show_upgrade ?
582 + ' button-primary fs-upgrade' :
583 + ' fs-change-plan'; ?> button-upgrade"><i
584 + class="dashicons dashicons-cart"></i> <?php echo esc_html( $show_upgrade ? $upgrade_text : $change_plan_text ) ?></a>
585 + <?php endif ?>
586 + </form>
587 + <?php endif ?>
588 + </div>
589 + <?php endif ?>
590 + <?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
591 + <?php if ( is_object( $bundle_subscription ) ) : ?>
592 + <?php if ( $is_active_bundle_subscription && ! $is_bundle_first_payment_pending ) : ?>
593 + <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
594 + <?php endif ?>
595 + <?php endif ?>
596 + <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
597 + <?php if ( $fs->has_premium_version() ) : ?>
598 + <?php if ( $is_premium ) : ?>
599 + <label
600 + class="fs-tag fs-<?php echo $fs->can_use_premium_code() ? 'success' : 'warn' ?>"><?php fs_esc_html_echo_inline( 'Premium version', 'premium-version', $slug ) ?></label>
601 + <?php elseif ( $fs->can_use_premium_code() ) : ?>
602 + <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
603 + <?php endif ?>
604 + <?php endif ?>
605 + <?php endif ?>
606 + </td>
607 + <?php if ( 'plan' !== $p['id'] && 'bundle_plan' !== $p['id'] ) : ?>
608 + <td class="fs-right">
609 + <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
610 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
611 + <input type="hidden" name="fs_action" value="verify_email">
612 + <?php wp_nonce_field( 'verify_email' ) ?>
613 + <input type="submit" class="button button-small"
614 + value="<?php fs_esc_attr_echo_inline( 'Verify Email', 'verify-email', $slug ) ?>">
615 + </form>
616 + <?php endif ?>
617 + <?php if ( 'version' === $p['id'] ) : ?>
618 + <?php if ( $fs->has_release_on_freemius() ) : ?>
619 + <div class="button-group">
620 + <?php if ( $is_paying || $fs->is_trial() ) : ?>
621 + <?php if ( ! $fs->is_allowed_to_install() ) : ?>
622 + <a target="_blank" rel="noopener" class="button button-primary"
623 + href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php
624 + $download_version_text_suffix = ( is_object( $update ) ? ' [' . $update->version . ']' : '' );
625 +
626 + $download_version_text = sprintf(
627 + /* translators: %s: plan name (e.g. Download "Professional" Version) */
628 + fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
629 + ( $fs->is_trial() ? $trial_plan->title : $plan->title )
630 + ) .
631 + $download_version_text_suffix;
632 +
633 + $download_version_text_length = function_exists( 'mb_strlen' ) ?
634 + mb_strlen( $download_version_text ) :
635 + strlen( $download_version_text );
636 +
637 + if ( $download_version_text_length > 31 ) {
638 + /**
639 + * Try to limit the number of characters to 31 for now.
640 + *
641 + * @author Leo Fajardo (@leorw)
642 + * @aince 2.3.2
643 + */
644 + $download_version_text = fs_text_inline( 'Download Paid Version', 'download-paid-version', $slug ) . $download_version_text_suffix;
645 + }
646 +
647 + echo $download_version_text;
648 + ?></a>
649 + <?php elseif ( is_object( $update ) ) : ?>
650 + <?php
651 + $module_type = $fs->get_module_type();
652 + ?>
653 + <a class="button button-primary"
654 + href="<?php echo wp_nonce_url( self_admin_url( "update.php?action=upgrade-{$module_type}&{$module_type}=" . $fs->get_plugin_basename() ), "upgrade-{$module_type}_" . $fs->get_plugin_basename() ) ?>"><?php echo fs_esc_html_inline( 'Install Update Now', 'install-update-now', $slug ) . ' [' . $update->version . ']' ?></a>
655 + <?php endif ?>
656 + <?php endif; ?>
657 + </div>
658 + <?php endif ?>
659 + <?php
660 + elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
661 + <?php if ( ! $is_whitelabeled && ( 'site_secret_key' === $p['id'] || ! $is_license_foreign ) ) : ?>
662 + <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
663 + <?php endif ?>
664 + <?php if ('license_key' === $p['id']) : ?>
665 + <button class="button button-small activate-license-trigger <?php echo $fs->get_unique_affix() ?>"><?php fs_esc_html_echo_inline( 'Change License', 'change-license', $slug ) ?></button>
666 + <?php endif ?>
667 + <?php
668 + elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
669 + ( is_string( $user->secret_key ) && in_array( $p['id'], array(
670 + 'email',
671 + 'user_name'
672 + ) ) )
673 + ) : ?>
674 + <?php if ( 'email' !== $p['id'] || ! fs_is_network_admin() ) : ?>
675 + <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
676 + onsubmit="var val = prompt('<?php echo esc_attr( sprintf(
677 + /* translators: %s: User's account property (e.g. name, email) */
678 + fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ),
679 + $p['title']
680 + ) ) ?>', '<?php echo $p['value'] ?>'); if (null == val || '' === val) return false; jQuery('input[name=fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>]').val(val); return true;">
681 + <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
682 + <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>"
683 + value="">
684 + <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
685 + <input type="submit" class="button button-small <?php if ( 'email' === $p['id'] ) echo 'button-edit-email-address' ?>"
686 + value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>">
687 + </form>
688 + <?php endif ?>
689 + <?php elseif ( 'user_id' === $p['id'] && ! empty( $ids_of_installs_activated_with_foreign_licenses ) ) : ?>
690 + <input id="fs_change_user" type="submit" class="button button-small"
691 + value="<?php echo fs_esc_attr_inline( 'Change User', 'change-user', $slug ) ?>">
692 + <?php endif ?>
693 + </td>
694 + <?php endif ?>
695 + </tr>
696 + <?php
697 + if ( 'version' === $p['id'] && $is_premium ) {
698 + /**
699 + * If there's a row for the beta program, keep its background color
700 + * the same as the version info row.
701 + *
702 + * @author Leo Fajardo (@leorw)
703 + * @since 2.3.0
704 + */
705 + continue;
706 + }
707 +
708 + $odd = ! $odd;
709 + endforeach ?>
710 + </table>
711 + </div>
712 + </div>
713 + <?php if ( fs_is_network_admin() ) : ?>
714 + <div id="fs_sites" class="postbox">
715 + <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
716 + <div class="fs-header-actions">
717 + <?php if ( ! $is_whitelabeled ) : ?>
718 + <?php $has_license = is_object( $license ) ?>
719 + <?php if ( $has_license || ( $show_upgrade && $is_premium ) ) : ?>
720 + <?php
721 + $activate_license_button_text = $has_license ?
722 + fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
723 + fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
724 + ?>
725 + <a class="button<?php echo ( ! $has_license ? ' button-primary' : '' ) ?> activate-license-trigger <?php echo $fs->get_unique_affix() ?>" href="#"><?php echo $activate_license_button_text ?></a>
726 + <?php endif ?>
727 + <?php endif ?>
728 + <input class="fs-search" type="text" placeholder="<?php fs_esc_attr_echo_inline( 'Search by address', 'search-by-address', $slug ) ?>..."><span class="dashicons dashicons-search"></span>
729 + </div>
730 + <div class="inside">
731 + <div id="" class="fs-scrollable-table">
732 + <div class="fs-table-head">
733 + <table class="widefat">
734 + <thead>
735 + <tr>
736 + <td><?php fs_esc_html_echo_inline('ID', 'id', $slug) ?></td>
737 + <td><?php fs_esc_html_echo_inline('Address', 'address', $slug) ?></td>
738 + <td><?php fs_esc_html_echo_inline('License', 'license', $slug) ?></td>
739 + <td><?php fs_esc_html_echo_inline('Plan', 'plan', $slug) ?></td>
740 + <td></td>
741 + </tr>
742 + </thead>
743 + </table>
744 + </div>
745 + <div class="fs-table-body">
746 + <table class="widefat">
747 + <?php
748 + $current_blog_id = get_current_blog_id();
749 +
750 + foreach ( $site_view_params as $view_params ) {
751 + fs_require_template(
752 + 'account/partials/site.php',
753 + $view_params
754 + );
755 + }
756 +
757 + /**
758 + * It's possible for the `Freemius::switch_to_blog()` method to be called within the `site.php` template and this changes the Freemius instance's context, so this check is for restoring the previous context based on the previously retrieved site.
759 + *
760 + * @author Leo Fajardo (@leorw)
761 + * @since 2.5.0
762 + */
763 + $current_install = $fs->get_site();
764 +
765 + if (
766 + is_object( $site ) &&
767 + ( ! is_object( $current_install ) || $current_install->id != $site->id )
768 + ) {
769 + $fs->switch_to_blog( $current_blog_id, $site, true );
770 + }
771 + ?>
772 + </table>
773 + </div>
774 + </div>
775 + </div>
776 + </div>
777 + <?php endif ?>
778 + <?php if ( 0 < count( $addons_to_show ) ) : ?>
779 + <!-- Add-Ons -->
780 + <div class="postbox">
781 + <div class="">
782 + <!-- <div class="inside">-->
783 + <table id="fs_addons" class="widefat">
784 + <thead>
785 + <tr>
786 + <th><h3><?php echo esc_html( $addons_text ) ?></h3></th>
787 + <th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
788 + <th><?php echo esc_html( $version_text ) ?></th>
789 + <th><?php echo esc_html( $plan_text ) ?></th>
790 + <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th>
791 + <th></th>
792 + <?php if ( $is_dev_mode ) : ?>
793 + <th></th>
794 + <?php endif ?>
795 + </tr>
796 + </thead>
797 + <tbody>
798 + <?php
799 + $odd = true;
800 +
801 + $installed_addons_ids_map = array_flip( $installed_addons_ids );
802 +
803 + $addon_info_by_id = array();
804 + $hide_all_addons_data = false;
805 +
806 + if ( $fs->is_whitelabeled_by_flag() ) {
807 + $hide_all_addons_data = true;
808 +
809 + foreach ( $addons_to_show as $addon_id ) {
810 + $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
811 + $addon_info = $fs->_get_addon_info( $addon_id, $is_addon_installed );
812 + $is_addon_connected = $addon_info['is_connected'];
813 +
814 + $fs_addon = ( $is_addon_connected && $is_addon_installed ) ?
815 + freemius( $addon_id ) :
816 + null;
817 +
818 + $is_whitelabeled = is_object( $fs_addon ) ?
819 + $fs_addon->is_whitelabeled( true ) :
820 + $addon_info['is_whitelabeled'];
821 +
822 + if ( ! $is_whitelabeled ) {
823 + $hide_all_addons_data = false;
824 + }
825 +
826 + if ( $is_data_debug_mode ) {
827 + $is_whitelabeled = false;
828 + }
829 +
830 + $addon_info_by_id[ $addon_id ] = $addon_info;
831 + }
832 + }
833 +
834 + foreach ( $addons_to_show as $addon_id ) {
835 + $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
836 +
837 + if (
838 + $hide_all_addons_data &&
839 + ! $is_addon_installed &&
840 + ! file_exists( fs_normalize_path( WP_PLUGIN_DIR . '/' . $fs->get_addon_basename( $addon_id ) ) )
841 + ) {
842 + continue;
843 + }
844 +
845 + $addon_view_params = array(
846 + 'parent_fs' => $fs,
847 + 'addon_id' => $addon_id,
848 + 'odd' => $odd,
849 + 'fs_blog_id' => $fs_blog_id,
850 + 'active_plugins_directories_map' => &$active_plugins_directories_map,
851 + 'is_addon_installed' => $is_addon_installed,
852 + 'addon_info' => isset( $addon_info_by_id[ $addon_id ] ) ?
853 + $addon_info_by_id[ $addon_id ] :
854 + $fs->_get_addon_info( $addon_id, $is_addon_installed ),
855 + 'is_whitelabeled' => ( $is_whitelabeled && ! $is_data_debug_mode )
856 + );
857 +
858 + if ( ! empty($addon_view_params['addon_info'] ) ) {
859 + fs_require_template(
860 + 'account/partials/addon.php',
861 + $addon_view_params
862 + );
863 + } else {
864 + // If we are here it means there is an activation of an unreleased add-on and yet the SDK is not in development mode.
865 + echo '<tr>';
866 + echo '<td style="text-align: right;">' . esc_html( $addon_id ) . '</td>';
867 + echo '<td colspan="' . ( $is_dev_mode ? 6 : 5 ) . '" style="text-align: left;">';
868 + echo 'The add-on you have activated is no longer <a href="https://freemius.com/help/documentation/wordpress/selling-add-ons-extensions/#preparing-the-add-on-for-sale" rel="noreferrer noopener" target="_blank">listed</a> by the product owner, or the SDK is not running in <a href="https://freemius.com/help/documentation/wordpress-sdk/testing/" rel="noreferrer noopener" target="_blank">test mode</a>. Please <a href="' . esc_url( $fs->contact_url() ) . '">contact support</a> if you need further assistance.';
869 + echo '</td>';
870 + echo '</tr>';
871 + }
872 +
873 + $odd = ! $odd;
874 + } ?>
875 + </tbody>
876 + </table>
877 + </div>
878 + </div>
879 + <?php endif ?>
880 +
881 + <?php $fs->do_action( 'after_account_details' ) ?>
882 +
883 + <?php
884 + if ( $show_billing ) {
885 + $view_params = array( 'id' => $VARS['id'], 'payments' => $payments );
886 + fs_require_once_template( 'account/billing.php', $view_params );
887 + fs_require_once_template( 'account/payments.php', $view_params );
888 + }
889 + ?>
890 + </div>
891 + </div>
892 + </div>
893 + </div>
894 + </div>
895 + <?php
896 + $subscription_cancellation_dialog_box_template_params = $fs->_get_subscription_cancellation_dialog_box_template_params( true );
897 + if ( ! empty( $subscription_cancellation_dialog_box_template_params ) ) {
898 + fs_require_template( 'forms/subscription-cancellation.php', $subscription_cancellation_dialog_box_template_params );
899 + }
900 + ?>
901 + <script type="text/javascript">
902 + (function ($) {
903 + var setLoading = function ($this, label) {
904 + // Set loading mode.
905 + $(document.body).css({'cursor': 'wait'});
906 +
907 + $this.css({'cursor': 'wait'});
908 +
909 + if ($this.is('input'))
910 + $this.val(label);
911 + else
912 + $this.html(label);
913 +
914 + setTimeout(function () {
915 + $this.attr('disabled', 'disabled');
916 + }, 200);
917 + };
918 +
919 + $('.fs-toggle-visibility').click(function () {
920 + var
921 + $this = $(this),
922 + $parent = $this.closest('tr'),
923 + $input = $parent.find('input');
924 +
925 + $parent.find('code').toggle();
926 + $input.toggle();
927 +
928 + if ($input.is(':visible')) {
929 + $this.html('<?php fs_esc_js_echo_x_inline( 'Hide', 'verb', 'hide', $slug ) ?>');
930 + setTimeout(function () {
931 + $input.select().focus();
932 + }, 100);
933 + }
934 + else {
935 + $this.html( '<?php fs_esc_js_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?>' );
936 + }
937 + });
938 +
939 + $('.fs-toggle-tracking').click(function () {
940 + setLoading(
941 + $(this),
942 + ($(this).data('is-disconnected') ?
943 + '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>' :
944 + '<?php fs_esc_js_echo_inline('Opting out', 'opting-out' ) ?>') +
945 + '...'
946 + );
947 + });
948 +
949 + <?php
950 + $plugin_title = $fs->get_plugin_title();
951 + $processing_text = fs_esc_js_inline( 'Processing', 'processing' );
952 + $confirmation_message = sprintf(
953 + '%s %s',
954 + sprintf( fs_esc_attr_inline( 'Get updates for bleeding edge Beta versions of %s.', 'get-beta-versions', $slug ), $plugin_title ),
955 + sprintf( fs_esc_attr_inline( 'An update to a Beta version will replace your installed version of %s with the latest Beta release - use with caution, and not on production sites. You have been warned.', 'beta-version-update-caution', $slug ), $plugin_title )
956 + );
957 + ?>
958 +
959 + $( '.fs-toggle-beta-mode' ).click( function () {
960 + var $checkbox = $( this ),
961 + isChecked = $checkbox.is( ':checked' );
962 +
963 + if ( ! isChecked || confirm( '<?php echo $confirmation_message ?>' ) ) {
964 + $.ajax( {
965 + url : <?php echo Freemius::ajax_url() ?>,
966 + method: 'POST',
967 + data : {
968 + action : '<?php echo $fs->get_ajax_action( 'set_beta_mode' ) ?>',
969 + security : '<?php echo $fs->get_ajax_security( 'set_beta_mode' ) ?>',
970 + is_beta : isChecked,
971 + module_id: <?php echo $fs->get_id() ?>
972 + },
973 + beforeSend: function () {
974 + $checkbox.prop( 'disabled', true );
975 + $checkbox.parent().find( 'span' ).text( '<?php echo $processing_text ?>' + '...' );
976 + },
977 + complete: function () {
978 + $checkbox.prop( 'disabled', false );
979 + $checkbox.parent().find( 'span' ).text( '<?php fs_esc_js_echo_inline( 'Join the Beta Program', 'join-beta', $slug ) ?>' );
980 + }
981 + } );
982 +
983 + return true;
984 + }
985 +
986 + return false;
987 + });
988 +
989 + $('.fs-opt-in').click(function () {
990 + setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');
991 + });
992 +
993 + $( '#fs_downgrade' ).submit(function( event ) {
994 + event.preventDefault();
995 +
996 + setLoading( $( this ).find( '.button' ), '<?php fs_esc_js_echo_inline( 'Downgrading', 'downgrading' ) ?>...' );
997 + });
998 +
999 + $('.fs-activate-license').click(function () {
1000 + setLoading($(this), '<?php fs_esc_js_echo_inline('Activating', 'activating' ) ?>...');
1001 + });
1002 +
1003 + var $deactivateLicenseOrCancelTrial = $( '.fs-deactivate-license, .fs-cancel-trial' ),
1004 + $subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' );
1005 +
1006 + if ( 0 !== $subscriptionCancellationModal.length ) {
1007 + $subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
1008 + setLoading(
1009 + $deactivateLicenseOrCancelTrial,
1010 + ( ! $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ?
1011 + '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>' :
1012 + '<?php echo esc_html( sprintf( fs_text_inline( 'Cancelling %s', 'cancelling-x', $slug ), fs_text_inline( 'trial', 'trial', $slug ) ) ) ?>' ) + '...'
1013 + );
1014 +
1015 + $subscriptionCancellationModal.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
1016 + $deactivateLicenseOrCancelTrial.unbind( 'click' );
1017 +
1018 + if ( false === cancelSubscription || $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ) {
1019 + $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( $deactivateLicenseOrCancelTrial.text() );
1020 +
1021 + $deactivateLicenseOrCancelTrial[0].parentNode.submit();
1022 + } else {
1023 + var $form = $( 'input[value="downgrade_account"],input[value="cancel_trial"]' ).parent();
1024 + $form.prepend( '<input type="hidden" name="deactivate_license" value="true" />' );
1025 +
1026 + $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( '<?php echo esc_js( sprintf(
1027 + fs_text_inline( 'Cancelling %s...', 'cancelling-x' , $slug ),
1028 + $is_paid_trial ?
1029 + fs_text_inline( 'trial', 'trial', $slug ) :
1030 + fs_text_inline( 'subscription', 'subscription', $slug )
1031 + ) ) ?>' );
1032 +
1033 + $form.submit();
1034 + }
1035 + });
1036 + }
1037 +
1038 + $deactivateLicenseOrCancelTrial.click(function() {
1039 + var $this = $( this );
1040 + if ( $this.hasClass( 'fs-cancel-trial' ) ) {
1041 + $subscriptionCancellationModal.find( '.fs-modal-panel' ).find( 'ul.subscription-actions, .fs-price-increase-warning' ).remove();
1042 + $subscriptionCancellationModal.find( '.fs-modal-panel > p' ).text( <?php echo json_encode( $cancel_trial_confirm_text ) ?> );
1043 + $subscriptionCancellationModal.trigger( 'showModal' );
1044 + } else if (confirm('<?php fs_esc_attr_echo_inline( 'Deactivating your license will block all premium features, but will enable activating the license on another site. Are you sure you want to proceed?', 'deactivate-license-confirm', $slug ) ?>')) {
1045 + var $this = $(this);
1046 +
1047 + if ( 0 !== $subscriptionCancellationModal.length ) {
1048 + $subscriptionCancellationModal.trigger( 'showModal' );
1049 + } else {
1050 + setLoading( $this, '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>...' );
1051 + $this[0].parentNode.submit();
1052 + }
1053 + }
1054 +
1055 + return false;
1056 + });
1057 +
1058 + var $sitesSection = $('#fs_sites'),
1059 + $sitesTable = $sitesSection.find('.fs-scrollable-table'),
1060 + $sitesTableRows = $sitesTable.find('.fs-site-details');
1061 +
1062 + $('.fs-show-install-details').click(function(){
1063 + var installID = $(this).parents('.fs-site-details').attr('data-install-id');
1064 + $sitesSection.find('.fs-install-details[data-install-id=' + installID + ']').toggle();
1065 + });
1066 +
1067 +
1068 + var adjustColumnWidth = function($table) {
1069 + var $headerColumns = $table.find('.fs-table-head td'),
1070 + $bodyColumns = $table.find('.fs-table-body tr:first > td');
1071 +
1072 + for (var i = 0, len = $headerColumns.length; i < len; i++) {
1073 + $($headerColumns[i]).width($($bodyColumns[i]).width());
1074 + }
1075 + for (i = 0, len = $headerColumns.length; i < len; i++) {
1076 + $($bodyColumns[i]).width($($headerColumns[i]).width());
1077 + }
1078 + };
1079 +
1080 + adjustColumnWidth($sitesTable);
1081 +
1082 + $sitesSection.find('.fs-search').keyup(function(){
1083 + var search = $(this).val().trim();
1084 +
1085 + if ('' === search){
1086 + // Show all.
1087 + $sitesTableRows.show();
1088 + return;
1089 + }
1090 +
1091 + var url;
1092 +
1093 + $sitesTableRows.each(function(index){
1094 + url = $(this).find('.fs-field-url').html();
1095 +
1096 + if (-1 < url.indexOf(search)){
1097 + $(this).show();
1098 + } else {
1099 + $(this).hide();
1100 + }
1101 + });
1102 + });
1103 +
1104 + $( '.fs-toggle-whitelabel-mode' ).click( function () {
1105 + var $toggleLink = $( this );
1106 +
1107 + $.ajax( {
1108 + url : <?php echo Freemius::ajax_url() ?>,
1109 + method: 'POST',
1110 + data : {
1111 + action : '<?php echo $fs->get_ajax_action( 'toggle_whitelabel_mode' ) ?>',
1112 + security : '<?php echo $fs->get_ajax_security( 'toggle_whitelabel_mode' ) ?>',
1113 + module_id: <?php echo $fs->get_id() ?>
1114 + },
1115 + beforeSend: function () {
1116 + $toggleLink.parent().text( '<?php
1117 + $is_whitelabeled ?
1118 + fs_esc_html_echo_inline( 'Disabling white-label mode', 'disabling-whitelabel-mode' ) :
1119 + fs_esc_html_echo_inline( 'Enabling white-label mode', 'enabling-whitelabel-mode' )
1120 + ?>' + '...' );
1121 + },
1122 + complete: function () {
1123 + location.reload();
1124 + }
1125 + } );
1126 + });
1127 + })(jQuery);
1128 + </script>
1129 +<?php
1130 + if ( $has_tabs ) {
1131 + $fs->_add_tabs_after_content();
1132 + }