Twitter-compatible API - don't strip XML-illegal chars from JSON output
darcs-hash:20081106225721-462f3-b80ba75f87a4b36b803868653c956c393a236626.gz
This commit is contained in:
parent
ab6c83dab8
commit
aac0605bd1
|
@ -60,7 +60,7 @@ class TwitterapiAction extends Action {
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
|
||||||
$twitter_status = array();
|
$twitter_status = array();
|
||||||
$twitter_status['text'] = common_xml_safe_str($notice->content);
|
$twitter_status['text'] = $notice->content;
|
||||||
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
|
$twitter_status['truncated'] = 'false'; # Not possible on Laconica
|
||||||
$twitter_status['created_at'] = $this->date_twitter($notice->created);
|
$twitter_status['created_at'] = $this->date_twitter($notice->created);
|
||||||
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
|
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : NULL;
|
||||||
|
@ -138,7 +138,7 @@ class TwitterapiAction extends Action {
|
||||||
|
|
||||||
$twitter_dm['id'] = $message->id;
|
$twitter_dm['id'] = $message->id;
|
||||||
$twitter_dm['sender_id'] = $message->from_profile;
|
$twitter_dm['sender_id'] = $message->from_profile;
|
||||||
$twitter_dm['text'] = common_xml_safe_str($message->content);
|
$twitter_dm['text'] = $message->content;
|
||||||
$twitter_dm['recipient_id'] = $message->to_profile;
|
$twitter_dm['recipient_id'] = $message->to_profile;
|
||||||
$twitter_dm['created_at'] = $this->date_twitter($message->created);
|
$twitter_dm['created_at'] = $this->date_twitter($message->created);
|
||||||
$twitter_dm['sender_screen_name'] = $from_profile->nickname;
|
$twitter_dm['sender_screen_name'] = $from_profile->nickname;
|
||||||
|
@ -152,9 +152,14 @@ class TwitterapiAction extends Action {
|
||||||
function show_twitter_xml_status($twitter_status) {
|
function show_twitter_xml_status($twitter_status) {
|
||||||
common_element_start('status');
|
common_element_start('status');
|
||||||
foreach($twitter_status as $element => $value) {
|
foreach($twitter_status as $element => $value) {
|
||||||
if ($element == 'user') {
|
switch ($element) {
|
||||||
|
case 'user':
|
||||||
$this->show_twitter_xml_user($twitter_status['user']);
|
$this->show_twitter_xml_user($twitter_status['user']);
|
||||||
} else {
|
break;
|
||||||
|
case 'text':
|
||||||
|
common_element($element, NULL, common_xml_safe_str($value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
common_element($element, NULL, $value);
|
common_element($element, NULL, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,9 +234,15 @@ class TwitterapiAction extends Action {
|
||||||
function show_twitter_xml_dmsg($twitter_dm) {
|
function show_twitter_xml_dmsg($twitter_dm) {
|
||||||
common_element_start('direct_message');
|
common_element_start('direct_message');
|
||||||
foreach($twitter_dm as $element => $value) {
|
foreach($twitter_dm as $element => $value) {
|
||||||
if ($element == 'sender' || $element == 'recipient') {
|
switch ($element) {
|
||||||
|
case 'sender':
|
||||||
|
case 'recipient':
|
||||||
$this->show_twitter_xml_user($value, $element);
|
$this->show_twitter_xml_user($value, $element);
|
||||||
} else {
|
break;
|
||||||
|
case 'text':
|
||||||
|
common_element($element, NULL, common_xml_safe_str($value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
common_element($element, NULL, $value);
|
common_element($element, NULL, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user