Index: trunk/phase3/maintenance/rebuildrecentchanges.php |
— | — | @@ -216,10 +216,10 @@ |
217 | 217 | |
218 | 218 | $botgroups = $autopatrolgroups = array(); |
219 | 219 | foreach ( $wgGroupPermissions as $group => $rights ) { |
220 | | - if ( isset( $rights['bot'] ) && $rights['bot'] == true ) { |
| 220 | + if ( isset( $rights['bot'] ) && $rights['bot'] ) { |
221 | 221 | $botgroups[] = $dbw->addQuotes( $group ); |
222 | 222 | } |
223 | | - if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] == true ) { |
| 223 | + if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] ) { |
224 | 224 | $autopatrolgroups[] = $dbw->addQuotes( $group ); |
225 | 225 | } |
226 | 226 | } |
Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | |
178 | 178 | $rt = $wgArticle->followRedirect(); |
179 | 179 | |
180 | | - if ( $rt == false || !is_object( $rt ) ) { |
| 180 | + if ( !$rt || !is_object( $rt ) ) { |
181 | 181 | // $wgTitle is not a redirect |
182 | 182 | // Delete any redirect table entry for it |
183 | 183 | $dbw->delete( 'redirect', array( 'rd_from' => $id ), |
Index: trunk/phase3/maintenance/runJobs.php |
— | — | @@ -64,11 +64,9 @@ |
65 | 65 | while ( $dbw->selectField( 'job', 'job_id', $conds, 'runJobs.php' ) ) { |
66 | 66 | $offset = 0; |
67 | 67 | for ( ; ; ) { |
68 | | - $job = ( $type == false ) ? |
69 | | - Job::pop( $offset ) |
70 | | - : Job::pop_type( $type ); |
| 68 | + $job = !$type ? Job::pop( $offset ) : Job::pop_type( $type ); |
71 | 69 | |
72 | | - if ( $job == false ) |
| 70 | + if ( !$job ) |
73 | 71 | break; |
74 | 72 | |
75 | 73 | wfWaitForSlaves( 5 ); |
Index: trunk/phase3/includes/BagOStuff.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | } |
104 | 104 | |
105 | 105 | public function add( $key, $value, $exptime = 0 ) { |
106 | | - if ( $this->get( $key ) == false ) { |
| 106 | + if ( !$this->get( $key ) ) { |
107 | 107 | $this->set( $key, $value, $exptime ); |
108 | 108 | |
109 | 109 | return true; |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -1500,7 +1500,7 @@ |
1501 | 1501 | pclose( $handle ); |
1502 | 1502 | unlink( $mytextName ); unlink( $oldtextName ); unlink( $yourtextName ); |
1503 | 1503 | |
1504 | | - if ( $result === '' && $old !== '' && $conflict == false ) { |
| 1504 | + if ( $result === '' && $old !== '' && !$conflict ) { |
1505 | 1505 | wfDebug( "Unexpected null result from diff3. Command: $cmd\n" ); |
1506 | 1506 | $conflict = true; |
1507 | 1507 | } |
Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -28,7 +28,8 @@ |
29 | 29 | $mSections = array(), # Table of contents |
30 | 30 | $mProperties = array(), # Name/value pairs to be cached in the DB |
31 | 31 | $mTOCHTML = ''; # HTML of the TOC |
32 | | - private $mIndexPolicy = ''; # 'index' or 'noindex'? Any other value will result in no change. |
| 32 | + private $mIndexPolicy = '', # 'index' or 'noindex'? Any other value will result in no change. |
| 33 | + $mPageIcons = array(); # Array of icons to show for the page (like Protect, Featured, etc) |
33 | 34 | |
34 | 35 | function ParserOutput( $text = '', $languageLinks = array(), $categoryLinks = array(), |
35 | 36 | $containsOldMagic = false, $titletext = '' ) |
— | — | @@ -59,6 +60,7 @@ |
60 | 61 | function getWarnings() { return array_keys( $this->mWarnings ); } |
61 | 62 | function getIndexPolicy() { return $this->mIndexPolicy; } |
62 | 63 | function getTOCHTML() { return $this->mTOCHTML; } |
| 64 | + function getPageIcons() { return $this->mPageIcons; } |
63 | 65 | |
64 | 66 | function containsOldMagic() { return $this->mContainsOldMagic; } |
65 | 67 | function setText( $text ) { return wfSetVar( $this->mText, $text ); } |
— | — | @@ -251,6 +253,15 @@ |
252 | 254 | } |
253 | 255 | |
254 | 256 | /** |
| 257 | + * Add page icons to the parser output. |
| 258 | + * @param File $file A valid file |
| 259 | + * @param String $alt Alt text, if any |
| 260 | + */ |
| 261 | + function addPageIcon( $file, $alt = '' ) { |
| 262 | + $this->mPageIcons[] = array( $file, $alt ); |
| 263 | + } |
| 264 | + |
| 265 | + /** |
255 | 266 | * Override the title to be used for display |
256 | 267 | * -- this is assumed to have been validated |
257 | 268 | * (check equal normalisation, etc.) |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | $parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH ); |
71 | 71 | $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); |
72 | 72 | $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) ); |
| 73 | + $parser->setFunctionHook( 'pageicon', array( __CLASS__, 'pageicon' ) ); |
73 | 74 | |
74 | 75 | if ( $wgAllowDisplayTitle ) { |
75 | 76 | $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH ); |
— | — | @@ -628,6 +629,14 @@ |
629 | 630 | } |
630 | 631 | } |
631 | 632 | |
| 633 | + public static function pageicon( $parser, $name = '', $alt = '' ) { |
| 634 | + $file = wfFindFile( $name ); |
| 635 | + if( $file ) { |
| 636 | + $parser->mOutput->addPageIcon( $file, $alt ); |
| 637 | + } |
| 638 | + return ''; |
| 639 | + } |
| 640 | + |
632 | 641 | /** |
633 | 642 | * Parser function to extension tag adaptor |
634 | 643 | */ |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | $this->mConn = oci_connect( $user, $password, $dbName, $this->defaultCharset, $session_mode ); |
251 | 251 | } |
252 | 252 | |
253 | | - if ( $this->mConn == false ) { |
| 253 | + if ( !$this->mConn ) { |
254 | 254 | wfDebug( "DB connection error\n" ); |
255 | 255 | wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" ); |
256 | 256 | wfDebug( $this->lastError() . "\n" ); |
— | — | @@ -310,7 +310,7 @@ |
311 | 311 | return false; |
312 | 312 | } |
313 | 313 | |
314 | | - if ( oci_execute( $stmt, $this->execFlags() ) == false ) { |
| 314 | + if ( !oci_execute( $stmt, $this->execFlags() ) ) { |
315 | 315 | $e = oci_error( $stmt ); |
316 | 316 | if ( !$this->ignore_DUP_VAL_ON_INDEX || $e['code'] != '1' ) { |
317 | 317 | $this->reportQueryError( $e['message'], $e['code'], $sql, __FUNCTION__ ); |
— | — | @@ -1013,7 +1013,7 @@ |
1014 | 1014 | // Avoid the non-standard "REPLACE INTO" syntax |
1015 | 1015 | echo "<li>Populating interwiki table</li>\n"; |
1016 | 1016 | $f = fopen( "../maintenance/interwiki.sql", 'r' ); |
1017 | | - if ( $f == false ) { |
| 1017 | + if ( !$f ) { |
1018 | 1018 | dieout( "Could not find the interwiki.sql file" ); |
1019 | 1019 | } |
1020 | 1020 | |
Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | $this->mConn = pg_connect( $connectString ); |
183 | 183 | $phpError = $this->restoreErrorHandler(); |
184 | 184 | |
185 | | - if ( $this->mConn == false ) { |
| 185 | + if ( !$this->mConn ) { |
186 | 186 | wfDebug( "DB connection error\n" ); |
187 | 187 | wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" ); |
188 | 188 | wfDebug( $this->lastError()."\n" ); |
— | — | @@ -309,7 +309,7 @@ |
310 | 310 | $connectVars['password'] = $password; |
311 | 311 | |
312 | 312 | @$this->mConn = pg_connect( $this->makeConnectionString( $connectVars ) ); |
313 | | - if ( $this->mConn == false ) { |
| 313 | + if ( $this->mConn ) { |
314 | 314 | print "<b>FAILED TO CONNECT!</b></li>"; |
315 | 315 | dieout("</ul>"); |
316 | 316 | } |
— | — | @@ -1355,7 +1355,7 @@ |
1356 | 1356 | echo "<li>Populating interwiki table... "; |
1357 | 1357 | ## Avoid the non-standard "REPLACE INTO" syntax |
1358 | 1358 | $f = fopen( "../maintenance/interwiki.sql", 'r' ); |
1359 | | - if ($f == false ) { |
| 1359 | + if ( $f ) { |
1360 | 1360 | print "<b>FAILED</b></li>"; |
1361 | 1361 | dieout( "Could not find the interwiki.sql file" ); |
1362 | 1362 | } |
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -520,7 +520,7 @@ |
521 | 521 | // Rather, turn autocommit off in the begin function and turn on after a commit |
522 | 522 | db2_autocommit($this->mConn, DB2_AUTOCOMMIT_ON); |
523 | 523 | |
524 | | - if ( $this->mConn == false ) { |
| 524 | + if ( !$this->mConn ) { |
525 | 525 | $this->installPrint( "DB connection error\n" ); |
526 | 526 | $this->installPrint( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" ); |
527 | 527 | $this->installPrint( $this->lastError()."\n" ); |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -494,7 +494,7 @@ |
495 | 495 | |
496 | 496 | # Use DatabasePostgres's code to populate interwiki from MySQL template |
497 | 497 | $f = fopen( "$IP/maintenance/interwiki.sql", 'r' ); |
498 | | - if ( $f == false ) { |
| 498 | + if ( !$f ) { |
499 | 499 | dieout( "Could not find the interwiki.sql file." ); |
500 | 500 | } |
501 | 501 | |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -2628,7 +2628,7 @@ |
2629 | 2629 | } |
2630 | 2630 | |
2631 | 2631 | function getBaseRevision() { |
2632 | | - if ( $this->mBaseRevision == false ) { |
| 2632 | + if ( !$this->mBaseRevision ) { |
2633 | 2633 | $db = wfGetDB( DB_MASTER ); |
2634 | 2634 | $baseRevision = Revision::loadFromTimestamp( |
2635 | 2635 | $db, $this->mTitle, $this->edittime ); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -39,6 +39,7 @@ |
40 | 40 | var $mParseWarnings = array(); |
41 | 41 | var $mSquidMaxage = 0; |
42 | 42 | var $mRevisionId = null; |
| 43 | + var $mPageIcons = array(); |
43 | 44 | protected $mTitle = null; |
44 | 45 | |
45 | 46 | /** |
— | — | @@ -1079,6 +1080,7 @@ |
1080 | 1081 | $this->addCategoryLinks( $parserOutput->getCategories() ); |
1081 | 1082 | $this->mNewSectionLink = $parserOutput->getNewSection(); |
1082 | 1083 | $this->mHideNewSectionLink = $parserOutput->getHideNewSection(); |
| 1084 | + $this->mPageIcons = $parserOutput->getPageIcons(); |
1083 | 1085 | |
1084 | 1086 | $this->mParseWarnings = $parserOutput->getWarnings(); |
1085 | 1087 | if ( !$parserOutput->isCacheable() ) { |
Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | $expiryarray[$p[0]] = Block::infinity(); |
97 | 97 | } else { |
98 | 98 | $exp = strtotime( $expiry[$i] ); |
99 | | - if ( $exp < 0 || $exp == false ) { |
| 99 | + if ( $exp < 0 || !$exp ) { |
100 | 100 | $this->dieUsageMsg( array( 'invalidexpiry', $expiry[$i] ) ); |
101 | 101 | } |
102 | 102 | |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -824,7 +824,7 @@ |
825 | 825 | } |
826 | 826 | |
827 | 827 | // internal links should point to same variant as current page (only anonymous users) |
828 | | - if ( $variant == false && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) { |
| 828 | + if ( !$variant && $wgContLang->hasVariants() && !$wgUser->isLoggedIn() ) { |
829 | 829 | $pref = $wgContLang->getPreferredVariant( false ); |
830 | 830 | if ( $pref != $wgContLang->getCode() ) |
831 | 831 | $variant = $pref; |
— | — | @@ -843,7 +843,7 @@ |
844 | 844 | $dbkey = wfUrlencode( $this->getPrefixedDBkey() ); |
845 | 845 | if ( $query == '' ) { |
846 | 846 | if ( $variant != false && $wgContLang->hasVariants() ) { |
847 | | - if ( $wgVariantArticlePath == false ) { |
| 847 | + if ( !$wgVariantArticlePath ) { |
848 | 848 | $variantArticlePath = "$wgScript?title=$1&variant=$2"; // default |
849 | 849 | } else { |
850 | 850 | $variantArticlePath = $wgVariantArticlePath; |
— | — | @@ -1474,7 +1474,7 @@ |
1475 | 1475 | $scBlockExpiryOptions = wfMsg( 'ipboptions' ); |
1476 | 1476 | |
1477 | 1477 | foreach ( explode( ',', $scBlockExpiryOptions ) as $option ) { |
1478 | | - if ( strpos( $option, ':' ) == false ) |
| 1478 | + if ( !strpos( $option, ':' ) ) |
1479 | 1479 | continue; |
1480 | 1480 | |
1481 | 1481 | list ( $show, $value ) = explode( ":", $option ); |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -230,6 +230,21 @@ |
231 | 231 | $tpl->set( 'pageclass', $this->getPageClasses( $this->mTitle ) ); |
232 | 232 | $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) ); |
233 | 233 | |
| 234 | + $icons = ''; |
| 235 | + foreach( $out->mPageIcons as $icon ) { |
| 236 | + list( $file, $alt ) = $icon; |
| 237 | + $fileAttr = array( 'src' => $file->createThumb( 16 ) ); |
| 238 | + if( $alt != '' ) { |
| 239 | + $msg = wfMsg( $alt ); |
| 240 | + if( !wfEmptyMsg( $alt ) ) { |
| 241 | + $alt = $msg; |
| 242 | + } |
| 243 | + $fileAttr['alt'] = htmlspecialchars( $alt ); |
| 244 | + } |
| 245 | + $icons .= Html::element( 'img', $fileAttr ) . " "; |
| 246 | + } |
| 247 | + $tpl->set( 'pageicons', $icons ); |
| 248 | + |
234 | 249 | $nsname = MWNamespace::exists( $this->mTitle->getNamespace() ) ? |
235 | 250 | MWNamespace::getCanonicalName( $this->mTitle->getNamespace() ) : |
236 | 251 | $this->mTitle->getNsText(); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | $this->mRestriction = $restriction; |
700 | 700 | $this->mListed = $listed; |
701 | 701 | $this->mIncludable = $includable; |
702 | | - if ( $function == false ) { |
| 702 | + if ( !$function ) { |
703 | 703 | $this->mFunction = 'wfSpecial'.$name; |
704 | 704 | } else { |
705 | 705 | $this->mFunction = $function; |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | * @param $f Boolean: set to false to disable. |
185 | 185 | */ |
186 | 186 | function setShowBytes( $f ) { |
187 | | - $this->mShowBytes = ( $f == true); |
| 187 | + $this->mShowBytes = $f; |
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | * @param $f Boolean: set to false to disable. |
195 | 195 | */ |
196 | 196 | function setShowFilename( $f ) { |
197 | | - $this->mShowFilename = ( $f == true); |
| 197 | + $this->mShowFilename = $f; |
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
Index: trunk/phase3/config/Installer.php |
— | — | @@ -1330,7 +1330,7 @@ |
1331 | 1331 | $localSettings = str_replace( "\r\n", "\n", $localSettings ); |
1332 | 1332 | $f = fopen( "LocalSettings.php", 'xt' ); |
1333 | 1333 | |
1334 | | - if( $f == false ) { |
| 1334 | + if( !$f ) { |
1335 | 1335 | print( "</li>\n" ); |
1336 | 1336 | dieout( "<p>Couldn't write out LocalSettings.php. Check that the directory permissions are correct and that there isn't already a file of that name here...</p>\n" . |
1337 | 1337 | "<p>Here's the file that would have been written, try to paste it into place manually:</p>\n" . |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -698,7 +698,7 @@ |
699 | 699 | } |
700 | 700 | |
701 | 701 | $variants = $this->autoConvertToAllVariants( $link ); |
702 | | - if ( $variants == false ) { // give up |
| 702 | + if ( !$variants ) { // give up |
703 | 703 | return; |
704 | 704 | } |
705 | 705 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -356,6 +356,7 @@ |
357 | 357 | 'url_path' => array( 0, 'PATH' ), |
358 | 358 | 'url_wiki' => array( 0, 'WIKI' ), |
359 | 359 | 'url_query' => array( 0, 'QUERY' ), |
| 360 | + 'pageicon' => array( 1, 'pageicon' ), |
360 | 361 | ); |
361 | 362 | |
362 | 363 | /** |