Settings] Version: .9.9.5.5 Author: AddToAny Author URI: http://www.addtoany.com/ */ 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_filter('init', 'A2A_SHARE_SAVE_textdomain'); function A2A_SHARE_SAVE_link_vars($linkname = FALSE, $linkurl = FALSE) { global $post; $linkname = ($linkname) ? $linkname : get_the_title($post->ID); $linkname_enc = rawurlencode( $linkname ); $linkurl = ($linkurl) ? $linkurl : get_permalink($post->ID); $linkurl_enc = rawurlencode( $linkurl ); return compact( 'linkname', 'linkname_enc', 'linkurl', 'linkurl_enc' ); } include_once('services.php'); // Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON function ADDTOANY_SHARE_SAVE_KIT( $args = false ) { if ( ! isset($args['html_container_open'])) $args['html_container_open'] = ""; // Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS $html_container_close = $args['html_container_close']; // Cache for _BUTTON unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON if ( ! isset($args['html_wrap_open'])) $args['html_wrap_open'] = "
  • "; if ( ! isset($args['html_wrap_close'])) $args['html_wrap_close'] = "
  • "; $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args); $args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS unset($args['html_container_open']); // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS $kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args); if($args['output_later']) return $kit_html; else echo $kit_html; } function ADDTOANY_SHARE_SAVE_ICONS( $args = false ) { // $args array: output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl $args = array_merge($args, A2A_SHARE_SAVE_link_vars($args['linkname'], $args['linkurl']));; // 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 = "" . $args['html_container_open']; 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', $args['linkurl_enc'], $href); $href = str_replace('A2A_LINKNAME', $args['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=" . $args['linkurl_enc'] . "&linkname=" . $args['linkname_enc']; $src = ($custom_service) ? $icon : $A2A_SHARE_SAVE_plugin_url_path."/icons/".$icon.".png"; $link = $args['html_wrap_open'].""; $link .= "\"$name\"/"; $link .= "".$args['html_wrap_close']; $ind_html .= apply_filters('addtoany_link', $link); } $ind_html .= $args['html_container_close']; if (isset($args['output_later'])) return $ind_html; else echo $ind_html; } function ADDTOANY_SHARE_SAVE_BUTTON( $args = false ) { // $args array = output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl 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); $args = array_merge($args, A2A_SHARE_SAVE_link_vars($args['linkname'], $args['linkurl']));; // linkname_enc, etc. /* AddToAny 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 = 'Share/Bookmark'; } $button_html = $args['html_container_open'].$args['html_wrap_open'].''.$button.''.$args['html_wrap_close'].$args['html_container_close']; // If not a feed if( !is_feed() ) { if (function_exists('is_ssl') ) // @since 2.6.0 $http_or_https = (is_ssl()) ? 'https' : 'http'; else $http_or_https = 'http'; global $A2A_SHARE_SAVE_external_script_called; if ( ! $A2A_SHARE_SAVE_external_script_called ) { // Use local cache? $cache = (get_option('A2A_SHARE_SAVE_cache')=='1') ? TRUE : FALSE; $upload_dir = wp_upload_dir(); $static_server = ($cache) ? $upload_dir['baseurl'] . '/addtoany' : $http_or_https . '://static.addtoany.com/menu'; // Enternal script call + initial JS + set-once variables $initial_js = 'var a2a_config = a2a_config || {};' . "\n"; $additional_js = get_option('A2A_SHARE_SAVE_additional_js_variables'); $external_script_call = (($cache) ? 'a2a_config.static_server="' . $static_server . '";' . "\n" : '' ) . ((get_option('A2A_SHARE_SAVE_onclick')=='1') ? 'a2a_config.onclick=1;' . "\n" : '') . ((get_option('A2A_SHARE_SAVE_hide_embeds')=='-1') ? 'a2a_config.hide_embeds=0;' . "\n" : '') . ((get_option('A2A_SHARE_SAVE_show_title')=='1') ? 'a2a_config.show_title=1;' . "\n" : '') . (($additional_js) ? stripslashes($additional_js) . "\n" : '') . ''; $A2A_SHARE_SAVE_external_script_called = true; } else { $external_script_call = 'a2a.init("page");'; $initial_js = ''; } $button_javascript = "\n" . ' = "2.6") { wp_enqueue_script('jquery-ui-sortable'); } } } add_filter('admin_menu', 'A2A_SHARE_SAVE_add_menu_link'); // Place in Settings Option List function A2A_SHARE_SAVE_actlinks( $links, $file ){ //Static so we don't call plugin_basename on every plugin row. static $this_plugin; if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__); if ( $file == $this_plugin ){ $settings_link = '' . __('Settings') . ''; array_unshift( $links, $settings_link ); // before other links } return $links; } add_filter("plugin_action_links", 'A2A_SHARE_SAVE_actlinks', 10, 2); ?>