Skip to content

Commit

Permalink
Upd. White label. Hide links to "research.cleantalk.org" and "l.clean…
Browse files Browse the repository at this point in the history
…talk.org/website-malware-removal" on plugin settings page if WL mode is enabled.
  • Loading branch information
alexandergull committed Oct 11, 2024
1 parent 7cfa52d commit 2ef5a22
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
11 changes: 9 additions & 2 deletions inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1811,9 +1811,16 @@ function spbc_field_statistics()
: 'unknown';
$va_last_request = sprintf('%s %s', __('last call on', 'security-malware-firewall'), $last_call);

$va_text = __('Closest vulnerabilities check requests preformed to', 'security-malware-firewall')
$research_db_link = empty($spbc->data['wl_mode_enabled'])
? LinkConstructor::buildPrenamedLink(
'https://research.cleantalk.org',
__(' performed to', 'security-malware-firewall')
)
: '';

$va_text = __('Closest vulnerabilities check requests', 'security-malware-firewall')
. ' '
. '<a href="https://research.cleantalk.org">research.cleantalk.org</a>';
. $research_db_link;

$va_text = sprintf('%s: %s, %s', $va_text, $va_last_request, $va_next_request);
echo(Escape::escKsesPreset($va_text, 'spbc_settings__display__notifications'));
Expand Down
16 changes: 16 additions & 0 deletions lib/CleantalkSP/SpbctWP/LinkConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,20 @@ public static function buildSimpleLink($domain, $uri = '')
{
return parent::buildSimpleLink($domain, $uri);
}

/**
* Build HTML like "Link description http://somedomain.com"
* @param string $url Url used in href and link text
* @param string $name_before_href Link pre-description
* @return string
*/
public static function buildPrenamedLink($url, $name_before_href)
{
return sprintf(
'<span>%s&nbsp;<a href="%s" target="_blank">%s</a></span>',
$name_before_href,
$url,
$url
);
}
}
24 changes: 9 additions & 15 deletions lib/CleantalkSP/SpbctWP/Views/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CleantalkSP\SpbctWP\Views;

use CleantalkSP\SpbctWP\LinkConstructor;
use CleantalkSP\SpbctWP\VulnerabilityAlarm\VulnerabilityAlarmView;
use CleantalkSP\Variables\Server;

Expand Down Expand Up @@ -68,7 +69,7 @@ public static function page($id_element = false)

// right corner section
'supportLink' => self::getSupportLink(),
'homepage' => self::generatePreNamedHref(
'homepage' => LinkConstructor::buildPrenamedLink(
$spbc->data["wl_url"],
__('Plugin Homepage', 'security-malware-firewall')
),
Expand All @@ -79,10 +80,13 @@ public static function page($id_element = false)
'trademark' => $spbc->data["wl_brandname"] . __(' is a registered trademark. All rights reserved.', 'security-malware-firewall'),
'feedback' => self::getFeedbackRequest(),
'premium' => self::getPremiumLink(),
'malwareCleaning' => self::generatePreNamedHref(
'https://l.cleantalk.org/website-malware-removal',
__('Malware cleaning', 'security-malware-firewall')
),
// delete link on wl mode
'malwareCleaning' => empty($spbc->data['wl_mode_enabled'])
? LinkConstructor::buildPrenamedLink(
'https://l.cleantalk.org/website-malware-removal',
__('Malware cleaning', 'security-malware-firewall')
)
: '',
// buttons
'goToCleanTalkLink' => esc_html(self::goToCleantalkLink()),
'goToCleanTalkText' => __('Security Dashboard', 'security-malware-firewall'),
Expand Down Expand Up @@ -141,16 +145,6 @@ private static function getSupportLink()
return $html;
}

private static function generatePreNamedHref($url, $name_before_href)
{
return sprintf(
'<span>%s&nbsp<a href="%s" target="_blank">%s</a></span>',
$name_before_href,
$url,
$url
);
}

private static function earlyOutput()
{
$link = get_site_option('siteurl') . 'wp-admin/options-general.php?page=spbc';
Expand Down

0 comments on commit 2ef5a22

Please sign in to comment.