$wgHooks['ParserFirstCallInit'][] = "efSampleSetup";
function efSampleSetup(Parser $parser) {
$parser->setHook( 'addhtml', 'efSampleRender' );
return true;
}
function checkPageEditRestriction( &$title )
// v1.1 feature
// where $title is a Mediawiki Title class object instance
{
$proceed = false;
$state = $title->getRestrictions('edit');
foreach ($state as $index => $group )
if ( $group == 'sysop' )
$proceed = true;
return $proceed;
}
function efSampleRender( $input, $args, $parser, PPFrame $frame ) {
// Nothing exciting here, just escape the user-provided
// input and throw it back out again
if (!checkPageEditRestriction( $parser->mTitle ))
return "unauthorized usage of <b>addHtml</b> extension.";
return $input;
}