Index: trunk/phase3/skins/Vector.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | /** |
4 | 4 | * Vector - Branch of MonoBook which has many usability improvements and |
5 | 5 | * somewhat cleaner code. |
6 | | - * |
| 6 | + * |
7 | 7 | * @todo document |
8 | 8 | * @file |
9 | 9 | * @ingroup Skins |
— | — | @@ -27,9 +27,9 @@ |
28 | 28 | */ |
29 | 29 | public function initPage( OutputPage $out ) { |
30 | 30 | global $wgStylePath, $wgJsMimeType, $wgStyleVersion; |
31 | | - |
| 31 | + |
32 | 32 | parent::initPage( $out ); |
33 | | - |
| 33 | + |
34 | 34 | // Append skin-specific styles |
35 | 35 | $out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' ); |
36 | 36 | $out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' ); |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | 'actions' => array(), |
72 | 72 | 'variants' => array() |
73 | 73 | ); |
74 | | - |
| 74 | + |
75 | 75 | // Detects parameters |
76 | 76 | $action = $wgRequest->getVal( 'action', 'view' ); |
77 | 77 | $section = $wgRequest->getVal( 'section' ); |
— | — | @@ -87,14 +87,14 @@ |
88 | 88 | |
89 | 89 | // Generates XML IDs from namespace names |
90 | 90 | $subjectId = $this->mTitle->getNamespaceKey( '' ); |
91 | | - |
| 91 | + |
92 | 92 | if ( $subjectId == 'main' ) { |
93 | 93 | $talkId = 'talk'; |
94 | 94 | } else { |
95 | 95 | $talkId = "{$subjectId}_talk"; |
96 | 96 | } |
97 | 97 | $currentId = $isTalk ? $talkId : $subjectId; |
98 | | - |
| 98 | + |
99 | 99 | // Adds namespace links |
100 | 100 | $links['namespaces'][$subjectId] = $this->tabAction( |
101 | 101 | $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | $talkPage, 'vector-namespace-talk', $isTalk, '', true |
106 | 106 | ); |
107 | 107 | $links['namespaces'][$talkId]['context'] = 'talk'; |
108 | | - |
| 108 | + |
109 | 109 | // Adds view view link |
110 | 110 | if ( $this->mTitle->exists() ) { |
111 | 111 | $links['views']['view'] = $this->tabAction( |
— | — | @@ -112,9 +112,9 @@ |
113 | 113 | 'vector-view-view', ( $action == 'view' ), '', true |
114 | 114 | ); |
115 | 115 | } |
116 | | - |
| 116 | + |
117 | 117 | wfProfileIn( __METHOD__ . '-edit' ); |
118 | | - |
| 118 | + |
119 | 119 | // Checks if user can... |
120 | 120 | if ( |
121 | 121 | // edit the current page |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | } |
272 | 272 | } |
273 | 273 | wfProfileOut( __METHOD__ . '-live' ); |
274 | | - |
| 274 | + |
275 | 275 | /** |
276 | 276 | * The following actions use messages which, if made particular to |
277 | 277 | * the Vector skin, would break the Ajax code which makes this |
— | — | @@ -303,10 +303,10 @@ |
304 | 304 | ); |
305 | 305 | } |
306 | 306 | } |
307 | | - |
| 307 | + |
308 | 308 | // This is instead of SkinTemplateTabs - which uses a flat array |
309 | 309 | wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) ); |
310 | | - |
| 310 | + |
311 | 311 | // If it's not content, it's got to be a special page |
312 | 312 | } else { |
313 | 313 | $links['namespaces']['special'] = array( |
— | — | @@ -351,29 +351,29 @@ |
352 | 352 | * @ingroup Skins |
353 | 353 | */ |
354 | 354 | class VectorTemplate extends QuickTemplate { |
355 | | - |
| 355 | + |
356 | 356 | /* Members */ |
357 | | - |
| 357 | + |
358 | 358 | /** |
359 | 359 | * @var Cached skin object |
360 | 360 | */ |
361 | 361 | var $skin; |
362 | | - |
| 362 | + |
363 | 363 | /* Functions */ |
364 | | - |
| 364 | + |
365 | 365 | /** |
366 | 366 | * Outputs the entire contents of the XHTML page |
367 | 367 | */ |
368 | 368 | public function execute() { |
369 | | - global $wgRequest, $wgOut, $wgContLang; |
370 | | - |
| 369 | + global $wgRequest, $wgOut, $wgContLang, $wgDevelopmentWarnings; |
| 370 | + |
371 | 371 | $this->skin = $this->data['skin']; |
372 | 372 | $action = $wgRequest->getText( 'action' ); |
373 | | - |
| 373 | + |
374 | 374 | // Suppress warnings to prevent notices about missing indexes in |
375 | 375 | // $this->data (is this really the best way to handle this?) |
376 | | - wfSuppressWarnings(); |
377 | | - |
| 376 | + $wgDevelopmentWarnings && wfSuppressWarnings(); |
| 377 | + |
378 | 378 | // Build additional attributes for navigation urls |
379 | 379 | $nav = $this->skin->buildNavigationUrls(); |
380 | 380 | foreach ( $nav as $section => $links ) { |
— | — | @@ -416,7 +416,7 @@ |
417 | 417 | $this->data['variant_urls'] = $nav['variants']; |
418 | 418 | // Build additional attributes for personal_urls |
419 | 419 | foreach ( $this->data['personal_urls'] as $key => $item) { |
420 | | - $this->data['personal_urls'][$key]['attributes'] = |
| 420 | + $this->data['personal_urls'][$key]['attributes'] = |
421 | 421 | ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"'; |
422 | 422 | if ( $item['active'] ) { |
423 | 423 | $this->data['personal_urls'][$key]['attributes'] .= |
— | — | @@ -425,7 +425,7 @@ |
426 | 426 | $this->data['personal_urls'][$key]['key'] = |
427 | 427 | $this->skin->tooltipAndAccesskey('pt-'.$key); |
428 | 428 | } |
429 | | - |
| 429 | + |
430 | 430 | // Generate additional footer links |
431 | 431 | $footerlinks = array( |
432 | 432 | 'info' => array( |
— | — | @@ -578,9 +578,9 @@ |
579 | 579 | </html> |
580 | 580 | <?php |
581 | 581 | // We're done with abusing arrays now... |
582 | | - wfRestoreWarnings(); |
| 582 | + $wgDevelopmentWarnings && wfRestoreWarnings(); |
583 | 583 | } |
584 | | - |
| 584 | + |
585 | 585 | /** |
586 | 586 | * Render a series of portals |
587 | 587 | */ |
— | — | @@ -675,14 +675,14 @@ |
676 | 676 | echo "\n<!-- /{$name} -->\n"; |
677 | 677 | } |
678 | 678 | } |
679 | | - |
| 679 | + |
680 | 680 | /** |
681 | 681 | * Render one or more navigations elements by name, automatically reveresed |
682 | 682 | * when UI is in RTL mode |
683 | 683 | */ |
684 | 684 | private function renderNavigation( $elements ) { |
685 | 685 | global $wgContLang, $wgVectorUseSimpleSearch, $wgStylePath; |
686 | | - |
| 686 | + |
687 | 687 | // If only one element was given, wrap it in an array, allowing more |
688 | 688 | // flexible arguments |
689 | 689 | if ( !is_array( $elements ) ) { |
— | — | @@ -792,6 +792,6 @@ |
793 | 793 | break; |
794 | 794 | } |
795 | 795 | echo "\n<!-- /{$name} -->\n"; |
796 | | - } |
| 796 | + } |
797 | 797 | } |
798 | 798 | } |