You are here

function qformat_xhtml::repchar in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/xhtml/format.php \qformat_xhtml::repchar()
1 call to qformat_xhtml::repchar()
qformat_xhtml::writequestion in includes/moodle/question/format/xhtml/format.php
convert a single question object into text output in the given format. This must be overriden

File

includes/moodle/question/format/xhtml/format.php, line 13

Class

qformat_xhtml
@package questionbank @subpackage importexport

Code

function repchar($text) {

  // escapes 'reserved' characters # = ~ { ) and removes new lines
  $reserved = array(
    '#',
    '=',
    '~',
    '{',
    '}',
    "\n",
    "\r",
  );
  $escaped = array(
    '\\#',
    '\\=',
    '\\~',
    '\\{',
    '\\}',
    ' ',
    '',
  );
  return str_replace($reserved, $escaped, $text);
}