You are here

function qformat_gift::escapedchar_pre in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/gift/format.php \qformat_gift::escapedchar_pre()
1 call to qformat_gift::escapedchar_pre()
qformat_gift::readquestion in includes/moodle/question/format/gift/format.php
Given the data known to define a question in this format, this function converts it into a question object suitable for processing and insertion into Moodle.

File

includes/moodle/question/format/gift/format.php, line 83

Class

qformat_gift
@package questionbank @subpackage importexport

Code

function escapedchar_pre($string) {

  //Replaces escaped control characters with a placeholder BEFORE processing
  $escapedcharacters = array(
    "\\:",
    "\\#",
    "\\=",
    "\\{",
    "\\}",
    "\\~",
    "\\n",
  );

  //dlnsk
  $placeholders = array(
    "&&058;",
    "&&035;",
    "&&061;",
    "&&123;",
    "&&125;",
    "&&126;",
    "&&010",
  );

  //dlnsk
  $string = str_replace("\\\\", "&&092;", $string);
  $string = str_replace($escapedcharacters, $placeholders, $string);
  $string = str_replace("&&092;", "\\", $string);
  return $string;
}