You are here

function tweet_sites in Tweet 6.4

Same name and namespace in other branches
  1. 7.4 tweet.module \tweet_sites()

Builds a list of sites to which we can tweet.

Parameters

$enabled_only: If TRUE, only enabled sites are returned. Otherwise, all defined sites are returned.

$reset: Reset and rebuild the static cache.

Return value

An array of sites to which we can tweet with associated information.

4 calls to tweet_sites()
tweet_admin in ./tweet.admin.inc
Settings page.
tweet_block in ./tweet.module
Implementation of hook_block().
tweet_link in ./tweet.module
Implementation of hook_link().
_tweet_to_twitter in ./tweet.module
Creates a link to post a URL and optionally title to twitter. Uses the current page by default.
2 string references to 'tweet_sites'
tweet_admin in ./tweet.admin.inc
Settings page.
tweet_uninstall in ./tweet.install
Implementation of hook_uninstall().

File

./tweet.module, line 107
Builds links to post pages to Twitter API sites.

Code

function tweet_sites($enabled_only = FALSE, $reset = FALSE) {
  static $sites = array();
  if ($reset || empty($sites)) {
    $sites = module_invoke_all('tweet_sites');
    drupal_alter('tweet_sites', $sites);
  }
  $allowed = $sites;
  if ($enabled_only) {
    foreach ($sites as $site => $info) {
      if (!in_array($site, variable_get('tweet_sites', array(
        'Twitter' => 'Twitter',
      )))) {
        unset($allowed[$site]);
      }
    }
  }
  return $allowed;
}