Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -1563,7 +1563,7 @@ |
1564 | 1564 | $msgObj = wfMessage( $boxName ); |
1565 | 1565 | $boxes[$boxName] = array( |
1566 | 1566 | 'id' => "p-$boxName", |
1567 | | - 'header' => htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $boxName ), |
| 1567 | + 'header' => $msgObj->exists() ? $msgObj->text() : $boxName, |
1568 | 1568 | 'generated' => true, |
1569 | 1569 | 'content' => $content, |
1570 | 1570 | ); |
— | — | @@ -1571,17 +1571,59 @@ |
1572 | 1572 | } |
1573 | 1573 | } |
1574 | 1574 | |
1575 | | - if ( !isset($options['withLists']) || $options['withLists'] !== true ) { |
| 1575 | + // HACK: Compatibility with extensions still using SkinTemplateToolboxEnd |
| 1576 | + $hookContents = null; |
| 1577 | + if ( isset( $boxes['TOOLBOX'] ) ) { |
| 1578 | + ob_start(); |
| 1579 | + // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox |
| 1580 | + // can abort and avoid outputting double toolbox links |
| 1581 | + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); |
| 1582 | + $hookContents = ob_get_contents(); |
| 1583 | + ob_end_clean(); |
| 1584 | + if ( !trim( $hookContents ) ) { |
| 1585 | + $hookContents = null; |
| 1586 | + } |
| 1587 | + } |
| 1588 | + // END hack |
| 1589 | + |
| 1590 | + if ( isset( $options['htmlOnly'] ) && $options['htmlOnly'] === true ) { |
1576 | 1591 | foreach ( $boxes as $boxName => $box ) { |
1577 | 1592 | if ( is_array( $box['content'] ) ) { |
1578 | 1593 | $content = "<ul>"; |
1579 | 1594 | foreach ( $box['content'] as $key => $val ) { |
1580 | 1595 | $content .= "\n " . $this->makeListItem( $key, $val ); |
1581 | 1596 | } |
| 1597 | + // HACK, shove the toolbox end onto the toolbox if we're rendering itself |
| 1598 | + if ( $hookContents ) { |
| 1599 | + $content .= "\n $hookContents"; |
| 1600 | + } |
| 1601 | + // END hack |
1582 | 1602 | $content .= "\n</ul>\n"; |
1583 | 1603 | $boxes[$boxName]['content'] = $content; |
1584 | 1604 | } |
1585 | 1605 | } |
| 1606 | + } else { |
| 1607 | + if ( $hookContents ) { |
| 1608 | + $boxes['TOOLBOXEND'] = array( |
| 1609 | + 'id' => "p-toolboxend", |
| 1610 | + 'header' => $boxes['TOOLBOX']['header'], |
| 1611 | + 'generated' => false, |
| 1612 | + 'content' => "<ul>{$hookContents}</ul>", |
| 1613 | + ); |
| 1614 | + // HACK: Make sure that TOOLBOXEND is sorted next to TOOLBOX |
| 1615 | + $boxes2 = array(); |
| 1616 | + foreach ( $boxes as $key => $box ) { |
| 1617 | + if ( $key === 'TOOLBOXEND' ) { |
| 1618 | + continue; |
| 1619 | + } |
| 1620 | + $boxes2[$key] = $box; |
| 1621 | + if ( $key === 'TOOLBOX' ) { |
| 1622 | + $boxes2['TOOLBOXEND'] = $boxes['TOOLBOXEND']; |
| 1623 | + } |
| 1624 | + } |
| 1625 | + $boxes = $boxes2; |
| 1626 | + // END hack |
| 1627 | + } |
1586 | 1628 | } |
1587 | 1629 | |
1588 | 1630 | return $boxes; |