You are here

addtoany.module in AddToAny Share Buttons 5

File

addtoany.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 addtoany_link($type, $node = NULL, $teaser = FALSE) {
  global $base_url;
  $string = 'share ' . $node->type . ' content';
  drupal_add_css(drupal_get_path('module', 'addtoany') . '/addtoany.css', $type = 'module', $media = 'all', $preprocess = TRUE);
  $links = array();
  $output .= '<a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?linkname=' . variable_get("site_name", "") . '&amp;linkurl=' . $base_url . '">
					<img src="http://www.addtoany.com/bookmark.gif" width="91" height="16" border="0" alt="Bookmark"/></a>
					<script type="text/javascript">a2a_linkname="' . variable_get("site_name", "") . '";a2a_linkurl="' . $base_url . '";</script>
					<script type="text/javascript" src="http://www.addtoany.com/js.dropdown.js?type=page"></script>';
  if (!$teaser && user_access($string)) {
    $links['addtoany'] = array(
      'title' => '<div class="addtoany" style="display:inline">' . $output . '</div>',
      'href' => '#',
      'html' => TRUE,
    );
  }
  return $links;
}

Functions