You are here

function _twitter_convert_status in Twitter 6.2

2 calls to _twitter_convert_status()
_twitter_convert_user in ./twitter.inc
_twitter_convert_xml_to_array in ./twitter.inc
Internal XML munging code

File

./twitter.inc, line 511
A wrapper API for the Twitter microblogging service.

Code

function _twitter_convert_status($status) {
  $result = (array) $status;
  $result['twitter_id'] = $result['id'];
  if (!empty($result['user']) && is_object($result['user'])) {
    $result['account'] = _twitter_convert_user($result['user']);
    $result['screen_name'] = $result['account']['screen_name'];
  }
  else {
    $result['screen_name'] = NULL;
  }
  $result['created_time'] = strtotime($result['created_at']);

  // These come in as objects rather than strings IF they are empty, curiously
  // enough. We want nulls, so we'll special case them.
  foreach (array(
    'in_reply_to_status_id',
    'in_reply_to_user_id',
    'in_reply_to_screen_name',
  ) as $key) {
    if (is_object($result[$key])) {
      $result[$key] = NULL;
    }
  }
  return $result;
}