Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php |
— | — | @@ -51,7 +51,6 @@ |
52 | 52 | var $wgDPLallowUnlimitedResults = true; // Allow unlimited results |
53 | 53 | var $wgDPLallowUnlimitedCategories = false; // Allow unlimited categories |
54 | 54 | |
55 | | - |
56 | 55 | /** |
57 | 56 | * @var array Parameters array |
58 | 57 | **/ |
— | — | @@ -70,25 +69,20 @@ |
71 | 70 | * main() |
72 | 71 | **/ |
73 | 72 | public function execute( $par ) { |
74 | | - global $wgUser; |
75 | | - global $wgLang; |
76 | | - global $wgContLang; |
77 | | - global $wgRequest, $wgOut; |
78 | | - global $wgSitename, $wgServer, $wgScriptPath; |
79 | | - // global $wfTimeStamp; |
80 | | - wfLoadExtensionMessages( 'GoogleNewsSitemap' ); |
81 | | - global $wgFeedClasses, $wgLocaltimezone; |
| 73 | + global $wgUser, $wgLang, $wgContLang, $wgRequest, $wgOut, |
| 74 | + $wgSitename, $wgServer, $wgScriptPath, $wgFeedClasses, |
| 75 | + $wgLocaltimezone; |
82 | 76 | |
83 | 77 | // Not sure how clean $wgLocaltimezone is |
84 | 78 | // In fact, it's default setting is null... |
85 | | - if ( null == $wgLocaltimezone ) |
| 79 | + if ( null == $wgLocaltimezone ) { |
86 | 80 | $wgLocaltimezone = date_default_timezone_get(); |
| 81 | + } |
87 | 82 | date_default_timezone_set( $wgLocaltimezone ); |
88 | 83 | // $url = __FILE__; |
89 | 84 | |
90 | 85 | $this->unload_params(); // populates this->params as a side effect |
91 | 86 | |
92 | | - |
93 | 87 | $wgFeedClasses[] = array( 'sitemap' => 'SitemapFeed' ); |
94 | 88 | |
95 | 89 | if ( 'sitemap' == $this->params['feed'] ) { |
— | — | @@ -117,7 +111,7 @@ |
118 | 112 | return; |
119 | 113 | } |
120 | 114 | |
121 | | - $dbr =& wfGetDB( DB_SLAVE ); |
| 115 | + $dbr = wfGetDB( DB_SLAVE ); |
122 | 116 | $sql = $this->dpl_buildSQL(); |
123 | 117 | // Debug line |
124 | 118 | // echo "\n<p>$sql</p>\n"; |
— | — | @@ -126,16 +120,17 @@ |
127 | 121 | // FIXME: figure out how to fail with no results gracefully |
128 | 122 | if ( $dbr->numRows( $res ) == 0 ) { |
129 | 123 | $feed->outFooter(); |
130 | | - if ( false == $this->params['suppressErrors'] ) |
| 124 | + if ( false == $this->params['suppressErrors'] ) { |
131 | 125 | return htmlspecialchars( wfMsg( 'gnsm_noresults' ) ); |
132 | | - else |
| 126 | + } else { |
133 | 127 | return ''; |
| 128 | + } |
134 | 129 | } |
135 | 130 | |
136 | 131 | while ( $row = $dbr->fetchObject( $res ) ) { |
137 | 132 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
138 | 133 | |
139 | | - if ( ! $title ) { |
| 134 | + if ( !$title ) { |
140 | 135 | $feed->outFooter(); |
141 | 136 | return; |
142 | 137 | } |
— | — | @@ -298,8 +293,10 @@ |
299 | 294 | // $this->notCategories[] = $wgRequest->getArray('notcategory'); |
300 | 295 | $this->params['nameSpace'] = $wgContLang->getNsIndex( $wgRequest->getVal( 'namespace', 0 ) ); |
301 | 296 | $this->params['count'] = $wgRequest->getInt( 'count', $this->wgDPLmaxResultCount ); |
302 | | - if ( ( $this->params['count'] > $this->wgDPLmaxResultCount ) || ( $this->params['count'] < $this->wgDPLminResultCount ) ) |
| 297 | + if ( ( $this->params['count'] > $this->wgDPLmaxResultCount ) |
| 298 | + || ( $this->params['count'] < $this->wgDPLminResultCount ) ) { |
303 | 299 | $this->params['count'] = $this->wgDPLmaxResultCount; |
| 300 | + } |
304 | 301 | |
305 | 302 | $this->params['order'] = $wgRequest->getVal( 'order', 'descending' ); |
306 | 303 | $this->params['orderMethod'] = $wgRequest->getVal( 'ordermethod', 'categoryadd' ); |
— | — | @@ -311,7 +308,6 @@ |
312 | 309 | $this->params['useCurId'] = $wgRequest->getBool( 'usecurid', false ); |
313 | 310 | $this->params['feed'] = $wgRequest->getVal( 'feed', 'sitemap' ); |
314 | 311 | |
315 | | - |
316 | 312 | $this->params['catCount'] = count( $this->categories ); |
317 | 313 | $this->params['notCatCount'] = count( $this->notCategories ); |
318 | 314 | $totalCatCount = $this->params['catCount'] + $this->params['notCatCount']; |
— | — | @@ -334,13 +330,13 @@ |
335 | 331 | } |
336 | 332 | |
337 | 333 | // disallow showing date if the query doesn't have an inclusion category parameter |
338 | | - if ( $this->params['count'] < 1 ) |
| 334 | + if ( $this->params['count'] < 1 ) { |
339 | 335 | $this->params['addFirstCategoryDate'] = false; |
| 336 | + } |
340 | 337 | |
341 | 338 | $this->params['dbr'] =& wfGetDB( DB_SLAVE ); |
342 | 339 | // print_r($this->notCategories); |
343 | 340 | // print_r($this->categories); |
344 | | - return; |
345 | 341 | } |
346 | 342 | |
347 | 343 | function feedItemAuthor( $row ) { |
Index: trunk/extensions/GoogleNewsSitemap/FeedSMItem.php |
— | — | @@ -10,11 +10,7 @@ |
11 | 11 | /** |
12 | 12 | * Var string |
13 | 13 | **/ |
14 | | - var $url = ''; |
15 | | - var $pubDate = ''; |
16 | | - var $keywords = ''; |
17 | | - var $lastMod = ''; |
18 | | - var $priority = ''; |
| 14 | + var $url = '', $pubDate = '', $keywords = '', $lastMod = '', $priority = ''; |
19 | 15 | |
20 | 16 | function __construct( $url, $pubDate, $keywords = '', $lastMod = '', $priority = '' ) { |
21 | 17 | $this->url = $url; |
Index: trunk/extensions/GoogleNewsSitemap/SitemapFeed.php |
— | — | @@ -13,8 +13,7 @@ |
14 | 14 | * Output feed headers |
15 | 15 | **/ |
16 | 16 | function outHeader() { |
17 | | - global $wgOut; |
18 | | - global $wgRequest; |
| 17 | + global $wgOut, $wgRequest; |
19 | 18 | |
20 | 19 | // FIXME: Why can't we just pick one mime type and always send that? |
21 | 20 | $ctype = $wgRequest->getVal( 'ctype', 'application/xml' ); |
— | — | @@ -36,7 +35,6 @@ |
37 | 36 | * @param FeedSMItem item to be output |
38 | 37 | **/ |
39 | 38 | function outItem( $item ) { |
40 | | - |
41 | 39 | $this->writer->startElement( "url" ); |
42 | 40 | $this->writer->startElement( "loc" ); |
43 | 41 | $this->writer->text( $item->getUrl() ); |