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