|
Some comments:
1) Look the get_context_instance(CONTEXT_SYSTEM, SITEID) as commented. Journal mod has been moved to contrib.
I incorrectly closed this issue, reopen it.
Note that filtered text gets cached so we shouldn't use capabilities at all ... it's possible to prevent caching when this filter is used but do we really want that sort of a performance hit (all texts processed again for every user every time)?
If we do then it shouldn't rely on doanything, but some special capability like filter/censor:seecensoredwords Forgot about the caching side of things.
One possible resolution to this issue is to cache twice - one cache with censored text and one for people with the capability to read uncensored swears. Another possible solution is to create a new filtering mechanism which is pre-write to the db. I.e. moodle_messages gets the censored text a new table moodle_prefilter gets the text prior to any filtering taking place Obviously I've just scratched the surface with this pre-write filter idea but I can expand on it if you think it is a viable solution. Well,
perhaps this is a matter, for 2.0 to do something like this (to bring this and similar issues fixed for ever): 1) OOP formats, making them pluggable (this is apart but could be good idea for 2.0) Note that right now, for example, we are adding manually the current_language() to the cache, because of the lang filter. This will fit in the schema commented above automatically. Guy, I'm not really sure if the "intermediate" cache (before filtering) that you comment is really a good idea or no. Perhaps you can try to perform some basic implementation and measure differences? I guess we'll lost more time reading and witting it than the time needed to format the texts, but... who knows. Dong, how do you see the proposal? IMO could be a nice thing to change (one more) for Moodle 2.0. Comment it with MD...ciao Sounds good, I will start to work on this issue after 1.9.1 release
Alternatively, just admit that blanket censorship of people's words through technical means is unworkable in the long run and to just put more effort into doing it socially. Set up some rules of conduct and introduce penalties for breaking them. Reducing student grades is an obvious one but I'm sure you can get creative.
But I do like Eloy's idea in general of letting all filters modify the hash
grrr. sorry by the delay. I'll review this tomorrow (when I receive this mail). Ciao
A new method is added in the abstract class
Replace all the filter functions with OOP Filters.
The changes to weblib.php and filterlib.php.
Because of $DB conversion, the old patch is not valid any more, I attach two new patch here, Eloy, can you have a look?
Changing name of this bug ...
New patches against the lastest HEAD.
This new patch provide back-compatible with old filter plugins.
resolve it for testing, feel free to reopen it
Thanks See also,
Note that http://docs.moodle.org/en/Development:Filters |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1. isteacher is a deprecated functions, so in my patch, I use has_capability('moodle/site:doanything', $context) instead
2. I use return filter_phrases($text, $words, true); instead of a <dummytag>, cause your students might swear using <dummytag>swear<dummytag>
Please review