Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/content-.../inc/freemius/template.../forms
File: license-activation.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @package Freemius
[2] Fix | Delete
* @copyright Copyright (c) 2015, Freemius, Inc.
[3] Fix | Delete
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
[4] Fix | Delete
* @since 1.1.9
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* @var array $VARS
[13] Fix | Delete
*
[14] Fix | Delete
* @var Freemius $fs
[15] Fix | Delete
*/
[16] Fix | Delete
$fs = freemius( $VARS['id'] );
[17] Fix | Delete
$slug = $fs->get_slug();
[18] Fix | Delete
$unique_affix = $fs->get_unique_affix();
[19] Fix | Delete
[20] Fix | Delete
$cant_find_license_key_text = fs_text_inline( "Can't find your license key?", 'cant-find-license-key', $slug );
[21] Fix | Delete
$message_above_input_field = fs_text_inline( 'Please enter the license key that you received in the email right after the purchase:', 'activate-license-message', $slug );
[22] Fix | Delete
$message_below_input_field = '';
[23] Fix | Delete
[24] Fix | Delete
$header_title = $fs->is_free_plan() ?
[25] Fix | Delete
fs_text_inline( 'Activate License', 'activate-license', $slug ) :
[26] Fix | Delete
fs_text_inline( 'Update License', 'update-license', $slug );
[27] Fix | Delete
[28] Fix | Delete
if ( $fs->is_registered() ) {
[29] Fix | Delete
$activate_button_text = $header_title;
[30] Fix | Delete
} else {
[31] Fix | Delete
$message_below_input_field = sprintf(
[32] Fix | Delete
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 ),
[33] Fix | Delete
$fs->get_module_label( true ),
[34] Fix | Delete
"<b>{$fs->get_plugin_title()}</b>"
[35] Fix | Delete
);
[36] Fix | Delete
[37] Fix | Delete
$activate_button_text = fs_text_inline( 'Agree & Activate License', 'agree-activate-license', $slug );
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
$license_key_text = fs_text_inline( 'License key', 'license-key' , $slug );
[41] Fix | Delete
[42] Fix | Delete
$is_network_activation = (
[43] Fix | Delete
$fs->is_network_active() &&
[44] Fix | Delete
fs_is_network_admin() &&
[45] Fix | Delete
! $fs->is_delegated_connection()
[46] Fix | Delete
);
[47] Fix | Delete
$network_activation_html = '';
[48] Fix | Delete
[49] Fix | Delete
$sites_details = array();
[50] Fix | Delete
if ( $is_network_activation ) {
[51] Fix | Delete
$all_sites = Freemius::get_sites();
[52] Fix | Delete
[53] Fix | Delete
$all_site_details = array();
[54] Fix | Delete
$subsite_url_by_install_id = array();
[55] Fix | Delete
$install_url_by_install_id = array();
[56] Fix | Delete
[57] Fix | Delete
foreach ( $all_sites as $site ) {
[58] Fix | Delete
$site_details = $fs->get_site_info( $site );
[59] Fix | Delete
[60] Fix | Delete
if ( FS_Clone_Manager::instance()->is_temporary_duplicate_by_blog_id( $site_details['blog_id'] ) ) {
[61] Fix | Delete
continue;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
$blog_id = Freemius::get_site_blog_id( $site );
[65] Fix | Delete
$install = $fs->get_install_by_blog_id($blog_id);
[66] Fix | Delete
[67] Fix | Delete
if ( is_object( $install ) ) {
[68] Fix | Delete
if ( isset( $subsite_url_by_install_id[ $install->id ] ) ) {
[69] Fix | Delete
$clone_subsite_url = $subsite_url_by_install_id[ $install->id ];
[70] Fix | Delete
$clone_install_url = $install_url_by_install_id[ $install->id ];
[71] Fix | Delete
[72] Fix | Delete
if (
[73] Fix | Delete
/**
[74] Fix | Delete
* 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.
[75] Fix | Delete
*
[76] Fix | Delete
* @author Leo Fajardo (@leorw)
[77] Fix | Delete
* @since 2.5.0
[78] Fix | Delete
*/
[79] Fix | Delete
fs_strip_url_protocol( untrailingslashit( $clone_install_url ) ) === fs_strip_url_protocol( untrailingslashit( $clone_subsite_url ) ) ||
[80] Fix | Delete
fs_strip_url_protocol( untrailingslashit( $install->url ) ) !== fs_strip_url_protocol( untrailingslashit( $site_details['url'] ) )
[81] Fix | Delete
) {
[82] Fix | Delete
continue;
[83] Fix | Delete
}
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
if ( FS_Plugin_License::is_valid_id( $install->license_id ) ) {
[87] Fix | Delete
$site_details['license_id'] = $install->license_id;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
$subsite_url_by_install_id[ $install->id ] = $site_details['url'];
[91] Fix | Delete
$install_url_by_install_id[ $install->id ] = $install->url;
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
$all_site_details[] = $site_details;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
if ( $is_network_activation ) {
[98] Fix | Delete
$vars = array(
[99] Fix | Delete
'id' => $fs->get_id(),
[100] Fix | Delete
'sites' => $all_site_details,
[101] Fix | Delete
'require_license_key' => true
[102] Fix | Delete
);
[103] Fix | Delete
[104] Fix | Delete
$network_activation_html = fs_get_template( 'partials/network-activation.php', $vars );
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
$premium_licenses = $fs->get_available_premium_licenses();
[109] Fix | Delete
$available_licenses = array();
[110] Fix | Delete
foreach ( $premium_licenses as $premium_license ) {
[111] Fix | Delete
$activations_left = $premium_license->left();
[112] Fix | Delete
if ( ! ( $activations_left > 0 ) ) {
[113] Fix | Delete
continue;
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
$available_licenses[ $activations_left . '_' . $premium_license->id ] = $premium_license;
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
$total_available_licenses = count( $available_licenses );
[120] Fix | Delete
if ( $total_available_licenses > 0 ) {
[121] Fix | Delete
$license_input_html = <<< HTML
[122] Fix | Delete
<div class="fs-license-options-container">
[123] Fix | Delete
<table>
[124] Fix | Delete
<tbody>
[125] Fix | Delete
<tr class="fs-available-license-key-container">
[126] Fix | Delete
<td><input type="radio" name="license_type" value="available"></td>
[127] Fix | Delete
<td>
[128] Fix | Delete
HTML;
[129] Fix | Delete
[130] Fix | Delete
if ( $total_available_licenses > 1 ) {
[131] Fix | Delete
// Sort the licenses by number of activations left in descending order.
[132] Fix | Delete
krsort( $available_licenses );
[133] Fix | Delete
[134] Fix | Delete
$license_input_html .= '<select class="fs-licenses">';
[135] Fix | Delete
[136] Fix | Delete
/**
[137] Fix | Delete
* @var FS_Plugin_License $license
[138] Fix | Delete
*/
[139] Fix | Delete
foreach ( $available_licenses as $license ) {
[140] Fix | Delete
$plan = $fs->_get_plan_by_id( $license->plan_id );
[141] Fix | Delete
[142] Fix | Delete
$label = sprintf(
[143] Fix | Delete
"%s-Site %s License - %s",
[144] Fix | Delete
( 1 == $license->quota ?
[145] Fix | Delete
'Single' :
[146] Fix | Delete
( $license->is_unlimited() ? 'Unlimited' : $license->quota )
[147] Fix | Delete
),
[148] Fix | Delete
( is_object( $plan ) ? $plan->title : '' ),
[149] Fix | Delete
$license->get_html_escaped_masked_secret_key()
[150] Fix | Delete
);
[151] Fix | Delete
[152] Fix | Delete
$license_input_html .= "<option data-id='{$license->id}' value='{$license->secret_key}' data-left='{$license->left()}'>{$label}</option>";
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
$license_input_html .= '</select>';
[156] Fix | Delete
} else {
[157] Fix | Delete
$available_licenses = array_values( $available_licenses );
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* @var FS_Plugin_License $available_license
[161] Fix | Delete
*/
[162] Fix | Delete
$available_license = $available_licenses[0];
[163] Fix | Delete
$value = sprintf(
[164] Fix | Delete
"%s-Site %s License - %s",
[165] Fix | Delete
( 1 == $available_license->quota ?
[166] Fix | Delete
'Single' :
[167] Fix | Delete
( $available_license->is_unlimited() ? 'Unlimited' : $available_license->quota )
[168] Fix | Delete
),
[169] Fix | Delete
$fs->_get_plan_by_id( $available_license->plan_id )->title,
[170] Fix | Delete
$available_license->get_html_escaped_masked_secret_key()
[171] Fix | Delete
);
[172] Fix | Delete
[173] Fix | Delete
$license_input_html .= <<< HTML
[174] Fix | Delete
<input
[175] Fix | Delete
class="fs-available-license-key"
[176] Fix | Delete
type="text"
[177] Fix | Delete
value="{$value}"
[178] Fix | Delete
data-id="{$available_license->id}"
[179] Fix | Delete
data-license-key="{$available_license->secret_key}"
[180] Fix | Delete
data-left="{$available_license->left()}"
[181] Fix | Delete
readonly />
[182] Fix | Delete
HTML;
[183] Fix | Delete
}
[184] Fix | Delete
[185] Fix | Delete
$license_input_html .= <<< HTML
[186] Fix | Delete
</td>
[187] Fix | Delete
</tr>
[188] Fix | Delete
<tr>
[189] Fix | Delete
<td><input type="radio" name="license_type" value="other"></td>
[190] Fix | Delete
<td class="fs-other-license-key-container">
[191] Fix | Delete
<label for="other_license_key_{$unique_affix}">Other: </label>
[192] Fix | Delete
<div>
[193] Fix | Delete
<input id="other_license_key_{$unique_affix}" class="fs-license-key" type="text" placeholder="Enter license key" tabindex="1">
[194] Fix | Delete
</div>
[195] Fix | Delete
</td>
[196] Fix | Delete
</tr>
[197] Fix | Delete
</tbody>
[198] Fix | Delete
</table>
[199] Fix | Delete
</div>
[200] Fix | Delete
HTML;
[201] Fix | Delete
} else {
[202] Fix | Delete
$license_input_html = "<input class='fs-license-key' type='text' placeholder='{$license_key_text}' tabindex='1' />";
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
$ownership_change_option_text = fs_text_inline( "Associate with the license owner's account.", 'associate-account-with-license-owner', $slug );
[206] Fix | Delete
$ownership_change_option_html = "<div class='ownership-change-option-container' style='display: none'><label><input type='checkbox' /> <strong>{$ownership_change_option_text}</strong></label></div>";
[207] Fix | Delete
[208] Fix | Delete
/**
[209] Fix | Delete
* IMPORTANT:
[210] Fix | Delete
* DO NOT ADD MAXLENGTH OR LIMIT THE LICENSE KEY LENGTH SINCE
[211] Fix | Delete
* WE DO WANT TO ALLOW INPUT OF LONGER KEYS (E.G. WooCommerce Keys)
[212] Fix | Delete
* FOR MIGRATED MODULES.
[213] Fix | Delete
*/
[214] Fix | Delete
$modal_content_html = <<< HTML
[215] Fix | Delete
<div class="notice notice-error inline license-activation-message"><p></p></div>
[216] Fix | Delete
<p>{$message_above_input_field}</p>
[217] Fix | Delete
{$license_input_html}
[218] Fix | Delete
<a class="show-license-resend-modal show-license-resend-modal-{$fs->get_unique_affix()}" href="!#" tabindex="2">{$cant_find_license_key_text}</a>
[219] Fix | Delete
{$network_activation_html}
[220] Fix | Delete
<p>{$message_below_input_field}</p>
[221] Fix | Delete
{$ownership_change_option_html}
[222] Fix | Delete
HTML;
[223] Fix | Delete
[224] Fix | Delete
/**
[225] Fix | Delete
* Handle the ownership change option if not an add-on or if no license yet is activated for the
[226] Fix | Delete
* parent product in case of an add-on.
[227] Fix | Delete
*
[228] Fix | Delete
* @author Leo Fajardo (@leorw)
[229] Fix | Delete
* @since 2.3.2
[230] Fix | Delete
*/
[231] Fix | Delete
$is_user_change_supported = ( ! $fs->is_addon() || ! $fs->get_parent_instance()->has_active_valid_license() );
[232] Fix | Delete
[233] Fix | Delete
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
[234] Fix | Delete
?>
[235] Fix | Delete
<script type="text/javascript">
[236] Fix | Delete
(function( $ ) {
[237] Fix | Delete
$( document ).ready(function() {
[238] Fix | Delete
var modalContentHtml = <?php echo json_encode($modal_content_html); ?>,
[239] Fix | Delete
modalHtml =
[240] Fix | Delete
'<div class="fs-modal fs-modal-license-activation fs-modal-license-activation-<?php echo $unique_affix ?>">'
[241] Fix | Delete
+ ' <div class="fs-modal-dialog">'
[242] Fix | Delete
+ ' <div class="fs-modal-header">'
[243] Fix | Delete
+ ' <h4><?php echo esc_js($header_title) ?></h4>'
[244] Fix | Delete
+ ' <a href="!#" class="fs-close"><i class="dashicons dashicons-no" title="<?php echo esc_js( fs_text_x_inline( 'Dismiss', 'as close a window', 'dismiss', $slug ) ) ?>"></i></a>'
[245] Fix | Delete
+ ' </div>'
[246] Fix | Delete
+ ' <div class="fs-modal-body">'
[247] Fix | Delete
+ ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
[248] Fix | Delete
+ ' </div>'
[249] Fix | Delete
+ ' <div class="fs-modal-footer">'
[250] Fix | Delete
+ ' <button class="button button-secondary button-close" tabindex="4"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></button>'
[251] Fix | Delete
+ ' <button class="button button-primary button-activate-license" tabindex="3"><?php echo esc_js( $activate_button_text ) ?></button>'
[252] Fix | Delete
+ ' </div>'
[253] Fix | Delete
+ ' </div>'
[254] Fix | Delete
+ '</div>',
[255] Fix | Delete
$modal = $(modalHtml),
[256] Fix | Delete
$activateLicenseButton = $modal.find('.button-activate-license'),
[257] Fix | Delete
$licenseKeyInput = $modal.find( 'input.fs-license-key' ),
[258] Fix | Delete
$licenseActivationMessage = $modal.find( '.license-activation-message' ),
[259] Fix | Delete
isNetworkActivation = <?php echo $is_network_activation ? 'true' : 'false' ?>,
[260] Fix | Delete
isUserChangeSupported = <?php echo $is_user_change_supported ? 'true' : 'false' ?>,
[261] Fix | Delete
isSingleSiteActivation = false,
[262] Fix | Delete
$ownershipChangeOptionContainer = $modal.find( '.ownership-change-option-container' ),
[263] Fix | Delete
$body = $( 'body' );
[264] Fix | Delete
[265] Fix | Delete
$modal.appendTo( $body );
[266] Fix | Delete
[267] Fix | Delete
var
[268] Fix | Delete
$licensesDropdown = $modal.find( '.fs-licenses' ),
[269] Fix | Delete
$licenseTypes = $modal.find( 'input[type="radio"][name="license_type"]' ),
[270] Fix | Delete
$applyOnAllSites = $modal.find( '.fs-apply-on-all-sites-checkbox' ),
[271] Fix | Delete
$sitesListContainer = $modal.find( '.fs-sites-list-container' ),
[272] Fix | Delete
$availableLicenseKey = $modal.find( '.fs-available-license-key' ),
[273] Fix | Delete
$otherLicenseKey = $modal.find( '#other_license_key_<?php echo $unique_affix ?>' ),
[274] Fix | Delete
$multisiteOptionsContainer = $modal.find( '.fs-multisite-options-container' ),
[275] Fix | Delete
$activationsLeft = null,
[276] Fix | Delete
hasLicensesDropdown = ( $licensesDropdown.length > 0 ),
[277] Fix | Delete
hasLicenseTypes = ( $licenseTypes.length > 0 ),
[278] Fix | Delete
maxSitesListHeight = null,
[279] Fix | Delete
totalSites = <?php echo count( $sites_details ) ?>,
[280] Fix | Delete
singleBlogID = null;
[281] Fix | Delete
[282] Fix | Delete
var
[283] Fix | Delete
previousLicenseKey = null,
[284] Fix | Delete
otherLicenseOwnerID = null,
[285] Fix | Delete
/**
[286] Fix | Delete
* @author Leo Fajardo (@leorw)
[287] Fix | Delete
* @since 2.3.2
[288] Fix | Delete
*/
[289] Fix | Delete
resetLoadingMode = function () {
[290] Fix | Delete
// Reset loading mode.
[291] Fix | Delete
$activateLicenseButton.text( <?php echo json_encode( $activate_button_text ) ?> );
[292] Fix | Delete
$activateLicenseButton.prop( 'disabled', false );
[293] Fix | Delete
$( document.body ).css( { 'cursor': 'auto' } );
[294] Fix | Delete
$( '.fs-loading' ).removeClass( 'fs-loading' );
[295] Fix | Delete
[296] Fix | Delete
console.log( 'resetLoadingMode - Primary button was enabled' );
[297] Fix | Delete
},
[298] Fix | Delete
/**
[299] Fix | Delete
* @author Leo Fajardo (@leorw)
[300] Fix | Delete
* @since 2.3.2
[301] Fix | Delete
*/
[302] Fix | Delete
setLoadingMode = function () {
[303] Fix | Delete
$( document.body ).css( { 'cursor': 'wait' } );
[304] Fix | Delete
},
[305] Fix | Delete
/**
[306] Fix | Delete
* @author Leo Fajardo (@leorw)
[307] Fix | Delete
* @since 2.3.2
[308] Fix | Delete
*/
[309] Fix | Delete
afterLicenseUserDataLoaded = function () {
[310] Fix | Delete
if (
[311] Fix | Delete
null !== otherLicenseOwnerID &&
[312] Fix | Delete
otherLicenseOwnerID != <?php echo $fs->is_registered() ? $fs->get_user()->id : 'null' ?>
[313] Fix | Delete
) {
[314] Fix | Delete
$ownershipChangeOptionContainer.show();
[315] Fix | Delete
} else {
[316] Fix | Delete
$ownershipChangeOptionContainer.hide();
[317] Fix | Delete
$activateLicenseButton.focus();
[318] Fix | Delete
}
[319] Fix | Delete
},
[320] Fix | Delete
/**
[321] Fix | Delete
* @author Leo Fajardo (@leorw)
[322] Fix | Delete
* @since 2.3.2
[323] Fix | Delete
*/
[324] Fix | Delete
fetchLicenseUserData = function () {
[325] Fix | Delete
var hideAndUncheckUserChangeCheckbox = ( ! isUserChangeSupported ),
[326] Fix | Delete
otherLicenseKeyIsSelected = isOtherLicenseKeySelected();
[327] Fix | Delete
[328] Fix | Delete
if ( ! hideAndUncheckUserChangeCheckbox ) {
[329] Fix | Delete
// User change is supported only on the site level.
[330] Fix | Delete
hideAndUncheckUserChangeCheckbox = ( isNetworkActivation || isSingleSiteActivation );
[331] Fix | Delete
}
[332] Fix | Delete
[333] Fix | Delete
if ( ! hideAndUncheckUserChangeCheckbox ) {
[334] Fix | Delete
hideAndUncheckUserChangeCheckbox = ( hasLicenseTypes && ! otherLicenseKeyIsSelected );
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
var licenseKey = $licenseKeyInput.val().trim();
[338] Fix | Delete
[339] Fix | Delete
if ( ! hideAndUncheckUserChangeCheckbox && otherLicenseKeyIsSelected ) {
[340] Fix | Delete
hideAndUncheckUserChangeCheckbox = ( licenseKey.length < 32 );
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
if ( licenseKey !== previousLicenseKey ) {
[344] Fix | Delete
// If the license key has not been changed, keep the owner ID in order to prevent another API call.
[345] Fix | Delete
otherLicenseOwnerID = null;
[346] Fix | Delete
}
[347] Fix | Delete
[348] Fix | Delete
if ( hideAndUncheckUserChangeCheckbox ) {
[349] Fix | Delete
$ownershipChangeOptionContainer.hide().find( 'input' ).attr( 'checked', false );
[350] Fix | Delete
[351] Fix | Delete
return;
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
if ( null !== otherLicenseOwnerID ) {
[355] Fix | Delete
afterLicenseUserDataLoaded();
[356] Fix | Delete
return;
[357] Fix | Delete
}
[358] Fix | Delete
[359] Fix | Delete
setLoadingMode();
[360] Fix | Delete
[361] Fix | Delete
$activateLicenseButton.addClass( 'fs-loading' );
[362] Fix | Delete
$activateLicenseButton.attr( 'disabled', 'disabled' );
[363] Fix | Delete
$activateLicenseButton.html( '<?php fs_esc_js_echo_inline( 'Please wait', 'please-wait', $slug ) ?>...' );
[364] Fix | Delete
[365] Fix | Delete
$.ajax( {
[366] Fix | Delete
url : <?php echo Freemius::ajax_url() ?>,
[367] Fix | Delete
method : 'POST',
[368] Fix | Delete
data : {
[369] Fix | Delete
action : '<?php echo $fs->get_ajax_action( 'fetch_is_marketing_required_flag_value' ) ?>',
[370] Fix | Delete
security : '<?php echo $fs->get_ajax_security( 'fetch_is_marketing_required_flag_value' ) ?>',
[371] Fix | Delete
license_key: licenseKey,
[372] Fix | Delete
module_id : '<?php echo $fs->get_id() ?>'
[373] Fix | Delete
},
[374] Fix | Delete
success: function ( result ) {
[375] Fix | Delete
resetLoadingMode();
[376] Fix | Delete
[377] Fix | Delete
if ( result.success ) {
[378] Fix | Delete
result = result.data;
[379] Fix | Delete
[380] Fix | Delete
// Cache license owner's ID.
[381] Fix | Delete
otherLicenseOwnerID = result.license_owner_id;
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
afterLicenseUserDataLoaded();
[385] Fix | Delete
}
[386] Fix | Delete
} );
[387] Fix | Delete
};
[388] Fix | Delete
[389] Fix | Delete
function registerEventHandlers() {
[390] Fix | Delete
var
[391] Fix | Delete
$otherLicenseKeyContainer = $modal.find( '.fs-other-license-key-container' );
[392] Fix | Delete
[393] Fix | Delete
if ( isNetworkActivation ) {
[394] Fix | Delete
$applyOnAllSites.click(function() {
[395] Fix | Delete
var applyOnAllSites = $( this ).is( ':checked' );
[396] Fix | Delete
[397] Fix | Delete
$multisiteOptionsContainer.toggleClass( 'fs-apply-on-all-sites', applyOnAllSites );
[398] Fix | Delete
[399] Fix | Delete
showSites( ! applyOnAllSites );
[400] Fix | Delete
[401] Fix | Delete
if ( hasValidLicenseKey() && ( applyOnAllSites || hasSelectedSite() ) ) {
[402] Fix | Delete
enableActivateLicenseButton();
[403] Fix | Delete
} else {
[404] Fix | Delete
disableActivateLicenseButton();
[405] Fix | Delete
}
[406] Fix | Delete
});
[407] Fix | Delete
[408] Fix | Delete
$sitesListContainer.delegate( 'td:not(:first-child)', 'click', function() {
[409] Fix | Delete
// If a site row is clicked, trigger a click on the checkbox.
[410] Fix | Delete
$( this ).parent().find( 'td:first-child input' ).click();
[411] Fix | Delete
});
[412] Fix | Delete
[413] Fix | Delete
$sitesListContainer.delegate( 'input[type="checkbox"]', 'click', function() {
[414] Fix | Delete
enableDisableSitesSelection();
[415] Fix | Delete
[416] Fix | Delete
if ( hasValidLicenseKey() && hasSelectedSite() ) {
[417] Fix | Delete
enableActivateLicenseButton();
[418] Fix | Delete
} else {
[419] Fix | Delete
disableActivateLicenseButton();
[420] Fix | Delete
}
[421] Fix | Delete
});
[422] Fix | Delete
}
[423] Fix | Delete
[424] Fix | Delete
if ( hasLicensesDropdown ) {
[425] Fix | Delete
$licensesDropdown.change(function() {
[426] Fix | Delete
// When a license is selected, select the associated radio button.
[427] Fix | Delete
$licenseTypes.filter( '[value="available"]' ).attr( 'checked', true );
[428] Fix | Delete
[429] Fix | Delete
if ( ! isNetworkActivation || $modal.hasClass( 'is-single-site-activation' ) ) {
[430] Fix | Delete
enableActivateLicenseButton();
[431] Fix | Delete
return true;
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
toggleActivationOnAllSites();
[435] Fix | Delete
})
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
if ( hasLicenseTypes ) {
[439] Fix | Delete
$licenseTypes.change(function() {
[440] Fix | Delete
var
[441] Fix | Delete
licenseKey = $modal.find( 'input.fs-license-key' ).val().trim(),
[442] Fix | Delete
otherLicenseKeySelected = isOtherLicenseKeySelected();
[443] Fix | Delete
[444] Fix | Delete
if ( ( licenseKey.length > 0 || ( hasLicenseTypes && ! otherLicenseKeySelected ) ) &&
[445] Fix | Delete
( $modal.hasClass( 'is-single-site-activation' ) || ! isNetworkActivation || hasSelectedSite() )
[446] Fix | Delete
) {
[447] Fix | Delete
/**
[448] Fix | Delete
* If the "other" license is not empty or an available license is selected, enable the activate
[449] Fix | Delete
* button.
[450] Fix | Delete
*
[451] Fix | Delete
* @author Leo Fajardo (@leorw)
[452] Fix | Delete
*/
[453] Fix | Delete
enableActivateLicenseButton();
[454] Fix | Delete
} else {
[455] Fix | Delete
disableActivateLicenseButton();
[456] Fix | Delete
}
[457] Fix | Delete
[458] Fix | Delete
if ( '' !== licenseKey ) {
[459] Fix | Delete
fetchLicenseUserData();
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
if ( ! isNetworkActivation ) {
[463] Fix | Delete
return;
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
if ( otherLicenseKeySelected ) {
[467] Fix | Delete
$applyOnAllSites.attr( 'disabled', false );
[468] Fix | Delete
enableDisableSitesSelection();
[469] Fix | Delete
resetActivateLicenseCheckboxLabel();
[470] Fix | Delete
} else if ( ! $modal.hasClass( 'is-single-site-activation' ) ) {
[471] Fix | Delete
toggleActivationOnAllSites();
[472] Fix | Delete
}
[473] Fix | Delete
});
[474] Fix | Delete
[475] Fix | Delete
if ( ! hasLicensesDropdown ) {
[476] Fix | Delete
$availableLicenseKey.click(function() {
[477] Fix | Delete
$licenseTypes.filter( '[value="available"]' ).click();
[478] Fix | Delete
});
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
$otherLicenseKeyContainer.click(function() {
[482] Fix | Delete
$licenseTypes.filter( '[value="other"]' ).click();
[483] Fix | Delete
});
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
$body.on( 'click', 'span.activate-license.<?php echo $unique_affix ?> a, .activate-license-trigger.<?php echo $unique_affix ?>', function (evt) {
[487] Fix | Delete
evt.preventDefault();
[488] Fix | Delete
[489] Fix | Delete
showModal( evt );
[490] Fix | Delete
});
[491] Fix | Delete
[492] Fix | Delete
var licenseTimeout = null;
[493] Fix | Delete
[494] Fix | Delete
/**
[495] Fix | Delete
* Disable activation button when license key is empty.
[496] Fix | Delete
*
[497] Fix | Delete
* @author Leo Fajardo (@leorw)
[498] Fix | Delete
* @since 2.3.2
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function