r10414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10413‎ | r10414 | r10415 >
Date:08:24, 9 August 2005
Author:avar
Status:old
Tags:
Comment:
* Show something useful on action=myact
Modified paths:
  • /trunk/extensions/content_action.php (modified) (history)

Diff [purge]

Index: trunk/extensions/content_action.php
@@ -16,10 +16,11 @@
1717 function wfAddaction() {
1818 global $wgHooks, $wgMessageCache;
1919 $wgMessageCache->addMessage( 'myact', 'My action' );
20 - $wgHooks['SkinTemplateContentActions'][] = 'wfAddactionHook';
 20+ $wgHooks['SkinTemplateContentActions'][] = 'wfAddactionContentHook';
 21+ $wgHooks['UnknownAction'][] = 'wfAddactActionHook';
2122 }
2223
23 -function wfAddActionHook( &$content_actions ) {
 24+function wfAddActionContentHook( &$content_actions ) {
2425 global $wgRequest, $wgRequest, $wgTitle;
2526
2627 $action = $wgRequest->getText( 'action' );
@@ -32,3 +33,12 @@
3334 );
3435 }
3536 }
 37+
 38+function wfAddactActionHook( $action, &$wgArticle ) {
 39+ global $wgOut;
 40+
 41+ $title = $wgArticle->getTitle();
 42+
 43+ if ($action == 'myact')
 44+ $wgOut->addHTML( 'The page name is ' . $title->getText() . ' and you are ' . $wgArticle->getUserText() );
 45+}

Status & tagging log