r54264 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54263‎ | r54264 | r54265 >
Date:10:49, 3 August 2009
Author:nikerabbit
Status:resolved (Comments)
Tags:
Comment:
* Trailing Whitespace
* Don't suppress warnings while developing, wasting my time for debugging
Modified paths:
  • /trunk/phase3/skins/Vector.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/Vector.php
@@ -2,7 +2,7 @@
33 /**
44 * Vector - Branch of MonoBook which has many usability improvements and
55 * somewhat cleaner code.
6 - *
 6+ *
77 * @todo document
88 * @file
99 * @ingroup Skins
@@ -27,9 +27,9 @@
2828 */
2929 public function initPage( OutputPage $out ) {
3030 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
31 -
 31+
3232 parent::initPage( $out );
33 -
 33+
3434 // Append skin-specific styles
3535 $out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' );
3636 $out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' );
@@ -70,7 +70,7 @@
7171 'actions' => array(),
7272 'variants' => array()
7373 );
74 -
 74+
7575 // Detects parameters
7676 $action = $wgRequest->getVal( 'action', 'view' );
7777 $section = $wgRequest->getVal( 'section' );
@@ -87,14 +87,14 @@
8888
8989 // Generates XML IDs from namespace names
9090 $subjectId = $this->mTitle->getNamespaceKey( '' );
91 -
 91+
9292 if ( $subjectId == 'main' ) {
9393 $talkId = 'talk';
9494 } else {
9595 $talkId = "{$subjectId}_talk";
9696 }
9797 $currentId = $isTalk ? $talkId : $subjectId;
98 -
 98+
9999 // Adds namespace links
100100 $links['namespaces'][$subjectId] = $this->tabAction(
101101 $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
@@ -104,7 +104,7 @@
105105 $talkPage, 'vector-namespace-talk', $isTalk, '', true
106106 );
107107 $links['namespaces'][$talkId]['context'] = 'talk';
108 -
 108+
109109 // Adds view view link
110110 if ( $this->mTitle->exists() ) {
111111 $links['views']['view'] = $this->tabAction(
@@ -112,9 +112,9 @@
113113 'vector-view-view', ( $action == 'view' ), '', true
114114 );
115115 }
116 -
 116+
117117 wfProfileIn( __METHOD__ . '-edit' );
118 -
 118+
119119 // Checks if user can...
120120 if (
121121 // edit the current page
@@ -270,7 +270,7 @@
271271 }
272272 }
273273 wfProfileOut( __METHOD__ . '-live' );
274 -
 274+
275275 /**
276276 * The following actions use messages which, if made particular to
277277 * the Vector skin, would break the Ajax code which makes this
@@ -303,10 +303,10 @@
304304 );
305305 }
306306 }
307 -
 307+
308308 // This is instead of SkinTemplateTabs - which uses a flat array
309309 wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
310 -
 310+
311311 // If it's not content, it's got to be a special page
312312 } else {
313313 $links['namespaces']['special'] = array(
@@ -351,29 +351,29 @@
352352 * @ingroup Skins
353353 */
354354 class VectorTemplate extends QuickTemplate {
355 -
 355+
356356 /* Members */
357 -
 357+
358358 /**
359359 * @var Cached skin object
360360 */
361361 var $skin;
362 -
 362+
363363 /* Functions */
364 -
 364+
365365 /**
366366 * Outputs the entire contents of the XHTML page
367367 */
368368 public function execute() {
369 - global $wgRequest, $wgOut, $wgContLang;
370 -
 369+ global $wgRequest, $wgOut, $wgContLang, $wgDevelopmentWarnings;
 370+
371371 $this->skin = $this->data['skin'];
372372 $action = $wgRequest->getText( 'action' );
373 -
 373+
374374 // Suppress warnings to prevent notices about missing indexes in
375375 // $this->data (is this really the best way to handle this?)
376 - wfSuppressWarnings();
377 -
 376+ $wgDevelopmentWarnings && wfSuppressWarnings();
 377+
378378 // Build additional attributes for navigation urls
379379 $nav = $this->skin->buildNavigationUrls();
380380 foreach ( $nav as $section => $links ) {
@@ -416,7 +416,7 @@
417417 $this->data['variant_urls'] = $nav['variants'];
418418 // Build additional attributes for personal_urls
419419 foreach ( $this->data['personal_urls'] as $key => $item) {
420 - $this->data['personal_urls'][$key]['attributes'] =
 420+ $this->data['personal_urls'][$key]['attributes'] =
421421 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
422422 if ( $item['active'] ) {
423423 $this->data['personal_urls'][$key]['attributes'] .=
@@ -425,7 +425,7 @@
426426 $this->data['personal_urls'][$key]['key'] =
427427 $this->skin->tooltipAndAccesskey('pt-'.$key);
428428 }
429 -
 429+
430430 // Generate additional footer links
431431 $footerlinks = array(
432432 'info' => array(
@@ -578,9 +578,9 @@
579579 </html>
580580 <?php
581581 // We're done with abusing arrays now...
582 - wfRestoreWarnings();
 582+ $wgDevelopmentWarnings && wfRestoreWarnings();
583583 }
584 -
 584+
585585 /**
586586 * Render a series of portals
587587 */
@@ -675,14 +675,14 @@
676676 echo "\n<!-- /{$name} -->\n";
677677 }
678678 }
679 -
 679+
680680 /**
681681 * Render one or more navigations elements by name, automatically reveresed
682682 * when UI is in RTL mode
683683 */
684684 private function renderNavigation( $elements ) {
685685 global $wgContLang, $wgVectorUseSimpleSearch, $wgStylePath;
686 -
 686+
687687 // If only one element was given, wrap it in an array, allowing more
688688 // flexible arguments
689689 if ( !is_array( $elements ) ) {
@@ -792,6 +792,6 @@
793793 break;
794794 }
795795 echo "\n<!-- /{$name} -->\n";
796 - }
 796+ }
797797 }
798798 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r55334Cleanup for r54264 "* Don't suppress warnings while developing, wasting my ti...brion18:22, 19 August 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   18:23, 19 August 2009

Now this is just confusing. :)

I've removed the warning suppression entirely in r55334; if there are any warnings in there they should be fixed (either proper isset() checks, initialization, or whatever), not just suppressed.

Status & tagging log