Skip to content

Instantly share code, notes, and snippets.

@MissAllSunday
Created March 15, 2013 13:38
Show Gist options
  • Save MissAllSunday/5169914 to your computer and use it in GitHub Desktop.
Save MissAllSunday/5169914 to your computer and use it in GitHub Desktop.
protected function returnResponse()
{
global $modSettings;
// kill anything else
ob_end_clean();
if (!empty($modSettings['enableCompressedOutput']))
@ob_start('ob_gzhandler');
else
ob_start();
// Send the header
header('Content-Type: application/json');
// Is there a custom message? Use it
if (!empty($this->_response))
print json_encode($this->_response);
// No? then show the standard error message
else
print json_encode(array(
'data' => $this->_text->getText('error_message'),
'type' => 'error'
));
// Done
obExit(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment