From a55a5d28c229c0ce323b0a44dc0e50f1b8f06761 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Tue, 29 Oct 2013 16:47:54 +0000 Subject: [PATCH] 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. --- lib/conditionlib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/conditionlib.php b/lib/conditionlib.php index 3bf7a8f8f3b..a597cec94f2 100644 --- a/lib/conditionlib.php +++ b/lib/conditionlib.php @@ -918,7 +918,7 @@ abstract class condition_info_base { if (!empty($information)) { $li = strpos($information, '
  • ', 4); if ($li === false) { - $information = preg_replace('~^
  • (.*)
  • $~', '$1', $information); + $information = preg_replace('~^\s*
  • (.*)
  • \s*$~s', '$1', $information); } else { $information = html_writer::tag('ul', $information); } @@ -1119,7 +1119,7 @@ abstract class condition_info_base { if (!empty($information)) { $li = strpos($information, '
  • ', 4); if ($li === false) { - $information = preg_replace('~^
  • (.*)
  • $~', '$1', $information); + $information = preg_replace('~^\s*
  • (.*)
  • \s*$~s', '$1', $information); } else { $information = html_writer::tag('ul', $information); }