From: Daniel Friesen Date: Tue, 27 Sep 2011 07:58:23 +0000 (+0000) Subject: Followup r98210; Add an ugly hack to support old extensions using the SkinTemplateToo... X-Git-Tag: 1.31.0-rc.0~27404 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=fb8c0479ce2a293328bd684d78722163253b66bb;p=lhc%2Fweb%2Fwiklou.git Followup r98210; Add an ugly hack to support old extensions using the SkinTemplateToolboxEnd hook, erm... 'thanks' Tim. ((Also fix an extra htmlspecialchars that shouldn't have been there)) --- diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index c972c31868..326c86d61d 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -1563,7 +1563,7 @@ abstract class BaseTemplate extends QuickTemplate { $msgObj = wfMessage( $boxName ); $boxes[$boxName] = array( 'id' => "p-$boxName", - 'header' => htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $boxName ), + 'header' => $msgObj->exists() ? $msgObj->text() : $boxName, 'generated' => true, 'content' => $content, ); @@ -1571,17 +1571,59 @@ abstract class BaseTemplate extends QuickTemplate { } } - if ( !isset($options['withLists']) || $options['withLists'] !== true ) { + // HACK: Compatibility with extensions still using SkinTemplateToolboxEnd + $hookContents = null; + if ( isset( $boxes['TOOLBOX'] ) ) { + ob_start(); + // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox + // can abort and avoid outputting double toolbox links + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); + $hookContents = ob_get_contents(); + ob_end_clean(); + if ( !trim( $hookContents ) ) { + $hookContents = null; + } + } + // END hack + + if ( isset( $options['htmlOnly'] ) && $options['htmlOnly'] === true ) { foreach ( $boxes as $boxName => $box ) { if ( is_array( $box['content'] ) ) { $content = "\n"; $boxes[$boxName]['content'] = $content; } } + } else { + if ( $hookContents ) { + $boxes['TOOLBOXEND'] = array( + 'id' => "p-toolboxend", + 'header' => $boxes['TOOLBOX']['header'], + 'generated' => false, + 'content' => "", + ); + // HACK: Make sure that TOOLBOXEND is sorted next to TOOLBOX + $boxes2 = array(); + foreach ( $boxes as $key => $box ) { + if ( $key === 'TOOLBOXEND' ) { + continue; + } + $boxes2[$key] = $box; + if ( $key === 'TOOLBOX' ) { + $boxes2['TOOLBOXEND'] = $boxes['TOOLBOXEND']; + } + } + $boxes = $boxes2; + // END hack + } } return $boxes;