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