function tweet_sites in Tweet 7.4
Same name and namespace in other branches
- 6.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.
5 calls to tweet_sites()
- tweet_admin in ./
tweet.admin.inc - Settings page.
- tweet_block_view in ./
tweet.module - Implements hook_block_view().
- tweet_node_view in ./
tweet.module - Implements hook_node_view().
- tweet_views_handler_field_button::render in ./
tweet_views_handler_field_button.inc - Render the field.
- _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 - Implements hook_uninstall().
File
- ./
tweet.module, line 116 - 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;
}