r83611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83610‎ | r83611 | r83612 >
Date:22:00, 9 March 2011
Author:ashley
Status:ok (Comments)
Tags:
Comment:
Intersection/DynamicPageList: rename variables; we don't use Hungarian notation
Modified paths:
  • /trunk/extensions/intersection/DynamicPageList.php (modified) (history)

Diff [purge]

Index: trunk/extensions/intersection/DynamicPageList.php
@@ -51,6 +51,7 @@
5252 $dir = dirname( __FILE__ ) . '/';
5353 $wgExtensionMessagesFiles['DynamicPageList'] = $dir . 'DynamicPageList.i18n.php';
5454
 55+// Parser tests
5556 $wgParserTestFiles[] = $dir . 'DynamicPageList.tests.txt';
5657
5758 # Configuration variables
@@ -78,85 +79,85 @@
7980 global $wgDLPmaxCategories, $wgDLPMaxResultCount;
8081 global $wgDLPAllowUnlimitedResults, $wgDLPAllowUnlimitedCategories;
8182
82 - $bCountSet = false;
 83+ $countSet = false;
8384
84 - $sStartList = '<ul>';
85 - $sEndList = '</ul>';
86 - $sStartItem = '<li>';
87 - $sEndItem = '</li>';
88 - $bInlineMode = false;
 85+ $startList = '<ul>';
 86+ $endList = '</ul>';
 87+ $startItem = '<li>';
 88+ $endItem = '</li>';
 89+ $inlineMode = false;
8990
90 - $bUseGallery = false;
91 - $bGalleryFileSize = false;
92 - $bGalleryFileName = true;
93 - $iGalleryImageHeight = 0;
94 - $iGalleryImageWidth = 0;
95 - $iGalleryNumbRows = 0;
96 - $sGalleryCaption = '';
 91+ $useGallery = false;
 92+ $galleryFileSize = false;
 93+ $galleryFileName = true;
 94+ $galleryImageHeight = 0;
 95+ $galleryImageWidth = 0;
 96+ $galleryNumbRows = 0;
 97+ $galleryCaption = '';
9798 $gallery = null;
9899
99 - $sOrderMethod = 'categoryadd';
100 - $sOrder = 'descending';
101 - $sRedirects = 'exclude';
102 - $sStable = $sQuality = 'include';
103 - $bFlaggedRevs = false;
 100+ $orderMethod = 'categoryadd';
 101+ $order = 'descending';
 102+ $redirects = 'exclude';
 103+ $stable = $quality = 'include';
 104+ $flaggedRevs = false;
104105
105106 $bNamespace = false;
106 - $iNamespace = 0;
 107+ $namespaceIndex = 0;
107108
108 - $iOffset = 0;
 109+ $offset = 0;
109110
110 - $bGoogleHack = false;
 111+ $googleHack = false;
111112
112 - $bSuppressErrors = false;
113 - $bShowNamespace = true;
114 - $bAddFirstCategoryDate = false;
115 - $sDateFormat = '';
116 - $bStripYear = false;
 113+ $suppressErrors = false;
 114+ $showNamespace = true;
 115+ $addFirstCategoryDate = false;
 116+ $dateFormat = '';
 117+ $stripYear = false;
117118
118 - $aLinkOptions = array();
119 - $aCategories = array();
120 - $aExcludeCategories = array();
 119+ $linkOptions = array();
 120+ $categories = array();
 121+ $excludeCategories = array();
121122
122 - $aParams = explode( "\n", $input );
 123+ $parameters = explode( "\n", $input );
123124
124125 $parser = new Parser;
125126 $poptions = new ParserOptions;
126127
127 - foreach ( $aParams as $sParam ) {
128 - $aParam = explode( '=', $sParam, 2 );
 128+ foreach ( $parameters as $parameter ) {
 129+ $aParam = explode( '=', $parameter, 2 );
129130 if( count( $aParam ) < 2 ) {
130131 continue;
131132 }
132 - $sType = trim( $aParam[0] );
133 - $sArg = trim( $aParam[1] );
134 - switch ( $sType ) {
 133+ $type = trim( $aParam[0] );
 134+ $arg = trim( $aParam[1] );
 135+ switch ( $type ) {
135136 case 'category':
136137 $title = Title::newFromText(
137 - $parser->transformMsg( $sArg, $poptions )
 138+ $parser->transformMsg( $arg, $poptions )
138139 );
139140 if( is_null( $title ) ) {
140141 continue;
141142 }
142 - $aCategories[] = $title;
 143+ $categories[] = $title;
143144 break;
144145 case 'notcategory':
145146 $title = Title::newFromText(
146 - $parser->transformMsg( $sArg, $poptions )
 147+ $parser->transformMsg( $arg, $poptions )
147148 );
148149 if( is_null( $title ) ) {
149150 continue;
150151 }
151 - $aExcludeCategories[] = $title;
 152+ $excludeCategories[] = $title;
152153 break;
153154 case 'namespace':
154 - $ns = $wgContLang->getNsIndex( $sArg );
 155+ $ns = $wgContLang->getNsIndex( $arg );
155156 if ( $ns != null ) {
156 - $iNamespace = $ns;
 157+ $namespaceIndex = $ns;
157158 $bNamespace = true;
158159 } else {
159 - $iNamespace = intval( $sArg );
160 - if ( $iNamespace >= 0 ) {
 160+ $namespaceIndex = intval( $arg );
 161+ if ( $namespaceIndex >= 0 ) {
161162 $bNamespace = true;
162163 } else {
163164 $bNamespace = false;
@@ -164,259 +165,259 @@
165166 }
166167 break;
167168 case 'count':
168 - // ensure that $iCount is a number;
169 - $iCount = intval( $sArg );
170 - $bCountSet = true;
 169+ // ensure that $count is a number;
 170+ $count = intval( $arg );
 171+ $countSet = true;
171172 break;
172173 case 'offset':
173 - $iOffset = intval( $sArg );
 174+ $offset = intval( $arg );
174175 break;
175176 case 'imagewidth':
176 - $iGalleryImageWidth = intval( $sArg );
 177+ $galleryImageWidth = intval( $arg );
177178 break;
178179 case 'imageheight':
179 - $iGalleryImageHeight = intval( $sArg );
 180+ $galleryImageHeight = intval( $arg );
180181 break;
181182 case 'imagesperrow':
182 - $iGalleryNumbRows = intval( $sArg );
 183+ $galleryNumbRows = intval( $arg );
183184 break;
184185 case 'mode':
185 - switch ( $sArg ) {
 186+ switch ( $arg ) {
186187 case 'gallery':
187 - $bUseGallery = true;
 188+ $useGallery = true;
188189 $gallery = new ImageGallery;
189 - $sStartList = '';
190 - $sEndList = '';
191 - $sStartItem = '';
192 - $sEndItem = '';
 190+ $startList = '';
 191+ $endList = '';
 192+ $startItem = '';
 193+ $endItem = '';
193194 break;
194195 case 'none':
195 - $sStartList = '';
196 - $sEndList = '';
197 - $sStartItem = '';
198 - $sEndItem = '<br />';
199 - $bInlineMode = false;
 196+ $startList = '';
 197+ $endList = '';
 198+ $startItem = '';
 199+ $endItem = '<br />';
 200+ $inlineMode = false;
200201 break;
201202 case 'ordered':
202 - $sStartList = '<ol>';
203 - $sEndList = '</ol>';
204 - $sStartItem = '<li>';
205 - $sEndItem = '</li>';
206 - $bInlineMode = false;
 203+ $startList = '<ol>';
 204+ $endList = '</ol>';
 205+ $startItem = '<li>';
 206+ $endItem = '</li>';
 207+ $inlineMode = false;
207208 break;
208209 case 'inline':
209210 // aka comma seperated list
210 - $sStartList = '';
211 - $sEndList = '';
212 - $sStartItem = '';
213 - $sEndItem = '';
214 - $bInlineMode = true;
 211+ $startList = '';
 212+ $endList = '';
 213+ $startItem = '';
 214+ $endItem = '';
 215+ $inlineMode = true;
215216 break;
216217 case 'unordered':
217218 default:
218 - $sStartList = '<ul>';
219 - $sEndList = '</ul>';
220 - $sStartItem = '<li>';
221 - $sEndItem = '</li>';
222 - $bInlineMode = false;
 219+ $startList = '<ul>';
 220+ $endList = '</ul>';
 221+ $startItem = '<li>';
 222+ $endItem = '</li>';
 223+ $inlineMode = false;
223224 break;
224225 }
225226 break;
226227 case 'gallerycaption':
227228 // Should perhaps actually parse caption instead
228229 // as links and what not in caption might be useful.
229 - $sGalleryCaption = $parser->transformMsg( $sArg, $poptions );
 230+ $galleryCaption = $parser->transformMsg( $arg, $poptions );
230231 break;
231232 case 'galleryshowfilesize':
232 - switch ( $sArg ) {
 233+ switch ( $arg ) {
233234 case 'no':
234235 case 'false':
235 - $bGalleryFileSize = false;
 236+ $galleryFileSize = false;
236237 break;
237238 case 'true':
238239 default:
239 - $bGalleryFileSize = true;
 240+ $galleryFileSize = true;
240241 }
241242 break;
242243 case 'galleryshowfilename':
243 - switch ( $sArg ) {
 244+ switch ( $arg ) {
244245 case 'no':
245246 case 'false':
246 - $bGalleryFileName = false;
 247+ $galleryFileName = false;
247248 break;
248249 case 'true':
249250 default:
250 - $bGalleryFileName = true;
 251+ $galleryFileName = true;
251252 break;
252253 }
253254 break;
254255 case 'order':
255 - switch ( $sArg ) {
 256+ switch ( $arg ) {
256257 case 'ascending':
257 - $sOrder = 'ascending';
 258+ $order = 'ascending';
258259 break;
259260 case 'descending':
260261 default:
261 - $sOrder = 'descending';
 262+ $order = 'descending';
262263 break;
263264 }
264265 break;
265266 case 'ordermethod':
266 - switch ( $sArg ) {
 267+ switch ( $arg ) {
267268 case 'lastedit':
268 - $sOrderMethod = 'lastedit';
 269+ $orderMethod = 'lastedit';
269270 break;
270271 case 'length':
271 - $sOrderMethod = 'length';
 272+ $orderMethod = 'length';
272273 break;
273274 case 'created':
274 - $sOrderMethod = 'created';
 275+ $orderMethod = 'created';
275276 break;
276277 case 'sortkey':
277278 case 'categorysortkey':
278 - $sOrderMethod = 'categorysortkey';
 279+ $orderMethod = 'categorysortkey';
279280 break;
280281 case 'popularity':
281282 if ( !$wgDisableCounters ) {
282 - $sOrderMethod = 'popularity';
 283+ $orderMethod = 'popularity';
283284 } else {
284 - $sOrderMethod = 'categoyadd'; // default if hitcounter disabled.
 285+ $orderMethod = 'categoyadd'; // default if hitcounter disabled.
285286 }
286287 break;
287288 case 'categoryadd':
288289 default:
289 - $sOrderMethod = 'categoryadd';
 290+ $orderMethod = 'categoryadd';
290291 break;
291292 }
292293 break;
293294 case 'redirects':
294 - switch ( $sArg ) {
 295+ switch ( $arg ) {
295296 case 'include':
296 - $sRedirects = 'include';
 297+ $redirects = 'include';
297298 break;
298299 case 'only':
299 - $sRedirects = 'only';
 300+ $redirects = 'only';
300301 break;
301302 case 'exclude':
302303 default:
303 - $sRedirects = 'exclude';
 304+ $redirects = 'exclude';
304305 break;
305306 }
306307 break;
307308 case 'stablepages':
308 - switch ( $sArg ) {
 309+ switch ( $arg ) {
309310 case 'include':
310 - $sStable = 'include';
 311+ $stable = 'include';
311312 break;
312313 case 'only':
313 - $bFlaggedRevs = true;
314 - $sStable = 'only';
 314+ $flaggedRevs = true;
 315+ $stable = 'only';
315316 break;
316317 case 'exclude':
317318 default:
318 - $bFlaggedRevs = true;
319 - $sStable = 'exclude';
 319+ $flaggedRevs = true;
 320+ $stable = 'exclude';
320321 break;
321322 }
322323 break;
323324 case 'qualitypages':
324 - switch ( $sArg ) {
 325+ switch ( $arg ) {
325326 case 'include':
326 - $sQuality = 'include';
 327+ $quality = 'include';
327328 break;
328329 case 'only':
329 - $bFlaggedRevs = true;
330 - $sQuality = 'only';
 330+ $flaggedRevs = true;
 331+ $quality = 'only';
331332 break;
332333 case 'exclude':
333334 default:
334 - $bFlaggedRevs = true;
335 - $sQuality = 'exclude';
 335+ $flaggedRevs = true;
 336+ $quality = 'exclude';
336337 break;
337338 }
338339 break;
339340 case 'suppresserrors':
340 - if ( $sArg == 'true' ) {
341 - $bSuppressErrors = true;
 341+ if ( $arg == 'true' ) {
 342+ $suppressErrors = true;
342343 } else {
343 - $bSuppressErrors = false;
 344+ $suppressErrors = false;
344345 }
345346 break;
346347 case 'addfirstcategorydate':
347 - if ( $sArg == 'true' ) {
348 - $bAddFirstCategoryDate = true;
349 - } elseif ( preg_match( '/^(?:[ymd]{2,3}|ISO 8601)$/', $sArg ) ) {
 348+ if ( $arg == 'true' ) {
 349+ $addFirstCategoryDate = true;
 350+ } elseif ( preg_match( '/^(?:[ymd]{2,3}|ISO 8601)$/', $arg ) ) {
350351 // if it more or less is valid dateformat.
351 - $bAddFirstCategoryDate = true;
352 - $sDateFormat = $sArg;
353 - if ( strlen( $sDateFormat ) == 2 ) {
354 - $sDateFormat = $sDateFormat . 'y'; # DateFormatter does not support no year. work arround
355 - $bStripYear = true;
 352+ $addFirstCategoryDate = true;
 353+ $dateFormat = $arg;
 354+ if ( strlen( $dateFormat ) == 2 ) {
 355+ $dateFormat = $dateFormat . 'y'; # DateFormatter does not support no year. work around
 356+ $stripYear = true;
356357 }
357358 } else {
358 - $bAddFirstCategoryDate = false;
 359+ $addFirstCategoryDate = false;
359360 }
360361 break;
361362 case 'shownamespace':
362 - if ( 'false' == $sArg ) {
363 - $bShowNamespace = false;
 363+ if ( 'false' == $arg ) {
 364+ $showNamespace = false;
364365 } else {
365 - $bShowNamespace = true;
 366+ $showNamespace = true;
366367 }
367368 break;
368369 case 'googlehack':
369 - if ( 'false' == $sArg ) {
370 - $bGoogleHack = false;
 370+ if ( 'false' == $arg ) {
 371+ $googleHack = false;
371372 } else {
372 - $bGoogleHack = true;
 373+ $googleHack = true;
373374 }
374375 break;
375376 case 'nofollow': # bug 6658
376 - if ( 'false' != $sArg ) {
377 - $aLinkOptions['rel'] = 'nofollow';
 377+ if ( 'false' != $arg ) {
 378+ $linkOptions['rel'] = 'nofollow';
378379 }
379380 break;
380381 } // end main switch()
381382 } // end foreach()
382383
383 - $iCatCount = count( $aCategories );
384 - $iExcludeCatCount = count( $aExcludeCategories );
385 - $iTotalCatCount = $iCatCount + $iExcludeCatCount;
 384+ $catCount = count( $categories );
 385+ $excludeCatCount = count( $excludeCategories );
 386+ $totalCatCount = $catCount + $excludeCatCount;
386387
387 - if ( $iCatCount < 1 && false == $bNamespace ) {
388 - if ( $bSuppressErrors == false ) {
 388+ if ( $catCount < 1 && false == $bNamespace ) {
 389+ if ( $suppressErrors == false ) {
389390 return htmlspecialchars( wfMsg( 'intersection_noincludecats' ) ); // "!!no included categories!!";
390391 } else {
391392 return '';
392393 }
393394 }
394395
395 - if ( $iTotalCatCount > $wgDLPmaxCategories && !$wgDLPAllowUnlimitedCategories ) {
396 - if ( $bSuppressErrors == false ) {
 396+ if ( $totalCatCount > $wgDLPmaxCategories && !$wgDLPAllowUnlimitedCategories ) {
 397+ if ( $suppressErrors == false ) {
397398 return htmlspecialchars( wfMsg( 'intersection_toomanycats' ) ); // "!!too many categories!!";
398399 } else {
399400 return '';
400401 }
401402 }
402403
403 - if ( $bCountSet ) {
404 - if ( $iCount < 1 ) {
405 - $iCount = 1;
 404+ if ( $countSet ) {
 405+ if ( $count < 1 ) {
 406+ $count = 1;
406407 }
407 - if ( $iCount > $wgDLPMaxResultCount ) {
408 - $iCount = $wgDLPMaxResultCount;
 408+ if ( $count > $wgDLPMaxResultCount ) {
 409+ $count = $wgDLPMaxResultCount;
409410 }
410411 } elseif ( !$wgDLPAllowUnlimitedResults ) {
411 - $iCount = $wgDLPMaxResultCount;
412 - $bCountSet = true;
 412+ $count = $wgDLPMaxResultCount;
 413+ $countSet = true;
413414 }
414415
415416 // disallow showing date if the query doesn't have an inclusion category parameter
416 - if ( $iCatCount < 1 ) {
417 - $bAddFirstCategoryDate = false;
 417+ if ( $catCount < 1 ) {
 418+ $addFirstCategoryDate = false;
418419 // don't sort by fields relating to categories if there are no categories.
419 - if ( $sOrderMethod == 'categoryadd' || $sOrderMethod == 'categorysortkey' ) {
420 - $sOrderMethod = 'created';
 420+ if ( $orderMethod == 'categoryadd' || $orderMethod == 'categorysortkey' ) {
 421+ $orderMethod = 'created';
421422 }
422423 }
423424
@@ -428,25 +429,25 @@
429430 $join = array();
430431 $options = array();
431432
432 - if ( $bGoogleHack ) {
 433+ if ( $googleHack ) {
433434 $fields[] = 'page_id';
434435 }
435436
436 - if ( $bAddFirstCategoryDate ) {
 437+ if ( $addFirstCategoryDate ) {
437438 $fields[] = 'c1.cl_timestamp';
438439 }
439440
440441 if ( $bNamespace == true ) {
441 - $where['page_namespace'] = $iNamespace;
 442+ $where['page_namespace'] = $namespaceIndex;
442443 }
443444
444445 // Bug 14943 - Allow filtering based on FlaggedRevs stability.
445446 // Check if the extension actually exists before changing the query...
446 - if ( function_exists( 'efLoadFlaggedRevs' ) && $bFlaggedRevs ) {
 447+ if ( function_exists( 'efLoadFlaggedRevs' ) && $flaggedRevs ) {
447448 $tables[] = 'flaggedpages';
448449 $join['flaggedpages'] = array( 'LEFT JOIN', 'page_id = fp_page_id' );
449450
450 - switch( $sStable ) {
 451+ switch( $stable ) {
451452 case 'only':
452453 $where[] = 'fp_stable IS NOT NULL';
453454 break;
@@ -455,7 +456,7 @@
456457 break;
457458 }
458459
459 - switch( $sQuality ) {
 460+ switch( $quality ) {
460461 case 'only':
461462 $where[] = 'fp_quality >= 1';
462463 break;
@@ -465,7 +466,7 @@
466467 }
467468 }
468469
469 - switch ( $sRedirects ) {
 470+ switch ( $redirects ) {
470471 case 'only':
471472 $where['page_is_redirect'] = 1;
472473 break;
@@ -474,70 +475,70 @@
475476 break;
476477 }
477478
478 - $iCurrentTableNumber = 1;
 479+ $currentTableNumber = 1;
479480 $categorylinks = $dbr->tableName( 'categorylinks' );
480481
481 - for ( $i = 0; $i < $iCatCount; $i++ ) {
482 - $join["$categorylinks AS c$iCurrentTableNumber"] = array(
 482+ for ( $i = 0; $i < $catCount; $i++ ) {
 483+ $join["$categorylinks AS c$currentTableNumber"] = array(
483484 'INNER JOIN',
484485 array(
485 - "page_id = c{$iCurrentTableNumber}.cl_from",
486 - "c{$iCurrentTableNumber}.cl_to={$dbr->addQuotes($aCategories[$i]->getDBKey())}"
 486+ "page_id = c{$currentTableNumber}.cl_from",
 487+ "c{$currentTableNumber}.cl_to={$dbr->addQuotes( $categories[$i]->getDBKey() )}"
487488 )
488489 );
489 - $tables[] = "$categorylinks AS c$iCurrentTableNumber";
 490+ $tables[] = "$categorylinks AS c$currentTableNumber";
490491
491 - $iCurrentTableNumber++;
 492+ $currentTableNumber++;
492493 }
493494
494 - for ( $i = 0; $i < $iExcludeCatCount; $i++ ) {
495 - $join["$categorylinks AS c$iCurrentTableNumber"] = array(
 495+ for ( $i = 0; $i < $excludeCatCount; $i++ ) {
 496+ $join["$categorylinks AS c$currentTableNumber"] = array(
496497 'LEFT OUTER JOIN',
497498 array(
498 - "page_id = c{$iCurrentTableNumber}.cl_from",
499 - "c{$iCurrentTableNumber}.cl_to={$dbr->addQuotes($aExcludeCategories[$i]->getDBKey())}"
 499+ "page_id = c{$currentTableNumber}.cl_from",
 500+ "c{$currentTableNumber}.cl_to={$dbr->addQuotes( $excludeCategories[$i]->getDBKey() )}"
500501 )
501502 );
502 - $tables[] = "$categorylinks AS c$iCurrentTableNumber";
503 - $where["c{$iCurrentTableNumber}.cl_to"] = null;
504 - $iCurrentTableNumber++;
 503+ $tables[] = "$categorylinks AS c$currentTableNumber";
 504+ $where["c{$currentTableNumber}.cl_to"] = null;
 505+ $currentTableNumber++;
505506 }
506507
507 - if ( 'descending' == $sOrder ) {
508 - $sSqlOrder = 'DESC';
 508+ if ( 'descending' == $order ) {
 509+ $sqlOrder = 'DESC';
509510 } else {
510 - $sSqlOrder = 'ASC';
 511+ $sqlOrder = 'ASC';
511512 }
512513
513 - switch ( $sOrderMethod ) {
 514+ switch ( $orderMethod ) {
514515 case 'lastedit':
515 - $sSqlSort = 'page_touched';
 516+ $sqlSort = 'page_touched';
516517 break;
517518 case 'length':
518 - $sSqlSort = 'page_len';
 519+ $sqlSort = 'page_len';
519520 break;
520521 case 'created':
521 - $sSqlSort = 'page_id'; # Since they're never reused and increasing
 522+ $sqlSort = 'page_id'; # Since they're never reused and increasing
522523 break;
523524 case 'categorysortkey':
524 - $sSqlSort = "c1.cl_type $sSqlOrder, c1.cl_sortkey";
 525+ $sqlSort = "c1.cl_type $sqlOrder, c1.cl_sortkey";
525526 break;
526527 case 'popularity':
527 - $sSqlSort = 'page_counter';
 528+ $sqlSort = 'page_counter';
528529 break;
529530 case 'categoryadd':
530531 default:
531 - $sSqlSort = 'c1.cl_timestamp';
 532+ $sqlSort = 'c1.cl_timestamp';
532533 break;
533534 }
534535
535 - $options['ORDER BY'] = "$sSqlSort $sSqlOrder";
 536+ $options['ORDER BY'] = "$sqlSort $sqlOrder";
536537
537 - if ( $bCountSet ) {
538 - $options['LIMIT'] = $iCount;
 538+ if ( $countSet ) {
 539+ $options['LIMIT'] = $count;
539540 }
540 - if ( $iOffset > 0 ) {
541 - $options['OFFSET'] = $iOffset;
 541+ if ( $offset > 0 ) {
 542+ $options['OFFSET'] = $offset;
542543 }
543544
544545 // process the query
@@ -545,7 +546,7 @@
546547 $sk = $wgUser->getSkin();
547548
548549 if ( $dbr->numRows( $res ) == 0 ) {
549 - if ( $bSuppressErrors == false ) {
 550+ if ( $suppressErrors == false ) {
550551 return htmlspecialchars( wfMsg( 'intersection_noresults' ) );
551552 } else {
552553 return '';
@@ -553,11 +554,11 @@
554555 }
555556
556557 // start unordered list
557 - $output = $sStartList . "\n";
 558+ $output = $startList . "\n";
558559
559560 $categoryDate = '';
560561 $df = null;
561 - if ( $sDateFormat != '' && $bAddFirstCategoryDate ) {
 562+ if ( $dateFormat != '' && $addFirstCategoryDate ) {
562563 $df = DateFormatter::getInstance();
563564 }
564565
@@ -567,22 +568,22 @@
568569 $articleList = array();
569570 foreach ( $res as $row ) {
570571 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
571 - if ( true == $bAddFirstCategoryDate ) {
572 - if ( $sDateFormat != '' ) {
 572+ if ( true == $addFirstCategoryDate ) {
 573+ if ( $dateFormat != '' ) {
573574 # this is a tad ugly
574575 # use DateFormatter, and support disgarding year.
575576 $categoryDate = wfTimestamp( TS_ISO_8601, $row->cl_timestamp );
576 - if ( $bStripYear ) {
 577+ if ( $stripYear ) {
577578 $categoryDate = $wgContLang->getMonthName( substr( $categoryDate, 5, 2 ) )
578579 . ' ' . substr ( $categoryDate, 8, 2 );
579580 } else {
580581 $categoryDate = substr( $categoryDate, 0, 10 );
581582 }
582 - $categoryDate = $df->reformat( $sDateFormat, $categoryDate, array( 'match-whole' ) );
 583+ $categoryDate = $df->reformat( $dateFormat, $categoryDate, array( 'match-whole' ) );
583584 } else {
584585 $categoryDate = $wgLang->date( wfTimestamp( TS_MW, $row->cl_timestamp ) );
585586 }
586 - if ( !$bUseGallery ) {
 587+ if ( !$useGallery ) {
587588 $categoryDate .= wfMsg( 'colon-separator' );
588589 } else {
589590 $categoryDate .= ' ';
@@ -591,17 +592,17 @@
592593
593594 $query = array();
594595
595 - if ( $bGoogleHack == true ) {
 596+ if ( $googleHack == true ) {
596597 $query['dpl_id'] = intval( $row->page_id );
597598 }
598599
599 - if ( $bShowNamespace == true ) {
 600+ if ( $showNamespace == true ) {
600601 $titleText = $title->getPrefixedText();
601602 } else {
602603 $titleText = $title->getText();
603604 }
604605
605 - if ( $bUseGallery ) {
 606+ if ( $useGallery ) {
606607 # Note, $categoryDate is treated as raw html
607608 # this is safe since the only html present
608609 # would come from the dateformatter <span>.
@@ -611,7 +612,7 @@
612613 $sk->link(
613614 $title,
614615 htmlspecialchars( $titleText ),
615 - $aLinkOptions,
 616+ $linkOptions,
616617 $query,
617618 array( 'forcearticlepath', 'known' )
618619 );
@@ -619,32 +620,33 @@
620621 }
621622
622623 // end unordered list
623 - if ( $bUseGallery ) {
 624+ if ( $useGallery ) {
624625 $gallery->setHideBadImages();
625 - $gallery->setShowFilename( $bGalleryFileName );
626 - $gallery->setShowBytes( $bGalleryFileSize );
627 - if ( $iGalleryImageHeight > 0 ) {
628 - $gallery->setHeights( $iGalleryImageHeight );
 626+ $gallery->setShowFilename( $galleryFileName );
 627+ $gallery->setShowBytes( $galleryFileSize );
 628+ if ( $galleryImageHeight > 0 ) {
 629+ $gallery->setHeights( $galleryImageHeight );
629630 }
630 - if ( $iGalleryImageWidth > 0 ) {
631 - $gallery->setWidths( $iGalleryImageWidth );
 631+ if ( $galleryImageWidth > 0 ) {
 632+ $gallery->setWidths( $galleryImageWidth );
632633 }
633 - if ( $iGalleryNumbRows > 0 ) {
634 - $gallery->setPerRow( $iGalleryNumbRows );
 634+ if ( $galleryNumbRows > 0 ) {
 635+ $gallery->setPerRow( $galleryNumbRows );
635636 }
636 - if ( $sGalleryCaption != '' ) {
637 - $gallery->setCaption( $sGalleryCaption ); # gallery class escapes string
 637+ if ( $galleryCaption != '' ) {
 638+ $gallery->setCaption( $galleryCaption ); # gallery class escapes string
638639 }
639640 $output = $gallery->toHtml();
640641 } else {
641 - $output .= $sStartItem;
642 - if ( $bInlineMode ) {
 642+ $output .= $startItem;
 643+ if ( $inlineMode ) {
643644 $output .= $wgContLang->commaList( $articleList );
644645 } else {
645 - $output .= implode( "$sEndItem \n $sStartItem", $articleList );
 646+ $output .= implode( "$endItem \n $startItem", $articleList );
646647 }
647 - $output .= $sEndItem;
648 - $output .= $sEndList . "\n";
 648+ $output .= $endItem;
 649+ $output .= $endList . "\n";
649650 }
 651+
650652 return $output;
651653 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r83780(follow-up r83611) renaming variables from hungarian notation to normal stand...bawolff20:07, 12 March 2011

Comments

#Comment by Bawolff (talk | contribs)   20:12, 12 March 2011

To check this, I used grep to make sure for each renamed variable, there are 0 of the old name in the new file, 0 of the new name in the old file, and the same number of the new name in the new file as there was of the old name in the old file. I also read through the code, and tested the extension quite a bit. I'm quite certain this commit didn't introduce any bugs.

Marking ok.

I did notice it missed renaming two variables ($bNamespace, and $aParam), it didn't cause any problems, since the old name was kept throughout, I changed them in r83780.

Status & tagging log