PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.2
Tiered Pricing Table for WooCommerce v2.2.2
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / freemius / templates / account.php

account.php in Tiered Pricing Table for WooCommerce 2.2.2, at freemius/templates/account.php

792 lines 41.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 $subscription = ( is_object( $license ) ?
48 $fs->_get_subscription( $license->id ) :
49 null );
50 $plan = $fs->get_plan();
51 $is_active_subscription = ( is_object( $subscription ) && $subscription->is_active() );
52 $is_paid_trial = $fs->is_paid_trial();
53 $has_paid_plan = $fs->has_paid_plan();
54 $show_upgrade = ( $has_paid_plan && ! $is_paying && ! $is_paid_trial );
55 $trial_plan = $fs->get_trial_plan();
56
57 if ( $has_paid_plan ) {
58 $fs->_add_license_activation_dialog_box();
59 }
60
61 if ( fs_request_get_bool( 'auto_install' ) ) {
62 $fs->_add_auto_installation_dialog_box();
63 }
64
65 if ( fs_request_get_bool( 'activate_license' ) ) {
66 // Open the license activation dialog box on the account page.
67 add_action( 'admin_footer', array(
68 &$fs,
69 '_open_license_activation_dialog_box'
70 ) );
71 }
72
73 $has_tabs = $fs->_add_tabs_before_content();
74
75 if ( $has_tabs ) {
76 $query_params['tabs'] = 'true';
77 }
78
79 // Aliases.
80 $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
81 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
82 $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
83 /* translators: %1s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
84 $downgrade_x_confirm_text = fs_text_inline( '%1s will immediately stop all future recurring payments and your %s plan license will expire in %s.', 'downgrade-x-confirm', $slug );
85 $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 );
86 $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 );
87 $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 );
88 $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 );
89 /* translators: %s: Plan title (e.g. "Professional") */
90 $activate_plan_text = fs_text_inline( 'Activate %s Plan', 'activate-x-plan', $slug );
91 $version_text = fs_text_x_inline( 'Version', 'product version', 'version', $slug );
92 /* translators: %s: Time period (e.g. Auto renews in "2 months") */
93 $renews_in_text = fs_text_inline( 'Auto renews in %s', 'renews-in', $slug );
94 /* translators: %s: Time period (e.g. Expires in "2 months") */
95 $expires_in_text = fs_text_inline( 'Expires in %s', 'expires-in', $slug );
96 $sync_license_text = fs_text_x_inline( 'Sync License', 'as synchronize license', 'sync-license', $slug );
97 $cancel_trial_text = fs_text_inline( 'Cancel Trial', 'cancel-trial', $slug );
98 $change_plan_text = fs_text_inline( 'Change Plan', 'change-plan', $slug );
99 $upgrade_text = fs_text_x_inline( 'Upgrade', 'verb', 'upgrade', $slug );
100 $addons_text = fs_text_inline( 'Add-Ons', 'add-ons', $slug );
101 $downgrade_text = fs_text_x_inline( 'Downgrade', 'verb', 'downgrade', $slug );
102 $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
103 $free_text = fs_text_inline( 'Free', 'free', $slug );
104 $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
105 $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
106
107 $show_plan_row = true;
108 $show_license_row = is_object( $license );
109
110 $site_view_params = array();
111
112 if ( fs_is_network_admin() ) {
113 $sites = Freemius::get_sites();
114 $all_installs_plan_id = null;
115 $all_installs_license_id = ( $show_license_row ? $license->id : null );
116 foreach ( $sites as $s ) {
117 $site_info = $fs->get_site_info( $s );
118 $install = $fs->get_install_by_blog_id( $site_info['blog_id'] );
119 $view_params = array(
120 'freemius' => $fs,
121 'license' => $license,
122 'site' => $site_info,
123 'install' => $install,
124 );
125
126 $site_view_params[] = $view_params;
127
128 if ( empty( $install ) ) {
129 continue;
130 }
131
132 if ( $show_plan_row ) {
133 if ( is_null( $all_installs_plan_id ) ) {
134 $all_installs_plan_id = $install->plan_id;
135 } else if ( $all_installs_plan_id != $install->plan_id ) {
136 $show_plan_row = false;
137 }
138 }
139
140 if ( $show_license_row && $all_installs_license_id != $install->license_id ) {
141 $show_license_row = false;
142 }
143 }
144 }
145 ?>
146 <div class="wrap fs-section">
147 <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
148 <h2 class="nav-tab-wrapper">
149 <a href="<?php echo $fs->get_account_url() ?>"
150 class="nav-tab nav-tab-active"><?php fs_esc_html_echo_inline( 'Account', 'account', $slug ) ?></a>
151 <?php if ( $fs->has_addons() ) : ?>
152 <a href="<?php echo $fs->_get_admin_page_url( 'addons' ) ?>"
153 class="nav-tab"><?php echo esc_html( $addons_text ) ?></a>
154 <?php endif ?>
155 <?php if ( $show_upgrade ) : ?>
156 <a href="<?php echo $fs->get_upgrade_url() ?>" class="nav-tab"><?php echo esc_html( $upgrade_text ) ?></a>
157 <?php if ( $fs->apply_filters( 'show_trial', true ) && ! $fs->is_trial_utilized() && $fs->has_trial_plan() ) : ?>
158 <a href="<?php echo $fs->get_trial_url() ?>" class="nav-tab"><?php fs_esc_html_echo_inline( 'Free Trial', 'free-trial', $slug ) ?></a>
159 <?php endif ?>
160 <?php endif ?>
161 </h2>
162 <?php endif ?>
163
164 <div id="poststuff">
165 <div id="fs_account">
166 <div class="has-sidebar has-right-sidebar">
167 <div class="has-sidebar-content">
168 <div class="postbox">
169 <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
170 <div class="fs-header-actions">
171 <ul>
172 <?php if ( ! $is_paying ) : ?>
173 <li>
174 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
175 <input type="hidden" name="fs_action" value="delete_account">
176 <?php wp_nonce_field( 'delete_account' ) ?>
177 <a class="fs-delete-account" href="#" onclick="if (confirm('<?php
178 if ( $is_active_subscription ) {
179 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 ) );
180 } else {
181 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 ) ) );
182 }
183 ?>')) this.parentNode.submit(); return false;"><i
184 class="dashicons dashicons-no"></i> <?php fs_esc_html_echo_inline( 'Delete Account', 'delete-account', $slug ) ?></a>
185 </form>
186 </li>
187 <li>&nbsp;&bull;&nbsp;</li>
188 <?php endif ?>
189 <?php if ( $is_paying ) : ?>
190 <?php if ( ! fs_is_network_admin() ) : ?>
191 <li>
192 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
193 <input type="hidden" name="fs_action" value="deactivate_license">
194 <?php wp_nonce_field( 'deactivate_license' ) ?>
195 <a href="#" class="fs-deactivate-license"><i
196 class="dashicons dashicons-admin-network"></i> <?php fs_echo_inline( 'Deactivate License', 'deactivate-license', $slug ) ?>
197 </a>
198 </form>
199 </li>
200 <li>&nbsp;&bull;&nbsp;</li>
201 <?php endif ?>
202 <?php if ( ! $license->is_lifetime() &&
203 $is_active_subscription
204 ) : ?>
205 <li>
206 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
207 <input type="hidden" name="fs_action" value="downgrade_account">
208 <?php wp_nonce_field( 'downgrade_account' ) ?>
209 <a href="#"
210 onclick="if ( confirm('<?php echo esc_attr( sprintf(
211 $downgrade_x_confirm_text,
212 ( $fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
213 $plan->title,
214 human_time_diff( time(), strtotime( $license->expiration ) )
215 ) ) ?> <?php if ( ! $license->is_block_features ) {
216 echo esc_attr( sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) ) );
217 } else {
218 echo esc_attr( sprintf( $after_downgrade_blocking_text, $plan->title ) );
219 }?> <?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>
220 </form>
221 </li>
222 <li>&nbsp;&bull;&nbsp;</li>
223 <?php endif ?>
224 <?php if ( ! $fs->is_single_plan() ) : ?>
225 <li>
226 <a href="<?php echo $fs->get_upgrade_url() ?>"><i
227 class="dashicons dashicons-grid-view"></i> <?php echo esc_html( $change_plan_text ) ?></a>
228 </li>
229 <li>&nbsp;&bull;&nbsp;</li>
230 <?php endif ?>
231 <?php elseif ( $is_paid_trial ) : ?>
232 <li>
233 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
234 <input type="hidden" name="fs_action" value="cancel_trial">
235 <?php wp_nonce_field( 'cancel_trial' ) ?>
236 <a href="#" class="fs-cancel-trial"><i
237 class="dashicons dashicons-download"></i> <?php echo esc_html( $cancel_trial_text ) ?></a>
238 </form>
239 </li>
240 <li>&nbsp;&bull;&nbsp;</li>
241 <?php endif ?>
242 <li>
243 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
244 <input type="hidden" name="fs_action" value="<?php echo $fs->get_unique_affix() ?>_sync_license">
245 <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
246 <a href="#" onclick="this.parentNode.submit(); return false;"><i
247 class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( 'Sync', 'as synchronize', 'sync', $slug ) ?></a>
248 </form>
249 </li>
250
251 </ul>
252 </div>
253 <div class="inside">
254 <table id="fs_account_details" cellspacing="0" class="fs-key-value-table">
255 <?php
256 $hide_license_key = ( ! $show_license_row || $fs->apply_filters( 'hide_license_key', false ) );
257
258 $profile = array();
259 $profile[] = array(
260 'id' => 'user_name',
261 'title' => fs_text_inline( 'Name', 'name', $slug ),
262 'value' => $name
263 );
264 // if (isset($user->email) && false !== strpos($user->email, '@'))
265 $profile[] = array(
266 'id' => 'email',
267 'title' => fs_text_inline( 'Email', 'email', $slug ),
268 'value' => $user->email
269 );
270
271 if ( is_numeric( $user->id ) ) {
272 $profile[] = array(
273 'id' => 'user_id',
274 'title' => fs_text_inline( 'User ID', 'user-id', $slug ),
275 'value' => $user->id
276 );
277 }
278
279 if ( ! fs_is_network_admin()) {
280 $profile[] = array(
281 'id' => 'site_id',
282 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
283 'value' => is_string( $site->id ) ?
284 $site->id :
285 fs_text_inline( 'No ID', 'no-id', $slug )
286 );
287
288 $profile[] = array(
289 'id' => 'site_public_key',
290 'title' => fs_text_inline( 'Public Key', 'public-key', $slug ),
291 'value' => $site->public_key
292 );
293
294 $profile[] = array(
295 'id' => 'site_secret_key',
296 'title' => fs_text_inline( 'Secret Key', 'secret-key', $slug ),
297 'value' => ( ( is_string( $site->secret_key ) ) ?
298 $site->secret_key :
299 fs_text_x_inline( 'No Secret', 'as secret encryption key missing', 'no-secret', $slug )
300 )
301 );
302 }
303
304 $profile[] = array(
305 'id' => 'version',
306 'title' => $version_text,
307 'value' => $fs->get_plugin_version()
308 );
309
310 if ( $has_paid_plan ) {
311 if ( $fs->is_trial() ) {
312 if ( $show_plan_row ) {
313 $profile[] = array(
314 'id' => 'plan',
315 'title' => $plan_text,
316 'value' => ( is_string( $trial_plan->name ) ?
317 strtoupper( $trial_plan->title ) :
318 fs_text_inline( 'Trial', 'trial', $slug ) )
319 );
320 }
321 } else {
322 if ( $show_plan_row ) {
323 $profile[] = array(
324 'id' => 'plan',
325 'title' => $plan_text,
326 'value' => strtoupper( is_string( $plan->name ) ?
327 $plan->title :
328 strtoupper( $free_text )
329 )
330 );
331 }
332
333 if ( is_object( $license ) ) {
334 if ( ! $hide_license_key ) {
335 $profile[] = array(
336 'id' => 'license_key',
337 'title' => fs_text_inline( 'License Key', $slug ),
338 'value' => $license->secret_key,
339 );
340 }
341 }
342 }
343 }
344 ?>
345 <?php $odd = true;
346 foreach ( $profile as $p ) : ?>
347 <?php
348 if ( 'plan' === $p['id'] && ! $has_paid_plan ) {
349 // If plugin don't have any paid plans, there's no reason
350 // to show current plan.
351 continue;
352 }
353 ?>
354 <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
355 <td>
356 <nobr><?php echo $p['title'] ?>:</nobr>
357 </td>
358 <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
359 <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
360 <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
361 <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
362 readonly/>
363 <?php else : ?>
364 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
365 <?php endif ?>
366 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
367 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'not verified', 'not-verified', $slug ) ?></label>
368 <?php endif ?>
369 <?php if ( 'plan' === $p['id'] ) : ?>
370 <?php if ( $fs->is_trial() ) : ?>
371 <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
372 <?php endif ?>
373 <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
374 <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
375 <?php $is_license_expired = $license->is_expired() ?>
376 <?php $expired_ago_text = ( fs_text_inline( 'Expired', 'expired', $slug ) . ' ' . fs_text_x_inline( '%s ago', 'x-ago', $slug ) ) ?>
377 <label
378 class="fs-tag <?php echo $is_license_expired ? 'fs-error' : 'fs-warn' ?>"><?php
379 echo esc_html( sprintf( $is_license_expired ? $expired_ago_text : $expires_in_text, human_time_diff( time(), strtotime( $license->expiration ) ) ) )
380 ?></label>
381 <?php elseif ( $is_active_subscription && ! $subscription->is_first_payment_pending() ) : ?>
382 <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $subscription->next_payment ) ) ) ) ?></label>
383 <?php endif ?>
384 <?php elseif ( $fs->is_trial() ) : ?>
385 <label class="fs-tag fs-warn"><?php echo esc_html( sprintf( $expires_in_text, human_time_diff( time(), strtotime( $site->trial_ends ) ) ) ) ?></label>
386 <?php endif ?>
387 <div class="button-group">
388 <?php $available_license = $fs->is_free_plan() && ! fs_is_network_admin() ? $fs->_get_available_premium_license( $site->is_localhost() ) : false ?>
389 <?php if ( is_object( $available_license ) ) : ?>
390 <?php $premium_plan = $fs->_get_plan_by_id( $available_license->plan_id ) ?>
391 <?php
392 $view_params = array(
393 'freemius' => $fs,
394 'slug' => $slug,
395 'license' => $available_license,
396 'plan' => $premium_plan,
397 'is_localhost' => $site->is_localhost(),
398 'install_id' => $site->id,
399 'class' => 'button-primary',
400 );
401 fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
402 <?php else : ?>
403 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
404 method="POST" class="button-group">
405 <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
406 <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>
407 <?php endif ?>
408 <input type="submit" class="button"
409 value="<?php echo esc_attr( $sync_license_text ) ?>">
410 <input type="hidden" name="fs_action"
411 value="<?php echo $fs->get_unique_affix() ?>_sync_license">
412 <?php wp_nonce_field( $fs->get_unique_affix() . '_sync_license' ) ?>
413 <?php if ( $show_upgrade || ! $fs->is_single_plan() ) : ?>
414 <a href="<?php echo $fs->get_upgrade_url() ?>"
415 class="button<?php
416 echo $show_upgrade ?
417 ' button-primary fs-upgrade' :
418 ' fs-change-plan'; ?> button-upgrade"><i
419 class="dashicons dashicons-cart"></i> <?php echo esc_html( $show_upgrade ? $upgrade_text : $change_plan_text ) ?></a>
420 <?php endif ?>
421 </form>
422 <?php endif ?>
423 </div>
424 <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
425 <?php if ( $fs->has_premium_version() ) : ?>
426 <?php if ( $fs->is_premium() ) : ?>
427 <label
428 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>
429 <?php elseif ( $fs->can_use_premium_code() ) : ?>
430 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
431 <?php endif ?>
432 <?php endif ?>
433 <?php endif ?>
434 </td>
435 <?php if ( 'plan' !== $p['id'] ) : ?>
436 <td class="fs-right">
437 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
438 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
439 <input type="hidden" name="fs_action" value="verify_email">
440 <?php wp_nonce_field( 'verify_email' ) ?>
441 <input type="submit" class="button button-small"
442 value="<?php fs_esc_attr_echo_inline( 'Verify Email', 'verify-email', $slug ) ?>">
443 </form>
444 <?php endif ?>
445 <?php if ( 'version' === $p['id'] ) : ?>
446 <?php if ( $fs->has_release_on_freemius() ) : ?>
447 <div class="button-group">
448 <?php if ( $is_paying || $fs->is_trial() ) : ?>
449 <?php if ( ! $fs->is_allowed_to_install() ) : ?>
450 <a target="_blank" class="button button-primary"
451 href="<?php echo $fs->_get_latest_download_local_url() ?>"><?php echo sprintf(
452 /* translators: %s: plan name (e.g. Download "Professional" Version) */
453 fs_text_inline( 'Download %s Version', 'download-x-version', $slug ),
454 ( $fs->is_trial() ? $trial_plan->title : $plan->title ) ) . ( is_object( $update ) ? ' [' . $update->version . ']' : '' ) ?></a>
455 <?php elseif ( is_object( $update ) ) : ?>
456 <?php
457 $module_type = $fs->get_module_type();
458 ?>
459 <a class="button button-primary"
460 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>
461 <?php endif ?>
462 <?php endif; ?>
463 </div>
464 <?php endif ?>
465 <?php
466 elseif ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
467 <button class="button button-small fs-toggle-visibility"><?php fs_esc_html_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?></button>
468 <?php if ('license_key' === $p['id']) : ?>
469 <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>
470 <?php endif ?>
471 <?php
472 elseif (/*in_array($p['id'], array('site_secret_key', 'site_id', 'site_public_key')) ||*/
473 ( is_string( $user->secret_key ) && in_array( $p['id'], array(
474 'email',
475 'user_name'
476 ) ) )
477 ) : ?>
478 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST"
479 onsubmit="var val = prompt('<?php echo esc_attr( sprintf(
480 /* translators: %s: User's account property (e.g. name, email) */
481 fs_text_inline( 'What is your %s?', 'what-is-your-x', $slug ),
482 $p['title']
483 ) ) ?>', '<?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;">
484 <input type="hidden" name="fs_action" value="update_<?php echo $p['id'] ?>">
485 <input type="hidden" name="fs_<?php echo $p['id'] ?>_<?php echo $fs->get_unique_affix() ?>"
486 value="">
487 <?php wp_nonce_field( 'update_' . $p['id'] ) ?>
488 <input type="submit" class="button button-small"
489 value="<?php echo fs_esc_attr_x_inline( 'Edit', 'verb', 'edit', $slug ) ?>">
490 </form>
491 <?php endif ?>
492 </td>
493 <?php endif ?>
494 </tr>
495 <?php $odd = ! $odd;
496 endforeach ?>
497 </table>
498 </div>
499 </div>
500 <?php if ( fs_is_network_admin() ) : ?>
501 <div id="fs_sites" class="postbox">
502 <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
503 <div class="fs-header-actions">
504 <?php $has_license = is_object( $license ) ?>
505 <?php if ( $has_license || ( $show_upgrade && $fs->is_premium() ) ) : ?>
506 <?php
507 $activate_license_button_text = $has_license ?
508 fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
509 fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
510 ?>
511 <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>
512 <?php endif ?>
513 <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>
514 </div>
515
516 <div class="inside">
517 <div id="" class="fs-scrollable-table">
518 <div class="fs-table-head">
519 <table class="widefat">
520 <thead>
521 <tr>
522 <td><?php fs_esc_html_echo_inline('ID', 'id', $slug) ?></td>
523 <td><?php fs_esc_html_echo_inline('Address', 'address', $slug) ?></td>
524 <td><?php fs_esc_html_echo_inline('License', 'license', $slug) ?></td>
525 <td><?php fs_esc_html_echo_inline('Plan', 'plan', $slug) ?></td>
526 <td></td>
527 </tr>
528 </thead>
529 </table>
530 </div>
531 <div class="fs-table-body">
532 <table class="widefat">
533 <?php
534 foreach ( $site_view_params as $view_params ) {
535 fs_require_template(
536 'account/partials/site.php',
537 $view_params
538 );
539 } ?>
540 </table>
541 </div>
542 </div>
543 </div>
544 </div>
545 <?php endif ?>
546
547 <?php
548 $account_addons = $fs->get_account_addons();
549 if ( ! is_array( $account_addons ) ) {
550 $account_addons = array();
551 }
552
553 $installed_addons = $fs->get_installed_addons();
554 $installed_addons_ids = array();
555 foreach ( $installed_addons as $fs_addon ) {
556 $installed_addons_ids[] = $fs_addon->get_id();
557 }
558
559 $addons_to_show = array_unique( array_merge( $installed_addons_ids, $account_addons ) );
560 ?>
561 <?php if ( 0 < count( $addons_to_show ) ) : ?>
562 <!-- Add-Ons -->
563 <div class="postbox">
564 <div class="">
565 <!-- <div class="inside">-->
566 <table id="fs_addons" class="widefat">
567 <thead>
568 <tr>
569 <th><h3><?php echo esc_html( $addons_text ) ?></h3></th>
570 <th><?php fs_esc_html_echo_inline( 'ID', 'id', $slug ) ?></th>
571 <th><?php echo esc_html( $version_text ) ?></th>
572 <th><?php echo esc_html( $plan_text ) ?></th>
573 <th><?php fs_esc_html_echo_x_inline( 'License', 'as software license', 'license', $slug ) ?></th>
574 <th></th>
575 <?php if ( defined( 'WP_FS__DEV_MODE' ) && WP_FS__DEV_MODE ) : ?>
576 <th></th>
577 <?php endif ?>
578 </tr>
579 </thead>
580 <tbody>
581 <?php $odd = true;
582 foreach ( $addons_to_show as $addon_id ) {
583 $addon_view_params = array(
584 'parent_fs' => $fs,
585 'addon_id' => $addon_id,
586 'odd' => $odd,
587 );
588
589 fs_require_template(
590 'account/partials/addon.php',
591 $addon_view_params
592 );
593
594 $odd = ! $odd;
595 } ?>
596 </tbody>
597 </table>
598 </div>
599 </div>
600 <?php endif ?>
601
602 <?php $fs->do_action( 'after_account_details' ) ?>
603
604 <?php
605 $view_params = array( 'id' => $VARS['id'] );
606 fs_require_once_template( 'account/billing.php', $view_params );
607 fs_require_once_template( 'account/payments.php', $view_params );
608 ?>
609 </div>
610 </div>
611 </div>
612 </div>
613 </div>
614 <?php $fs->_maybe_add_subscription_cancellation_dialog_box( true ) ?>
615 <script type="text/javascript">
616 (function ($) {
617 var setLoading = function ($this, label) {
618 // Set loading mode.
619 $(document.body).css({'cursor': 'wait'});
620
621 $this.css({'cursor': 'wait'});
622
623 if ($this.is('input'))
624 $this.val(label);
625 else
626 $this.html(label);
627
628 setTimeout(function () {
629 $this.attr('disabled', 'disabled');
630 }, 200);
631 };
632
633 $('.fs-toggle-visibility').click(function () {
634 var
635 $this = $(this),
636 $parent = $this.closest('tr'),
637 $input = $parent.find('input');
638
639 $parent.find('code').toggle();
640 $input.toggle();
641
642 if ($input.is(':visible')) {
643 $this.html('<?php fs_esc_js_echo_x_inline( 'Hide', 'verb', 'hide', $slug ) ?>');
644 setTimeout(function () {
645 $input.select().focus();
646 }, 100);
647 }
648 else {
649 $this.html( '<?php fs_esc_js_echo_x_inline( 'Show', 'verb', 'show', $slug ) ?>' );
650 }
651 });
652
653 $('.fs-toggle-tracking').click(function () {
654 setLoading(
655 $(this),
656 ($(this).data('is-disconnected') ?
657 '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>' :
658 '<?php fs_esc_js_echo_inline('Opting out', 'opting-out' ) ?>') +
659 '...'
660 );
661 });
662
663 $('.fs-opt-in').click(function () {
664 setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');
665 });
666
667 $( '#fs_downgrade' ).submit(function( event ) {
668 event.preventDefault();
669
670 setLoading( $( this ).find( '.button' ), '<?php fs_esc_js_echo_inline( 'Downgrading', 'downgrading' ) ?>...' );
671 });
672
673 $('.fs-activate-license').click(function () {
674 setLoading($(this), '<?php fs_esc_js_echo_inline('Activating', 'activating' ) ?>...');
675 });
676
677 var $deactivateLicenseOrCancelTrial = $( '.fs-deactivate-license, .fs-cancel-trial' ),
678 $subscriptionCancellationModal = $( '.fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>' );
679
680 if ( 0 !== $subscriptionCancellationModal.length ) {
681 $subscriptionCancellationModal.on( '<?php echo $fs->get_action_tag( 'subscription_cancellation_action' ) ?>', function( evt, cancelSubscription ) {
682 setLoading(
683 $deactivateLicenseOrCancelTrial,
684 ( ! $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ?
685 '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>' :
686 '<?php echo esc_html( sprintf( fs_text_inline( 'Cancelling %s', 'cancelling-x', $slug ), fs_text_inline( 'trial', 'trial', $slug ) ) ) ?>' ) + '...'
687 );
688
689 $subscriptionCancellationModal.find( '.fs-modal-footer .button' ).addClass( 'disabled' );
690 $deactivateLicenseOrCancelTrial.unbind( 'click' );
691
692 if ( false === cancelSubscription || $deactivateLicenseOrCancelTrial.hasClass( 'fs-cancel-trial' ) ) {
693 $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( $deactivateLicenseOrCancelTrial.text() );
694
695 $deactivateLicenseOrCancelTrial[0].parentNode.submit();
696 } else {
697 var $form = $( 'input[value="downgrade_account"],input[value="cancel_trial"]' ).parent();
698 $form.prepend( '<input type="hidden" name="deactivate_license" value="true" />' );
699
700 $subscriptionCancellationModal.find( '.fs-modal-footer .button-primary' ).text( '<?php echo esc_js( sprintf(
701 fs_text_inline( 'Cancelling %s...', 'cancelling-x' , $slug ),
702 $is_paid_trial ?
703 fs_text_inline( 'trial', 'trial', $slug ) :
704 fs_text_inline( 'subscription', 'subscription', $slug )
705 ) ) ?>' );
706
707 $form.submit();
708 }
709 });
710 }
711
712 $deactivateLicenseOrCancelTrial.click(function() {
713 var $this = $( this );
714 if ( $this.hasClass( 'fs-cancel-trial' ) ) {
715 $subscriptionCancellationModal.find( '.fs-modal-panel' ).find( 'ul.subscription-actions, .fs-price-increase-warning' ).remove();
716 $subscriptionCancellationModal.find( '.fs-modal-panel > p' ).text( <?php echo json_encode( $cancel_trial_confirm_text ) ?> );
717 $subscriptionCancellationModal.trigger( 'showModal' );
718 } 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 ) ?>')) {
719 var $this = $(this);
720
721 if ( 0 !== $subscriptionCancellationModal.length ) {
722 $subscriptionCancellationModal.trigger( 'showModal' );
723 } else {
724 setLoading( $this, '<?php fs_esc_js_echo_inline( 'Deactivating', 'deactivating', $slug ) ?>...' );
725 $this[0].parentNode.submit();
726 }
727 }
728
729 return false;
730 });
731
732 var $sitesSection = $('#fs_sites'),
733 $sitesTable = $sitesSection.find('.fs-scrollable-table'),
734 $sitesTableRows = $sitesTable.find('.fs-site-details');
735
736 $('.fs-show-install-details').click(function(){
737 var installID = $(this).parents('.fs-site-details').attr('data-install-id');
738 $sitesSection.find('.fs-install-details[data-install-id=' + installID + ']').toggle();
739 });
740
741
742 var adjustColumnWidth = function($table) {
743 var $headerColumns = $table.find('.fs-table-head td'),
744 $bodyColumns = $table.find('.fs-table-body tr:first > td');
745
746 for (var i = 0, len = $headerColumns.length; i < len; i++) {
747 $($headerColumns[i]).width($($bodyColumns[i]).width());
748 }
749 for (i = 0, len = $headerColumns.length; i < len; i++) {
750 $($bodyColumns[i]).width($($headerColumns[i]).width());
751 }
752 };
753
754 adjustColumnWidth($sitesTable);
755
756 $sitesSection.find('.fs-search').keyup(function(){
757 var search = $(this).val().trim();
758
759 if ('' === search){
760 // Show all.
761 $sitesTableRows.show();
762 return;
763 }
764
765 var url;
766
767 $sitesTableRows.each(function(index){
768 url = $(this).find('.fs-field-url').html();
769
770 if (-1 < url.indexOf(search)){
771 $(this).show();
772 } else {
773 $(this).hide();
774 }
775 });
776 });
777
778 })(jQuery);
779 </script>
780 <?php
781 if ( $has_tabs ) {
782 $fs->_add_tabs_after_content();
783 }
784
785 $params = array(
786 'page' => 'account',
787 'module_id' => $fs->get_id(),
788 'module_type' => $fs->get_module_type(),
789 'module_slug' => $slug,
790 'module_version' => $fs->get_plugin_version(),
791 );
792 fs_require_template( 'powered-by.php', $params );