Index: trunk/extensions/NewsChannel/NewsChannel.class.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
| 4 | + |
| 5 | +class LinkNewsChannel { |
| 6 | + static function ExtensionFeeds() { |
| 7 | + global $wgOut, $wgNewsChannelTitle; |
| 8 | + |
| 9 | + $title = Title::newFromText( 'NewsChannel', NS_SPECIAL ); |
| 10 | + $wgOut->addLink( array( |
| 11 | + 'rel' => 'alternate', |
| 12 | + 'type' => 'application/rss+xml', |
| 13 | + 'title' => $wgNewsChannelTitle . ' - RSS 2.0', |
| 14 | + 'href' => $title->getLocalURL( 'format=rss20' ) ) ); |
| 15 | + $wgOut->addLink( array( |
| 16 | + 'rel' => 'alternate', |
| 17 | + 'type' => 'application/atom+xml', |
| 18 | + 'title' => $wgNewsChannelTitle . ' - Atom 1.0', |
| 19 | + 'href' => $title->getLocalURL( 'format=atom10' ) ) ); |
| 20 | + |
| 21 | + return true; |
| 22 | + } |
| 23 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/NewsChannel/NewsChannel.class.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
Added: svn:eol-style |
1 | 24 | + native |
Added: svn:keywords |
2 | 25 | + Id |
Index: trunk/extensions/NewsChannel/NewsChannel.alias.php |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Aliases for special pages |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$aliases = array(); |
| 11 | + |
| 12 | +/** English */ |
| 13 | +$aliases['en'] = array( |
| 14 | + 'NewsChannel' => array( 'NewsChannel' ), |
| 15 | +); |
Property changes on: trunk/extensions/NewsChannel/NewsChannel.alias.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 16 | + native |
Added: svn:keywords |
2 | 17 | + Id |
Index: trunk/extensions/NewsChannel/NewsChannel_body.php |
— | — | @@ -1,4 +1,5 @@ |
2 | 2 | <?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
3 | 4 | /** |
4 | 5 | * News Channel extension 1.6 |
5 | 6 | * This MediaWiki extension represents a RSS 2.0/Atom 1.0 news channel for wiki project. |
— | — | @@ -25,8 +26,6 @@ |
26 | 27 | * Constructor is used to initialize class member variables and load extension messages. |
27 | 28 | */ |
28 | 29 | function NewsChannel() { |
29 | | - |
30 | | - wfLoadExtensionMessages( 'NewsChannel' ); |
31 | 30 | SpecialPage::SpecialPage( 'NewsChannel' ); |
32 | 31 | } |
33 | 32 | |
— | — | @@ -39,6 +38,8 @@ |
40 | 39 | function execute( $par ) { |
41 | 40 | global $wgRequest, $wgVersion, $wgOut, $wgNewsChannelCategory, $wgNewsChannelDefaultItems; |
42 | 41 | |
| 42 | + wfLoadExtensionMessages( 'NewsChannel' ); |
| 43 | + |
43 | 44 | if( version_compare( $wgVersion, '1.8', '<' ) === true ) { |
44 | 45 | $wgOut->showErrorPage( "Error: Upgrade required", "The News Channel extension can't work " . |
45 | 46 | "on MediaWiki older than 1.8. Please, upgrade." ); |
— | — | @@ -141,7 +142,7 @@ |
142 | 143 | $exCatSqlQueryStr = ''; |
143 | 144 | |
144 | 145 | if ( $subquerySupport == false ) { |
145 | | - $sqlQueryStr = |
| 146 | + $sqlQueryStr = |
146 | 147 | "SELECT {$catlinksTableName}.cl_from, " . |
147 | 148 | "MIN({$catlinksTableName}.cl_timestamp) AS timestamp, COUNT(*) AS match_count, " . |
148 | 149 | "{$pageTableName}.page_namespace AS ns, {$pageTableName}.page_title AS title, " . |
— | — | @@ -240,8 +241,8 @@ |
241 | 242 | function formatFeedHeader() { |
242 | 243 | global $wgRequest, $wgServer, $wgContLanguageCode, $wgOut; |
243 | 244 | global $wgNewsChannelTitle, $wgNewsChannelDescription, $wgNewsChannelCopyright, |
244 | | - $wgNewsChannelLanguage, $wgNewsChannelLogoImage, $wgNewsChannelUpdateInterval, |
245 | | - $wgNewsChannelEditorName, $wgNewsChannelEditorAddress, $wgNewsChannelWebMasterName, |
| 245 | + $wgNewsChannelLanguage, $wgNewsChannelLogoImage, $wgNewsChannelUpdateInterval, |
| 246 | + $wgNewsChannelEditorName, $wgNewsChannelEditorAddress, $wgNewsChannelWebMasterName, |
246 | 247 | $wgNewsChannelWebMasterAddress; |
247 | 248 | |
248 | 249 | if( empty( $wgNewsChannelLanguage ) ) |
— | — | @@ -429,4 +430,3 @@ |
430 | 431 | </form>' . "\n" ); |
431 | 432 | } |
432 | 433 | } |
433 | | -?> |
\ No newline at end of file |
Index: trunk/extensions/NewsChannel/NewsChannel.i18n.php |
— | — | @@ -10,17 +10,16 @@ |
11 | 11 | * Extension's home page: http://www.mediawiki.org/wiki/Extension:News_Channel |
12 | 12 | * |
13 | 13 | * Distributed under GNU General Public License 2.0 or later (http://www.gnu.org/copyleft/gpl.html) |
14 | | -* Authors: |
15 | | -* English messages: Iaroslav Vassiliev |
16 | | -* Russian messages: Iaroslav Vassiliev |
17 | | -* German messages: Cornelius Sicker |
18 | | -* French messages: Mauro Bornet |
19 | 14 | */ |
20 | 15 | |
21 | 16 | $messages = array(); |
22 | 17 | |
23 | | -$messages['en'] = array( |
| 18 | +/** English |
| 19 | + * @author Iaroslav Vassiliev |
| 20 | + */ |
| 21 | +$messages['en'] = array( |
24 | 22 | 'newschannel' => 'News channel', |
| 23 | + 'newschannel-desc' => 'Implements a news channel as a dynamic [[Special:NewsChannel|special page]]', |
25 | 24 | 'newschannel_format' => 'Format:', |
26 | 25 | 'newschannel_limit' => 'Limit:', |
27 | 26 | 'newschannel_include_category' => 'Additional category:', |
— | — | @@ -28,16 +27,10 @@ |
29 | 28 | 'newschannel_submit_button' => 'Create feed', |
30 | 29 | ); |
31 | 30 | |
32 | | -$messages['ru'] = array( |
33 | | - 'newschannel' => 'Канал новостей', |
34 | | - 'newschannel_format' => 'Формат новостей:', |
35 | | - 'newschannel_limit' => 'Кол-во последних новостей:', |
36 | | - 'newschannel_include_category' => 'Дополнительная категория:', |
37 | | - 'newschannel_exclude_category' => 'Исключить категорию:', |
38 | | - 'newschannel_submit_button' => 'Вывести', |
39 | | -); |
40 | | - |
41 | | -$messages['de'] = array( |
| 31 | +/** German (Deutsch) |
| 32 | + * @author Cornelius Sicker |
| 33 | + */ |
| 34 | +$messages['de'] = array( |
42 | 35 | 'newschannel' => 'Nachrichten', |
43 | 36 | 'newschannel_format' => 'Format:', |
44 | 37 | 'newschannel_limit' => 'Limit:', |
— | — | @@ -46,7 +39,10 @@ |
47 | 40 | 'newschannel_submit_button' => 'Feed erstellen', |
48 | 41 | ); |
49 | 42 | |
50 | | -$messages['fr'] = array( |
| 43 | +/** French (Français) |
| 44 | + * @author Mauro Bornet |
| 45 | + */ |
| 46 | +$messages['fr'] = array( |
51 | 47 | 'newschannel' => 'Chaîne d\'information', |
52 | 48 | 'newschannel_format' => 'Format:', |
53 | 49 | 'newschannel_limit' => 'Limite:', |
— | — | @@ -54,4 +50,15 @@ |
55 | 51 | 'newschannel_exclude_category' => 'Catégorie(s) exclue(s):', |
56 | 52 | 'newschannel_submit_button' => 'Créer le flux', |
57 | 53 | ); |
58 | | -?> |
\ No newline at end of file |
| 54 | + |
| 55 | +/** Russian (Русский) |
| 56 | + * @author Iaroslav Vassiliev |
| 57 | + */ |
| 58 | +$messages['ru'] = array( |
| 59 | + 'newschannel' => 'Канал новостей', |
| 60 | + 'newschannel_format' => 'Формат новостей:', |
| 61 | + 'newschannel_limit' => 'Кол-во последних новостей:', |
| 62 | + 'newschannel_include_category' => 'Дополнительная категория:', |
| 63 | + 'newschannel_exclude_category' => 'Исключить категорию:', |
| 64 | + 'newschannel_submit_button' => 'Вывести', |
| 65 | +); |
Index: trunk/extensions/NewsChannel/NewsChannel.php |
— | — | @@ -13,6 +13,14 @@ |
14 | 14 | * Distributed under GNU General Public License 2.0 or later (http://www.gnu.org/copyleft/gpl.html) |
15 | 15 | */ |
16 | 16 | |
| 17 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 18 | + echo <<<EOT |
| 19 | +To install this extension, put the following line in LocalSettings.php: |
| 20 | +require_once( "\$IP/extensions/NewsChannel/NewsChannel.php" ); |
| 21 | +EOT; |
| 22 | + exit( 1 ); |
| 23 | +} |
| 24 | + |
17 | 25 | // Set up general channel info here |
18 | 26 | |
19 | 27 | /** Channel title. */ |
— | — | @@ -21,7 +29,7 @@ |
22 | 30 | $wgNewsChannelDescription = 'The most hot IT news on MyWikiSite.com.'; |
23 | 31 | /** |
24 | 32 | * Channel's language code and optional country subcode, e. g. 'en-US'. |
25 | | -* Default is language, specified in $wgLanguageCode variable in LocalSettings.php file. |
| 33 | +* Default is language, specified in $wgLanguageCode variable in LocalSettings.php file. |
26 | 34 | */ |
27 | 35 | $wgNewsChannelLanguage = ''; |
28 | 36 | /** Copyright text. */ |
— | — | @@ -66,44 +74,20 @@ |
67 | 75 | |
68 | 76 | // End of configuration settings |
69 | 77 | |
70 | | -if ( !defined( 'MEDIAWIKI' ) ) { |
71 | | - echo <<<EOT |
72 | | -To install this extension, put the following line in LocalSettings.php: |
73 | | -require_once( "\$IP/extensions/NewsChannel/NewsChannel.php" ); |
74 | | -EOT; |
75 | | - exit( 1 ); |
76 | | -} |
77 | | - |
78 | 78 | $wgExtensionCredits['specialpage'][] = array( |
79 | | - 'name' => 'News Channel', |
80 | | - 'version' => 1.6, |
81 | | - 'author' => 'Iaroslav Vassiliev <codedriller@gmail.com>', |
82 | | - 'description' => 'This MediaWiki extension represents a news channel for wiki project. ' . |
| 79 | + 'name' => 'News Channel', |
| 80 | + 'version' => '2.0', |
| 81 | + 'author' => '[mailto:codedriller@gmail.com Iaroslav Vassiliev]', |
| 82 | + 'description' => 'This MediaWiki extension represents a news channel for wiki project. ' . |
83 | 83 | 'The channel is implemented as a dynamic [[Special:NewsChannel|special page]].', |
84 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:News_Channel' |
| 84 | + 'descriptionmsg' => 'newschannel-desc', |
| 85 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:News_Channel', |
85 | 86 | ); |
86 | 87 | |
87 | | -//$wgExtensionFunctions[] = 'wfSetupNewsChannelExtension'; |
88 | | -$wgAutoloadClasses['NewsChannel'] = dirname( __FILE__ ) . '/NewsChannel_body.php'; |
89 | | -$wgExtensionMessagesFiles['NewsChannel'] = dirname( __FILE__ ) . '/NewsChannel.i18n.php'; |
| 88 | +$dir = dirname(__FILE__) . '/'; |
| 89 | +$wgAutoloadClasses['NewsChannel'] = $dir . 'NewsChannel_body.php'; |
| 90 | +$wgAutoloadClasses['LinkNewsChannel'] = $dir . 'NewsChannel.class.php'; |
| 91 | +$wgExtensionMessagesFiles['NewsChannel'] = $dir . 'NewsChannel.i18n.php'; |
| 92 | +$wgExtensionAliasesFiles['NewsChannel'] = $dir . 'NewsChannel.alias.php'; |
90 | 93 | $wgSpecialPages['NewsChannel'] = 'NewsChannel'; |
91 | | -$wgHooks['BeforePageDisplay'][] = 'wfLinkNewsChannelExtensionFeeds'; |
92 | | - |
93 | | -function wfLinkNewsChannelExtensionFeeds() { |
94 | | - global $wgOut, $wgNewsChannelTitle; |
95 | | - |
96 | | - $title = Title::newFromText( 'NewsChannel', NS_SPECIAL ); |
97 | | - $wgOut->addLink( array( |
98 | | - 'rel' => 'alternate', |
99 | | - 'type' => 'application/rss+xml', |
100 | | - 'title' => $wgNewsChannelTitle . ' - RSS 2.0', |
101 | | - 'href' => $title->getLocalURL( 'format=rss20' ) ) ); |
102 | | - $wgOut->addLink( array( |
103 | | - 'rel' => 'alternate', |
104 | | - 'type' => 'application/atom+xml', |
105 | | - 'title' => $wgNewsChannelTitle . ' - Atom 1.0', |
106 | | - 'href' => $title->getLocalURL( 'format=atom10' ) ) ); |
107 | | - |
108 | | - return true; |
109 | | -} |
110 | | -?> |
\ No newline at end of file |
| 94 | +$wgHooks['BeforePageDisplay'][] = 'LinkNewsChannel::ExtensionFeeds'; |