http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70245
Revision: 70245 Author: platonides Date: 2010-07-31 22:08:58 +0000 (Sat, 31 Jul 2010) Log Message: ----------- Change from if (defined()) { code } else { die() } to if (!defined()) { die } code. Diffs best ignoring whitespace. Modified Paths: -------------- trunk/extensions/Contributors/Contributors.php trunk/extensions/ContributorsAddon/ContributorsAddon.php trunk/extensions/FileSearch/FileSearch.php trunk/extensions/FormatDates/FormatDates.php trunk/extensions/Logo/Logo.php trunk/extensions/RandomImage/RandomImage.php trunk/extensions/Sort/Sort.php trunk/extensions/UserRightsNotif/UserRightsNotif.php Modified: trunk/extensions/Contributors/Contributors.php =================================================================== --- trunk/extensions/Contributors/Contributors.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/Contributors/Contributors.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -8,93 +8,91 @@ * @author Rob Church <robc...@gmail.com> */ -if( defined( 'MEDIAWIKI' ) ) { +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); + exit( 1 ); +} - $wgExtensionFunctions[] = 'efContributors'; - $wgExtensionCredits['specialpage'][] = array( - 'path' => __FILE__, - 'name' => 'Contributors', - 'version' => '1.0.1beta', - 'author' => 'Rob Church', - 'descriptionmsg' => 'contributors-desc', - 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributors', - ); +$wgExtensionFunctions[] = 'efContributors'; +$wgExtensionCredits['specialpage'][] = array( + 'path' => __FILE__, + 'name' => 'Contributors', + 'version' => '1.0.1beta', + 'author' => 'Rob Church', + 'descriptionmsg' => 'contributors-desc', + 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributors', +); - $dir = dirname(__FILE__) . '/'; - $wgExtensionMessagesFiles['Contributors'] = $dir . 'Contributors.i18n.php'; - $wgExtensionAliasesFiles['Contributors'] = $dir . 'Contributors.alias.php'; - $wgAutoloadClasses['SpecialContributors'] = $dir . 'Contributors.page.php'; - $wgSpecialPages['Contributors'] = 'SpecialContributors'; - $wgSpecialPageGroups['Contributors'] = 'pages'; +$dir = dirname(__FILE__) . '/'; +$wgExtensionMessagesFiles['Contributors'] = $dir . 'Contributors.i18n.php'; +$wgExtensionAliasesFiles['Contributors'] = $dir . 'Contributors.alias.php'; +$wgAutoloadClasses['SpecialContributors'] = $dir . 'Contributors.page.php'; +$wgSpecialPages['Contributors'] = 'SpecialContributors'; +$wgSpecialPageGroups['Contributors'] = 'pages'; - /** - * Intelligent cut-off limit; see below - */ - $wgContributorsLimit = 10; +/** + * Intelligent cut-off limit; see below + */ +$wgContributorsLimit = 10; - /** - * After $wgContributorsLimit is reach, contributors with less than this - * number of edits to a page won't be listed in normal or inclusion lists - */ - $wgContributorsThreshold = 2; +/** + * After $wgContributorsLimit is reach, contributors with less than this + * number of edits to a page won't be listed in normal or inclusion lists + */ +$wgContributorsThreshold = 2; - /** - * Extension initialisation function - */ - function efContributors() { - global $wgHooks; +/** + * Extension initialisation function + */ +function efContributors() { + global $wgHooks; - wfLoadExtensionMessages( 'Contributors' ); - $wgHooks['ArticleDeleteComplete'][] = 'efContributorsInvalidateCache'; - $wgHooks['ArticleSaveComplete'][] = 'efContributorsInvalidateCache'; - # Good god, this is ludicrous! - $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efContributorsNavigation'; - $wgHooks['SkinTemplateToolboxEnd'][] = 'efContributorsToolbox'; - } + wfLoadExtensionMessages( 'Contributors' ); + $wgHooks['ArticleDeleteComplete'][] = 'efContributorsInvalidateCache'; + $wgHooks['ArticleSaveComplete'][] = 'efContributorsInvalidateCache'; + # Good god, this is ludicrous! + $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efContributorsNavigation'; + $wgHooks['SkinTemplateToolboxEnd'][] = 'efContributorsToolbox'; +} - /** - * Invalidate the cache we saved for a given title - * - * @param $article Article object that changed - */ - function efContributorsInvalidateCache( &$article ) { - global $wgMemc; - $wgMemc->delete( wfMemcKey( 'contributors', $article->getId() ) ); +/** + * Invalidate the cache we saved for a given title + * + * @param $article Article object that changed + */ +function efContributorsInvalidateCache( &$article ) { + global $wgMemc; + $wgMemc->delete( wfMemcKey( 'contributors', $article->getId() ) ); - return true; - } + return true; +} - /** - * Prepare the toolbox link - */ - function efContributorsNavigation( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { - if ( $skintemplate->mTitle->getNamespace() === NS_MAIN && $revid !== 0 ) - $nav_urls['contributors'] = array( - 'text' => wfMsg( 'contributors-toolbox' ), - 'href' => $skintemplate->makeSpecialUrl( 'Contributors', "target=" . wfUrlEncode( "{$skintemplate->thispage}" ) ) - ); - return true; - } +/** + * Prepare the toolbox link + */ +function efContributorsNavigation( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { + if ( $skintemplate->mTitle->getNamespace() === NS_MAIN && $revid !== 0 ) + $nav_urls['contributors'] = array( + 'text' => wfMsg( 'contributors-toolbox' ), + 'href' => $skintemplate->makeSpecialUrl( 'Contributors', "target=" . wfUrlEncode( "{$skintemplate->thispage}" ) ) + ); + return true; +} - /** - * Output the toolbox link - */ - function efContributorsToolbox( &$monobook ) { - if ( isset( $monobook->data['nav_urls']['contributors'] ) ) - if ( $monobook->data['nav_urls']['contributors']['href'] == '' ) { - ?><li id="t-iscontributors"><?php echo $monobook->msg( 'contributors-toolbox' ); ?></li><?php - } else { - ?><li id="t-contributors"><?php - ?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['contributors']['href'] ) ?>"><?php - echo $monobook->msg( 'contributors-toolbox' ); - ?></a><?php - ?></li><?php - } - return true; - } - -} else { - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); - exit( 1 ); +/** + * Output the toolbox link + */ +function efContributorsToolbox( &$monobook ) { + if ( isset( $monobook->data['nav_urls']['contributors'] ) ) + if ( $monobook->data['nav_urls']['contributors']['href'] == '' ) { + ?><li id="t-iscontributors"><?php echo $monobook->msg( 'contributors-toolbox' ); ?></li><?php + } else { + ?><li id="t-contributors"><?php + ?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['contributors']['href'] ) ?>"><?php + echo $monobook->msg( 'contributors-toolbox' ); + ?></a><?php + ?></li><?php + } + return true; } Modified: trunk/extensions/ContributorsAddon/ContributorsAddon.php =================================================================== --- trunk/extensions/ContributorsAddon/ContributorsAddon.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/ContributorsAddon/ContributorsAddon.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -12,36 +12,36 @@ * @author Tim Laqua <t.la...@gmail.com> */ -if( defined( 'MEDIAWIKI' ) ) { - $wgExtensionFunctions[] = 'efContributorsAddon'; - $wgExtensionCredits['other'][] = array( - 'path' => __FILE__, - 'name' => 'ContributorsAddon', - 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributorsAddon', - 'author' => 'Tim Laqua', - 'descriptionmsg' => 'contributorsaddon-desc', - ); +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); + exit( 1 ); +} - $dir = dirname(__FILE__) . '/'; - $wgExtensionMessagesFiles['ContributorsAddon'] = $dir . 'ContributorsAddon.i18n.php'; - $wgAutoloadClasses['SpecialContributorsAddon'] = $dir . 'ContributorsAddonClass.php'; +$wgExtensionFunctions[] = 'efContributorsAddon'; +$wgExtensionCredits['other'][] = array( + 'path' => __FILE__, + 'name' => 'ContributorsAddon', + 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributorsAddon', + 'author' => 'Tim Laqua', + 'descriptionmsg' => 'contributorsaddon-desc', +); - function efContributorsAddon() { - global $wgHooks; - $wgHooks['OutputPageParserOutput'][] = 'efContributorsAddonSetup'; - return true; - } - - function efContributorsAddonSetup(&$out, $parseroutput) { - global $wgScriptPath; - $out->addScript( '<link rel="stylesheet" type="text/css" href="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.css" />' ); - $out->addScript( '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.js"><!-- ContributorsAddon js --></script>' ); - $spContribAddon = new SpecialContributorsAddon; - $out->addScript( "\n<script type=\"text/javascript\">\nvar contributorsText = \"". $spContribAddon->getContributorsText() . "\";\n</script>\n" ); - return true; - } +$dir = dirname(__FILE__) . '/'; +$wgExtensionMessagesFiles['ContributorsAddon'] = $dir . 'ContributorsAddon.i18n.php'; +$wgAutoloadClasses['SpecialContributorsAddon'] = $dir . 'ContributorsAddonClass.php'; -} else { - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); - exit( 1 ); +function efContributorsAddon() { + global $wgHooks; + $wgHooks['OutputPageParserOutput'][] = 'efContributorsAddonSetup'; + return true; } + +function efContributorsAddonSetup(&$out, $parseroutput) { + global $wgScriptPath; + $out->addScript( '<link rel="stylesheet" type="text/css" href="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.css" />' ); + $out->addScript( '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.js"><!-- ContributorsAddon js --></script>' ); + $spContribAddon = new SpecialContributorsAddon; + $out->addScript( "\n<script type=\"text/javascript\">\nvar contributorsText = \"". $spContribAddon->getContributorsText() . "\";\n</script>\n" ); + return true; +} + Modified: trunk/extensions/FileSearch/FileSearch.php =================================================================== --- trunk/extensions/FileSearch/FileSearch.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/FileSearch/FileSearch.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -9,22 +9,20 @@ * @author Rob Church <robc...@gmail.com> */ -if( defined( 'MEDIAWIKI' ) ) { - - $wgExtensionFunctions[] = 'efFileSearchSetup'; - $wgAutoloadClasses['FileSearchIndexer'] = dirname( __FILE__ ) . '/FileSearchIndexer.php'; - $wgAutoloadClasses['Extractor'] = dirname( __FILE__ ) . '/extract/Extractor.php'; - $wgFileSearchExtractors['TextExtractor'] = dirname( __FILE__ ) . '/extract/TextExtractor.php'; - - function efFileSearchSetup() { - global $wgHooks; - $wgHooks['FileUpload'][] = 'FileSearchIndexer::upload'; - $wgHooks['SearchUpdate'][] = 'FileSearchIndexer::index'; - #FileSearchIndexer::initialise(); - } - -} else { +if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); exit( 1 ); } +$wgExtensionFunctions[] = 'efFileSearchSetup'; +$wgAutoloadClasses['FileSearchIndexer'] = dirname( __FILE__ ) . '/FileSearchIndexer.php'; +$wgAutoloadClasses['Extractor'] = dirname( __FILE__ ) . '/extract/Extractor.php'; +$wgFileSearchExtractors['TextExtractor'] = dirname( __FILE__ ) . '/extract/TextExtractor.php'; + +function efFileSearchSetup() { + global $wgHooks; + $wgHooks['FileUpload'][] = 'FileSearchIndexer::upload'; + $wgHooks['SearchUpdate'][] = 'FileSearchIndexer::index'; + #FileSearchIndexer::initialise(); +} + Modified: trunk/extensions/FormatDates/FormatDates.php =================================================================== --- trunk/extensions/FormatDates/FormatDates.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/FormatDates/FormatDates.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -10,37 +10,35 @@ * Please see the LICENCE file for terms of use and redistribution */ -if( defined( 'MEDIAWIKI' ) ) { +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); + exit( 1 ); +} - $wgAutoloadClasses['DateParser'] = dirname( __FILE__ ) . '/DateParser.php'; - $wgAutoloadClasses['FormattableDate'] = dirname( __FILE__ ) . '/FormattableDate.php'; - $wgExtensionFunctions[] = 'efFormatDates'; - - $wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'Date Formatter', - 'author' => 'Rob Church', - 'description' => 'Supports refactoring of unlinked dates through the <code><nowiki><date></nowiki></code> tag', - ); +$wgAutoloadClasses['DateParser'] = dirname( __FILE__ ) . '/DateParser.php'; +$wgAutoloadClasses['FormattableDate'] = dirname( __FILE__ ) . '/FormattableDate.php'; +$wgExtensionFunctions[] = 'efFormatDates'; - function efFormatDates() { - global $wgParser; - $wgParser->setHook( 'date', 'efFormatDate' ); - } - - function efFormatDate( $text, $args, &$parser ) { - global $wgUseDynamicDates, $wgContLang; - if( $wgUseDynamicDates ) { - $dp = new DateParser( $wgContLang, DateParser::convertPref( $parser->getOptions()->getDateFormat() ) ); - return $dp->reformat( $text ); - } else { - return $text; - } - } +$wgExtensionCredits['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'Date Formatter', + 'author' => 'Rob Church', + 'description' => 'Supports refactoring of unlinked dates through the <code><nowiki><date></nowiki></code> tag', +); -} else { - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); - exit( 1 ); +function efFormatDates() { + global $wgParser; + $wgParser->setHook( 'date', 'efFormatDate' ); } +function efFormatDate( $text, $args, &$parser ) { + global $wgUseDynamicDates, $wgContLang; + if( $wgUseDynamicDates ) { + $dp = new DateParser( $wgContLang, DateParser::convertPref( $parser->getOptions()->getDateFormat() ) ); + return $dp->reformat( $text ); + } else { + return $text; + } +} + Modified: trunk/extensions/Logo/Logo.php =================================================================== --- trunk/extensions/Logo/Logo.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/Logo/Logo.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -8,29 +8,26 @@ * @author Rob Church <robc...@gmail.com> */ -if( defined( 'MEDIAWIKI' ) ) { - - $wgExtensionFunctions[] = 'efLogo'; - $wgExtensionCredits['other'][] = array( 'name' => 'Logo', 'author' => 'Rob Church' ); - - function efLogo() { - global $wgLogo, $wgLogoAutoScale; - $msg = wfMsgForContent( 'logo' ); - if( $msg != '<logo>' ) { - $title = Title::newFromText( wfMsgForContent( 'logo' ) ); - if( is_object( $title ) ) { - if( $title->getNamespace() != NS_IMAGE ) - $title = Title::makeTitle( NS_IMAGE, $title->getText() ); - $logo = wfFindFile( $title ); - if( $logo->exists() ) - $wgLogo = $logo->createThumb( 135 ); - } - } - } - -} else { +if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); die( 1 ); } +$wgExtensionFunctions[] = 'efLogo'; +$wgExtensionCredits['other'][] = array( 'name' => 'Logo', 'author' => 'Rob Church' ); +function efLogo() { + global $wgLogo, $wgLogoAutoScale; + $msg = wfMsgForContent( 'logo' ); + if( $msg != '<logo>' ) { + $title = Title::newFromText( wfMsgForContent( 'logo' ) ); + if( is_object( $title ) ) { + if( $title->getNamespace() != NS_IMAGE ) + $title = Title::makeTitle( NS_IMAGE, $title->getText() ); + $logo = wfFindFile( $title ); + if( $logo->exists() ) + $wgLogo = $logo->createThumb( 135 ); + } + } +} + Modified: trunk/extensions/RandomImage/RandomImage.php =================================================================== --- trunk/extensions/RandomImage/RandomImage.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/RandomImage/RandomImage.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -10,42 +10,41 @@ * @licence GNU General Public Licence 2.0 */ -if( defined( 'MEDIAWIKI' ) ) { +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); + exit( 1 ); +} - $wgAutoloadClasses['RandomImage'] = dirname( __FILE__ ) . '/RandomImage.class.php'; - $wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'RandomImage', - 'author' => 'Rob Church', - 'url' => 'http://www.mediawiki.org/wiki/Extension:RandomImage', - 'descriptionmsg' => 'randomimage-desc', - ); - $wgExtensionMessagesFiles['RandomImage'] = dirname(__FILE__) . '/RandomImage.i18n.php'; - $wgHooks['ParserAfterStrip'][] = 'RandomImage::stripHook'; - $wgHooks['ParserFirstCallInit'][] = 'efRandomImage'; +$wgAutoloadClasses['RandomImage'] = dirname( __FILE__ ) . '/RandomImage.class.php'; +$wgExtensionCredits['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'RandomImage', + 'author' => 'Rob Church', + 'url' => 'http://www.mediawiki.org/wiki/Extension:RandomImage', + 'descriptionmsg' => 'randomimage-desc', +); +$wgExtensionMessagesFiles['RandomImage'] = dirname(__FILE__) . '/RandomImage.i18n.php'; +$wgHooks['ParserAfterStrip'][] = 'RandomImage::stripHook'; +$wgHooks['ParserFirstCallInit'][] = 'efRandomImage'; - /** - * Set this to true to disable the parser cache for pages which - * contain a <randomimage> tag; this keeps the galleries up to date - * at the cost of a performance overhead on page views - */ - $wgRandomImageNoCache = false; +/** + * Set this to true to disable the parser cache for pages which + * contain a <randomimage> tag; this keeps the galleries up to date + * at the cost of a performance overhead on page views + */ +$wgRandomImageNoCache = false; - /** - * Set this to true to ensure that images selected from the database - * have an "IMAGE" MIME type - */ - $wgRandomImageStrict = !$wgMiserMode; +/** + * Set this to true to ensure that images selected from the database + * have an "IMAGE" MIME type + */ +$wgRandomImageStrict = !$wgMiserMode; - /** - * Hook setup - */ - function efRandomImage(&$parser) { - $parser->setHook( 'randomimage', 'RandomImage::renderHook' ); - return true; - } - -} else { - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); - exit( 1 ); +/** + * Hook setup + */ +function efRandomImage(&$parser) { + $parser->setHook( 'randomimage', 'RandomImage::renderHook' ); + return true; } + Modified: trunk/extensions/Sort/Sort.php =================================================================== --- trunk/extensions/Sort/Sort.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/Sort/Sort.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -10,41 +10,40 @@ * @licence GNU General Public Licence 2.0 */ -if( defined( 'MEDIAWIKI' ) ) { +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); + exit( 1 ); +} - $wgAutoloadClasses['Sorter'] = dirname( __FILE__ ) . '/Sort.class.php'; - $wgExtensionFunctions[] = 'efSort'; - $wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'Sort', - 'author' => 'Rob Church', - 'description' => 'Create simple sorted lists using <tt><sort></tt>', - 'url' => 'http://www.mediawiki.org/wiki/Extension:Sort', - ); +$wgAutoloadClasses['Sorter'] = dirname( __FILE__ ) . '/Sort.class.php'; +$wgExtensionFunctions[] = 'efSort'; +$wgExtensionCredits['parserhook'][] = array( + 'path' => __FILE__, + 'name' => 'Sort', + 'author' => 'Rob Church', + 'description' => 'Create simple sorted lists using <tt><sort></tt>', + 'url' => 'http://www.mediawiki.org/wiki/Extension:Sort', +); - /** - * Register hook function - */ - function efSort() { - global $wgParser; - $wgParser->setHook( 'sort', 'efRenderSort' ); - } +/** + * Register hook function + */ +function efSort() { + global $wgParser; + $wgParser->setHook( 'sort', 'efRenderSort' ); +} - /** - * Hook callback for <sort> - * - * @param string $input Input text - * @param array $args Tag arguments - * @param Parser $parser Parent parser - * @return string - */ - function efRenderSort( $input, $args, &$parser ) { - $sorter = new Sorter( $parser ); - $sorter->loadSettings( $args ); - return $sorter->sort( $input ); - } - -} else { - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); - exit( 1 ); +/** + * Hook callback for <sort> + * + * @param string $input Input text + * @param array $args Tag arguments + * @param Parser $parser Parent parser + * @return string + */ +function efRenderSort( $input, $args, &$parser ) { + $sorter = new Sorter( $parser ); + $sorter->loadSettings( $args ); + return $sorter->sort( $input ); } + Modified: trunk/extensions/UserRightsNotif/UserRightsNotif.php =================================================================== --- trunk/extensions/UserRightsNotif/UserRightsNotif.php 2010-07-31 21:57:16 UTC (rev 70244) +++ trunk/extensions/UserRightsNotif/UserRightsNotif.php 2010-07-31 22:08:58 UTC (rev 70245) @@ -11,43 +11,42 @@ * @licence GNU General Public Licence 2.0 */ -if( defined( 'MEDIAWIKI' ) ) { +if( !defined( 'MEDIAWIKI' ) ) { + echo( "This file is an extension to the MediaWiki software and cannot be executed standalone.\n" ); + die( 1 ); +} - $wgExtensionFunctions[] = 'efUserRightsNotifierSetup'; - $wgExtensionCredits['other'][] = array( - 'path' => __FILE__, - 'name' => 'User Rights Email Notification', - 'url' => 'http://www.mediawiki.org/wiki/Extension:User_Rights_Email_Notification', - 'author' => 'Rob Church', - 'descriptionmsg' => 'userrightsnotif-desc', - ); +$wgExtensionFunctions[] = 'efUserRightsNotifierSetup'; +$wgExtensionCredits['other'][] = array( + 'path' => __FILE__, + 'name' => 'User Rights Email Notification', + 'url' => 'http://www.mediawiki.org/wiki/Extension:User_Rights_Email_Notification', + 'author' => 'Rob Church', + 'descriptionmsg' => 'userrightsnotif-desc', +); - $dir = dirname(__FILE__) . '/'; - $wgExtensionMessagesFiles['UserRightsNotif'] = $dir . 'UserRightsNotif.i18n.php'; +$dir = dirname(__FILE__) . '/'; +$wgExtensionMessagesFiles['UserRightsNotif'] = $dir . 'UserRightsNotif.i18n.php'; - # Change this to alter the email sender - $wgUserRightsNotif['sender'] = $wgPasswordSender; +# Change this to alter the email sender +$wgUserRightsNotif['sender'] = $wgPasswordSender; - function efUserRightsNotifierSetup() { - global $wgHooks; - wfLoadExtensionMessages( 'UserRightsNotif' ); - $wgHooks['UserRights'][] = 'efUserRightsNotifier'; - } +function efUserRightsNotifierSetup() { + global $wgHooks; + wfLoadExtensionMessages( 'UserRightsNotif' ); + $wgHooks['UserRights'][] = 'efUserRightsNotifier'; +} - function efUserRightsNotifier( &$user, $added, $removed ) { - global $wgUserRightsNotif; - if( $user->canReceiveEmail() ) { - global $wgUser, $wgSitename, $wgContLang; - $added = is_array( $added ) ? $wgContLang->commaList( $added ) : ''; - $removed = is_array( $removed ) ? $wgContLang->commaList( $removed ) : ''; - $subject = wfMsg( 'userrightsnotifysubject', $wgSitename ); - $message = wfMsg( 'userrightsnotifybody', $user->getName(), $wgSitename, $wgUser->getName(), $wgContLang->timeAndDate( wfTimestampNow() ), $added, $removed ); - $user->sendMail( $subject, $message, $wgUserRightsNotif['sender'] ); - } - return true; +function efUserRightsNotifier( &$user, $added, $removed ) { + global $wgUserRightsNotif; + if( $user->canReceiveEmail() ) { + global $wgUser, $wgSitename, $wgContLang; + $added = is_array( $added ) ? $wgContLang->commaList( $added ) : ''; + $removed = is_array( $removed ) ? $wgContLang->commaList( $removed ) : ''; + $subject = wfMsg( 'userrightsnotifysubject', $wgSitename ); + $message = wfMsg( 'userrightsnotifybody', $user->getName(), $wgSitename, $wgUser->getName(), $wgContLang->timeAndDate( wfTimestampNow() ), $added, $removed ); + $user->sendMail( $subject, $message, $wgUserRightsNotif['sender'] ); } - -} else { - echo( "This file is an extension to the MediaWiki software and cannot be executed standalone.\n" ); - die( 1 ); + return true; } + _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs