Settings] Version: .9.9.7.9 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 // Fix SSL if (is_ssl()) $A2A_SHARE_SAVE_plugin_url_path = str_replace('http:', 'https:', $A2A_SHARE_SAVE_plugin_url_path); $A2A_SHARE_SAVE_options = get_option('addtoany_options'); function A2A_SHARE_SAVE_init() { global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_plugin_basename; if (get_option('A2A_SHARE_SAVE_button')) { A2A_SHARE_SAVE_migrate_options(); } 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_init'); 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(dirname(__FILE__).'/' . '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'] = "
"; if ( ! isset($args['html_container_close'])) $args['html_container_close'] = "
"; // 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 = array() ) { // $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; $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE; $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE; $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc. $defaults = array( 'linkname' => '', 'linkurl' => '', 'linkname_enc' => '', 'linkurl_enc' => '', 'output_later' => FALSE, 'html_container_open' => '', 'html_container_close' => '', 'html_wrap_open' => '', 'html_wrap_close' => '', ); $args = wp_parse_args( $args, $defaults ); extract( $args ); // Make available services extensible via plugins, themes (functions.php), etc. $A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services); $service_codes = array_keys($A2A_SHARE_SAVE_services); // Include Facebook Like and Twitter Tweet array_unshift($service_codes, 'facebook_like', 'twitter_tweet'); $options = get_option('addtoany_options'); $active_services = $options['active_services']; $ind_html = "" . $html_container_open; if( !$active_services ) $active_services = Array(); foreach($active_services as $active_service) { if ( !in_array($active_service, $service_codes) ) continue; if ($active_service == 'facebook_like' || $active_service == 'twitter_tweet') { $link = ADDTOANY_SHARE_SAVE_SPECIAL($active_service, $args); } else { $service = $A2A_SHARE_SAVE_services[$active_service]; $safe_name = $active_service; $name = $service['name']; if (isset($service['href'])) { $custom_service = TRUE; $href = $service['href']; if (isset($service['href_js_esc'])) { $href_linkurl = str_replace("'", "\'", $linkurl); $href_linkname = str_replace("'", "\'", $linkname); } else { $href_linkurl = $linkurl_enc; $href_linkname = $linkname_enc; } $href = str_replace("A2A_LINKURL", $href_linkurl, $href); $href = str_replace("A2A_LINKNAME", $href_linkname, $href); $href = str_replace(" ", "%20", $href); } else { $custom_service = FALSE; } $icon_url = (isset($service['icon_url'])) ? $service['icon_url'] : FALSE; $icon = (isset($service['icon'])) ? $service['icon'] : 'default'; // Just the icon filename $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 = ($icon_url) ? $icon_url : $A2A_SHARE_SAVE_plugin_url_path."/icons/".$icon.".png"; $class_attr = ($custom_service) ? "" : " class=\"a2a_button_$safe_name\""; $target_attr = (isset($service['href'])) ? "" : " target=\"_blank\""; $link = $html_wrap_open.""; $link .= "\"$name\"/"; $link .= "".$html_wrap_close; } $ind_html .= $link; } $ind_html .= $html_container_close; if ( $output_later ) return $ind_html; else echo $ind_html; } function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) { // $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; $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE; $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE; $args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc. $defaults = array( 'linkname' => '', 'linkurl' => '', 'linkname_enc' => '', 'linkurl_enc' => '', 'output_later' => FALSE, 'html_container_open' => '', 'html_container_close' => '', 'html_wrap_open' => '', 'html_wrap_close' => '', ); $args = wp_parse_args( $args, $defaults ); extract( $args ); /* AddToAny button */ $is_feed = is_feed(); $button_target = ''; $button_href_querystring = ($is_feed) ? '#url=' . $linkurl_enc . '&title=' . $linkname_enc : ''; $options = get_option('addtoany_options'); if( ! $options['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( $options['button'] == 'CUSTOM' ) { $button_src = $options['button_custom']; $button_width = ''; $button_height = ''; } else if( $options['button'] == 'TEXT' ) { $button_text = stripslashes($options['button_text']); } else { $button_attrs = explode( '|', $options['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($options['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 !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'; } $button_html = $html_container_open . $html_wrap_open . '' . $button . '' . $html_wrap_close . $html_container_close; // If not a feed if( ! $is_feed ) { $http_or_https = (is_ssl()) ? 'https' : 'http'; global $A2A_SHARE_SAVE_external_script_called; if ( ! $A2A_SHARE_SAVE_external_script_called ) { // Use local cache? $cache = ($options['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 = $options['additional_js_variables']; $external_script_call = (($cache) ? 'a2a_config.static_server="' . $static_server . '";' . "\n" : '' ) . (($options['onclick']=='1') ? 'a2a_config.onclick=1;' . "\n" : '') . (($options['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');\n//-->"; $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 Option List on Settings > Plugins page 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); ?>