function service_links_render in Service links 5
Same name and namespace in other branches
- 6.2 service_links.module \service_links_render()
- 6 service_links.module \service_links_render()
- 7.2 service_links.module \service_links_render()
Function that renders the service links. This is the function themers want to call to insert the service links.
4 calls to service_links_render()
- service_links_block in ./
service_links.module - Implementation of hook_block().
- service_links_link in ./
service_links.module - Implementation of hook_link().
- service_links_nodeapi in ./
service_links.module - Implementation of hook_nodeapi().
- _phptemplate_variables in ./
template.php - @file Example template.php for service_links.module Use <?php print $service_links ?> to insert links in your node.tpl.php or you page.tpl.php file.
File
- ./
service_links.module, line 338 - Mantainer: Fabio Mucciante aka TheCrow Original Author: Fredrik Jonsson fredrik at combonet dot se A module that adds Digg, del.icio.us, reddit, Technorati etc. links to nodes.
Code
function service_links_render($node, $nodelink = FALSE) {
$links = array();
if (variable_get('service_links_agg2_link', 0) && $node->link) {
$url = $node->source_link ? $node->source_link : $node->link;
$title = isset($node->title) ? $node->title : drupal_get_title();
}
elseif (!empty($node)) {
$url = url("node/{$node->nid}", NULL, NULL, TRUE);
$title = isset($node->title) ? $node->title : '';
}
else {
$url = url($_GET['q'], NULL, NULL, TRUE);
$title = drupal_get_title();
}
$url = urlencode($url);
$title = isset($title) ? rawurlencode($title) : '';
$summary = urlencode(strip_tags($node->teaser));
if (variable_get('service_links_show_delicious', 0)) {
$links['service_links_delicious'] = theme('service_links_build_link', t('Delicious'), "http://del.icio.us/post?url={$url}&title={$title}", t('Bookmark this post on del.icio.us.'), 'delicious.png', $nodelink);
}
if (variable_get('service_links_show_digg', 0)) {
$links['service_links_digg'] = theme('service_links_build_link', t('Digg'), "http://digg.com/submit?phase=2&url={$url}&title={$title}", t('Digg this post on digg.com.'), 'digg.png', $nodelink);
}
if (variable_get('service_links_show_stumbleupon', 0)) {
$links['service_links_stumbleupon'] = theme('service_links_build_link', t('StumbleUpon'), "http://www.stumbleupon.com/submit?url={$url}&title={$title}", t('Thumb this up at StumbleUpon.'), 'stumbleit.png', $nodelink);
}
if (variable_get('service_links_show_propeller', 0)) {
$links['service_links_propeller'] = theme('service_links_build_link', t('Propeller'), "http://www.propeller.com/submit/?U={$url}&T={$title}", t('Submit to Propeller.'), 'propeller.png', $nodelink);
}
if (variable_get('service_links_show_reddit', 0)) {
$links['service_links_reddit'] = theme('service_links_build_link', t('Reddit'), "http://reddit.com/submit?url={$url}&title={$title}", t('Submit this post on reddit.com.'), 'reddit.png', $nodelink);
}
if (variable_get('service_links_show_magnoliacom', 0)) {
$links['service_links_magnoliacom'] = theme('service_links_build_link', t('Magnoliacom'), "http://ma.gnolia.com/bookmarklet/add?url={$url}&title={$title}", t('Submit this post on ma.gnolia.com.'), 'magnoliacom.png', $nodelink);
}
if (variable_get('service_links_show_newsvine', 0)) {
$links['service_links_newsvine'] = theme('service_links_build_link', t('Newsvine'), "http://www.newsvine.com/_tools/seed&save?u={$url}&h={$title}", t('Submit this post on newsvine.com.'), 'newsvine.png', $nodelink);
}
if (variable_get('service_links_show_furl', 0)) {
$links['service_links_furl'] = theme('service_links_build_link', t('Furl'), "http://www.furl.net/storeIt.jsp?u={$url}&t={$title}", t('Submit this post on furl.net.'), 'furl.png', $nodelink);
}
if (variable_get('service_links_show_facebook', 0)) {
$links['service_links_facebook'] = theme('service_links_build_link', t('Facebook'), "http://www.facebook.com/sharer.php?u={$url}&t={$title}", t('Share on Facebook.'), 'facebook.png', $nodelink);
}
if (variable_get('service_links_show_myspace', 0)) {
$links['service_links_myspace'] = theme('service_links_build_link', t('MySpace'), "http://www.myspace.com/index.cfm?fuseaction=postto&t={$title}&u={$url}", t('Share on MySpace.'), 'myspace.png', $nodelink);
}
if (variable_get('service_links_show_twitter', 0)) {
$surl = isset($node->nid) ? url('node/' . $node->nid, NULL, NULL, TRUE) : $url;
$links['service_links_twitter'] = theme('service_links_build_link', t('Twitter'), "http://twitter.com/?status={$surl}" . "%20--%20" . $title, t('Share on Twitter.'), 'twitter.png', $nodelink);
}
/*if (variable_get('service_links_show_twitter_with_tinyurl', 0)) {
$turl = drupal_http_request('http://tinyurl.com/api-create.php?url='. $url);
$turl = (isset($turl->data) && ($turl->code == 200)) ? $turl->data : $url;
$links['service_links_twitter_with_tinyurl'] = theme('service_links_build_link', t('Twitter'), "http://twitter.com/home/?status=$turl". "+". $title, t('Share on Twitter.'), 'twitter.png', $nodelink);
}*/
if (variable_get('service_links_show_google', 0)) {
$links['service_links_google'] = theme('service_links_build_link', t('Google'), "http://www.google.com/bookmarks/mark?op=add&bkmk={$url}&title={$title}", t('Bookmark this post on Google.'), 'google.png', $nodelink);
}
if (variable_get('service_links_show_yahoo', 0)) {
$links['service_links_yahoo'] = theme('service_links_build_link', t('Yahoo'), "http://bookmarks.yahoo.com/myresults/bookmarklet?u={$url}&t={$title}", t('Bookmark this post on Yahoo.'), 'yahoo.png', $nodelink);
}
if (variable_get('service_links_show_buzz', 0)) {
$links['service_links_buzz'] = theme('service_links_build_link', t('Buzz Up!'), "http://buzz.yahoo.com/buzz?targetUrl={$url}&headline={$title}&summary={$summary}", t('Buzz up this post on Yahoo! Buzz.'), 'buzz.png', $nodelink);
}
if (variable_get('service_links_show_linkedin', 0)) {
$source = urlencode(variable_get('site_name', 'Drupal'));
$links['service_links_linkedin'] = theme('service_links_build_link', t('LinkedIn'), "http://www.linkedin.com/shareArticle?mini=true&url={$url}&title={$title}&summary={$summary}&source={$source}", t('Publish this to LinkedIn'), 'linkedin.png', $nodelink);
}
if (variable_get('service_links_show_technorati', 0)) {
$links['service_links_technorati'] = theme('service_links_build_link', t('Technorati'), "http://technorati.com/search/{$url}", t('Search Technorati for links to this post.'), 'technorati.png', $nodelink);
}
if (variable_get('service_links_show_icerocket', 0)) {
$links['service_links_icerocket'] = theme('service_links_build_link', t('Icerocket'), "http://blogs.icerocket.com/search?q={$url}", t('Search IceRocket for links to this post.'), 'icerocket.png', $nodelink);
}
// Add your own link by modifing the link below and uncomment it.
//$links['service_links_delicious'] = theme('service_links_build_link', t('Delicious'), "http://del.icio.us/post?url=$url&title=$title", t('Bookmark this post on del.icio.us.'), 'delicious.png', $nodelink);
return $links;
}