web/wp-content/plugins/add-to-any/add-to-any.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     1 <?php
     1 <?php
     2 /*
     2 /*
     3 Plugin Name: Add to Any: Share/Bookmark/Email Button
     3 Plugin Name: Share Buttons by Lockerz / AddToAny
     4 Plugin URI: http://www.addtoany.com/
     4 Plugin URI: http://share.lockerz.com/
     5 Description: Help readers share, bookmark, and email your posts and pages using any service.  [<a href="options-general.php?page=add-to-any.php">Settings</a>]
     5 Description: Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google, StumbleUpon, LinkedIn and many more.  [<a href="options-general.php?page=add-to-any.php">Settings</a>]
     6 Version: .9.9.4.3
     6 Version: 1.0.3
     7 Author: Add to Any
     7 Author: micropat
     8 Author URI: http://www.addtoany.com/contact/
     8 Author URI: http://share.lockerz.com/
     9 */
     9 */
    10 
    10 
    11 if( !isset($A2A_javascript) )
       
    12 	$A2A_javascript = '';
       
    13 if( !isset($A2A_locale) )
    11 if( !isset($A2A_locale) )
    14 	$A2A_locale = '';
    12 	$A2A_locale = '';
    15 
    13 	
    16 // Pre-2.6 compatibility
    14 // Pre-2.6 compatibility
    17 if ( !defined('WP_CONTENT_URL') )
    15 if ( ! defined('WP_CONTENT_URL') )
    18     define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    16 	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    19 if ( ! defined( 'WP_PLUGIN_URL' ) )
    17 if ( ! defined( 'WP_PLUGIN_URL' ) )
    20       define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
    18 	define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );
    21 
    19 	
    22 $A2A_SHARE_SAVE_plugin_basename = plugin_basename(dirname(__FILE__));
    20 $A2A_SHARE_SAVE_plugin_basename = plugin_basename(dirname(__FILE__));
    23 $A2A_SHARE_SAVE_plugin_url_path = WP_PLUGIN_URL.'/'.$A2A_SHARE_SAVE_plugin_basename; // /wp-content/plugins/add-to-any
    21 
    24 
    22 // WordPress Must-Use?
    25 function A2A_SHARE_SAVE_textdomain() {
    23 if ( basename(dirname(__FILE__)) == "mu-plugins" ) {
    26 	global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_plugin_basename;
    24 	// __FILE__ expected in /wp-content/mu-plugins (parent directory for auto-execution)
    27 	
    25 	// /wp-content/mu-plugins/add-to-any
       
    26 	$A2A_SHARE_SAVE_plugin_url_path = WPMU_PLUGIN_URL . '/add-to-any';
       
    27 	$A2A_SHARE_SAVE_plugin_dir = WPMU_PLUGIN_DIR . '/add-to-any';
       
    28 } 
       
    29 else {
       
    30 	// /wp-content/plugins/add-to-any
       
    31 	$A2A_SHARE_SAVE_plugin_url_path = WP_PLUGIN_URL . '/' . $A2A_SHARE_SAVE_plugin_basename;
       
    32 	$A2A_SHARE_SAVE_plugin_dir = WP_PLUGIN_DIR . '/' . $A2A_SHARE_SAVE_plugin_basename;
       
    33 }
       
    34 	
       
    35 
       
    36 // Fix SSL
       
    37 if (is_ssl())
       
    38 	$A2A_SHARE_SAVE_plugin_url_path = str_replace('http:', 'https:', $A2A_SHARE_SAVE_plugin_url_path);
       
    39 
       
    40 $A2A_SHARE_SAVE_options = get_option('addtoany_options');
       
    41 
       
    42 function A2A_SHARE_SAVE_init() {
       
    43 	global $A2A_SHARE_SAVE_plugin_url_path,
       
    44 		$A2A_SHARE_SAVE_plugin_basename, 
       
    45 		$A2A_SHARE_SAVE_options;
       
    46 	
       
    47 	if (get_option('A2A_SHARE_SAVE_button')) {
       
    48 	    A2A_SHARE_SAVE_migrate_options();
       
    49 	    $A2A_SHARE_SAVE_options = get_option('addtoany_options');
       
    50 	}
       
    51   
    28 	load_plugin_textdomain('add-to-any',
    52 	load_plugin_textdomain('add-to-any',
    29 		$A2A_SHARE_SAVE_plugin_url_path.'/languages',
    53 		$A2A_SHARE_SAVE_plugin_url_path.'/languages',
    30 		$A2A_SHARE_SAVE_plugin_basename.'/languages');
    54 		$A2A_SHARE_SAVE_plugin_basename.'/languages');
    31 }
    55 		
    32 add_action('init', 'A2A_SHARE_SAVE_textdomain');
    56 	if ($A2A_SHARE_SAVE_options['display_in_excerpts'] != '-1') {
    33 
    57 		// Excerpts use strip_tags() for the_content, so cancel if Excerpt and append to the_excerpt instead
    34 function A2A_SHARE_SAVE_link_vars() {
    58 		add_filter('get_the_excerpt', 'A2A_SHARE_SAVE_remove_from_content', 9);
       
    59 		add_filter('the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98);
       
    60 	}
       
    61 }
       
    62 add_filter('init', 'A2A_SHARE_SAVE_init');
       
    63 
       
    64 function A2A_SHARE_SAVE_link_vars($linkname = FALSE, $linkurl = FALSE) {
    35 	global $post;
    65 	global $post;
    36 	
    66 	
    37 	$linkname		= get_the_title($post->ID);
    67 	$linkname		= ($linkname) ? $linkname : get_the_title($post->ID);
    38 	$linkname_enc	= rawurlencode( $linkname );
    68 	$linkname_enc	= rawurlencode( html_entity_decode($linkname, ENT_QUOTES, 'UTF-8') );
    39 	$linkurl		= get_permalink($post->ID);
    69 	$linkurl		= ($linkurl) ? $linkurl : get_permalink($post->ID);
    40 	$linkurl_enc	= rawurlencode( $linkurl );	
    70 	$linkurl_enc	= rawurlencode( $linkurl );
    41 	
    71 	
    42 	return compact( 'linkname', 'linkname_enc', 'linkurl', 'linkurl_enc' );
    72 	return compact( 'linkname', 'linkname_enc', 'linkurl', 'linkurl_enc' );
    43 }
    73 }
    44 
    74 
    45 include_once('services.php');
    75 include_once($A2A_SHARE_SAVE_plugin_dir . '/services.php');
    46 
    76 
    47 function ADDTOANY_SHARE_SAVE_ICONS( $args = false ) {
    77 // Combine ADDTOANY_SHARE_SAVE_ICONS and ADDTOANY_SHARE_SAVE_BUTTON
    48 	if( $args )
    78 function ADDTOANY_SHARE_SAVE_KIT( $args = false ) {
    49 		extract( $args ); // output_later, html_wrap_open, html_wrap_close
    79 	global $_addtoany_counter;
    50 	extract(A2A_SHARE_SAVE_link_vars()); // linkname_enc, etc.
    80 	
    51 		
    81 	$_addtoany_counter++;
    52 	global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services;
    82 	
       
    83 	if ( ! isset($args['html_container_open'])) {
       
    84 		$args['html_container_open'] = '<div class="a2a_kit a2a_target addtoany_list" id="wpa2a_' . $_addtoany_counter . '">';
       
    85 		$args['is_kit'] = TRUE;
       
    86 	}
       
    87 	if ( ! isset($args['html_container_close']))
       
    88 		$args['html_container_close'] = "</div>";
       
    89 	// Close container element in ADDTOANY_SHARE_SAVE_BUTTON, not prematurely in ADDTOANY_SHARE_SAVE_ICONS
       
    90 	$html_container_close = $args['html_container_close']; // Cache for _BUTTON
       
    91 	unset($args['html_container_close']); // Avoid passing to ADDTOANY_SHARE_SAVE_ICONS since set in _BUTTON
       
    92 				
       
    93 	if ( ! isset($args['html_wrap_open']))
       
    94 		$args['html_wrap_open'] = "";
       
    95 	if ( ! isset($args['html_wrap_close']))
       
    96 		$args['html_wrap_close'] = "";
       
    97 	
       
    98     $kit_html = ADDTOANY_SHARE_SAVE_ICONS($args);
       
    99 	
       
   100 	$args['html_container_close'] = $html_container_close; // Re-set because unset above for _ICONS
       
   101 	unset($args['html_container_open']);  // Avoid passing to ADDTOANY_SHARE_SAVE_BUTTON since set in _ICONS
       
   102     
       
   103 	$kit_html .= ADDTOANY_SHARE_SAVE_BUTTON($args);
       
   104 	
       
   105 	if (isset($args['output_later']) && $args['output_later'])
       
   106 		return $kit_html;
       
   107 	else
       
   108 		echo $kit_html;
       
   109 }
       
   110 
       
   111 function ADDTOANY_SHARE_SAVE_ICONS( $args = array() ) {
       
   112 	// $args array: output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl
       
   113 	
       
   114 	global $A2A_SHARE_SAVE_plugin_url_path, 
       
   115 		$A2A_SHARE_SAVE_services;
       
   116 	
       
   117 	$linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
       
   118 	$linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
       
   119 	
       
   120 	$args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
       
   121 	
       
   122 	$defaults = array(
       
   123 		'linkname' => '',
       
   124 		'linkurl' => '',
       
   125 		'linkname_enc' => '',
       
   126 		'linkurl_enc' => '',
       
   127 		'output_later' => FALSE,
       
   128 		'html_container_open' => '',
       
   129 		'html_container_close' => '',
       
   130 		'html_wrap_open' => '',
       
   131 		'html_wrap_close' => '',
       
   132 	);
       
   133 	
       
   134 	$args = wp_parse_args( $args, $defaults );
       
   135 	extract( $args );
    53 	
   136 	
    54 	// Make available services extensible via plugins, themes (functions.php), etc.
   137 	// Make available services extensible via plugins, themes (functions.php), etc.
    55 	$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
   138 	$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
    56 	
   139 	
    57 	$active_services = get_option('A2A_SHARE_SAVE_active_services');
   140 	$service_codes = (is_array($A2A_SHARE_SAVE_services)) ? array_keys($A2A_SHARE_SAVE_services) : Array();
    58 	
   141 	
    59 	$ind_html = "";
   142 	// Include Facebook Like and Twitter Tweet etc.
       
   143 	array_unshift($service_codes, 'facebook_like', 'twitter_tweet', 'google_plusone', 'google_plus_share');
       
   144 	
       
   145 	$options = get_option('addtoany_options');
       
   146   
       
   147 	$active_services = $options['active_services'];
       
   148 	
       
   149 	$ind_html = "" . $html_container_open;
    60 	
   150 	
    61 	if( !$active_services )
   151 	if( !$active_services )
    62 		$active_services = Array();
   152 		$active_services = Array();
    63 	
   153 	
    64 	foreach($active_services as $active_service) {
   154 	foreach($active_services as $active_service) {
    65 		
   155 		
    66 		// Skip unknown
   156 		if ( !in_array($active_service, $service_codes) )
    67 		if( !in_array($active_service, array_keys($A2A_SHARE_SAVE_services)) )
       
    68 			continue;
   157 			continue;
    69 
   158 
    70 		$service = $A2A_SHARE_SAVE_services[$active_service];
   159 		if ($active_service == 'facebook_like' || $active_service == 'twitter_tweet' || $active_service == 'google_plusone' || $active_service == 'google_plus_share') {
    71 		$safe_name = $active_service;
   160 			$special_args = $args;
    72 		$name = $service['name'];
   161 			$special_args['output_later'] = TRUE;
    73 		
   162 			$link = ADDTOANY_SHARE_SAVE_SPECIAL($active_service, $special_args);
    74 		if (isset($service['href'])) {
   163 		}
    75 			$custom_service = TRUE;
   164 		else {
    76 			$href = $service['href'];
   165 			$service = $A2A_SHARE_SAVE_services[$active_service];
    77 			$href = str_replace('A2A_LINKURL', $linkurl_enc, $href);
   166 			$safe_name = $active_service;
    78 			$href = str_replace('A2A_LINKNAME', $linkname_enc, $href);
   167 			$name = $service['name'];
    79 		} else {
   168 			
    80 			$custom_service = FALSE;
   169 			if (isset($service['href'])) {
    81 		}
   170 				$custom_service = TRUE;
    82 
   171 				$href = $service['href'];
    83 		if ( $custom_service && isset($service['icon_url']) )
   172 				if (isset($service['href_js_esc'])) {
    84 			$icon = $service['icon_url'];
   173 					$href_linkurl = str_replace("'", "\'", $linkurl);
    85 		elseif ( ! isset($service['icon']))
   174 					$href_linkname = str_replace("'", "\'", $linkname);
    86 			$icon = 'default';
   175 				} else {
    87 		else
   176 					$href_linkurl = $linkurl_enc;
    88 			$icon = $service['icon'];
   177 					$href_linkname = $linkname_enc;
    89 		$width = (isset($service['icon_width'])) ? $service['icon_width'] : '16';
   178 				}
    90 		$height = (isset($service['icon_height'])) ? $service['icon_height'] : '16'; 
   179 				$href = str_replace("A2A_LINKURL", $href_linkurl, $href);
    91 		
   180 				$href = str_replace("A2A_LINKNAME", $href_linkname, $href);
    92 		$url = ($custom_service) ? $href : "http://www.addtoany.com/add_to/" . $safe_name . "?linkurl=" . $linkurl_enc . "&amp;linkname=" . $linkname_enc;
   181 				$href = str_replace(" ", "%20", $href);
    93 		$src = ($custom_service) ? $icon : $A2A_SHARE_SAVE_plugin_url_path."/icons/".$icon.".png";
   182 			} else {
    94 		
   183 				$custom_service = FALSE;
    95 		$link = $html_wrap_open."<a href=\"$url\" title=\"$name\" rel=\"nofollow\" target=\"_blank\">";
   184 			}
    96 		$link .= "<img src=\"$src\" width=\"$width\" height=\"$height\" alt=\"$name\"/>";
   185 	
    97 		$link .= "</a>".$html_wrap_close;
   186 			$icon_url = (isset($service['icon_url'])) ? $service['icon_url'] : FALSE;
    98 		
   187 			$icon = (isset($service['icon'])) ? $service['icon'] : 'default'; // Just the icon filename
    99 		$ind_html .= apply_filters('addtoany_link', $link);
   188 			$width = (isset($service['icon_width'])) ? $service['icon_width'] : '16';
   100 	}
   189 			$height = (isset($service['icon_height'])) ? $service['icon_height'] : '16';
   101 	
   190 			
   102 	if($output_later)
   191 			$url = ($custom_service) ? $href : "http://www.addtoany.com/add_to/" . $safe_name . "?linkurl=" . $linkurl_enc . "&amp;linkname=" . $linkname_enc;
       
   192 			$src = ($icon_url) ? $icon_url : $A2A_SHARE_SAVE_plugin_url_path."/icons/".$icon.".png";
       
   193 			$class_attr = ($custom_service) ? "" : " class=\"a2a_button_$safe_name\"";
       
   194 			
       
   195 			$link = $html_wrap_open."<a$class_attr href=\"$url\" title=\"$name\" rel=\"nofollow\" target=\"_blank\">";
       
   196 			$link .= "<img src=\"$src\" width=\"$width\" height=\"$height\" alt=\"$name\"/>";
       
   197 			$link .= "</a>".$html_wrap_close;
       
   198 		}
       
   199 		
       
   200 		$ind_html .= $link;
       
   201 	}
       
   202 	
       
   203 	$ind_html .= $html_container_close;
       
   204 	
       
   205 	if ( $output_later )
   103 		return $ind_html;
   206 		return $ind_html;
   104 	else
   207 	else
   105 		echo $ind_html;
   208 		echo $ind_html;
   106 }
   209 }
   107 
   210 
   108 function ADDTOANY_SHARE_SAVE_BUTTON( $args = false ) {
   211 function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
   109 
   212 	
   110 	global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services;
   213 	// $args array = output_later, html_container_open, html_container_close, html_wrap_open, html_wrap_close, linkname, linkurl
   111 	
   214 
   112 	// Make available services extensible via plugins, themes (functions.php), etc.
   215 	global $A2A_SHARE_SAVE_plugin_url_path, $_addtoany_targets, $_addtoany_counter, $_addtoany_init;
   113 	$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
   216 	
   114 	
   217 	$linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
   115 	if( $args )
   218 	$linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
   116 		extract( $args ); // output_later, html_wrap_open, html_wrap_close
   219 	$_addtoany_targets = (isset($_addtoany_targets)) ? $_addtoany_targets : array();
   117 	
   220 
   118 	extract(A2A_SHARE_SAVE_link_vars()); // linkname_enc, etc.
   221 	$args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
   119 	
   222 	
   120 	/* Add to Any button */
   223 	$defaults = array(
   121 	
   224 		'linkname' => '',
   122 	$button_target	= (get_option('A2A_SHARE_SAVE_button_opens_new_window')=='1' && (get_option('A2A_SHARE_SAVE_onclick')!='1')) ? ' target="_blank"' : '';
   225 		'linkurl' => '',
   123 	
   226 		'linkname_enc' => '',
   124 	if( !get_option('A2A_SHARE_SAVE_button') ) {
   227 		'linkurl_enc' => '',
       
   228 		'use_current_page' => FALSE,
       
   229 		'output_later' => FALSE,
       
   230 		'is_kit' => FALSE,
       
   231 		'html_container_open' => '',
       
   232 		'html_container_close' => '',
       
   233 		'html_wrap_open' => '',
       
   234 		'html_wrap_close' => '',
       
   235 	);
       
   236 	
       
   237 	$args = wp_parse_args( $args, $defaults );
       
   238 	extract( $args );
       
   239 	
       
   240 	// If not enclosed in an AddToAny Kit, count & target this button (instead of Kit) for async loading
       
   241 	if ( ! $args['is_kit']) {
       
   242 		$_addtoany_counter++;
       
   243 		$button_class = ' a2a_target';
       
   244 		$button_id = ' id="wpa2a_' . $_addtoany_counter . '"';
       
   245 	} else {
       
   246 		$button_class = '';
       
   247 		$button_id = '';
       
   248 	}
       
   249 	
       
   250 	/* AddToAny button */
       
   251 	
       
   252 	$is_feed = is_feed();
       
   253 	$button_target = '';
       
   254 	$button_href_querystring = ($is_feed) ? '#url=' . $linkurl_enc . '&amp;title=' . $linkname_enc  : '';
       
   255 	$options = get_option('addtoany_options');
       
   256 	
       
   257 	if( ! $options['button'] ) {
   125 		$button_fname	= 'share_save_171_16.png';
   258 		$button_fname	= 'share_save_171_16.png';
   126 		$button_width	= ' width="171"';
   259 		$button_width	= ' width="171"';
   127 		$button_height	= ' height="16"';
   260 		$button_height	= ' height="16"';
   128 		$button_src		= $A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname;
   261 		$button_src		= $A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname;
   129 	} else if( get_option('A2A_SHARE_SAVE_button') == 'CUSTOM' ) {
   262 	} else if( $options['button'] == 'CUSTOM' ) {
   130 		$button_src		= get_option('A2A_SHARE_SAVE_button_custom');
   263 		$button_src		= $options['button_custom'];
   131 		$button_width	= '';
   264 		$button_width	= '';
   132 		$button_height	= '';
   265 		$button_height	= '';
   133 	} else if( get_option('A2A_SHARE_SAVE_button') == 'TEXT' ) {
   266 	} else if( $options['button'] == 'TEXT' ) {
   134 		$button_text	= stripslashes(get_option('A2A_SHARE_SAVE_button_text'));
   267 		$button_text	= stripslashes($options['button_text']);
   135 	} else {
   268 	} else {
   136 		$button_attrs	= explode( '|', get_option('A2A_SHARE_SAVE_button') );
   269 		$button_attrs	= explode( '|', $options['button'] );
   137 		$button_fname	= $button_attrs[0];
   270 		$button_fname	= $button_attrs[0];
   138 		$button_width	= ' width="'.$button_attrs[1].'"';
   271 		$button_width	= ' width="'.$button_attrs[1].'"';
   139 		$button_height	= ' height="'.$button_attrs[2].'"';
   272 		$button_height	= ' height="'.$button_attrs[2].'"';
   140 		$button_src		= $A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname;
   273 		$button_src		= $A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname;
   141 		$button_text	= stripslashes(get_option('A2A_SHARE_SAVE_button_text'));
   274 		$button_text	= stripslashes($options['button_text']);
   142 	}
   275 	}
   143 	
   276 	
   144 	if( $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png' ) {
   277 	$style = '';
   145 		if( !is_feed() ) {
   278 	
   146 			$style_bg	= 'background:url('.$A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname.') no-repeat scroll 9px 0px'; // padding-left:9 (9=other icons padding)
   279 	if( isset($button_fname) && ($button_fname == 'favicon.png' || $button_fname == 'share_16_16.png') ) {
   147 			$style_bg	= ';' . $style_bg . ' !important;';
   280 		if( ! $is_feed) {
   148 			$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)
   281 			$style_bg	= 'background:url('.$A2A_SHARE_SAVE_plugin_url_path.'/'.$button_fname.') no-repeat scroll 9px 0px !important;';
   149 		}
   282 			$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)
   150 	}
   283 		}
   151 	
   284 	}
   152 	if( $button_text && (!$button_fname || $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png') ) {
   285 	
       
   286 	if( isset($button_text) && $button_text && ( ! isset($button_fname) || ! $button_fname || $button_fname == 'favicon.png' || $button_fname == 'share_16_16.png') ) {
   153 		$button			= $button_text;
   287 		$button			= $button_text;
   154 	} else {
   288 	} else {
   155 		$style = '';
   289 		$style = '';
   156 		$button			= '<img src="'.$button_src.'"'.$button_width.$button_height.' alt="Share/Bookmark"/>';
   290 		$button			= '<img src="'.$button_src.'"'.$button_width.$button_height.' alt="Share"/>';
   157 	}
   291 	}
   158 	
   292 	
   159 	$button_html = $html_wrap_open.'<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?'
   293 	$button_html = $html_container_open . $html_wrap_open . '<a class="a2a_dd' . $button_class . ' addtoany_share_save" href="http://www.addtoany.com/share_save' .$button_href_querystring . '"' . $button_id
   160 		.'linkurl='.$linkurl_enc
   294 		. $style . $button_target
   161 		.'&amp;linkname='.$linkname_enc
   295 		. '>' . $button . '</a>' . $html_wrap_close . $html_container_close;
   162 		.'"' . $style . $button_target
       
   163 		.'>'.$button.'</a>'.$html_wrap_close;
       
   164 	
   296 	
   165 	// If not a feed
   297 	// If not a feed
   166 	if( !is_feed() ) {
   298 	if( ! $is_feed ) {
   167 	
   299 		if ($use_current_page) {
   168 		global $A2A_javascript, $A2A_SHARE_SAVE_external_script_called;
   300 			$_addtoany_targets[] = "\n{title:document.title,"
   169 		if( $A2A_javascript == '' || !$A2A_SHARE_SAVE_external_script_called ) {
   301 				. "url:location.href}";
   170 			$external_script_call = '</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>';
   302 		} else {
   171 			$A2A_SHARE_SAVE_external_script_called = true;
   303 			$_addtoany_targets[] = "\n{title:'". esc_js($linkname) . "',"
       
   304 				. "url:'" . $linkurl . "'}";
       
   305 		}
       
   306 		
       
   307 		if ( ! $_addtoany_init) {
       
   308 			$javascript_load_early = "\n<script type=\"text/javascript\"><!--\n"
       
   309 				. "wpa2a.script_load();"			
       
   310 				. "\n//--></script>\n";
   172 		}
   311 		}
   173 		else
   312 		else
   174 			$external_script_call = 'a2a_init("page");</script>';
   313 			$javascript_load_early = "";
   175 		$A2A_javascript .= '<script type="text/javascript">' . "\n"
   314 		
   176 			. A2A_menu_locale()
   315 		$button_html .= $javascript_load_early;
   177 			. 'a2a_linkname="' . js_escape($linkname) . '";' . "\n"
   316 		$_addtoany_init = TRUE;
   178 			. 'a2a_linkurl="' . $linkurl . '";' . "\n"
   317 	}
   179 			. ((get_option('A2A_SHARE_SAVE_onclick')=='1') ? 'a2a_onclick=1;' . "\n" : '')
   318 	
   180 			. ((get_option('A2A_SHARE_SAVE_hide_embeds')=='-1') ? 'a2a_hide_embeds=0;' . "\n" : '')
   319 	if ( $output_later )
   181 			. ((get_option('A2A_SHARE_SAVE_show_title')=='1') ? 'a2a_show_title=1;' . "\n" : '')
       
   182 			. (($A2A_javascript == '' || !$A2A_SHARE_SAVE_external_script_called) ? stripslashes(get_option('A2A_SHARE_SAVE_additional_js_variables')) . "\n" : '')
       
   183 			. $external_script_call . "\n\n";
       
   184 		
       
   185 		remove_action('wp_footer', 'A2A_menu_javascript');
       
   186 		add_action('wp_footer', 'A2A_menu_javascript');
       
   187 	
       
   188 	}
       
   189 	
       
   190 	if($output_later)
       
   191 		return $button_html;
   320 		return $button_html;
   192 	else
   321 	else
   193 		echo $button_html;
   322 		echo $button_html;
   194 }
   323 }
   195 
   324 
   196 if (!function_exists('A2A_menu_javascript')) {
   325 function ADDTOANY_SHARE_SAVE_SPECIAL($special_service_code, $args = array() ) {
   197 	function A2A_menu_javascript() {
   326 	// $args array = output_later, linkname, linkurl
   198 		global $A2A_javascript;
   327 	
   199 		echo $A2A_javascript;
   328 	$options = get_option('addtoany_options');
   200 	}
   329 	
       
   330 	$linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
       
   331 	$linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
       
   332 	
       
   333 	$args = array_merge($args, A2A_SHARE_SAVE_link_vars($linkname, $linkurl)); // linkname_enc, etc.
       
   334 	extract( $args );
       
   335 	
       
   336 	$special_anchor_template = '<a class="a2a_button_%1$s addtoany_special_service"%2$s></a>';
       
   337 	$custom_attributes = '';
       
   338 	
       
   339 	if ($special_service_code == 'facebook_like') {
       
   340 		$custom_attributes .= ($options['special_facebook_like_options']['verb'] == 'recommend') ? ' data-action="recommend"'  : '';
       
   341 		$custom_attributes .= ' data-href="' . $linkurl . '"';
       
   342 		$special_html = sprintf($special_anchor_template, $special_service_code, $custom_attributes);
       
   343 	}
       
   344 	
       
   345 	elseif ($special_service_code == 'twitter_tweet') {
       
   346 		$custom_attributes .= ($options['special_twitter_tweet_options']['show_count'] == '1') ? ' data-count="horizontal"'  : ' data-count="none"';
       
   347 		$custom_attributes .= ' data-url="' . $linkurl . '"';
       
   348 		$custom_attributes .= ' data-text="' . $linkname . '"';
       
   349 		$special_html = sprintf($special_anchor_template, $special_service_code, $custom_attributes);
       
   350 	}
       
   351 	
       
   352 	elseif ($special_service_code == 'google_plusone') {
       
   353 		$custom_attributes .= ($options['special_google_plusone_options']['show_count'] == '1') ? ''  : ' data-annotation="none"';
       
   354 		$custom_attributes .= ' data-href="' . $linkurl . '"';
       
   355 		$special_html = sprintf($special_anchor_template, $special_service_code, $custom_attributes);
       
   356 	}
       
   357 	
       
   358 	elseif ($special_service_code == 'google_plus_share') {
       
   359 		$custom_attributes .= ($options['special_google_plus_share_options']['show_count'] == '1') ? ''  : ' data-annotation="none"';
       
   360 		$custom_attributes .= ' data-href="' . $linkurl . '"';
       
   361 		$special_html = sprintf($special_anchor_template, $special_service_code, $custom_attributes);
       
   362 	}
       
   363 	
       
   364 	if ( $output_later )
       
   365 		return $special_html;
       
   366 	else
       
   367 		echo $special_html;
   201 }
   368 }
   202 
   369 
   203 if (!function_exists('A2A_menu_locale')) {
   370 if (!function_exists('A2A_menu_locale')) {
   204 	function A2A_menu_locale() {return false;
   371 	function A2A_menu_locale() {
   205 		global $A2A_locale;
   372 		global $A2A_locale;
   206 		echo get_locale();
   373 		$locale = get_locale();
   207 		if( get_locale() == 'en_US' || $A2A_locale != '' )
   374 		if($locale  == 'en_US' || $locale == 'en' || $A2A_locale != '' )
   208 			return false;
   375 			return false;
   209 			
   376 			
   210 		$A2A_locale = 'a2a_localize = {
   377 		$A2A_locale = 'a2a_localize = {
   211 	Share: "' . __("Share", "add-to-any") . '",
   378 	Share: "' . __("Share", "add-to-any") . '",
   212 	Save: "' . __("Save", "add-to-any") . '",
   379 	Save: "' . __("Save", "add-to-any") . '",
   219 	FindAnyServiceToAddTo: "' . __("Instantly find any service to add to", "add-to-any") . '",
   386 	FindAnyServiceToAddTo: "' . __("Instantly find any service to add to", "add-to-any") . '",
   220 	PoweredBy: "' . __("Powered by", "add-to-any") . '",
   387 	PoweredBy: "' . __("Powered by", "add-to-any") . '",
   221 	ShareViaEmail: "' . __("Share via e-mail", "add-to-any") . '",
   388 	ShareViaEmail: "' . __("Share via e-mail", "add-to-any") . '",
   222 	SubscribeViaEmail: "' . __("Subscribe via e-mail", "add-to-any") . '",
   389 	SubscribeViaEmail: "' . __("Subscribe via e-mail", "add-to-any") . '",
   223 	BookmarkInYourBrowser: "' . __("Bookmark in your browser", "add-to-any") . '",
   390 	BookmarkInYourBrowser: "' . __("Bookmark in your browser", "add-to-any") . '",
   224 	BookmarkInstructions: "' . __("Press Ctrl+D or &#8984;+D to bookmark this page", "add-to-any") . '",
   391 	BookmarkInstructions: "' . __("Press Ctrl+D or \u2318+D to bookmark this page", "add-to-any") . '",
   225 	AddToYourFavorites: "' . __("Add to your favorites", "add-to-any") . '",
   392 	AddToYourFavorites: "' . __("Add to your favorites", "add-to-any") . '",
   226 	SendFromWebOrProgram: "' . __("Send from any e-mail address or e-mail program", "add-to-any") . '",
   393 	SendFromWebOrProgram: "' . __("Send from any e-mail address or e-mail program", "add-to-any") . '",
   227     EmailProgram: "' . __("E-mail program", "add-to-any") . '"
   394     EmailProgram: "' . __("E-mail program", "add-to-any") . '"
   228 };
   395 };
   229 ';
   396 ';
   230 		return $A2A_locale;
   397 		return $A2A_locale;
   231 	}
   398 	}
   232 }
   399 }
   233 
   400 
   234 if (!function_exists('A2A_wp_footer_check')) {
   401 
   235 	function A2A_wp_footer_check()
   402 function A2A_SHARE_SAVE_head_script() {
   236 	{
   403 	if (is_admin())
   237 		// If footer.php exists in the current theme, scan for "wp_footer"
   404 		return;
   238 		$file = get_template_directory() . '/footer.php';
   405 		
   239 		if( is_file($file) ) {
   406 	$options = get_option('addtoany_options');
   240 			$search_string = "wp_footer";
   407 	
   241 			$file_lines = @file($file);
   408 	$http_or_https = (is_ssl()) ? 'https' : 'http';
   242 			
   409 	
   243 			foreach($file_lines as $line) {
   410 	global $A2A_SHARE_SAVE_external_script_called;
   244 				$searchCount = substr_count($line, $search_string);
   411 	if ( ! $A2A_SHARE_SAVE_external_script_called ) {
   245 				if($searchCount > 0) {
   412 		// Use local cache?
   246 					return true;
   413 		$cache = ($options['cache']=='1') ? TRUE : FALSE;
   247 					break;
   414 		$upload_dir = wp_upload_dir();
   248 				}
   415 		$static_server = ($cache) ? $upload_dir['baseurl'] . '/addtoany' : $http_or_https . '://static.addtoany.com/menu';
       
   416 		
       
   417 		// Enternal script call + initial JS + set-once variables
       
   418 		$additional_js = $options['additional_js_variables'];
       
   419 		$script_configs = (($cache) ? "\n" . 'a2a_config.static_server="' . $static_server . '";' : '' )
       
   420 			. (($options['onclick']=='1') ? "\n" . 'a2a_config.onclick=1;' : '')
       
   421 			. (($options['show_title']=='1') ? "\n" . 'a2a_config.show_title=1;' : '')
       
   422 			. (($additional_js) ? "\n" . stripslashes($additional_js)  : '');
       
   423 		$A2A_SHARE_SAVE_external_script_called = true;
       
   424 	}
       
   425 	else {
       
   426 		$script_configs = "";
       
   427 	}
       
   428 	
       
   429 	$javascript_header = "\n" . '<script type="text/javascript">' . "<!--\n"
       
   430 			. "var a2a_config=a2a_config||{},"
       
   431 			. "wpa2a={done:false,"
       
   432 			. "html_done:false,"
       
   433 			. "script_ready:false,"
       
   434 			. "script_load:function(){"
       
   435 				. "var a=document.createElement('script'),"
       
   436 					. "s=document.getElementsByTagName('script')[0];"
       
   437 				. "a.type='text/javascript';a.async=true;"
       
   438 				. "a.src='" . $static_server . "/page.js';"
       
   439 				. "s.parentNode.insertBefore(a,s);"
       
   440 				. "wpa2a.script_load=function(){};"
       
   441 			. "},"
       
   442 			. "script_onready:function(){"
       
   443 				. "if(a2a.type=='page'){" // Check a2a internal var to ensure script loaded is page.js not feed.js
       
   444 					. "wpa2a.script_ready=true;"
       
   445 					. "if(wpa2a.html_done)wpa2a.init();"
       
   446 				. "}"
       
   447 			. "},"
       
   448 			. "init:function(){"
       
   449 				. "for(var i=0,el,target,targets=wpa2a.targets,length=targets.length;i<length;i++){"
       
   450 					. "el=document.getElementById('wpa2a_'+(i+1));"
       
   451 					. "target=targets[i];"
       
   452 					. "a2a_config.linkname=target.title;"
       
   453 					. "a2a_config.linkurl=target.url;"
       
   454 					. "if(el)a2a.init('page',{target:el});wpa2a.done=true;"
       
   455 				. "}"
       
   456 			. "}"
       
   457 		. "};"
       
   458 		. "a2a_config.tracking_callback=['ready',wpa2a.script_onready];"
       
   459 		. A2A_menu_locale()
       
   460 		. $script_configs
       
   461 		. "\n//--></script>\n";
       
   462 	
       
   463 	 echo $javascript_header;
       
   464 }
       
   465 
       
   466 add_action('wp_head', 'A2A_SHARE_SAVE_head_script');
       
   467 
       
   468 function A2A_SHARE_SAVE_footer_script() {
       
   469 	global $_addtoany_targets;
       
   470 	
       
   471 	if (is_admin())
       
   472 		return;
       
   473 		
       
   474 	$_addtoany_targets = (isset($_addtoany_targets)) ? $_addtoany_targets : array();
       
   475 	
       
   476 	$javascript_footer = "\n" . '<script type="text/javascript">' . "<!--\n"
       
   477 		. "wpa2a.targets=["
       
   478 			. implode(",", $_addtoany_targets)
       
   479 		. "];\n"
       
   480 		. "wpa2a.html_done=true;"
       
   481 		. "if(wpa2a.script_ready&&!wpa2a.done)wpa2a.init();" // External script may load before html_done=true, but will only init if html_done=true.  So call wpa2a.init() if external script is ready, and if wpa2a.init() hasn't been called already.  Otherwise, wait for callback to call wpa2a.init()
       
   482 		. "wpa2a.script_load();" // Load external script if not already called with the first AddToAny button.  Fixes issues where first button code is processed internally but without actual code output
       
   483 		. "\n//--></script>\n";
       
   484 	echo $javascript_footer;
       
   485 }
       
   486 
       
   487 add_action('wp_footer', 'A2A_SHARE_SAVE_footer_script');
       
   488 
       
   489 
       
   490 
       
   491 function A2A_SHARE_SAVE_theme_hooks_check() {
       
   492 	$template_directory = get_template_directory();
       
   493 	
       
   494 	// If footer.php exists in the current theme, scan for "wp_footer"
       
   495 	$file = $template_directory . '/footer.php';
       
   496 	if (is_file($file)) {
       
   497 		$search_string = "wp_footer";
       
   498 		$file_lines = @file($file);
       
   499 		
       
   500 		foreach ($file_lines as $line) {
       
   501 			$searchCount = substr_count($line, $search_string);
       
   502 			if ($searchCount > 0) {
       
   503 				return true;
   249 			}
   504 			}
   250 			
   505 		}
   251 			// wp_footer() not found:
   506 		
   252 			echo "<div class=\"plugin-update\">" . __("Your theme needs to be fixed. To fix your theme, use the <a href=\"theme-editor.php\">Theme Editor</a> to insert <code>&lt;?php wp_footer(); ?&gt;</code> just before the <code>&lt;/body&gt;</code> line of your theme's <code>footer.php</code> file.") . "</div>";
   507 		// wp_footer() not found:
   253 		}
   508 		echo "<div class=\"update-nag\">" . __("Your theme needs to be fixed. To fix your theme, use the <a href=\"theme-editor.php\">Theme Editor</a> to insert <code>&lt;?php wp_footer(); ?&gt;</code> just before the <code>&lt;/body&gt;</code> line of your theme's <code>footer.php</code> file.") . "</div>";
   254 	}  
   509 	}
   255 }
   510 	
   256 
   511 	// If header.php exists in the current theme, scan for "wp_head"
   257 
   512 	$file = $template_directory . '/header.php';
   258 function A2A_SHARE_SAVE_to_bottom_of_content($content) {
   513 	if (is_file($file)) {
       
   514 		$search_string = "wp_head";
       
   515 		$file_lines = @file($file);
       
   516 		
       
   517 		foreach ($file_lines as $line) {
       
   518 			$searchCount = substr_count($line, $search_string);
       
   519 			if ($searchCount > 0) {
       
   520 				return true;
       
   521 			}
       
   522 		}
       
   523 		
       
   524 		// wp_footer() not found:
       
   525 		echo "<div class=\"update-nag\">" . __("Your theme needs to be fixed. To fix your theme, use the <a href=\"theme-editor.php\">Theme Editor</a> to insert <code>&lt;?php wp_head(); ?&gt;</code> just before the <code>&lt;/head&gt;</code> line of your theme's <code>header.php</code> file.") . "</div>";
       
   526 	}
       
   527 }
       
   528 
       
   529 function A2A_SHARE_SAVE_auto_placement($title) {
       
   530 	global $A2A_SHARE_SAVE_auto_placement_ready;
       
   531 	$A2A_SHARE_SAVE_auto_placement_ready = true;
       
   532 	
       
   533 	return $title;
       
   534 }
       
   535 
       
   536 
       
   537 /**
       
   538  * Remove the_content filter and add it for next time 
       
   539  */
       
   540 function A2A_SHARE_SAVE_remove_from_content($content) {
       
   541 	remove_filter('the_content', 'A2A_SHARE_SAVE_add_to_content', 98);
       
   542 	add_filter('the_content', 'A2A_SHARE_SAVE_add_to_content_next_time', 98);
       
   543 	
       
   544 	return $content;
       
   545 }
       
   546 
       
   547 /**
       
   548  * Apply the_content filter "next time"
       
   549  */
       
   550 function A2A_SHARE_SAVE_add_to_content_next_time($content) {
       
   551 	add_filter('the_content', 'A2A_SHARE_SAVE_add_to_content', 98);
       
   552 	
       
   553 	return $content;
       
   554 }
       
   555 
       
   556 
       
   557 function A2A_SHARE_SAVE_add_to_content($content) {
       
   558 	global $A2A_SHARE_SAVE_auto_placement_ready;
       
   559 	
   259 	$is_feed = is_feed();
   560 	$is_feed = is_feed();
       
   561 	$options = get_option('addtoany_options');
       
   562   
       
   563 	if( ! $A2A_SHARE_SAVE_auto_placement_ready)
       
   564 		return $content;
       
   565 		
       
   566 	if (get_post_status(get_the_ID()) == 'private')
       
   567 		return $content;
   260 	
   568 	
   261 	if ( 
   569 	if ( 
   262 		( 
   570 		( 
   263 			// Tags
   571 			// Tags
   264 			strpos($content, '<!--sharesave-->')===false || 											// <!--sharesave--> tag
   572 			// <!--sharesave--> tag
   265 			strpos($content, '<!--nosharesave-->')!==false												// <!--nosharesave--> tag
   573 			strpos($content, '<!--sharesave-->')===false || 
   266 		) &&											
   574 			// <!--nosharesave--> tag
       
   575 			strpos($content, '<!--nosharesave-->')!==false
       
   576 		) &&
   267 		(
   577 		(
   268 			// Posts
   578 			// Posts
   269 			( ! is_page() && get_option('A2A_SHARE_SAVE_display_in_posts')=='-1' ) || 					// All posts
   579 			// All posts
   270 			( is_home() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  		// Front page posts
   580 			( ! is_page() && $options['display_in_posts']=='-1' ) ||
   271 			( is_category() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  	// Category posts (same as Front page option)
   581 			// Front page posts		
   272 			( is_tag() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  		// Tag Cloud posts (same as Front page option)
   582 			( is_home() && $options['display_in_posts_on_front_page']=='-1' ) ||
   273 			( is_date() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  		// Date-based archives posts (same as Front page option)
   583 			// Archive page posts (Category, Tag, Author and Date pages)
   274 			( is_author() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  	// Author posts (same as Front page option)
   584 			( is_archive() && $options['display_in_posts_on_archive_pages']=='-1' ) ||
   275 			( is_search() && get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')=='-1' ) ||  	// Search results posts (same as Front page option)
   585 			// Search results posts (same as Archive page posts option)
   276 			( $is_feed && (get_option('A2A_SHARE_SAVE_display_in_feed')=='-1' ) || 					// Posts in feed
   586 			( is_search() && $options['display_in_posts_on_archive_pages']=='-1' ) || 
       
   587 			// Posts in feed
       
   588 			( $is_feed && ($options['display_in_feed']=='-1' ) ||
   277 			
   589 			
   278 			// Pages
   590 			// Pages
   279 			( is_page() && get_option('A2A_SHARE_SAVE_display_in_pages')=='-1' ) ||						// Individual pages
   591 			// Individual pages
   280 			( (strpos($content, '<!--nosharesave-->')!==false) )										// <!--nosharesave-->
   592 			( is_page() && $options['display_in_pages']=='-1' ) ||
       
   593 			// <!--nosharesave-->						
       
   594 			( (strpos($content, '<!--nosharesave-->')!==false) )
   281 		)
   595 		)
   282 		)
   596 		)
   283 	)	
   597 	)	
   284 		return $content;
   598 		return $content;
   285 	
   599 	
   286 	$icons_args = array(
   600 	$kit_args = array(
   287 		"output_later" => true,
   601 		"output_later" => true,
   288 		"html_wrap_open" => ($is_feed) ? "" : "<li>",
   602 		"is_kit" => ($is_feed) ? FALSE : TRUE,
   289 		"html_wrap_close" => ($is_feed) ? " " : "</li>",
       
   290 	);
   603 	);
   291 	
   604 	
   292 	$A2A_SHARE_SAVE_options = array(
       
   293 		"output_later" => true,
       
   294 		"html_wrap_open" => ($is_feed) ? "" : "<li>",
       
   295 		"html_wrap_close" => ($is_feed) ? "" : "</li>",
       
   296 	);
       
   297 	
       
   298 	if ( ! $is_feed ) {
   605 	if ( ! $is_feed ) {
   299 		$container_wrap_open = '<div class="addtoany_share_save_container"><ul class="addtoany_list">';
   606 		$container_wrap_open = '<div class="addtoany_share_save_container">';
   300 		$container_wrap_close = '</ul></div>';
   607 		$container_wrap_close = '</div>';
   301 	}
   608 	} else { // Is feed
   302 	
   609 		$container_wrap_open = '<p>';
   303 	$content .= $container_wrap_open.ADDTOANY_SHARE_SAVE_ICONS( $icons_args ).ADDTOANY_SHARE_SAVE_BUTTON( $A2A_SHARE_SAVE_options ).$container_wrap_close;
   610 		$container_wrap_close = '</p>';
       
   611 		$kit_args['html_container_open'] = '';
       
   612 		$kit_args['html_container_close'] = '';
       
   613 		$kit_args['html_wrap_open'] = '';
       
   614 		$kit_args['html_wrap_close'] = '';
       
   615 	}
       
   616 	
       
   617 	$options['position'] = isset($options['position']) ? $options['position'] : 'bottom';
       
   618 	
       
   619 	if ($options['position'] == 'both' || $options['position'] == 'top') {
       
   620 		// Prepend to content
       
   621 		$content = $container_wrap_open.ADDTOANY_SHARE_SAVE_KIT($kit_args) . $container_wrap_close . $content;
       
   622 	}
       
   623 	if ( $options['position'] == 'bottom' || $options['position'] == 'both') {
       
   624 		// Append to content
       
   625 		$content .= $container_wrap_open.ADDTOANY_SHARE_SAVE_KIT($kit_args) . $container_wrap_close;
       
   626 	}
       
   627 	
   304 	return $content;
   628 	return $content;
   305 }
   629 }
   306 
   630 
   307 add_action('the_content', 'A2A_SHARE_SAVE_to_bottom_of_content', 98);
   631 // Only automatically output button code after the_title has been called - to avoid premature calling from misc. the_content filters (especially meta description)
   308 
   632 add_filter('the_title', 'A2A_SHARE_SAVE_auto_placement', 9);
   309 
   633 add_filter('the_content', 'A2A_SHARE_SAVE_add_to_content', 98);
   310 function A2A_SHARE_SAVE_button_css() {
   634 
   311 	?><style type="text/css">
   635 
   312 	.addtoany_share_save_container{margin:16px 0;}
   636 // [addtoany url="http://example.com/page.html" title="Some Example Page"]
   313 	ul.addtoany_list{
   637 function A2A_SHARE_SAVE_shortcode( $attributes ) {
   314 		display:inline;
   638 	extract( shortcode_atts( array(
   315 		list-style-type:none;
   639 		'url' => 'something',
   316 		margin:0 !important;
   640 		'title' => 'something else',
   317 		padding:0 !important;
   641 	), $attributes ) );
   318 		text-indent:0 !important;
   642 	
   319 	}
   643 	$linkname = (isset($attributes['title'])) ? $attributes['title'] : FALSE;
   320 	ul.addtoany_list li{
   644 	$linkurl = (isset($attributes['url'])) ? $attributes['url'] : FALSE;
   321 		background:none !important;
   645 	$output_later = TRUE;
   322 		border:0;
   646 
   323 		display:inline !important;
   647 	return ADDTOANY_SHARE_SAVE_KIT( compact('linkname', 'linkurl', 'output_later') );
   324 		line-height:32px;<?php /* For vertical space in the event of wrapping*/ ?>
   648 }
   325 		list-style-type:none;
   649 
   326 		margin:0 !important;
   650 add_shortcode( 'addtoany', 'A2A_SHARE_SAVE_shortcode' );
   327 		padding:0 !important;
   651 
   328 	}
   652 
   329 	ul.addtoany_list li:before{content:"";}
   653 
   330 	ul.addtoany_list li a{padding:0 9px;}
   654 function A2A_SHARE_SAVE_button_css_IE() {
   331 	ul.addtoany_list img{
   655 /* IE support for opacity: */ ?>
   332 		float:none;
   656 <!--[if IE]>
   333 		border:0;
   657 <style type="text/css">
   334 		margin:0;
   658 .addtoany_list a img{filter:alpha(opacity=70)}
   335 		padding:0;
   659 .addtoany_list a:hover img,.addtoany_list a.addtoany_share_save img{filter:alpha(opacity=100)}
   336 		vertical-align:middle;
   660 </style>
   337 	}
   661 <![endif]-->
   338 	ul.addtoany_list a img{
       
   339 		opacity:.6;
       
   340 		-moz-opacity:.6;
       
   341 		filter:alpha(opacity=60);
       
   342 	}
       
   343 	ul.addtoany_list a:hover img, ul.addtoany_list a.addtoany_share_save img{
       
   344 		opacity:1;
       
   345 		-moz-opacity:1;
       
   346 		filter:alpha(opacity=100);
       
   347 	}
       
   348 	a.addtoany_share_save img{border:0;width:auto;height:auto;}<?php /* Must declare after "ul.addtoany_list img" */ ?>
       
   349     </style>
       
   350 <?php
   662 <?php
   351 }
   663 }
   352 
   664 
   353 add_action('wp_head', 'A2A_SHARE_SAVE_button_css');
   665 function A2A_SHARE_SAVE_stylesheet() {
   354 
   666 	global $A2A_SHARE_SAVE_options, $A2A_SHARE_SAVE_plugin_url_path;
       
   667 	
       
   668 	// Use stylesheet?
       
   669 	if ($A2A_SHARE_SAVE_options['inline_css'] != '-1' && ! is_admin()) {
       
   670 		wp_enqueue_style('A2A_SHARE_SAVE', $A2A_SHARE_SAVE_plugin_url_path . '/addtoany.min.css', false, '1.4');
       
   671 		
       
   672 		// Conditional inline CSS stylesheet for IE
       
   673 		add_filter('wp_head', 'A2A_SHARE_SAVE_button_css_IE');
       
   674 	}
       
   675 }
       
   676 
       
   677 add_action('wp_print_styles', 'A2A_SHARE_SAVE_stylesheet');
       
   678 
       
   679 
       
   680 
       
   681 /*****************************
       
   682 		CACHE ADDTOANY
       
   683 ******************************/
       
   684 
       
   685 function A2A_SHARE_SAVE_refresh_cache() {
       
   686 	$contents = wp_remote_fopen("http://www.addtoany.com/ext/updater/files_list/");
       
   687 	$file_urls = explode("\n", $contents, 20);
       
   688 	$upload_dir = wp_upload_dir();
       
   689 	
       
   690 	// Make directory if needed
       
   691 	if ( ! wp_mkdir_p( dirname( $upload_dir['basedir'] . '/addtoany/foo' ) ) ) {
       
   692 		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) );
       
   693 		return array( 'error' => $message );
       
   694 	}
       
   695 	
       
   696 	if (count($file_urls) > 0) {
       
   697 		for ($i = 0; $i < count($file_urls); $i++) {
       
   698 			// Download files
       
   699 			$file_url = $file_urls[$i];
       
   700 			$file_name = substr(strrchr($file_url, '/'), 1, 99);
       
   701 			
       
   702 			// Place files in uploads/addtoany directory
       
   703 			wp_get_http($file_url, $upload_dir['basedir'] . '/addtoany/' . $file_name);
       
   704 		}
       
   705 	}
       
   706 }
       
   707 
       
   708 function A2A_SHARE_SAVE_schedule_cache() {
       
   709 	// WP "Cron" requires WP version 2.1
       
   710 	$timestamp = wp_next_scheduled('A2A_SHARE_SAVE_refresh_cache');
       
   711 	if ( ! $timestamp) {
       
   712 		// Only schedule if currently unscheduled
       
   713 		wp_schedule_event(time(), 'daily', 'A2A_SHARE_SAVE_refresh_cache');
       
   714 	}
       
   715 }
       
   716 
       
   717 function A2A_SHARE_SAVE_unschedule_cache() {
       
   718 	$timestamp = wp_next_scheduled('A2A_SHARE_SAVE_refresh_cache');
       
   719 	wp_unschedule_event($timestamp, 'A2A_SHARE_SAVE_refresh_cache');
       
   720 }
   355 
   721 
   356 
   722 
   357 
   723 
   358 /*****************************
   724 /*****************************
   359 		OPTIONS
   725 		OPTIONS
   360 ******************************/
   726 ******************************/
   361 
   727 
   362 
   728 
       
   729 function A2A_SHARE_SAVE_migrate_options() {
       
   730 	
       
   731 	$options = array(
       
   732 		'inline_css' => '1', // Modernly used for "Use CSS Stylesheet?"
       
   733 		'cache' => '-1',
       
   734 		'display_in_posts_on_front_page' => '1',
       
   735 		'display_in_posts_on_archive_pages' => '1',
       
   736 		'display_in_posts' => '1',
       
   737 		'display_in_pages' => '1',
       
   738 		'display_in_feed' => '1',
       
   739 		'show_title' => '-1',
       
   740 		'onclick' => '-1',
       
   741 		'button' => 'share_save_171_16.png|171|16',
       
   742 		'button_custom' => '',
       
   743 		'additional_js_variables' => '',
       
   744 		'button_text' => 'Share/Bookmark',
       
   745 		'display_in_excerpts' => '1',
       
   746 		'active_services' => Array(),
       
   747 	);
       
   748 	
       
   749 	$namespace = 'A2A_SHARE_SAVE_';
       
   750   
       
   751 	foreach ($options as $option_name => $option_value) {
       
   752 		$old_option_name = $namespace . $option_name;  
       
   753 		$old_option_value = get_option($old_option_name);
       
   754 		
       
   755 		if($old_option_value === FALSE) {
       
   756 			// Default value
       
   757 		    $options[$option_name] = $option_value;
       
   758 		} else {
       
   759 			// Old value
       
   760 		    $options[$option_name] = $old_option_value;
       
   761 		}
       
   762 		
       
   763 		delete_option($old_option_name);
       
   764 	}
       
   765 	
       
   766 	update_option('addtoany_options', $options);
       
   767 	
       
   768 	$deprecated_options = array(
       
   769 		'button_opens_new_window',
       
   770 		'hide_embeds',
       
   771 	);
       
   772 	
       
   773 	foreach ($deprecated_options as $option_name) {
       
   774 		delete_option($namespace . $option_name);
       
   775 	}
       
   776 	
       
   777 }
       
   778 
   363 function A2A_SHARE_SAVE_options_page() {
   779 function A2A_SHARE_SAVE_options_page() {
   364 
   780 
   365 	global $A2A_SHARE_SAVE_plugin_url_path, $A2A_SHARE_SAVE_services;
   781 	global $A2A_SHARE_SAVE_plugin_url_path,
   366 	
   782 		$A2A_SHARE_SAVE_services;
       
   783 	
       
   784 	// Require admin privs
       
   785 	if ( ! current_user_can('manage_options') )
       
   786 		return false;
       
   787 	
       
   788   $new_options = array();
       
   789   
       
   790   $namespace = 'A2A_SHARE_SAVE_';
       
   791   
   367 	// Make available services extensible via plugins, themes (functions.php), etc.
   792 	// Make available services extensible via plugins, themes (functions.php), etc.
   368 	$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
   793 	$A2A_SHARE_SAVE_services = apply_filters('A2A_SHARE_SAVE_services', $A2A_SHARE_SAVE_services);
   369 
   794 
   370     if( $_POST[ 'A2A_SHARE_SAVE_submit_hidden' ] == 'Y' ) {
   795     if (isset($_POST['Submit'])) {
   371 
   796 		
   372         update_option( 'A2A_SHARE_SAVE_display_in_posts_on_front_page', ($_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page']=='1') ? '1':'-1' );
   797 		// Nonce verification 
   373 		update_option( 'A2A_SHARE_SAVE_display_in_posts', ($_POST['A2A_SHARE_SAVE_display_in_posts']=='1') ? '1':'-1' );
   798 		check_admin_referer('add-to-any-update-options');
   374 		update_option( 'A2A_SHARE_SAVE_display_in_pages', ($_POST['A2A_SHARE_SAVE_display_in_pages']=='1') ? '1':'-1' );
   799 
   375 		update_option( 'A2A_SHARE_SAVE_display_in_feed', ($_POST['A2A_SHARE_SAVE_display_in_feed']=='1') ? '1':'-1' );
   800 		$new_options['position'] = ($_POST['A2A_SHARE_SAVE_position']) ? @$_POST['A2A_SHARE_SAVE_position'] : 'bottom';
   376 		update_option( 'A2A_SHARE_SAVE_hide_embeds', ($_POST['A2A_SHARE_SAVE_hide_embeds']=='1') ? '1':'-1' );
   801 		$new_options['display_in_posts_on_front_page'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_front_page']=='1') ? '1':'-1';
   377 		update_option( 'A2A_SHARE_SAVE_show_title', ($_POST['A2A_SHARE_SAVE_show_title']=='1') ? '1':'-1' );
   802 		$new_options['display_in_posts_on_archive_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts_on_archive_pages']=='1') ? '1':'-1';
   378 		update_option( 'A2A_SHARE_SAVE_onclick', ($_POST['A2A_SHARE_SAVE_onclick']=='1') ? '1':'-1' );
   803 		$new_options['display_in_excerpts'] = (@$_POST['A2A_SHARE_SAVE_display_in_excerpts']=='1') ? '1':'-1';
   379 		update_option( 'A2A_SHARE_SAVE_button_opens_new_window', ($_POST['A2A_SHARE_SAVE_button_opens_new_window']=='1') ? '1':'-1' );
   804 		$new_options['display_in_posts'] = (@$_POST['A2A_SHARE_SAVE_display_in_posts']=='1') ? '1':'-1';
   380 		update_option( 'A2A_SHARE_SAVE_button', $_POST['A2A_SHARE_SAVE_button'] );
   805 		$new_options['display_in_pages'] = (@$_POST['A2A_SHARE_SAVE_display_in_pages']=='1') ? '1':'-1';
   381 		update_option( 'A2A_SHARE_SAVE_button_custom', $_POST['A2A_SHARE_SAVE_button_custom'] );
   806 		$new_options['display_in_feed'] = (@$_POST['A2A_SHARE_SAVE_display_in_feed']=='1') ? '1':'-1';
   382 		update_option( 'A2A_SHARE_SAVE_additional_js_variables', trim($_POST['A2A_SHARE_SAVE_additional_js_variables']) );
   807 		$new_options['show_title'] = (@$_POST['A2A_SHARE_SAVE_show_title']=='1') ? '1':'-1';
       
   808 		$new_options['onclick'] = (@$_POST['A2A_SHARE_SAVE_onclick']=='1') ? '1':'-1';
       
   809 		$new_options['button'] = @$_POST['A2A_SHARE_SAVE_button'];
       
   810 		$new_options['button_custom'] = @$_POST['A2A_SHARE_SAVE_button_custom'];
       
   811 		$new_options['additional_js_variables'] = trim(@$_POST['A2A_SHARE_SAVE_additional_js_variables']);
       
   812 		$new_options['inline_css'] = (@$_POST['A2A_SHARE_SAVE_inline_css']=='1') ? '1':'-1';
       
   813 		$new_options['cache'] = (@$_POST['A2A_SHARE_SAVE_cache']=='1') ? '1':'-1';
       
   814 		
       
   815 		// Schedule cache refresh?
       
   816 		if (@$_POST['A2A_SHARE_SAVE_cache']=='1') {
       
   817 			A2A_SHARE_SAVE_schedule_cache();
       
   818 			A2A_SHARE_SAVE_refresh_cache();
       
   819 		} else {
       
   820 			A2A_SHARE_SAVE_unschedule_cache();
       
   821 		}
   383 		
   822 		
   384 		// Store desired text if 16 x 16px buttons or text-only is chosen:
   823 		// Store desired text if 16 x 16px buttons or text-only is chosen:
   385 		if( get_option('A2A_SHARE_SAVE_button') == 'favicon.png|16|16' )
   824 		if( $new_options['button'] == 'favicon.png|16|16' )
   386 			update_option( 'A2A_SHARE_SAVE_button_text', $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text'] );
   825 			$new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_favicon_16_16_text'];
   387 		elseif( get_option('A2A_SHARE_SAVE_button') == 'share_16_16.png|16|16' )
   826 		elseif( $new_options['button'] == 'share_16_16.png|16|16' )
   388 			update_option( 'A2A_SHARE_SAVE_button_text', $_POST['A2A_SHARE_SAVE_button_share_16_16_text'] );
   827 			$new_options['button_text'] = $_POST['A2A_SHARE_SAVE_button_share_16_16_text'];
   389 		else
   828 		else
   390 			update_option( 'A2A_SHARE_SAVE_button_text', ( trim($_POST['A2A_SHARE_SAVE_button_text']) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share/Bookmark','add-to-any') );
   829 			$new_options['button_text'] = ( trim($_POST['A2A_SHARE_SAVE_button_text']) != '' ) ? $_POST['A2A_SHARE_SAVE_button_text'] : __('Share/Bookmark','add-to-any');
   391 			
   830 			
   392 		// Store chosen individual services to make active
   831 		// Store chosen individual services to make active
   393 		$active_services = Array();
   832 		$active_services = Array();
   394 		if( !$_POST['A2A_SHARE_SAVE_active_services'] )
   833 		if ( ! isset($_POST['A2A_SHARE_SAVE_active_services']))
   395 			$_POST['A2A_SHARE_SAVE_active_services'] = Array();
   834 			$_POST['A2A_SHARE_SAVE_active_services'] = Array();
   396 		foreach( $_POST['A2A_SHARE_SAVE_active_services'] as $dummy=>$sitename )
   835 		foreach ( $_POST['A2A_SHARE_SAVE_active_services'] as $dummy=>$sitename )
   397 			$active_services[] = substr($sitename, 7);
   836 			$active_services[] = substr($sitename, 7);
   398 		update_option('A2A_SHARE_SAVE_active_services', $active_services);
   837 		$new_options['active_services'] = $active_services;
   399 		// Delete then re-add to ensure sorting works (re-sorting doesn't effect associated array equality in PHP so update doesn't hit the dB for identical arrays
   838 		
   400 		delete_option('A2A_SHARE_SAVE_active_services', $active_services);
   839 		// Store special service options
   401 		add_option('A2A_SHARE_SAVE_active_services', $active_services);
   840 		$new_options['special_facebook_like_options'] = array(
   402 		
   841 			'verb' => ((@$_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like')
       
   842 		);
       
   843 		$new_options['special_twitter_tweet_options'] = array(
       
   844 			'show_count' => ((@$_POST['addtoany_twitter_tweet_show_count'] == '1') ? '1' : '-1')
       
   845 		);
       
   846 		$new_options['special_google_plusone_options'] = array(
       
   847 			'show_count' => ((@$_POST['addtoany_google_plusone_show_count'] == '1') ? '1' : '-1')
       
   848 		);
       
   849 		$new_options['special_google_plus_share_options'] = array(
       
   850 			'show_count' => ((@$_POST['addtoany_google_plus_share_show_count'] == '1') ? '1' : '-1')
       
   851 		);
       
   852 		
       
   853     	update_option('addtoany_options', $new_options);
       
   854     
   403 		?>
   855 		?>
   404     	<div class="updated fade"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
   856     	<div class="updated fade"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
   405 		<?php
   857 		<?php
   406 		
   858 		
       
   859     } else if (isset($_POST['Reset'])) {
       
   860     	// Nonce verification 
       
   861 		  check_admin_referer('add-to-any-update-options');
       
   862 		  
       
   863 		  delete_option('addtoany_options');
   407     }
   864     }
   408 
   865 
       
   866     $options = get_option('addtoany_options');
       
   867 	
       
   868 	function position_in_content($options, $option_box = FALSE) {
       
   869 		
       
   870 		if ( ! isset($options['position'])) {
       
   871 			$options['position'] = 'bottom';
       
   872 		}
       
   873 		
       
   874 		$positions = array(
       
   875 			'bottom' => array(
       
   876 				'selected' => ('bottom' == $options['position']) ? ' selected="selected"' : '',
       
   877 				'string' => __('bottom', 'add-to-any')
       
   878 			),
       
   879 			'top' => array(
       
   880 				'selected' => ('top' == $options['position']) ? ' selected="selected"' : '',
       
   881 				'string' => __('top', 'add-to-any')
       
   882 			),
       
   883 			'both' => array(
       
   884 				'selected' => ('both' == $options['position']) ? ' selected="selected"' : '',
       
   885 				'string' => __('top &amp; bottom', 'add-to-any')
       
   886 			)
       
   887 		);
       
   888 		
       
   889 		if ($option_box) {
       
   890 			$html = '</label>';
       
   891 			$html .= '<label>'; // Label needed to prevent checkmark toggle on SELECT click 
       
   892 		    $html .= '<select name="A2A_SHARE_SAVE_position">';
       
   893 		    $html .= '<option value="bottom"' . $positions['bottom']['selected'] . '>' . $positions['bottom']['string'] . '</option>';
       
   894 		    $html .= '<option value="top"' . $positions['top']['selected'] . '>' . $positions['top']['string'] . '</option>';
       
   895 		    $html .= '<option value="both"' . $positions['both']['selected'] . '>' . $positions['both']['string'] . '</option>';
       
   896 			$html .= '</select>';
       
   897 		    
       
   898 		    return $html;
       
   899 		} else {
       
   900 			$html = '<span class="A2A_SHARE_SAVE_position">';
       
   901 			$html .= $positions[$options['position']]['string'];
       
   902 			$html .= '</span>';
       
   903 			
       
   904 			return $html;
       
   905 		}
       
   906 	}
       
   907 	
   409     ?>
   908     ?>
   410     
   909     
   411     <?php A2A_wp_footer_check(); ?>
   910     <?php A2A_SHARE_SAVE_theme_hooks_check(); ?>
   412     
   911     
   413     <div class="wrap">
   912     <div class="wrap">
   414 
   913 	
   415 	<h2><?php _e( 'Add to Any: Share/Save ', 'add-to-any' ) . _e( 'Settings' ); ?></h2>
   914 	<div id="icon-options-general" class="icon32"></div>
       
   915 	
       
   916 	<h2><?php _e( 'AddToAny: Share/Save ', 'add-to-any' ) . _e( 'Settings' ); ?></h2>
   416 
   917 
   417     <form method="post" action="">
   918     <form method="post" action="">
   418     
   919     
   419 	<?php wp_nonce_field('update-options'); ?>
   920 	<?php wp_nonce_field('add-to-any-update-options'); ?>
   420     
       
   421     	<input type="hidden" name="A2A_SHARE_SAVE_submit_hidden" value="Y">
       
   422     
   921     
   423         <table class="form-table">
   922         <table class="form-table">
   424         	<tr valign="top">
   923         	<tr valign="top">
   425             <th scope="row"><?php _e("Standalone Services", "add-to-any"); ?></th>
   924             <th scope="row"><?php _e("Standalone Services", "add-to-any"); ?></th>
   426 			<td><fieldset>
   925 			<td><fieldset>
   427             	<ul id="addtoany_services_sortable" class="addtoany_admin_list">
   926             	<ul id="addtoany_services_sortable" class="addtoany_admin_list">
   428                 	<li class="dummy"><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/transparent.gif" width="16" height="16" alt="" /></li>
   927                 	<li class="dummy"><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path; ?>/icons/transparent.gif" width="16" height="16" alt="" /></li>
   429                 </ul>
   928                 </ul>
   430                 <p id="addtoany_services_info"><?php _e("Choose the services you want below. &nbsp;Click a chosen service again to remove. &nbsp;Reorder services by dragging and dropping as they appear above.", "add-to-any"); ?></p>
   929                 <p id="addtoany_services_info"><?php _e("Choose the services you want below. &nbsp;Click a chosen service again to remove. &nbsp;Reorder services by dragging and dropping as they appear above.", "add-to-any"); ?></p>
   431             	<ul id="addtoany_services_selectable" class="addtoany_admin_list">
   930             	<ul id="addtoany_services_selectable" class="addtoany_admin_list">
       
   931             		<li id="a2a_wp_facebook_like" class="addtoany_special_service" title="Facebook Like button">
       
   932                         <span><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/facebook_like.png'; ?>" width="50" height="20" alt="Facebook Like" /></span>
       
   933                     </li>
       
   934 					<li id="a2a_wp_twitter_tweet" class="addtoany_special_service" title="Twitter Tweet button">
       
   935                         <span><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/twitter_tweet.png'; ?>" width="55" height="20" alt="Twitter Tweet" /></span>
       
   936                     </li>
       
   937                     <li id="a2a_wp_google_plusone" class="addtoany_special_service" title="Google +1 button">
       
   938                         <span><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/google_plusone.png'; ?>" width="32" height="20" alt="Google +1" /></span>
       
   939                     </li>
       
   940                     <li id="a2a_wp_google_plus_share" class="addtoany_special_service" title="Google+ Share button">
       
   941                         <span><img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/icons/google_plus_share.png'; ?>" width="57" height="20" alt="Google+ Share Button" /></span>
       
   942                     </li>
   432 				<?php
   943 				<?php
   433 					// Show all services
   944 					// Show all services
   434 					$active_services = get_option('A2A_SHARE_SAVE_active_services');
   945 					$active_services = $options['active_services'];
   435 					if( !$active_services )
   946 					if( !$active_services )
   436 						$active_services = Array();
   947 						$active_services = Array();
   437 					
   948 					
   438                     foreach ($A2A_SHARE_SAVE_services as $service_safe_name=>$site) { 
   949                     foreach ($A2A_SHARE_SAVE_services as $service_safe_name=>$site) { 
   439 						if (isset($site['href']))
   950 						if (isset($site['href']))
   441 						else
   952 						else
   442 							$custom_service = FALSE;
   953 							$custom_service = FALSE;
   443 						if ( ! isset($site['icon']))
   954 						if ( ! isset($site['icon']))
   444 							$site['icon'] = 'default';
   955 							$site['icon'] = 'default';
   445 					?>
   956 					?>
   446                         <li id="a2a_wp_<?php echo $service_safe_name; ?>"
   957                         <li id="a2a_wp_<?php echo $service_safe_name; ?>" title="<?php echo $site['name']; ?>">
   447                             title="<?php echo $site['name']; ?>">
   958                             <span><img src="<?php echo ($site['icon_url']) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url_path.'/icons/'.$site['icon'].'.png'; ?>" width="<?php echo (isset($site['icon_width'])) ? $site['icon_width'] : '16'; ?>" height="<?php echo (isset($site['icon_height'])) ? $site['icon_height'] : '16'; ?>" alt="" /><?php echo $site['name']; ?></span>
   448                             <span><img src="<?php echo ($custom_service) ? $site['icon_url'] : $A2A_SHARE_SAVE_plugin_url_path.'/icons/'.$site['icon'].'.png'; ?>" width="<?php echo (isset($site['icon_width'])) ? $site['icon_width'] : '16'; ?>" height="<?php echo (isset($site['icon_height'])) ? $site['icon_height'] : '16'; ?>" alt="" /><?php echo $site['name']; ?></span>
       
   449                         </li>
   959                         </li>
   450 				<?php
   960 				<?php
   451                     } ?>
   961                     } ?>
   452                 </ul>
   962                 </ul>
   453             </fieldset></td>
   963             </fieldset></td>
   454             </tr>
   964             </tr>
   455         	<tr valign="top">
   965         	<tr valign="top">
   456             <th scope="row"><?php _e("Button", "add-to-any"); ?></th>
   966             <th scope="row"><?php _e("Button", "add-to-any"); ?></th>
   457             <td><fieldset>
   967             <td><fieldset>
   458             	<label>
   968             	<label>
   459                 	<input name="A2A_SHARE_SAVE_button" value="favicon.png|16|16" type="radio"<?php if(get_option('A2A_SHARE_SAVE_button')=='favicon.png|16|16') echo ' checked="checked"'; ?>
   969                 	<input name="A2A_SHARE_SAVE_button" value="favicon.png|16|16" type="radio"<?php if($options['button']=='favicon.png|16|16') echo ' checked="checked"'; ?>
   460                     	 style="margin:9px 0;vertical-align:middle">
   970                     	 style="margin:9px 0;vertical-align:middle">
   461                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/favicon.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share/Bookmark','add-to-any'); ?>" title="+ <?php _e('Share/Bookmark','add-to-any'); ?>"
   971                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/favicon.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share/Bookmark','add-to-any'); ?>" title="+ <?php _e('Share/Bookmark','add-to-any'); ?>"
   462                     	onclick="this.parentNode.firstChild.checked=true"/>
   972                     	onclick="this.parentNode.firstChild.checked=true"/>
   463                 </label>
   973                 </label>
   464                 <input name="A2A_SHARE_SAVE_button_favicon_16_16_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-7].checked=true" style="vertical-align:middle;width:150px"
   974                 <input name="A2A_SHARE_SAVE_button_favicon_16_16_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-7].checked=true" style="vertical-align:middle;width:150px"
   465                 	value="<?php echo (get_option('A2A_SHARE_SAVE_button_text') !== FALSE) ? stripslashes(get_option('A2A_SHARE_SAVE_button_text')) : __('Share/Bookmark','add-to-any'); ?>" />
   975                 	value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share/Bookmark','add-to-any'); ?>" />
   466                 <label style="padding-left:9px">
   976                 <label style="padding-left:9px">
   467                 	<input name="A2A_SHARE_SAVE_button" value="share_16_16.png|16|16" type="radio"<?php if(get_option('A2A_SHARE_SAVE_button')=='share_16_16.png|16|16') echo ' checked="checked"'; ?>
   977                 	<input name="A2A_SHARE_SAVE_button" value="share_16_16.png|16|16" type="radio"<?php if($options['button']=='share_16_16.png|16|16') echo ' checked="checked"'; ?>
   468                     	 style="margin:9px 0;vertical-align:middle">
   978                     	 style="margin:9px 0;vertical-align:middle">
   469                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_16_16.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share/Bookmark','add-to-any'); ?>" title="+ <?php _e('Share/Bookmark','add-to-any'); ?>"
   979                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_16_16.png'; ?>" width="16" height="16" border="0" style="padding:9px;vertical-align:middle" alt="+ <?php _e('Share/Bookmark','add-to-any'); ?>" title="+ <?php _e('Share/Bookmark','add-to-any'); ?>"
   470                     	onclick="this.parentNode.firstChild.checked=true"/>
   980                     	onclick="this.parentNode.firstChild.checked=true"/>
   471                 </label>
   981                 </label>
   472                 <input name="A2A_SHARE_SAVE_button_share_16_16_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-6].checked=true" style="vertical-align:middle;width:150px"
   982                 <input name="A2A_SHARE_SAVE_button_share_16_16_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-6].checked=true" style="vertical-align:middle;width:150px"
   473                 	value="<?php echo (get_option('A2A_SHARE_SAVE_button_text') !== FALSE) ? stripslashes(get_option('A2A_SHARE_SAVE_button_text')) : __('Share/Bookmark','add-to-any'); ?>" /><br>
   983                 	value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share/Bookmark','add-to-any'); ?>" /><br>
   474                 <label>
   984                 <label>
   475                 	<input name="A2A_SHARE_SAVE_button" value="share_save_120_16.png|120|16" type="radio"<?php if(get_option('A2A_SHARE_SAVE_button' )=='share_save_120_16.png|120|16') echo ' checked="checked"'; ?>
   985                 	<input name="A2A_SHARE_SAVE_button" value="share_save_120_16.png|120|16" type="radio"<?php if($options['button']=='share_save_120_16.png|120|16') echo ' checked="checked"'; ?>
   476                     	style="margin:9px 0;vertical-align:middle">
   986                     	style="margin:9px 0;vertical-align:middle">
   477                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_120_16.png'; ?>" width="120" height="16" border="0" style="padding:9px;vertical-align:middle"
   987                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_120_16.png'; ?>" width="120" height="16" border="0" style="padding:9px;vertical-align:middle"
   478                     	onclick="this.parentNode.firstChild.checked=true"/>
   988                     	onclick="this.parentNode.firstChild.checked=true"/>
   479                 </label><br>
   989                 </label><br>
   480                 <label>
   990                 <label>
   481                 	<input name="A2A_SHARE_SAVE_button" value="share_save_171_16.png|171|16" type="radio"<?php if( !get_option('A2A_SHARE_SAVE_button') || get_option('A2A_SHARE_SAVE_button')=='share_save_171_16.png|171|16' ) echo ' checked="checked"'; ?>
   991                 	<input name="A2A_SHARE_SAVE_button" value="share_save_171_16.png|171|16" type="radio"<?php if( !$options['button'] || $options['button']=='share_save_171_16.png|171|16' ) echo ' checked="checked"'; ?>
   482                     	style="margin:9px 0;vertical-align:middle">
   992                     	style="margin:9px 0;vertical-align:middle">
   483                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_171_16.png'; ?>" width="171" height="16" border="0" style="padding:9px;vertical-align:middle"
   993                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_171_16.png'; ?>" width="171" height="16" border="0" style="padding:9px;vertical-align:middle"
   484                     	onclick="this.parentNode.firstChild.checked=true"/>
   994                     	onclick="this.parentNode.firstChild.checked=true"/>
   485                 </label><br>
   995                 </label><br>
   486                 <label>
   996                 <label>
   487                 	<input name="A2A_SHARE_SAVE_button" value="share_save_256_24.png|256|24" type="radio"<?php if(get_option('A2A_SHARE_SAVE_button')=='share_save_256_24.png|256|24') echo ' checked="checked"'; ?>
   997                 	<input name="A2A_SHARE_SAVE_button" value="share_save_256_24.png|256|24" type="radio"<?php if($options['button']=='share_save_256_24.png|256|24') echo ' checked="checked"'; ?>
   488                     	style="margin:9px 0;vertical-align:middle">
   998                     	style="margin:9px 0;vertical-align:middle">
   489                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_256_24.png'; ?>" width="256" height="24" border="0" style="padding:9px;vertical-align:middle"
   999                     <img src="<?php echo $A2A_SHARE_SAVE_plugin_url_path.'/share_save_256_24.png'; ?>" width="256" height="24" border="0" style="padding:9px;vertical-align:middle"
   490                     	onclick="this.parentNode.firstChild.checked=true"/>
  1000                     	onclick="this.parentNode.firstChild.checked=true"/>
   491 				</label><br>
  1001 				</label><br>
   492                 <label>
  1002                 <label>
   493                 	<input name="A2A_SHARE_SAVE_button" value="CUSTOM" type="radio"<?php if( get_option('A2A_SHARE_SAVE_button') == 'CUSTOM' ) echo ' checked="checked"'; ?>
  1003                 	<input name="A2A_SHARE_SAVE_button" value="CUSTOM" type="radio"<?php if( $options['button'] == 'CUSTOM' ) echo ' checked="checked"'; ?>
   494                     	style="margin:9px 0;vertical-align:middle">
  1004                     	style="margin:9px 0;vertical-align:middle">
   495 					<span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
  1005 					<span style="margin:0 9px;vertical-align:middle"><?php _e("Image URL"); ?>:</span>
   496 				</label>
  1006 				</label>
   497   				<input name="A2A_SHARE_SAVE_button_custom" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-2].checked=true" style="vertical-align:middle"
  1007   				<input name="A2A_SHARE_SAVE_button_custom" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-2].checked=true" style="vertical-align:middle"
   498                 	value="<?php echo get_option('A2A_SHARE_SAVE_button_custom'); ?>" /><br>
  1008                 	value="<?php echo $options['button_custom']; ?>" /><br>
   499 				<label>
  1009 				<label>
   500                 	<input name="A2A_SHARE_SAVE_button" value="TEXT" type="radio"<?php if( get_option('A2A_SHARE_SAVE_button') == 'TEXT' ) echo ' checked="checked"'; ?>
  1010                 	<input name="A2A_SHARE_SAVE_button" value="TEXT" type="radio"<?php if( $options['button'] == 'TEXT' ) echo ' checked="checked"'; ?>
   501                     	style="margin:9px 0;vertical-align:middle">
  1011                     	style="margin:9px 0;vertical-align:middle">
   502 					<span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
  1012 					<span style="margin:0 9px;vertical-align:middle"><?php _e("Text only"); ?>:</span>
   503 				</label>
  1013 				</label>
   504                 <input name="A2A_SHARE_SAVE_button_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-1].checked=true" style="vertical-align:middle;width:150px"
  1014                 <input name="A2A_SHARE_SAVE_button_text" type="text" class="code" size="50" onclick="e=document.getElementsByName('A2A_SHARE_SAVE_button');e[e.length-1].checked=true" style="vertical-align:middle;width:150px"
   505                 	value="<?php echo ( trim(get_option('A2A_SHARE_SAVE_button_text')) != '' ) ? stripslashes(get_option('A2A_SHARE_SAVE_button_text')) : __('Share/Bookmark','add-to-any'); ?>" />
  1015                 	value="<?php echo ( trim($options['button_text']) != '' ) ? stripslashes($options['button_text']) : __('Share/Bookmark','add-to-any'); ?>" />
   506                 
  1016                 
   507             </fieldset></td>
  1017             </fieldset></td>
   508             </tr>
  1018             </tr>
   509             <tr valign="top">
  1019             <tr valign="top">
   510             <th scope="row"><?php _e('Placement', 'add-to-any'); ?></th>
  1020             <th scope="row"><?php _e('Placement', 'add-to-any'); ?></th>
   511             <td><fieldset>
  1021             <td><fieldset>
   512                 <label>
  1022                 <label>
   513                 	<input name="A2A_SHARE_SAVE_display_in_posts" 
  1023                 	<input id="A2A_SHARE_SAVE_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts" type="checkbox"<?php 
   514                     	onclick="e=getElementsByName('A2A_SHARE_SAVE_display_in_posts_on_front_page')[0];f=getElementsByName('A2A_SHARE_SAVE_display_in_feed')[0];
  1024 						if($options['display_in_posts']!='-1') echo ' checked="checked"'; ?> value="1"/>
   515                         	if(!this.checked){e.checked=false;e.disabled=true; f.checked=false;f.disabled=true}else{e.checked=true;e.disabled=false; f.checked=true;f.disabled=false}"
  1025                 	<?php printf(__('Display at the %s of posts', 'add-to-any'), position_in_content($options, TRUE)); ?> <strong>*</strong>
   516                         onchange="e=getElementsByName('A2A_SHARE_SAVE_display_in_posts_on_front_page')[0];f=getElementsByName('A2A_SHARE_SAVE_display_in_feed')[0];
       
   517                         	if(!this.checked){e.checked=false;e.disabled=true; f.checked=false;f.disabled=true}else{e.checked=true;e.disabled=false; f.checked=true;f.disabled=false}"
       
   518                         type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_display_in_posts')!='-1') echo ' checked="checked"'; ?> value="1"/>
       
   519                 	<?php _e('Display Share/Save button at the bottom of posts', 'add-to-any'); ?> <strong>*</strong>
       
   520                 </label><br/>
  1026                 </label><br/>
   521                 <label>
  1027                 <label>
   522                 	&nbsp; &nbsp; &nbsp; <input name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?php 
  1028                 	&nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_excerpts" type="checkbox"<?php 
   523 						if(get_option('A2A_SHARE_SAVE_display_in_posts_on_front_page')!='-1') echo ' checked="checked"';
  1029 						if($options['display_in_excerpts']!='-1') echo ' checked="checked"';
   524 						if(get_option('A2A_SHARE_SAVE_display_in_posts')=='-1') echo ' disabled="disabled"';
  1030 						if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
   525 						?> value="1"/>
  1031 						?> value="1"/>
   526                     <?php _e('Display Share/Save button at the bottom of posts on the front page', 'add-to-any'); ?>
  1032 					<?php printf(__('Display at the %s of post excerpts', 'add-to-any'), position_in_content($options)); ?>
       
  1033 				</label><br/>
       
  1034 				<label>
       
  1035                 	&nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_front_page" type="checkbox"<?php 
       
  1036 						if($options['display_in_posts_on_front_page']!='-1') echo ' checked="checked"';
       
  1037 						if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
       
  1038 						?> value="1"/>
       
  1039                     <?php printf(__('Display at the %s of posts on the front page', 'add-to-any'), position_in_content($options)); ?>
       
  1040 				</label><br/>
       
  1041 				<label>
       
  1042                 	&nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_posts_on_archive_pages" type="checkbox"<?php 
       
  1043 						if($options['display_in_posts_on_archive_pages']!='-1') echo ' checked="checked"';
       
  1044 						if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
       
  1045 						?> value="1"/>
       
  1046                     <?php printf(__('Display at the %s of posts on archive pages', 'add-to-any'), position_in_content($options)); ?>
       
  1047 				</label><br/>
       
  1048 				<label>
       
  1049                 	&nbsp; &nbsp; &nbsp; <input class="A2A_SHARE_SAVE_child_of_display_in_posts" name="A2A_SHARE_SAVE_display_in_feed" type="checkbox"<?php 
       
  1050 						if($options['display_in_feed']!='-1') echo ' checked="checked"'; 
       
  1051 						if($options['display_in_posts']=='-1') echo ' disabled="disabled"';
       
  1052 						?> value="1"/>
       
  1053 					<?php printf(__('Display at the %s of posts in the feed', 'add-to-any'), position_in_content($options)); ?>
   527 				</label><br/>
  1054 				</label><br/>
   528                 <label>
  1055                 <label>
   529                 	&nbsp; &nbsp; &nbsp; <input name="A2A_SHARE_SAVE_display_in_feed" type="checkbox"<?php 
  1056                 	<input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if($options['display_in_pages']!='-1') echo ' checked="checked"'; ?> value="1"/>
   530 						if(get_option('A2A_SHARE_SAVE_display_in_feed')!='-1') echo ' checked="checked"'; 
  1057                     <?php printf(__('Display at the %s of pages', 'add-to-any'), position_in_content($options, TRUE)); ?>
   531 						if(get_option('A2A_SHARE_SAVE_display_in_posts')=='-1') echo ' disabled="disabled"';
       
   532 						?> value="1"/>
       
   533                     <?php _e('Display Share/Save button at the bottom of posts in the feed', 'add-to-any'); ?>
       
   534 				</label><br/>
       
   535                 <label>
       
   536                 	<input name="A2A_SHARE_SAVE_display_in_pages" type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_display_in_pages')!='-1') echo ' checked="checked"'; ?> value="1"/>
       
   537                     <?php _e('Display Share/Save button at the bottom of pages', 'add-to-any'); ?>
       
   538 				</label>
  1058 				</label>
   539                 <br/><br/>
  1059                 <br/><br/>
   540                 <div class="setting-description">
  1060                 <div class="setting-description">
   541                 	<strong>*</strong> <?php _e("If unchecked, be sure to place the following code in <a href=\"theme-editor.php\">your template pages</a> (within <code>index.php</code>, <code>single.php</code>, and/or <code>page.php</code>)", "add-to-any"); ?>: <span id="addtoany_show_template_button_code" class="button-secondary">&#187;</span>
  1061                 	<strong>*</strong> <?php _e("If unchecked, be sure to place the following code in <a href=\"theme-editor.php\">your template pages</a> (within <code>index.php</code>, <code>single.php</code>, and/or <code>page.php</code>)", "add-to-any"); ?>: <span id="addtoany_show_template_button_code" class="button-secondary">&#187;</span>
   542                     <div id="addtoany_template_button_code">
  1062                     <div id="addtoany_template_button_code">
   543                       <code>&lt;?php echo '&lt;ul class=&quot;addtoany_list&quot;&gt;';  if( function_exists('ADDTOANY_SHARE_SAVE_ICONS') )      ADDTOANY_SHARE_SAVE_ICONS( array(&quot;html_wrap_open&quot; =&gt; &quot;&lt;li&gt;&quot;, &quot;html_wrap_close&quot; =&gt; &quot;&lt;/li&gt;&quot;) );  if( function_exists('ADDTOANY_SHARE_SAVE_BUTTON') )      ADDTOANY_SHARE_SAVE_BUTTON( array(&quot;html_wrap_open&quot; =&gt; &quot;&lt;li&gt;&quot;, &quot;html_wrap_close&quot; =&gt; &quot;&lt;/li&gt;&quot;) );  echo '&lt;/ul&gt;'; ?&gt;</code>
  1063                       <code>&lt;?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?&gt;</code>
   544                     </div>
  1064                     </div>
   545                     <noscript<code>&lt;?php echo '&lt;ul class=&quot;addtoany_list&quot;&gt;';  if( function_exists('ADDTOANY_SHARE_SAVE_ICONS') )      ADDTOANY_SHARE_SAVE_ICONS( array(&quot;html_wrap_open&quot; =&gt; &quot;&lt;li&gt;&quot;, &quot;html_wrap_close&quot; =&gt; &quot;&lt;/li&gt;&quot;) );  if( function_exists('ADDTOANY_SHARE_SAVE_BUTTON') )      ADDTOANY_SHARE_SAVE_BUTTON( array(&quot;html_wrap_open&quot; =&gt; &quot;&lt;li&gt;&quot;, &quot;html_wrap_close&quot; =&gt; &quot;&lt;/li&gt;&quot;) );  echo '&lt;/ul&gt;'; ?&gt;</code></noscript>
  1065                     <noscript><code>&lt;?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?&gt;</code></noscript>
   546                 </div>
  1066                 </div>
   547             </fieldset></td>
  1067             </fieldset></td>
   548             </tr>
  1068             </tr>
   549             <tr valign="top">
  1069             <tr valign="top">
   550             <th scope="row"><?php _e('Menu Style', 'add-to-any'); ?></th>
  1070             <th scope="row"><?php _e('Menu Style', 'add-to-any'); ?></th>
   551             <td><fieldset>
  1071             <td><fieldset>
   552 					<p><?php _e("Using Add to Any's Menu Styler, you can customize the colors of your Share/Save menu! When you're done, be sure to paste the generated code in the <a href=\"#\" onclick=\"document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();return false\">Additional Options</a> box below.", "add-to-any"); ?></p>
  1072 					<p><?php _e("Using AddToAny's Menu Styler, you can customize the colors of your Share/Save menu! When you're done, be sure to paste the generated code in the <a href=\"#\" onclick=\"document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();return false\">Additional Options</a> box below.", "add-to-any"); ?></p>
   553                     <p>
  1073                     <p>
   554                 		<a href="http://www.addtoany.com/buttons/share_save/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the Add to Any Menu Styler in a new window", "add-to-any"); ?>" target="_blank"
  1074                 		<a href="http://www.addtoany.com/buttons/share_save/menu_style/wordpress" class="button-secondary" title="<?php _e("Open the AddToAny Menu Styler in a new window", "add-to-any"); ?>" target="_blank"
   555                         	onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();
  1075                         	onclick="document.getElementById('A2A_SHARE_SAVE_additional_js_variables').focus();
   556                             	document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", "add-to-any"); ?></a>
  1076                             	document.getElementById('A2A_SHARE_SAVE_menu_styler_note').style.display='';"><?php _e("Open Menu Styler", "add-to-any"); ?></a>
   557 					</p>
  1077 					</p>
   558             </fieldset></td>
  1078             </fieldset></td>
   559             </tr>
  1079             </tr>
   560             <tr valign="top">
  1080             <tr valign="top">
   561             <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
  1081             <th scope="row"><?php _e('Menu Options', 'add-to-any'); ?></th>
   562             <td><fieldset>
  1082             <td><fieldset>
   563             	<label>
       
   564                 	<input name="A2A_SHARE_SAVE_hide_embeds" 
       
   565                         type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_hide_embeds')!='-1') echo ' checked="checked"'; ?> value="1"/>
       
   566                 	<?php _e('Hide embedded objects (Flash, video, etc.) that intersect with the menu when displayed', 'add-to-any'); ?>
       
   567                 </label><br />
       
   568                 <label>
  1083                 <label>
   569                 	<input name="A2A_SHARE_SAVE_show_title" 
       
   570                         type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_show_title')=='1') echo ' checked="checked"'; ?> value="1"/>
       
   571                 	<?php _e('Show the title of the post (or page) within the menu', 'add-to-any'); ?>
       
   572                 </label><br />
       
   573 				<label>
       
   574                 	<input name="A2A_SHARE_SAVE_onclick" 
  1084                 	<input name="A2A_SHARE_SAVE_onclick" 
   575                         type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_onclick')=='1') echo ' checked="checked"'; ?> value="1"
  1085                         type="checkbox"<?php if($options['onclick']=='1') echo ' checked="checked"'; ?> value="1"/>
   576                         onclick="e=getElementsByName('A2A_SHARE_SAVE_button_opens_new_window')[0];if(this.checked){e.checked=false;e.disabled=true}else{e.disabled=false}"
       
   577 						onchange="e=getElementsByName('A2A_SHARE_SAVE_button_opens_new_window')[0];if(this.checked){e.checked=false;e.disabled=true}else{e.disabled=false}"/>
       
   578                 	<?php _e('Only show the menu when the user clicks the Share/Save button', 'add-to-any'); ?>
  1086                 	<?php _e('Only show the menu when the user clicks the Share/Save button', 'add-to-any'); ?>
   579                 </label><br />
  1087                 </label><br />
   580 				<label>
  1088 				<label>
   581                 	<input name="A2A_SHARE_SAVE_button_opens_new_window" 
  1089                 	<input name="A2A_SHARE_SAVE_show_title" 
   582                         type="checkbox"<?php if(get_option('A2A_SHARE_SAVE_button_opens_new_window')=='1') echo ' checked="checked"'; ?> value="1"
  1090                         type="checkbox"<?php if($options['show_title']=='1') echo ' checked="checked"'; ?> value="1"/>
   583 						<?php if(get_option('A2A_SHARE_SAVE_onclick')=='1') echo ' disabled="disabled"'; ?>/>
  1091                 	<?php _e('Show the title of the post (or page) within the menu', 'add-to-any'); ?>
   584                 	<?php _e('Open the addtoany.com menu page in a new tab or window if the user clicks the Share/Save button', 'add-to-any'); ?>
       
   585                 </label>
  1092                 </label>
   586             </fieldset></td>
  1093             </fieldset></td>
   587             </tr>
  1094             </tr>
   588             <tr valign="top">
  1095             <tr valign="top">
   589             <th scope="row"><?php _e('Additional Options', 'add-to-any'); ?></th>
  1096             <th scope="row"><?php _e('Additional Options', 'add-to-any'); ?></th>
   590             <td><fieldset>
  1097             <td><fieldset>
   591             		<p id="A2A_SHARE_SAVE_menu_styler_note" style="display:none">
  1098             		<p id="A2A_SHARE_SAVE_menu_styler_note" style="display:none">
   592                         <label for="A2A_SHARE_SAVE_additional_js_variables" class="updated">
  1099                         <label for="A2A_SHARE_SAVE_additional_js_variables" class="updated">
   593                             <strong><?php _e("Paste the code from Add to Any's Menu Styler in the box below!", 'add-to-any'); ?></strong>
  1100                             <strong><?php _e("Paste the code from AddToAny's Menu Styler in the box below!", 'add-to-any'); ?></strong>
   594                         </label>
  1101                         </label>
   595                     </p>
  1102                     </p>
   596                     <label for="A2A_SHARE_SAVE_additional_js_variables">
  1103                     <label for="A2A_SHARE_SAVE_additional_js_variables">
   597                     	<p><?php _e('Below you can set special JavaScript variables to apply to each Share/Save menu.', 'add-to-any'); ?>
  1104                     	<p><?php _e('Below you can set special JavaScript variables to apply to each Share/Save menu.', 'add-to-any'); ?>
   598                     	<?php _e("Advanced users might want to explore Add to Any's <a href=\"http://www.addtoany.com/buttons/api/\" target=\"_blank\">JavaScript API</a>.", "add-to-any"); ?></p>
  1105                     	<?php _e("Advanced users might want to explore AddToAny's <a href=\"http://www.addtoany.com/buttons/customize/\" target=\"_blank\">additional options</a>.", "add-to-any"); ?></p>
   599 					</label>
  1106 					</label>
   600                     <p>
  1107                     <p>
   601                 		<textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="5" cols="50"><?php echo stripslashes(get_option('A2A_SHARE_SAVE_additional_js_variables')); ?></textarea>
  1108                 		<textarea name="A2A_SHARE_SAVE_additional_js_variables" id="A2A_SHARE_SAVE_additional_js_variables" class="code" style="width: 98%; font-size: 12px;" rows="6" cols="50"><?php echo stripslashes($options['additional_js_variables']); ?></textarea>
   602 					</p>
  1109 					</p>
   603                     <?php if( get_option('A2A_SHARE_SAVE_additional_js_variables')!='' ) { ?>
  1110                     <?php if( $options['additional_js_variables']!='' ) { ?>
   604                     <label for="A2A_SHARE_SAVE_additional_js_variables" class="setting-description"><?php _e("<strong>Note</strong>: If you're adding new code, be careful not to accidentally overwrite any previous code.</label>", 'add-to-any'); ?>
  1111                     <label for="A2A_SHARE_SAVE_additional_js_variables" class="setting-description"><?php _e("<strong>Note</strong>: If you're adding new code, be careful not to accidentally overwrite any previous code.</label>", 'add-to-any'); ?>
   605                     <?php } ?>
  1112 					<?php } ?>	
       
  1113 			</fieldset></td>
       
  1114             </tr>
       
  1115 			<tr valign="top">
       
  1116             <th scope="row"><?php _e('Advanced Options', 'add-to-any'); ?></th>
       
  1117             <td><fieldset>
       
  1118             	<label for="A2A_SHARE_SAVE_inline_css">
       
  1119 					<input name="A2A_SHARE_SAVE_inline_css" id="A2A_SHARE_SAVE_inline_css"
       
  1120                     	type="checkbox"<?php if($options['inline_css']!='-1') echo ' checked="checked"'; ?> value="1"/>
       
  1121             	<?php _e('Use CSS stylesheet', 'add-to-any'); ?>
       
  1122 				</label><br/>
       
  1123 				<label for="A2A_SHARE_SAVE_cache">
       
  1124 					<input name="A2A_SHARE_SAVE_cache" id="A2A_SHARE_SAVE_cache" 
       
  1125                     	type="checkbox"<?php if($options['cache']=='1') echo ' checked="checked"'; ?> value="1"/>
       
  1126             	<?php _e('Cache AddToAny locally with daily cache updates', 'add-to-any'); ?> <strong>**</strong>
       
  1127 				</label>
       
  1128 				<br/><br/>
       
  1129                 <div class="setting-description">
       
  1130 					<strong>**</strong> <?php _e("Only consider for sites with frequently returning visitors. Since many visitors will have AddToAny cached in their browser already, serving AddToAny locally from your site will be slower for those visitors.  Be sure to set far future cache/expires headers for image files in your <code>uploads/addtoany</code> directory.", "add-to-any"); ?>
       
  1131 				</div>
   606             </fieldset></td>
  1132             </fieldset></td>
   607             </tr>
  1133             </tr>
   608         </table>
  1134         </table>
   609         
  1135         
   610         <p class="submit">
  1136         <p class="submit">
   611             <input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes', 'add-to-any' ) ?>" />
  1137             <input class="button-primary" type="submit" name="Submit" value="<?php _e('Save Changes', 'add-to-any' ) ?>" />
       
  1138             <input id="A2A_SHARE_SAVE_reset_options" type="submit" name="Reset" onclick="return confirm('<?php _e('Are you sure you want to delete all AddToAny options?', 'add-to-any' ) ?>')" value="<?php _e('Reset', 'add-to-any' ) ?>" />
   612         </p>
  1139         </p>
   613     
  1140     
   614     </form>
  1141     </form>
   615     
  1142     
   616     <h2><?php _e('Like this plugin?','add-to-any'); ?></h2>
  1143     <h2><?php _e('Like this plugin?','add-to-any'); ?></h2>
   617     <p><?php _e('<a href="http://wordpress.org/extend/plugins/add-to-any/">Give it a good rating</a> on WordPress.org.','add-to-any'); ?></p>
  1144     <p><?php _e('<a href="http://wordpress.org/extend/plugins/add-to-any/">Give it a good rating</a> on WordPress.org.','add-to-any'); ?> <a href="http://www.facebook.com/AddToAny">Facebook</a> / <a href="http://twitter.com/AddToAny">Twitter</a></p>
   618     <p><?php _e('<a href="http://www.addtoany.com/share_save?linkname=WordPress%20Share%20Plugin%20by%20AddToAny.com&amp;linkurl=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fadd-to-any%2F">Share it</a> with your friends.','add-to-any'); ?></p>
  1145     <p><?php _e('<a href="http://www.addtoany.com/share_save?linkname=WordPress%20Share%20%2F%20Bookmark%20Plugin%20by%20AddToAny.com&amp;linkurl=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fadd-to-any%2F">Share it</a> with your friends.','add-to-any'); ?></p>
   619     
  1146     
   620     <h2><?php _e('Need support?','add-to-any'); ?></h2>
  1147     <h2><?php _e('Need support?','add-to-any'); ?></h2>
   621     <p><?php _e('See the <a href="http://wordpress.org/extend/plugins/add-to-any/faq/">FAQs</a>.','add-to-any'); ?></p>
  1148     <p><?php _e('See the <a href="http://wordpress.org/extend/plugins/add-to-any/faq/">FAQs</a>.','add-to-any'); ?></p>
   622     <p><?php _e('Search the <a href="http://wordpress.org/tags/add-to-any">support forums</a>.','add-to-any'); ?></p>
  1149     <p><?php _e('Search the <a href="http://wordpress.org/tags/add-to-any">support forums</a>.','add-to-any'); ?></p>
   623     </div>
  1150     </div>
   627 }
  1154 }
   628 
  1155 
   629 // Admin page header
  1156 // Admin page header
   630 function A2A_SHARE_SAVE_admin_head() {
  1157 function A2A_SHARE_SAVE_admin_head() {
   631 	if (isset($_GET['page']) && $_GET['page'] == 'add-to-any.php') {
  1158 	if (isset($_GET['page']) && $_GET['page'] == 'add-to-any.php') {
   632 		global $wp_version;
  1159       
   633 		
  1160 		$options = get_option('addtoany_options');
   634 		// Must be on WP 2.6+
  1161   
   635 		if ($wp_version < "2.6")
       
   636 			return;
       
   637 	?>
  1162 	?>
   638 	<script language="JavaScript" type="text/javascript"><!--
  1163 	<script type="text/javascript"><!--
   639 	jQuery(document).ready(function(){
  1164 	jQuery(document).ready(function(){
       
  1165 		
       
  1166 		// Toggle child options of 'Display in posts'
       
  1167 		jQuery('#A2A_SHARE_SAVE_display_in_posts').bind('change click', function(e){
       
  1168 			if (jQuery(this).is(':checked'))
       
  1169 				jQuery('.A2A_SHARE_SAVE_child_of_display_in_posts').attr('checked', true).attr('disabled', false);
       
  1170 			else 
       
  1171 				jQuery('.A2A_SHARE_SAVE_child_of_display_in_posts').attr('checked', false).attr('disabled', true);
       
  1172 		});
       
  1173 		
       
  1174 		// Update button position labels/values universally in Placement section 
       
  1175 		jQuery('select[name="A2A_SHARE_SAVE_position"]').bind('change click', function(e){
       
  1176 			var $this = jQuery(this);
       
  1177 			jQuery('select[name="A2A_SHARE_SAVE_position"]').not($this).val($this.val());
       
  1178 			
       
  1179 			jQuery('.A2A_SHARE_SAVE_position').html($this.find('option:selected').html());
       
  1180 		});
   640 	
  1181 	
   641 		var to_input = function(this_sortable){
  1182 		var to_input = function(this_sortable){
   642 			// Clear any previous services stored as hidden inputs
  1183 			// Clear any previous services stored as hidden inputs
   643 			jQuery('input[name="A2A_SHARE_SAVE_active_services[]"]').remove();
  1184 			jQuery('input[name="A2A_SHARE_SAVE_active_services[]"]').remove();
   644 			
  1185 			
   645 			var services_array = jQuery(this_sortable).sortable('toArray'),
  1186 			var services_array = jQuery(this_sortable).sortable('toArray'),
   646 				services_size = services_array.length;
  1187 				services_size = services_array.length;
   647 			if(services_size<1) return;
  1188 			if(services_size<1) return;
   648 			
  1189 			
   649 			for(var i=0;i<services_size;i++){
  1190 			for(var i=0, service_name; i < services_size; i++){
   650 				if(services_array[i]!='') // Exclude dummy icon
  1191 				if(services_array[i]!='') { // Exclude dummy icon
   651 					jQuery('form:first').append('<input name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+services_array[i]+'"/>');
  1192 					jQuery('form:first').append('<input name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+services_array[i]+'"/>');
       
  1193 					
       
  1194 					// Special service options?
       
  1195 					service_name = services_array[i].substr(7);
       
  1196 					if (service_name == 'facebook_like' || service_name == 'twitter_tweet' || service_name == 'google_plusone' || service_name == 'google_plus_share') {
       
  1197 						if ((service_name == 'twitter_tweet' || service_name == 'google_plusone' || service_name == 'google_plus_share') && jQuery('#' + services_array[i] + '_show_count').is(':checked'))
       
  1198 							jQuery('form:first').append('<input name="addtoany_' + service_name + '_show_count" type="hidden" value="1"/>');
       
  1199 						if ((service_name == 'facebook_like') && jQuery('#' + services_array[i] + '_verb').val() == 'recommend')
       
  1200 							jQuery('form:first').append('<input name="addtoany_' + service_name + '_verb" type="hidden" value="recommend"/>');
       
  1201 					}
       
  1202 				}
   652 			}
  1203 			}
   653 		};
  1204 		};
   654 	
  1205 	
   655 		jQuery('#addtoany_services_sortable').sortable({
  1206 		jQuery('#addtoany_services_sortable').sortable({
       
  1207 			forcePlaceholderSize: true,
   656 			items: 'li:not(#addtoany_show_services, .dummy)',
  1208 			items: 'li:not(#addtoany_show_services, .dummy)',
   657 			placeholder: 'ui-sortable-placeholder',
  1209 			placeholder: 'ui-sortable-placeholder',
   658 			opacity: .6,
  1210 			opacity: .6,
   659 			tolerance: 'pointer',
  1211 			tolerance: 'pointer',
   660 			update: function(){to_input(this)}
  1212 			update: function(){to_input(this)}
   661 		});
  1213 		});
   662 		
  1214 		
   663 		// Service click = move to sortable list
  1215 		// Service click = move to sortable list
   664 		var moveToSortableList = function(){
  1216 		var moveToSortableList = function(){
   665 			if( jQuery('#addtoany_services_sortable li').not('.dummy').length==0 )
  1217 			var configurable_html = '',
       
  1218 				this_service = jQuery(this),
       
  1219 				this_service_name = this_service.attr('id').substr(7),
       
  1220 				checked = '',
       
  1221 				special_options = '';
       
  1222 			
       
  1223 			if (jQuery('#addtoany_services_sortable li').not('.dummy').length == 0)
   666 				jQuery('#addtoany_services_sortable').find('.dummy').hide();
  1224 				jQuery('#addtoany_services_sortable').find('.dummy').hide();
   667 			
  1225 				
   668 			jQuery(this).toggleClass('addtoany_selected')
  1226 			if (this_service.hasClass('addtoany_special_service')) {
       
  1227 				if (this_service_name == 'facebook_like') {
       
  1228 					if (service_options[this_service_name] && service_options[this_service_name].verb)
       
  1229 						checked = ' selected="selected"';
       
  1230 					special_options_html = '<select id="' + this_service.attr('id') + '_verb" name="' + this_service.attr('id') + '_verb">'
       
  1231 						+ '<option value="like">Like</option>'
       
  1232 						+ '<option' + checked + ' value="recommend">Recommend</option>'
       
  1233 						+ '</select>';
       
  1234 				} else {
       
  1235 					// twitter_tweet & google_plusone & google_plus_share
       
  1236 					if (service_options[this_service_name] && service_options[this_service_name].show_count)
       
  1237 						checked = ' checked="checked"';
       
  1238 					special_options_html = '<label><input' + checked + ' id="' + this_service.attr('id') + '_show_count" name="' + this_service.attr('id') + '_show_count" type="checkbox" value="1"> Show count</label>';
       
  1239 				}
       
  1240 				
       
  1241 				configurable_html = '<span class="down_arrow"></span><br style="clear:both"/><div class="special_options">' + special_options_html + '</div>';
       
  1242 			}
       
  1243 			
       
  1244 			this_service.toggleClass('addtoany_selected')
   669 			.unbind('click', moveToSortableList)
  1245 			.unbind('click', moveToSortableList)
   670 			.bind('click', moveToSelectableList)
  1246 			.bind('click', moveToSelectableList)
   671 			.clone()
  1247 			.clone()
   672 			.html( jQuery(this).find('img').clone().attr('alt', jQuery(this).attr('title')) )
  1248 			.html( this_service.find('img').clone().attr('alt', this_service.attr('title')) ).append(configurable_html)
       
  1249 			.click(function(){
       
  1250 				jQuery(this).not('.addtoany_special_service_options_selected').find('.special_options').slideDown('fast').parent().addClass('addtoany_special_service_options_selected');
       
  1251 			})
   673 			.hide()
  1252 			.hide()
   674 			.insertBefore('#addtoany_services_sortable .dummy')
  1253 			.insertBefore('#addtoany_services_sortable .dummy')
   675 			.fadeIn('fast');
  1254 			.fadeIn('fast');
   676 			
  1255 			
   677 			jQuery(this).attr( 'id', 'old_'+jQuery(this).attr('id') );
  1256 			this_service.attr( 'id', 'old_'+this_service.attr('id') );
   678 			
       
   679 			jQuery('#addtoany_services_sortable li:last').fadeTo('fast', 1);
       
   680 		};
  1257 		};
   681 		
  1258 		
   682 		// Service click again = move back to selectable list
  1259 		// Service click again = move back to selectable list
   683 		var moveToSelectableList = function(){
  1260 		var moveToSelectableList = function(){
   684 			jQuery(this).toggleClass('addtoany_selected')
  1261 			jQuery(this).toggleClass('addtoany_selected')
   703         // Form submit = get sortable list
  1280         // Form submit = get sortable list
   704         jQuery('form').submit(function(){to_input('#addtoany_services_sortable')});
  1281         jQuery('form').submit(function(){to_input('#addtoany_services_sortable')});
   705         
  1282         
   706         // Auto-select active services
  1283         // Auto-select active services
   707         <?php
  1284         <?php
   708 		$admin_services_saved = is_array($_POST['A2A_SHARE_SAVE_active_services']) || isset($_POST['A2A_SHARE_SAVE_submit_hidden']);
  1285 		$admin_services_saved = is_array($_POST['A2A_SHARE_SAVE_active_services']) || isset($_POST['Submit']);
   709 		$active_services = ( $admin_services_saved )
  1286 		$active_services = ( $admin_services_saved )
   710 			? $_POST['A2A_SHARE_SAVE_active_services'] : get_option('A2A_SHARE_SAVE_active_services');
  1287 			? $_POST['A2A_SHARE_SAVE_active_services'] : $options['active_services'];
   711 		if( !$active_services )
  1288 		if( ! $active_services )
   712 			$active_services = Array();
  1289 			$active_services = Array();
   713 		$active_services_last = end($active_services);
  1290 		$active_services_last = end($active_services);
       
  1291 		if($admin_services_saved)
       
  1292 			$active_services_last = substr($active_services_last, 7); // Remove a2a_wp_
   714 		$active_services_quoted = '';
  1293 		$active_services_quoted = '';
   715 		foreach ($active_services as $service) {
  1294 		foreach ($active_services as $service) {
   716 			if($admin_services_saved)
  1295 			if($admin_services_saved)
   717 				$service = substr($service, 7); // Remove a2a_wp_
  1296 				$service = substr($service, 7); // Remove a2a_wp_
   718 			$active_services_quoted .= '"'.$service.'"';
  1297 			$active_services_quoted .= '"'.$service.'"';
   719 			if ( $service != $active_services_last )
  1298 			if ( $service != $active_services_last )
   720 				$active_services_quoted .= ',';
  1299 				$active_services_quoted .= ',';
   721 		}
  1300 		}
   722 		?>
  1301 		?>
   723         var services = [<?php echo $active_services_quoted; ?>];
  1302         var services = [<?php echo $active_services_quoted; ?>],
       
  1303         	service_options = {};
       
  1304         
       
  1305         <?php		
       
  1306 		// Special service options
       
  1307 		if ( $_POST['addtoany_facebook_like_verb'] == 'recommend' || $options['special_facebook_like_options']['verb'] == 'recommend') {
       
  1308 			?>service_options.facebook_like = {verb: 'recommend'};<?php
       
  1309 		}
       
  1310 		if ( $_POST['addtoany_twitter_tweet_show_count'] == '1' || $options['special_twitter_tweet_options']['show_count'] == '1') {
       
  1311 			?>service_options.twitter_tweet = {show_count: 1};<?php
       
  1312 		}
       
  1313 		if ( $_POST['addtoany_google_plusone_show_count'] == '1' || $options['special_google_plusone_options']['show_count'] == '1') {
       
  1314 			?>service_options.google_plusone = {show_count: 1};<?php
       
  1315 		}
       
  1316 		if ( $_POST['addtoany_google_plus_share_show_count'] == '1' || $options['special_google_plus_share_options']['show_count'] == '1') {
       
  1317 			?>service_options.google_plus_share = {show_count: 1};<?php
       
  1318 		}
       
  1319 		?>
       
  1320         
   724         jQuery.each(services, function(i, val){
  1321         jQuery.each(services, function(i, val){
   725         	jQuery('#a2a_wp_'+val).click();
  1322         	jQuery('#a2a_wp_'+val).click();
   726 		});
  1323 		});
   727 		
  1324 		
   728 		// Add/Remove Services
  1325 		// Add/Remove Services
   733 		});
  1330 		});
   734 		jQuery('#addtoany_show_template_button_code').click(function(e){
  1331 		jQuery('#addtoany_show_template_button_code').click(function(e){
   735 			jQuery('#addtoany_template_button_code').slideDown('fast');
  1332 			jQuery('#addtoany_template_button_code').slideDown('fast');
   736 			jQuery(this).fadeOut('fast');
  1333 			jQuery(this).fadeOut('fast');
   737 		});
  1334 		});
       
  1335 		jQuery('#addtoany_show_css_code').click(function(e){
       
  1336 			jQuery('#addtoany_css_code').slideDown('fast');
       
  1337 			jQuery(this).fadeOut('fast');
       
  1338 		});
   738 	});
  1339 	});
   739 	--></script>
  1340 	--></script>
   740 
  1341 
   741 	<style type="text/css">
  1342 	<style type="text/css">
   742 	.ui-sortable-placeholder{border:1px dashed #AAA;}
  1343 	.ui-sortable-placeholder{background-color:transparent;border:1px dashed #AAA !important;}
   743 	.addtoany_admin_list{list-style:none;padding:0;margin:0;}
  1344 	.addtoany_admin_list{list-style:none;padding:0;margin:0;}
   744 	.addtoany_admin_list li{-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;}
  1345 	.addtoany_admin_list li{-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;}
   745 	
  1346 	
   746 	#addtoany_services_selectable{clear:left;display:none;}
  1347 	#addtoany_services_selectable{clear:left;display:none;}
   747 	#addtoany_services_selectable li{cursor:crosshair;float:left;width:150px;font-size:11px;margin:0;padding:3px;border:1px solid transparent;_border-color:#FAFAFA/*IE6*/;overflow:hidden;}
  1348 	#addtoany_services_selectable li{cursor:crosshair;float:left;width:150px;font-size:11px;margin:0;padding:6px;border:1px solid transparent;_border-color:#FAFAFA/*IE6*/;overflow:hidden;}
   748 	<?php // white-space:nowrap could go above, but then webkit does not wrap floats if parent has no width set; wrapping in <span> instead (below) ?>
  1349 	<?php // white-space:nowrap could go above, but then webkit does not wrap floats if parent has no width set; wrapping in <span> instead (below) ?>
   749 	#addtoany_services_selectable li span{white-space:nowrap;}
  1350 	#addtoany_services_selectable li span{white-space:nowrap;}
   750 	#addtoany_services_selectable li:hover, #addtoany_services_selectable li.addtoany_selected{border:1px solid #AAA;background-color:#FFF;}
  1351 	#addtoany_services_selectable li:hover, #addtoany_services_selectable li.addtoany_selected{border:1px solid #AAA;background-color:#FFF;}
   751 	#addtoany_services_selectable li.addtoany_selected:hover{border-color:#F00;}
  1352 	#addtoany_services_selectable li.addtoany_selected:hover{border-color:#F00;}
   752 	#addtoany_services_selectable li:active{border:1px solid #000;}
  1353 	#addtoany_services_selectable li:active{border:1px solid #000;}
   753     #addtoany_services_selectable li span img{margin:0 4px 0 4px;width:16px;height:16px;border:0;vertical-align:middle;}
  1354 	#addtoany_services_selectable img{margin:0 4px;width:16px;height:16px;border:0;vertical-align:middle;}
       
  1355 	#addtoany_services_selectable .addtoany_special_service{padding:3px 6px;}
       
  1356 	#addtoany_services_selectable .addtoany_special_service img{width:auto;height:20px;}
   754 	
  1357 	
   755 	#addtoany_services_sortable li, #addtoany_services_sortable li.dummy:hover{cursor:move;float:left;padding:9px;border:1px solid transparent;_border-color:#FAFAFA/*IE6*/;}
  1358 	#addtoany_services_sortable li, #addtoany_services_sortable li.dummy:hover{cursor:move;float:left;padding:9px;border:1px solid transparent;_border-color:#FAFAFA/*IE6*/;}
   756 	#addtoany_services_sortable li:hover{border:1px solid #AAA;background-color:#FFF;}
  1359 	#addtoany_services_sortable li:hover{border:1px solid #AAA;background-color:#FFF;}
   757 	#addtoany_services_sortable li.dummy, #addtoany_services_sortable li.dummy:hover{cursor:auto;background-color:transparent;}
  1360 	#addtoany_services_sortable li.dummy, #addtoany_services_sortable li.dummy:hover{cursor:auto;background-color:transparent;}
   758 	#addtoany_services_sortable img{width:16px;height:16px;border:0;vertical-align:middle;}
  1361 	#addtoany_services_sortable img{width:16px;height:16px;border:0;vertical-align:middle;}
       
  1362 	#addtoany_services_sortable .addtoany_special_service img{width:auto;height:20px;float:left;}
       
  1363 	#addtoany_services_sortable .addtoany_special_service span.down_arrow{background:url(<?php echo admin_url( '/images/menu-bits.gif' ); ?>) no-repeat -2px -110px;float:right;height:30px;;margin:-5px 0 -6px 5px;width:20px;}
       
  1364 	#addtoany_services_sortable .addtoany_special_service div.special_options{display:none;font-size:11px;margin-top:9px;}
       
  1365 	#addtoany_services_sortable .addtoany_special_service_options_selected{border:1px solid #AAA;background-color:#FFF;}
       
  1366 	#addtoany_services_sortable .addtoany_special_service_options_selected span.down_arrow{display:none;}
   759 	
  1367 	
   760 	li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;}
  1368 	li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;}
   761 	li#addtoany_show_services:hover{border:1px solid #AAA;}
  1369 	li#addtoany_show_services:hover{border:1px solid #AAA;}
   762 	#addtoany_services_info{clear:left;display:none;}
  1370 	#addtoany_services_info{clear:left;display:none;}
   763 	
  1371 	
   764 	#addtoany_template_button_code{display:none;}
  1372 	#addtoany_template_button_code, #addtoany_css_code{display:none;}
   765     </style>
  1373 	
       
  1374 	#A2A_SHARE_SAVE_reset_options{color:red;margin-left: 15px;}
       
  1375   </style>
   766 <?php
  1376 <?php
   767 	}
  1377 
   768 }
  1378 	}
   769 
  1379 }
   770 add_action('admin_head', 'A2A_SHARE_SAVE_admin_head');
  1380 
       
  1381 add_filter('admin_head', 'A2A_SHARE_SAVE_admin_head');
   771 
  1382 
   772 function A2A_SHARE_SAVE_add_menu_link() {
  1383 function A2A_SHARE_SAVE_add_menu_link() {
       
  1384 		
   773 	if( current_user_can('manage_options') ) {
  1385 	if( current_user_can('manage_options') ) {
   774 		add_options_page(
  1386 		$page = add_options_page(
   775 			'Add to Any: '. __("Share/Save", "add-to-any"). " " . __("Settings")
  1387 			'AddToAny: '. __("Share/Save", "add-to-any"). " " . __("Settings")
   776 			, __("Share/Save Buttons", "add-to-any")
  1388 			, __("AddToAny", "add-to-any")
   777 			, 8 
  1389 			, 'activate_plugins' 
   778 			, basename(__FILE__)
  1390 			, basename(__FILE__)
   779 			, 'A2A_SHARE_SAVE_options_page'
  1391 			, 'A2A_SHARE_SAVE_options_page'
   780 		);
  1392 		);
   781 		
  1393 		
   782 		// Load jQuery UI Sortable
  1394 		/* Using registered $page handle to hook script load, to only load in AddToAny admin */
   783 		wp_enqueue_script('jquery-ui-sortable');
  1395         add_filter('admin_print_scripts-' . $page, 'A2A_SHARE_SAVE_scripts');
   784 	}
  1396 	}
   785 }
  1397 }
   786 
  1398 
   787 add_action('admin_menu', 'A2A_SHARE_SAVE_add_menu_link');
  1399 function A2A_SHARE_SAVE_scripts() {
   788 
  1400 	wp_enqueue_script('jquery-ui-sortable');
   789 // Place in Settings Option List
  1401 }
       
  1402 
       
  1403 
       
  1404 function A2A_SHARE_SAVE_widget_init() {
       
  1405 	global $A2A_SHARE_SAVE_plugin_dir;
       
  1406 	
       
  1407     include_once($A2A_SHARE_SAVE_plugin_dir . '/add-to-any-wp-widget.php');
       
  1408     register_widget('A2A_SHARE_SAVE_Widget');
       
  1409 }
       
  1410 
       
  1411 add_action('widgets_init', 'A2A_SHARE_SAVE_widget_init');
       
  1412 
       
  1413 
       
  1414 add_filter('admin_menu', 'A2A_SHARE_SAVE_add_menu_link');
       
  1415 
       
  1416 // Place in Option List on Settings > Plugins page 
   790 function A2A_SHARE_SAVE_actlinks( $links, $file ){
  1417 function A2A_SHARE_SAVE_actlinks( $links, $file ){
   791 	//Static so we don't call plugin_basename on every plugin row.
  1418 	// Static so we don't call plugin_basename on every plugin row.
   792 	static $this_plugin;
  1419 	static $this_plugin;
   793 	if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);
  1420 	if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__);
   794 	
  1421 	
   795 	if ( $file == $this_plugin ){
  1422 	if ( $file == $this_plugin ){
   796 		$settings_link = '<a href="options-general.php?page=add-to-any.php">' . __('Settings') . '</a>';
  1423 		$settings_link = '<a href="options-general.php?page=add-to-any.php">' . __('Settings') . '</a>';