? .git
Index: addthis.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/addthis/addthis.css,v
retrieving revision 1.2
diff -n -u -p -r1.2 addthis.css
--- addthis.css	10 Jun 2008 20:50:22 -0000	1.2
+++ addthis.css	10 Nov 2009 09:33:46 -0000
@@ -1,7 +1,10 @@
-/* $Id: addthis.css,v 1.2 2008/06/10 20:50:22 wesku Exp $ */
+/* $Id: addthis.css,v 1.2.4.1 2008/11/19 20:20:32 wesku Exp $ */
 
 .addthis {
   display:inline;
-  position:relative;
-  top:2px;
+}
+
+.addthis img {
+  vertical-align: bottom;
+  margin-bottom: 2px;
 }
\ No newline at end of file
Index: addthis.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/addthis/addthis.info,v
retrieving revision 1.5
diff -n -u -p -r1.5 addthis.info
--- addthis.info	6 Sep 2008 11:57:04 -0000	1.5
+++ addthis.info	10 Nov 2009 09:33:46 -0000
@@ -1,6 +1,9 @@
-; $Id: addthis.info,v 1.5 2008/09/06 11:57:04 wesku Exp $
+; $Id: addthis.info,v 1.4.2.1 2008/08/23 13:11:15 wesku Exp $
 name = AddThis
-package = Other
 description = Creates AddThis button as a block, to be used in themes and to node links.
 core = 7.x
-files[] = addthis.module
\ No newline at end of file
+project = "addthis"
+datestamp = "1242663607"
+files[] = "addthis.module"
+files[] = "addthis.admin.inc"
+
Index: addthis.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/addthis/addthis.module,v
retrieving revision 1.15
diff -n -u -p -r1.15 addthis.module
--- addthis.module	6 Sep 2008 11:57:04 -0000	1.15
+++ addthis.module	10 Nov 2009 09:33:46 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: addthis.module,v 1.15 2008/09/06 11:57:04 wesku Exp $
+// $Id: addthis.module,v 1.13.2.15 2009/04/29 06:40:48 wesku Exp $
 
 /**
  * @file
@@ -7,71 +7,123 @@
  */
 
 /**
- * Implementation of hook_perm().
+ * Implement hook_permission().
  */
-function addthis_perm() {
-  $perms[] = 'administer addthis';
-  $perms[] = 'view addthis';
-  return $perms;
+function addthis_permission() {
+  return array(
+    'administer addthis' => array(
+      'title' => 'Administer Addthis sharing widget',
+      'description' => 'Change which services are shown, color, etc and add addthis.com usename',
+    ),
+    'view addthis' => array(
+      'title' => 'View the addthis widget',
+      'description' => 'User can see the button which allows them to share posts',
+    ),
+  );
 }
 
 /**
- * Implementation of hook_link().
+ * Implement hook_node_view().
  */
-function addthis_link($type, $node=NULL, $teaser = FALSE) {
+function addthis_node_view(&$node, $build_mode) {
   $links = array();
-
-  if ($type === 'node' && user_access('view addthis')) {
-    if (! $teaser || variable_get('addthis_display_in_teasers', '1')) {
-      $links['addthis'] = array(
-          'title' => _addthis_create_button($node, $teaser),
-          'html' => TRUE,
-        );
+  if (user_access('view addthis')) {
+    if (($node && variable_get('addthis_nodetype_' . $node->type, 1)) &&
+      (($build_mode == 'teaser' && variable_get('addthis_display_in_teasers', '0')) ||
+      ($build_mode == 'full' && variable_get('addthis_display_in_links', '0')))) {
+      $node->content['addthis'] = array(
+        '#markup' => _addthis_create_button(array('build_mode' => $build_mode))
+      );
     }
   }
-
-  return $links;
 }
+
 /**
- * Implementation of hook_menu().
+ * Implement of hook_menu().
  */
 function addthis_menu() {
   $items = array();
 
-  $items['admin/settings/addthis'] = array(
-    'title' => 'AddThis module settings',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('addthis_admin_settings'),
-    'description' => 'Set username and customize look and feel for <a href="http://www.addthis.com/">AddThis</a> button.',
-    'access arguments' => array('addthis_admin_settings'),
-    'menu_name' => 'settings',
+  $items['admin/config/system/addthis'] = array(
+    'title'            => t('AddThis'),
+    'description'      => t('Set username and customize look and feel for <a href="http://www.addthis.com/">AddThis</a> button.'),
+    'page callback'    => 'drupal_get_form',
+    'page arguments'   => array('addthis_admin_settings'),
+    'access arguments' => array('administer addthis'),
+    'file'             => 'addthis.admin.inc',
   );
 
   return $items;
 }
 
+
+/**
+ * Implement hook_block_info();
+ */
+function addthis_block_info() {
+  return array(
+    'addthis' => array (
+      'info' => t('Add this button'),
+      'cache' => DRUPAL_CACHE_PER_PAGE, 
+    )
+  );
+}
+
+/**
+ * Implement hook_block_view();
+ */
+function addthis_block_view($delta) {
+  if ($delta != 'addthis' || !user_access('view addthis')) {
+    return;
+  }
+  return array(
+    'subject' => t('Addthis'),
+    'content' => _addthis_create_button(),
+  );
+}
+
 /**
- * Implementation of hook_block().
+ * Implement hook_form_FORM_ID_alter().
  */
-function addthis_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $blocks[0]['info'] = t('AddThis button');
-    return $blocks;
-  }
-  else if ($op == 'view' && user_access('view addthis')) {
-    $block['subject'] = t('AddThis');
-    $block['content'] = _addthis_create_button();
-    return $block;
+function addthis_form_node_type_form_alter(&$form, $form_state, $form_id) {
+  if (isset($form['identity']['type'])) {
+    $form['addthis'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Addthis settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#group' => 'additional_settings',
+    );
+    $form['addthis']['addthis_nodetype'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show AddThis button on this type of node'),
+      '#default_value' => variable_get('addthis_nodetype_' . $form['#node_type']->type, 1),
+      '#description' => t('Select whether the AddThis button should be shown or not on this type of node.'),
+    );
   }
 }
 
 /**
+ * Implement of hook_theme().
+ */
+function addthis_theme() {
+  return array(
+    'addthis_button' => array(
+      'arguments' => array(
+        'node' => NULL,
+        'teaser' => NULL,
+      ),
+    ),
+  );
+}
+
+/**
  * Internal function to generate code for AddThis button
  *
  * @return
  *   String containing html code for the button
  */
-function _addthis_create_button($node=NULL, $teaser = FALSE) {
+function _addthis_create_button($build_mode) {
   global $_addthis_counter;
   $_addthis_counter++;
   if ($_addthis_counter == 1) {
@@ -83,153 +135,54 @@ function _addthis_create_button($node=NU
 	    addthis_logo_color = \'%s\';
 	    addthis_brand = \'%s\';
 	    addthis_options = \'%s\';
-	    addthis_offset_top = \'%d\';
-	    addthis_offset_left = \'%d\';
+	    addthis_disable_flash = \'%s\';
 	',
-        variable_get('addthis_username', 'my-username'),
-        variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'),
-        variable_get('addthis_logo_background', 'EFEFFF'),
-        variable_get('addthis_logo_color', '666699'),
-        variable_get('addthis_brand', 'Your Site'),
-        variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'),
-        variable_get('addthis_offset_top', '2'),
-        variable_get('addthis_offset_left', '2')
+        addslashes(variable_get('addthis_username', 'my-username')),
+        addslashes(variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png')),
+        addslashes(variable_get('addthis_logo_background', 'EFEFFF')),
+        addslashes(variable_get('addthis_logo_color', '666699')),
+        addslashes(variable_get('addthis_brand', 'Your Site')),
+        addslashes(variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more')),
+        variable_get('addthis_options', FALSE) ? 'true' : 'false'
       ), 'inline');
   }
 
-  return ( sprintf('
-    <div class="addthis"><a href="http://www.addthis.com/bookmark.php"
-      onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
-      onmouseout="addthis_close()"
-      onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a></div>
-    <script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
-    ',
-    $teaser ? url('node/'. $node->nid, NULL, NULL, TRUE) : '[URL]',
-    $teaser ? addslashes($node->title) : '[TITLE]',
-    variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
-    variable_get('addthis_image_width', '125'),
-    variable_get('addthis_image_height', '16'),
-    variable_get('addthis_image_attributes', 'alt=""')
-  ));
+  return theme('addthis_button', array('build_mode' => $build_mode));
 }
 
 /**
- * Administration settings form.
- *
- * @return
- *   The completed form definition.
+ * Theme the AddThis button.
  */
-function addthis_admin_settings() {
-  $form = array();
-
-  $form['addthis_general_settings'] = array(
-    '#type'  => 'fieldset',
-    '#title' => t('General settings'),
-  );
-  $form['addthis_general_settings']['addthis_username'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Username'),
-    '#default_value' => variable_get('addthis_username', 'my-username'),
-    '#description'   => t('Your username for <a href="http://www.addthis.com/">addthis.com</a>. Example: my-username'),
-  );
-  $form['addthis_general_settings']['addthis_display_in_links'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Display on node pages'),
-    '#default_value' => variable_get('addthis_display_in_links', '0'),
-    '#description'   => t('Display an AddThis button always on a node page\'s links section.'),
-  );
-  $form['addthis_general_settings']['addthis_display_in_teasers'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Display in node teasers'),
-    '#default_value' => variable_get('addthis_display_in_teasers', '0'),
-    '#description'   => t('Display an AddThis button in the node teasers.'),
-  );
-
-  $form['addthis_button_settings'] = array(
-    '#type'         => 'fieldset',
-    '#title'        => t('Button image settings'),
-    '#collapsible'  => TRUE,
-    '#collapsed'    => TRUE,
-  );
-  $form['addthis_button_settings']['addthis_image'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Button image url'),
-    '#default_value' => variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif'),
-    '#description'   => t('URL for small image in the button. Example: http://s9.addthis.com/button1-share.gif'),
-  );
-  $form['addthis_button_settings']['addthis_image_width'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Button image width'),
-    '#default_value' => variable_get('addthis_image_width', '125'),
-    '#description'   => t('Width for button image. Example: 125'),
-  );
-  $form['addthis_button_settings']['addthis_image_height'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Button image height'),
-    '#default_value' => variable_get('addthis_image_height', '16'),
-    '#description'   => t('Height for button image. Example: 16'),
-  );
-  $form['addthis_button_settings']['addthis_image_attributes'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Button image HTML attributes'),
-    '#default_value' => variable_get('addthis_image_attributes', 'alt=""'),
-    '#description'   => t('Extra HTML attributes for img tag. Example: alt=""'),
-  );
-
-  $form['addthis_widget_settings'] = array(
-    '#type'         => 'fieldset',
-    '#title'        => t('Widget settings'),
-    '#collapsible'  => TRUE,
-    '#collapsed'    => TRUE,
-  );
-  $form['addthis_widget_settings']['addthis_dropdown_disabled'] = array(
-    '#type'          => 'checkbox',
-    '#title'         => t('Disable dropdown'),
-    '#default_value' => variable_get('addthis_dropdown_disabled', '0'),
-    '#description'   => t('You can disable the dropdown for selecting where to share your link and use a pop-up window instead. This can be useful if the button is for example located next to a flash object.'),
-  );
-  $form['addthis_widget_settings']['addthis_logo'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Logo url'),
-    '#default_value' => variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'),
-    '#description'   => t('The logo to display on the popup window (about 200x50 pixels). The popup window is show when the user selects the \'More\' choice. Example: http://www.your-website.com/img/mylogo.gif'),
-  );
-  $form['addthis_widget_settings']['addthis_logo_background'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Logo background color'),
-    '#default_value' => variable_get('addthis_logo_background', 'EFEFFF'),
-    '#description'   => t('The color to use as a background around the logo in the popup. Example: EFEFEF'),
-  );
-  $form['addthis_widget_settings']['addthis_logo_color'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Logo text color'),
-    '#default_value' => variable_get('addthis_logo_color', '666699'),
-    '#description'   => t('The color to use for the text next to the logo in the popup. Example: 666666'),
-  );
-  $form['addthis_widget_settings']['addthis_brand'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Brand text'),
-    '#default_value' => variable_get('addthis_brand', 'Your Site'),
-    '#description'   => t('The brand name to display in the drop-down (top right). Example: My Website'),
-  );
-  $form['addthis_widget_settings']['addthis_options'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Options'),
-    '#default_value' => variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'),
-    '#description'   => t('A comma-separated ordered list of options to include in the drop-down. Example: favorites, email, digg, delicious, more<br/>Currently supported options:<br/>
-	delicious, digg, email, favorites, facebook, fark, furl, google, live, myweb, myspace, newsvine, reddit, slashdot, stumbleupon, technorati, twitter, more'),
-  );
-  $form['addthis_widget_settings']['addthis_offset_top'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Offset top'),
-    '#default_value' => variable_get('addthis_offset_top', '2'),
-    '#description'   => t('Vertical offset for the drop-down window (in pixels). Example: 2'),
-  );
-  $form['addthis_widget_settings']['addthis_offset_left'] = array(
-    '#type'          => 'textfield',
-    '#title'         => t('Offset top'),
-    '#default_value' => variable_get('addthis_offset_left', '2'),
-    '#description'   => t('Horizontal offset for the drop-down window (in pixels). Example: 2'),
-  );
-  return system_settings_form($form);
-}
\ No newline at end of file
+function theme_addthis_button($variables) {
+  $build_mode = $variables['build_mode'];
+  $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
+  if (variable_get('addthis_dropdown_disabled', '0')) {
+    return ( sprintf('
+      <a href="http://www.addthis.com/bookmark.php"
+        onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);">
+      <img src="%s" width="%d" height="%d" %s /></a>
+      ',
+      $https ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
+      addslashes(variable_get('addthis_image_width', '125')),
+      addslashes(variable_get('addthis_image_height', '16')),
+      addslashes(variable_get('addthis_image_attributes', 'alt=""'))
+    ));
+  }
+  else {
+    return ( sprintf('
+      <a href="http://www.addthis.com/bookmark.php"
+        onmouseover="return addthis_open(this, \'\', \'%s\', \'%s\')"
+        onmouseout="addthis_close()"
+        onclick="return addthis_sendto()"><img src="%s" width="%d" height="%d" %s /></a>
+      <script type="text/javascript" src="%s/js/' . variable_get('addthis_widget_version', '152') . '/addthis_widget.js"></script>
+      ',
+      ($build_mode == 'teaser') ? url('node/'. $node->nid, array('absolute' => 1) ) : '[URL]',
+      ($build_mode == 'teaser') ? addslashes($node->title) : '[TITLE]',
+      $https == 'on' ? addslashes(variable_get('addthis_image_secure', 'https://secure.addthis.com/button1-share.gif')) : addslashes(variable_get('addthis_image', 'http://s9.addthis.com/button1-share.gif')),
+      addslashes(variable_get('addthis_image_width', '125')),
+      addslashes(variable_get('addthis_image_height', '16')),
+      variable_get('addthis_image_attributes', 'alt=""'),
+      $https == 'on' ? 'https://secure.addthis.com' : 'http://s7.addthis.com'
+    ));
+  }
+}
