this rocks 5.x-1.0 6.x-1.0
authorPatrick Przybilla
Thu, 17 Apr 2008 04:16:19 +0000 (04:16 +0000)
committerPatrick Przybilla
Thu, 17 Apr 2008 04:16:19 +0000 (04:16 +0000)
addthis.css [new file with mode: 0644]
addthis.info [new file with mode: 0644]
addthis.module [new file with mode: 0644]

diff --git a/addthis.css b/addthis.css
new file mode 100644 (file)
index 0000000..80dd670
--- /dev/null
@@ -0,0 +1,6 @@
+.addthis{
+       display:inline;
+       position:relative;
+       top:2px;
+
+}
\ No newline at end of file
diff --git a/addthis.info b/addthis.info
new file mode 100644 (file)
index 0000000..1d404a5
--- /dev/null
@@ -0,0 +1,4 @@
+; $ID$
+name = AddThis
+description = "Lets site users invite persons directly from their gmail, yahoo, hotmail or AOL address book."
+
diff --git a/addthis.module b/addthis.module
new file mode 100644 (file)
index 0000000..741760b
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+function addtoany_perm() {
+  //$perms = array('administer content types', 'administer nodes', 'access content', 'view revisions', 'revert revisions');
+
+  foreach (node_get_types() as $type) {
+      $name = check_plain($type->type);
+      $perms[] = 'share '. $name .' content';
+    
+  }
+
+  return $perms;
+}
+
+function addthis_link($type,$node=NULL, $teaser = FALSE) {
+       global $base_url;
+       $string = 'share '. $node->type .' content';
+       drupal_add_css((drupal_get_path('module', 'addthis') .'/addthis.css'), $type = 'module', $media = 'all', $preprocess = TRUE);
+       $links = array();
+         $output .= '<script type="text/javascript">addthis_pub  = "'.variable_get('addthis_user','tipzdigger').'";</script>
+                                       <a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()" 
+                                       onclick="return addthis_sendto()"><img
+                                       src="http://s9.addthis.com/button1-share.gif" width="125" height="16"
+                                       border="0" alt="" /></a><script type="text/javascript"
+                                       src="http://s7.addthis.com/js/152/addthis_widget.js"></script>';
+                                       
+       if (!$teaser && user_access($string)) {
+           $links['addthis'] = array(
+                   'title' => '<div class="addthis" style="display:inline">'.$output.'</div>',
+                   'href' => '#',
+                       'html' => TRUE,
+                 );
+       }  
+       return $links;
+
+}
+