r59216 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59215‎ | r59216 | r59217 >
Date:21:07, 18 November 2009
Author:churchofemacs
Status:deferred (Comments)
Tags:
Comment:
New Extension:GroupsSidebar. More information about this extension in mediawiki.org wiki. Requires r59215 to work.
Modified paths:
  • /trunk/extensions/GroupsSidebar (added) (history)
  • /trunk/extensions/GroupsSidebar/GroupsSidebar.body.php (added) (history)
  • /trunk/extensions/GroupsSidebar/GroupsSidebar.php (added) (history)

Diff [purge]

Index: trunk/extensions/GroupsSidebar/GroupsSidebar.php
@@ -0,0 +1,20 @@
 2+<?php
 3+# Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
 4+if (!defined('MEDIAWIKI')) {
 5+ exit( 1 );
 6+}
 7+
 8+$wgExtensionCredits['parserhook'][] = array(
 9+ 'name' => 'GroupsSidebar',
 10+ 'author' => 'Church of emacs',
 11+ 'url' => 'http://www.mediawiki.org/wiki/Extension:GroupsSidebar',
 12+ 'description' => 'Add sidebar element for specific user groups',
 13+ 'descriptionmsg' => 'myextension-desc',
 14+ 'version' => '0.1',
 15+);
 16+
 17+$dir = dirname(__FILE__) . '/';
 18+
 19+$wgAutoloadClasses['GroupsSidebar'] = $dir . 'GroupsSidebar.body.php'; # Tell MediaWiki to load the extension body.
 20+$wgHooks['SkinBuildSidebar'][] = array(new GroupsSidebar(), 'efHideSidebar');
 21+
Property changes on: trunk/extensions/GroupsSidebar/GroupsSidebar.php
___________________________________________________________________
Added: svn:eol-style
122 + native
Index: trunk/extensions/GroupsSidebar/GroupsSidebar.body.php
@@ -0,0 +1,19 @@
 2+<?php
 3+
 4+class GroupsSidebar {
 5+ /*
 6+ * Gets called by Hook SkinBuildSidebar
 7+ */
 8+ function efHideSidebar( $skin, &$bar ) {
 9+ global $wgGroupsSidebar, $wgUser;
 10+ if ( is_null($wgGroupsSidebar) )
 11+ return true;
 12+ foreach ( $wgGroupsSidebar as $group => $sectiontitle ) {
 13+ if (in_array($group, $wgUser->getEffectiveGroups())) {
 14+ $message = 'sidebar-'.$sectiontitle;
 15+ $skin->addToSidebar( &$bar, $message );
 16+ }
 17+ }
 18+ return true;
 19+ }
 20+}
Property changes on: trunk/extensions/GroupsSidebar/GroupsSidebar.body.php
___________________________________________________________________
Added: svn:eol-style
121 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r59338fixing r59216: adding i18n file for extension-descchurchofemacs18:05, 22 November 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59215Make adding sidebar elements easier for extensions (e.g. Extension:GroupsSide...churchofemacs21:06, 18 November 2009

Comments

#Comment by Siebrand (talk | contribs)   21:47, 18 November 2009

Has 'descriptionmsg' => 'myextension-desc' but no i18n file and wgExtensionMessagesFiles[]

Status & tagging log