Last modified: 2010-05-15 14:36:27 UTC
You should allow for extensions to define new variables (eg, {{FOO}}).
Created attachment 869 [details] Proposed implementation (1.5) This is my implementation of this bug. It modifies MagicWord.php, Parser.php, and SpecialVersion.php.
Created attachment 870 [details] Example Extension using the previous implementation This is an example extension that creates the variable RANDOM. It should be fairly self-explainatory.
Created attachment 871 [details] Proposed implementation (1.5) Added a few more comments in MagicWord.php
Created attachment 872 [details] Proposed implementation (1.5) Some phpdoc corrections, other comment changes.
I just realized that in Parser.php, it does not cache the result of it in the static $varCache. (Parser::getVariableValue().) I'm not sure this would be a bug or a feature.
Created attachment 1099 [details] Implementation using the existing hook system Your implementation of this was overly complex and redundant, we already have an all purpose hook system in place and there's no need to write a custom one for this occation when that one will do perfectly. I've commited my own implementation of this (attached) using the existing system. You can find an example extension that implements it called Variable_hook.php in the examples directory in the extensions module in CVS HEAD.
Marking this as FIXED in CVS HEAD.
(In reply to comment #6) > Created an attachment (id=1099) [edit] > Implementation using the existing hook system > > Your implementation of this was overly complex and redundant, we already have > an all purpose hook system in place and there's no need to write a custom one > for this occation when that one will do perfectly. I've commited my own > implementation of this (attached) using the existing system. You can find an > example extension that implements it called Variable_hook.php in the examples > directory in the extensions module in CVS HEAD. I was aiming for implementation similar to the parser extensions. (ie, you register your variable, and the parser calls your function.) But in hindsight, your version is more flexible in that you could use it to do simple {{foo:...}} extensions (but no params).