Twitter-compatible API - JSONP callbacks for all methods emitting JSON

darcs-hash:20080910025013-7b5ce-95c8dd7eaf83e98e5ee0da5dee8ef07fe4ae5041.gz
This commit is contained in:
Zach Copley 2008-09-09 22:50:13 -04:00
parent 6eb84f0f03
commit 219927cb79
1 changed files with 15 additions and 3 deletions

View File

@ -213,6 +213,12 @@ class TwitterapiAction extends Action {
break;
case 'json':
header('Content-Type: application/json; charset=utf-8');
// Check for JSON-P callback
$callback = $this->arg('callback');
if ($callback) {
print $callback . '(';
}
break;
case 'rss':
header("Content-Type: application/rss+xml; charset=utf-8");
@ -236,6 +242,12 @@ class TwitterapiAction extends Action {
common_end_xml();
break;
case 'json':
// Check for JSON-P callback
$callback = $this->arg('callback');
if ($callback) {
print ')';
}
break;
case 'rss':
$this->end_twitter_rss();