Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -118,21 +118,30 @@ |
119 | 119 | } |
120 | 120 | |
121 | 121 | # Override for custom handling. If the titles/links are ok, just do feedItemDesc() |
122 | | - function feedResult( $result ) { |
123 | | - if( isset( $result->cur_title ) ) { |
124 | | - $title = Title::MakeTitle( $result->cur_namespace, $result->cur_title ); |
125 | | - } elseif( isset( $result->old_title ) ) { |
126 | | - $title = Title::MakeTitle( $result->old_namespace, $result->old_title ); |
127 | | - } elseif( isset( $result->rc_title ) ) { |
128 | | - $title = Title::MakeTitle( $result->rc_namespace, $result->rc_title ); |
| 122 | + function feedResult( $row ) { |
| 123 | + if( isset( $row->cur_title ) ) { |
| 124 | + $title = Title::MakeTitle( $row->cur_namespace, $row->cur_title ); |
| 125 | + } elseif( isset( $row->old_title ) ) { |
| 126 | + $title = Title::MakeTitle( $row->old_namespace, $row->old_title ); |
| 127 | + } elseif( isset( $row->rc_title ) ) { |
| 128 | + $title = Title::MakeTitle( $row->rc_namespace, $row->rc_title ); |
129 | 129 | } else { |
130 | 130 | return NULL; |
131 | 131 | } |
132 | 132 | if( $title ) { |
| 133 | + $date = ""; |
| 134 | + if( isset( $row->cur_timestamp ) ) { |
| 135 | + $date = $row->cur_timestamp; |
| 136 | + } elseif( isset( $row->old_timestamp ) ) { |
| 137 | + $date = $row->old_timestamp; |
| 138 | + } elseif( isset( $row->rc_cur_timestamp ) ) { |
| 139 | + $date = $row->rc_cur_timestamp; |
| 140 | + } |
133 | 141 | return new FeedItem( |
134 | 142 | $title->getText(), |
135 | | - $this->feedItemDesc( $result ), |
136 | | - wfFullUrl( $title->getUrl() ) ); |
| 143 | + $this->feedItemDesc( $row ), |
| 144 | + wfFullUrl( $title->getUrl() ) , |
| 145 | + $date); |
137 | 146 | } else { |
138 | 147 | return NULL; |
139 | 148 | } |
Index: trunk/phase3/includes/Feed.php |
— | — | @@ -9,11 +9,13 @@ |
10 | 10 | var $Title = "Wiki"; |
11 | 11 | var $Description = ""; |
12 | 12 | var $Url = ""; |
| 13 | + var $Date = ""; |
13 | 14 | |
14 | | - function FeedItem( $Title, $Description, $Url ) { |
| 15 | + function FeedItem( $Title, $Description, $Url, $Date = "" ) { |
15 | 16 | $this->Title = $Title; |
16 | 17 | $this->Description = $Description; |
17 | 18 | $this->Url = $Url; |
| 19 | + $this->Date = $Date; |
18 | 20 | } |
19 | 21 | |
20 | 22 | /* Static... */ |
— | — | @@ -38,6 +40,9 @@ |
39 | 41 | global $wgLanguageCode; |
40 | 42 | return $wgLanguageCode; |
41 | 43 | } |
| 44 | + function getDate() { |
| 45 | + return $this->Date; |
| 46 | + } |
42 | 47 | } |
43 | 48 | |
44 | 49 | class ChannelFeed extends FeedItem { |
— | — | @@ -54,15 +59,22 @@ |
55 | 60 | } |
56 | 61 | |
57 | 62 | class RSSFeed extends ChannelFeed { |
| 63 | + function formatTime( $ts ) { |
| 64 | + return gmdate( "D, d M Y H:i:s T", wfTimestamp2Unix( $ts ) ); |
| 65 | + } |
| 66 | + |
58 | 67 | function outHeader() { |
| 68 | + global $wgVersion; |
| 69 | + |
59 | 70 | print '<' . '?xml version="1.0" encoding="utf-8"?' . ">\n"; |
60 | | - ?><!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> |
61 | | -<rss version="0.91"> |
| 71 | + ?><rss version="2.0"> |
62 | 72 | <channel> |
63 | 73 | <title><?php print $this->getTitle() ?></title> |
64 | 74 | <link><?php print $this->getUrl() ?></link> |
65 | 75 | <description><?php print $this->getDescription() ?></description> |
66 | 76 | <language><?php print $this->getLanguage() ?></language> |
| 77 | + <generator>MediaWiki <?php print $wgVersion ?></generator> |
| 78 | + <lastBuildDate><?php print $this->formatTime( wfTimestampNow() ) ?></lastBuildDate> |
67 | 79 | <?php |
68 | 80 | } |
69 | 81 | |
— | — | @@ -72,6 +84,8 @@ |
73 | 85 | <title><?php print $item->getTitle() ?></title> |
74 | 86 | <link><?php print $item->getUrl() ?></link> |
75 | 87 | <description><?php print $item->getDescription() ?></description> |
| 88 | + <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?> |
| 89 | + |
76 | 90 | </item> |
77 | 91 | <?php |
78 | 92 | } |