Index: trunk/phase3/skins/Vector.php |
— | — | @@ -587,62 +587,51 @@ |
588 | 588 | case 'SEARCH': |
589 | 589 | break; |
590 | 590 | case 'TOOLBOX': |
591 | | -?> |
592 | | -<div class="portal" id="p-tb"> |
593 | | - <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5> |
594 | | - <div class="body"> |
595 | | - <ul> |
596 | | -<?php |
597 | | - foreach ( $this->getToolbox() as $key => $tbitem ): ?> |
598 | | - <?php echo $this->makeListItem($key, $tbitem); ?> |
599 | | - |
600 | | -<?php |
601 | | - endforeach; |
602 | | - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?> |
603 | | - </ul> |
604 | | - </div> |
605 | | -</div> |
606 | | -<?php |
| 591 | + $this->renderPortal( "tb", $this->getToolbox(), "toolbox", "SkinTemplateToolboxEnd" ); |
607 | 592 | break; |
608 | 593 | case 'LANGUAGES': |
609 | 594 | if ( $this->data['language_urls'] ) { |
610 | | -?> |
611 | | -<div class="portal" id="p-lang"> |
612 | | - <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5> |
613 | | - <div class="body"> |
614 | | - <ul> |
615 | | - <?php foreach ( $this->data['language_urls'] as $key => $langlink ): ?> |
616 | | - <?php echo $this->makeListItem($key, $langlink); ?> |
617 | | - |
618 | | - <?php endforeach; ?> |
619 | | - </ul> |
620 | | - </div> |
621 | | -</div> |
622 | | -<?php |
| 595 | + $this->renderPortal("lang", $this->data['language_urls'], "otherlanguages"); |
623 | 596 | } |
624 | 597 | break; |
625 | 598 | default: |
626 | | -?> |
| 599 | + $this->renderPortal($name, $content); |
| 600 | + break; |
| 601 | + } |
| 602 | + echo "\n<!-- /{$name} -->\n"; |
| 603 | + } |
| 604 | + } |
| 605 | + |
| 606 | + private function renderPortal($name, $content, $msg=null, $hook=null) { |
| 607 | + if ( !isset($msg) ) { |
| 608 | + $msg = $name; |
| 609 | + } |
| 610 | + ?> |
627 | 611 | <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>> |
628 | | - <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5> |
| 612 | + <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $msg ); if ( wfEmptyMsg( $msg, $out ) ) echo htmlspecialchars( $msg ); else echo htmlspecialchars( $out ); ?></h5> |
629 | 613 | <div class="body"> |
630 | | - <?php if ( is_array( $content ) ): ?> |
| 614 | +<?php |
| 615 | + if ( is_array( $content ) ): ?> |
631 | 616 | <ul> |
632 | | - <?php foreach( $content as $key => $val ): ?> |
| 617 | +<?php |
| 618 | + foreach( $content as $key => $val ): ?> |
633 | 619 | <?php echo $this->makeListItem($key, $val); ?> |
634 | 620 | |
635 | | - <?php endforeach; ?> |
| 621 | +<?php |
| 622 | + endforeach; |
| 623 | + if ( isset($hook) ) { |
| 624 | + wfRunHooks( $hook, array( &$this ) ); |
| 625 | + } |
| 626 | + ?> |
636 | 627 | </ul> |
637 | | - <?php else: ?> |
| 628 | +<?php |
| 629 | + else: ?> |
638 | 630 | <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?> |
639 | | - <?php endif; ?> |
| 631 | +<?php |
| 632 | + endif; ?> |
640 | 633 | </div> |
641 | 634 | </div> |
642 | 635 | <?php |
643 | | - break; |
644 | | - } |
645 | | - echo "\n<!-- /{$name} -->\n"; |
646 | | - } |
647 | 636 | } |
648 | 637 | |
649 | 638 | /** |