protected function detectReturnType()
{
if (!empty($_GET['return_url'])) {
$this->returnType = 'redirect';
} elseif (!empty($_GET['callback'])) {
$this->returnType = 'jsonp';
} elseif (strpos($_SERVER['HTTP_ACCEPT'], 'image/') !== false) {
$this->returnType = 'image';
} elseif (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false) {
$this->returnType = 'json';
}
}