PluginProbe
Tiered Pricing Table for WooCommerce / 2.2.3
Tiered Pricing Table for WooCommerce v2.2.3
8.0.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 All 91 releases
← All changes | freemius/templates/account.php +164 -24 2.2.1 → 2.2.3 View file →
@@ -69,8 +69,13 @@
69 69 '_open_license_activation_dialog_box'
70 70 ) );
71 71 }
72 72
73 + $payments = $fs->_fetch_payments();
74 +
75 + $show_billing = ( is_array( $payments ) && 0 < count( $payments ) );
76 +
77 +
73 78 $has_tabs = $fs->_add_tabs_before_content();
74 79
75 80 if ( $has_tabs ) {
76 81 $query_params['tabs'] = 'true';
@@ -79,10 +84,10 @@
79 84 // Aliases.
80 85 $download_latest_text = fs_text_x_inline( 'Download Latest', 'as download latest version', 'download-latest', $slug );
81 86 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
82 87 $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 );
88 + /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
89 + $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 );
85 90 $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 91 $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 92 $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 93 $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 );
@@ -102,8 +107,9 @@
102 107 $trial_text = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
103 108 $free_text = fs_text_inline( 'Free', 'free', $slug );
104 109 $activate_text = fs_text_inline( 'Activate', 'activate', $slug );
105 110 $plan_text = fs_text_x_inline( 'Plan', 'as product pricing plan', 'plan', $slug );
111 + $bundle_plan_text = fs_text_inline( 'Bundle Plan', 'bundle-plan', $slug );
106 112
107 113 $show_plan_row = true;
108 114 $show_license_row = is_object( $license );
109 115
@@ -141,8 +147,29 @@
141 147 $show_license_row = false;
142 148 }
143 149 }
144 150 }
151 +
152 + $is_child_license = ( is_object( $license ) && FS_Plugin_License::is_valid_id( $license->parent_license_id ) );
153 + $bundle_subscription = null;
154 +
155 + if (
156 + $show_plan_row &&
157 + is_object( $license ) &&
158 + FS_Plugin_License::is_valid_id( $license->parent_license_id )
159 + ) {
160 + $bundle_subscription = $fs->_get_subscription( $license->parent_license_id );
161 + }
162 +
163 + $is_active_bundle_subscription = ( is_object( $bundle_subscription ) && $bundle_subscription->is_active() );
164 +
165 + $fs_blog_id = ( is_multisite() && ! is_network_admin() ) ?
166 + get_current_blog_id() :
167 + 0;
168 +
169 + $active_plugins_directories_map = Freemius::get_active_plugins_directories_map( $fs_blog_id );
170 +
171 + $is_premium = $fs->is_premium();
145 172 ?>
146 173 <div class="wrap fs-section">
147 174 <?php if ( ! $has_tabs && ! $fs->apply_filters( 'hide_account_tabs', false ) ) : ?>
148 175 <h2 class="nav-tab-wrapper">
@@ -168,8 +195,12 @@
168 195 <div class="postbox">
169 196 <h3><span class="dashicons dashicons-businessman"></span> <?php fs_esc_html_echo_inline( 'Account Details', 'account-details', $slug ) ?></h3>
170 197 <div class="fs-header-actions">
171 198 <ul>
199 + <?php if ( $show_billing ) : ?>
200 + <li><a href="#fs_billing"><i class="dashicons dashicons-portfolio"></i> <?php fs_esc_html_echo_inline( 'Billing & Invoices', 'billing-invoices', $slug ) ?></li>
201 + <li>&nbsp;&bull;&nbsp;</li>
202 + <?php endif ?>
172 203 <?php if ( ! $is_paying ) : ?>
173 204 <li>
174 205 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
175 206 <input type="hidden" name="fs_action" value="delete_account">
@@ -275,8 +306,24 @@
275 306 'value' => $user->id
276 307 );
277 308 }
278 309
310 + $profile[] = array(
311 + 'id' => 'product',
312 + 'title' => ( $fs->is_plugin() ?
313 + fs_text_inline( 'Plugin', 'plugin', $slug ) :
314 + fs_text_inline( 'Theme', 'theme', $slug ) ),
315 + 'value' => $fs->get_plugin_title()
316 + );
317 +
318 + $profile[] = array(
319 + 'id' => 'product_id',
320 + 'title' => ( $fs->is_plugin() ?
321 + fs_text_inline( 'Plugin', 'plugin', $slug ) :
322 + fs_text_inline( 'Theme', 'theme', $slug ) ) . ' ' . fs_text_inline( 'ID', 'id', $slug ),
323 + 'value' => $fs->get_id()
324 + );
325 +
279 326 if ( ! fs_is_network_admin()) {
280 327 $profile[] = array(
281 328 'id' => 'site_id',
282 329 'title' => fs_text_inline( 'Site ID', 'site-id', $slug ),
@@ -306,8 +353,16 @@
306 353 'title' => $version_text,
307 354 'value' => $fs->get_plugin_version()
308 355 );
309 356
357 + if ( $is_premium ) {
358 + $profile[] = array(
359 + 'id' => 'beta_program',
360 + 'title' => '',
361 + 'value' => $user->is_beta
362 + );
363 + }
364 +
310 365 if ( $has_paid_plan ) {
311 366 if ( $fs->is_trial() ) {
312 367 if ( $show_plan_row ) {
313 368 $profile[] = array(
@@ -321,14 +376,22 @@
321 376 } else {
322 377 if ( $show_plan_row ) {
323 378 $profile[] = array(
324 379 'id' => 'plan',
325 - 'title' => $plan_text,
380 + 'title' => ( $is_child_license ? ucfirst( $fs->get_module_type() ) . ' ' : '' ) . $plan_text,
326 381 'value' => strtoupper( is_string( $plan->name ) ?
327 382 $plan->title :
328 383 strtoupper( $free_text )
329 384 )
330 385 );
386 +
387 + if ( $is_child_license ) {
388 + $profile[] = array(
389 + 'id' => 'bundle_plan',
390 + 'title' => $bundle_plan_text,
391 + 'value' => strtoupper( $license->parent_plan_title )
392 + );
393 + }
331 394 }
332 395
333 396 if ( is_object( $license ) ) {
334 397 if ( ! $hide_license_key ) {
@@ -352,15 +415,20 @@
352 415 }
353 416 ?>
354 417 <tr class="fs-field-<?php echo $p['id'] ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
355 418 <td>
356 - <nobr><?php echo $p['title'] ?>:</nobr>
419 + <nobr><?php echo $p['title'] ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
357 420 </td>
358 - <td<?php if ( 'plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
421 + <td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
359 422 <?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
360 423 <code><?php echo htmlspecialchars( substr( $p['value'], 0, 6 ) ) . str_pad( '', 23 * 6, '&bull;' ) . htmlspecialchars( substr( $p['value'], - 3 ) ) ?></code>
361 424 <input type="text" value="<?php echo htmlspecialchars( $p['value'] ) ?>" style="display: none"
362 425 readonly/>
426 + <?php elseif ( 'beta_program' === $p['id'] ) : ?>
427 + <label>
428 + <input type="checkbox" class="fs-toggle-beta-mode" <?php checked( true, $p['value'] ) ?>/><span><?php
429 + fs_esc_html_echo_inline( 'Join the Beta program', 'join-beta', $slug )
430 + ?></span></label>
363 431 <?php else : ?>
364 432 <code><?php echo htmlspecialchars( $p['value'] ) ?></code>
365 433 <?php endif ?>
366 434 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
@@ -370,9 +438,9 @@
370 438 <?php if ( $fs->is_trial() ) : ?>
371 439 <label class="fs-tag fs-success"><?php echo esc_html( $trial_text ) ?></label>
372 440 <?php endif ?>
373 441 <?php if ( is_object( $license ) && ! $license->is_lifetime() ) : ?>
374 - <?php if ( ! $is_active_subscription && ! $license->is_first_payment_pending() ) : ?>
442 + <?php if ( ! $is_active_subscription && ! $is_active_bundle_subscription && ! $license->is_first_payment_pending() ) : ?>
375 443 <?php $is_license_expired = $license->is_expired() ?>
376 444 <?php $expired_ago_text = ( fs_text_inline( 'Expired', 'expired', $slug ) . ' ' . fs_text_x_inline( '%s ago', 'x-ago', $slug ) ) ?>
377 445 <label
378 446 class="fs-tag <?php echo $is_license_expired ? 'fs-error' : 'fs-warn' ?>"><?php
@@ -401,9 +469,9 @@
401 469 fs_require_template( 'account/partials/activate-license-button.php', $view_params ); ?>
402 470 <?php else : ?>
403 471 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>"
404 472 method="POST" class="button-group">
405 - <?php if ( $show_upgrade && $fs->is_premium() ) : ?>
473 + <?php if ( $show_upgrade && $is_premium ) : ?>
406 474 <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 475 <?php endif ?>
408 476 <input type="submit" class="button"
409 477 value="<?php echo esc_attr( $sync_license_text ) ?>">
@@ -420,11 +488,17 @@
420 488 <?php endif ?>
421 489 </form>
422 490 <?php endif ?>
423 491 </div>
492 + <?php elseif ( 'bundle_plan' === $p['id'] ) : ?>
493 + <?php if ( is_object( $bundle_subscription ) ) : ?>
494 + <?php if ( $is_active_bundle_subscription && ! $license->is_first_payment_pending() ) : ?>
495 + <label class="fs-tag fs-success"><?php echo esc_html( sprintf( $renews_in_text, human_time_diff( time(), strtotime( $bundle_subscription->next_payment ) ) ) ) ?></label>
496 + <?php endif ?>
497 + <?php endif ?>
424 498 <?php elseif ( 'version' === $p['id'] && $has_paid_plan ) : ?>
425 499 <?php if ( $fs->has_premium_version() ) : ?>
426 - <?php if ( $fs->is_premium() ) : ?>
500 + <?php if ( $is_premium ) : ?>
427 501 <label
428 502 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 503 <?php elseif ( $fs->can_use_premium_code() ) : ?>
430 504 <label class="fs-tag fs-warn"><?php fs_esc_html_echo_inline( 'Free version', 'free-version', $slug ) ?></label>
@@ -431,9 +505,9 @@
431 505 <?php endif ?>
432 506 <?php endif ?>
433 507 <?php endif ?>
434 508 </td>
435 - <?php if ( 'plan' !== $p['id'] ) : ?>
509 + <?php if ( 'plan' !== $p['id'] && 'bundle_plan' !== $p['id'] ) : ?>
436 510 <td class="fs-right">
437 511 <?php if ( 'email' === $p['id'] && ! $user->is_verified() ) : ?>
438 512 <form action="<?php echo $fs->_get_admin_page_url( 'account' ) ?>" method="POST">
439 513 <input type="hidden" name="fs_action" value="verify_email">
@@ -491,10 +565,22 @@
491 565 <?php endif ?>
492 566 </td>
493 567 <?php endif ?>
494 568 </tr>
495 - <?php $odd = ! $odd;
496 - endforeach ?>
569 + <?php
570 + if ( 'version' === $p['id'] && $is_premium ) {
571 + /**
572 + * If there's a row for the beta program, keep its background color
573 + * the same as the version info row.
574 + *
575 + * @author Leo Fajardo (@leorw)
576 + * @since 2.3.0
577 + */
578 + continue;
579 + }
580 +
581 + $odd = ! $odd;
582 + endforeach ?>
497 583 </table>
498 584 </div>
499 585 </div>
500 586 <?php if ( fs_is_network_admin() ) : ?>
@@ -501,9 +587,9 @@
501 587 <div id="fs_sites" class="postbox">
502 588 <h3><span class="dashicons dashicons-networking"></span> <?php fs_esc_html_echo_inline( 'Sites', 'sites', $slug ) ?></h3>
503 589 <div class="fs-header-actions">
504 590 <?php $has_license = is_object( $license ) ?>
505 - <?php if ( $has_license || ( $show_upgrade && $fs->is_premium() ) ) : ?>
591 + <?php if ( $has_license || ( $show_upgrade && $is_premium ) ) : ?>
506 592 <?php
507 593 $activate_license_button_text = $has_license ?
508 594 fs_esc_html_inline( 'Change License', 'change-license', $slug ) :
509 595 fs_esc_html_inline( 'Activate License', 'activate-license', $slug );
@@ -544,12 +630,9 @@
544 630 </div>
545 631 <?php endif ?>
546 632
547 633 <?php
548 - $account_addons = $fs->get_account_addons();
549 - if ( ! is_array( $account_addons ) ) {
550 - $account_addons = array();
551 - }
634 + $account_addons = $fs->get_updated_account_addons();
552 635
553 636 $installed_addons = $fs->get_installed_addons();
554 637 $installed_addons_ids = array();
555 638 foreach ( $installed_addons as $fs_addon ) {
@@ -577,14 +660,24 @@
577 660 <?php endif ?>
578 661 </tr>
579 662 </thead>
580 663 <tbody>
581 - <?php $odd = true;
664 + <?php
665 + $odd = true;
666 +
667 + $installed_addons_ids_map = array_flip( $installed_addons_ids );
668 +
582 669 foreach ( $addons_to_show as $addon_id ) {
670 + $is_addon_installed = isset( $installed_addons_ids_map[ $addon_id ] );
671 +
583 672 $addon_view_params = array(
584 - 'parent_fs' => $fs,
585 - 'addon_id' => $addon_id,
586 - 'odd' => $odd,
673 + 'parent_fs' => $fs,
674 + 'addon_id' => $addon_id,
675 + 'odd' => $odd,
676 + 'fs_blog_id' => $fs_blog_id,
677 + 'active_plugins_directories_map' => &$active_plugins_directories_map,
678 + 'is_addon_installed' => $is_addon_installed,
679 + 'addon_info' => $fs->_get_addon_info( $addon_id, $is_addon_installed )
587 680 );
588 681
589 682 fs_require_template(
590 683 'account/partials/addon.php',
@@ -601,11 +694,13 @@
601 694
602 695 <?php $fs->do_action( 'after_account_details' ) ?>
603 696
604 697 <?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 );
698 + if ( $show_billing ) {
699 + $view_params = array( 'id' => $VARS['id'] );
700 + fs_require_once_template( 'account/billing.php', $view_params );
701 + fs_require_once_template( 'account/payments.php', $view_params );
702 + }
608 703 ?>
609 704 </div>
610 705 </div>
611 706 </div>
@@ -610,9 +705,14 @@
610 705 </div>
611 706 </div>
612 707 </div>
613 708 </div>
614 - <?php $fs->_maybe_add_subscription_cancellation_dialog_box( true ) ?>
709 + <?php
710 + $subscription_cancellation_dialog_box_template_params = $fs->_get_subscription_cancellation_dialog_box_template_params( true );
711 + if ( ! empty( $subscription_cancellation_dialog_box_template_params ) ) {
712 + fs_require_template( 'forms/subscription-cancellation.php', $subscription_cancellation_dialog_box_template_params );
713 + }
714 + ?>
615 715 <script type="text/javascript">
616 716 (function ($) {
617 717 var setLoading = function ($this, label) {
618 718 // Set loading mode.
@@ -657,8 +757,48 @@
657 757 '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>' :
658 758 '<?php fs_esc_js_echo_inline('Opting out', 'opting-out' ) ?>') +
659 759 '...'
660 760 );
761 + });
762 +
763 + <?php
764 + $plugin_title = $fs->get_plugin_title();
765 + $processing_text = fs_esc_js_inline( 'Processing', 'processing' );
766 + $confirmation_message = sprintf(
767 + '%s %s',
768 + sprintf( fs_esc_attr_inline( 'Get updates for bleeding edge Beta versions of %s.', 'get-beta-versions', $slug ), $plugin_title ),
769 + 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 )
770 + );
771 + ?>
772 +
773 + $( '.fs-toggle-beta-mode' ).click( function () {
774 + var $checkbox = $( this ),
775 + isChecked = $checkbox.is( ':checked' );
776 +
777 + if ( ! isChecked || confirm( '<?php echo $confirmation_message ?>' ) ) {
778 + $.ajax( {
779 + url : ajaxurl,
780 + method: 'POST',
781 + data : {
782 + action : '<?php echo $fs->get_ajax_action( 'set_beta_mode' ) ?>',
783 + security : '<?php echo $fs->get_ajax_security( 'set_beta_mode' ) ?>',
784 + is_beta : isChecked,
785 + module_id: <?php echo $fs->get_id() ?>
786 + },
787 + beforeSend: function () {
788 + $checkbox.prop( 'disabled', true );
789 + $checkbox.parent().find( 'span' ).text( '<?php echo $processing_text ?>' + '...' );
790 + },
791 + complete: function () {
792 + $checkbox.prop( 'disabled', false );
793 + $checkbox.parent().find( 'span' ).text( '<?php fs_esc_js_echo_inline( 'Join the Beta Program', 'join-beta', $slug ) ?>' );
794 + }
795 + } );
796 +
797 + return true;
798 + }
799 +
800 + return false;
661 801 });
662 802
663 803 $('.fs-opt-in').click(function () {
664 804 setLoading($(this), '<?php fs_esc_js_echo_inline('Opting in', 'opting-in' ) ?>...');