Skip to content

Commit

Permalink
feat(Utils) suppressHTMLTags support for single quotes and deleteHTML…
Browse files Browse the repository at this point in the history
…Tags
  • Loading branch information
joebordes committed Dec 8, 2021
1 parent 56c1c72 commit a4239c9
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions include/utils/CommonUtils.php
Expand Up @@ -3587,8 +3587,24 @@ function suppressAllButFirst($occurence, $from) {
return substr($from, 0, $spos+$slen).str_replace($occurence, '', substr($from, $spos+$slen));
}

function vt_suppressHTMLTags($string) {
return preg_replace(array('/</', '/>/', '/"/'), array('&lt;', '&gt;', '&quot;'), $string);
function vt_deleteHTMLTags($string, $singleQuote = false) {
$from = array('<', '>', '"');
$to = array('', '', '');
if ($singleQuote) {
$from[] = "'";
$to[] = '';
}
return str_replace($from, $to, $string);
}

function vt_suppressHTMLTags($string, $singleQuote = false) {
$from = array('/</', '/>/', '/"/');
$to = array('&lt;', '&gt;', '&quot;');
if ($singleQuote) {
$from[] = "/'/";
$to[] = '&#39;';
}
return preg_replace($from, $to, $string);
}

function gtltTagsToHTML($string) {
Expand Down

0 comments on commit a4239c9

Please sign in to comment.