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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib
File: wordfenceClass.php
[6500] Fix | Delete
echo '<div id="wafConfigNeedsFixedNotice" class="fade error"><p><strong>' . __('The Wordfence Web Application Firewall needs a configuration update.', 'wordfence') . '</strong> ' .
[6501] Fix | Delete
sprintf(
[6502] Fix | Delete
/* translators: 1. WordPress admin panel URL. 2. Support URL. */
[6503] Fix | Delete
__('It is not currently in extended protection mode but was configured to use an older version of PHP and may have become deactivated when PHP was updated. You may perform the configuration update automatically by <a href="%1$s">clicking here</a> or use the "Optimize the Wordfence Firewall" button on the Firewall Options page. <a class="wfhelp" target="_blank" rel="noopener noreferrer" href="%2$s"><span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a>', 'wordfence'),
[6504] Fix | Delete
$wafMenuURL,
[6505] Fix | Delete
wfSupportController::esc_supportURL(wfSupportController::ITEM_NOTICE_WAF_MOD_PHP_FIX)
[6506] Fix | Delete
) . '</p></div>';
[6507] Fix | Delete
}
[6508] Fix | Delete
public static function wafReadOnlyNotice() {
[6509] Fix | Delete
echo '<div id="wordfenceWAFReadOnlyNotice" class="fade error"><p><strong>' . __('The Wordfence Web Application Firewall is in read-only mode.', 'wordfence') . '</strong> ' . sprintf('PHP is currently running as a command line user and to avoid file permission issues, the WAF is running in read-only mode. It will automatically resume normal operation when run normally by a web server. <a class="wfhelp" target="_blank" rel="noopener noreferrer" href="%s"><span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a>', wfSupportController::esc_supportURL(wfSupportController::ITEM_NOTICE_WAF_READ_ONLY_WARNING)) . '</p></div>';
[6510] Fix | Delete
}
[6511] Fix | Delete
public static function misconfiguredHowGetIPsNotice() {
[6512] Fix | Delete
$url = network_admin_url('admin.php?page=Wordfence&subpage=global_options');
[6513] Fix | Delete
$existing = wfConfig::get('howGetIPs', '');
[6514] Fix | Delete
$recommendation = wfConfig::get('detectProxyRecommendation', '');
[6515] Fix | Delete
[6516] Fix | Delete
$existingMsg = '';
[6517] Fix | Delete
if ($existing == 'REMOTE_ADDR') {
[6518] Fix | Delete
$existingMsg = __('This site is currently using PHP\'s built in REMOTE_ADDR.', 'wordfence');
[6519] Fix | Delete
}
[6520] Fix | Delete
else if ($existing == 'HTTP_X_FORWARDED_FOR') {
[6521] Fix | Delete
$existingMsg = __('This site is currently using the X-Forwarded-For HTTP header, which should only be used when the site is behind a front-end proxy that outputs this header.', 'wordfence');
[6522] Fix | Delete
}
[6523] Fix | Delete
else if ($existing == 'HTTP_X_REAL_IP') {
[6524] Fix | Delete
$existingMsg = __('This site is currently using the X-Real-IP HTTP header, which should only be used when the site is behind a front-end proxy that outputs this header.', 'wordfence');
[6525] Fix | Delete
}
[6526] Fix | Delete
else if ($existing == 'HTTP_CF_CONNECTING_IP') {
[6527] Fix | Delete
$existingMsg = __('This site is currently using the Cloudflare "CF-Connecting-IP" HTTP header, which should only be used when the site is behind Cloudflare.', 'wordfence');
[6528] Fix | Delete
}
[6529] Fix | Delete
[6530] Fix | Delete
$recommendationMsg = '';
[6531] Fix | Delete
if ($recommendation == 'REMOTE_ADDR') {
[6532] Fix | Delete
$recommendationMsg = __('For maximum security use PHP\'s built in REMOTE_ADDR.', 'wordfence');
[6533] Fix | Delete
}
[6534] Fix | Delete
else if ($recommendation == 'HTTP_X_FORWARDED_FOR') {
[6535] Fix | Delete
$recommendationMsg = __('This site appears to be behind a front-end proxy, so using the X-Forwarded-For HTTP header will resolve to the correct IPs.', 'wordfence');
[6536] Fix | Delete
}
[6537] Fix | Delete
else if ($recommendation == 'HTTP_X_REAL_IP') {
[6538] Fix | Delete
$recommendationMsg = __('This site appears to be behind a front-end proxy, so using the X-Real-IP HTTP header will resolve to the correct IPs.', 'wordfence');
[6539] Fix | Delete
}
[6540] Fix | Delete
else if ($recommendation == 'HTTP_CF_CONNECTING_IP') {
[6541] Fix | Delete
$recommendationMsg = __('This site appears to be behind Cloudflare, so using the Cloudflare "CF-Connecting-IP" HTTP header will resolve to the correct IPs.', 'wordfence');
[6542] Fix | Delete
}
[6543] Fix | Delete
echo '<div id="wordfenceMisconfiguredHowGetIPsNotice" class="fade error"><p><strong>' .
[6544] Fix | Delete
__('Your \'How does Wordfence get IPs\' setting is misconfigured.', 'wordfence')
[6545] Fix | Delete
. '</strong> ' . $existingMsg . ' ' . $recommendationMsg . ' <a href="#" onclick="wordfenceExt.misconfiguredHowGetIPsChoice(\'yes\'); return false;" role="button">' .
[6546] Fix | Delete
__('Click here to use the recommended setting', 'wordfence')
[6547] Fix | Delete
. '</a> ' .
[6548] Fix | Delete
__('or', 'wordfence')
[6549] Fix | Delete
. ' <a href="' . $url . '">' .
[6550] Fix | Delete
__('visit the options page', 'wordfence')
[6551] Fix | Delete
. '</a> ' .
[6552] Fix | Delete
__('to manually update it.', 'wordfence')
[6553] Fix | Delete
. '</p><p>
[6554] Fix | Delete
<a class="wf-btn wf-btn-default wf-btn-sm wf-dismiss-link" href="#" onclick="wordfenceExt.misconfiguredHowGetIPsChoice(\'no\'); return false;" role="button">' .
[6555] Fix | Delete
__('Dismiss', 'wordfence')
[6556] Fix | Delete
. '</a> <a class="wfhelp" target="_blank" rel="noopener noreferrer" href="' . wfSupportController::esc_supportURL(wfSupportController::ITEM_NOTICE_MISCONFIGURED_HOW_GET_IPS) . '"><span class="screen-reader-text"> (' . esc_html__('opens in new tab', 'wordfence') . ')</span></a></p></div>';
[6557] Fix | Delete
}
[6558] Fix | Delete
public static function autoUpdateNotice(){
[6559] Fix | Delete
echo '<div id="wordfenceAutoUpdateChoice" class="fade error"><p><strong>' .
[6560] Fix | Delete
__('Do you want Wordfence to stay up-to-date automatically?', 'wordfence')
[6561] Fix | Delete
. '</strong>&nbsp;&nbsp;&nbsp;<a href="#" onclick="wordfenceExt.autoUpdateChoice(\'yes\'); return false;" role="button">'.
[6562] Fix | Delete
__('Yes, enable auto-update.', 'wordfence')
[6563] Fix | Delete
. '</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="wordfenceExt.autoUpdateChoice(\'no\'); return false;" role="button">' .
[6564] Fix | Delete
__('No thanks.', 'wordfence')
[6565] Fix | Delete
. '</a></p></div>';
[6566] Fix | Delete
}
[6567] Fix | Delete
private static function getNoticeHideKey($id) {
[6568] Fix | Delete
return "wordfence_dismiss_$id";
[6569] Fix | Delete
}
[6570] Fix | Delete
private static function hideNoticeForUser($id) {
[6571] Fix | Delete
$user = get_current_user_id();
[6572] Fix | Delete
if ($user !== 0)
[6573] Fix | Delete
update_user_meta($user, self::getNoticeHideKey($id), true);
[6574] Fix | Delete
}
[6575] Fix | Delete
private static function hasHiddenNotice($id) {
[6576] Fix | Delete
$user = get_current_user_id();
[6577] Fix | Delete
if ($user !== 0)
[6578] Fix | Delete
return get_user_meta($user, self::getNoticeHideKey($id), true);
[6579] Fix | Delete
return false;
[6580] Fix | Delete
}
[6581] Fix | Delete
public static function showUnitedStatesBlockedNotice() {
[6582] Fix | Delete
$id = "wordfenceUnitedStatesBlocked";
[6583] Fix | Delete
if (self::hasHiddenNotice($id))
[6584] Fix | Delete
return;
[6585] Fix | Delete
?>
[6586] Fix | Delete
<div id="<?php echo esc_attr($id) ?>" class="notice notice-warning">
[6587] Fix | Delete
<p>
[6588] Fix | Delete
<?php esc_html_e('Wordfence country blocking is currently set to block the United States. We recommend allowing access from the United States for Google and other benign crawlers, unless you choose to only block the login page.', 'wordfence') ?>
[6589] Fix | Delete
<a target="_blank" rel="noopener noreferrer" href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_BLOCKING_FULL_SITE) ?>"><?php esc_html_e('Learn More', 'wordfence') ?></a>
[6590] Fix | Delete
<a class="wf-btn wf-btn-default wf-btn-sm wf-dismiss-link" href="#" onclick="<?php echo esc_attr('wordfenceExt.hideNoticeForUser(' . json_encode($id) . '); return false;') ?>"><?php esc_html_e('Dismiss', 'wordfence') ?></a>
[6591] Fix | Delete
</p>
[6592] Fix | Delete
</div>
[6593] Fix | Delete
<?php
[6594] Fix | Delete
}
[6595] Fix | Delete
public static function isWordfenceAdminPage() {
[6596] Fix | Delete
if (isset($_GET['page']) && is_string($_GET['page'])) {
[6597] Fix | Delete
foreach (array('Wordfence', 'WFLS') as $prefix) {
[6598] Fix | Delete
if (strpos($_GET['page'], $prefix) === 0)
[6599] Fix | Delete
return true;
[6600] Fix | Delete
}
[6601] Fix | Delete
}
[6602] Fix | Delete
return false;
[6603] Fix | Delete
}
[6604] Fix | Delete
public static function getDashboardNotificationCountIcon() {
[6605] Fix | Delete
$notificationCount = count(wfNotification::notifications());
[6606] Fix | Delete
$updatingNotifications = get_site_transient('wordfence_updating_notifications');
[6607] Fix | Delete
$hidden = ($notificationCount == 0 || $updatingNotifications ? ' wf-hidden' : '');
[6608] Fix | Delete
$formattedCount = number_format_i18n($notificationCount);
[6609] Fix | Delete
return " <span class=\"update-plugins wf-menu-badge wf-notification-count-container{$hidden}\" title=\"" . esc_attr($formattedCount) . '"><span class="update-count wf-notification-count-value">' . esc_html($formattedCount) . '</span></span>';
[6610] Fix | Delete
}
[6611] Fix | Delete
[6612] Fix | Delete
public static function isWordfenceInstallPage() {
[6613] Fix | Delete
return self::isPage('WordfenceInstall');
[6614] Fix | Delete
}
[6615] Fix | Delete
[6616] Fix | Delete
public static function isWordfenceSupportPage() {
[6617] Fix | Delete
return self::isPage('WordfenceSupport');
[6618] Fix | Delete
}
[6619] Fix | Delete
[6620] Fix | Delete
public static function admin_menus(){
[6621] Fix | Delete
if(! wfUtils::isAdmin()){ return; }
[6622] Fix | Delete
$warningAdded = self::isWordfenceInstallPage();
[6623] Fix | Delete
if(get_option('wf_plugin_act_error', false)){
[6624] Fix | Delete
if(wfUtils::isAdminPageMU()){
[6625] Fix | Delete
add_action('network_admin_notices', 'wordfence::activation_warning');
[6626] Fix | Delete
} else {
[6627] Fix | Delete
add_action('admin_notices', 'wordfence::activation_warning');
[6628] Fix | Delete
}
[6629] Fix | Delete
$warningAdded = true;
[6630] Fix | Delete
}
[6631] Fix | Delete
if(!wfConfig::get('apiKey') && !wfOnboardingController::shouldShowAnyAttempt()){
[6632] Fix | Delete
if(wfUtils::isAdminPageMU()){
[6633] Fix | Delete
add_action('network_admin_notices', 'wordfence::noKeyError');
[6634] Fix | Delete
} else {
[6635] Fix | Delete
add_action('admin_notices', 'wordfence::noKeyError');
[6636] Fix | Delete
}
[6637] Fix | Delete
$warningAdded = true;
[6638] Fix | Delete
}
[6639] Fix | Delete
[6640] Fix | Delete
$firewall = new wfFirewall();
[6641] Fix | Delete
if (!empty($_GET['page']) && preg_match('/^Wordfence/i', $_GET['page'])) {
[6642] Fix | Delete
if (!$firewall->testConfig()) {
[6643] Fix | Delete
$warningAdded = true;
[6644] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6645] Fix | Delete
add_action('network_admin_notices', 'wordfence::wafConfigInaccessibleNotice');
[6646] Fix | Delete
}
[6647] Fix | Delete
else {
[6648] Fix | Delete
add_action('admin_notices', 'wordfence::wafConfigInaccessibleNotice');
[6649] Fix | Delete
}
[6650] Fix | Delete
}
[6651] Fix | Delete
else if (!$warningAdded && method_exists('wfWAF', 'hasFallbackStorageEngine') && wfWAF::hasFallbackStorageEngine()) {
[6652] Fix | Delete
$warningAdded = true;
[6653] Fix | Delete
add_action(wfUtils::isAdminPageMU()?'network_admin_notices':'admin_notices', 'wordfence::wafStorageEngineFallbackNotice');
[6654] Fix | Delete
}
[6655] Fix | Delete
}
[6656] Fix | Delete
[6657] Fix | Delete
if (!$warningAdded && !WFWAF_SUBDIRECTORY_INSTALL && !wfWAFAutoPrependHelper::verifyHtaccessMod_php()) {
[6658] Fix | Delete
if (WFWAF_AUTO_PREPEND) { //Active, running PHP 5 only mod_php block
[6659] Fix | Delete
$warningAdded = true;
[6660] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6661] Fix | Delete
add_action('network_admin_notices', 'wordfence::wafConfigNeedsUpdate_mod_php');
[6662] Fix | Delete
}
[6663] Fix | Delete
else {
[6664] Fix | Delete
add_action('admin_notices', 'wordfence::wafConfigNeedsUpdate_mod_php');
[6665] Fix | Delete
}
[6666] Fix | Delete
}
[6667] Fix | Delete
else if (PHP_MAJOR_VERSION > 5) { //Inactive, probably deactivated by updating from PHP 5 -> 7 due to no PHP 7 mod_php block
[6668] Fix | Delete
$warningAdded = true;
[6669] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6670] Fix | Delete
add_action('network_admin_notices', 'wordfence::wafConfigNeedsFixed_mod_php');
[6671] Fix | Delete
}
[6672] Fix | Delete
else {
[6673] Fix | Delete
add_action('admin_notices', 'wordfence::wafConfigNeedsFixed_mod_php');
[6674] Fix | Delete
}
[6675] Fix | Delete
}
[6676] Fix | Delete
}
[6677] Fix | Delete
[6678] Fix | Delete
if (wfOnboardingController::shouldShowAttempt3() || wfConfig::get('touppPromptNeeded')) { //Both top banners
[6679] Fix | Delete
$warningAdded = true;
[6680] Fix | Delete
}
[6681] Fix | Delete
[6682] Fix | Delete
//Check WAF rules status
[6683] Fix | Delete
$firewall = new wfFirewall();
[6684] Fix | Delete
if ($firewall->firewallMode() != wfFirewall::FIREWALL_MODE_DISABLED) {
[6685] Fix | Delete
try {
[6686] Fix | Delete
$lastChecked = (int) wfWAF::getInstance()->getStorageEngine()->getConfig('lastRuleUpdateCheck', null, 'transient');
[6687] Fix | Delete
$lastUpdated = (int) wfWAF::getInstance()->getStorageEngine()->getConfig('rulesLastUpdated', null, 'transient');
[6688] Fix | Delete
$threshold = time() - (86400 * (wfConfig::get('isPaid') ? 2.5 : 9)); //Refresh rate + 2 days
[6689] Fix | Delete
if ($lastChecked > 0 && $lastUpdated > 0 && $lastChecked < $threshold) {
[6690] Fix | Delete
$nextUpdate = PHP_INT_MAX;
[6691] Fix | Delete
$cron = (array) wfWAF::getInstance()->getStorageEngine()->getConfig('cron', null, 'livewaf');
[6692] Fix | Delete
if (is_array($cron)) {
[6693] Fix | Delete
/** @var wfWAFCronEvent $event */
[6694] Fix | Delete
foreach ($cron as $index => $event) {
[6695] Fix | Delete
if ($event instanceof wfWAFCronFetchRulesEvent) {
[6696] Fix | Delete
$event->setWaf(wfWAF::getInstance());
[6697] Fix | Delete
if (!$event->isInPast()) {
[6698] Fix | Delete
$nextUpdate = min($nextUpdate, $event->getFireTime());
[6699] Fix | Delete
}
[6700] Fix | Delete
}
[6701] Fix | Delete
}
[6702] Fix | Delete
}
[6703] Fix | Delete
[6704] Fix | Delete
$message = sprintf(
[6705] Fix | Delete
/* translators: Localized date. */
[6706] Fix | Delete
__('The last rules update for the Wordfence Web Application Firewall was unsuccessful. The last successful update check was %s, so this site may be missing new rules added since then.', 'wordfence'),
[6707] Fix | Delete
wfUtils::formatLocalTime(get_option('date_format') . ' ' . get_option('time_format'), $lastChecked)
[6708] Fix | Delete
);
[6709] Fix | Delete
[6710] Fix | Delete
if (!$firewall->isSubDirectoryInstallation()) {
[6711] Fix | Delete
if ($nextUpdate < PHP_INT_MAX) {
[6712] Fix | Delete
$message .= ' ' . sprintf(
[6713] Fix | Delete
/* translators: 1. Localized date. 2. WordPress admin panel URL. */
[6714] Fix | Delete
__('You may wait for the next automatic attempt at %1$s or try to <a href="%2$s">Manually Update</a> by clicking the "Manually Refresh Rules" button below the Rules list.', 'wordfence'),
[6715] Fix | Delete
wfUtils::formatLocalTime(get_option('date_format') . ' ' . get_option('time_format'), $nextUpdate),
[6716] Fix | Delete
esc_url(network_admin_url('admin.php?page=WordfenceWAF&subpage=waf_options#wf-option-wafRules'))
[6717] Fix | Delete
);
[6718] Fix | Delete
}
[6719] Fix | Delete
else {
[6720] Fix | Delete
$message .= ' ' . sprintf(/* translators: WordPress admin panel URL. */ __('You may wait for the next automatic attempt or try to <a href="%s">Manually Update</a> by clicking the "Manually Refresh Rules" button below the Rules list.', 'wordfence'), esc_url(network_admin_url('admin.php?page=WordfenceWAF&subpage=waf_options#waf-rules-next-update')));
[6721] Fix | Delete
}
[6722] Fix | Delete
}
[6723] Fix | Delete
else {
[6724] Fix | Delete
if ($nextUpdate < PHP_INT_MAX) {
[6725] Fix | Delete
$message .= ' ' . sprintf(/* translators: WordPress admin panel URL. */ __('You may wait for the next automatic attempt at %s or log into the parent site to manually update by clicking the "Manually Refresh Rules" button below the Rules list.', 'wordfence'), wfUtils::formatLocalTime(get_option('date_format') . ' ' . get_option('time_format'), $nextUpdate));
[6726] Fix | Delete
}
[6727] Fix | Delete
else {
[6728] Fix | Delete
$message .= ' ' . __('You may wait for the next automatic attempt or log into the parent site to manually update by clicking the "Manually Refresh Rules" button below the Rules list.', 'wordfence');
[6729] Fix | Delete
}
[6730] Fix | Delete
}
[6731] Fix | Delete
[6732] Fix | Delete
wfAdminNoticeQueue::addAdminNotice(wfAdminNotice::SEVERITY_CRITICAL, $message, 'waf-rules-failed');
[6733] Fix | Delete
}
[6734] Fix | Delete
else {
[6735] Fix | Delete
wfAdminNoticeQueue::removeAdminNotice(false, 'waf-rules-failed');
[6736] Fix | Delete
}
[6737] Fix | Delete
}
[6738] Fix | Delete
catch (wfWAFStorageFileException $e) {
[6739] Fix | Delete
error_log($e->getMessage());
[6740] Fix | Delete
}
[6741] Fix | Delete
}
[6742] Fix | Delete
else {
[6743] Fix | Delete
wfAdminNoticeQueue::removeAdminNotice(false, 'waf-rules-failed');
[6744] Fix | Delete
}
[6745] Fix | Delete
[6746] Fix | Delete
if (wfAdminNoticeQueue::enqueueAdminNotices()) {
[6747] Fix | Delete
$warningAdded = true;
[6748] Fix | Delete
}
[6749] Fix | Delete
[6750] Fix | Delete
if (!$warningAdded && self::isWordfencePage() && wfCentral::isCentralSiteUrlMismatched() && !wfUtils::truthyToBoolean(wfConfig::get('centralUrlMismatchChoice'))) {
[6751] Fix | Delete
$warningAdded = true;
[6752] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6753] Fix | Delete
add_action('network_admin_notices', 'wfCentral::mismatchedCentralUrlNotice');
[6754] Fix | Delete
}
[6755] Fix | Delete
else {
[6756] Fix | Delete
add_action('admin_notices', 'wfCentral::mismatchedCentralUrlNotice');
[6757] Fix | Delete
}
[6758] Fix | Delete
}
[6759] Fix | Delete
[6760] Fix | Delete
$existing = wfConfig::get('howGetIPs', '');
[6761] Fix | Delete
$recommendation = wfConfig::get('detectProxyRecommendation', '');
[6762] Fix | Delete
$canDisplayMisconfiguredHowGetIPs = true;
[6763] Fix | Delete
if (empty($existing) || empty($recommendation) || $recommendation == 'UNKNOWN' || $recommendation == 'DEFERRED' || $existing == $recommendation) {
[6764] Fix | Delete
$canDisplayMisconfiguredHowGetIPs = false;
[6765] Fix | Delete
}
[6766] Fix | Delete
if (!$warningAdded && $canDisplayMisconfiguredHowGetIPs && !wfUtils::truthyToBoolean(wfConfig::get('misconfiguredHowGetIPsChoice' . WORDFENCE_VERSION)) && !(defined('WORDFENCE_DISABLE_MISCONFIGURED_HOWGETIPS') && WORDFENCE_DISABLE_MISCONFIGURED_HOWGETIPS)) {
[6767] Fix | Delete
$warningAdded = true;
[6768] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6769] Fix | Delete
add_action('network_admin_notices', 'wordfence::misconfiguredHowGetIPsNotice');
[6770] Fix | Delete
}
[6771] Fix | Delete
else {
[6772] Fix | Delete
add_action('admin_notices', 'wordfence::misconfiguredHowGetIPsNotice');
[6773] Fix | Delete
}
[6774] Fix | Delete
}
[6775] Fix | Delete
if (!$warningAdded && method_exists(wfWAF::getInstance(), 'isReadOnly') && wfWAF::getInstance()->isReadOnly()) {
[6776] Fix | Delete
$warningAdded = true;
[6777] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6778] Fix | Delete
add_action('network_admin_notices', 'wordfence::wafReadOnlyNotice');
[6779] Fix | Delete
}
[6780] Fix | Delete
else {
[6781] Fix | Delete
add_action('admin_notices', 'wordfence::wafReadOnlyNotice');
[6782] Fix | Delete
}
[6783] Fix | Delete
}
[6784] Fix | Delete
if(! $warningAdded){
[6785] Fix | Delete
if (!wfConfig::get('autoUpdate') && !wfConfig::get('autoUpdateChoice')) {
[6786] Fix | Delete
$warningAdded = true;
[6787] Fix | Delete
if (wfUtils::isAdminPageMU()) {
[6788] Fix | Delete
add_action('network_admin_notices', 'wordfence::autoUpdateNotice');
[6789] Fix | Delete
} else {
[6790] Fix | Delete
add_action('admin_notices', 'wordfence::autoUpdateNotice');
[6791] Fix | Delete
}
[6792] Fix | Delete
}
[6793] Fix | Delete
}
[6794] Fix | Delete
[6795] Fix | Delete
if (!empty($_GET['page']) && $_GET['page'] === 'WordfenceWAF' && !empty($_GET['wafconfigrebuild']) && !WFWAF_SUBDIRECTORY_INSTALL) {
[6796] Fix | Delete
check_admin_referer('wafconfigrebuild', 'waf-nonce');
[6797] Fix | Delete
[6798] Fix | Delete
wfWAF::getInstance()->uninstall();
[6799] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[6800] Fix | Delete
$wafMenuURL = network_admin_url('admin.php?page=WordfenceWAF');
[6801] Fix | Delete
} else {
[6802] Fix | Delete
$wafMenuURL = admin_url('admin.php?page=WordfenceWAF');
[6803] Fix | Delete
}
[6804] Fix | Delete
wp_redirect($wafMenuURL);
[6805] Fix | Delete
exit;
[6806] Fix | Delete
}
[6807] Fix | Delete
[6808] Fix | Delete
if (!empty($_GET['page']) && $_GET['page'] === 'WordfenceWAF' && !empty($_GET['wafconfigfixmodphp']) && !WFWAF_SUBDIRECTORY_INSTALL) {
[6809] Fix | Delete
check_admin_referer('wafconfigfixmodphp', 'waf-nonce');
[6810] Fix | Delete
[6811] Fix | Delete
wfWAFAutoPrependHelper::fixHtaccessMod_php();
[6812] Fix | Delete
if (function_exists('network_admin_url') && is_multisite()) {
[6813] Fix | Delete
$wafMenuURL = network_admin_url('admin.php?page=WordfenceWAF');
[6814] Fix | Delete
} else {
[6815] Fix | Delete
$wafMenuURL = admin_url('admin.php?page=WordfenceWAF');
[6816] Fix | Delete
}
[6817] Fix | Delete
wp_redirect($wafMenuURL);
[6818] Fix | Delete
exit;
[6819] Fix | Delete
}
[6820] Fix | Delete
[6821] Fix | Delete
if (!$warningAdded) {
[6822] Fix | Delete
foreach (wfBlock::countryBlocks() as $block) {
[6823] Fix | Delete
if ($block->parameters['blockSite']) {
[6824] Fix | Delete
foreach ($block->parameters['countries'] as $country) {
[6825] Fix | Delete
if (strtoupper($country) === 'US') {
[6826] Fix | Delete
add_action(wfUtils::isAdminPageMU() ? 'network_admin_notices' : 'admin_notices', 'wordfence::showUnitedStatesBlockedNotice');
[6827] Fix | Delete
break 2;
[6828] Fix | Delete
}
[6829] Fix | Delete
}
[6830] Fix | Delete
}
[6831] Fix | Delete
}
[6832] Fix | Delete
}
[6833] Fix | Delete
[6834] Fix | Delete
if (!$warningAdded && wfSupportController::shouldShowSatisfactionPrompt()) {
[6835] Fix | Delete
if (is_multisite()) {
[6836] Fix | Delete
add_action('network_admin_notices', 'wfSupportController::satisfactionPromptNotice');
[6837] Fix | Delete
}
[6838] Fix | Delete
else {
[6839] Fix | Delete
add_action('admin_notices', 'wfSupportController::satisfactionPromptNotice');
[6840] Fix | Delete
}
[6841] Fix | Delete
}
[6842] Fix | Delete
[6843] Fix | Delete
if (self::isWordfenceAdminPage()) {
[6844] Fix | Delete
$dashboardExtra = '';
[6845] Fix | Delete
}
[6846] Fix | Delete
else {
[6847] Fix | Delete
$dashboardExtra = self::getDashboardNotificationCountIcon();
[6848] Fix | Delete
}
[6849] Fix | Delete
add_menu_page('Wordfence', "Wordfence{$dashboardExtra}", 'activate_plugins', 'Wordfence', 'wordfence::menu_dashboard', 'none');
[6850] Fix | Delete
}
[6851] Fix | Delete
[6852] Fix | Delete
//These are split to allow our module plugins to insert their menu item(s) at any point in the hierarchy
[6853] Fix | Delete
public static function admin_menus_20() {
[6854] Fix | Delete
$dashboardExtra = self::getDashboardNotificationCountIcon();
[6855] Fix | Delete
add_submenu_page("Wordfence", __("Wordfence Dashboard", 'wordfence'), __("Dashboard", 'wordfence') . $dashboardExtra, "activate_plugins", "Wordfence", 'wordfence::menu_dashboard');
[6856] Fix | Delete
}
[6857] Fix | Delete
[6858] Fix | Delete
public static function admin_menus_30() {
[6859] Fix | Delete
add_submenu_page("Wordfence", __("Firewall", 'wordfence'), __("Firewall", 'wordfence'), "activate_plugins", "WordfenceWAF", 'wordfence::menu_firewall');
[6860] Fix | Delete
if (wfConfig::get('displayTopLevelBlocking')) {
[6861] Fix | Delete
add_submenu_page("Wordfence", __("Blocking", 'wordfence'), __("Blocking", 'wordfence'), "activate_plugins", "WordfenceBlocking", 'wordfence::menu_blocking');
[6862] Fix | Delete
}
[6863] Fix | Delete
}
[6864] Fix | Delete
[6865] Fix | Delete
public static function admin_menus_40() {
[6866] Fix | Delete
add_submenu_page("Wordfence", __("Scan", 'wordfence'), __("Scan", 'wordfence'), "activate_plugins", "WordfenceScan", 'wordfence::menu_scan');
[6867] Fix | Delete
}
[6868] Fix | Delete
[6869] Fix | Delete
public static function admin_menus_50() {
[6870] Fix | Delete
add_submenu_page('Wordfence', __('Tools', 'wordfence'), __('Tools', 'wordfence'), 'activate_plugins', 'WordfenceTools', 'wordfence::menu_tools');
[6871] Fix | Delete
if (wfConfig::get('displayTopLevelLiveTraffic')) {
[6872] Fix | Delete
add_submenu_page("Wordfence", __("Live Traffic", 'wordfence'), __("Live Traffic", 'wordfence'), "activate_plugins", "WordfenceLiveTraffic", 'wordfence::menu_tools');
[6873] Fix | Delete
}
[6874] Fix | Delete
}
[6875] Fix | Delete
[6876] Fix | Delete
public static function admin_menus_60() {
[6877] Fix | Delete
if (wfConfig::get('displayTopLevelOptions')) {
[6878] Fix | Delete
add_submenu_page("Wordfence", __("All Options", 'wordfence'), __("All Options", 'wordfence'), "activate_plugins", "WordfenceOptions", 'wordfence::menu_options');
[6879] Fix | Delete
}
[6880] Fix | Delete
}
[6881] Fix | Delete
[6882] Fix | Delete
public static function admin_menus_70() {
[6883] Fix | Delete
add_submenu_page('Wordfence', __('Help', 'wordfence'), __('Help', 'wordfence'), 'activate_plugins', 'WordfenceSupport', 'wordfence::menu_support');
[6884] Fix | Delete
}
[6885] Fix | Delete
[6886] Fix | Delete
public static function admin_menus_80() {
[6887] Fix | Delete
if (wfCentral::isSupported() && self::isPage('WordfenceCentral')) {
[6888] Fix | Delete
add_submenu_page('Wordfence', __('Wordfence Central', 'wordfence'), __('Wordfence Central', 'wordfence'), 'activate_plugins', 'WordfenceCentral', 'wordfence::menu_wordfence_central');
[6889] Fix | Delete
}
[6890] Fix | Delete
}
[6891] Fix | Delete
[6892] Fix | Delete
public static function admin_menus_85() {
[6893] Fix | Delete
if (wfOnboardingController::shouldShowAnyAttempt() || self::isWordfenceInstallPage()) {
[6894] Fix | Delete
add_submenu_page('Wordfence', __('Install Wordfence', 'wordfence'), __('Install', 'wordfence'), 'activate_plugins', 'WordfenceInstall', 'wordfence::menu_install');
[6895] Fix | Delete
}
[6896] Fix | Delete
}
[6897] Fix | Delete
[6898] Fix | Delete
public static function admin_menus_90() {
[6899] Fix | Delete
switch (wfLicense::current()->getType()) {
[6900] Fix | Delete
case wfLicense::TYPE_FREE:
[6901] Fix | Delete
$message = __('Upgrade to Premium', 'wordfence');
[6902] Fix | Delete
$slug = 'WordfenceUpgradeToPremium';
[6903] Fix | Delete
break;
[6904] Fix | Delete
case wfLicense::TYPE_PREMIUM:
[6905] Fix | Delete
$message = __('Upgrade to Care', 'wordfence');
[6906] Fix | Delete
$slug = 'WordfenceUpgradeToCare';
[6907] Fix | Delete
break;
[6908] Fix | Delete
case wfLicense::TYPE_CARE:
[6909] Fix | Delete
$message = __('Upgrade to Response', 'wordfence');
[6910] Fix | Delete
$slug = 'WordfenceUpgradeToResponse';
[6911] Fix | Delete
break;
[6912] Fix | Delete
default:
[6913] Fix | Delete
$message = __('Protect More Sites', 'wordfence');
[6914] Fix | Delete
$slug = 'WordfenceProtectMoreSites';
[6915] Fix | Delete
break;
[6916] Fix | Delete
}
[6917] Fix | Delete
add_submenu_page("Wordfence", $message, "<strong id=\"wfMenuCallout\" style=\"color: #FCB214;\">" . $message . "</strong>", "activate_plugins", $slug, 'wordfence::_menu_noop');
[6918] Fix | Delete
add_filter('clean_url', 'wordfence::_patchWordfenceSubmenuCallout', 10, 3);
[6919] Fix | Delete
}
[6920] Fix | Delete
[6921] Fix | Delete
private static function isPage($page) {
[6922] Fix | Delete
return array_key_exists('page', $_GET) && $_GET['page'] === $page;
[6923] Fix | Delete
}
[6924] Fix | Delete
[6925] Fix | Delete
public static function _patchWordfenceSubmenuCallout($url, $original_url, $_context){
[6926] Fix | Delete
if (preg_match('/(?:WordfenceUpgradeTo(Premium|Care|Response))$/i', $url, $matches)) {
[6927] Fix | Delete
remove_filter('clean_url', 'wordfence::_patchWordfenceSubmenuCallout', 10);
[6928] Fix | Delete
return wfLicense::current()->getUpgradeUrl("menuUpgrade$matches[1]");
[6929] Fix | Delete
}
[6930] Fix | Delete
else if (preg_match('/(?:WordfenceProtectMoreSites)$/i', $url)) {
[6931] Fix | Delete
remove_filter('clean_url', 'wordfence::_patchWordfenceSubmenuCallout', 10);
[6932] Fix | Delete
return 'https://www.wordfence.com/zz10/licenses?purchase';
[6933] Fix | Delete
}
[6934] Fix | Delete
return $url;
[6935] Fix | Delete
}
[6936] Fix | Delete
public static function _menu_noop() {
[6937] Fix | Delete
//Do nothing
[6938] Fix | Delete
}
[6939] Fix | Delete
public static function _retargetWordfenceSubmenuCallout() {
[6940] Fix | Delete
echo <<<JQUERY
[6941] Fix | Delete
<script type="text/javascript">
[6942] Fix | Delete
jQuery(document).ready(function($) {
[6943] Fix | Delete
$('#wfMenuCallout').closest('a').attr('target', '_blank').attr('rel', 'noopener noreferrer');
[6944] Fix | Delete
});
[6945] Fix | Delete
</script>
[6946] Fix | Delete
JQUERY;
[6947] Fix | Delete
[6948] Fix | Delete
}
[6949] Fix | Delete
public static function admin_bar_menu() {
[6950] Fix | Delete
global $wp_admin_bar;
[6951] Fix | Delete
[6952] Fix | Delete
if (wfUtils::isAdmin() && wfConfig::get('showAdminBarMenu')) {
[6953] Fix | Delete
$title = '<div id="wf-adminbar-icon" class="ab-item"></div>';
[6954] Fix | Delete
$count = count(wfNotification::notifications());
[6955] Fix | Delete
$sinceCount = count(wfNotification::notifications((int) get_user_meta(get_current_user_id(), 'wordfence-notifications', true)));
[6956] Fix | Delete
if ($sinceCount > 0) {
[6957] Fix | Delete
$counter = '<span id="wf-notification-popover" data-toggle="popover" data-trigger="focus" data-content="' .
[6958] Fix | Delete
esc_attr(/* translators: Number of notifications. */ _n('You have %d new Wordfence notification.', 'You have %d new Wordfence notifications.', $sinceCount, 'wordfence'))
[6959] Fix | Delete
. '" data-container="body" data-placement="wf-bottom">&nbsp;</span>';
[6960] Fix | Delete
update_user_meta(get_current_user_id(), 'wordfence-notifications', time());
[6961] Fix | Delete
}
[6962] Fix | Delete
else {
[6963] Fix | Delete
$counter = ' ';
[6964] Fix | Delete
}
[6965] Fix | Delete
$badge = '<div class="wp-core-ui wp-ui-notification wf-notification-counter wf-notification-count-container' . ($count == 0 ? ' wf-hidden' : '') . '"><span class="wf-count wf-notification-count-value">' . $count . '</span></div>';
[6966] Fix | Delete
$counter .= $badge;
[6967] Fix | Delete
[6968] Fix | Delete
$wp_admin_bar->add_menu( array(
[6969] Fix | Delete
'id' => 'wordfence-menu',
[6970] Fix | Delete
'title' => $title . $counter,
[6971] Fix | Delete
'href' => network_admin_url('admin.php?page=Wordfence'),
[6972] Fix | Delete
));
[6973] Fix | Delete
$wp_admin_bar->add_menu( array(
[6974] Fix | Delete
'parent' => 'wordfence-menu',
[6975] Fix | Delete
'id' => 'wordfence-notifications',
[6976] Fix | Delete
'title' => '<div id="wordfence-notifications-display" class="wf-adminbar-submenu-title">' . __('Notifications', 'wordfence') . '</div>' . $badge,
[6977] Fix | Delete
'href' => network_admin_url('admin.php?page=Wordfence'),
[6978] Fix | Delete
));
[6979] Fix | Delete
$wp_admin_bar->add_menu( array(
[6980] Fix | Delete
'parent' => 'wordfence-menu',
[6981] Fix | Delete
'id' => 'wordfence-javascripterror',
[6982] Fix | Delete
'title' => '<div id="wordfence-javascripterror-display" class="wf-adminbar-submenu-title">' . __('JavaScript Errors', 'wordfence') . '</div><div class="wf-adminbar-status wf-adminbar-status-good">&bullet;</div>',
[6983] Fix | Delete
'href' => 'javascript:void(0)',
[6984] Fix | Delete
));
[6985] Fix | Delete
$wp_admin_bar->add_menu( array(
[6986] Fix | Delete
'parent' => 'wordfence-menu',
[6987] Fix | Delete
'id' => 'wordfence-malwareurl',
[6988] Fix | Delete
'title' => '<div id="wordfence-malwareurl-display' . (is_admin() ? '-skip' : '') . '" class="wf-adminbar-submenu-title">' . __('Malware URLs', 'wordfence') . '</div><div class="wf-adminbar-status wf-adminbar-status-neutral">&bullet;</div>',
[6989] Fix | Delete
'href' => network_admin_url('admin.php?page=WordfenceScan'),
[6990] Fix | Delete
));
[6991] Fix | Delete
}
[6992] Fix | Delete
}
[6993] Fix | Delete
public static function menu_tools() {
[6994] Fix | Delete
wp_enqueue_style('wordfence-select2-css');
[6995] Fix | Delete
wp_enqueue_script('wordfence-select2-js');
[6996] Fix | Delete
[6997] Fix | Delete
$subpage = filter_input(INPUT_GET, 'subpage');
[6998] Fix | Delete
switch ($subpage) {
[6999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function