Page MenuHomePhabricator

Add hooks to allow post-processing the output of wfMessage
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):

I would like to have hooks in Message::format to be able to post-process the output of a message. This would allow extensions to modify the output of wfMessage() [Previously individual messages could be modified, but not after formatting only before]

There are 5 output types, but i think it makes most sense to have two hooks, one for the HTML formats (parse, parseAsBlock, escaped) and one for the text formats (text, plain), with an argument for the format type. The reason to split into two types as you generally want to treat HTML and text types very differently.

Use case(s)
I want to make an extension called Extension:XSSProtector that tries to filter messages for javascript looking things. Right now it is using a very hacky solution to accomplish this, I'd like a more proper solution.

Event Timeline

Change #1179297 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[mediawiki/core@master] Add hooks MessagePostProcessHtml and MessagePostProcessText

https://gerrit.wikimedia.org/r/1179297

Change #1179297 merged by jenkins-bot:

[mediawiki/core@master] Add hooks MessagePostProcessHtml and MessagePostProcessText

https://gerrit.wikimedia.org/r/1179297

Bawolff claimed this task.