| Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php |
| — | — | @@ -27,8 +27,6 @@ |
| 28 | 28 | **/ |
| 29 | 29 | |
| 30 | 30 | class GoogleNewsSitemap extends IncludableSpecialPage { |
| 31 | | - |
| 32 | | - |
| 33 | 31 | /** |
| 34 | 32 | * FIXME: Some of this might need a config eventually |
| 35 | 33 | * @var string |
| — | — | @@ -53,7 +51,6 @@ |
| 54 | 52 | var $wgDPLallowUnlimitedResults = true; // Allow unlimited results |
| 55 | 53 | var $wgDPLallowUnlimitedCategories = false; // Allow unlimited categories |
| 56 | 54 | |
| 57 | | - |
| 58 | 55 | /** |
| 59 | 56 | * @var array Parameters array |
| 60 | 57 | **/ |
| — | — | @@ -72,12 +69,7 @@ |
| 73 | 70 | * main() |
| 74 | 71 | **/ |
| 75 | 72 | public function execute( $par ) { |
| 76 | | - global $wgUser; |
| 77 | | - global $wgLang; |
| 78 | | - global $wgContLang; |
| 79 | | - global $wgRequest, $wgOut; |
| 80 | 73 | global $wgSitename, $wgServer, $wgScriptPath; |
| 81 | | - wfLoadExtensionMessages( 'GoogleNewsSitemap' ); |
| 82 | 74 | global $wgFeedClasses, $wgLocaltimezone; |
| 83 | 75 | |
| 84 | 76 | // Not sure how clean $wgLocaltimezone is |
| — | — | @@ -89,7 +81,6 @@ |
| 90 | 82 | |
| 91 | 83 | $this->dpl_parm( $par ); |
| 92 | 84 | |
| 93 | | - |
| 94 | 85 | $wgFeedClasses[] = array( 'sitemap' => 'SitemapFeed' ); |
| 95 | 86 | |
| 96 | 87 | if ( 'sitemap' == $this->params['feed'] ) { |
| — | — | @@ -123,17 +114,18 @@ |
| 124 | 115 | // FIXME: figure out how to fail with no results gracefully |
| 125 | 116 | if ( $dbr->numRows( $res ) == 0 ) { |
| 126 | 117 | $feed->outFooter(); |
| 127 | | - if ( false == $this->params['suppressErrors'] ) |
| 128 | | - return htmlspecialchars( wfMsg( 'gnsm_noresults' ) ); |
| 129 | | - else |
| 130 | | - return ''; |
| | 118 | + if ( false == $this->params['suppressErrors'] ) { |
| | 119 | + return htmlspecialchars( wfMsg( 'gnsm_noresults' ) ); |
| | 120 | + } else { |
| | 121 | + return ''; |
| | 122 | + } |
| 131 | 123 | } |
| 132 | 124 | |
| 133 | | - while ( $row = $dbr->fetchObject( $res ) ) { |
| | 125 | + foreach ($res as $row ) { |
| 134 | 126 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
| 135 | 127 | |
| 136 | 128 | if ( $title ) { |
| 137 | | - // This is printing things in places it shouldn't |
| | 129 | + // This is printing things in places it shouldn't |
| 138 | 130 | // print $this->params['nameSpace']; |
| 139 | 131 | |
| 140 | 132 | $titleText = ( true == $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText(); |
| — | — | @@ -155,10 +147,10 @@ |
| 156 | 148 | |
| 157 | 149 | $this->Date = isset( $row->cl_timestamp ) ? $row->cl_timestamp : date( DATE_ATOM ); |
| 158 | 150 | if ( isset( $row->comment ) ) { |
| 159 | | - $comments = htmlspecialchars( $row->comment ); |
| | 151 | + $comments = htmlspecialchars( $row->comment ); |
| 160 | 152 | } else { |
| 161 | | - $talkpage = $title->getTalkPage(); |
| 162 | | - $comments = $talkpage->getFullURL(); |
| | 153 | + $talkpage = $title->getTalkPage(); |
| | 154 | + $comments = $talkpage->getFullURL(); |
| 163 | 155 | } |
| 164 | 156 | $titleText = ( true === $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText(); |
| 165 | 157 | $feedItem = new FeedItem( |
| — | — | @@ -251,16 +243,17 @@ |
| 252 | 244 | $currentTableNumber++; |
| 253 | 245 | } |
| 254 | 246 | |
| 255 | | - if ( 'lastedit' == $this->params['orderMethod'] ) |
| | 247 | + if ( 'lastedit' == $this->params['orderMethod'] ) { |
| 256 | 248 | $sqlWhere .= ' ORDER BY page_touched '; |
| 257 | | - else |
| | 249 | + } else { |
| 258 | 250 | $sqlWhere .= ' ORDER BY c1.cl_timestamp '; |
| | 251 | + } |
| 259 | 252 | |
| 260 | | - if ( 'descending' == $this->params['order'] ) |
| | 253 | + if ( 'descending' == $this->params['order'] ) { |
| 261 | 254 | $sqlWhere .= 'DESC'; |
| 262 | | - else |
| | 255 | + } else { |
| 263 | 256 | $sqlWhere .= 'ASC'; |
| 264 | | - |
| | 257 | + } |
| 265 | 258 | // FIXME: Note: this is not a boolean type check - will also trap count = 0 which may |
| 266 | 259 | // accidentally give unlimited returns |
| 267 | 260 | if ( 0 < $this->params['count'] ) { |
| — | — | @@ -454,7 +447,6 @@ |
| 455 | 448 | $this->params['catCount'] = count( $this->categories ); |
| 456 | 449 | } else { |
| 457 | 450 | echo "\$feed is not an object.\n"; |
| 458 | | - continue; |
| 459 | 451 | } |
| 460 | 452 | } |
| 461 | 453 | |
| — | — | @@ -511,7 +503,6 @@ |
| 512 | 504 | $str = substr( $str, 2 ); # to remove leading ', ' |
| 513 | 505 | return $str; |
| 514 | 506 | } |
| 515 | | - |
| 516 | 507 | } |
| 517 | 508 | |
| 518 | 509 | /** |