r10413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10412‎ | r10413 | r10414 >
Date:08:03, 9 August 2005
Author:avar
Status:old
Tags:
Comment:
* Adding an extension that demonstrated how to use the
SkinTemplateContentActions hook
Modified paths:
  • /trunk/extensions/content_action.php (added) (history)

Diff [purge]

Index: trunk/extensions/content_action.php
@@ -0,0 +1,34 @@
 2+<?php
 3+/**
 4+ * An extension that demonstrated how to use the SkinTemplateContentActions
 5+ * hook to add a new content action
 6+ *
 7+ * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
 8+ */
 9+
 10+$wgExtensionFunctions[] = 'wfAddaction';
 11+$wgExtensionCredits['other'][] = array(
 12+ 'name' => 'Content action hook',
 13+ 'author' => 'Ævar Arnfjörð Bjarmason',
 14+);
 15+
 16+
 17+function wfAddaction() {
 18+ global $wgHooks, $wgMessageCache;
 19+ $wgMessageCache->addMessage( 'myact', 'My action' );
 20+ $wgHooks['SkinTemplateContentActions'][] = 'wfAddactionHook';
 21+}
 22+
 23+function wfAddActionHook( &$content_actions ) {
 24+ global $wgRequest, $wgRequest, $wgTitle;
 25+
 26+ $action = $wgRequest->getText( 'action' );
 27+
 28+ if ($wgTitle->getNamespace() != NS_SPECIAL) {
 29+ $content_actions['myact'] = array(
 30+ 'class' => $action == 'myact' ? 'selected' : false,
 31+ 'text' => wfMsg( 'myact' ),
 32+ 'href' => $wgTitle->getLocalUrl( 'action=myact' )
 33+ );
 34+ }
 35+}
Property changes on: trunk/extensions/content_action.php
___________________________________________________________________
Added: svn:eol-style
136 + native
Added: svn:keywords
237 + Author Date Id Revision

Status & tagging log