741760bb7acc7c00ac02d6ccac3b3af7560f0da7
[project/addthis.git] / addthis.module
1 <?php
2
3 function addtoany_perm() {
4 //$perms = array('administer content types', 'administer nodes', 'access content', 'view revisions', 'revert revisions');
5
6 foreach (node_get_types() as $type) {
7 $name = check_plain($type->type);
8 $perms[] = 'share '. $name .' content';
9
10 }
11
12 return $perms;
13 }
14
15 function addthis_link($type,$node=NULL, $teaser = FALSE) {
16 global $base_url;
17 $string = 'share '. $node->type .' content';
18 drupal_add_css((drupal_get_path('module', 'addthis') .'/addthis.css'), $type = 'module', $media = 'all', $preprocess = TRUE);
19 $links = array();
20 $output .= '<script type="text/javascript">addthis_pub = "'.variable_get('addthis_user','tipzdigger').'";</script>
21 <a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()"
22 onclick="return addthis_sendto()"><img
23 src="http://s9.addthis.com/button1-share.gif" width="125" height="16"
24 border="0" alt="" /></a><script type="text/javascript"
25 src="http://s7.addthis.com/js/152/addthis_widget.js"></script>';
26
27 if (!$teaser && user_access($string)) {
28 $links['addthis'] = array(
29 'title' => '<div class="addthis" style="display:inline">'.$output.'</div>',
30 'href' => '#',
31 'html' => TRUE,
32 );
33 }
34 return $links;
35
36 }
37