You are here

function _addthis_create_button in AddThis 6.2

Same name and namespace in other branches
  1. 5.2 addthis.module \_addthis_create_button()
  2. 7.2 addthis.module \_addthis_create_button()

Internal function to generate code for AddThis button

Return value

String containing html code for the button

4 calls to _addthis_create_button()
addthis_block in ./addthis.module
Implementation of hook_block().
addthis_handler_field_service_links::render in ./addthis_handler_field_service_links.inc
addthis_link in ./addthis.module
Implementation of hook_link().
_addthis_ds_create_button in ./addthis.module
Internal function for Display Suite to return the code for AddThis button.

File

./addthis.module, line 144
Stand alone module file to handle AddThis button integration

Code

function _addthis_create_button($node = NULL, $teaser = FALSE) {
  global $_addthis_counter;
  $_addthis_counter++;
  $brand = variable_get('addthis_brand', '');
  if ($brand == '') {
    $brand = variable_get('site_name', 'Drupal');
  }
  $addthis_options = variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more');
  $addthis_options = str_replace("\n", "", $addthis_options);
  $addthis_options = str_replace("\r", "", $addthis_options);
  if ($_addthis_counter == 1) {
    drupal_add_css(drupal_get_path('module', 'addthis') . '/addthis.css');
    drupal_add_js(sprintf('
	    addthis_pub = \'%s\';
	    addthis_logo = \'%s\';
	    addthis_logo_background = \'%s\';
	    addthis_logo_color = \'%s\';
	    addthis_brand = \'%s\';
	    addthis_options = \'%s\';
	    addthis_disable_flash = \'%s\';
	', addslashes(check_plain(variable_get('addthis_username', 'my-username'))), addslashes(check_plain(variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'))), addslashes(check_plain(variable_get('addthis_logo_background', 'EFEFFF'))), addslashes(check_plain(variable_get('addthis_logo_color', '666699'))), addslashes(check_plain($brand)), addslashes(check_plain($addthis_options)), variable_get('addthis_disable_flash', FALSE) ? 'true' : 'false'), 'inline');
  }
  return theme('addthis_button', $node, $teaser);
}