? .svn
? addtoany.block-caching-patch.610564.31.patch
? images/.svn
? views/.svn
Index: addtoany.install
===================================================================
RCS file: addtoany.install
diff -N addtoany.install
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ addtoany.install 28 Jan 2011 22:23:38 -0000
@@ -0,0 +1,17 @@
+type]) &&
+ $show = (!empty($types[$node->type]) &&
(($teaser && variable_get('addtoany_display_in_teasers', '1')!=0) ||
(!$teaser && variable_get('addtoany_display_in_nodelink', '1')!=0)));
-
+
if ($type === 'node' && $show) {
$links['addtoany'] = array(
'title' => _addtoany_create_button($node, $teaser),
@@ -45,20 +45,20 @@ function addtoany_link($type, $node = NU
/**
* Implementation of hook_block().
- *
+ *
* @param object $op [optional]
* @param object $delta [optional]
- * @return
+ * @return
*/
function addtoany_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks[0]['info'] = t('AddToAny button');
+ $blocks[0]['cache'] = BLOCK_NO_CACHE;
return $blocks;
}
else if ($op == 'view') {
$block['subject'] = t('AddToAny');
$block['content'] = _addtoany_create_button(menu_get_object());
- $block['cache'] = BLOCK_NO_CACHE; // Caching issue: http://drupal.org/node/610564
return $block;
}
}
@@ -77,12 +77,12 @@ function addtoany_nodeapi(&$node, $op, $
// Only show comments on the full non-teasered page
if (!$a3 && $a4) {
$types = variable_get('addtoany_nodetypes', array());
-
- $show = (!empty($types[$node->type]) &&
+
+ $show = (!empty($types[$node->type]) &&
variable_get('addtoany_display_in_nodecont', '0'));
-
+
$weight = variable_get('addtoany_display_weight', 40);
-
+
if ($show) {
$node->content['addtoany'] = array(
'#value' => _addtoany_create_button($node, FALSE),
@@ -124,18 +124,18 @@ function addtoany_menu() {
/**
* Implementation of hook_footer(). Would use drupal_add_js, but external scripts are not well supported
- *
+ *
* @param object $main [optional]
* @return
* String containing JavaScript code to initialize each drop-down menu
*/
function addtoany_footer($main = 0) {
global $_addtoany_script, $_addtoany_script_init;
-
+
// Only output when needed (fixes http://drupal.org/node/843068)
if ( ! $_addtoany_script_init)
return;
-
+
$javascript = "\n";
-
+
return $javascript;
}
/**
* Internal function to create asynchronous load JavaScript after first button, and create the on-ready JS for footer.
- *
+ *
* @param object $id_num
* @param object $link_name
* @param object $link_url
- * @return
+ * @return
* String containing the asynchronous load JavaScript for the first button.
*/
function _addtoany_create_script($id_num, $link_name, $link_url) {
global $_addtoany_script, $_addtoany_script_init;
-
+
$_addtoany_script .= "a2a_config.linkname='". check_plain($link_name)
. "'; a2a_config.linkurl='" . check_plain($link_url)
. "'; a2a.init('page', {target: '#da2a_" . $id_num . "'});\n";
-
+
if ( ! $_addtoany_script_init) {
$script_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://static.addtoany.com/menu/page.js' : 'http://static.addtoany.com/menu/page.js';
$javascript_async = "";
}
else
$javascript_async = "";
-
+
$_addtoany_script_init = TRUE;
-
+
return $javascript_async;
}
/**
* Internal function to generate code for AddToAny button
- *
+ *
* @param object $node [optional]
* @param object $teaser [optional]
* @return
@@ -200,12 +200,12 @@ function _addtoany_create_script($id_num
*/
function _addtoany_create_button($node=NULL, $teaser = FALSE) {
global $_addtoany_counter, $base_path;
-
+
$_addtoany_counter++;
if ($_addtoany_counter == 1) {
drupal_add_css((drupal_get_path('module', 'addtoany') .'/addtoany.css'));
}
-
+
$disable_dropdown = variable_get('addtoany_dropdown_disabled', '0');
if (is_object($node)) {
@@ -215,15 +215,15 @@ function _addtoany_create_button($node=N
$link_name = (module_exists('page_title')) ? page_title_page_get_title() : variable_get('site_name', '');
$link_url = url('', array('absolute' => 1));
}
-
+
$javascript = ($disable_dropdown) ? '' : _addtoany_create_script($_addtoany_counter, $link_name, $link_url);
-
+
$button_setting = variable_get('addtoany_image', 'share_save_171_16.png|171|16');
if ($button_setting == "custom") {
$button_image = variable_get('addtoany_custom_image', '');
$button_width = '';
- $button_height = '';
+ $button_height = '';
} elseif ($button_setting != "text") {
$button = explode('|', $button_setting);
$button_filename = $button[0];
@@ -231,11 +231,11 @@ function _addtoany_create_button($node=N
$button_height = ' height="' . $button[2] . '"';
$button_image = $base_path . drupal_get_path('module', 'addtoany') . '/images/' . $button_filename;
}
-
+
$button_text = variable_get('addtoany_link_text', '');
if (strlen($button_text) > 0)
- $button_text = ' ' . $button_text;
-
+ $button_text = ' ' . $button_text;
+
$button_innerHTML = ($button_setting == "text") ? $button_text : sprintf('
%s',
$button_image,
$button_width,
@@ -243,7 +243,7 @@ function _addtoany_create_button($node=N
variable_get('addtoany_image_attributes', 'alt="Share this"'),
$button_text
);
-
+
return ( sprintf('
%s
%s