Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap_body.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) die(); |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Class GoogleNewsSitemap creates Atom/RSS feeds for Wikinews |
— | — | @@ -85,24 +85,24 @@ |
86 | 86 | if ( null == $wgLocaltimezone ) |
87 | 87 | $wgLocaltimezone = date_default_timezone_get(); |
88 | 88 | date_default_timezone_set( $wgLocaltimezone ); |
89 | | - //$url = __FILE__; |
| 89 | + // $url = __FILE__; |
90 | 90 | |
91 | 91 | $this->dpl_parm( $par ); |
92 | 92 | |
93 | 93 | |
94 | 94 | $wgFeedClasses[] = array( 'sitemap' => 'SitemapFeed' ); |
95 | 95 | |
96 | | - if ( 'sitemap' == $this->params['feed'] ){ |
| 96 | + if ( 'sitemap' == $this->params['feed'] ) { |
97 | 97 | $feed = new SitemapFeed( |
98 | | - $wgServer.$wgScriptPath, |
| 98 | + $wgServer . $wgScriptPath, |
99 | 99 | date( DATE_ATOM ) |
100 | 100 | ); |
101 | | - }else{ |
| 101 | + } else { |
102 | 102 | // FIXME: These should be configurable at some point |
103 | 103 | $feed = new $wgFeedClasses[ $this->params['feed'] ]( |
104 | 104 | $wgSitename, |
105 | 105 | $wgSitename . ' ' . $this->params['feed'] . ' feed', |
106 | | - $wgServer.$wgScriptPath, |
| 106 | + $wgServer . $wgScriptPath, |
107 | 107 | date( DATE_ATOM ), |
108 | 108 | $wgSitename |
109 | 109 | ); |
— | — | @@ -111,17 +111,17 @@ |
112 | 112 | $feed->outHeader(); |
113 | 113 | |
114 | 114 | // main routine to output items |
115 | | - if ( isset( $this->param['error'] ) ){ |
| 115 | + if ( isset( $this->param['error'] ) ) { |
116 | 116 | echo $this->param['error']; |
117 | | - }else{ |
| 117 | + } else { |
118 | 118 | $dbr = wfGetDB( DB_SLAVE ); |
119 | 119 | $sql = $this->dpl_buildSQL(); |
120 | | - //Debug line |
121 | | - //echo "\n<p>$sql</p>\n"; |
| 120 | + // Debug line |
| 121 | + // echo "\n<p>$sql</p>\n"; |
122 | 122 | $res = $dbr->query ( $sql ); |
123 | 123 | |
124 | 124 | // FIXME: figure out how to fail with no results gracefully |
125 | | - if ( $dbr->numRows( $res ) == 0 ){ |
| 125 | + if ( $dbr->numRows( $res ) == 0 ) { |
126 | 126 | $feed->outFooter(); |
127 | 127 | if ( false == $this->params['suppressErrors'] ) |
128 | 128 | return htmlspecialchars( wfMsg( 'gnsm_noresults' ) ); |
— | — | @@ -129,16 +129,16 @@ |
130 | 130 | return ''; |
131 | 131 | } |
132 | 132 | |
133 | | - while ($row = $dbr->fetchObject( $res ) ) { |
134 | | - $title = Title::makeTitle( $row->page_namespace, $row->page_title); |
| 133 | + while ( $row = $dbr->fetchObject( $res ) ) { |
| 134 | + $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
135 | 135 | |
136 | | - if ( $title ){ |
137 | | - //This is printing things in places it shouldn't |
| 136 | + if ( $title ) { |
| 137 | + // This is printing things in places it shouldn't |
138 | 138 | // print $this->params['nameSpace']; |
139 | 139 | |
140 | 140 | $titleText = ( true == $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText(); |
141 | 141 | |
142 | | - if ( 'sitemap' == $this->params['feed'] ){ |
| 142 | + if ( 'sitemap' == $this->params['feed'] ) { |
143 | 143 | |
144 | 144 | $this->pubDate = isset( $row->cl_timestamp ) ? $row->cl_timestamp : date( DATE_ATOM ); |
145 | 145 | $feedArticle = new Article( $title ); |
— | — | @@ -150,24 +150,24 @@ |
151 | 151 | wfTimeStamp( TS_ISO_8601, $feedArticle->getTouched() ), |
152 | 152 | $feed->getPriority( $this->priority ) |
153 | 153 | ); |
154 | | - |
155 | | - }elseif ( ('atom' == $this->params['feed'] ) || ( 'rss' == $this->params['feed'] ) ){ |
156 | | - |
| 154 | + |
| 155 | + } elseif ( ( 'atom' == $this->params['feed'] ) || ( 'rss' == $this->params['feed'] ) ) { |
| 156 | + |
157 | 157 | $this->Date = isset( $row->cl_timestamp ) ? $row->cl_timestamp : date( DATE_ATOM ); |
158 | | - if ( isset( $row->comment ) ){ |
| 158 | + if ( isset( $row->comment ) ) { |
159 | 159 | $comments = htmlspecialchars( $row->comment ); |
160 | | - }else{ |
| 160 | + } else { |
161 | 161 | $talkpage = $title->getTalkPage(); |
162 | 162 | $comments = $talkpage->getFullURL(); |
163 | 163 | } |
164 | | - $titleText = (true === $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText(); |
| 164 | + $titleText = ( true === $this->params['nameSpace'] ) ? $title->getPrefixedText() : $title->getText(); |
165 | 165 | $feedItem = new FeedItem( |
166 | 166 | $titleText, |
167 | 167 | $this->feedItemDesc( $row ), |
168 | 168 | $title->getFullURL(), |
169 | 169 | $this->Date, |
170 | 170 | $this->feedItemAuthor( $row ), |
171 | | - $comments); |
| 171 | + $comments ); |
172 | 172 | } |
173 | 173 | $feed->outItem( $feedItem ); |
174 | 174 | } |
— | — | @@ -179,26 +179,26 @@ |
180 | 180 | /** |
181 | 181 | * Build sql |
182 | 182 | **/ |
183 | | - public function dpl_buildSQL(){ |
184 | | - |
| 183 | + public function dpl_buildSQL() { |
| 184 | + |
185 | 185 | $sqlSelectFrom = 'SELECT page_namespace, page_title, page_id, c1.cl_timestamp FROM ' . $this->params['dbr']->tableName( 'page' ); |
186 | 186 | |
187 | | - if ( $this->params['nameSpace'] ){ |
| 187 | + if ( $this->params['nameSpace'] ) { |
188 | 188 | $sqlWhere = ' WHERE page_namespace=' . $this->params['iNameSpace'] . ' '; |
189 | | - }else{ |
| 189 | + } else { |
190 | 190 | $sqlWhere = ' WHERE 1=1 '; |
191 | 191 | } |
192 | 192 | |
193 | 193 | // If flagged revisions is in use, check which options selected. |
194 | 194 | // FIXME: double check the default options in function::dpl_parm; what should it default to? |
195 | | - if( function_exists('efLoadFlaggedRevs') ) { |
| 195 | + if ( function_exists( 'efLoadFlaggedRevs' ) ) { |
196 | 196 | $flaggedPages = $this->params['dbr']->tableName( 'flaggedpages' ); |
197 | 197 | $filterSet = array( 'only', 'exclude' ); |
198 | 198 | # Either involves the same JOIN here... |
199 | | - if( in_array( $this->params['stable'], $filterSet ) || in_array( $this->params['quality'], $filterSet ) ) { |
| 199 | + if ( in_array( $this->params['stable'], $filterSet ) || in_array( $this->params['quality'], $filterSet ) ) { |
200 | 200 | $sqlSelectFrom .= " LEFT JOIN $flaggedPages ON page_id = fp_page_id"; |
201 | 201 | } |
202 | | - switch( $this->params['stable'] ){ |
| 202 | + switch( $this->params['stable'] ) { |
203 | 203 | case 'only': |
204 | 204 | $sqlWhere .= ' AND fp_stable IS NOT NULL '; |
205 | 205 | break; |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | $sqlWhere .= ' AND fp_stable IS NULL '; |
208 | 208 | break; |
209 | 209 | } |
210 | | - switch( $this->params['quality'] ){ |
| 210 | + switch( $this->params['quality'] ) { |
211 | 211 | case 'only': |
212 | 212 | $sqlWhere .= ' AND fp_quality >= 1'; |
213 | 213 | break; |
— | — | @@ -228,7 +228,7 @@ |
229 | 229 | |
230 | 230 | $currentTableNumber = 0; |
231 | 231 | |
232 | | - for ( $i = 0; $i < $this->params['catCount']; $i++ ){ |
| 232 | + for ( $i = 0; $i < $this->params['catCount']; $i++ ) { |
233 | 233 | |
234 | 234 | $sqlSelectFrom .= ' INNER JOIN ' . $this->params['dbr']->tableName( 'categorylinks' ); |
235 | 235 | $sqlSelectFrom .= ' AS c' . ( $currentTableNumber + 1 ) . ' ON page_id = c'; |
— | — | @@ -239,8 +239,8 @@ |
240 | 240 | $currentTableNumber++; |
241 | 241 | } |
242 | 242 | |
243 | | - for ( $i = 0; $i < $this->params['notCatCount']; $i++ ){ |
244 | | - //echo "notCategory parameter $i<br />\n"; |
| 243 | + for ( $i = 0; $i < $this->params['notCatCount']; $i++ ) { |
| 244 | + // echo "notCategory parameter $i<br />\n"; |
245 | 245 | $sqlSelectFrom .= ' LEFT OUTER JOIN ' . $this->params['dbr']->tableName( 'categorylinks' ); |
246 | 246 | $sqlSelectFrom .= ' AS c' . ( $currentTableNumber + 1 ) . ' ON page_id = c' . ( $currentTableNumber + 1 ); |
247 | 247 | $sqlSelectFrom .= '.cl_from AND c' . ( $currentTableNumber + 1 ); |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | $currentTableNumber++; |
253 | 253 | } |
254 | 254 | |
255 | | - if ('lastedit' == $this->params['orderMethod'] ) |
| 255 | + if ( 'lastedit' == $this->params['orderMethod'] ) |
256 | 256 | $sqlWhere .= ' ORDER BY page_touched '; |
257 | 257 | else |
258 | 258 | $sqlWhere .= ' ORDER BY c1.cl_timestamp '; |
— | — | @@ -263,12 +263,12 @@ |
264 | 264 | |
265 | 265 | // FIXME: Note: this is not a boolean type check - will also trap count = 0 which may |
266 | 266 | // accidentally give unlimited returns |
267 | | - if ( 0 < $this->params['count'] ){ |
| 267 | + if ( 0 < $this->params['count'] ) { |
268 | 268 | $sqlWhere .= ' LIMIT ' . $this->params['count']; |
269 | 269 | } |
270 | 270 | |
271 | | - //debug line |
272 | | - //echo "<p>$sqlSelectFrom$sqlWhere;</p>\n"; |
| 271 | + // debug line |
| 272 | + // echo "<p>$sqlSelectFrom$sqlWhere;</p>\n"; |
273 | 273 | |
274 | 274 | return $sqlSelectFrom . $sqlWhere; |
275 | 275 | } |
— | — | @@ -278,7 +278,7 @@ |
279 | 279 | ** |
280 | 280 | * FIXME this includes a lot of DynamicPageList cruft in need of thinning. |
281 | 281 | **/ |
282 | | - public function dpl_parm( $par ){ |
| 282 | + public function dpl_parm( $par ) { |
283 | 283 | global $wgContLang; |
284 | 284 | global $wgRequest; |
285 | 285 | |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | // FIXME: note: if ( false === $count ) then no count has ever been set |
288 | 288 | // however, there's still no guarantee $count <> zero || NULL |
289 | 289 | $this->params['count'] = $this->wgDPLmaxResultCount; |
290 | | - |
| 290 | + |
291 | 291 | $this->params['orderMethod'] = 'categoryadd'; |
292 | 292 | $this->params['order'] = 'descending'; |
293 | 293 | $this->params['redirects'] = 'exclude'; |
— | — | @@ -301,8 +301,8 @@ |
302 | 302 | $this->params['suppressErrors'] = false; |
303 | 303 | |
304 | 304 | $this->params['feed'] = 'atom'; |
305 | | - $feedType = explode( '/', $par, 2); |
306 | | - switch( strtolower($feedType[0])){ |
| 305 | + $feedType = explode( '/', $par, 2 ); |
| 306 | + switch( strtolower( $feedType[0] ) ) { |
307 | 307 | case 'rss': |
308 | 308 | $this->params['feed'] = 'rss'; |
309 | 309 | break; |
— | — | @@ -312,56 +312,56 @@ |
313 | 313 | default: |
314 | 314 | $this->params['feed'] = 'atom'; |
315 | 315 | break; |
316 | | - } |
| 316 | + } |
317 | 317 | |
318 | 318 | $parser = new Parser; |
319 | 319 | $poptions = new ParserOptions; |
320 | 320 | |
321 | | - foreach ( $params as $key=>$value ){ |
322 | | - switch ( $key ){ |
| 321 | + foreach ( $params as $key => $value ) { |
| 322 | + switch ( $key ) { |
323 | 323 | case 'category': |
324 | 324 | $title = Title::newFromText( $parser->transformMsg( $value, $poptions ) ); |
325 | 325 | |
326 | | - if ( is_object( $title ) ){ |
| 326 | + if ( is_object( $title ) ) { |
327 | 327 | $this->categories[] = $title; |
328 | | - }else{ |
| 328 | + } else { |
329 | 329 | echo "Explode on category.\n"; |
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | break; |
333 | 333 | case 'notcategory': |
334 | | - //echo "Got notcategory $value\n"; |
| 334 | + // echo "Got notcategory $value\n"; |
335 | 335 | $title = Title::newFromText( $parser->transformMsg( $value, $poptions ) ); |
336 | 336 | if ( is_object( $title ) ) |
337 | 337 | $this->notCategories[] = $title; |
338 | | - else{ |
| 338 | + else { |
339 | 339 | echo 'Explode on notCategory.'; |
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | break; |
343 | 343 | case 'namespace': |
344 | | - if ( $value == intval( $value ) ){ |
| 344 | + if ( $value == intval( $value ) ) { |
345 | 345 | $this->params['iNameSpace'] = intval( $value ); |
346 | | - if ( 0 <= $this->params['iNameSpace'] ){ |
| 346 | + if ( 0 <= $this->params['iNameSpace'] ) { |
347 | 347 | $this->params['nameSpace'] = true; |
348 | | - }else{ |
| 348 | + } else { |
349 | 349 | $this->params['nameSpace'] = false; |
350 | 350 | } |
351 | | - }else{ |
| 351 | + } else { |
352 | 352 | $ns = $wgContLang->getNsIndex( $value ); |
353 | | - if ( null !== $ns ){ |
| 353 | + if ( null !== $ns ) { |
354 | 354 | $this->params['iNameSpace'] = $ns; |
355 | 355 | $this->params['nameSpace'] = true; |
356 | 356 | } |
357 | 357 | } |
358 | 358 | break; |
359 | 359 | case 'count': |
360 | | - if ( ( $this->wgDPLminResultCount < $value ) && ( $value < $this->wgDPLmaxResultCount ) ){ |
| 360 | + if ( ( $this->wgDPLminResultCount < $value ) && ( $value < $this->wgDPLmaxResultCount ) ) { |
361 | 361 | $this->params['count'] = intval( $value ); |
362 | 362 | } |
363 | 363 | break; |
364 | 364 | case 'order'; |
365 | | - switch ( $value ){ |
| 365 | + switch ( $value ) { |
366 | 366 | case 'ascending': |
367 | 367 | $this->params['order'] = 'ascending'; |
368 | 368 | break; |
— | — | @@ -372,7 +372,7 @@ |
373 | 373 | } |
374 | 374 | break; |
375 | 375 | case 'ordermethod'; |
376 | | - switch ( $value ){ |
| 376 | + switch ( $value ) { |
377 | 377 | case 'lastedit': |
378 | 378 | $this->params['orderMethod'] = 'lastedit'; |
379 | 379 | break; |
— | — | @@ -383,7 +383,7 @@ |
384 | 384 | } |
385 | 385 | break; |
386 | 386 | case 'redirects'; |
387 | | - switch ( $value ){ |
| 387 | + switch ( $value ) { |
388 | 388 | case 'include': |
389 | 389 | $this->params['redirects'] = 'include'; |
390 | 390 | break; |
— | — | @@ -397,7 +397,7 @@ |
398 | 398 | } |
399 | 399 | break; |
400 | 400 | case 'stablepages': |
401 | | - switch ( $value ){ |
| 401 | + switch ( $value ) { |
402 | 402 | case 'include': |
403 | 403 | $this->params['stable'] = 'include'; |
404 | 404 | break; |
— | — | @@ -411,7 +411,7 @@ |
412 | 412 | } |
413 | 413 | break; |
414 | 414 | case 'qualitypages': |
415 | | - switch ( $value ){ |
| 415 | + switch ( $value ) { |
416 | 416 | case 'include': |
417 | 417 | $this->params['quality'] = 'include'; |
418 | 418 | break; |
— | — | @@ -443,26 +443,26 @@ |
444 | 444 | $this->params['catCount'] = count( $this->categories ); |
445 | 445 | $this->params['notCatCount'] = count( $this->notCategories ); |
446 | 446 | $totalCatCount = $this->params['catCount'] + $this->params['notCatCount']; |
447 | | - |
448 | | - if (( $this->params['catCount'] < 1 && false == $this->params['nameSpace'] ) || ( $totalCatCount < $this->wgDPlminCategories )){ |
449 | | - //echo "Boom on catCount\n"; |
| 447 | + |
| 448 | + if ( ( $this->params['catCount'] < 1 && false == $this->params['nameSpace'] ) || ( $totalCatCount < $this->wgDPlminCategories ) ) { |
| 449 | + // echo "Boom on catCount\n"; |
450 | 450 | $parser = new Parser; |
451 | 451 | $poptions = new ParserOptions; |
452 | 452 | $feed = Title::newFromText( $parser->transformMsg( 'Published', $poptions ) ); |
453 | | - if ( is_object( $feed ) ){ |
| 453 | + if ( is_object( $feed ) ) { |
454 | 454 | $this->categories[] = $feed; |
455 | 455 | $this->params['catCount'] = count( $this->categories ); |
456 | | - }else{ |
| 456 | + } else { |
457 | 457 | echo "\$feed is not an object.\n"; |
458 | 458 | continue; |
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | | - if ( ( $totalCatCount > $this->wgDPlmaxCategories ) && ( !$this->wgDPLallowUnlimitedCategories ) ){ |
| 462 | + if ( ( $totalCatCount > $this->wgDPlmaxCategories ) && ( !$this->wgDPLallowUnlimitedCategories ) ) { |
463 | 463 | $this->params['error'] = htmlspecialchars( wfMsg( 'intersection_toomanycats' ) ); // "!!too many categories!!"; |
464 | 464 | } |
465 | 465 | |
466 | | - //disallow showing date if the query doesn't have an inclusion category parameter |
| 466 | + // disallow showing date if the query doesn't have an inclusion category parameter |
467 | 467 | if ( $this->params['count'] < 1 ) |
468 | 468 | $this->params['addFirstCategoryDate'] = false; |
469 | 469 | |
— | — | @@ -478,37 +478,37 @@ |
479 | 479 | return isset( $row->comment ) ? htmlspecialchars( $row->comment ) : ''; |
480 | 480 | } |
481 | 481 | |
482 | | - function getKeywords ( $title ){ |
| 482 | + function getKeywords ( $title ) { |
483 | 483 | $cats = $title->getParentCategories(); |
484 | 484 | $str = ''; |
485 | | - #the following code is based (stolen) from r56954 of flagged revs. |
| 485 | + # the following code is based (stolen) from r56954 of flagged revs. |
486 | 486 | $catMap = Array(); |
487 | 487 | $catMask = Array(); |
488 | 488 | $msg = wfMsg( 'gnsm_categorymap' ); |
489 | 489 | if ( !wfEmptyMsg( 'gnsm_categorymap', $msg ) ) { |
490 | | - $list = explode( "\n*", "\n$msg"); |
491 | | - foreach($list as $item) { |
492 | | - $mapping = explode('|', $item, 2); |
| 490 | + $list = explode( "\n*", "\n$msg" ); |
| 491 | + foreach ( $list as $item ) { |
| 492 | + $mapping = explode( '|', $item, 2 ); |
493 | 493 | if ( count( $mapping ) == 2 ) { |
494 | | - if ( trim( $mapping[1] ) == '__MASK__') { |
495 | | - $catMask[trim($mapping[0])] = true; |
| 494 | + if ( trim( $mapping[1] ) == '__MASK__' ) { |
| 495 | + $catMask[trim( $mapping[0] )] = true; |
496 | 496 | } else { |
497 | | - $catMap[trim($mapping[0])] = trim($mapping[1]); |
| 497 | + $catMap[trim( $mapping[0] )] = trim( $mapping[1] ); |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | | - foreach ( $cats as $key => $val ){ |
| 502 | + foreach ( $cats as $key => $val ) { |
503 | 503 | $cat = str_replace( '_', ' ', trim( substr( $key, strpos( $key, ':' ) + 1 ) ) ); |
504 | | - if (!isset($catMask[$cat])) { |
505 | | - if (isset($catMap[$cat])) { |
| 504 | + if ( !isset( $catMask[$cat] ) ) { |
| 505 | + if ( isset( $catMap[$cat] ) ) { |
506 | 506 | $str .= ', ' . str_replace( '_', ' ', trim ( $catMap[$cat] ) ); |
507 | 507 | } else { |
508 | 508 | $str .= ', ' . $cat; |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } |
512 | | - $str = substr( $str, 2 ); #to remove leading ', ' |
| 512 | + $str = substr( $str, 2 ); # to remove leading ', ' |
513 | 513 | return $str; |
514 | 514 | } |
515 | 515 | |
— | — | @@ -519,7 +519,7 @@ |
520 | 520 | ** |
521 | 521 | * Base class for basic SiteMap support, for building url containers. |
522 | 522 | **/ |
523 | | -class FeedSitemapItem{ |
| 523 | +class FeedSitemapItem { |
524 | 524 | /** |
525 | 525 | * Var string |
526 | 526 | **/ |
— | — | @@ -529,7 +529,7 @@ |
530 | 530 | var $lastMod = ''; |
531 | 531 | var $priority = ''; |
532 | 532 | |
533 | | - function __construct( $url, $pubDate, $keywords = '', $lastMod = '', $priority = ''){ |
| 533 | + function __construct( $url, $pubDate, $keywords = '', $lastMod = '', $priority = '' ) { |
534 | 534 | $this->url = $url; |
535 | 535 | $this->pubDate = $pubDate; |
536 | 536 | $this->keywords = $keywords; |
— | — | @@ -537,29 +537,29 @@ |
538 | 538 | $this->priority = $priority; |
539 | 539 | } |
540 | 540 | |
541 | | - public function xmlEncode( $string ){ |
| 541 | + public function xmlEncode( $string ) { |
542 | 542 | $string = str_replace( "\r\n", "\n", $string ); |
543 | 543 | $string = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', '', $string ); |
544 | 544 | return htmlspecialchars( $string ); |
545 | 545 | } |
546 | 546 | |
547 | | - public function getUrl(){ |
| 547 | + public function getUrl() { |
548 | 548 | return $this->url; |
549 | 549 | } |
550 | 550 | |
551 | | - public function getPriority(){ |
| 551 | + public function getPriority() { |
552 | 552 | return $this->priority; |
553 | 553 | } |
554 | 554 | |
555 | | - public function getLastMod(){ |
| 555 | + public function getLastMod() { |
556 | 556 | return $this->lastMod; |
557 | 557 | } |
558 | 558 | |
559 | | - public function getKeywords (){ |
| 559 | + public function getKeywords () { |
560 | 560 | return $this->xmlEncode( $this->keywords ); |
561 | 561 | } |
562 | 562 | |
563 | | - public function getPubDate(){ |
| 563 | + public function getPubDate() { |
564 | 564 | return $this->pubDate; |
565 | 565 | } |
566 | 566 | |
— | — | @@ -588,7 +588,7 @@ |
589 | 589 | |
590 | 590 | } |
591 | 591 | |
592 | | - function outXmlHeader(){ |
| 592 | + function outXmlHeader() { |
593 | 593 | global $wgStylePath, $wgStyleVersion; |
594 | 594 | |
595 | 595 | $this->httpHeaders(); |
— | — | @@ -603,18 +603,18 @@ |
604 | 604 | **/ |
605 | 605 | function contentType() { |
606 | 606 | global $wgRequest; |
607 | | - $ctype = $wgRequest->getVal('ctype','application/xml'); |
608 | | - $allowedctypes = array('application/xml','text/xml','application/rss+xml','application/atom+xml'); |
609 | | - return (in_array($ctype, $allowedctypes) ? $ctype : 'application/xml'); |
| 607 | + $ctype = $wgRequest->getVal( 'ctype', 'application/xml' ); |
| 608 | + $allowedctypes = array( 'application/xml', 'text/xml', 'application/rss+xml', 'application/atom+xml' ); |
| 609 | + return ( in_array( $ctype, $allowedctypes ) ? $ctype : 'application/xml' ); |
610 | 610 | } |
611 | 611 | |
612 | 612 | } |
613 | 613 | |
614 | | -class SitemapFeed extends FeedSitemapItem{ |
| 614 | +class SitemapFeed extends FeedSitemapItem { |
615 | 615 | /** |
616 | 616 | * Output feed headers |
617 | 617 | **/ |
618 | | - function outHeader(){ |
| 618 | + function outHeader() { |
619 | 619 | $this->outXmlHeader(); |
620 | 620 | ?> |
621 | 621 | <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" |
— | — | @@ -635,21 +635,21 @@ |
636 | 636 | <news:publication_date> |
637 | 637 | <?php print $item->getPubDate() ?> |
638 | 638 | </news:publication_date> |
639 | | - <?php if( $item->getKeywords() ){ |
| 639 | + <?php if ( $item->getKeywords() ) { |
640 | 640 | echo '<news:keywords>' . $item->getKeywords() . "</news:keywords>\n"; |
641 | 641 | } |
642 | 642 | ?> |
643 | 643 | </news:news> |
644 | | - <?php if( $item->getLastMod() ){ ?> |
| 644 | + <?php if ( $item->getLastMod() ) { ?> |
645 | 645 | <lastmod> |
646 | 646 | <?php print $item->getLastMod(); ?> |
647 | 647 | </lastmod> |
648 | | - <?php }?> |
649 | | - <?php if( $item->getPriority() ){ ?> |
| 648 | + <?php } ?> |
| 649 | + <?php if ( $item->getPriority() ) { ?> |
650 | 650 | <priority> |
651 | 651 | <? print $item->getPriority(); ?> |
652 | 652 | </priority> |
653 | | - <?php }?> |
| 653 | + <?php } ?> |
654 | 654 | </url> |
655 | 655 | <?php |
656 | 656 | } |
— | — | @@ -657,7 +657,7 @@ |
658 | 658 | /** |
659 | 659 | * Output SiteMap 0.9 footer |
660 | 660 | **/ |
661 | | - function outFooter(){ |
| 661 | + function outFooter() { |
662 | 662 | echo '</urlset>'; |
663 | 663 | } |
664 | 664 | |
Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap.i18n.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @ingroup Extensions |
9 | 9 | */ |
10 | 10 | |
11 | | -$messages= array(); |
| 11 | +$messages = array(); |
12 | 12 | |
13 | 13 | /** English |
14 | 14 | * @author Amgine |
Index: trunk/extensions/GoogleNewsSitemap/GoogleNewsSitemap.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -if (!defined('MEDIAWIKI')) { |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
4 | 4 | echo <<<EOT |
5 | 5 | To install GoogleNewsSitemap extension, an extension special page, put the following line in LocalSettings.php: |
6 | 6 | require_once( dirname(__FILE__) . '/extensions/GoogleNewsSitemap/GoogleNewsSitemap.php' ); |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | 'url' => 'http://www.mediawiki.org/wiki/Extension:GoogleNewsSitemap', |
63 | 63 | ); |
64 | 64 | |
65 | | -$dir = dirname(__FILE__) . '/'; |
| 65 | +$dir = dirname( __FILE__ ) . '/'; |
66 | 66 | $wgExtensionMessagesFiles['GoogleNewsSitemap'] = $dir . 'GoogleNewsSitemap.i18n.php'; |
67 | 67 | $wgExtensionAliasesFiles['GoogleNewsSitemap'] = $dir . 'GoogleNewsSitemap.alias.php'; |
68 | 68 | $wgAutoloadClasses['GoogleNewsSitemap'] = $dir . 'GoogleNewsSitemap_body.php'; |