r73450 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73449‎ | r73450 | r73451 >
Date:05:26, 21 September 2010
Author:nad
Status:deferred
Tags:
Comment:
make action tab work for vector based skins too
Modified paths:
  • /trunk/extensions/EmailPage/EmailPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EmailPage/EmailPage.php
@@ -10,36 +10,35 @@
1111 * @copyright © 2007 Aran Dunkley
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
 14+if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." );
1415
15 -if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' );
 16+define( 'EMAILPAGE_VERSION', "1.3.6, 2010-09-21" );
1617
17 -define( 'EMAILPAGE_VERSION', '1.3.5, 2010-09-17' );
18 -
19 -$wgEmailPageGroup = 'sysop'; # Users must belong to this group to send emails (empty string means anyone can send)
20 -$wgEmailPageContactsCat = ''; # This specifies the name of a category containing categories of contact pages
21 -$wgEmailPageCss = 'EmailPage.css'; # A minimal CSS page to embed in the email (eg. monobook/main.css without portlets, actions etc)
22 -$wgEmailPageAllowRemoteAddr = array( '127.0.0.1' ); # Allow anonymous sending from these addresses
 18+$wgEmailPageGroup = "sysop"; # Users must belong to this group to send emails (empty string means anyone can send)
 19+$wgEmailPageContactsCat = ""; # This specifies the name of a category containing categories of contact pages
 20+$wgEmailPageCss = "EmailPage.css"; # A minimal CSS page to embed in the email (eg. monobook/main.css without portlets, actions etc)
 21+$wgEmailPageAllowRemoteAddr = array( "127.0.0.1" ); # Allow anonymous sending from these addresses
2322 $wgEmailPageAllowAllUsers = false; # Whether to allow sending to all users (the "user" group)
2423 $wgEmailPageToolboxLink = true; # Add a link to the sidebar toolbox?
2524 $wgEmailPageActionLink = true; # Add a link to the actions links?
26 -$wgPhpMailerClass = dirname( __FILE__ ) . '/phpMailer_v2.1.0beta2/class.phpmailer.php'; # From http://phpmailer.sourceforge.net/
 25+$wgPhpMailerClass = dirname( __FILE__ ) . "/phpMailer_v2.1.0beta2/class.phpmailer.php"; # From http://phpmailer.sourceforge.net/
2726
28 -if ( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true;
 27+if( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true;
2928
30 -if ( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR'];
 29+if( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR'];
3130
3231 $dir = dirname( __FILE__ ) . '/';
33 -$wgAutoloadClasses['SpecialEmailPage'] = $dir . 'EmailPage_body.php';
34 -$wgExtensionMessagesFiles['EmailPage'] = $dir . 'EmailPage.i18n.php';
35 -$wgExtensionAliasesFiles['EmailPage'] = $dir . 'EmailPage.alias.php';
36 -$wgSpecialPages['EmailPage'] = 'SpecialEmailPage';
 32+$wgAutoloadClasses['SpecialEmailPage'] = $dir . "EmailPage_body.php";
 33+$wgExtensionMessagesFiles['EmailPage'] = $dir . "EmailPage.i18n.php";
 34+$wgExtensionAliasesFiles['EmailPage'] = $dir . "EmailPage.alias.php";
 35+$wgSpecialPages['EmailPage'] = "SpecialEmailPage";
3736
3837 $wgExtensionCredits['specialpage'][] = array(
3938 'path' => __FILE__,
40 - 'name' => 'EmailPage',
41 - 'author' => '[http://www.organicdesign.co.nz/nad User:Nad]',
42 - 'descriptionmsg' => 'ea-desc',
43 - 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailPage',
 39+ 'name' => "EmailPage",
 40+ 'author' => "[http://www.organicdesign.co.nz/nad User:Nad]",
 41+ 'descriptionmsg' => "ea-desc",
 42+ 'url' => "http://www.mediawiki.org/wiki/Extension:EmailPage",
4443 'version' => EMAILPAGE_VERSION
4544 );
4645
@@ -48,7 +47,10 @@
4948
5049 # Add toolbox and action links
5150 if ( $wgEmailPageToolboxLink ) $wgHooks['SkinTemplateToolboxEnd'][] = 'wfEmailPageToolboxLink';
52 -if ( $wgEmailPageActionLink ) $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink';
 51+if ( $wgEmailPageActionLink ) {
 52+ $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink';
 53+ $wgHooks['SkinTemplateNavigation'][] = 'wfEmailPageActionLinkVector';
 54+}
5355
5456 function wfEmailPageToolboxLink() {
5557 global $wgTitle, $wgUser, $wgEmailPageGroup;
@@ -67,3 +69,12 @@
6870 }
6971 return true;
7072 }
 73+
 74+function wfEmailPageActionLinkVector( $skin, &$actions ) {
 75+ global $wgTitle, $wgUser, $wgEmailPageGroup;
 76+ if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) {
 77+ $url = SpecialPage::getTitleFor( 'EmailPage' )->getLocalURL( array( 'ea-title' => $wgTitle->getPrefixedText() ) );
 78+ $actions['views']['email'] = array( 'text' => wfMsg( 'email' ), 'class' => false, 'href' => $url );
 79+ }
 80+ return true;
 81+}

Status & tagging log