Update code formatting
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Mon, 25 Mar 2013 22:52:41 +0000 (23:52 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 27 Mar 2013 13:03:33 +0000 (13:03 +0000)
Used PHPStorm's code formatting feature, with manual checks and updates.

Change-Id: I0496eba007056bc9c4b09163387f11d6cea2a55d

13 files changed:
includes/specials/SpecialAllmessages.php
includes/specials/SpecialAllpages.php
includes/specials/SpecialAncientpages.php
includes/specials/SpecialBlankpage.php
includes/specials/SpecialBlock.php
includes/specials/SpecialBlockList.php
includes/specials/SpecialBlockme.php
includes/specials/SpecialBooksources.php
includes/specials/SpecialBrokenRedirects.php
includes/specials/SpecialCategories.php
includes/specials/SpecialChangeEmail.php
includes/specials/SpecialChangePassword.php
includes/specials/SpecialComparePages.php

index a60c8ef..855d409 100644 (file)
@@ -53,7 +53,7 @@ class SpecialAllmessages extends SpecialPage {
                $this->setHeaders();
 
                global $wgUseDatabaseMessages;
-               if( !$wgUseDatabaseMessages ) {
+               if ( !$wgUseDatabaseMessages ) {
                        $out->addWikiMsg( 'allmessagesnotsupportedDB' );
                        return;
                } else {
@@ -121,15 +121,15 @@ class AllmessagesTablePager extends TablePager {
                $request = $this->getRequest();
 
                $this->filter = $request->getVal( 'filter', 'all' );
-               if( $this->filter === 'all' ) {
+               if ( $this->filter === 'all' ) {
                        $this->custom = null; // So won't match in either case
                } else {
-                       $this->custom = ($this->filter == 'unmodified');
+                       $this->custom = ( $this->filter == 'unmodified' );
                }
 
                $prefix = $this->getLanguage()->ucfirst( $request->getVal( 'prefix', '' ) );
                $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $request->getVal( 'prefix', null ) ) : null;
-               if( $prefix !== null ) {
+               if ( $prefix !== null ) {
                        $this->displayPrefix = $prefix->getDBkey();
                        $this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i';
                } else {
@@ -139,7 +139,7 @@ class AllmessagesTablePager extends TablePager {
 
                // The suffix that may be needed for message names if we're in a
                // different language (eg [[MediaWiki:Foo/fr]]: $suffix = '/fr'
-               if( $this->foreign ) {
+               if ( $this->foreign ) {
                        $this->suffix = '/' . $this->langcode;
                } else {
                        $this->suffix = '';
@@ -159,36 +159,36 @@ class AllmessagesTablePager extends TablePager {
                        Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" .
                        '<tr>
                                <td class="mw-label">' .
-                                       Xml::label( $this->msg( 'allmessages-prefix' )->text(), 'mw-allmessages-form-prefix' ) .
-                               "</td>\n
-                               <td class=\"mw-input\">" .
-                                       Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->displayPrefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) .
-                               "</td>\n
+                       Xml::label( $this->msg( 'allmessages-prefix' )->text(), 'mw-allmessages-form-prefix' ) .
+                       "</td>\n
+                       <td class=\"mw-input\">" .
+                       Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->displayPrefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) .
+                       "</td>\n
                        </tr>
                        <tr>\n
-                               <td class='mw-label'>" .
-                                       $this->msg( 'allmessages-filter' )->escaped() .
-                               "</td>\n
+                       <td class='mw-label'>" .
+                       $this->msg( 'allmessages-filter' )->escaped() .
+                       "</td>\n
                                <td class='mw-input'>" .
-                                       Xml::radioLabel( $this->msg( 'allmessages-filter-unmodified' )->text(),
-                                               'filter',
-                                               'unmodified',
-                                               'mw-allmessages-form-filter-unmodified',
-                                               ( $this->filter == 'unmodified' )
-                                       ) .
-                                       Xml::radioLabel( $this->msg( 'allmessages-filter-all' )->text(),
-                                               'filter',
-                                               'all',
-                                               'mw-allmessages-form-filter-all',
-                                               ( $this->filter == 'all' )
-                                       ) .
-                                       Xml::radioLabel( $this->msg( 'allmessages-filter-modified' )->text(),
-                                               'filter',
-                                               'modified',
-                                               'mw-allmessages-form-filter-modified',
-                                       ( $this->filter == 'modified' )
-                               ) .
-                               "</td>\n
+                       Xml::radioLabel( $this->msg( 'allmessages-filter-unmodified' )->text(),
+                               'filter',
+                               'unmodified',
+                               'mw-allmessages-form-filter-unmodified',
+                               ( $this->filter == 'unmodified' )
+                       ) .
+                       Xml::radioLabel( $this->msg( 'allmessages-filter-all' )->text(),
+                               'filter',
+                               'all',
+                               'mw-allmessages-form-filter-all',
+                               ( $this->filter == 'all' )
+                       ) .
+                       Xml::radioLabel( $this->msg( 'allmessages-filter-modified' )->text(),
+                               'filter',
+                               'modified',
+                               'mw-allmessages-form-filter-modified',
+                               ( $this->filter == 'modified' )
+                       ) .
+                       "</td>\n
                        </tr>
                        <tr>\n
                                <td class=\"mw-label\">" . $langSelect[0] . "</td>\n
@@ -197,16 +197,16 @@ class AllmessagesTablePager extends TablePager {
 
                        '<tr>
                                <td class="mw-label">' .
-                                       Xml::label( $this->msg( 'table_pager_limit_label' )->text(), 'mw-table_pager_limit_label' ) .
-                               '</td>
-                               <td class="mw-input">' .
-                                       $this->getLimitSelect() .
-                               '</td>
+                       Xml::label( $this->msg( 'table_pager_limit_label' )->text(), 'mw-table_pager_limit_label' ) .
+                       '</td>
+                       <td class="mw-input">' .
+                       $this->getLimitSelect() .
+                       '</td>
                        <tr>
                                <td></td>
                                <td>' .
-                                       Xml::submitButton( $this->msg( 'allmessages-filter-submit' )->text() ) .
-                               "</td>\n
+                       Xml::submitButton( $this->msg( 'allmessages-filter-submit' )->text() ) .
+                       "</td>\n
                        </tr>" .
 
                        Xml::closeElement( 'table' ) .
@@ -219,7 +219,7 @@ class AllmessagesTablePager extends TablePager {
        function getAllMessages( $descending ) {
                wfProfileIn( __METHOD__ );
                $messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' );
-               if( $descending ) {
+               if ( $descending ) {
                        rsort( $messageNames );
                } else {
                        asort( $messageNames );
@@ -260,18 +260,19 @@ class AllmessagesTablePager extends TablePager {
 
                foreach ( $res as $s ) {
                        $exists = false;
-                       if( $foreign ) {
+                       if ( $foreign ) {
                                $title = explode( '/', $s->page_title );
-                               if( count( $title ) === 2 && $langcode == $title[1]
-                                       && isset( $xNames[$title[0]] ) ) {
+                               if ( count( $title ) === 2 && $langcode == $title[1]
+                                       && isset( $xNames[$title[0]] )
+                               ) {
                                        $exists = $title[0];
                                }
-                       } elseif( isset( $xNames[$s->page_title] ) ) {
+                       } elseif ( isset( $xNames[$s->page_title] ) ) {
                                $exists = $s->page_title;
                        }
-                       if( $exists && $s->page_namespace == NS_MEDIAWIKI ) {
+                       if ( $exists && $s->page_namespace == NS_MEDIAWIKI ) {
                                $pageFlags[$exists] = true;
-                       } elseif( $exists && $s->page_namespace == NS_MEDIAWIKI_TALK ) {
+                       } elseif ( $exists && $s->page_namespace == NS_MEDIAWIKI_TALK ) {
                                $talkFlags[$exists] = true;
                        }
                }
@@ -293,24 +294,25 @@ class AllmessagesTablePager extends TablePager {
                $statuses = self::getCustomisedStatuses( $messageNames, $this->langcode, $this->foreign );
 
                $count = 0;
-               foreach( $messageNames as $key ) {
+               foreach ( $messageNames as $key ) {
                        $customised = isset( $statuses['pages'][$key] );
-                       if( $customised !== $this->custom &&
+                       if ( $customised !== $this->custom &&
                                ( $descending && ( $key < $offset || !$offset ) || !$descending && $key > $offset ) &&
                                ( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false )
                        ) {
                                $actual = wfMessage( $key )->inLanguage( $this->langcode )->plain();
                                $default = wfMessage( $key )->inLanguage( $this->langcode )->useDatabase( false )->plain();
                                $result->result[] = array(
-                                       'am_title'      => $key,
-                                       'am_actual'     => $actual,
-                                       'am_default'    => $default,
+                                       'am_title' => $key,
+                                       'am_actual' => $actual,
+                                       'am_default' => $default,
                                        'am_customised' => $customised,
                                        'am_talk_exists' => isset( $statuses['talks'][$key] )
                                );
                                $count++;
                        }
-                       if( $count == $limit ) {
+
+                       if ( $count == $limit ) {
                                break;
                        }
                }
@@ -321,26 +323,26 @@ class AllmessagesTablePager extends TablePager {
                return Xml::openElement( 'table', array( 'class' => 'mw-datatable TablePager', 'id' => 'mw-allmessagestable' ) ) . "\n" .
                        "<thead><tr>
                                <th rowspan=\"2\">" .
-                                       $this->msg( 'allmessagesname' )->escaped() . "
+                       $this->msg( 'allmessagesname' )->escaped() . "
                                </th>
                                <th>" .
-                                       $this->msg( 'allmessagesdefault' )->escaped() .
-                               "</th>
+                       $this->msg( 'allmessagesdefault' )->escaped() .
+                       "</th>
                        </tr>\n
                        <tr>
                                <th>" .
-                                       $this->msg( 'allmessagescurrent' )->escaped() .
-                               "</th>
+                       $this->msg( 'allmessagescurrent' )->escaped() .
+                       "</th>
                        </tr></thead><tbody>\n";
        }
 
        function formatValue( $field, $value ) {
-               switch( $field ) {
+               switch ( $field ) {
                        case 'am_title' :
                                $title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix );
                                $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix );
 
-                               if( $this->mCurrentRow->am_customised ) {
+                               if ( $this->mCurrentRow->am_customised ) {
                                        $title = Linker::linkKnown( $title, $this->getLanguage()->lcfirst( $value ) );
                                } else {
                                        $title = Linker::link(
@@ -376,7 +378,7 @@ class AllmessagesTablePager extends TablePager {
                $s = parent::formatRow( $row );
 
                // But if there's a customised message, add that too.
-               if( $row->am_customised ) {
+               if ( $row->am_customised ) {
                        $s .= Xml::openElement( 'tr', $this->getRowAttrs( $row, true ) );
                        $formatted = strval( $this->formatValue( 'am_actual', $row->am_actual ) );
                        if ( $formatted == '' ) {
@@ -390,19 +392,19 @@ class AllmessagesTablePager extends TablePager {
 
        function getRowAttrs( $row, $isSecond = false ) {
                $arr = array();
-               if( $row->am_customised ) {
+               if ( $row->am_customised ) {
                        $arr['class'] = 'allmessages-customised';
                }
-               if( !$isSecond ) {
+               if ( !$isSecond ) {
                        $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLanguage()->lcfirst( $row->am_title ) );
                }
                return $arr;
        }
 
        function getCellAttrs( $field, $value ) {
-               if( $this->mCurrentRow->am_customised && $field == 'am_title' ) {
+               if ( $this->mCurrentRow->am_customised && $field == 'am_title' ) {
                        return array( 'rowspan' => '2', 'class' => $field );
-               } elseif( $field == 'am_title' ) {
+               } elseif ( $field == 'am_title' ) {
                        return array( 'class' => $field );
                } else {
                        return array( 'lang' => $this->langcode, 'dir' => $this->lang->getDir(), 'class' => $field );
index 084d752..f8b6d4e 100644 (file)
@@ -89,14 +89,14 @@ class SpecialAllpages extends IncludableSpecialPage {
 
                $out->setPageTitle(
                        ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) ?
-                       $this->msg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
-                       $this->msg( 'allarticles' )
+                               $this->msg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
+                               $this->msg( 'allarticles' )
                );
                $out->addModuleStyles( 'mediawiki.special' );
 
-               if( $par !== null ) {
+               if ( $par !== null ) {
                        $this->showChunk( $namespace, $par, $to, $hideredirects );
-               } elseif( $from !== null && $to === null ) {
+               } elseif ( $from !== null && $to === null ) {
                        $this->showChunk( $namespace, $from, $to, $hideredirects );
                } else {
                        $this->showToplevel( $namespace, $from, $to, $hideredirects );
@@ -188,10 +188,13 @@ class SpecialAllpages extends IncludableSpecialPage {
                $from = ( $from && $from->isLocal() ) ? $from->getDBkey() : null;
                $to = ( $to && $to->isLocal() ) ? $to->getDBkey() : null;
 
-               if( isset( $from ) )
+               if ( isset( $from ) ) {
                        $where[] = 'page_title >= ' . $dbr->addQuotes( $from );
-               if( isset( $to ) )
+               }
+
+               if ( isset( $to ) ) {
                        $where[] = 'page_title <= ' . $dbr->addQuotes( $to );
+               }
 
                global $wgMemc;
                $key = wfMemcKey( 'allpages', 'ns', $namespace, sha1( $from ), sha1( $to ) );
@@ -201,7 +204,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                $maxPerSubpage = intval( $count / $this->maxLineCount );
                $maxPerSubpage = max( $maxPerSubpage, $this->maxPerPage );
 
-               if( !is_array( $lines ) ) {
+               if ( !is_array( $lines ) ) {
                        $options = array( 'LIMIT' => 1 );
                        $options['ORDER BY'] = 'page_title ASC';
                        $firstTitle = $dbr->selectField( 'page', 'page_title', $where, __METHOD__, $options );
@@ -210,7 +213,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                        $lines = array( $firstTitle );
                        # If we are going to show n rows, we need n+1 queries to find the relevant titles.
                        $done = false;
-                       while( !$done ) {
+                       while ( !$done ) {
                                // Fetch the last title of this chunk and the first of the next
                                $chunk = ( $lastTitle === false )
                                        ? array()
@@ -223,7 +226,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                                );
 
                                $s = $dbr->fetchObject( $res );
-                               if( $s ) {
+                               if ( $s ) {
                                        array_push( $lines, $s->page_title );
                                } else {
                                        // Final chunk, but ended prematurely. Go back and find the end.
@@ -233,8 +236,9 @@ class SpecialAllpages extends IncludableSpecialPage {
                                        array_push( $lines, $endTitle );
                                        $done = true;
                                }
+
                                $s = $res->fetchObject();
-                               if( $s ) {
+                               if ( $s ) {
                                        array_push( $lines, $s->page_title );
                                        $lastTitle = $s->page_title;
                                } else {
@@ -249,8 +253,8 @@ class SpecialAllpages extends IncludableSpecialPage {
 
                // If there are only two or less sections, don't even display them.
                // Instead, display the first section directly.
-               if( count( $lines ) <= 2 ) {
-                       if( !empty( $lines ) ) {
+               if ( count( $lines ) <= 2 ) {
+                       if ( !empty( $lines ) ) {
                                $this->showChunk( $namespace, $from, $to, $hideredirects );
                        } else {
                                $output->addHTML( $this->namespaceForm( $namespace, $from, $to, $hideredirects ) );
@@ -260,7 +264,7 @@ class SpecialAllpages extends IncludableSpecialPage {
 
                # At this point, $lines should contain an even number of elements.
                $out .= Xml::openElement( 'table', array( 'class' => 'allpageslist' ) );
-               while( count ( $lines ) > 0 ) {
+               while ( count( $lines ) > 0 ) {
                        $inpoint = array_shift( $lines );
                        $outpoint = array_shift( $lines );
                        $out .= $this->showline( $inpoint, $outpoint, $namespace, $hideredirects );
@@ -269,19 +273,19 @@ class SpecialAllpages extends IncludableSpecialPage {
                $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects );
 
                # Is there more?
-               if( $this->including() ) {
+               if ( $this->including() ) {
                        $out2 = '';
                } else {
-                       if( isset( $from ) || isset( $to ) ) {
-                               $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ).
-                                               '<tr>
+                       if ( isset( $from ) || isset( $to ) ) {
+                               $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ) .
+                                       '<tr>
                                                        <td>' .
-                                                               $nsForm .
-                                                       '</td>
+                                       $nsForm .
+                                       '</td>
                                                        <td class="mw-allpages-nav">' .
-                                                               Linker::link( $this->getTitle(), $this->msg( 'allpages' )->escaped(),
-                                                                       array(), array(), 'known' ) .
-                                                       "</td>
+                                       Linker::link( $this->getTitle(), $this->msg( 'allpages' )->escaped(),
+                                               array(), array(), 'known' ) .
+                                       "</td>
                                                </tr>" .
                                        Xml::closeElement( 'table' );
                        } else {
@@ -365,7 +369,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                                $conds['page_is_redirect'] = 0;
                        }
 
-                       if( $toKey !== "" ) {
+                       if ( $toKey !== "" ) {
                                $conds[] = 'page_title <= ' . $dbr->addQuotes( $toKey );
                        }
 
@@ -374,33 +378,36 @@ class SpecialAllpages extends IncludableSpecialPage {
                                $conds,
                                __METHOD__,
                                array(
-                                       'ORDER BY'  => 'page_title',
-                                       'LIMIT'     => $this->maxPerPage + 1,
+                                       'ORDER BY' => 'page_title',
+                                       'LIMIT' => $this->maxPerPage + 1,
                                        'USE INDEX' => 'name_title',
                                )
                        );
 
-                       if( $res->numRows() > 0 ) {
+                       if ( $res->numRows() > 0 ) {
                                $out = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-chunk' ) );
-                               while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
+                               while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                        $t = Title::newFromRow( $s );
-                                       if( $t ) {
+                                       if ( $t ) {
                                                $link = ( $s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
                                                        Linker::link( $t ) .
-                                                       ($s->page_is_redirect ? '</div>' : '' );
+                                                       ( $s->page_is_redirect ? '</div>' : '' );
                                        } else {
                                                $link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
                                        }
-                                       if( $n % 3 == 0 ) {
+
+                                       if ( $n % 3 == 0 ) {
                                                $out .= '<tr>';
                                        }
+
                                        $out .= "<td style=\"width:33%\">$link</td>";
                                        $n++;
-                                       if( $n % 3 == 0 ) {
+                                       if ( $n % 3 == 0 ) {
                                                $out .= "</tr>\n";
                                        }
                                }
-                               if( ($n % 3) != 0 ) {
+
+                               if ( ( $n % 3 ) != 0 ) {
                                        $out .= "</tr>\n";
                                }
                                $out .= Xml::closeElement( 'table' );
@@ -412,7 +419,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                if ( $this->including() ) {
                        $out2 = '';
                } else {
-                       if( $from == '' ) {
+                       if ( $from == '' ) {
                                // First chunk; no previous link.
                                $prevTitle = null;
                        } else {
@@ -429,20 +436,20 @@ class SpecialAllpages extends IncludableSpecialPage {
                                );
 
                                # Get first title of previous complete chunk
-                               if( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) {
+                               if ( $dbr->numrows( $res_prev ) >= $this->maxPerPage ) {
                                        $pt = $dbr->fetchObject( $res_prev );
                                        $prevTitle = Title::makeTitle( $namespace, $pt->page_title );
                                } else {
                                        # The previous chunk is not complete, need to link to the very first title
                                        # available in the database
                                        $options = array( 'LIMIT' => 1 );
-                                       if ( ! $dbr->implicitOrderby() ) {
+                                       if ( !$dbr->implicitOrderby() ) {
                                                $options['ORDER BY'] = 'page_title';
                                        }
                                        $reallyFirstPage_title = $dbr->selectField( 'page', 'page_title',
                                                array( 'page_namespace' => $namespace ), __METHOD__, $options );
                                        # Show the previous link if it s not the current requested chunk
-                                       if( $from != $reallyFirstPage_title ) {
+                                       if ( $from != $reallyFirstPage_title ) {
                                                $prevTitle = Title::makeTitle( $namespace, $reallyFirstPage_title );
                                        } else {
                                                $prevTitle = null;
@@ -453,23 +460,25 @@ class SpecialAllpages extends IncludableSpecialPage {
                        $self = $this->getTitle();
 
                        $nsForm = $this->namespaceForm( $namespace, $from, $to, $hideredirects );
-                       $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ).
-                                               '<tr>
+                       $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ) .
+                               '<tr>
                                                        <td>' .
-                                                               $nsForm .
-                                                       '</td>
+                               $nsForm .
+                               '</td>
                                                        <td class="mw-allpages-nav">' .
-                                                               Linker::link( $self, $this->msg( 'allpages' )->escaped() );
+                               Linker::link( $self, $this->msg( 'allpages' )->escaped() );
 
                        # Do we put a previous link ?
-                       if( isset( $prevTitle ) && $pt = $prevTitle->getText() ) {
+                       if ( isset( $prevTitle ) && $pt = $prevTitle->getText() ) {
                                $query = array( 'from' => $prevTitle->getText() );
 
-                               if( $namespace )
+                               if ( $namespace ) {
                                        $query['namespace'] = $namespace;
+                               }
 
-                               if( $hideredirects )
+                               if ( $hideredirects ) {
                                        $query['hideredirects'] = $hideredirects;
+                               }
 
                                $prevLink = Linker::linkKnown(
                                        $self,
@@ -480,16 +489,18 @@ class SpecialAllpages extends IncludableSpecialPage {
                                $out2 = $this->getLanguage()->pipeList( array( $out2, $prevLink ) );
                        }
 
-                       if( $n == $this->maxPerPage && $s = $res->fetchObject() ) {
+                       if ( $n == $this->maxPerPage && $s = $res->fetchObject() ) {
                                # $s is the first link of the next chunk
                                $t = Title::makeTitle( $namespace, $s->page_title );
                                $query = array( 'from' => $t->getText() );
 
-                               if( $namespace )
+                               if ( $namespace ) {
                                        $query['namespace'] = $namespace;
+                               }
 
-                               if( $hideredirects )
+                               if ( $hideredirects ) {
                                        $query['hideredirects'] = $hideredirects;
+                               }
 
                                $nextLink = Linker::linkKnown(
                                        $self,
@@ -505,15 +516,21 @@ class SpecialAllpages extends IncludableSpecialPage {
                $output->addHTML( $out2 . $out );
 
                $links = array();
-               if ( isset( $prevLink ) ) $links[] = $prevLink;
-               if ( isset( $nextLink ) ) $links[] = $nextLink;
+               if ( isset( $prevLink ) ) {
+                       $links[] = $prevLink;
+               }
+
+               if ( isset( $nextLink ) ) {
+                       $links[] = $nextLink;
+               }
 
                if ( count( $links ) ) {
                        $output->addHTML(
                                Html::element( 'hr' ) .
-                               Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ),
-                                       $this->getLanguage()->pipeList( $links )
-                               ) );
+                                       Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ),
+                                               $this->getLanguage()->pipeList( $links )
+                                       )
+                       );
                }
 
        }
@@ -524,8 +541,10 @@ class SpecialAllpages extends IncludableSpecialPage {
         * @return array( int namespace, string dbkey, string pagename ) or NULL on error
         */
        protected function getNamespaceKeyAndText( $ns, $text ) {
-               if ( $text == '' )
-                       return array( $ns, '', '' ); # shortcut for common case
+               if ( $text == '' ) {
+                       # shortcut for common case
+                       return array( $ns, '', '' );
+               }
 
                $t = Title::makeTitleSafe( $ns, $text );
                if ( $t && $t->isLocal() ) {
index b0f333c..fafe75f 100644 (file)
@@ -43,12 +43,16 @@ class AncientPagesPage extends QueryPage {
        function getQueryInfo() {
                return array(
                        'tables' => array( 'page', 'revision' ),
-                       'fields' => array( 'namespace' => 'page_namespace',
-                                       'title' => 'page_title',
-                                       'value' => 'rev_timestamp' ),
-                       'conds' => array( 'page_namespace' => MWNamespace::getContentNamespaces(),
-                                       'page_is_redirect' => 0,
-                                       'page_latest=rev_id' )
+                       'fields' => array(
+                               'namespace' => 'page_namespace',
+                               'title' => 'page_title',
+                               'value' => 'rev_timestamp'
+                       ),
+                       'conds' => array(
+                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_is_redirect' => 0,
+                               'page_latest=rev_id'
+                       )
                );
        }
 
index bfa2f95..e61f12b 100644 (file)
@@ -31,6 +31,7 @@ class SpecialBlankpage extends UnlistedSpecialPage {
        public function __construct() {
                parent::__construct( 'Blankpage' );
        }
+
        public function execute( $par ) {
                $this->setHeaders();
                $this->getOutput()->addWikiMsg( 'intentionallyblankpage' );
index 8dafbae..53f7f4d 100644 (file)
@@ -110,10 +110,10 @@ class SpecialBlock extends FormSpecialPage {
                        $s = HTMLForm::formatErrors( $this->preErrors );
                        if ( $s ) {
                                $form->addHeaderText( Html::rawElement(
-                                               'div',
-                                               array( 'class' => 'error' ),
-                                               $s
-                                       ) );
+                                       'div',
+                                       array( 'class' => 'error' ),
+                                       $s
+                               ) );
                        }
                }
        }
@@ -241,8 +241,7 @@ class SpecialBlock extends FormSpecialPage {
                if ( $block instanceof Block && !$block->mAuto # The block exists and isn't an autoblock
                        && ( $this->type != Block::TYPE_RANGE # The block isn't a rangeblock
                                || $block->getTarget() == $this->target ) # or if it is, the range is what we're about to block
-                       )
-               {
+               ) {
                        $fields['HardBlock']['default'] = $block->isHardblock();
                        $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
                        $fields['AutoBlock']['default'] = $block->isAutoblocking();
@@ -460,8 +459,8 @@ class SpecialBlock extends FormSpecialPage {
                $i = 0;
                $target = null;
 
-               while( true ) {
-                       switch( $i++ ) {
+               while ( true ) {
+                       switch ( $i++ ) {
                                case 0:
                                        # The HTMLForm will check wpTarget first and only if it doesn't get
                                        # a value use the default, which will be generated from the options
@@ -620,8 +619,8 @@ class SpecialBlock extends FormSpecialPage {
                        # but $data['target'] gets overriden by (non-normalized) request variable
                        # from previous request.
                        if ( $target === $performer->getName() &&
-                               ( $data['PreviousTarget'] !== $target || !$data['Confirm'] ) )
-                       {
+                               ( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
+                       {
                                return array( 'ipb-blockingself' );
                        }
                } elseif ( $type == Block::TYPE_RANGE ) {
@@ -635,8 +634,8 @@ class SpecialBlock extends FormSpecialPage {
                }
 
                if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 )
-                       || !self::parseExpiryInput( $data['Expiry'] ) )
-               {
+                       || !self::parseExpiryInput( $data['Expiry'] )
+               {
                        return array( 'ipb_expiry_invalid' );
                }
 
@@ -703,9 +702,9 @@ class SpecialBlock extends FormSpecialPage {
                        $reblockNotAllowed = ( array_key_exists( 'Reblock', $data ) && !$data['Reblock'] );
 
                        # Show form unless the user is already aware of this...
-                       if( $blockNotConfirmed || $reblockNotAllowed ) {
+                       if ( $blockNotConfirmed || $reblockNotAllowed ) {
                                return array( array( 'ipb_already_blocked', $block->getTarget() ) );
-                       # Otherwise, try to update the block...
+                               # Otherwise, try to update the block...
                        } else {
                                # This returns direct blocks before autoblocks/rangeblocks, since we should
                                # be sure the user is blocked by now it should work for our purposes
@@ -865,7 +864,7 @@ class SpecialBlock extends FormSpecialPage {
                                # User is trying to unblock themselves
                                if ( $performer->isAllowed( 'unblockself' ) ) {
                                        return true;
-                               # User blocked themselves and is now trying to reverse it
+                                       # User blocked themselves and is now trying to reverse it
                                } elseif ( $performer->blockedBy() === $performer->getName() ) {
                                        return true;
                                } else {
index e10df4f..17cc327 100644 (file)
@@ -55,7 +55,7 @@ class SpecialBlockList extends SpecialPage {
 
                $action = $request->getText( 'action' );
 
-               if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
+               if ( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
                        # B/C @since 1.18: Unblock interface is now at Special:Unblock
                        $title = SpecialPage::getTitleFor( 'Unblock', $this->target );
                        $out->redirect( $title->getFullUrl() );
@@ -120,7 +120,7 @@ class SpecialBlockList extends SpecialPage {
                if ( $this->target !== '' ) {
                        list( $target, $type ) = Block::parseTarget( $this->target );
 
-                       switch( $type ) {
+                       switch ( $type ) {
                                case Block::TYPE_ID:
                                case Block::TYPE_AUTO:
                                        $conds['ipb_id'] = $target;
@@ -148,16 +148,16 @@ class SpecialBlockList extends SpecialPage {
                }
 
                # Apply filters
-               if( in_array( 'userblocks', $this->options ) ) {
+               if ( in_array( 'userblocks', $this->options ) ) {
                        $conds['ipb_user'] = 0;
                }
-               if( in_array( 'tempblocks', $this->options ) ) {
+               if ( in_array( 'tempblocks', $this->options ) ) {
                        $conds['ipb_expiry'] = 'infinity';
                }
-               if( in_array( 'addressblocks', $this->options ) ) {
+               if ( in_array( 'addressblocks', $this->options ) ) {
                        $conds[] = "ipb_user != 0 OR ipb_range_end > ipb_range_start";
                }
-               if( in_array( 'rangeblocks', $this->options ) ) {
+               if ( in_array( 'rangeblocks', $this->options ) ) {
                        $conds[] = "ipb_range_end = ipb_range_start";
                }
 
@@ -169,7 +169,7 @@ class SpecialBlockList extends SpecialPage {
 
                # Show additional header for the local block only when other blocks exists.
                # Not necessary in a standard installation without such extensions enabled
-               if( count( $otherBlockLink ) ) {
+               if ( count( $otherBlockLink ) ) {
                        $out->addHTML(
                                Html::element( 'h2', array(), $this->msg( 'ipblocklist-localblock' )->text() ) . "\n"
                        );
@@ -179,8 +179,8 @@ class SpecialBlockList extends SpecialPage {
                if ( $pager->getNumRows() ) {
                        $out->addHTML(
                                $pager->getNavigationBar() .
-                               $pager->getBody().
-                               $pager->getNavigationBar()
+                                       $pager->getBody() .
+                                       $pager->getNavigationBar()
                        );
 
                } elseif ( $this->target ) {
@@ -190,7 +190,7 @@ class SpecialBlockList extends SpecialPage {
                        $out->addWikiMsg( 'ipblocklist-empty' );
                }
 
-               if( count( $otherBlockLink ) ) {
+               if ( count( $otherBlockLink ) ) {
                        $out->addHTML(
                                Html::rawElement(
                                        'h2',
@@ -199,7 +199,7 @@ class SpecialBlockList extends SpecialPage {
                                ) . "\n"
                        );
                        $list = '';
-                       foreach( $otherBlockLink as $link ) {
+                       foreach ( $otherBlockLink as $link ) {
                                $list .= Html::rawElement( 'li', array(), $link ) . "\n";
                        }
                        $out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
@@ -238,7 +238,7 @@ class BlockListPager extends TablePager {
                                'ipb_params' => 'blocklist-params',
                                'ipb_reason' => 'blocklist-reason',
                        );
-                       foreach( $headers as $key => $val ) {
+                       foreach ( $headers as $key => $val ) {
                                $headers[$key] = $this->msg( $val )->text();
                        }
                }
@@ -267,17 +267,17 @@ class BlockListPager extends TablePager {
 
                $formatted = '';
 
-               switch( $name ) {
+               switch ( $name ) {
                        case 'ipb_timestamp':
                                $formatted = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() );
                                break;
 
                        case 'ipb_target':
-                               if( $row->ipb_auto ) {
+                               if ( $row->ipb_auto ) {
                                        $formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse();
                                } else {
                                        list( $target, $type ) = Block::parseTarget( $row->ipb_address );
-                                       switch( $type ) {
+                                       switch ( $type ) {
                                                case Block::TYPE_USER:
                                                case Block::TYPE_IP:
                                                        $formatted = Linker::userLink( $target->getId(), $target );
@@ -295,9 +295,9 @@ class BlockListPager extends TablePager {
                                break;
 
                        case 'ipb_expiry':
-                               $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */ true );
-                               if( $this->getUser()->isAllowed( 'block' ) ) {
-                                       if( $row->ipb_auto ) {
+                               $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */true );
+                               if ( $this->getUser()->isAllowed( 'block' ) ) {
+                                       if ( $row->ipb_auto ) {
                                                $links[] = Linker::linkKnown(
                                                        SpecialPage::getTitleFor( 'Unblock' ),
                                                        $msg['unblocklink'],
@@ -441,7 +441,7 @@ class BlockListPager extends TablePager {
                }
 
                $ua = UserArray::newFromIDs( $userids );
-               foreach( $ua as $user ) {
+               foreach ( $ua as $user ) {
                        $name = str_replace( ' ', '_', $user->getName() );
                        $lb->add( NS_USER, $name );
                        $lb->add( NS_USER_TALK, $name );
index 85a3019..1e5b524 100644 (file)
@@ -39,7 +39,7 @@ class SpecialBlockme extends UnlistedSpecialPage {
                $this->outputHeader();
 
                $ip = $this->getRequest()->getIP();
-               if( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) {
+               if ( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) {
                        $this->getOutput()->addWikiMsg( 'proxyblocker-disabled' );
                        return;
                }
index bdbd77b..0774c44 100644 (file)
@@ -53,8 +53,8 @@ class SpecialBookSources extends SpecialPage {
                $this->outputHeader();
                $this->isbn = self::cleanIsbn( $isbn ? $isbn : $this->getRequest()->getText( 'isbn' ) );
                $this->getOutput()->addHTML( $this->makeForm() );
-               if( strlen( $this->isbn ) > 0 ) {
-                       if( !self::isValidISBN( $this->isbn ) ) {
+               if ( strlen( $this->isbn ) > 0 ) {
+                       if ( !self::isValidISBN( $this->isbn ) ) {
                                $this->getOutput()->wrapWikiMsg( "<div class=\"error\">\n$1\n</div>", 'booksources-invalid-isbn' );
                        }
                        $this->showList();
@@ -69,29 +69,29 @@ class SpecialBookSources extends SpecialPage {
        public static function isValidISBN( $isbn ) {
                $isbn = self::cleanIsbn( $isbn );
                $sum = 0;
-               if( strlen( $isbn ) == 13 ) {
-                       for( $i = 0; $i < 12; $i++ ) {
-                               if( $i % 2 == 0 ) {
+               if ( strlen( $isbn ) == 13 ) {
+                       for ( $i = 0; $i < 12; $i++ ) {
+                               if ( $i % 2 == 0 ) {
                                        $sum += $isbn[$i];
                                } else {
                                        $sum += 3 * $isbn[$i];
                                }
                        }
 
-                       $check = (10 - ($sum % 10)) % 10;
+                       $check = ( 10 - ( $sum % 10 ) ) % 10;
                        if ( $check == $isbn[12] ) {
                                return true;
                        }
-               } elseif( strlen( $isbn ) == 10 ) {
-                       for( $i = 0; $i < 9; $i++ ) {
-                               $sum += $isbn[$i] * ($i + 1);
+               } elseif ( strlen( $isbn ) == 10 ) {
+                       for ( $i = 0; $i < 9; $i++ ) {
+                               $sum += $isbn[$i] * ( $i + 1 );
                        }
 
                        $check = $sum % 11;
-                       if( $check == 10 ) {
+                       if ( $check == 10 ) {
                                $check = "X";
                        }
-                       if( $check == $isbn[9] ) {
+                       if ( $check == $isbn[9] ) {
                                return true;
                        }
                }
@@ -143,7 +143,7 @@ class SpecialBookSources extends SpecialPage {
                # Check for a local page such as Project:Book_sources and use that if available
                $page = $this->msg( 'booksources' )->inContentLanguage()->text();
                $title = Title::makeTitleSafe( NS_PROJECT, $page ); # Show list in content language
-               if( is_object( $title ) && $title->exists() ) {
+               if ( is_object( $title ) && $title->exists() ) {
                        $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
                        $content = $rev->getContent();
 
@@ -162,7 +162,7 @@ class SpecialBookSources extends SpecialPage {
                $this->getOutput()->addWikiMsg( 'booksources-text' );
                $this->getOutput()->addHTML( '<ul>' );
                $items = $wgContLang->getBookstoreList();
-               foreach( $items as $label => $url )
+               foreach ( $items as $label => $url )
                        $this->getOutput()->addHTML( $this->makeListItem( $label, $url ) );
                $this->getOutput()->addHTML( '</ul>' );
                return true;
index fac4123..e6fd58d 100644 (file)
@@ -88,7 +88,7 @@ class BrokenRedirectsPage extends QueryPage {
         * @return array
         */
        function getOrderFields() {
-               return array ( 'rd_namespace', 'rd_title', 'rd_from' );
+               return array( 'rd_namespace', 'rd_title', 'rd_from' );
        }
 
        /**
@@ -138,7 +138,7 @@ class BrokenRedirectsPage extends QueryPage {
 
                $out = $from . $this->msg( 'word-separator' )->escaped();
 
-               if( $this->getUser()->isAllowed( 'delete' ) ) {
+               if ( $this->getUser()->isAllowed( 'delete' ) ) {
                        $links[] = Linker::linkKnown(
                                $fromObj,
                                $this->msg( 'brokenredirects-delete' )->escaped(),
index f56ca52..f7256a4 100644 (file)
@@ -42,12 +42,12 @@ class SpecialCategories extends SpecialPage {
 
                $this->getOutput()->addHTML(
                        Html::openElement( 'div', array( 'class' => 'mw-spcontent' ) ) .
-                       $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
-                       $cap->getStartForm( $from ) .
-                       $cap->getNavigationBar() .
-                       '<ul>' . $cap->getBody() . '</ul>' .
-                       $cap->getNavigationBar() .
-                       Html::closeElement( 'div' )
+                               $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
+                               $cap->getStartForm( $from ) .
+                               $cap->getNavigationBar() .
+                               '<ul>' . $cap->getBody() . '</ul>' .
+                               $cap->getNavigationBar() .
+                               Html::closeElement( 'div' )
                );
        }
 
@@ -66,7 +66,7 @@ class CategoryPager extends AlphabeticPager {
        function __construct( IContextSource $context, $from ) {
                parent::__construct( $context );
                $from = str_replace( ' ', '_', $from );
-               if( $from !== '' ) {
+               if ( $from !== '' ) {
                        $from = Title::capitalize( $from, NS_CATEGORY );
                        $this->setOffset( $from );
                        $this->setIncludeOffset( true );
@@ -92,6 +92,7 @@ class CategoryPager extends AlphabeticPager {
                unset( $this->mDefaultQuery['from'] );
                return $this->mDefaultQuery;
        }
+
 #      protected function getOrderTypeMessages() {
 #              return array( 'abc' => 'special-categories-sort-abc',
 #                      'count' => 'special-categories-sort-count' );
@@ -126,12 +127,19 @@ class CategoryPager extends AlphabeticPager {
        public function getStartForm( $from ) {
                global $wgScript;
 
-               return Xml::tags( 'form', array( 'method' => 'get', 'action' => $wgScript ),
-                               Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
-                               Xml::fieldset( $this->msg( 'categories' )->text(),
-                                       Xml::inputLabel( $this->msg( 'categoriesfrom' )->text(),
+               return Xml::tags(
+                       'form',
+                       array( 'method' => 'get', 'action' => $wgScript ),
+                       Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
+                               Xml::fieldset(
+                                       $this->msg( 'categories' )->text(),
+                                       Xml::inputLabel(
+                                               $this->msg( 'categoriesfrom' )->text(),
                                                'from', 'from', 20, $from ) .
-                                       ' ' .
-                                       Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) ) );
+                                                       ' ' .
+                                                       Xml::submitButton( $this->msg( 'allpagessubmit' )->text()
+                                       )
+                               )
+               );
        }
 }
index 59a0257..9ffbdf0 100644 (file)
@@ -89,8 +89,8 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                $this->mNewEmail = $request->getVal( 'wpNewEmail' );
 
                if ( $request->wasPosted()
-                       && $user->matchEditToken( $request->getVal( 'token' ) ) )
-               {
+                       && $user->matchEditToken( $request->getVal( 'token' ) )
+               {
                        $info = $this->attemptChange( $user, $this->mPassword, $this->mNewEmail );
                        if ( $info === true ) {
                                $this->doReturnTo();
@@ -138,15 +138,15 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                $this->getOutput()->addHTML(
                        Xml::fieldset( $this->msg( 'changeemail-header' )->text() ) .
-                       Xml::openElement( 'form',
-                               array(
-                                       'method' => 'post',
-                                       'action' => $this->getTitle()->getLocalUrl(),
-                                       'id' => 'mw-changeemail-form' ) ) . "\n" .
-                       Html::hidden( 'token', $user->getEditToken() ) . "\n" .
-                       Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" .
-                       $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" .
-                       Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n"
+                               Xml::openElement( 'form',
+                                       array(
+                                               'method' => 'post',
+                                               'action' => $this->getTitle()->getLocalUrl(),
+                                               'id' => 'mw-changeemail-form' ) ) . "\n" .
+                               Html::hidden( 'token', $user->getEditToken() ) . "\n" .
+                               Html::hidden( 'returnto', $this->getRequest()->getVal( 'returnto' ) ) . "\n" .
+                               $this->msg( 'changeemail-text' )->parseAsBlock() . "\n" .
+                               Xml::openElement( 'table', array( 'id' => 'mw-changeemail-table' ) ) . "\n"
                );
                $items = array(
                        array( 'wpName', 'username', 'text', $user->getName() ),
@@ -159,17 +159,17 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                $this->getOutput()->addHTML(
                        $this->pretty( $items ) .
-                       "\n" .
-                       "<tr>\n" .
+                               "\n" .
+                               "<tr>\n" .
                                "<td></td>\n" .
                                '<td class="mw-input">' .
-                                       Xml::submitButton( $this->msg( 'changeemail-submit' )->text() ) .
-                                       Xml::submitButton( $this->msg( 'changeemail-cancel' )->text(), array( 'name' => 'wpCancel' ) ) .
+                               Xml::submitButton( $this->msg( 'changeemail-submit' )->text() ) .
+                               Xml::submitButton( $this->msg( 'changeemail-cancel' )->text(), array( 'name' => 'wpCancel' ) ) .
                                "</td>\n" .
-                       "</tr>\n" .
-                       Xml::closeElement( 'table' ) .
-                       Xml::closeElement( 'form' ) .
-                       Xml::closeElement( 'fieldset' ) . "\n"
+                               "</tr>\n" .
+                               Xml::closeElement( 'table' ) .
+                               Xml::closeElement( 'form' ) .
+                               Xml::closeElement( 'fieldset' ) . "\n"
                );
        }
 
@@ -181,7 +181,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                $out = '';
                foreach ( $fields as $list ) {
                        list( $name, $label, $type, $value ) = $list;
-                       if( $type == 'text' ) {
+                       if ( $type == 'text' ) {
                                $field = htmlspecialchars( $value );
                        } else {
                                $attribs = array( 'id' => $name );
@@ -241,8 +241,8 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                if ( !$status->isGood() ) {
                        $this->getOutput()->addHTML(
                                '<p class="error">' .
-                               $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) .
-                               '</p>' );
+                                       $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) .
+                                       '</p>' );
                        return false;
                }
 
index 73eb97f..09531b2 100644 (file)
@@ -52,46 +52,46 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $this->mDomain = $request->getVal( 'wpDomain' );
 
                $user = $this->getUser();
-               if( !$request->wasPosted() && !$user->isLoggedIn() ) {
+               if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
                        $this->error( $this->msg( 'resetpass-no-info' )->text() );
                        return;
                }
 
-               if( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
+               if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $this->doReturnTo();
                        return;
                }
 
                $this->checkReadOnly();
 
-               if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
+               if ( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) {
                        try {
                                $this->mDomain = $wgAuth->getDomain();
-                               if( !$wgAuth->allowPasswordChange() ) {
+                               if ( !$wgAuth->allowPasswordChange() ) {
                                        $this->error( $this->msg( 'resetpass_forbidden' )->text() );
                                        return;
                                }
 
                                $this->attemptReset( $this->mNewpass, $this->mRetype );
 
-                               if( $user->isLoggedIn() ) {
+                               if ( $user->isLoggedIn() ) {
                                        $this->doReturnTo();
                                } else {
                                        LoginForm::setLoginToken();
                                        $token = LoginForm::getLoginToken();
                                        $data = array(
-                                               'action'       => 'submitlogin',
-                                               'wpName'       => $this->mUserName,
-                                               'wpDomain'     => $this->mDomain,
+                                               'action' => 'submitlogin',
+                                               'wpName' => $this->mUserName,
+                                               'wpDomain' => $this->mDomain,
                                                'wpLoginToken' => $token,
-                                               'wpPassword'   => $request->getVal( 'wpNewPassword' ),
+                                               'wpPassword' => $request->getVal( 'wpNewPassword' ),
                                        ) + $request->getValues( 'wpRemember', 'returnto', 'returntoquery' );
                                        $login = new LoginForm( new FauxRequest( $data, true ) );
                                        $login->setContext( $this->getContext() );
                                        $login->execute( null );
                                }
                                return;
-                       } catch( PasswordError $e ) {
+                       } catch ( PasswordError $e ) {
                                $this->error( $e->getMessage() );
                        }
                }
@@ -127,12 +127,12 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $rememberMe = '<tr>' .
                                '<td></td>' .
                                '<td class="mw-input">' .
-                                       Xml::checkLabel(
-                                               $this->msg( 'remembermypassword' )->numParams( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(),
-                                               'wpRemember', 'wpRemember',
-                                               $this->getRequest()->getCheck( 'wpRemember' ) ) .
+                               Xml::checkLabel(
+                                       $this->msg( 'remembermypassword' )->numParams( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) )->text(),
+                                       'wpRemember', 'wpRemember',
+                                       $this->getRequest()->getCheck( 'wpRemember' ) ) .
                                '</td>' .
-                       '</tr>';
+                               '</tr>';
                        $submitMsg = 'resetpass_submit';
                        $oldpassMsg = 'resetpass-temp-password';
                } else {
@@ -142,11 +142,11 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $extraFields = array();
                wfRunHooks( 'ChangePasswordForm', array( &$extraFields ) );
                $prettyFields = array(
-                                       array( 'wpName', 'username', 'text', $this->mUserName ),
-                                       array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ),
-                                       array( 'wpNewPassword', 'newpassword', 'password', null ),
-                                       array( 'wpRetype', 'retypenew', 'password', null ),
-                               );
+                       array( 'wpName', 'username', 'text', $this->mUserName ),
+                       array( 'wpPassword', $oldpassMsg, 'password', $this->mOldpass ),
+                       array( 'wpNewPassword', 'newpassword', 'password', null ),
+                       array( 'wpRetype', 'retypenew', 'password', null ),
+               );
                $prettyFields = array_merge( $prettyFields, $extraFields );
                $hiddenFields = array(
                        'token' => $user->getEditToken(),
@@ -154,31 +154,31 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        'wpDomain' => $this->mDomain,
                ) + $this->getRequest()->getValues( 'returnto', 'returntoquery' );
                $hiddenFieldsStr = '';
-               foreach( $hiddenFields as $fieldname => $fieldvalue ) {
+               foreach ( $hiddenFields as $fieldname => $fieldvalue ) {
                        $hiddenFieldsStr .= Html::hidden( $fieldname, $fieldvalue ) . "\n";
                }
                $this->getOutput()->addHTML(
                        Xml::fieldset( $this->msg( 'resetpass_header' )->text() ) .
-                       Xml::openElement( 'form',
-                               array(
-                                       'method' => 'post',
-                                       'action' => $this->getTitle()->getLocalUrl(),
-                                       'id' => 'mw-resetpass-form' ) ) . "\n" .
-                       $hiddenFieldsStr .
-                       $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" .
-                       Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" .
-                       $this->pretty( $prettyFields ) . "\n" .
-                       $rememberMe .
-                       "<tr>\n" .
+                               Xml::openElement( 'form',
+                                       array(
+                                               'method' => 'post',
+                                               'action' => $this->getTitle()->getLocalUrl(),
+                                               'id' => 'mw-resetpass-form' ) ) . "\n" .
+                               $hiddenFieldsStr .
+                               $this->msg( 'resetpass_text' )->parseAsBlock() . "\n" .
+                               Xml::openElement( 'table', array( 'id' => 'mw-resetpass-table' ) ) . "\n" .
+                               $this->pretty( $prettyFields ) . "\n" .
+                               $rememberMe .
+                               "<tr>\n" .
                                "<td></td>\n" .
                                '<td class="mw-input">' .
-                                       Xml::submitButton( $this->msg( $submitMsg )->text() ) .
-                                       Xml::submitButton( $this->msg( 'resetpass-submit-cancel' )->text(), array( 'name' => 'wpCancel' ) ) .
+                               Xml::submitButton( $this->msg( $submitMsg )->text() ) .
+                               Xml::submitButton( $this->msg( 'resetpass-submit-cancel' )->text(), array( 'name' => 'wpCancel' ) ) .
                                "</td>\n" .
-                       "</tr>\n" .
-                       Xml::closeElement( 'table' ) .
-                       Xml::closeElement( 'form' ) .
-                       Xml::closeElement( 'fieldset' ) . "\n"
+                               "</tr>\n" .
+                               Xml::closeElement( 'table' ) .
+                               Xml::closeElement( 'form' ) .
+                               Xml::closeElement( 'fieldset' ) . "\n"
                );
        }
 
@@ -190,7 +190,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $out = '';
                foreach ( $fields as $list ) {
                        list( $name, $label, $type, $value ) = $list;
-                       if( $type == 'text' ) {
+                       if ( $type == 'text' ) {
                                $field = htmlspecialchars( $value );
                        } else {
                                $attribs = array( 'id' => $name );
@@ -205,10 +205,13 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        }
                        $out .= "<tr>\n";
                        $out .= "\t<td class='mw-label'>";
-                       if ( $type != 'text' )
+
+                       if ( $type != 'text' ) {
                                $out .= Xml::label( $this->msg( $label )->text(), $name );
-                       else
+                       } else {
                                $out .= $this->msg( $label )->escaped();
+                       }
+
                        $out .= "</td>\n";
                        $out .= "\t<td class='mw-input'>";
                        $out .= $field;
@@ -229,11 +232,11 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $user = User::newFromName( $this->mUserName );
                }
 
-               if( !$user || $user->isAnon() ) {
+               if ( !$user || $user->isAnon() ) {
                        throw new PasswordError( $this->msg( 'nosuchusershort', $this->mUserName )->text() );
                }
 
-               if( $newpass !== $retype ) {
+               if ( $newpass !== $retype ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'badretype' ) );
                        throw new PasswordError( $this->msg( 'badretype' )->text() );
                }
@@ -243,7 +246,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        throw new PasswordError( $this->msg( 'login-throttled' )->text() );
                }
 
-               if( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) {
+               if ( !$user->checkTemporaryPassword( $this->mOldpass ) && !$user->checkPassword( $this->mOldpass ) ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'wrongpassword' ) );
                        throw new PasswordError( $this->msg( 'resetpass-wrong-oldpass' )->text() );
                }
@@ -257,7 +260,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $user->setPassword( $this->mNewpass );
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'success' ) );
                        $this->mNewpass = $this->mOldpass = $this->mRetype = '';
-               } catch( PasswordError $e ) {
+               } catch ( PasswordError $e ) {
                        wfRunHooks( 'PrefsPasswordAudit', array( $user, $newpass, 'error' ) );
                        throw new PasswordError( $e->getMessage() );
                }
index c3bd3fe..3b82326 100644 (file)
@@ -110,7 +110,7 @@ class SpecialComparePages extends SpecialPage {
                $rev1 = self::revOrTitle( $data['Revision1'], $data['Page1'] );
                $rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] );
 
-               if( $rev1 && $rev2 ) {
+               if ( $rev1 && $rev2 ) {
                        $revision = Revision::newFromId( $rev1 );
 
                        if ( $revision ) { // NOTE: $rev1 was already checked, should exist.
@@ -128,11 +128,11 @@ class SpecialComparePages extends SpecialPage {
        }
 
        public static function revOrTitle( $revision, $title ) {
-               if( $revision ) {
+               if ( $revision ) {
                        return $revision;
-               } elseif( $title ) {
+               } elseif ( $title ) {
                        $title = Title::newFromText( $title );
-                       if( $title instanceof Title ) {
+                       if ( $title instanceof Title ) {
                                return $title->getLatestRevID();
                        }
                }