moodlehq/moodle-filter_moodlelinks — pull request #3 by stronk7 (2013-01-05 01:14:23+00:00)
Title: MDLSITE-1632 Prevent filtering into tags and links.

This filter was using some simple str_[i]replace() calls
to perform replacements in all moodle.org contents. That
was leading to problems here and there when the target texts
were used within tags (borking) or links (double links).

As far as it's really hard to compute those cases using an
unique regexp, now the filter is relying into the core
filter_phrases() function (used by the glossary, data... filters)
able to properly avoid those tags and links and, at the same time,
also provide accurate support for case-sensitive and full-matches.

Note that there are some slightly modifications in tests, all them
to properly cover the "full-match" mode, that previously was, simply,
not working at all.

Finally note that, with this change, we have tried to observe the
old links behavior completely by forcing some phrases here and there.
Surely it will be more "natural" to, always, preserve the original
casing typed by the user (perhaps "MOOCH" can be
the unique exception with some sense).

This can be easily achieved by taking out all the "forcephrase"
parameters in the $links property of the filter. But in any case
it's not the goal of this issue, so I've prefered to keep the
resulting phrases the same.