[Mediawiki-l] Parser::extractTagsAndParams(....)
Borut Tomažin
debijan at gmail.com
Wed Jul 19 16:35:06 UTC 2006
Hello there,
Can anyone help me. I want to get tags and parameters out from te article,
when user click on edit. I have made hook. Look at the code:
define( "PROTECT_TAG", "restrict" );
$wgExtensionFunctions[] = 'efAdminPagesRestrictionsHook';
function efAdminPagesRestrictionsHook() {
global $wgHooks;
global $wgParser;
global $wgMessageCache;
$wgMessageCache->addMessages(
array(
'page_no_access' => "This area is [[Page
Protection|protected]]. You are not allowed to read or edit this area.",
'page_read_access' => "You can only view this area,
but cannot edit it."
)
);
$wgHooks['AlternateEdit'][] = 'RestrictHookEdit';}
function RestrictHookEdit( &$editpage ) {
#global $wgParser;
global $_REQUEST;
global $_GET;
$text = $editpage->mArticle->getContent();
$content = '';
$tags = '';
$params = array();
Parser::extractTagsAndParams( PROTECT_TAG, $text, $content, $tags,
$params );
if( count( $tags ) > 0 && count( $params ) > 0 ) {
#HERE I CAN NOT GET OUT $tags and $params VALUES
#return $editpage;
}
else if( count( $tags ) == 0 ) {
#return $editpage;
}
}
Borut
More information about the MediaWiki-l
mailing list