Skip to content
Browse files

MDL-31885 The activity name auto-linking filter should not create lin…

…ks to webpages it was created on
  • Loading branch information...
1 parent f29e62c commit 96bc64775534e2cce474d71b2cabccf93e4d5cfc @marinaglancy marinaglancy committed Feb 20, 2013
Showing with 14 additions and 3 deletions.
  1. +14 −3 filter/activitynames/filter.php
View
17 filter/activitynames/filter.php
@@ -70,18 +70,29 @@ function filter($text, array $options = array()) {
$href_tag_begin = html_writer::start_tag('a',
array('class' => 'autolink', 'title' => $title,
'href' => $cm->get_url()));
- self::$activitylist[] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
+ self::$activitylist[$cm->id] = 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
- self::$activitylist[] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
+ self::$activitylist[$cm->id.'-e'] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
}
}
}
}
}
}
+ $filterslist = array();
if (self::$activitylist) {
- return $text = filter_phrases ($text, self::$activitylist);
+ $cmid = $this->context->instanceid;
+ if ($this->context->contextlevel == CONTEXT_MODULE && isset(self::$activitylist[$cmid])) {
+ // remove filterobjects for the current module
+ $filterslist = array_diff_key(self::$activitylist, array($cmid => 1, $cmid.'-e' => 1));
+ } else {
+ $filterslist = self::$activitylist;
+ }
+ }
+
+ if ($filterslist) {
+ return $text = filter_phrases($text, $filterslist);
} else {
return $text;
}

0 comments on commit 96bc647

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