From bce96ff4bfafaa7f402062f759b2eb2ad2526c8f Mon Sep 17 00:00:00 2001 From: Tom Homer Date: Mon, 26 Nov 2018 16:14:31 -0500 Subject: [PATCH] Added new variable modifier for template class Added :h Call which strip_tags on the variable before output. --- system/classes/template.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/system/classes/template.class.php b/system/classes/template.class.php index 9c255a445..bb4918832 100644 --- a/system/classes/template.class.php +++ b/system/classes/template.class.php @@ -1460,6 +1460,10 @@ function mod_echo($val, $modifier = '') case 's': $ret = htmlspecialchars($ret); break; + + case 'h': + $ret = strip_tags($ret); + break; case 't': $ret = substr($ret, 0, intval(substr($mod, 1))); // truncate @@ -1568,7 +1572,7 @@ private function replace_vars($tmplt, $in_php = false) $tmplt = preg_replace( array( '/\{([-\.\w\d_\[\]]+)\}/', // matches {identifier} - '/\{([-\.\w\d_\[\]]+)((:u|:s|:t\d+)+)\}/', // matches {identifier} with optional :s, :u or :t### suffix + '/\{([-\.\w\d_\[\]]+)((:u|:s|:h|:t\d+)+)\}/', // matches {identifier} with optional :s, :u or :t### suffix ), array( '$this->get_var(\'\1\')', @@ -1579,7 +1583,7 @@ private function replace_vars($tmplt, $in_php = false) $tmplt = preg_replace( array( '/\{([-\.\w\d_\[\]]+)\}/', // matches {identifier} - '/\{([-\.\w\d_\[\]]+)((:u|:s|:t\d+)+)\}/', // matches {identifier} with optional :s, :u or :t### suffix + '/\{([-\.\w\d_\[\]]+)((:u|:s|:h|:t\d+)+)\}/', // matches {identifier} with optional :s, :u or :t### suffix ), array( 'val_echo(\'\1\'); ?>',