r51897 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51896‎ | r51897 | r51898 >
Date:13:01, 15 June 2009
Author:jojo
Status:ok
Tags:
Comment:
MW coding conventions
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.hooks.php (modified) (history)
  • /trunk/extensions/Collection/Collection.templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.hooks.php
@@ -171,7 +171,7 @@
172172 $showShowAndClearLinks = true;
173173 $addRemoveState = '';
174174
175 - $out = Xml::element( 'ul', array( 'id' => 'collectionPortletList' ), NULL );
 175+ $out = Xml::element( 'ul', array( 'id' => 'collectionPortletList' ), null );
176176
177177 if( self::_isCollectionPage( $wgTitle, $wgArticle) ) {
178178 $out .= Xml::tags(
@@ -189,7 +189,7 @@
190190 )
191191 );
192192 $showShowAndClearLinks = false;
193 - } else if( $ajaxHint == 'addcategory' || $namespace == NS_CATEGORY ) {
 193+ } elseif( $ajaxHint == 'addcategory' || $namespace == NS_CATEGORY ) {
194194 $addRemoveState = 'addcategory';
195195 $out .= Xml::tags(
196196 'li',
@@ -206,7 +206,7 @@
207207 array( 'known', 'noclasses' )
208208 )
209209 );
210 - } else if( $ajaxHint || in_array( $namespace, $wgCollectionArticleNamespaces ) ) {
 210+ } elseif( $ajaxHint || in_array( $namespace, $wgCollectionArticleNamespaces ) ) {
211211 $params = array( 'arttitle' => $wgTitle->getPrefixedText() );
212212 if ( !is_null( $wgArticle ) ) {
213213 $oldid = $wgArticle->getOldID();
Index: trunk/extensions/Collection/Collection.body.php
@@ -179,7 +179,7 @@
180180 $title = Title::newFromText(
181181 $userPageTitle . '/' . wfMsgForContent( 'coll-collections' ) . '/' . $collname
182182 );
183 - } else if ( $colltype == 'community' ) {
 183+ } elseif ( $colltype == 'community' ) {
184184 $collname = $wgRequest->getVal( 'ccollname' );
185185 if ( !$wgUser->isAllowed( 'collectionsaveascommunitypage' ) || empty( $collname ) ) {
186186 return;
@@ -296,7 +296,7 @@
297297 usort( $articles, array( self, 'title_cmp' ) );
298298 $new_items = array_merge( $new_items, $articles, array( $item ) );
299299 $articles = array();
300 - } else if ( $item['type'] == 'article' ) {
 300+ } elseif ( $item['type'] == 'article' ) {
301301 $articles[] = $item;
302302 }
303303 }
@@ -484,21 +484,21 @@
485485 $line = trim( $line );
486486 if ( !$append && preg_match( '/^===\s*(.*?)\s*===$/', $line, $match) ) {
487487 $collection['subtitle'] = $match[ 1 ];
488 - } else if ( !$append && preg_match( '/^==\s*(.*?)\s*==$/', $line, $match) ) {
 488+ } elseif ( !$append && preg_match( '/^==\s*(.*?)\s*==$/', $line, $match) ) {
489489 $collection['title'] = $match[ 1 ];
490 - } else if (substr( $line, 0, 1 ) == ';') { // chapter
 490+ } elseif (substr( $line, 0, 1 ) == ';') { // chapter
491491 return array(
492492 'type' => 'chapter',
493493 'title' => trim( substr( $line, 1 ) ),
494494 );
495 - } else if ( substr( $line, 0, 1 ) == ':' ) { // article
 495+ } elseif ( substr( $line, 0, 1 ) == ':' ) { // article
496496 $articleTitle = trim( substr( $line, 1 ) );
497497 if ( preg_match( '/\[\[:?(.*?)(\|(.*?))?\]\]/', $articleTitle, $match ) ) {
498498 $articleTitle = $match[1];
499499 $displayTitle = $match[3];
500500 $oldid = -1;
501501 $currentVersion = 1;
502 - } else if ( preg_match( '/\[\{\{fullurl:(.*?)\|oldid=(.*?)\}\}\s+(.*?)\]/', $articleTitle, $match ) ) {
 502+ } elseif ( preg_match( '/\[\{\{fullurl:(.*?)\|oldid=(.*?)\}\}\s+(.*?)\]/', $articleTitle, $match ) ) {
503503 $articleTitle = $match[1];
504504 $displayTitle = $match[3];
505505 $oldid = $match[2];
@@ -593,7 +593,7 @@
594594 foreach ( $collection['items'] as $item ) {
595595 if ( $item['type'] == 'chapter' ) {
596596 $articleText .= ';' . $item['title'] . "\n";
597 - } else if ( $item['type'] == 'article' ) {
 597+ } elseif ( $item['type'] == 'article' ) {
598598 if ($item['currentVersion'] == 1) {
599599 $articleText .= ":[[" . $item['title'];
600600 if ( $item['displaytitle'] ) {
@@ -690,7 +690,7 @@
691691 } else {
692692 $currentChapter['items'][] = $item;
693693 }
694 - } else if ( $item['type'] == 'chapter' ) {
 694+ } elseif ( $item['type'] == 'chapter' ) {
695695 if ( !is_null( $currentChapter ) ) {
696696 $items[] = $currentChapter;
697697 }
@@ -824,7 +824,7 @@
825825 $statusText = $response['status']['status'];
826826 if ( isset( $response['status']['article'] ) && $response['status']['article'] ) {
827827 $statusText .= ' ' . wfMsg( 'coll-rendering_article', $response['status']['article'] );
828 - } else if ( isset( $response['status']['page'] ) && $response['status']['page'] ) {
 828+ } elseif ( isset( $response['status']['page'] ) && $response['status']['page'] ) {
829829 $statusText .= ' ' . wfMsg( 'coll-rendering_page', $wgLang->formatNum( $response['status']['page'] ) );
830830 }
831831 $status = wfMsg( 'coll-rendering_status', $statusText );
@@ -1046,7 +1046,7 @@
10471047 $text = false;
10481048 $errorMessage = curl_error( $c );
10491049 $headers = false;
1050 - } else if ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
 1050+ } elseif ( curl_getinfo( $c, CURLINFO_HTTP_CODE ) != 200 ) {
10511051 $text = false;
10521052 $errorMessage = 'HTTP status ' . curl_getinfo( $c, CURLINFO_HTTP_CODE );
10531053 $headers = false;
Index: trunk/extensions/Collection/Collection.templates.php
@@ -262,7 +262,7 @@
263263 } ?>
264264 </span>
265265 </li>
266 - <?php } else if ($item['type'] == 'chapter') { ?>
 266+ <?php } elseif ($item['type'] == 'chapter') { ?>
267267 <li id="item-<?php echo intval( $index ) ?>" class="chapter" style="margin-top:0.3em;">
268268 <a onclick="return coll_remove_item(<?php echo intval( $index ) ?>)" href="<?php echo htmlspecialchars(SkinTemplate::makeSpecialUrlSubpage('Book', 'remove_item/', 'index=' . $index)) ?>" title="<?php $this->msg('coll-remove') ?>"><img src="<?php echo htmlspecialchars($mediapath . "remove.png") ?>" width="10" height="10" alt="<?php $this->msg('coll-remove') ?>" /></a>
269269 <noscript>

Status & tagging log