r83806 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83805‎ | r83806 | r83807 >
Date:03:38, 13 March 2011
Author:bawolff
Status:ok
Tags:
Comment:
Whitespace cleanup. No code changes. One comment was removed. Stylize.php was applied
Modified paths:
  • /trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php (modified) (history)
  • /trunk/extensions/GoogleNewsSitemap/SitemapFeed.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php
@@ -44,9 +44,9 @@
4545 /**
4646 * Script default values - correctly spelt, naming standard.
4747 **/
48 - var $wgDPlminCategories = 1; // Minimum number of categories to look for
49 - var $wgDPlmaxCategories = 6; // Maximum number of categories to look for
50 - var $wgDPLmaxResultCount = 50; // Maximum number of results to allow
 48+ var $wgDPlminCategories = 1; // Minimum number of categories to look for
 49+ var $wgDPlmaxCategories = 6; // Maximum number of categories to look for
 50+ var $wgDPLmaxResultCount = 50; // Maximum number of results to allow
5151
5252 /**
5353 * @var array Parameters array
@@ -80,7 +80,7 @@
8181
8282 $this->unload_params(); // populates this->params as a side effect
8383
84 - // if there's an error parsing the params, bail out and return
 84+ // if there's an error parsing the params, bail out and return
8585 if ( isset( $this->params['error'] ) ) {
8686 if ( false == $this->params['suppressErrors'] ) {
8787 $wgOut->disable();
@@ -141,8 +141,11 @@
142142 $comments );
143143 }
144144 $feed->outItem( $feedItem );
145 - }// end while fetchobject
 145+
 146+ } // end while fetchobject
 147+
146148 $feed->outFooter();
 149+
147150 } // end public function execute
148151
149152 /**
@@ -154,13 +157,13 @@
155158
156159 $tables[] = $dbr->tableName( 'page' );
157160
158 - //this is a little hacky, c1 is dynamically defined as the first category
159 - //so this can't ever work with uncategorized articles
160 - $fields = array('page_namespace', 'page_title', 'page_id', 'c1.cl_timestamp');
 161+ // this is a little hacky, c1 is dynamically defined as the first category
 162+ // so this can't ever work with uncategorized articles
 163+ $fields = array( 'page_namespace', 'page_title', 'page_id', 'c1.cl_timestamp' );
161164 $conditions = array();
162165
163166 if ( $this->params['nameSpace'] ) {
164 - $conditions['page_namespace'] = $this->params['nameSpace'];
 167+ $conditions['page_namespace'] = $this->params['nameSpace'];
165168 }
166169
167170 // If flagged revisions is in use, check which options selected.
@@ -169,12 +172,12 @@
170173 $filterSet = array( 'only', 'exclude' );
171174 # Either involves the same JOIN here...
172175 if ( in_array( $this->params['stable'], $filterSet ) || in_array( $this->params['quality'], $filterSet ) ) {
173 - $joins['flaggedpages'] = array( 'LEFT JOIN', 'page_id = fp_page_id' );
 176+ $joins['flaggedpages'] = array( 'LEFT JOIN', 'page_id = fp_page_id' );
174177 }
175178
176179 switch( $this->params['stable'] ) {
177180 case 'only':
178 - $conditions[]='fp_stable IS NOT NULL ';
 181+ $conditions[] = 'fp_stable IS NOT NULL ';
179182 break;
180183 case 'exclude':
181184 $conditions['fp_stable'] = null;
@@ -182,7 +185,7 @@
183186 }
184187 switch( $this->params['quality'] ) {
185188 case 'only':
186 - $conditions[]='fp_quality >= 1';
 189+ $conditions[] = 'fp_quality >= 1';
187190 break;
188191 case 'exclude':
189192 $conditions['fp_quality'] = 0;
@@ -203,7 +206,7 @@
204207 $categorylinks = $dbr->tableName( 'categorylinks' );
205208
206209 $joins = array();
207 - for ($i = 0; $i < $this->params['catCount']; $i++) {
 210+ for ( $i = 0; $i < $this->params['catCount']; $i++ ) {
208211 $joins["$categorylinks AS c$currentTableNumber"] = array( 'INNER JOIN',
209212 array( "page_id = c{$currentTableNumber}.cl_from",
210213 "c{$currentTableNumber}.cl_to={$dbr->addQuotes( $this->categories[$i]->getDBKey() ) }"
@@ -213,7 +216,7 @@
214217 $currentTableNumber++;
215218 }
216219
217 - //exclusion categories disabled pending discussion on whether they are necessary
 220+ // exclusion categories disabled pending discussion on whether they are necessary
218221 /*
219222 for ( $i = 0; $i < $this->params['notCatCount']; $i++ ) {
220223 // echo "notCategory parameter $i<br />\n";
@@ -241,11 +244,11 @@
242245 }
243246
244247
245 - //earlier validation logic ensures this is a reasonable number
 248+ // earlier validation logic ensures this is a reasonable number
246249 $options['LIMIT'] = $this->params['count'];
247250
248 - //return $dbr->query( $sqlSelectFrom . $conditions );
249 - return $dbr->select ( $tables, $fields, $conditions, '', $options, $joins );
 251+ // return $dbr->query( $sqlSelectFrom . $conditions );
 252+ return $dbr->select( $tables, $fields, $conditions, '', $options, $joins );
250253 }
251254
252255 /**
@@ -272,7 +275,8 @@
273276 $this->params['count'] = $wgRequest->getInt( 'count', $this->wgDPLmaxResultCount );
274277
275278 if ( ( $this->params['count'] > $this->wgDPLmaxResultCount )
276 - || ( $this->params['count'] < 1 ) ) {
 279+ || ( $this->params['count'] < 1 ) )
 280+ {
277281 $this->params['count'] = $this->wgDPLmaxResultCount;
278282 }
279283
@@ -293,7 +297,7 @@
294298 if ( ( $this->params['catCount'] < 1 && !$this->params['nameSpace'] )
295299 || ( $totalCatCount < $this->wgDPlminCategories ) )
296300 {
297 - $feed = Title::newFromText( 'Published', NS_CATEGORY );
 301+ $feed = Title::newFromText( 'Published', NS_CATEGORY );
298302 if ( is_object( $feed ) ) {
299303 $this->categories[] = $feed;
300304 $this->params['catCount'] = count( $this->categories );
@@ -303,10 +307,10 @@
304308 }
305309
306310 if ( $totalCatCount > $this->wgDPlmaxCategories ) {
307 - $this->params['error'] = htmlspecialchars( wfMsg( 'googlenewssitemap_toomanycats' ) ); // "!!too many categories!!";
 311+ $this->params['error'] = htmlspecialchars( wfMsg( 'googlenewssitemap_toomanycats' ) );
308312 }
309313
310 - // disallow showing date if the query doesn't have an inclusion category parameter
 314+ // Disallow showing date if the query doesn't have an inclusion category parameter.
311315 if ( $this->params['count'] < 1 ) {
312316 $this->params['addFirstCategoryDate'] = false;
313317 }
Index: trunk/extensions/GoogleNewsSitemap/SitemapFeed.php
@@ -9,9 +9,10 @@
1010 $this->writer = new XMLWriter();
1111 $wgOut->disable();
1212 }
 13+
1314 /**
1415 * Output feed headers
15 - **/
 16+ */
1617 function outHeader() {
1718 global $wgOut, $wgRequest;
1819
@@ -19,9 +20,10 @@
2021 $ctype = $wgRequest->getVal( 'ctype', 'application/xml' );
2122 $allowedctypes = array( 'application/xml', 'text/xml', 'application/rss+xml', 'application/atom+xml' );
2223 $mimetype = in_array( $ctype, $allowedctypes ) ? $ctype : 'application/xml';
23 - header( "Content-type: $mimetype; charset=UTF-8" );
24 - $wgOut->sendCacheControl();
2524
 25+ header( "Content-type: $mimetype; charset=UTF-8" );
 26+ $wgOut->sendCacheControl();
 27+
2628 $this->writer->openURI( 'php://output' );
2729 $this->writer->setIndent( true );
2830 $this->writer->startDocument( "1.0", "UTF-8" );
@@ -30,10 +32,11 @@
3133 $this->writer->writeAttribute( "xmlns:news", "http://www.google.com/schemas/sitemap-news/0.9" );
3234 $this->writer->flush();
3335 }
 36+
3437 /**
3538 * Output a SiteMap 0.9 item
3639 * @param FeedSMItem $item to be output
37 - **/
 40+ */
3841 function outItem( $item ) {
3942 $this->writer->startElement( "url" );
4043 $this->writer->startElement( "loc" );
@@ -64,7 +67,7 @@
6568
6669 /**
6770 * Output SiteMap 0.9 footer
68 - **/
 71+ */
6972 function outFooter() {
7073 $this->writer->endDocument();
7174 $this->writer->flush();

Status & tagging log