Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Dec 24, 2022
1 parent b3dc5ac commit a2adac7
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions library/htmlspecialchars.inc.php
Expand Up @@ -92,11 +92,29 @@ function xmlEscape($text)
}

/**
* Special function to remove the 'javascript' string (case insensitive) for when including a variable within a html link
* Special function to remove the 'javascript' strings (case insensitive) for when including a variable within a html link
*/
function javascriptStringRemove($text)
function javascriptStringRemove(?string $text): string
{
return str_ireplace('javascript', '', $text ?? '');
$returnText = str_ireplace('javascript', '', $text ?? '');

if (javascriptStringCheck($returnText)) {
$returnText = javascriptStringRemove($returnText);
}

return $returnText;
}

/**
* Special function to check if 'javascript' string (case insensitive) is in a variable within a html link
*/
function javascriptStringCheck(?string $text): bool
{
if (stripos($text ?? '', 'javascript') === false) {
return false;
} else {
return true;
}
}

/**
Expand Down

0 comments on commit a2adac7

Please sign in to comment.