Skip to content

Commit

Permalink
Test for existence of htmlspecialchars flag (PHP < 5.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid committed Sep 14, 2022
1 parent 4d316d3 commit 3f426c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libs/plugins/function.mailto.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ function smarty_function_mailto($params)
return;
}

$string = '<a href="mailto:' . htmlspecialchars($address, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, Smarty::$_CHARSET) .
'" ' . $extra . '>' . htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, Smarty::$_CHARSET) . '</a>';
$flags = ENT_QUOTES;
if (defined('ENT_SUBSTITUTE') && defined('ENT_HTML401')) {
$flags |= ENT_SUBSTITUTE | ENT_HTML401;
}

$string = '<a href="mailto:' . htmlspecialchars($address, $flags, Smarty::$_CHARSET) .
'" ' . $extra . '>' . htmlspecialchars($text, $flags, Smarty::$_CHARSET) . '</a>';

if ($encode === 'javascript') {
$js_encode = '';
Expand Down

0 comments on commit 3f426c4

Please sign in to comment.