Settings]
Version: .9.7
Author: Add to Any
Author URI: http://www.addtoany.com/contact/
*/
if( !isset($A2A_javascript) )
$A2A_javascript = '';
if( !isset($A2A_locale) )
$A2A_locale = '';
function A2A_SHARE_SAVE_textdomain() {
load_plugin_textdomain('add-to-any',
PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)),
dirname(plugin_basename(__FILE__)));
}
add_action('init', 'A2A_SHARE_SAVE_textdomain');
// Returns the utf string corresponding to the unicode value (from php.net, courtesy - romans@void.lv)
if (!function_exists('A2A_SHARE_SAVE_code2utf')) {
function A2A_SHARE_SAVE_code2utf($num)
{
if ($num < 128) return chr($num);
if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
return '';
}
}
// Since UTF-8 does not work in PHP4 ( http://us2.php.net/manual/en/function.html-entity-decode.php ) :
if (!function_exists('A2A_SHARE_SAVE_html_entity_decode_utf8')) {
function A2A_SHARE_SAVE_html_entity_decode_utf8($string)
{
static $trans_tbl;
// replace numeric entities
$string = preg_replace('~([0-9a-f]+);~ei', 'A2A_SHARE_SAVE_code2utf(hexdec("\\1"))', $string);
$string = preg_replace('~([0-9]+);~e', 'A2A_SHARE_SAVE_code2utf(\\1)', $string);
// replace literal entities
if (!isset($trans_tbl))
{
$trans_tbl = array();
foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key)
$trans_tbl[$key] = utf8_encode($val);
}
return strtr($string, $trans_tbl);
}
}
function ADDTOANY_SHARE_SAVE_BUTTON($output_buffering=false) {
if($output_buffering)ob_start();
$sitename_enc = rawurlencode( get_bloginfo('name') );
$siteurl_enc = rawurlencode( trailingslashit( get_bloginfo('url') ) );
$linkname = A2A_SHARE_SAVE_html_entity_decode_utf8( get_the_title() );
$linkname_enc = rawurlencode( $linkname );
$linkurl = get_permalink($post->ID);
$linkurl_enc = rawurlencode( $linkurl );
if( !get_option('A2A_SHARE_SAVE_button') ) {
$button_fname = 'share_save_120_16.gif';
$button_width = ' width="120"';
$button_height = ' height="16"';
$button_src = trailingslashit(get_option('siteurl')).PLUGINDIR.'/add-to-any/'.$button_fname;
} else if( get_option('A2A_SHARE_SAVE_button') == 'CUSTOM' ) {
$button_src = get_option('A2A_SHARE_SAVE_button_custom');
$button_width = '';
$button_height = '';
} else {
$button_attrs = explode( '|', get_option('A2A_SHARE_SAVE_button') );
$button_fname = $button_attrs[0];
$button_width = ' width="'.$button_attrs[1].'"';
$button_height = ' height="'.$button_attrs[2].'"';
$button_src = trailingslashit(get_option('siteurl')).PLUGINDIR.'/add-to-any/'.$button_fname;
}
if( $button_attrs[0] == 'favicon.png' ) {
$style_bg = 'background:url('.trailingslashit(get_option('siteurl')).PLUGINDIR.'/add-to-any/'.$button_fname.') no-repeat scroll 0px 0px';
$style_bg = ';' . $style_bg . ' !important;';
$style = ' style="'.$style_bg.'padding:1px 5px 5px 22px"';
$button = 'Share/Save';
} else
$button = '
';
?>
onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/share_save?sitename=&siteurl=&linkname=&linkurl=">
';
$A2A_SHARE_SAVE_external_script_called = true;
}
else
$external_script_call = 'a2a_init("page");';
$A2A_javascript .= '