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