[Mediawiki-l] How best to set up hooks in an extension function ?
sebastien bracq
sbracq at hotmail.fr
Tue Jun 30 21:31:03 UTC 2009
> Date: Wed, 1 Jul 2009 02:25:09 +0800
> From: richard.philippines at gmail.com
> To: mediawiki-l at lists.wikimedia.org
> Subject: [Mediawiki-l] How best to set up hooks in an extension function ?
>
> I thought I had read somewhere that it was not a good idea to set
> function hooks inside of a class in this way.
> what follows is just one of many examples out there:
>
> $wgExtensionFunctions[] = 'wfSetupCSS'
>
> function wfSetupCSS() {
> global $wgCSS;
> $wgCSS = new CSS();
> }
>
> class CSS {
>
> function CSS() {
> global $wgParser, $wgCSSMagic;
> $wgParser->setFunctionHook($wgCSSMagic, array($this, 'magicCss'));
> }
>
>
> Any other suggestions on how to implement this type of functionality.
> Would it be better not to instantiate the CSS
> class and just use a static class with a function to set the hook like this:
>
> $wgExtensionFunctions[] = 'CSS::SetupCSS'
>
> Where SetupCSS was a static function to set the hook.
>
> Sorry if the question appears a bit dumb but I'm interested to hear
> what the more experienced guys think.
>
> Thanks,
>
> Richard
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_________________________________________________________________
Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous !
http://www.microsoft.com/windows/windowslive/default.aspx
More information about the MediaWiki-l
mailing list