Skip to content

Commit

Permalink
Merge pull request #443 from CleanTalk/utm_for_firewall.ag
Browse files Browse the repository at this point in the history
Upd. Firewall Log. UTM marks added.
  • Loading branch information
alexandergull authored Nov 25, 2024
2 parents 5fcc2ff + 40de834 commit daa53d0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
11 changes: 10 additions & 1 deletion inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<a href="#" onclick="return spbcTcAllowIp(\'' . esc_attr($ip) . '\')" class="spbcGreen">' . esc_html__('Allow', 'security-malware-firewall') . '</a>';
$ban_layout = '<a href="#" onclick="return spbcTcBanIp(\'' . esc_attr($ip) . '\')" class="spbc---red">' . esc_html__('Ban', 'security-malware-firewall') . '</a>';
$ip = "<a href='https://cleantalk.org/blacklists/{$row->ip_entry}' target='_blank'>" . esc_html($ip) . '</a>'

//construct link
$uri_link = 'blacklists/' . $row->ip_entry;
$ip_link = LinkConstructor::buildCleanTalkLink('settings__firewall_ip_addresses', $uri_link);

//
$ip = "<a href='{$ip_link}' target='_blank'>" . esc_html($ip) . '</a>'
. '<br>'
. $allow_layout . ' | ' . $ban_layout;

Expand Down
4 changes: 3 additions & 1 deletion lib/CleantalkSP/Common/LinkConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
9 changes: 8 additions & 1 deletion lib/CleantalkSP/SpbctWP/LinkConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit daa53d0

Please sign in to comment.