Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-17545 activity names filter: Improve handling when name contains …

…htmlentities() chars. Backported from HEAD.
  • Loading branch information...
commit 4ebc71d9411510ce75b990710e949cb76e96cffc 1 parent e31d919
stronk7 authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 filter/activitynames/filter.php
View
8 filter/activitynames/filter.php
@@ -41,13 +41,15 @@ function activitynames_filter($courseid, $text) {
//Exclude labels and hidden items
if ($activity->mod != "label" && $activity->visible) {
$title = trim(strip_tags(urldecode($activity->name)));
+ $currentname = trim(urldecode($activity->name));
+ $entitisedname = s($currentname);
/// Avoid empty or unlinkable activity names
if (!empty($title)) {
$title = str_replace('"', "'", $title);
$href_tag_begin = "<a class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/$activity->mod/view.php?id=$activity->cm\" $CFG->frametarget>";
- $currentname = urldecode($activity->name);
- if ($currentname = trim($currentname)) {
- $activitylist[] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
+ $activitylist[] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
+ if ($currentname != $entitisedname) { /// If name has some entity (&amp; &quot; &lt; &gt;) add that filter too. MDL-17545
+ $activitylist[] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.