Index: trunk/extensions/UserRightsNotif/UserRightsNotif.php |
— | — | @@ -11,43 +11,42 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 |
13 | 13 | */ |
14 | 14 | |
15 | | -if( defined( 'MEDIAWIKI' ) ) { |
| 15 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 16 | + echo( "This file is an extension to the MediaWiki software and cannot be executed standalone.\n" ); |
| 17 | + die( 1 ); |
| 18 | +} |
16 | 19 | |
17 | | - $wgExtensionFunctions[] = 'efUserRightsNotifierSetup'; |
18 | | - $wgExtensionCredits['other'][] = array( |
19 | | - 'path' => __FILE__, |
20 | | - 'name' => 'User Rights Email Notification', |
21 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:User_Rights_Email_Notification', |
22 | | - 'author' => 'Rob Church', |
23 | | - 'descriptionmsg' => 'userrightsnotif-desc', |
24 | | - ); |
| 20 | +$wgExtensionFunctions[] = 'efUserRightsNotifierSetup'; |
| 21 | +$wgExtensionCredits['other'][] = array( |
| 22 | + 'path' => __FILE__, |
| 23 | + 'name' => 'User Rights Email Notification', |
| 24 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:User_Rights_Email_Notification', |
| 25 | + 'author' => 'Rob Church', |
| 26 | + 'descriptionmsg' => 'userrightsnotif-desc', |
| 27 | +); |
25 | 28 | |
26 | | - $dir = dirname(__FILE__) . '/'; |
27 | | - $wgExtensionMessagesFiles['UserRightsNotif'] = $dir . 'UserRightsNotif.i18n.php'; |
| 29 | +$dir = dirname(__FILE__) . '/'; |
| 30 | +$wgExtensionMessagesFiles['UserRightsNotif'] = $dir . 'UserRightsNotif.i18n.php'; |
28 | 31 | |
29 | | - # Change this to alter the email sender |
30 | | - $wgUserRightsNotif['sender'] = $wgPasswordSender; |
| 32 | +# Change this to alter the email sender |
| 33 | +$wgUserRightsNotif['sender'] = $wgPasswordSender; |
31 | 34 | |
32 | | - function efUserRightsNotifierSetup() { |
33 | | - global $wgHooks; |
34 | | - wfLoadExtensionMessages( 'UserRightsNotif' ); |
35 | | - $wgHooks['UserRights'][] = 'efUserRightsNotifier'; |
36 | | - } |
| 35 | +function efUserRightsNotifierSetup() { |
| 36 | + global $wgHooks; |
| 37 | + wfLoadExtensionMessages( 'UserRightsNotif' ); |
| 38 | + $wgHooks['UserRights'][] = 'efUserRightsNotifier'; |
| 39 | +} |
37 | 40 | |
38 | | - function efUserRightsNotifier( &$user, $added, $removed ) { |
39 | | - global $wgUserRightsNotif; |
40 | | - if( $user->canReceiveEmail() ) { |
41 | | - global $wgUser, $wgSitename, $wgContLang; |
42 | | - $added = is_array( $added ) ? $wgContLang->commaList( $added ) : ''; |
43 | | - $removed = is_array( $removed ) ? $wgContLang->commaList( $removed ) : ''; |
44 | | - $subject = wfMsg( 'userrightsnotifysubject', $wgSitename ); |
45 | | - $message = wfMsg( 'userrightsnotifybody', $user->getName(), $wgSitename, $wgUser->getName(), $wgContLang->timeAndDate( wfTimestampNow() ), $added, $removed ); |
46 | | - $user->sendMail( $subject, $message, $wgUserRightsNotif['sender'] ); |
47 | | - } |
48 | | - return true; |
| 41 | +function efUserRightsNotifier( &$user, $added, $removed ) { |
| 42 | + global $wgUserRightsNotif; |
| 43 | + if( $user->canReceiveEmail() ) { |
| 44 | + global $wgUser, $wgSitename, $wgContLang; |
| 45 | + $added = is_array( $added ) ? $wgContLang->commaList( $added ) : ''; |
| 46 | + $removed = is_array( $removed ) ? $wgContLang->commaList( $removed ) : ''; |
| 47 | + $subject = wfMsg( 'userrightsnotifysubject', $wgSitename ); |
| 48 | + $message = wfMsg( 'userrightsnotifybody', $user->getName(), $wgSitename, $wgUser->getName(), $wgContLang->timeAndDate( wfTimestampNow() ), $added, $removed ); |
| 49 | + $user->sendMail( $subject, $message, $wgUserRightsNotif['sender'] ); |
49 | 50 | } |
50 | | - |
51 | | -} else { |
52 | | - echo( "This file is an extension to the MediaWiki software and cannot be executed standalone.\n" ); |
53 | | - die( 1 ); |
| 51 | + return true; |
54 | 52 | } |
| 53 | + |
Index: trunk/extensions/Logo/Logo.php |
— | — | @@ -8,29 +8,26 @@ |
9 | 9 | * @author Rob Church <robchur@gmail.com> |
10 | 10 | */ |
11 | 11 | |
12 | | -if( defined( 'MEDIAWIKI' ) ) { |
13 | | - |
14 | | - $wgExtensionFunctions[] = 'efLogo'; |
15 | | - $wgExtensionCredits['other'][] = array( 'name' => 'Logo', 'author' => 'Rob Church' ); |
16 | | - |
17 | | - function efLogo() { |
18 | | - global $wgLogo, $wgLogoAutoScale; |
19 | | - $msg = wfMsgForContent( 'logo' ); |
20 | | - if( $msg != '<logo>' ) { |
21 | | - $title = Title::newFromText( wfMsgForContent( 'logo' ) ); |
22 | | - if( is_object( $title ) ) { |
23 | | - if( $title->getNamespace() != NS_IMAGE ) |
24 | | - $title = Title::makeTitle( NS_IMAGE, $title->getText() ); |
25 | | - $logo = wfFindFile( $title ); |
26 | | - if( $logo->exists() ) |
27 | | - $wgLogo = $logo->createThumb( 135 ); |
28 | | - } |
29 | | - } |
30 | | - } |
31 | | - |
32 | | -} else { |
| 12 | +if( !defined( 'MEDIAWIKI' ) ) { |
33 | 13 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
34 | 14 | die( 1 ); |
35 | 15 | } |
36 | 16 | |
| 17 | +$wgExtensionFunctions[] = 'efLogo'; |
| 18 | +$wgExtensionCredits['other'][] = array( 'name' => 'Logo', 'author' => 'Rob Church' ); |
37 | 19 | |
| 20 | +function efLogo() { |
| 21 | + global $wgLogo, $wgLogoAutoScale; |
| 22 | + $msg = wfMsgForContent( 'logo' ); |
| 23 | + if( $msg != '<logo>' ) { |
| 24 | + $title = Title::newFromText( wfMsgForContent( 'logo' ) ); |
| 25 | + if( is_object( $title ) ) { |
| 26 | + if( $title->getNamespace() != NS_IMAGE ) |
| 27 | + $title = Title::makeTitle( NS_IMAGE, $title->getText() ); |
| 28 | + $logo = wfFindFile( $title ); |
| 29 | + if( $logo->exists() ) |
| 30 | + $wgLogo = $logo->createThumb( 135 ); |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | + |
Index: trunk/extensions/Sort/Sort.php |
— | — | @@ -10,41 +10,40 @@ |
11 | 11 | * @licence GNU General Public Licence 2.0 |
12 | 12 | */ |
13 | 13 | |
14 | | -if( defined( 'MEDIAWIKI' ) ) { |
| 14 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 15 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 16 | + exit( 1 ); |
| 17 | +} |
15 | 18 | |
16 | | - $wgAutoloadClasses['Sorter'] = dirname( __FILE__ ) . '/Sort.class.php'; |
17 | | - $wgExtensionFunctions[] = 'efSort'; |
18 | | - $wgExtensionCredits['parserhook'][] = array( |
19 | | - 'path' => __FILE__, |
20 | | - 'name' => 'Sort', |
21 | | - 'author' => 'Rob Church', |
22 | | - 'description' => 'Create simple sorted lists using <tt><sort></tt>', |
23 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Sort', |
24 | | - ); |
| 19 | +$wgAutoloadClasses['Sorter'] = dirname( __FILE__ ) . '/Sort.class.php'; |
| 20 | +$wgExtensionFunctions[] = 'efSort'; |
| 21 | +$wgExtensionCredits['parserhook'][] = array( |
| 22 | + 'path' => __FILE__, |
| 23 | + 'name' => 'Sort', |
| 24 | + 'author' => 'Rob Church', |
| 25 | + 'description' => 'Create simple sorted lists using <tt><sort></tt>', |
| 26 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Sort', |
| 27 | +); |
25 | 28 | |
26 | | - /** |
27 | | - * Register hook function |
28 | | - */ |
29 | | - function efSort() { |
30 | | - global $wgParser; |
31 | | - $wgParser->setHook( 'sort', 'efRenderSort' ); |
32 | | - } |
| 29 | +/** |
| 30 | + * Register hook function |
| 31 | + */ |
| 32 | +function efSort() { |
| 33 | + global $wgParser; |
| 34 | + $wgParser->setHook( 'sort', 'efRenderSort' ); |
| 35 | +} |
33 | 36 | |
34 | | - /** |
35 | | - * Hook callback for <sort> |
36 | | - * |
37 | | - * @param string $input Input text |
38 | | - * @param array $args Tag arguments |
39 | | - * @param Parser $parser Parent parser |
40 | | - * @return string |
41 | | - */ |
42 | | - function efRenderSort( $input, $args, &$parser ) { |
43 | | - $sorter = new Sorter( $parser ); |
44 | | - $sorter->loadSettings( $args ); |
45 | | - return $sorter->sort( $input ); |
46 | | - } |
47 | | - |
48 | | -} else { |
49 | | - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
50 | | - exit( 1 ); |
| 37 | +/** |
| 38 | + * Hook callback for <sort> |
| 39 | + * |
| 40 | + * @param string $input Input text |
| 41 | + * @param array $args Tag arguments |
| 42 | + * @param Parser $parser Parent parser |
| 43 | + * @return string |
| 44 | + */ |
| 45 | +function efRenderSort( $input, $args, &$parser ) { |
| 46 | + $sorter = new Sorter( $parser ); |
| 47 | + $sorter->loadSettings( $args ); |
| 48 | + return $sorter->sort( $input ); |
51 | 49 | } |
| 50 | + |
Index: trunk/extensions/ContributorsAddon/ContributorsAddon.php |
— | — | @@ -12,36 +12,36 @@ |
13 | 13 | * @author Tim Laqua <t.laqua@gmail.com> |
14 | 14 | */ |
15 | 15 | |
16 | | -if( defined( 'MEDIAWIKI' ) ) { |
17 | | - $wgExtensionFunctions[] = 'efContributorsAddon'; |
18 | | - $wgExtensionCredits['other'][] = array( |
19 | | - 'path' => __FILE__, |
20 | | - 'name' => 'ContributorsAddon', |
21 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributorsAddon', |
22 | | - 'author' => 'Tim Laqua', |
23 | | - 'descriptionmsg' => 'contributorsaddon-desc', |
24 | | - ); |
| 16 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 17 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 18 | + exit( 1 ); |
| 19 | +} |
25 | 20 | |
26 | | - $dir = dirname(__FILE__) . '/'; |
27 | | - $wgExtensionMessagesFiles['ContributorsAddon'] = $dir . 'ContributorsAddon.i18n.php'; |
28 | | - $wgAutoloadClasses['SpecialContributorsAddon'] = $dir . 'ContributorsAddonClass.php'; |
| 21 | +$wgExtensionFunctions[] = 'efContributorsAddon'; |
| 22 | +$wgExtensionCredits['other'][] = array( |
| 23 | + 'path' => __FILE__, |
| 24 | + 'name' => 'ContributorsAddon', |
| 25 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributorsAddon', |
| 26 | + 'author' => 'Tim Laqua', |
| 27 | + 'descriptionmsg' => 'contributorsaddon-desc', |
| 28 | +); |
29 | 29 | |
30 | | - function efContributorsAddon() { |
31 | | - global $wgHooks; |
32 | | - $wgHooks['OutputPageParserOutput'][] = 'efContributorsAddonSetup'; |
33 | | - return true; |
34 | | - } |
35 | | - |
36 | | - function efContributorsAddonSetup(&$out, $parseroutput) { |
37 | | - global $wgScriptPath; |
38 | | - $out->addScript( '<link rel="stylesheet" type="text/css" href="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.css" />' ); |
39 | | - $out->addScript( '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.js"><!-- ContributorsAddon js --></script>' ); |
40 | | - $spContribAddon = new SpecialContributorsAddon; |
41 | | - $out->addScript( "\n<script type=\"text/javascript\">\nvar contributorsText = \"". $spContribAddon->getContributorsText() . "\";\n</script>\n" ); |
42 | | - return true; |
43 | | - } |
| 30 | +$dir = dirname(__FILE__) . '/'; |
| 31 | +$wgExtensionMessagesFiles['ContributorsAddon'] = $dir . 'ContributorsAddon.i18n.php'; |
| 32 | +$wgAutoloadClasses['SpecialContributorsAddon'] = $dir . 'ContributorsAddonClass.php'; |
44 | 33 | |
45 | | -} else { |
46 | | - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
47 | | - exit( 1 ); |
| 34 | +function efContributorsAddon() { |
| 35 | + global $wgHooks; |
| 36 | + $wgHooks['OutputPageParserOutput'][] = 'efContributorsAddonSetup'; |
| 37 | + return true; |
48 | 38 | } |
| 39 | + |
| 40 | +function efContributorsAddonSetup(&$out, $parseroutput) { |
| 41 | + global $wgScriptPath; |
| 42 | + $out->addScript( '<link rel="stylesheet" type="text/css" href="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.css" />' ); |
| 43 | + $out->addScript( '<script type="text/javascript" src="' . $wgScriptPath . '/extensions/ContributorsAddon/ContributorsAddon.js"><!-- ContributorsAddon js --></script>' ); |
| 44 | + $spContribAddon = new SpecialContributorsAddon; |
| 45 | + $out->addScript( "\n<script type=\"text/javascript\">\nvar contributorsText = \"". $spContribAddon->getContributorsText() . "\";\n</script>\n" ); |
| 46 | + return true; |
| 47 | +} |
| 48 | + |
Index: trunk/extensions/RandomImage/RandomImage.php |
— | — | @@ -10,42 +10,41 @@ |
11 | 11 | * @licence GNU General Public Licence 2.0 |
12 | 12 | */ |
13 | 13 | |
14 | | -if( defined( 'MEDIAWIKI' ) ) { |
| 14 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 15 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 16 | + exit( 1 ); |
| 17 | +} |
15 | 18 | |
16 | | - $wgAutoloadClasses['RandomImage'] = dirname( __FILE__ ) . '/RandomImage.class.php'; |
17 | | - $wgExtensionCredits['parserhook'][] = array( |
18 | | - 'path' => __FILE__, |
19 | | - 'name' => 'RandomImage', |
20 | | - 'author' => 'Rob Church', |
21 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:RandomImage', |
22 | | - 'descriptionmsg' => 'randomimage-desc', |
23 | | - ); |
24 | | - $wgExtensionMessagesFiles['RandomImage'] = dirname(__FILE__) . '/RandomImage.i18n.php'; |
25 | | - $wgHooks['ParserAfterStrip'][] = 'RandomImage::stripHook'; |
26 | | - $wgHooks['ParserFirstCallInit'][] = 'efRandomImage'; |
| 19 | +$wgAutoloadClasses['RandomImage'] = dirname( __FILE__ ) . '/RandomImage.class.php'; |
| 20 | +$wgExtensionCredits['parserhook'][] = array( |
| 21 | + 'path' => __FILE__, |
| 22 | + 'name' => 'RandomImage', |
| 23 | + 'author' => 'Rob Church', |
| 24 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:RandomImage', |
| 25 | + 'descriptionmsg' => 'randomimage-desc', |
| 26 | +); |
| 27 | +$wgExtensionMessagesFiles['RandomImage'] = dirname(__FILE__) . '/RandomImage.i18n.php'; |
| 28 | +$wgHooks['ParserAfterStrip'][] = 'RandomImage::stripHook'; |
| 29 | +$wgHooks['ParserFirstCallInit'][] = 'efRandomImage'; |
27 | 30 | |
28 | | - /** |
29 | | - * Set this to true to disable the parser cache for pages which |
30 | | - * contain a <randomimage> tag; this keeps the galleries up to date |
31 | | - * at the cost of a performance overhead on page views |
32 | | - */ |
33 | | - $wgRandomImageNoCache = false; |
| 31 | +/** |
| 32 | + * Set this to true to disable the parser cache for pages which |
| 33 | + * contain a <randomimage> tag; this keeps the galleries up to date |
| 34 | + * at the cost of a performance overhead on page views |
| 35 | + */ |
| 36 | +$wgRandomImageNoCache = false; |
34 | 37 | |
35 | | - /** |
36 | | - * Set this to true to ensure that images selected from the database |
37 | | - * have an "IMAGE" MIME type |
38 | | - */ |
39 | | - $wgRandomImageStrict = !$wgMiserMode; |
| 38 | +/** |
| 39 | + * Set this to true to ensure that images selected from the database |
| 40 | + * have an "IMAGE" MIME type |
| 41 | + */ |
| 42 | +$wgRandomImageStrict = !$wgMiserMode; |
40 | 43 | |
41 | | - /** |
42 | | - * Hook setup |
43 | | - */ |
44 | | - function efRandomImage(&$parser) { |
45 | | - $parser->setHook( 'randomimage', 'RandomImage::renderHook' ); |
46 | | - return true; |
47 | | - } |
48 | | - |
49 | | -} else { |
50 | | - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
51 | | - exit( 1 ); |
| 44 | +/** |
| 45 | + * Hook setup |
| 46 | + */ |
| 47 | +function efRandomImage(&$parser) { |
| 48 | + $parser->setHook( 'randomimage', 'RandomImage::renderHook' ); |
| 49 | + return true; |
52 | 50 | } |
| 51 | + |
Index: trunk/extensions/FormatDates/FormatDates.php |
— | — | @@ -10,37 +10,35 @@ |
11 | 11 | * Please see the LICENCE file for terms of use and redistribution |
12 | 12 | */ |
13 | 13 | |
14 | | -if( defined( 'MEDIAWIKI' ) ) { |
| 14 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 15 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 16 | + exit( 1 ); |
| 17 | +} |
15 | 18 | |
16 | | - $wgAutoloadClasses['DateParser'] = dirname( __FILE__ ) . '/DateParser.php'; |
17 | | - $wgAutoloadClasses['FormattableDate'] = dirname( __FILE__ ) . '/FormattableDate.php'; |
18 | | - $wgExtensionFunctions[] = 'efFormatDates'; |
19 | | - |
20 | | - $wgExtensionCredits['parserhook'][] = array( |
21 | | - 'path' => __FILE__, |
22 | | - 'name' => 'Date Formatter', |
23 | | - 'author' => 'Rob Church', |
24 | | - 'description' => 'Supports refactoring of unlinked dates through the <code><nowiki><date></nowiki></code> tag', |
25 | | - ); |
| 19 | +$wgAutoloadClasses['DateParser'] = dirname( __FILE__ ) . '/DateParser.php'; |
| 20 | +$wgAutoloadClasses['FormattableDate'] = dirname( __FILE__ ) . '/FormattableDate.php'; |
| 21 | +$wgExtensionFunctions[] = 'efFormatDates'; |
26 | 22 | |
27 | | - function efFormatDates() { |
28 | | - global $wgParser; |
29 | | - $wgParser->setHook( 'date', 'efFormatDate' ); |
30 | | - } |
31 | | - |
32 | | - function efFormatDate( $text, $args, &$parser ) { |
33 | | - global $wgUseDynamicDates, $wgContLang; |
34 | | - if( $wgUseDynamicDates ) { |
35 | | - $dp = new DateParser( $wgContLang, DateParser::convertPref( $parser->getOptions()->getDateFormat() ) ); |
36 | | - return $dp->reformat( $text ); |
37 | | - } else { |
38 | | - return $text; |
39 | | - } |
40 | | - } |
| 23 | +$wgExtensionCredits['parserhook'][] = array( |
| 24 | + 'path' => __FILE__, |
| 25 | + 'name' => 'Date Formatter', |
| 26 | + 'author' => 'Rob Church', |
| 27 | + 'description' => 'Supports refactoring of unlinked dates through the <code><nowiki><date></nowiki></code> tag', |
| 28 | +); |
41 | 29 | |
42 | | -} else { |
43 | | - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
44 | | - exit( 1 ); |
| 30 | +function efFormatDates() { |
| 31 | + global $wgParser; |
| 32 | + $wgParser->setHook( 'date', 'efFormatDate' ); |
45 | 33 | } |
46 | 34 | |
| 35 | +function efFormatDate( $text, $args, &$parser ) { |
| 36 | + global $wgUseDynamicDates, $wgContLang; |
| 37 | + if( $wgUseDynamicDates ) { |
| 38 | + $dp = new DateParser( $wgContLang, DateParser::convertPref( $parser->getOptions()->getDateFormat() ) ); |
| 39 | + return $dp->reformat( $text ); |
| 40 | + } else { |
| 41 | + return $text; |
| 42 | + } |
| 43 | +} |
47 | 44 | |
| 45 | + |
Index: trunk/extensions/Contributors/Contributors.php |
— | — | @@ -8,93 +8,91 @@ |
9 | 9 | * @author Rob Church <robchur@gmail.com> |
10 | 10 | */ |
11 | 11 | |
12 | | -if( defined( 'MEDIAWIKI' ) ) { |
| 12 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 14 | + exit( 1 ); |
| 15 | +} |
13 | 16 | |
14 | | - $wgExtensionFunctions[] = 'efContributors'; |
15 | | - $wgExtensionCredits['specialpage'][] = array( |
16 | | - 'path' => __FILE__, |
17 | | - 'name' => 'Contributors', |
18 | | - 'version' => '1.0.1beta', |
19 | | - 'author' => 'Rob Church', |
20 | | - 'descriptionmsg' => 'contributors-desc', |
21 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributors', |
22 | | - ); |
| 17 | +$wgExtensionFunctions[] = 'efContributors'; |
| 18 | +$wgExtensionCredits['specialpage'][] = array( |
| 19 | + 'path' => __FILE__, |
| 20 | + 'name' => 'Contributors', |
| 21 | + 'version' => '1.0.1beta', |
| 22 | + 'author' => 'Rob Church', |
| 23 | + 'descriptionmsg' => 'contributors-desc', |
| 24 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Contributors', |
| 25 | +); |
23 | 26 | |
24 | | - $dir = dirname(__FILE__) . '/'; |
25 | | - $wgExtensionMessagesFiles['Contributors'] = $dir . 'Contributors.i18n.php'; |
26 | | - $wgExtensionAliasesFiles['Contributors'] = $dir . 'Contributors.alias.php'; |
27 | | - $wgAutoloadClasses['SpecialContributors'] = $dir . 'Contributors.page.php'; |
28 | | - $wgSpecialPages['Contributors'] = 'SpecialContributors'; |
29 | | - $wgSpecialPageGroups['Contributors'] = 'pages'; |
| 27 | +$dir = dirname(__FILE__) . '/'; |
| 28 | +$wgExtensionMessagesFiles['Contributors'] = $dir . 'Contributors.i18n.php'; |
| 29 | +$wgExtensionAliasesFiles['Contributors'] = $dir . 'Contributors.alias.php'; |
| 30 | +$wgAutoloadClasses['SpecialContributors'] = $dir . 'Contributors.page.php'; |
| 31 | +$wgSpecialPages['Contributors'] = 'SpecialContributors'; |
| 32 | +$wgSpecialPageGroups['Contributors'] = 'pages'; |
30 | 33 | |
31 | | - /** |
32 | | - * Intelligent cut-off limit; see below |
33 | | - */ |
34 | | - $wgContributorsLimit = 10; |
| 34 | +/** |
| 35 | + * Intelligent cut-off limit; see below |
| 36 | + */ |
| 37 | +$wgContributorsLimit = 10; |
35 | 38 | |
36 | | - /** |
37 | | - * After $wgContributorsLimit is reach, contributors with less than this |
38 | | - * number of edits to a page won't be listed in normal or inclusion lists |
39 | | - */ |
40 | | - $wgContributorsThreshold = 2; |
| 39 | +/** |
| 40 | + * After $wgContributorsLimit is reach, contributors with less than this |
| 41 | + * number of edits to a page won't be listed in normal or inclusion lists |
| 42 | + */ |
| 43 | +$wgContributorsThreshold = 2; |
41 | 44 | |
42 | | - /** |
43 | | - * Extension initialisation function |
44 | | - */ |
45 | | - function efContributors() { |
46 | | - global $wgHooks; |
| 45 | +/** |
| 46 | + * Extension initialisation function |
| 47 | + */ |
| 48 | +function efContributors() { |
| 49 | + global $wgHooks; |
47 | 50 | |
48 | | - wfLoadExtensionMessages( 'Contributors' ); |
49 | | - $wgHooks['ArticleDeleteComplete'][] = 'efContributorsInvalidateCache'; |
50 | | - $wgHooks['ArticleSaveComplete'][] = 'efContributorsInvalidateCache'; |
51 | | - # Good god, this is ludicrous! |
52 | | - $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efContributorsNavigation'; |
53 | | - $wgHooks['SkinTemplateToolboxEnd'][] = 'efContributorsToolbox'; |
54 | | - } |
| 51 | + wfLoadExtensionMessages( 'Contributors' ); |
| 52 | + $wgHooks['ArticleDeleteComplete'][] = 'efContributorsInvalidateCache'; |
| 53 | + $wgHooks['ArticleSaveComplete'][] = 'efContributorsInvalidateCache'; |
| 54 | + # Good god, this is ludicrous! |
| 55 | + $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efContributorsNavigation'; |
| 56 | + $wgHooks['SkinTemplateToolboxEnd'][] = 'efContributorsToolbox'; |
| 57 | +} |
55 | 58 | |
56 | | - /** |
57 | | - * Invalidate the cache we saved for a given title |
58 | | - * |
59 | | - * @param $article Article object that changed |
60 | | - */ |
61 | | - function efContributorsInvalidateCache( &$article ) { |
62 | | - global $wgMemc; |
63 | | - $wgMemc->delete( wfMemcKey( 'contributors', $article->getId() ) ); |
| 59 | +/** |
| 60 | + * Invalidate the cache we saved for a given title |
| 61 | + * |
| 62 | + * @param $article Article object that changed |
| 63 | + */ |
| 64 | +function efContributorsInvalidateCache( &$article ) { |
| 65 | + global $wgMemc; |
| 66 | + $wgMemc->delete( wfMemcKey( 'contributors', $article->getId() ) ); |
64 | 67 | |
65 | | - return true; |
66 | | - } |
| 68 | + return true; |
| 69 | +} |
67 | 70 | |
68 | | - /** |
69 | | - * Prepare the toolbox link |
70 | | - */ |
71 | | - function efContributorsNavigation( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { |
72 | | - if ( $skintemplate->mTitle->getNamespace() === NS_MAIN && $revid !== 0 ) |
73 | | - $nav_urls['contributors'] = array( |
74 | | - 'text' => wfMsg( 'contributors-toolbox' ), |
75 | | - 'href' => $skintemplate->makeSpecialUrl( 'Contributors', "target=" . wfUrlEncode( "{$skintemplate->thispage}" ) ) |
76 | | - ); |
77 | | - return true; |
78 | | - } |
| 71 | +/** |
| 72 | + * Prepare the toolbox link |
| 73 | + */ |
| 74 | +function efContributorsNavigation( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { |
| 75 | + if ( $skintemplate->mTitle->getNamespace() === NS_MAIN && $revid !== 0 ) |
| 76 | + $nav_urls['contributors'] = array( |
| 77 | + 'text' => wfMsg( 'contributors-toolbox' ), |
| 78 | + 'href' => $skintemplate->makeSpecialUrl( 'Contributors', "target=" . wfUrlEncode( "{$skintemplate->thispage}" ) ) |
| 79 | + ); |
| 80 | + return true; |
| 81 | +} |
79 | 82 | |
80 | | - /** |
81 | | - * Output the toolbox link |
82 | | - */ |
83 | | - function efContributorsToolbox( &$monobook ) { |
84 | | - if ( isset( $monobook->data['nav_urls']['contributors'] ) ) |
85 | | - if ( $monobook->data['nav_urls']['contributors']['href'] == '' ) { |
86 | | - ?><li id="t-iscontributors"><?php echo $monobook->msg( 'contributors-toolbox' ); ?></li><?php |
87 | | - } else { |
88 | | - ?><li id="t-contributors"><?php |
89 | | - ?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['contributors']['href'] ) ?>"><?php |
90 | | - echo $monobook->msg( 'contributors-toolbox' ); |
91 | | - ?></a><?php |
92 | | - ?></li><?php |
93 | | - } |
94 | | - return true; |
95 | | - } |
96 | | - |
97 | | -} else { |
98 | | - echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
99 | | - exit( 1 ); |
| 83 | +/** |
| 84 | + * Output the toolbox link |
| 85 | + */ |
| 86 | +function efContributorsToolbox( &$monobook ) { |
| 87 | + if ( isset( $monobook->data['nav_urls']['contributors'] ) ) |
| 88 | + if ( $monobook->data['nav_urls']['contributors']['href'] == '' ) { |
| 89 | + ?><li id="t-iscontributors"><?php echo $monobook->msg( 'contributors-toolbox' ); ?></li><?php |
| 90 | + } else { |
| 91 | + ?><li id="t-contributors"><?php |
| 92 | + ?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['contributors']['href'] ) ?>"><?php |
| 93 | + echo $monobook->msg( 'contributors-toolbox' ); |
| 94 | + ?></a><?php |
| 95 | + ?></li><?php |
| 96 | + } |
| 97 | + return true; |
100 | 98 | } |
101 | 99 | |
Index: trunk/extensions/FileSearch/FileSearch.php |
— | — | @@ -9,22 +9,20 @@ |
10 | 10 | * @author Rob Church <robchur@gmail.com> |
11 | 11 | */ |
12 | 12 | |
13 | | -if( defined( 'MEDIAWIKI' ) ) { |
14 | | - |
15 | | - $wgExtensionFunctions[] = 'efFileSearchSetup'; |
16 | | - $wgAutoloadClasses['FileSearchIndexer'] = dirname( __FILE__ ) . '/FileSearchIndexer.php'; |
17 | | - $wgAutoloadClasses['Extractor'] = dirname( __FILE__ ) . '/extract/Extractor.php'; |
18 | | - $wgFileSearchExtractors['TextExtractor'] = dirname( __FILE__ ) . '/extract/TextExtractor.php'; |
19 | | - |
20 | | - function efFileSearchSetup() { |
21 | | - global $wgHooks; |
22 | | - $wgHooks['FileUpload'][] = 'FileSearchIndexer::upload'; |
23 | | - $wgHooks['SearchUpdate'][] = 'FileSearchIndexer::index'; |
24 | | - #FileSearchIndexer::initialise(); |
25 | | - } |
26 | | - |
27 | | -} else { |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
28 | 14 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
29 | 15 | exit( 1 ); |
30 | 16 | } |
31 | 17 | |
| 18 | +$wgExtensionFunctions[] = 'efFileSearchSetup'; |
| 19 | +$wgAutoloadClasses['FileSearchIndexer'] = dirname( __FILE__ ) . '/FileSearchIndexer.php'; |
| 20 | +$wgAutoloadClasses['Extractor'] = dirname( __FILE__ ) . '/extract/Extractor.php'; |
| 21 | +$wgFileSearchExtractors['TextExtractor'] = dirname( __FILE__ ) . '/extract/TextExtractor.php'; |
| 22 | + |
| 23 | +function efFileSearchSetup() { |
| 24 | + global $wgHooks; |
| 25 | + $wgHooks['FileUpload'][] = 'FileSearchIndexer::upload'; |
| 26 | + $wgHooks['SearchUpdate'][] = 'FileSearchIndexer::index'; |
| 27 | + #FileSearchIndexer::initialise(); |
| 28 | +} |
| 29 | + |