You are here

function twitter_filter in Twitter 6.3

Same name and namespace in other branches
  1. 6.5 twitter.module \twitter_filter()
  2. 6.2 twitter.module \twitter_filter()
  3. 6.4 twitter.module \twitter_filter()

Implementation of hook_filter().

  • Twitter @username converter: .Converts Twitter-style @usernames into links to Twitter account pages.
  • Twitter #hashtag converter: .Converts Twitter-style #hashtags into links to hashtags.org.

File

./twitter.module, line 163

Code

function twitter_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(
        0 => t('Twitter @username converter'),
        1 => t('Twitter #hashtag converter'),
      );
    case 'description':
      switch ($delta) {
        case 0:
          return t('Converts Twitter-style @usernames into links to Twitter account pages.');
        case 1:
          return t('Converts Twitter-style #hashtags into links to hashtags.org.');
        default:
          return;
      }
    case 'process':
      switch ($delta) {
        case 0:
          return twitter_link_filter($text);
        case 1:
          $destination = variable_get('twitter_search', TWITTER_SEARCH) . '/search?q=%23';
          return twitter_link_filter($text, '#', $destination);
        default:
          return $text;
      }
    default:
      return $text;
  }
}