Firefox PHP

Strange "quote" hook

Posted by marc_jentsch 
Strange "quote" hook
January 12, 2011 10:21AM

I understood the quote-hook as some kind of a filter. That means, different plugins can register this hook and alter the quoted text (one after another) before it comes to the output. A filter returns the output data always in the same format as the input data (in case of the quote-hook the input is an array). But in the file \include\posting\request_first.php the output is completely thrown away if it is still in the array-format. The bbCode-module follows that strange way too ...

Language: PHP
/* from: request_first.php */ if (empty($quoted) || is_array($quoted)){ //line 82 ... }

I suggest to change this behavior, because cascading of hooks should be possible ...

have a nice day,

Re: Strange "quote" hook
January 12, 2011 03:29PM
You are looking at a bit of technical debt here.

The assumption around the time that this hook was introduced was that only one quote hook would be active at a time, which isn't a bad assumption. The few quoting methods that we have now do very different things and chaining multiple hooks that modify quoted data don't make too much sense in that respect (they could easily become conflicting.)

For you, it makes sense of course, since you seem to be after a specific use case that you need to implement. The way to go would be to write your own quote hook, which implements the full quote handling that you need. Besides that, disable the quote hook from the bundled BBcode module.

If we would have introduced the quote hook at this time, we might have made it chainable. However, the hook was introduced at a time when the hook system hadn't yet fully crystallized, resulting in the odd handling. Unfortunately, turning that back and changing the hook isn't really a feasible option. We prefer to remain backward compatible in the hook department.

Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login