| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: sharethis.module,v 1.1.2.7.2.2 2009/08/14 03:44:09 robloach Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 34 |
* See the Service Links module. |
* See the Service Links module. |
| 35 |
*/ |
*/ |
| 36 |
function sharethis_service_links() { |
function sharethis_service_links() { |
| 37 |
|
// The main ShareThis button. |
| 38 |
$links['sharethis'] = array( |
$links['sharethis'] = array( |
| 39 |
'name' => 'ShareThis', |
'name' => 'ShareThis', |
| 40 |
'description' => t('ShareThis makes sharing easy!'), |
'description' => t('ShareThis makes sharing easy!'), |
| 41 |
'link' => 'http://sharethis.com/post?url=<encoded-url>&title=<encoded-title>', |
'link' => 'http://sharethis.com/post?url=<encoded-url>&title=<encoded-title>', |
| 42 |
'icon' => drupal_get_path('module', 'sharethis') .'/' . variable_get('sharethis_icon', 'sharethis.png'), |
'icon' => drupal_get_path('module', 'sharethis') .'/images/' . variable_get('sharethis_icon', 'sharethis.png'), |
|
'attributes' => array( |
|
|
'class' => 'sharethis-link-button chicklet', |
|
|
), |
|
| 43 |
'javascript' => drupal_get_path('module', 'sharethis') .'/sharethis.js', |
'javascript' => drupal_get_path('module', 'sharethis') .'/sharethis.js', |
| 44 |
'callback' => 'sharethis_service_links_callback', |
'callback' => 'sharethis_service_links_callback', |
| 45 |
); |
); |
| 46 |
|
// Construct the individual chicklets. |
| 47 |
|
$chicklets = array( |
| 48 |
|
'email' => array( |
| 49 |
|
'name' => 'Email', |
| 50 |
|
'description' => t('Send this post to a friend via Email.'), |
| 51 |
|
), |
| 52 |
|
'twitter' => array( |
| 53 |
|
'name' => 'Twitter', |
| 54 |
|
'description' => t('Share this post on Twitter.'), |
| 55 |
|
), |
| 56 |
|
); |
| 57 |
|
foreach ($chicklets as $name => $chicklet) { |
| 58 |
|
$links['sharethis-'. $name] = array( |
| 59 |
|
'name' => $chicklet['name'], |
| 60 |
|
'description' => $chicklet['description'], |
| 61 |
|
'link' => 'http://sharethis.com/post?url=<encoded-url>&title=<encoded-title>', |
| 62 |
|
'icon' => drupal_get_path('module', 'sharethis') ."/images/$name.gif", |
| 63 |
|
'attributes' => array( |
| 64 |
|
'class' => $name, |
| 65 |
|
), |
| 66 |
|
'javascript' => drupal_get_path('module', 'sharethis') .'/sharethis.js', |
| 67 |
|
'callback' => 'sharethis_service_links_callback', |
| 68 |
|
); |
| 69 |
|
} |
| 70 |
return $links; |
return $links; |
| 71 |
} |
} |
| 72 |
|
|
| 87 |
drupal_set_html_head('<script type="text/javascript" src="'. $code .'&button=false"></script>'); |
drupal_set_html_head('<script type="text/javascript" src="'. $code .'&button=false"></script>'); |
| 88 |
} |
} |
| 89 |
$settings = array( |
$settings = array( |
| 90 |
'sharethis' => array( |
$service['attributes']['id'] => array( |
| 91 |
$service['attributes']['id'] => array( |
'title' => $context['title'], |
| 92 |
'title' => $context['title'], |
'url' => $context['url'], |
| 93 |
'url' => $context['url'], |
'chicklet' => isset($service['attributes']['class']) ? $service['attributes']['class'] : FALSE, |
|
), |
|
| 94 |
), |
), |
| 95 |
); |
); |
| 96 |
drupal_add_js($settings, 'setting'); |
drupal_add_js(array('sharethis' => $settings), 'setting'); |
| 97 |
} |
} |