mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Add newline after JSON and XML responses
This commit is contained in:
parent
114755d13a
commit
d0183268ce
3 changed files with 8 additions and 8 deletions
|
|
@ -160,13 +160,13 @@ class DisplayHandler extends Handler
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getDebugInfo(&$output = null)
|
public static function getDebugInfo(&$output = null): string
|
||||||
{
|
{
|
||||||
// Check if debugging information has already been printed.
|
// Check if debugging information has already been printed.
|
||||||
|
|
||||||
if (self::$debug_printed)
|
if (self::$debug_printed)
|
||||||
{
|
{
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -176,7 +176,7 @@ class DisplayHandler extends Handler
|
||||||
// Check if debugging is enabled for this request.
|
// Check if debugging is enabled for this request.
|
||||||
if (!Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
if (!Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
||||||
{
|
{
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not display debugging information if there is no output.
|
// Do not display debugging information if there is no output.
|
||||||
|
|
@ -187,7 +187,7 @@ class DisplayHandler extends Handler
|
||||||
}
|
}
|
||||||
if ($output === null && !in_array('file', $display_types))
|
if ($output === null && !in_array('file', $display_types))
|
||||||
{
|
{
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
if ($output === null)
|
if ($output === null)
|
||||||
{
|
{
|
||||||
|
|
@ -261,12 +261,12 @@ class DisplayHandler extends Handler
|
||||||
break;
|
break;
|
||||||
case 'JSON':
|
case 'JSON':
|
||||||
unset($_SESSION['_rx_debug_previous']);
|
unset($_SESSION['_rx_debug_previous']);
|
||||||
if (preg_match('/^(.+)\}$/', $output, $matches))
|
if (preg_match('/^(.+)\}\n?$/', $output, $matches))
|
||||||
{
|
{
|
||||||
$data = json_encode($data);
|
$data = json_encode($data);
|
||||||
if (json_last_error() === JSON_ERROR_NONE)
|
if (json_last_error() === JSON_ERROR_NONE)
|
||||||
{
|
{
|
||||||
$output = $matches[1] . ',"_rx_debug":' . $data . '}';
|
$output = $matches[1] . ',"_rx_debug":' . $data . "}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class JSONDisplayHandler
|
||||||
$variables['message'] = $oModule->getMessage();
|
$variables['message'] = $oModule->getMessage();
|
||||||
|
|
||||||
self::_convertCompat($variables, Context::getRequestMethod());
|
self::_convertCompat($variables, Context::getRequestMethod());
|
||||||
return json_encode($variables);
|
return json_encode($variables) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class XMLDisplayHandler
|
||||||
|
|
||||||
$xmlDoc .= $this->_makeXmlDoc($variables);
|
$xmlDoc .= $this->_makeXmlDoc($variables);
|
||||||
|
|
||||||
$xmlDoc .= "</response>";
|
$xmlDoc .= "</response>\n";
|
||||||
|
|
||||||
return $xmlDoc;
|
return $xmlDoc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue