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/connect.php +51 -12 2.2.1 → 2.2.3 View file →
@@ -313,9 +313,9 @@
313 313 <?php if ( $fs->is_enable_anonymous() && ! $is_pending_activation && ( ! $require_license_key || $is_network_upgrade_mode ) ) : ?>
314 314 <a id="skip_activation" href="<?php echo fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_skip_activation' ), $is_network_level_activation ), $fs->get_unique_affix() . '_skip_activation' ) ?>"
315 315 class="button button-secondary" tabindex="2"><?php fs_esc_html_echo_x_inline( 'Skip', 'verb', 'skip', $slug ) ?></a>
316 316 <?php endif ?>
317 - <?php if ( $is_network_level_activation ) : ?>
317 + <?php if ( $is_network_level_activation && $fs->apply_filters( 'show_delegation_option', true ) ) : ?>
318 318 <a id="delegate_to_site_admins" class="fs-tooltip-trigger <?php echo is_rtl() ? ' rtl' : '' ?>" href="<?php echo fs_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $fs->get_unique_affix() . '_delegate_activation' ) ), $fs->get_unique_affix() . '_delegate_activation' ) ?>"><?php fs_esc_html_echo_inline( 'Delegate to Site Admins', 'delegate-to-site-admins', $slug ) ?><span class="fs-tooltip"><?php fs_esc_html_echo_inline( 'If you click it, this decision will be delegated to the sites administrators.', 'delegate-sites-tooltip', $slug ) ?></span></a>
319 319 <?php endif ?>
320 320 <?php if ( $activate_with_current_user ) : ?>
321 321 <form action="" method="POST">
@@ -473,8 +473,9 @@
473 473 isNetworkUpgradeMode = <?php echo $is_network_upgrade_mode ? 'true' : 'false' ?>,
474 474 $licenseSecret,
475 475 $licenseKeyInput = $('#fs_license_key'),
476 476 pauseCtaLabelUpdate = false,
477 + isNetworkDelegating = false,
477 478 /**
478 479 * @author Leo Fajardo (@leorw)
479 480 * @since 2.1.0
480 481 */
@@ -504,16 +505,17 @@
504 505 });
505 506
506 507 if ( isNetworkActive ) {
507 508 var
508 - $multisiteOptionsContainer = $( '#multisite_options_container' ),
509 - $allSitesOptions = $( '#all_sites_options' ),
510 - $applyOnAllSites = $( '#apply_on_all_sites' ),
511 - $sitesListContainer = $( '#sites_list_container' ),
509 + $multisiteOptionsContainer = $( '.fs-multisite-options-container' ),
510 + $allSitesOptions = $( '.fs-all-sites-options' ),
511 + $applyOnAllSites = $( '.fs-apply-on-all-sites-checkbox' ),
512 + $sitesListContainer = $( '.fs-sites-list-container' ),
512 513 totalSites = <?php echo count( $sites ) ?>,
513 514 maxSitesListHeight = null,
514 515 $skipActivationButton = $( '#skip_activation' ),
515 - $delegateToSiteAdminsButton = $( '#delegate_to_site_admins' );
516 + $delegateToSiteAdminsButton = $( '#delegate_to_site_admins' ),
517 + hasAnyInstall = <?php echo ! is_null( $fs->find_first_install() ) ? 'true' : 'false' ?>;
516 518
517 519 $applyOnAllSites.click(function() {
518 520 var isChecked = $( this ).is( ':checked' );
519 521
@@ -527,9 +529,9 @@
527 529 $skipActivationButton.toggle();
528 530
529 531 $delegateToSiteAdminsButton.toggle();
530 532
531 - $multisiteOptionsContainer.toggleClass( 'apply-on-all-sites', isChecked );
533 + $multisiteOptionsContainer.toggleClass( 'fs-apply-on-all-sites', isChecked );
532 534
533 535 $sitesListContainer.toggle( ! isChecked );
534 536 if ( ! isChecked && null === maxSitesListHeight ) {
535 537 /**
@@ -574,9 +576,9 @@
574 576 updatePrimaryCtaText( 'mixed' );
575 577 }
576 578 });
577 579
578 - if (isNetworkUpgradeMode) {
580 + if ( isNetworkUpgradeMode || hasAnyInstall ) {
579 581 $skipActivationButton.click(function(){
580 582 $delegateToSiteAdminsButton.hide();
581 583
582 584 $skipActivationButton.html('<?php fs_esc_js_echo_inline( 'Skipping, please wait', 'skipping-wait', $slug ) ?>...');
@@ -597,8 +599,18 @@
597 599 $delegateToSiteAdminsButton.html('<?php fs_esc_js_echo_inline( 'Delegating, please wait', 'delegating-wait', $slug ) ?>...');
598 600
599 601 pauseCtaLabelUpdate = true;
600 602
603 + /**
604 + * Set to true so that the form submission handler can differentiate delegation from license
605 + * activation and the proper AJAX action will be used (when delegating, the action should be
606 + * `network_activate` and not `activate_license`).
607 + *
608 + * @author Leo Fajardo (@leorw)
609 + * @since 2.3.0
610 + */
611 + isNetworkDelegating = true;
612 +
601 613 // Check all sites to be skipped.
602 614 $allSitesOptions.find('.action.action-delegate').click();
603 615
604 616 $form.submit();
@@ -604,8 +616,18 @@
604 616 $form.submit();
605 617
606 618 pauseCtaLabelUpdate = false;
607 619
620 + /**
621 + * Set to false so that in case the previous AJAX request has failed, the form submission handler
622 + * can differentiate license activation from delegation and the proper AJAX action will be used
623 + * (when activating a license, the action should be `activate_license` and not `network_activate`).
624 + *
625 + * @author Leo Fajardo (@leorw)
626 + * @since 2.3.0
627 + */
628 + isNetworkDelegating = false;
629 +
608 630 return false;
609 631 });
610 632 }
611 633 }
@@ -642,22 +664,33 @@
642 664 * @since 1.1.9
643 665 */
644 666 if ( ajaxOptin ) {
645 667 if (!hasContextUser || isNetworkUpgradeMode) {
646 - <?php $action = $require_license_key ? 'activate_license' : 'network_activate' ?>
668 + var action = null,
669 + security = null;
647 670
671 + if ( requireLicenseKey && ! isNetworkDelegating ) {
672 + action = '<?php echo $fs->get_ajax_action( 'activate_license' ) ?>';
673 + security = '<?php echo $fs->get_ajax_security( 'activate_license' ) ?>';
674 + } else {
675 + action = '<?php echo $fs->get_ajax_action( 'network_activate' ) ?>';
676 + security = '<?php echo $fs->get_ajax_security( 'network_activate' ) ?>';
677 + }
678 +
648 679 $('.fs-error').remove();
649 680
650 681 var
651 682 licenseKey = $licenseKeyInput.val(),
652 683 data = {
653 - action : '<?php echo $fs->get_ajax_action( $action ) ?>',
654 - security : '<?php echo $fs->get_ajax_security( $action ) ?>',
684 + action : action,
685 + security : security,
655 686 license_key: licenseKey,
656 687 module_id : '<?php echo $fs->get_id() ?>'
657 688 };
658 689
659 - if (requireLicenseKey &&
690 + if (
691 + requireLicenseKey &&
692 + ! isNetworkDelegating &&
660 693 isMarketingAllowedByLicense.hasOwnProperty(licenseKey)
661 694 ) {
662 695 var
663 696 isMarketingAllowed = null,
@@ -705,8 +738,10 @@
705 738 };
706 739
707 740 if ( ! requireLicenseKey) {
708 741 site.action = $this.find('.action.selected').data('action-type');
742 + } else if ( isNetworkDelegating ) {
743 + site.action = 'delegate';
709 744 }
710 745
711 746 sites.push( site );
712 747 });
@@ -711,8 +746,12 @@
711 746 sites.push( site );
712 747 });
713 748
714 749 data.sites = sites;
750 +
751 + if ( hasAnyInstall ) {
752 + data.has_any_install = hasAnyInstall;
753 + }
715 754 }
716 755
717 756 /**
718 757 * Use the AJAX opt-in when license key is required to potentially