function qformat_gift::repchar in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/gift/format.php \qformat_gift::repchar()
1 call to qformat_gift::repchar()
- qformat_gift::writequestion in includes/
moodle/ question/ format/ gift/ format.php - convert a single question object into text output in the given format. This must be overriden
File
- includes/
moodle/ question/ format/ gift/ format.php, line 517
Class
- qformat_gift
- @package questionbank @subpackage importexport
Code
function repchar($text, $format = 0) {
// escapes 'reserved' characters # = ~ { ) : and removes new lines
// also pushes text through format routine
$reserved = array(
'#',
'=',
'~',
'{',
'}',
':',
"\n",
"\r",
);
$escaped = array(
'\\#',
'\\=',
'\\~',
'\\{',
'\\}',
'\\:',
'\\n',
'',
);
//dlnsk
$newtext = str_replace($reserved, $escaped, $text);
$format = 0;
// turn this off for now
if ($format) {
$newtext = format_text($format);
}
return $newtext;
}