is_tracking_prohibited()) { $extra = get_site_transient('wp_fail2ban_extra_about'); if (false === ($extra = apply_filters('wp_fail2ban_extra_about_transient', $extra))) { $url = apply_filters('wp_fail2ban_extra_about_url', 'https://wp-fail2ban.com/extra-about/?version='.WP_FAIL2BAN_VER); if (!is_wp_error($rv = wp_remote_get($url))) { /** * Try not to fetch more than once per day */ set_site_transient('wp_fail2ban_extra_about', $rv['body'], DAY_IN_SECONDS); $extra = $rv['body']; } } } return $extra; } /** * Helper to provide wrapper * * @since 4.3.0.10 * * @return void */ function welcome() { ?>

 

%s.

', __('Active', 'wp-fail2ban')); } elseif (file_exists(WP_PLUGIN_DIR."/{$free}/addon.php") || file_exists(WP_PLUGIN_DIR."/{$premium}/addon.php")) { $html = sprintf('

%s.

', __('Inactive', 'wp-fail2ban')); } else { $html = "

$desc

"; $html .= sprintf( '%s', $free, __('More Info') // use WP translation ); $url = network_admin_url('update.php?action=install-plugin&plugin='.$free); $url = wp_nonce_url($url, 'install-plugin_'.$free); $url = esc_url($url); $html .= sprintf( '%s', $url, __('Install Now') // use WP translation ); $html .= '

'; } return "
$name
$html
"; } /** * Helper: Blocklist info * * @since 4.4.1 * * @return string */ function getBlocklistInfo(): string { return getAddonInfo( 'Blocklist', 'WP_FAIL2BAN_ADDON_BLOCKLIST', 'wpf2b-addon-blocklist', 'wp-fail2ban-addon-blocklist', __('A collaborative preemptive blocklist.', 'wp-fail2ban') ); } /** * Helper: Contact Form 7 info * * @since 5.0.0 * * @return string */ function getContactForm7Info(): string { return (defined('WPCF7_VERSION')) ? getAddonInfo( 'for Contact Form 7', 'WP_FAIL2BAN_ADDON_CF7', 'wp-fail2ban-addon-contact-form-7', 'wp-fail2ban-addon-contact-form-7-premium', __('', 'wp-fail2ban') ) : ''; } /** * Helper: Gravity Forms info * * @since 5.0.0 * * @return string */ function getGravityFormsInfo(): string { return (class_exists('GFCommon')) ? getAddonInfo( 'for Gravity Forms', 'WP_FAIL2BAN_ADDON_GRAVITY_FORMS', 'wp-fail2ban-addon-gravity-forms', 'wp-fail2ban-addon-gravity-forms-premium', __('', 'wp-fail2ban') ) : ''; } /** * Info about the DB status * * @since 5.0.0 Refactored to use Site Health test * * @return string HTML */ function getDbInfo(): string { $shi = premium\SiteHealth::get_instance(); $results = $shi->get_test_premium_db(); if ('good' == $results['status']) { $fmt = << %s: %s

HTML; $html =sprintf($fmt, __('OK'), strip_tags($results['description'])); } else { $fmt = <<%s

%s

HTML; $html = sprintf( $fmt, __('MISSING - ACTION REQUIRED.', 'wp-fail2ban'), sprintf( /* translators: %s: internals */ __('Be sure to backup your database BEFORE clicking here to re-initialise.', 'wp-fail2ban'), 'href="?page=wpf2b-settings&action=force-activation"' ) ); } return $html; } /** * Info about the Cloudflare IP list * * @since 5.0.0 * * @return string HTML */ function getCloudflareInfo(): string { if (Config::get('WP_FAIL2BAN_EX_PROXY_CLOUDFLARE')) { $cf = []; if (!empty($cf['IPs'] = Config::get('WP_FAIL2BAN_EX_PROXY_CLOUDFLARE_IPS'))) { if (0 < ($lu = Config::get('WP_FAIL2BAN_EX_PROXY_CLOUDFLARE_IPS_UPDATED'))) { $tz = new \DateTimeZone(wp_timezone_string()); $dt = new \DateTimeImmutable("@{$lu}", $tz); $lu = sprintf(' %s: %s', __('OK'), $dt->format('Y/m/d H:i:s O')); } else { $lu = sprintf('%s', __('Last update unknown', 'wp-fail2bam')); } // There's space for 2 columns of CIDR IPv4 addresses, so first filter by length $short_ips = array_filter($cf['IPs'], function ($ip) { return (18 >= strlen($ip)); }); $long_ips = array_filter($cf['IPs'], function ($ip) { return (18 < strlen($ip)); }); $l = array_slice($short_ips, 0, (int)ceil(count($short_ips)/2)); $r = array_slice($short_ips, count($l)); $fmt = <<{$lu}

%s   %s
%s
HTML; $html = sprintf($fmt, join('
', $l), join('
', $r), join("
", $long_ips)); } else { $html = __('Not set.', 'wp-fail2ban'); } } else { $html = ' '.__('Not enabled.', 'wp-fail2ban'); } return $html; } /** * li helper * * @since 5.2.1 * * @param string $class_wpf2b * @param string $class_dashicon * @param string $blurb */ function li(string $class_wpf2b, string $class_dashicon, string $blurb): void { echo << {$blurb} HTML; } /** * About content * * @since 4.2.0 * * @return void */ function about(): void { $wp_f2b_ver = WP_FAIL2BAN_VER2; $extra = _get_extra_about(); $utm = '?utm_source=about&utm_medium=about&utm_campaign='.WP_FAIL2BAN_VER; $logo_box = [ 'title' => 'WP fail2ban', 'logo' => plugins_url('assets/icon.png', WP_FAIL2BAN_FILE), 'links' => [ 'Blog' => "https://wp-fail2ban.com/blog/{$utm}", // 'Guide' => "https://life-with.wp-fail2ban.com/{$utm}", 'Reference' => "https://docs.wp-fail2ban.com/en/{$wp_f2b_ver}/{$utm}", 'Support' => "https://forums.invis.net/c/wp-fail2ban/support/{$utm}" ] ]; if (wf_fs()->can_use_premium_code()) { $info = [ 'db' => getDbInfo(), 'cloudflare' => getCloudflareInfo() ]; } ?>

Version


Status

can_use_premium_code()): ?>
Filters
    get_test_filter_obsolete(); switch ($obs['status']) { case 'good': // OK li('ok', 'yes', __('Up to date.', 'wp-fail2ban')); break; case 'recommended': li('warning', 'warning', __('Status unknown.', 'wp-fail2ban')); $run_site_health = true; break; case 'critical': li('error', 'no', __('Obsolete filter(s) found.', 'wp-fail2ban')); $run_site_health = true; break; case 'old': li('warning', 'warning', __('Outdated but compatible filter(s).', 'wp-fail2ban')); break; } $mod = $shi->get_test_filter_modified(); if (empty($mod)) { // obj already failed } elseif ('good' == $mod['status']) { // OK li('ok', 'yes', __('Not modified.', 'wp-fail2ban')); } else { li('warning', 'warning', __('Modified filter(s) found.', 'wp-fail2ban')); $run_site_health = true; } echo ' '; $mis = $shi->get_test_filter_missing(); if (empty($mis)) { // obj already failed } elseif ('good' == $mis['status']) { // OK li('ok', 'yes', __('All filters present.', 'wp-fail2ban')); } else { li('error', 'no', __('Incomplete.', 'wp-fail2ban')); $run_site_health = true; } if ($run_site_health) { printf('

%s

', __('Run Site Health Tool.', 'wp-fail2ban')); } else { echo ''; } ?>

Add-Ons