You are here

addthis.module in AddThis 6

File

addthis.module
View source
<?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;
}

Functions