http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83780
Revision: 83780 Author: bawolff Date: 2011-03-12 20:07:20 +0000 (Sat, 12 Mar 2011) Log Message: ----------- (follow-up r83611) renaming variables from hungarian notation to normal standards. Two variables were missed (they were missed consistantly, so didn't cause any problems) Also add a comment to the namespace part, too clarify how its used in practise. Modified Paths: -------------- trunk/extensions/intersection/DynamicPageList.php Modified: trunk/extensions/intersection/DynamicPageList.php =================================================================== --- trunk/extensions/intersection/DynamicPageList.php 2011-03-12 19:59:41 UTC (rev 83779) +++ trunk/extensions/intersection/DynamicPageList.php 2011-03-12 20:07:20 UTC (rev 83780) @@ -102,7 +102,7 @@ $stable = $quality = 'include'; $flaggedRevs = false; - $bNamespace = false; + $namespaceFiltering = false; $namespaceIndex = 0; $offset = 0; @@ -125,12 +125,12 @@ $poptions = new ParserOptions; foreach ( $parameters as $parameter ) { - $aParam = explode( '=', $parameter, 2 ); - if( count( $aParam ) < 2 ) { + $paramField = explode( '=', $parameter, 2 ); + if( count( $paramField ) < 2 ) { continue; } - $type = trim( $aParam[0] ); - $arg = trim( $aParam[1] ); + $type = trim( $paramField[0] ); + $arg = trim( $paramField[1] ); switch ( $type ) { case 'category': $title = Title::newFromText( @@ -154,13 +154,20 @@ $ns = $wgContLang->getNsIndex( $arg ); if ( $ns != null ) { $namespaceIndex = $ns; - $bNamespace = true; + $namespaceFiltering = true; } else { + // Note, since intval("some string") = 0 + // this considers pretty much anything + // invalid here as the main namespace. + // This was probably originally a bug, + // but is now depended upon by people + // writing things like namespace=main + // so be careful when changing this code. $namespaceIndex = intval( $arg ); if ( $namespaceIndex >= 0 ) { - $bNamespace = true; + $namespaceFiltering = true; } else { - $bNamespace = false; + $namespaceFiltering = false; } } break; @@ -384,7 +391,7 @@ $excludeCatCount = count( $excludeCategories ); $totalCatCount = $catCount + $excludeCatCount; - if ( $catCount < 1 && false == $bNamespace ) { + if ( $catCount < 1 && false == $namespaceFiltering ) { if ( $suppressErrors == false ) { return htmlspecialchars( wfMsg( 'intersection_noincludecats' ) ); // "!!no included categories!!"; } else { @@ -437,7 +444,7 @@ $fields[] = 'c1.cl_timestamp'; } - if ( $bNamespace == true ) { + if ( $namespaceFiltering == true ) { $where['page_namespace'] = $namespaceIndex; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs