function _addtoany_create_script in AddToAny Share Buttons 5.0
Same name and namespace in other branches
- 6.3 addtoany.module \_addtoany_create_script()
- 6.2 addtoany.module \_addtoany_create_script()
- 7.4 addtoany.module \_addtoany_create_script()
- 7 addtoany.module \_addtoany_create_script()
- 7.3 addtoany.module \_addtoany_create_script()
1 call to _addtoany_create_script()
- _addtoany_create_button in ./
addtoany.module - Internal function to generate code for AddToAny button
File
- ./
addtoany.module, line 127 - Stand alone module file to handle AddToAny button integration
Code
function _addtoany_create_script($node = NULL) {
// Drop-down disabled?
if (variable_get('addtoany_dropdown_disabled', '0')) {
return;
}
if (is_object($node)) {
$link_name = check_plain($node->title[LANGUAGE_NONE][0]['value']);
$link_url = url('node/' . $node->nid, array(
'absolute' => 1,
));
}
else {
// Front page
$link_name = check_plain(variable_get('page_title_front', variable_get('site_name', '')));
$link_url = url('<front>', array(
'absolute' => 1,
));
}
global $_addtoany_script, $_addtoany_script_init;
if (!$_addtoany_script_init) {
$_addtoany_script = '<script type="text/javascript">';
}
else {
$_addtoany_script .= '<script type="text/javascript">';
}
$_addtoany_script .= 'a2a_linkname="' . $link_name . '";a2a_linkurl="' . $link_url . '";';
if (!$_addtoany_script_init) {
$_addtoany_script .= variable_get('addtoany_additional_js', '');
$_addtoany_script .= '</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>';
}
else {
$_addtoany_script .= 'a2a_init("page");</script>';
}
$_addtoany_script_init = TRUE;
}