I'm reopening this because, although working, there are some important thoughts we have been discussing on Skype. Let's summarise them:
0) Latest change of the format_string() function seems to be slightly incorrect: Caching is broken & filter functions are called twice.
All this ignited one long discussion in chat about how things were going to be handled in 1.8 and finally we agreed that this could be a clear path to follow:
1) For activity names, is order to allow pre-existing ones to display html tags, global switch controls is we allow tags or no. We use complete format_string() to display them in course page.
2) For course/site titles we only allow <span> and process by format_string() function.
3) All we (developers/testers) create a course named #@#@#.... to detect where format_string is missing. format_string() will strip it so it'll be easy to detect where we are missing the format_string() function.
4/ rewrite format_string() to strip all tags by default. It's supposed that only non-html text is going to be processed by it.
5/ format_string() apply only SAFE filters. Those safe filters will be defined inside each filter by checking results of one "xxxx_filter_string()" (true/false) function (instead of the current $CFG->stringfilters new global. Only enabled filters being safe will be processed by format_string.
This should be decided ASAP. Should help to clarify things definitively.