Settings]
Version: .9.9.4.2
Author: Add to Any
Author URI: http://www.addtoany.com/contact/
*/
if( !isset($A2A_javascript) )
$A2A_javascript = '';
if( !isset($A2A_locale) )
$A2A_locale = '';
// Pre-2.6 compatibility
if ( !defined('WP_CONTENT_URL') )
define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
if ( ! defined( 'WP_PLUGIN_URL' ) )
define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
$A2A_SHARE_SAVE_plugin_basename = plugin_basename(dirname(__FILE__));
$A2A_SHARE_SAVE_plugin_url_path = WP_PLUGIN_URL.'/'.$A2A_SHARE_SAVE_plugin_basename; // /wp-content/plugins/add-to-any
function A2A_SHARE_SAVE_textdomain() {
global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_plugin_basename;
load_plugin_textdomain('add-to-any',
$A2A_SHARE_SAVE_plugin_url_path.'/languages',
$A2A_SHARE_SAVE_plugin_basename.'/languages');
}
add_action('init', 'A2A_SHARE_SAVE_textdomain');
function A2A_SHARE_SAVE_link_vars() {
global $post;
$linkname = get_the_title($post->ID);
$linkname_enc = rawurlencode( $linkname );
$linkurl = get_permalink($post->ID);
$linkurl_enc = rawurlencode( $linkurl );
return compact( 'linkname', 'linkname_enc', 'linkurl', 'linkurl_enc' );
}
include_once('services.php');
function ADDTOANY_SHARE_SAVE_ICONS( $args = false ) {
if( $args )
extract( $args ); // output_later, html_wrap_open, html_wrap_close
extract(A2A_SHARE_SAVE_link_vars()); // linkname_enc, etc.
global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services;
// Make available services extensible via plugins, themes (functions.php), etc.
$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
$active_services = get_option('A2A_SHARE_SAVE_active_services');
$ind_html = "";
if( !$active_services )
$active_services = Array();
foreach($active_services as $active_service) {
// Skip unknown
if( !in_array($active_service, array_keys($A2A_SHARE_SAVE_services)) )
continue;
$service = $A2A_SHARE_SAVE_services[$active_service];
$safe_name = $active_service;
$name = $service['name'];
if (isset($service['href'])) {
$custom_service = TRUE;
$href = $service['href'];
$href = str_replace('A2A_LINKURL', $linkurl_enc, $href);
$href = str_replace('A2A_LINKNAME', $linkname_enc, $href);
} else {
$custom_service = FALSE;
}
if ( $custom_service && isset($service['icon_url']) )
$icon = $service['icon_url'];
elseif ( ! isset($service['icon']))
$icon = 'default';
else
$icon = $service['icon'];
$width = (isset($service['icon_width'])) ? $service['icon_width'] : '16';
$height = (isset($service['icon_height'])) ? $service['icon_height'] : '16';
$url = ($custom_service) ? $href : "http://www.addtoany.com/add_to/" . $safe_name . "?linkurl=" . $linkurl_enc . "&linkname=" . $linkname_enc;
$src = ($custom_service) ? $icon : $A2A_SHARE_SAVE_plugin_url_path."/icons/".$icon.".png";
$link = $html_wrap_open."";
$link .= "
";
$link .= "".$html_wrap_close;
$ind_html .= apply_filters('addtoany_link', $link);
}
if($output_later)
return $ind_html;
else
echo $ind_html;
}
function ADDTOANY_SHARE_SAVE_BUTTON( $args = false ) {
global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services;
// Make available services extensible via plugins, themes (functions.php), etc.
$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
if( $args )
extract( $args ); // output_later, html_wrap_open, html_wrap_close
extract(A2A_SHARE_SAVE_link_vars()); // linkname_enc, etc.
/* Add to Any button */
$button_target = (get_option('A2A_SHARE_SAVE_button_opens_new_window')=='1' && (get_option('A2A_SHARE_SAVE_onclick')!='1')) ? ' target="_blank"' : '';
if( !get_option('A2A_SHARE_SAVE_button') ) {
$button_fname = 'share_save_171_16.png';
$button_width = ' width="171"';
$button_height = ' height="16"';
$button_src = $A2A_SHARE_SAVE_plugin_url_path.'/'.$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 if( get_option('A2A_SHARE_SAVE_button') == 'TEXT' ) {
$button_text = stripslashes(get_option('A2A_SHARE_SAVE_button_text'));
} 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 = $A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname;
$button_text = stripslashes(get_option('A2A_SHARE_SAVE_button_text'));
}
if( $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) {
if( !is_feed() ) {
$style_bg = 'background:url('.$A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname.') no-repeat scroll 9px 0px'; // padding-left:9 (9=other icons padding)
$style_bg = ';' . $style_bg . ' !important;';
$style = ' style="'.$style_bg.'padding:0 0 0 30px;display:inline-block;height:16px;line-height:16px;vertical-align:middle;"'; // padding-left:30+9 (9=other icons padding)
}
}
if( $button_text && (!$button_fname || $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png') ) {
$button = $button_text;
} else {
$style = '';
$button = '
';
}
$button_html = $html_wrap_open.''.$button.''.$html_wrap_close;
// If not a feed
if( !is_feed() ) {
global $A2A_javascript, $A2A_SHARE_SAVE_external_script_called;
if( $A2A_javascript == '' || !$A2A_SHARE_SAVE_external_script_called ) {
$external_script_call = '';
$A2A_SHARE_SAVE_external_script_called = true;
}
else
$external_script_call = 'a2a_init("page");';
$A2A_javascript .= '
' . __('Settings') . '';
array_unshift( $links, $settings_link ); // before other links
}
return $links;
}
add_filter("plugin_action_links", 'A2A_SHARE_SAVE_actlinks', 10, 2);
?>