function display($template, $sendContentType = null, $hookName = null, $display = true)
{
// Set the defaults
// N.B: This was moved from method signature to allow calls such as: ->display($template, null, null, false)
if (is_null($sendContentType)) {
$sendContentType = 'text/html';
}
if (is_null($hookName)) {
$hookName = 'TemplateManager::display';
}
$charset = Config::getVar('i18n', 'client_charset');
// Give any hooks registered against the TemplateManager
// the opportunity to modify behavior; otherwise, display
// the template as usual.
$output = null;
if (!HookRegistry::call($hookName, array($this, &$template, &$sendContentType, &$charset, &$output))) {
// If this is the main display call, send headers.
if ($hookName == 'TemplateManager::display') {
// Explicitly set the character encoding
// Required in case server is using Apache's
// AddDefaultCharset directive (which can
// prevent browser auto-detection of the proper
// character set)
header('Content-Type: ' . $sendContentType . '; charset=' . $charset);
// Send caching info
header('Cache-Control: ' . $this->_cacheability);
}
// Actually display the template.
return $this->fetch($template, null, null, $display);
} else {
// Display the results of the plugin.
echo $output;
}
}