You are here

function SocialTwitterFormatter::getTweetId in Open Social 7

Get tweet ID from URL.

Parameters

string $url: Tweet URL.

Return value

string Tweet ID.

1 call to SocialTwitterFormatter::getTweetId()
SocialTwitterFormatter::getData in includes/social_comments.twitter.inc

File

includes/social_comments.twitter.inc, line 38
Twitter class

Class

SocialTwitterFormatter
@file Twitter class

Code

function getTweetId($url) {
  $tweet_id = FALSE;
  if (is_string($url)) {

    // Get URL path.
    $url = parse_url($url, PHP_URL_PATH);

    // Explode for arguments.
    $args = explode('/', $url);
    if (isset($args[3]) && is_numeric($args[3])) {
      $tweet_id = $args[3];
    }
  }
  return $tweet_id;
}