function smarty_function_escape_special_chars in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/smarty/plugins/shared.escape_special_chars.php \smarty_function_escape_special_chars()
escape_special_chars common function
Function: smarty_function_escape_special_chars<br> Purpose: used by other smarty functions to escape special chars except for already escaped ones
Parameters
string:
Return value
string
8 calls to smarty_function_escape_special_chars()
- smarty_function_html_checkboxes in includes/
moodle/ lib/ smarty/ plugins/ function.html_checkboxes.php - Smarty {html_checkboxes} function plugin
- smarty_function_html_checkboxes_output in includes/
moodle/ lib/ smarty/ plugins/ function.html_checkboxes.php - smarty_function_html_image in includes/
moodle/ lib/ smarty/ plugins/ function.html_image.php - Smarty {html_image} function plugin
- smarty_function_html_options in includes/
moodle/ lib/ smarty/ plugins/ function.html_options.php - Smarty {html_options} function plugin
- smarty_function_html_options_optgroup in includes/
moodle/ lib/ smarty/ plugins/ function.html_options.php
File
- includes/
moodle/ lib/ smarty/ plugins/ shared.escape_special_chars.php, line 18
Code
function smarty_function_escape_special_chars($string) {
if (!is_array($string)) {
$string = preg_replace('!&(#?\\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
$string = htmlspecialchars($string);
$string = str_replace(array(
'%%%SMARTY_START%%%',
'%%%SMARTY_END%%%',
), array(
'&',
';',
), $string);
}
return $string;
}