MDL-42582 Availability: Restriction display incorrect for multi-para Labels

When a label has multiple paragraphs, its name (converted to plain text)
contains a line feed. Due to an error in regular expressions that don't
accept the line feed, this caused incorrect display on the course page
when that label is shown as a requirement for accessing another activity.
This commit is contained in:
sam marshall 2013-10-29 16:47:54 +00:00
parent 9524fc754d
commit 597ac7e5d2

View File

@ -909,7 +909,7 @@ abstract class condition_info_base {
if (!empty($information)) {
$li = strpos($information, '<li>', 4);
if ($li === false) {
$information = preg_replace('~^<li>(.*)</li>$~', '$1', $information);
$information = preg_replace('~^\s*<li>(.*)</li>\s*$~s', '$1', $information);
} else {
$information = html_writer::tag('ul', $information);
}
@ -1106,7 +1106,7 @@ abstract class condition_info_base {
if (!empty($information)) {
$li = strpos($information, '<li>', 4);
if ($li === false) {
$information = preg_replace('~^<li>(.*)</li>$~', '$1', $information);
$information = preg_replace('~^\s*<li>(.*)</li>\s*$~s', '$1', $information);
} else {
$information = html_writer::tag('ul', $information);
}