Skip to content

Commit

Permalink
Update names.
Browse files Browse the repository at this point in the history
  • Loading branch information
svfcode committed Jul 18, 2024
1 parent 6ee561a commit 964c9e8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
6 changes: 3 additions & 3 deletions inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4554,17 +4554,17 @@ function spbc_sanitize_settings($settings)

// Sanitizing scanner dirs exceptions
if ($settings['scanner__dir_exclusions_view']) {
$dirExclusion = new \CleantalkSP\SpbctWP\Settings\DirExclusion();
$dirExclusion = new \CleantalkSP\SpbctWP\Settings\FilesScanDirExclusion();

$settings['scanner__dir_exclusions_view'] = $dirExclusion->dirExclusionsView($settings['scanner__dir_exclusions_view']);
$settings['scanner__dir_exclusions'] = $dirExclusion->dirExclusions($settings['scanner__dir_exclusions_view']);
}

// Sanitizing frontend scanner URL exclusions
if ($settings['scanner__frontend_analysis__domains_exclusions_view']) {
$domainExclusion = new \CleantalkSP\SpbctWP\Settings\DomainExclusion();
$domainExclusion = new \CleantalkSP\SpbctWP\Settings\FrontendScanDomainExclusion();

$domainExclusionView = $domainExclusion->domainExclusionsView($settings['scanner__frontend_analysis__domains_exclusions_view']);
$domainExclusionView = $domainExclusion->frontendScanDomainExclusionsView($settings['scanner__frontend_analysis__domains_exclusions_view']);
$settings['scanner__frontend_analysis__domains_exclusions_view'] = $domainExclusionView;

$domainExclusionSets = $domainExclusion->domainExclusions($settings['scanner__frontend_analysis__domains_exclusions_view']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use CleantalkSP\SpbctWP\Helpers\CSV;

class DirExclusion
class FilesScanDirExclusion
{
private $DIR_EXCLUSION_FILE_NAME = 'spbct_directory_exclusions.txt';

Expand Down Expand Up @@ -57,6 +57,10 @@ public function dirExclusions($exclusions)
$upload_dirs = $this->getUploadDirs($upload_urls);
$upload_dirs = array_filter($upload_dirs, function ($dir) {
return $dir !== '';
});

$dirs = array_merge($dirs, $upload_dirs);
$dirs = array_unique($dirs);

Expand Down Expand Up @@ -106,8 +110,13 @@ private function getUploadDirs($urls)
continue;
}

$dir_content = array_filter($dir_content, function ($dir) {
return $dir !== '';
});

$upload_dirs_stat[$dir] = count($dir_content);
}

update_option('spbc_upload_dirs_stat', $upload_dirs_stat);

$upload_dirs_merged = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use CleantalkSP\SpbctWP\Scanner;
use CleantalkSP\SpbctWP\Helpers\CSV;

class DomainExclusion
class FrontendScanDomainExclusion
{
private $DOMAIN_EXCLUSION_FILE_NAME = 'spbct_allowed_domains.txt';

public function domainExclusionsView($exclusions)
public function frontendScanDomainExclusionsView($exclusions)
{
$urls = CSV::parseNSV($exclusions);

Expand Down Expand Up @@ -111,6 +111,10 @@ private function getUploadUrls($urls)
continue;
}

$url_content = array_filter($url_content, function ($url) {
return $url !== '';
});

$upload_urls_stat[$url] = count($url_content);
}
update_option('spbc_upload_urls_stat', $upload_urls_stat);
Expand Down
6 changes: 3 additions & 3 deletions security-malware-firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ function spbc_update_scan_settings_exclusions()
$settings = $spbc->settings;

try {
$dirExclusion = new \CleantalkSP\SpbctWP\Settings\DirExclusion();
$dirExclusion = new \CleantalkSP\SpbctWP\Settings\FilesScanDirExclusion();

$settings['scanner__dir_exclusions_view'] = $dirExclusion->dirExclusionsView($settings['scanner__dir_exclusions_view']);
$settings['scanner__dir_exclusions'] = $dirExclusion->dirExclusions($settings['scanner__dir_exclusions_view']);

$domainExclusion = new \CleantalkSP\SpbctWP\Settings\DomainExclusion();
$domainExclusion = new \CleantalkSP\SpbctWP\Settings\FrontendScanDomainExclusion();

$domainExclusionView = $domainExclusion->domainExclusionsView($settings['scanner__frontend_analysis__domains_exclusions_view']);
$domainExclusionView = $domainExclusion->frontendScanDomainExclusionsView($settings['scanner__frontend_analysis__domains_exclusions_view']);
$settings['scanner__frontend_analysis__domains_exclusions_view'] = $domainExclusionView;

$domainExclusionSets = $domainExclusion->domainExclusions($settings['scanner__frontend_analysis__domains_exclusions_view']);
Expand Down

0 comments on commit 964c9e8

Please sign in to comment.