Tim Starling wrote:
Brion Vibber wrote:
Hacksprint wrote:
Unfortunately setHook isn't used anywhere so
I have no example
to work with and I don't know where the best place to insert the
hook from. Anyone have any hints I could use?
We've got a couple of extensions in CVS:
http://cvs.sourceforge.net/viewcvs.py/wikipedia/extensions/
EasyTimeline and WikiHiero are in use on Wikipedia so should be in a
reasonably working state.
Just to add to that, MediaWiki extensions are switched on by including
the PHP file from LocalSettings.php. When the file is included, it
will register an extension function, and the extension function will
be called back from Setup.php once the environment is fully
initialised. Inside the extension function, you can do things like
adding parser hooks and special pages.
-- Tim Starling
I added "include_once( "extensions/rblog.php" );" to my
LocalSettings.php
Is this adequate for a minimal extension? I can't get it to do something
useful with the <rblog> tag. Thanks
<?php
# Remote Blog extension
# To use, include this file from your LocalSettings.php
# To configure, set members of $wgRemoteBlogSettings after the inclusion
class RemoteBlogSettings {
var $settings;
};
$wgRemoteBlogSettings = new RemoteBlogSettings;
$wgRemoteBlogSettings->settings="";
$wgExtensionFunctions[] = "wfRemoteBlogExtension";
function wfRemoteBlogExtension() {
global $wgParser;
$wgParser->setHook( "rblog", "ext_rblog_hook" );
}
function ext_rblog_hook( $rblog_src )
{
return "Hello World" . $rblog_src;
}
?>