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: user-change.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 2.3.2
[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
[19] Fix | Delete
/**
[20] Fix | Delete
* @var object[] $license_owners
[21] Fix | Delete
*/
[22] Fix | Delete
$license_owners = $VARS['license_owners'];
[23] Fix | Delete
[24] Fix | Delete
$change_user_message = fs_text_inline( 'By changing the user, you agree to transfer the account ownership to:', 'change-user--message', $slug );
[25] Fix | Delete
$header_title = fs_text_inline( 'Change User', 'change-user', $slug );
[26] Fix | Delete
$user_change_button_text = fs_text_inline( 'I Agree - Change User', 'agree-change-user', $slug );
[27] Fix | Delete
$other_text = fs_text_inline( 'Other', 'other', $slug );
[28] Fix | Delete
$enter_email_address_placeholder_text = fs_text_inline( 'Enter email address', 'enter-email-address', $slug );
[29] Fix | Delete
[30] Fix | Delete
$user_change_options_html = <<< HTML
[31] Fix | Delete
<div class="fs-user-change-options-container">
[32] Fix | Delete
<table>
[33] Fix | Delete
<tbody>
[34] Fix | Delete
HTML;
[35] Fix | Delete
[36] Fix | Delete
foreach ( $license_owners as $license_owner ) {
[37] Fix | Delete
$user_change_options_html .= <<< HTML
[38] Fix | Delete
<tr class="fs-email-address-container">
[39] Fix | Delete
<td><input id="fs_email_address_{$license_owner->id}" type="radio" name="fs_email_address" value="{$license_owner->id}"></td>
[40] Fix | Delete
<td><label for="fs_email_address_{$license_owner->id}">{$license_owner->email}</label></td>
[41] Fix | Delete
</tr>
[42] Fix | Delete
HTML;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
$user_change_options_html .= <<< HTML
[46] Fix | Delete
<tr>
[47] Fix | Delete
<td><input id="fs_other_email_address_radio" type="radio" name="fs_email_address" value="other"></td>
[48] Fix | Delete
<td class="fs-other-email-address-container">
[49] Fix | Delete
<div>
[50] Fix | Delete
<label for="fs_email_address">{$other_text}: </label>
[51] Fix | Delete
<div>
[52] Fix | Delete
<input id="fs_other_email_address_text_field" class="fs-email-address" type="text" placeholder="{$enter_email_address_placeholder_text}" tabindex="1">
[53] Fix | Delete
</div>
[54] Fix | Delete
</div>
[55] Fix | Delete
</td>
[56] Fix | Delete
</tr>
[57] Fix | Delete
</tbody>
[58] Fix | Delete
</table>
[59] Fix | Delete
</div>
[60] Fix | Delete
HTML;
[61] Fix | Delete
[62] Fix | Delete
$modal_content_html = <<< HTML
[63] Fix | Delete
<div class="notice notice-error inline fs-change-user-result-message"><p></p></div>
[64] Fix | Delete
<p>{$change_user_message}</p>
[65] Fix | Delete
{$user_change_options_html}
[66] Fix | Delete
HTML;
[67] Fix | Delete
[68] Fix | Delete
fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
[69] Fix | Delete
?>
[70] Fix | Delete
<script type="text/javascript">
[71] Fix | Delete
(function( $ ) {
[72] Fix | Delete
$( document ).ready(function() {
[73] Fix | Delete
var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
[74] Fix | Delete
modalHtml =
[75] Fix | Delete
'<div class="fs-modal fs-modal-change-user fs-modal-change-user-<?php echo $fs->get_unique_affix() ?>">'
[76] Fix | Delete
+ ' <div class="fs-modal-dialog">'
[77] Fix | Delete
+ ' <div class="fs-modal-header">'
[78] Fix | Delete
+ ' <h4><?php echo esc_js( $header_title ) ?></h4>'
[79] Fix | Delete
+ ' <a href="!#" class="fs-close"><i class="dashicons dashicons-no" title="<?php echo esc_js( fs_text_x_inline( 'Dismiss', 'close window', 'dismiss', $slug ) ) ?>"></i></a>'
[80] Fix | Delete
+ ' </div>'
[81] Fix | Delete
+ ' <div class="fs-modal-body">'
[82] Fix | Delete
+ ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
[83] Fix | Delete
+ ' </div>'
[84] Fix | Delete
+ ' <div class="fs-modal-footer">'
[85] Fix | Delete
+ ' <button class="button button-secondary button-close" tabindex="4"><?php fs_esc_js_echo_inline( 'Cancel', 'cancel', $slug ) ?></button>'
[86] Fix | Delete
+ ' <button class="button button-primary fs-user-change-button" tabindex="3"><?php echo esc_js( $user_change_button_text ) ?></button>'
[87] Fix | Delete
+ ' </div>'
[88] Fix | Delete
+ ' </div>'
[89] Fix | Delete
+ '</div>',
[90] Fix | Delete
$modal = $( modalHtml ),
[91] Fix | Delete
$userChangeButton = $modal.find( '.fs-user-change-button' ),
[92] Fix | Delete
$otherEmailAddressRadio = $modal.find( '#fs_other_email_address_radio' ),
[93] Fix | Delete
$changeUserResultMessage = $modal.find( '.fs-change-user-result-message' ),
[94] Fix | Delete
$otherEmailAddressContainer = $modal.find( '.fs-other-email-address-container' ),
[95] Fix | Delete
$otherEmailAddressTextField = $modal.find( '#fs_other_email_address_text_field' ),
[96] Fix | Delete
$licenseOwners = $modal.find( 'input[type="radio"][name="fs_email_address"]' );
[97] Fix | Delete
[98] Fix | Delete
$modal.appendTo( $( 'body' ) );
[99] Fix | Delete
[100] Fix | Delete
var previousEmailAddress = null;
[101] Fix | Delete
[102] Fix | Delete
function registerEventHandlers() {
[103] Fix | Delete
$licenseOwners.change( function() {
[104] Fix | Delete
var otherEmailAddress = $otherEmailAddressTextField.val().trim(),
[105] Fix | Delete
otherEmailAddressIsSelected = isOtherEmailAddressSelected();
[106] Fix | Delete
[107] Fix | Delete
if ( otherEmailAddressIsSelected ) {
[108] Fix | Delete
$otherEmailAddressTextField.focus();
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
if ( otherEmailAddress.length > 0 || ! otherEmailAddressIsSelected ) {
[112] Fix | Delete
enableUserChangeButton();
[113] Fix | Delete
} else {
[114] Fix | Delete
disableUserChangeButton();
[115] Fix | Delete
}
[116] Fix | Delete
} );
[117] Fix | Delete
[118] Fix | Delete
$otherEmailAddressContainer.click( function () {
[119] Fix | Delete
$otherEmailAddressRadio.click();
[120] Fix | Delete
} );
[121] Fix | Delete
[122] Fix | Delete
// Handle for the "Change User" button on the "Account" page.
[123] Fix | Delete
$( '#fs_change_user' ).click( function ( evt ) {
[124] Fix | Delete
evt.preventDefault();
[125] Fix | Delete
[126] Fix | Delete
showModal( evt );
[127] Fix | Delete
} );
[128] Fix | Delete
[129] Fix | Delete
/**
[130] Fix | Delete
* Disables the "Change User" button when the email address is empty.
[131] Fix | Delete
*/
[132] Fix | Delete
$modal.on( 'keyup paste delete cut', 'input#fs_other_email_address_text_field', function () {
[133] Fix | Delete
setTimeout( function () {
[134] Fix | Delete
var emailAddress = $otherEmailAddressRadio.val().trim();
[135] Fix | Delete
[136] Fix | Delete
if ( emailAddress === previousEmailAddress ) {
[137] Fix | Delete
return;
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
if ( '' === emailAddress ) {
[141] Fix | Delete
disableUserChangeButton();
[142] Fix | Delete
} else {
[143] Fix | Delete
enableUserChangeButton();
[144] Fix | Delete
}
[145] Fix | Delete
[146] Fix | Delete
previousEmailAddress = emailAddress;
[147] Fix | Delete
}, 100 );
[148] Fix | Delete
} ).focus();
[149] Fix | Delete
[150] Fix | Delete
$modal.on( 'input propertychange', 'input#fs_other_email_address_text_field', function () {
[151] Fix | Delete
var emailAddress = $( this ).val().trim();
[152] Fix | Delete
[153] Fix | Delete
/**
[154] Fix | Delete
* If email address is not empty, enable the "Change User" button.
[155] Fix | Delete
*/
[156] Fix | Delete
if ( emailAddress.length > 0 ) {
[157] Fix | Delete
enableUserChangeButton();
[158] Fix | Delete
}
[159] Fix | Delete
} );
[160] Fix | Delete
[161] Fix | Delete
$modal.on( 'blur', 'input#fs_other_email_address_text_field', function( evt ) {
[162] Fix | Delete
var emailAddress = $( this ).val().trim();
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* If email address is empty, disable the "Change User" button.
[166] Fix | Delete
*/
[167] Fix | Delete
if ( 0 === emailAddress.length ) {
[168] Fix | Delete
disableUserChangeButton();
[169] Fix | Delete
}
[170] Fix | Delete
} );
[171] Fix | Delete
[172] Fix | Delete
$modal.on( 'click', '.fs-user-change-button', function ( evt ) {
[173] Fix | Delete
evt.preventDefault();
[174] Fix | Delete
[175] Fix | Delete
if ( $( this ).hasClass( 'disabled' ) ) {
[176] Fix | Delete
return;
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
var emailAddress = '',
[180] Fix | Delete
licenseOwnerID = null;
[181] Fix | Delete
[182] Fix | Delete
if ( ! isOtherEmailAddressSelected() ) {
[183] Fix | Delete
licenseOwnerID = $licenseOwners.filter( ':checked' ).val();
[184] Fix | Delete
} else {
[185] Fix | Delete
emailAddress = $otherEmailAddressTextField.val().trim();
[186] Fix | Delete
[187] Fix | Delete
if ( 0 === emailAddress.length ) {
[188] Fix | Delete
return;
[189] Fix | Delete
}
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
disableUserChangeButton();
[193] Fix | Delete
[194] Fix | Delete
$.ajax( {
[195] Fix | Delete
url : <?php echo Freemius::ajax_url() ?>,
[196] Fix | Delete
method : 'POST',
[197] Fix | Delete
data : {
[198] Fix | Delete
action : '<?php echo $fs->get_ajax_action( 'change_user' ) ?>',
[199] Fix | Delete
security : '<?php echo $fs->get_ajax_security( 'change_user' ) ?>',
[200] Fix | Delete
email_address: emailAddress,
[201] Fix | Delete
user_id : licenseOwnerID,
[202] Fix | Delete
module_id : '<?php echo $fs->get_id() ?>'
[203] Fix | Delete
},
[204] Fix | Delete
beforeSend: function () {
[205] Fix | Delete
$userChangeButton
[206] Fix | Delete
.text( '<?php fs_esc_js_echo_inline( 'Changing user, please wait', 'changing-user-please-wait', $slug ) ?>...' )
[207] Fix | Delete
.prepend('<i class="fs-ajax-spinner"></i>');
[208] Fix | Delete
[209] Fix | Delete
$(document.body).css({'cursor': 'wait'});
[210] Fix | Delete
},
[211] Fix | Delete
success : function( result ) {
[212] Fix | Delete
if ( result.success ) {
[213] Fix | Delete
// Redirect to the "Account" page.
[214] Fix | Delete
window.location.reload();
[215] Fix | Delete
} else {
[216] Fix | Delete
$(document.body).css({'cursor': 'auto'});
[217] Fix | Delete
[218] Fix | Delete
showError( result.error.message ? result.error.message : result.error );
[219] Fix | Delete
resetUserChangeButton();
[220] Fix | Delete
}
[221] Fix | Delete
},
[222] Fix | Delete
error : function () {
[223] Fix | Delete
$(document.body).css({'cursor': 'auto'});
[224] Fix | Delete
[225] Fix | Delete
showError( '<?php fs_esc_js_echo_inline( 'Unexpected error, try again in 5 minutes. If the error persists, please contact support.', 'unexpected-error', $slug ) ?>' );
[226] Fix | Delete
[227] Fix | Delete
resetUserChangeButton();
[228] Fix | Delete
}
[229] Fix | Delete
} );
[230] Fix | Delete
} );
[231] Fix | Delete
[232] Fix | Delete
// If the user has clicked outside the window, close the modal.
[233] Fix | Delete
$modal.on( 'click', '.fs-close, .button-secondary', function () {
[234] Fix | Delete
closeModal();
[235] Fix | Delete
return false;
[236] Fix | Delete
} );
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
registerEventHandlers();
[240] Fix | Delete
[241] Fix | Delete
/**
[242] Fix | Delete
* @returns {Boolean}
[243] Fix | Delete
*/
[244] Fix | Delete
function isOtherEmailAddressSelected() {
[245] Fix | Delete
return ( 'other' === $licenseOwners.filter( ':checked' ).val() );
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
function showModal() {
[249] Fix | Delete
resetModal();
[250] Fix | Delete
[251] Fix | Delete
// Display the dialog box.
[252] Fix | Delete
$modal.addClass( 'active' );
[253] Fix | Delete
$( 'body' ).addClass( 'has-fs-modal' );
[254] Fix | Delete
[255] Fix | Delete
// Select the first radio button.
[256] Fix | Delete
$licenseOwners.get( 0 ).click();
[257] Fix | Delete
[258] Fix | Delete
$otherEmailAddressTextField.val( '' );
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
function closeModal() {
[262] Fix | Delete
$modal.removeClass( 'active' );
[263] Fix | Delete
$( 'body' ).removeClass( 'has-fs-modal' );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
function resetUserChangeButton() {
[267] Fix | Delete
enableUserChangeButton();
[268] Fix | Delete
$userChangeButton.text( <?php echo json_encode( $user_change_button_text ) ?> );
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
function resetModal() {
[272] Fix | Delete
hideError();
[273] Fix | Delete
resetUserChangeButton();
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
function enableUserChangeButton() {
[277] Fix | Delete
$userChangeButton.removeClass( 'disabled' );
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
function disableUserChangeButton() {
[281] Fix | Delete
$userChangeButton.addClass( 'disabled' );
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
function hideError() {
[285] Fix | Delete
$changeUserResultMessage.hide();
[286] Fix | Delete
}
[287] Fix | Delete
[288] Fix | Delete
function showError( msg ) {
[289] Fix | Delete
$changeUserResultMessage.find( ' > p' ).html( msg );
[290] Fix | Delete
$changeUserResultMessage.show();
[291] Fix | Delete
}
[292] Fix | Delete
});
[293] Fix | Delete
})( jQuery );
[294] Fix | Delete
</script>
[295] Fix | Delete
[296] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function