You are here

function qformat_qti2::get_cloze_intro in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/qti2/format.php \qformat_qti2::get_cloze_intro()

strips out the <intro>...</intro> section, if any, and returns the text

changes the text object passed to it.

Parameters

string $&text:

Return value

string the intro text, if there was an intro tag. '' otherwise.

1 call to qformat_qti2::get_cloze_intro()
qformat_qti2::writequestion in includes/moodle/question/format/qti2/format.php
Creates the export text for a question

File

includes/moodle/question/format/qti2/format.php, line 778

Class

qformat_qti2

Code

function get_cloze_intro(&$text) {
  if (preg_match('/(.*)?\\<intro>(.+)?\\<\\/intro>(.*)/s', $text, $matches)) {
    $text = $matches[1] . $matches[3];
    return $matches[2];
  }
  else {
    return '';
  }
}