Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-36571_23' of git://github.com/timhunt/moodle into M…

…OODLE_23_STABLE
  • Loading branch information...
commit 254d78b75f78aea6d8d1c944f232e4fb9735608d 2 parents 21082f7 + 4c1a35e
@danpoltawski danpoltawski authored
View
8 question/type/multichoice/question.php
@@ -126,10 +126,10 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $
}
public function make_html_inline($html) {
- $html = preg_replace('~\s*<p>\s*~', '', $html);
- $html = preg_replace('~\s*</p>\s*~', '<br />', $html);
- $html = preg_replace('~<br />$~', '', $html);
- return $html;
+ $html = preg_replace('~\s*<p>\s*~u', '', $html);
+ $html = preg_replace('~\s*</p>\s*~u', '<br />', $html);
+ $html = preg_replace('~(<br\s*/?>)+$~u', '', $html);
+ return trim($html);
}
}
View
2  question/type/multichoice/tests/question_test.php
@@ -147,6 +147,8 @@ public function test_make_html_inline() {
$this->assertEquals("Frog<br />XXX <img src='http://example.com/pic.png' alt='Graph' />",
$mc->make_html_inline(" <p> Frog </p> \n\r
<p> XXX <img src='http://example.com/pic.png' alt='Graph' /> </p> "));
+ $this->assertEquals('Frog', $mc->make_html_inline('<p>Frog</p><p></p>'));
+ $this->assertEquals('Frog<br />†', $mc->make_html_inline('<p>Frog</p><p>†</p>'));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.