mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 02:01:40 +09:00
Add RawDisplayHandler and fix RSS/Atom not producing the correct headers
This commit is contained in:
parent
35203b684d
commit
a405b91e42
5 changed files with 49 additions and 4 deletions
|
|
@ -52,6 +52,10 @@ class DisplayHandler extends Handler
|
|||
$this->gz_enabled = FALSE;
|
||||
}
|
||||
}
|
||||
elseif(Context::getResponseMethod() == 'RAW')
|
||||
{
|
||||
$handler = new RawDisplayHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
$handler = new HTMLDisplayHandler();
|
||||
|
|
@ -114,6 +118,10 @@ class DisplayHandler extends Handler
|
|||
{
|
||||
self::_printXMLHeader();
|
||||
}
|
||||
elseif(Context::getResponseMethod() == 'RAW' && $content_type = Context::get('response_content_type'))
|
||||
{
|
||||
self::_printCustomContentTypeHeader($content_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::_printHTMLHeader();
|
||||
|
|
@ -329,6 +337,18 @@ class DisplayHandler extends Handler
|
|||
{
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* print a custom Content-Type header.
|
||||
*
|
||||
* @param string $content_type
|
||||
* @return void
|
||||
*/
|
||||
public static function _printCustomContentTypeHeader($content_type)
|
||||
{
|
||||
$charset = (strpos($content_type, 'text/') === 0) ? '; charset=UTF-8' : '';
|
||||
header('Content-Type: ' . $content_type . $charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* print a HTTP HEADER for HTML, which is encoded in UTF-8
|
||||
|
|
|
|||
20
classes/display/RawDisplayHandler.php
Normal file
20
classes/display/RawDisplayHandler.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
class RawDisplayHandler
|
||||
{
|
||||
function toDoc($oModule)
|
||||
{
|
||||
$tpl_path = $oModule->getTemplatePath();
|
||||
$tpl_file = $oModule->getTemplateFile();
|
||||
if ($tpl_path && $tpl_file)
|
||||
{
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
$output = $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = '';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue