From 40de834cd08533250e1610bef564088d3f14c14d Mon Sep 17 00:00:00 2001 From: alexandergull Date: Thu, 21 Nov 2024 18:18:44 +0500 Subject: [PATCH] Upd. Firewall log. Added UTM marks to every IP address link in set. --- inc/spbc-settings.php | 11 ++++++++++- lib/CleantalkSP/Common/LinkConstructor.php | 4 +++- lib/CleantalkSP/SpbctWP/LinkConstructor.php | 9 ++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/inc/spbc-settings.php b/inc/spbc-settings.php index 95d106068..c479fce19 100644 --- a/inc/spbc-settings.php +++ b/inc/spbc-settings.php @@ -2350,10 +2350,19 @@ function spbc_field_traffic_control_logs__prepare_data(&$table) $time_offset = current_time('timestamp') - time(); foreach ($table->rows as $row) { + // obtain IP $ip = IP::reduceIPv6($row->ip_entry); + + //construct actions $allow_layout = '' . esc_html__('Allow', 'security-malware-firewall') . ''; $ban_layout = '' . esc_html__('Ban', 'security-malware-firewall') . ''; - $ip = "" . esc_html($ip) . '' + + //construct link + $uri_link = 'blacklists/' . $row->ip_entry; + $ip_link = LinkConstructor::buildCleanTalkLink('settings__firewall_ip_addresses', $uri_link); + + // + $ip = "" . esc_html($ip) . '' . '
' . $allow_layout . ' | ' . $ban_layout; diff --git a/lib/CleantalkSP/Common/LinkConstructor.php b/lib/CleantalkSP/Common/LinkConstructor.php index 9d54d669a..7941c4fb6 100644 --- a/lib/CleantalkSP/Common/LinkConstructor.php +++ b/lib/CleantalkSP/Common/LinkConstructor.php @@ -42,7 +42,9 @@ private static function getGetParamsChunk($utm_preset, $get_params = array()) } else { $utm_data = static::$utm_presets[$utm_preset]; } - $utm_data['utm_campaign'] = static::$utm_campaign; + $utm_data['utm_campaign'] = isset(static::$utm_presets[$utm_preset]['utm_campaign']) + ? static::$utm_presets[$utm_preset]['utm_campaign'] + : static::$utm_campaign; $glued = array_merge($get_params, $utm_data); return http_build_query($glued); } diff --git a/lib/CleantalkSP/SpbctWP/LinkConstructor.php b/lib/CleantalkSP/SpbctWP/LinkConstructor.php index 6ffb72530..8e3d1f62f 100644 --- a/lib/CleantalkSP/SpbctWP/LinkConstructor.php +++ b/lib/CleantalkSP/SpbctWP/LinkConstructor.php @@ -37,7 +37,14 @@ class LinkConstructor extends \CleantalkSP\Common\LinkConstructor /* * Settings */ - + 'settings__firewall_ip_addresses' => array( //each record of FW entries + 'utm_id' => '', + 'utm_term' => '', + 'utm_source' => 'wordpress', + 'utm_medium' => 'dashboard', + 'utm_content' => 'firewall_log', + 'utm_campaign' => 'firewall', + ), /* * Public pages */