PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | freemius/templates/forms/license-activation.php +58 -26 1.3.2 → 5.0.1 View file →
@@ -29,19 +29,12 @@
29 29
30 30 if ( $fs->is_registered() ) {
31 31 $activate_button_text = $header_title;
32 32 } else {
33 - $freemius_site_url = $fs->has_paid_plan() ?
34 - 'https://freemius.com/' :
35 - // Insights platform information.
36 - $fs->get_usage_tracking_terms_url();
37 -
38 - $freemius_link = '<a href="' . $freemius_site_url . '" target="_blank" rel="noopener" tabindex="0">freemius.com</a>';
39 -
40 33 $message_below_input_field = sprintf(
41 - fs_text_inline( 'The %1$s will be periodically sending data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ),
34 + fs_text_inline( 'The %1$s will be periodically sending essential license data to %2$s to check for security and feature updates, and verify the validity of your license.', 'license-sync-disclaimer', $slug ),
42 35 $fs->get_module_label( true ),
43 - $freemius_link
36 + "<b>{$fs->get_plugin_title()}</b>"
44 37 );
45 38
46 39 $activate_button_text = fs_text_inline( 'Agree & Activate License', 'agree-activate-license', $slug );
47 40 }
@@ -58,25 +51,56 @@
58 51 $sites_details = array();
59 52 if ( $is_network_activation ) {
60 53 $all_sites = Freemius::get_sites();
61 54
55 + $all_site_details = array();
56 + $subsite_url_by_install_id = array();
57 + $install_url_by_install_id = array();
58 +
62 59 foreach ( $all_sites as $site ) {
63 60 $site_details = $fs->get_site_info( $site );
64 61
62 + if ( FS_Clone_Manager::instance()->is_temporary_duplicate_by_blog_id( $site_details['blog_id'] ) ) {
63 + continue;
64 + }
65 +
65 66 $blog_id = Freemius::get_site_blog_id( $site );
66 67 $install = $fs->get_install_by_blog_id($blog_id);
67 68
68 - if ( is_object( $install ) && FS_Plugin_License::is_valid_id( $install->license_id ) ) {
69 - $site_details['license_id'] = $install->license_id;
69 + if ( is_object( $install ) ) {
70 + if ( isset( $subsite_url_by_install_id[ $install->id ] ) ) {
71 + $clone_subsite_url = $subsite_url_by_install_id[ $install->id ];
72 + $clone_install_url = $install_url_by_install_id[ $install->id ];
73 +
74 + if (
75 + /**
76 + * If we already have an install with the same URL as the subsite it's stored in, skip the current subsite. Otherwise, replace the existing install's data with the current subsite's install's data if the URLs match.
77 + *
78 + * @author Leo Fajardo (@leorw)
79 + * @since 2.5.0
80 + */
81 + fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_url ) ) ||
82 + fs_strip_url_protocol( untrailingslashit( $install->url ) ) !== fs_strip_url_protocol( untrailingslashit( $site_details['url'] ) )
83 + ) {
84 + continue;
85 + }
86 + }
87 +
88 + if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) {
89 + $site_details['license_id'] = $install->license_id;
90 + }
91 +
92 + $subsite_url_by_install_id[ $install->id ] = $site_details['url'];
93 + $install_url_by_install_id[ $install->id ] = $install->url;
70 94 }
71 95
72 - $sites_details[] = $site_details;
96 + $all_site_details[] = $site_details;
73 97 }
74 98
75 99 if ( $is_network_activation ) {
76 100 $vars = array(
77 101 'id' => $fs->get_id(),
78 - 'sites' => $sites_details,
102 + 'sites' => $all_site_details,
79 103 'require_license_key' => true
80 104 );
81 105
82 106 $network_activation_html = fs_get_template( 'partials/network-activation.php', $vars );
@@ -114,8 +138,10 @@
114 138 /**
115 139 * @var FS_Plugin_License $license
116 140 */
117 141 foreach ( $available_licenses as $license ) {
142 + $plan = $fs->_get_plan_by_id( $license->plan_id );
143 +
118 144 $label = sprintf(
119 145 "%s-Site %s License - %s",
120 146 ( 1 == $license->quota ?
121 147 'Single' :
@@ -120,13 +146,13 @@
120 146 ( 1 == $license->quota ?
121 147 'Single' :
122 148 ( $license->is_unlimited() ? 'Unlimited' : $license->quota )
123 149 ),
124 - $fs->_get_plan_by_id( $license->plan_id )->title,
150 + ( is_object( $plan ) ? $plan->title : '' ),
125 151 $license->get_html_escaped_masked_secret_key()
126 152 );
127 153
128 - $license_input_html .= "<option data-id='{$license->id}' value='{$license->secret_key}' data-left='{$license->left()}'>{$label}</option>";
154 + $license_input_html .= "<option data-id='{$license->id}' value='{$license->id}' data-left='{$license->left()}'>{$label}</option>";
129 155 }
130 156
131 157 $license_input_html .= '</select>';
132 158 } else {
@@ -151,9 +177,8 @@
151 177 class="fs-available-license-key"
152 178 type="text"
153 179 value="{$value}"
154 180 data-id="{$available_license->id}"
155 - data-license-key="{$available_license->secret_key}"
156 181 data-left="{$available_license->left()}"
157 182 readonly />
158 183 HTML;
159 184 }
@@ -283,8 +308,9 @@
283 308 * @since 2.3.2
284 309 */
285 310 afterLicenseUserDataLoaded = function () {
286 311 if (
312 + false !== otherLicenseOwnerID &&
287 313 null !== otherLicenseOwnerID &&
288 314 otherLicenseOwnerID != <?php echo $fs->is_registered() ? $fs->get_user()->id : 'null' ?>
289 315 ) {
290 316 $ownershipChangeOptionContainer.show();
@@ -338,9 +364,9 @@
338 364 $activateLicenseButton.attr( 'disabled', 'disabled' );
339 365 $activateLicenseButton.html( '<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait', $slug ) ?>...' );
340 366
341 367 $.ajax( {
342 - url : ajaxurl,
368 + url : <?php echo Freemius::ajax_url() ?>,
343 369 method : 'POST',
344 370 data : {
345 371 action : '<?php echo $fs->get_ajax_action( 'fetch_is_marketing_required_flag_value' ) ?>',
346 372 security : '<?php echo $fs->get_ajax_security( 'fetch_is_marketing_required_flag_value' ) ?>',
@@ -535,10 +561,10 @@
535 561 if ($(this).hasClass('disabled')) {
536 562 return;
537 563 }
538 564
539 - var
540 - licenseKey = '';
565 + var licenseKey = '',
566 + licenseID = '';
541 567
542 568 if ( hasLicenseTypes ) {
543 569 if ( isOtherLicenseKeySelected() ) {
544 570 licenseKey = $otherLicenseKey.val();
@@ -543,11 +569,11 @@
543 569 if ( isOtherLicenseKeySelected() ) {
544 570 licenseKey = $otherLicenseKey.val();
545 571 } else {
546 572 if ( ! hasLicensesDropdown ) {
547 - licenseKey = $availableLicenseKey.data( 'license-key' );
573 + licenseID = $availableLicenseKey.data( 'id' ).toString();
548 574 } else {
549 - licenseKey = $licensesDropdown.val();
575 + licenseID = $licensesDropdown.val();
550 576 }
551 577 }
552 578 } else {
553 579 licenseKey = $licenseKeyInput.val().trim();
@@ -554,9 +580,9 @@
554 580 }
555 581
556 582 disableActivateLicenseButton();
557 583
558 - if (0 === licenseKey.length) {
584 + if ( 0 === licenseID.length && 0 === licenseKey.length ) {
559 585 return;
560 586 }
561 587
562 588 var data = {
@@ -561,12 +587,17 @@
561 587
562 588 var data = {
563 589 action : '<?php echo $fs->get_ajax_action( 'activate_license' ) ?>',
564 590 security : '<?php echo $fs->get_ajax_security( 'activate_license' ) ?>',
565 - license_key: licenseKey,
566 591 module_id : '<?php echo $fs->get_id() ?>'
567 592 };
568 593
594 + if ( licenseID.length > 0 ) {
595 + data.license_id = licenseID;
596 + } else {
597 + data.license_key = licenseKey;
598 + }
599 +
569 600 if ( isNetworkActivation ) {
570 601 var
571 602 sites = [];
572 603
@@ -586,9 +617,8 @@
586 617 uid : $this.find( '.uid' ).val(),
587 618 url : $this.find( '.url' ).val(),
588 619 title : $this.find( '.title' ).val(),
589 620 language: $this.find( '.language' ).val(),
590 - charset : $this.find( '.charset' ).val(),
591 621 blog_id : $this.find( '.blog-id' ).find( 'span' ).text()
592 622 };
593 623
594 624 sites.push( site );
@@ -604,9 +634,9 @@
604 634 data.user_id = otherLicenseOwnerID;
605 635 }
606 636
607 637 $.ajax({
608 - url: ajaxurl,
638 + url: <?php echo Freemius::ajax_url() ?>,
609 639 method: 'POST',
610 640 data: data,
611 641 beforeSend: function () {
612 642 $activateLicenseButton.text( '<?php fs_esc_js_echo_inline( 'Activating license', 'activating-license', $slug ) ?>...' );
@@ -864,5 +894,7 @@
864 894 $licenseActivationMessage.show();
865 895 }
866 896 });
867 897 })( jQuery );
868 -</script>
898 +</script>
899 +<?php
900 + fs_require_once_template( 'api-connectivity-message-js.php' );