Skip to content
Browse files

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.
  • Loading branch information...
1 parent e98f145 commit 7ed24ca35192c697534212027da18b7151d4dc26 @sammarshallou sammarshallou committed with damyon Oct 29, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/conditionlib.php
View
4 lib/conditionlib.php
@@ -909,7 +909,7 @@ public function get_full_information($modinfo=null) {
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 @@ public function is_available(&$information, $grabthelot=false, $userid=0, $modin
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);
}

0 comments on commit 7ed24ca

Please sign in to comment.
Something went wrong with that request. Please try again.