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/clone/wp-conte.../plugins/wordfenc.../modules/login-se.../views/manage
File: regenerate.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_LS_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* @var \WP_User $user The user being edited. Required.
[3] Fix | Delete
* @var int $remaining The number of unused recovery codes. Required.
[4] Fix | Delete
*/
[5] Fix | Delete
?>
[6] Fix | Delete
<div class="wfls-block wfls-always-active wfls-flex-item-full-width">
[7] Fix | Delete
<div class="wfls-block-header wfls-block-header-border-bottom">
[8] Fix | Delete
<div class="wfls-block-header-content">
[9] Fix | Delete
<div class="wfls-block-title">
[10] Fix | Delete
<strong><?php esc_html_e('Recovery Codes', 'wordfence'); ?></strong>
[11] Fix | Delete
</div>
[12] Fix | Delete
</div>
[13] Fix | Delete
</div>
[14] Fix | Delete
<div class="wfls-block-content wfls-padding-add-bottom">
[15] Fix | Delete
<p id="wfls-recovery-code-count"><?php echo esc_html(sprintf($remaining == 1 ? __('%d unused recovery code remains. You may generate a new set by clicking below.', 'wordfence') : __('%d unused recovery codes remain. You may generate a new set by clicking below.', 'wordfence'), $remaining)); ?></p>
[16] Fix | Delete
<p class="wfls-center wfls-add-top"><a href="#" class="wfls-btn wfls-btn-default" id="wfls-recovery" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Generate New Codes', 'wordfence'); ?></a></p>
[17] Fix | Delete
</div>
[18] Fix | Delete
</div>
[19] Fix | Delete
<script type="text/x-jquery-template" id="wfls-tmpl-recovery-prompt">
[20] Fix | Delete
<?php
[21] Fix | Delete
echo \WordfenceLS\Model_View::create('common/modal-prompt', array(
[22] Fix | Delete
'title' => __('Generate New Recovery Codes', 'wordfence'),
[23] Fix | Delete
'message' => __('Are you sure you want to generate new recovery codes? Any remaining unused codes will be disabled.', 'wordfence'),
[24] Fix | Delete
'primaryButton' => array('id' => 'wfls-recovery-prompt-cancel', 'label' => __('Cancel', 'wordfence'), 'link' => '#'),
[25] Fix | Delete
'secondaryButtons' => array(array('id' => 'wfls-recovery-prompt-confirm', 'label' => __('Generate', 'wordfence'), 'link' => '#')),
[26] Fix | Delete
))->render();
[27] Fix | Delete
?>
[28] Fix | Delete
</script>
[29] Fix | Delete
<script type="application/javascript">
[30] Fix | Delete
(function($) {
[31] Fix | Delete
$(function() {
[32] Fix | Delete
$('#wfls-recovery').on('click', function(e) {
[33] Fix | Delete
e.preventDefault();
[34] Fix | Delete
e.stopPropagation();
[35] Fix | Delete
[36] Fix | Delete
var prompt = $('#wfls-tmpl-recovery-prompt').tmpl({});
[37] Fix | Delete
var promptHTML = $("<div />").append(prompt).html();
[38] Fix | Delete
WFLS.panelHTML((WFLS.screenSize(500) ? '300px' : '400px'), promptHTML, {overlayClose: false, closeButton: false, className: 'wfls-modal', onComplete: function() {
[39] Fix | Delete
$('#wfls-recovery-prompt-cancel').on('click', function(e) {
[40] Fix | Delete
e.preventDefault();
[41] Fix | Delete
e.stopPropagation();
[42] Fix | Delete
[43] Fix | Delete
WFLS.panelClose();
[44] Fix | Delete
});
[45] Fix | Delete
[46] Fix | Delete
$('#wfls-recovery-prompt-confirm').on('click', function(e) {
[47] Fix | Delete
e.preventDefault();
[48] Fix | Delete
e.stopPropagation();
[49] Fix | Delete
[50] Fix | Delete
var payload = {
[51] Fix | Delete
user: <?php echo (int) $user->ID; ?>,
[52] Fix | Delete
};
[53] Fix | Delete
[54] Fix | Delete
WFLS.ajax(
[55] Fix | Delete
'wordfence_ls_regenerate',
[56] Fix | Delete
payload,
[57] Fix | Delete
function(response) {
[58] Fix | Delete
if (response.error) {
[59] Fix | Delete
WFLS.panelModal((WFLS.screenSize(500) ? '300px' : '400px'), '<?php echo esc_js(__('Error Generating New Codes', 'wordfence')); ?>', response.error);
[60] Fix | Delete
}
[61] Fix | Delete
else if (response.recovery) {
[62] Fix | Delete
$('#wfls-recovery-code-count').text(response.text);
[63] Fix | Delete
[64] Fix | Delete
var message = '<p><?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(sprintf(__('Use one of these %d codes to log in if you lose access to your authenticator device. Codes are %d characters long plus optional spaces. Each one may be used only once.', 'wordfence'), \WordfenceLS\Controller_Users::RECOVERY_CODE_COUNT, \WordfenceLS\Controller_Users::RECOVERY_CODE_SIZE * 2)); ?></p><ul class="wfls-recovery-codes">';
[65] Fix | Delete
[66] Fix | Delete
var recoveryCodeFileContents = '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(sprintf(__('Two-Factor Authentication Recovery Codes - %s (%s)', 'wordfence'), preg_replace('~^https?://~i', '', home_url()), $user->user_login)); ?>' + "\r\n";
[67] Fix | Delete
recoveryCodeFileContents = recoveryCodeFileContents + "\r\n" + '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(sprintf(__('Each line of %d letters and numbers is a single recovery code, with optional spaces for readability. To use a recovery code, after entering your username and password, enter the code like "1234 5678 90AB CDEF" at the 2FA prompt. If your site has a custom login prompt and does not show a 2FA prompt, you can use the single-step method by entering your password and the code together in the Password field, like "mypassword1234 5678 90AB CDEF". Your recovery codes are:', 'wordfence'), \WordfenceLS\Controller_Users::RECOVERY_CODE_SIZE * 2)); ?>' + "\r\n\r\n";
[68] Fix | Delete
for (var i = 0; i < response.recovery.length; i++) {
[69] Fix | Delete
message = message + '<li>' + response.recovery[i] + '</li>';
[70] Fix | Delete
recoveryCodeFileContents = recoveryCodeFileContents + response.recovery[i] + "\r\n";
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
message = message + "</ul>";
[74] Fix | Delete
[75] Fix | Delete
message = message + "<p class=\"wfls-center\"><a href=\"#\" class=\"wfls-btn wfls-btn-default\" id=\"wfls-recovery-new-download\" target=\"_blank\" rel=\"noopener noreferrer\"><i class=\"dashicons dashicons-download\"></i> <?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('Download', 'wordfence')); ?></a></p>";
[76] Fix | Delete
[77] Fix | Delete
[78] Fix | Delete
WFLS.panelModalHTML((WFLS.screenSize(500) ? '300px' : '400px'), "<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('New Recovery Codes', 'wordfence')); ?>", message, {onComplete: function() {
[79] Fix | Delete
$('#wfls-recovery-new-download').on('click', function(e) {
[80] Fix | Delete
e.preventDefault();
[81] Fix | Delete
e.stopPropagation();
[82] Fix | Delete
saveAs(new Blob([recoveryCodeFileContents], {type: "text/plain;charset=" + document.characterSet}), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(preg_replace('~^https?://~i', '', home_url()) . '_' . $user->user_login . '_recoverycodes.txt'); ?>');
[83] Fix | Delete
});
[84] Fix | Delete
}});
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
WFLS.panelClose(); //The prompt
[88] Fix | Delete
},
[89] Fix | Delete
function(error) {
[90] Fix | Delete
WFLS.panelModal((WFLS.screenSize(500) ? '300px' : '400px'), '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('Error Generating New Codes', 'wordfence')); ?>', '<?php echo \WordfenceLS\Text\Model_JavaScript::esc_js(__('An error was encountered while trying to generate new recovery codes. Please try again.', 'wordfence')); ?>');
[91] Fix | Delete
WFLS.panelClose(); //The prompt
[92] Fix | Delete
}
[93] Fix | Delete
);
[94] Fix | Delete
});
[95] Fix | Delete
}});
[96] Fix | Delete
});
[97] Fix | Delete
});
[98] Fix | Delete
})(jQuery);
[99] Fix | Delete
</script>
[100] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function