Skip to content

Commit

Permalink
Merge pull request #135 from andrewlimaza/obfuscate-email
Browse files Browse the repository at this point in the history
Scrub email addresses in the log file.
  • Loading branch information
dparker1005 authored Nov 15, 2023
2 parents af4751f + 8fedd2e commit 8f807f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ function pmpromc_log( $entry ) {
return;
}

// Define a regular expression pattern to match email addresses
$pattern = '/(?<=@)([a-zA-Z0-9._%+-]+)(?=\.[a-zA-Z]{2,})/';
$entry = preg_replace( $pattern, '****', $entry );

$logstr = "Logged On: " . date_i18n("m/d/Y H:i:s") . "\n";
$logstr .= $entry;
$logstr .= "\n-------------\n";
Expand Down

0 comments on commit 8f807f3

Please sign in to comment.