Version Description
- Bug Fixes
- set addthis_exclude custom field to 'true' to not display addthis on that post / page
- Added additional paramater to
- Ability to specify custom toolboxes for both above and below
- Added additional paramater to do_action('addthis_widget'). Paramaters are now:
- * url (use get_permalink() if you are calling it inside the loop)
- * title (use the_title() if calling inside the loop)
- * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
Download this release
Release Info
Developer | jorbin |
Plugin | WordPress Share Buttons Plugin – AddThis |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- addthis_social_widget.php +292 -37
- readme.txt +15 -3
addthis_social_widget.php
CHANGED
@@ -27,7 +27,7 @@ else return;
|
|
27 |
* Plugin Name: AddThis Social Bookmarking Widget
|
28 |
* Plugin URI: http://www.addthis.com
|
29 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
30 |
-
* Version: 2.0.
|
31 |
*
|
32 |
* Author: The AddThis Team
|
33 |
* Author URI: http://www.addthis.com/blog
|
@@ -69,7 +69,7 @@ $addthis_new_styles = array(
|
|
69 |
), // facebook tweet share counter
|
70 |
'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="http://addthis.com/bookmark.php?v=250&username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden'
|
71 |
), // Plus sign share
|
72 |
-
'button' => array( 'src' => '<a class="addthis_button" href="http://addthis.com/bookmark.php?v=250
|
73 |
), // classic
|
74 |
'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden'
|
75 |
),
|
@@ -78,7 +78,7 @@ $addthis_new_styles = array(
|
|
78 |
|
79 |
|
80 |
define( 'addthis_style_default' , 'small_toolbox_with_share');
|
81 |
-
define( 'ADDTHIS_PLUGIN_VERSION', '2.0.
|
82 |
/**
|
83 |
* Converts our old many options in to one beautiful array
|
84 |
*
|
@@ -172,6 +172,16 @@ function addthis_options_200()
|
|
172 |
|
173 |
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
|
177 |
|
@@ -198,10 +208,96 @@ function addthis_get_wp_version() {
|
|
198 |
/**
|
199 |
* For templates, we need a wrapper for printing out the code on demand.
|
200 |
*/
|
201 |
-
function addthis_print_widget($url=null, $title=null) {
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
|
|
|
205 |
/**
|
206 |
* Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
|
207 |
*/
|
@@ -341,7 +437,10 @@ function addthis_render_dashboard_widget() {
|
|
341 |
|
342 |
$domain = str_replace(array('http://', 'https://'), '', $domain);
|
343 |
|
344 |
-
|
|
|
|
|
|
|
345 |
|
346 |
$requests = array(
|
347 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
|
@@ -363,11 +462,12 @@ function addthis_render_dashboard_widget() {
|
|
363 |
$dimension = $metric = $domain = $period = '';
|
364 |
extract($request);
|
365 |
$dimension = ($dimension != '') ? '/'.$dimension : '';
|
366 |
-
$url = '
|
367 |
'domain='.$domain.'&period='.$period.
|
368 |
'&username='.$username.
|
369 |
-
'&password='.$password
|
370 |
-
$
|
|
|
371 |
}
|
372 |
if ($stats['sharesday']['response']['code'] == 200)
|
373 |
set_transient('addthis_dashboard_stats', $stats, '600');
|
@@ -464,13 +564,13 @@ foreach (array('yesterday', 'lastweek', 'lastmonth') as $timePeriod )
|
|
464 |
}
|
465 |
echo "</div>";
|
466 |
echo "<hr />";
|
467 |
-
echo "<
|
468 |
-
|
469 |
-
|
470 |
-
echo '<div id="tstab2"';
|
471 |
-
echo "<h5>Top Services for clicks(last month)</h5>";
|
472 |
-
echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
|
473 |
echo "</div>";
|
|
|
|
|
|
|
474 |
echo "</div>";
|
475 |
echo '<div class="clear"> </div>';
|
476 |
echo '<p><a class="button rbutton" href="http://www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
|
@@ -522,14 +622,15 @@ function addthis_save_transient() {
|
|
522 |
if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
|
523 |
|
524 |
// Parse Post data
|
525 |
-
|
526 |
$option_array = addthis_parse_options($values);
|
|
|
527 |
// Set Transient
|
528 |
if (false !== get_transient('addthis_settings'))
|
529 |
delete_transient('addthis_settings');
|
530 |
$eh = set_transient('addthis_settings', $option_array, 120);
|
531 |
|
532 |
-
|
|
|
533 |
die();
|
534 |
}
|
535 |
|
@@ -557,10 +658,13 @@ $styles = array_merge($addthis_styles, $addthis_new_styles);
|
|
557 |
|
558 |
$options = array();
|
559 |
|
560 |
-
// Sanitize username and password
|
561 |
if ( isset($data['addthis_username']) )
|
562 |
$options['username'] = sanitize_text_field($data['addthis_username']);
|
563 |
|
|
|
|
|
|
|
564 |
if ( isset($data['addthis_password']) )
|
565 |
$options['password'] = sanitize_text_field($data['addthis_password']);
|
566 |
|
@@ -573,6 +677,18 @@ elseif ($data['above'] == 'none')
|
|
573 |
{
|
574 |
$options['above'] = 'none';
|
575 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
576 |
|
577 |
if ( isset ($data['show_below']) )
|
578 |
$options['below'] = 'none';
|
@@ -582,6 +698,18 @@ elseif ($data['below'] == 'none')
|
|
582 |
{
|
583 |
$options['below'] = 'none';
|
584 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
|
586 |
|
587 |
// All the checkbox fields
|
@@ -681,12 +809,14 @@ function addthis_init()
|
|
681 |
|
682 |
add_filter('admin_menu', 'addthis_admin_menu');
|
683 |
|
684 |
-
if ( get_option('addthis_product') !== false &&
|
685 |
-
! is_array( $options ) )
|
686 |
addthis_options_200();
|
687 |
|
|
|
|
|
|
|
688 |
|
689 |
-
add_action( 'addthis_widget', 'addthis_print_widget', 10,
|
690 |
|
691 |
$product = get_option('addthis_product');
|
692 |
|
@@ -724,7 +854,9 @@ add_action('widgets_init', 'addthis_widget_init');
|
|
724 |
function addthis_widget_init()
|
725 |
{
|
726 |
require_once('addthis_sidebar_widget.php');
|
|
|
727 |
register_widget('AddThisSidebarWidget');
|
|
|
728 |
}
|
729 |
|
730 |
function addthis_sidebar_widget($args)
|
@@ -804,7 +936,18 @@ function addthis_late_widget($link_text)
|
|
804 |
$url_below = "addthis:url='$url' ";
|
805 |
$url_below .= "addthis:title='$title'";
|
806 |
|
807 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
{
|
809 |
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
810 |
}
|
@@ -812,7 +955,7 @@ if ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment()
|
|
812 |
{
|
813 |
$below = apply_filters('addthis_below_content','' );
|
814 |
}
|
815 |
-
return $link_text .
|
816 |
|
817 |
|
818 |
}
|
@@ -861,6 +1004,11 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
|
|
861 |
else
|
862 |
$display = false;
|
863 |
|
|
|
|
|
|
|
|
|
|
|
864 |
remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
|
865 |
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
866 |
$url = get_permalink();
|
@@ -875,19 +1023,38 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
|
|
875 |
{
|
876 |
if (isset ($styles[$options['above']]))
|
877 |
{
|
878 |
-
$above = apply_filters('addthis_above_content', $styles[$options['above']]['src'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
}
|
880 |
}
|
881 |
-
|
882 |
$above = apply_filters('addthis_above_content','' );
|
883 |
-
|
|
|
|
|
884 |
if ($options['below'] != 'none' && $display && ! $below_excerpt )
|
885 |
{
|
886 |
if (isset ($styles[$options['below']]))
|
887 |
{
|
888 |
-
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
}
|
890 |
-
|
891 |
}
|
892 |
elseif ($below_excerpt && $display && $options['below'] != 'none' )
|
893 |
{
|
@@ -895,7 +1062,8 @@ function addthis_display_social_widget($content, $filtered = true, $below_excerp
|
|
895 |
if ($options['addthis_showonexcerpts'] == true )
|
896 |
add_filter('get_the_excerpt', 'addthis_late_widget', 14);
|
897 |
}
|
898 |
-
|
|
|
899 |
else
|
900 |
$below = '';
|
901 |
|
@@ -931,9 +1099,10 @@ function addthis_output_script()
|
|
931 |
|
932 |
$script = "\n<!-- AddThis Button Begin -->\n"
|
933 |
.'<script type="text/javascript">'
|
934 |
-
."var addthis_product = 'wpp-
|
|
|
935 |
|
936 |
-
$pub = (isset($options['
|
937 |
if (!$pub) {
|
938 |
$pub = 'wp-'.cuid();
|
939 |
}
|
@@ -970,7 +1139,7 @@ function addthis_output_script()
|
|
970 |
$script .= '</script>';
|
971 |
|
972 |
|
973 |
-
$script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#
|
974 |
|
975 |
echo $script;
|
976 |
}
|
@@ -1121,6 +1290,7 @@ function addthis_admin_menu()
|
|
1121 |
}
|
1122 |
|
1123 |
$addthis_default_options = array(
|
|
|
1124 |
'username' => '',
|
1125 |
'password' => '',
|
1126 |
'style' => addthis_style_default ,
|
@@ -1139,10 +1309,19 @@ function addthis_admin_menu()
|
|
1139 |
'addthis_header_background' => '',
|
1140 |
'addthis_header_color' => '',
|
1141 |
'addthis_options' => '',
|
1142 |
-
'addthis_showonexcerpts' => true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1143 |
);
|
1144 |
|
1145 |
function addthis_plugin_options_php4() {
|
|
|
1146 |
global $addthis_styles;
|
1147 |
global $addthis_languages;
|
1148 |
global $addthis_settings;
|
@@ -1169,7 +1348,7 @@ function addthis_plugin_options_php4() {
|
|
1169 |
|
1170 |
$addthis_options = get_option('addthis_settings');
|
1171 |
foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
|
1172 |
-
{
|
1173 |
if ( $addthis_options && ! isset($addthis_options[$option]) )
|
1174 |
$addthis_options[$option] = false;
|
1175 |
}
|
@@ -1202,7 +1381,44 @@ function addthis_plugin_options_php4() {
|
|
1202 |
}
|
1203 |
echo "<p class='above_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[above]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
|
1204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
?>
|
|
|
|
|
1206 |
<a class="above_option" href="#above_more" id="above_more">addtional style options</a>
|
1207 |
</td>
|
1208 |
</tr>
|
@@ -1218,14 +1434,53 @@ function addthis_plugin_options_php4() {
|
|
1218 |
$checked = 'checked="checked"';
|
1219 |
$class = '';
|
1220 |
}
|
1221 |
-
|
1222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1223 |
?>
|
1224 |
<a class="below_option" href="#below_more" id="below_more">additional style options</a>
|
1225 |
</td>
|
1226 |
</tr>
|
1227 |
<tr valign="top">
|
1228 |
-
<td colspan="2"><?php _e('Enter a username and password to discover how your content is being shared, and how your most influential audience members are bringing traffic back to your site. Learn what interests them – and to what degree – and how thoses interests are driving sharing. <a href="http://addthis.com/features" target="_blank">Click here for more information</a
|
|
|
|
|
|
|
|
|
1229 |
</tr>
|
1230 |
<tr valign="top">
|
1231 |
<th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
|
27 |
* Plugin Name: AddThis Social Bookmarking Widget
|
28 |
* Plugin URI: http://www.addthis.com
|
29 |
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
|
30 |
+
* Version: 2.0.2
|
31 |
*
|
32 |
* Author: The AddThis Team
|
33 |
* Author URI: http://www.addthis.com/blog
|
69 |
), // facebook tweet share counter
|
70 |
'simple_button' => array('src' => '<div class="addthis_toolbox addthis_default_style " %s><a href="http://addthis.com/bookmark.php?v=250&username=xa-4d2b47f81ddfbdce" class="addthis_button_compact">Share</a></div>', 'img' => 'share.jpg', 'name' => 'Share Button', 'above' => 'hidden ', 'below' => 'hidden'
|
71 |
), // Plus sign share
|
72 |
+
'button' => array( 'src' => '<div><a class="addthis_button" href="http://addthis.com/bookmark.php?v=250" %s><img src="http://cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>', 'img' => 'button.jpg', 'name' => 'Classic Share Button', 'above' => 'hidden ', 'below' => 'hidden'
|
73 |
), // classic
|
74 |
'share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a class="addthis_counter"></a></div>', 'img' => 'share_counter.png', 'name' => 'Share Counter', 'above' => 'hidden ', 'below' => 'hidden'
|
75 |
),
|
78 |
|
79 |
|
80 |
define( 'addthis_style_default' , 'small_toolbox_with_share');
|
81 |
+
define( 'ADDTHIS_PLUGIN_VERSION', '2.0.2');
|
82 |
/**
|
83 |
* Converts our old many options in to one beautiful array
|
84 |
*
|
172 |
|
173 |
}
|
174 |
|
175 |
+
function addthis_options_210()
|
176 |
+
{
|
177 |
+
$options = get_option('addthis_settings');
|
178 |
+
if ( isset( $options['username'] ) )
|
179 |
+
$options['profile'] = $options['username'];
|
180 |
+
$$options['dbversion'] == '210';
|
181 |
+
|
182 |
+
update_option( 'addthis_settings', $options);
|
183 |
+
|
184 |
+
}
|
185 |
|
186 |
|
187 |
|
208 |
/**
|
209 |
* For templates, we need a wrapper for printing out the code on demand.
|
210 |
*/
|
211 |
+
function addthis_print_widget($url=null, $title=null, $style = addthis_style_default ) {
|
212 |
+
global $addthis_new_styles ;
|
213 |
+
|
214 |
+
$identifier = addthis_get_identifier($url, $title);
|
215 |
+
|
216 |
+
echo "\n<!-- AddThis Custom -->\n";
|
217 |
+
|
218 |
+
|
219 |
+
if ( ! is_array($style) && isset($addthis_new_styles[$style]) ){
|
220 |
+
echo sprintf($addthis_new_styles[$style]['src'], $identifier);
|
221 |
+
}
|
222 |
+
|
223 |
+
elseif (is_array($style))
|
224 |
+
echo addthis_custom_toolbox($style, $url, $title);
|
225 |
+
echo "\n<!-- End AddThis Custom -->\n";
|
226 |
+
}
|
227 |
+
|
228 |
+
/*
|
229 |
+
* Generates the addthis:url and addthis:title attributes
|
230 |
+
*/
|
231 |
+
|
232 |
+
function addthis_get_identifier($url = null, $title = null)
|
233 |
+
{
|
234 |
+
|
235 |
+
if (! is_null($url) )
|
236 |
+
$identifier = "addthis:url='$url' ";
|
237 |
+
if (! is_null($title) )
|
238 |
+
$identifier .= "addthis:title='$title'";
|
239 |
+
|
240 |
+
if (! isset($identifier) )
|
241 |
+
$identifier = '';
|
242 |
+
|
243 |
+
return $identifier;
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Options is an array that contains
|
249 |
+
* size - either 16 or 32. Defaults to 16
|
250 |
+
* services - comma sepperated list of services
|
251 |
+
* preferred - number of Prefered services to be displayed after listed services
|
252 |
+
* more - bool to show or not show the more icon at the end
|
253 |
+
*
|
254 |
+
* @param $options array
|
255 |
+
*/
|
256 |
+
|
257 |
+
function addthis_custom_toolbox($options, $url, $title)
|
258 |
+
{
|
259 |
+
$identifier = addthis_get_identifier($url, $title);
|
260 |
+
|
261 |
+
$outerClasses = 'addthis_toolbox addthis_default_style';
|
262 |
+
|
263 |
+
if (isset($options['size']) && $options['size'] == '32')
|
264 |
+
$outerClasses .= ' addthis_32x32_style';
|
265 |
+
|
266 |
+
$button = '<div class="'.$outerClasses.'" '.$identifier.' >';
|
267 |
+
|
268 |
+
if (isset($options['services']) )
|
269 |
+
{
|
270 |
+
$services = explode(',', $options['services']);
|
271 |
+
foreach ($services as $service)
|
272 |
+
{
|
273 |
+
$service = trim($service);
|
274 |
+
if ($service == 'more')
|
275 |
+
$button .= '<a class="addthis_button_compact"></a>';
|
276 |
+
else
|
277 |
+
$button .= '<a class="addthis_button_'.$service.'"></a>';
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
if (isset($options['preferred']) && is_numeric($options['preferred']))
|
282 |
+
{
|
283 |
+
for ($a = 1; $a <= $options['preferred']; $a++)
|
284 |
+
{
|
285 |
+
$button .= '<a class="addthis_button_preferred_'.$a.'"></a>';
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
if (isset($options['more']) && $options['more'] == true)
|
290 |
+
{
|
291 |
+
$button .= '<a class="addthis_button_compact"></a>';
|
292 |
+
}
|
293 |
+
|
294 |
+
$button .= '</div>';
|
295 |
+
|
296 |
+
return $button;
|
297 |
+
|
298 |
}
|
299 |
|
300 |
+
|
301 |
/**
|
302 |
* Adds AddThis CSS to page. Only used for admin dashboard in WP 2.7 and higher.
|
303 |
*/
|
437 |
|
438 |
$domain = str_replace(array('http://', 'https://'), '', $domain);
|
439 |
|
440 |
+
if (isset($options['profile']))
|
441 |
+
$profile = '&pubid='.urlencode($options['profile']);
|
442 |
+
else
|
443 |
+
$profile = '';
|
444 |
|
445 |
$requests = array(
|
446 |
array('metric' => 'shares', 'dimension' => '', 'domain' => $domain, 'period' => 'day'),
|
462 |
$dimension = $metric = $domain = $period = '';
|
463 |
extract($request);
|
464 |
$dimension = ($dimension != '') ? '/'.$dimension : '';
|
465 |
+
$url = 'https://api.addthis.com/analytics/1.0/pub/' . $metric . $dimension . '.json?'.
|
466 |
'domain='.$domain.'&period='.$period.
|
467 |
'&username='.$username.
|
468 |
+
'&password='.$password.
|
469 |
+
$profile;
|
470 |
+
$stats[$metric.$dimension.$period] = wp_remote_get($url, array('period' => $period, 'domain' => $domain, 'password' => $password, 'username' => $username) );
|
471 |
}
|
472 |
if ($stats['sharesday']['response']['code'] == 200)
|
473 |
set_transient('addthis_dashboard_stats', $stats, '600');
|
564 |
}
|
565 |
echo "</div>";
|
566 |
echo "<hr />";
|
567 |
+
echo "<div id='tstab1'>";
|
568 |
+
echo "<h5>Top Services for shares(last month)</h5>";
|
569 |
+
echo "<img src='{$servicesCharts['shares']}' width='118' height='145' alt='share stats for the last month' />";
|
|
|
|
|
|
|
570 |
echo "</div>";
|
571 |
+
echo '<div id="tstab2">';
|
572 |
+
echo "<h5>Top Services for clicks(last month)</h5>";
|
573 |
+
echo "<img src='{$servicesCharts['clickbacks']}' width='118' height='145' alt='share stats for the last month' />";
|
574 |
echo "</div>";
|
575 |
echo '<div class="clear"> </div>';
|
576 |
echo '<p><a class="button rbutton" href="http://www.addthis.com/analytics/summary?domain='.$domain.'">View More Analytics</a></p>';
|
622 |
if (! wp_verify_nonce($nonce, 'addthis-options') ) die('Security check');
|
623 |
|
624 |
// Parse Post data
|
|
|
625 |
$option_array = addthis_parse_options($values);
|
626 |
+
|
627 |
// Set Transient
|
628 |
if (false !== get_transient('addthis_settings'))
|
629 |
delete_transient('addthis_settings');
|
630 |
$eh = set_transient('addthis_settings', $option_array, 120);
|
631 |
|
632 |
+
print_r($option_array);
|
633 |
+
|
634 |
die();
|
635 |
}
|
636 |
|
658 |
|
659 |
$options = array();
|
660 |
|
661 |
+
// Sanitize profile, username and password
|
662 |
if ( isset($data['addthis_username']) )
|
663 |
$options['username'] = sanitize_text_field($data['addthis_username']);
|
664 |
|
665 |
+
if ( isset($data['addthis_profile']) )
|
666 |
+
$options['profile'] = sanitize_text_field($data['addthis_profile']);
|
667 |
+
|
668 |
if ( isset($data['addthis_password']) )
|
669 |
$options['password'] = sanitize_text_field($data['addthis_password']);
|
670 |
|
677 |
{
|
678 |
$options['above'] = 'none';
|
679 |
}
|
680 |
+
elseif ($data['above'] = 'custom')
|
681 |
+
{
|
682 |
+
|
683 |
+
$options['above_do_custom_services'] = isset($data['above_do_custom_services']) ;
|
684 |
+
$options['above_do_custom_preferred'] = isset($data['above_do_custom_preferred']) ;
|
685 |
+
|
686 |
+
$options['above'] = 'custom';
|
687 |
+
$options['above_custom_size'] = ( $data['above_custom_size'] == '16' || $data['above_custom_size'] == 32 ) ? $data['above_custom_size'] : '' ;
|
688 |
+
$options['above_custom_services'] = sanitize_text_field( $data['above_custom_services'] );
|
689 |
+
$options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
|
690 |
+
$options['above_custom_more'] = isset($data['above_custom_more']);
|
691 |
+
}
|
692 |
|
693 |
if ( isset ($data['show_below']) )
|
694 |
$options['below'] = 'none';
|
698 |
{
|
699 |
$options['below'] = 'none';
|
700 |
}
|
701 |
+
elseif ($data['below'] = 'custom')
|
702 |
+
{
|
703 |
+
$options['below_do_custom_services'] = isset($data['below_do_custom_services']) ;
|
704 |
+
$options['below_do_custom_preferred'] = isset($data['below_do_custom_preferred']) ;
|
705 |
+
|
706 |
+
$options['below'] = 'custom';
|
707 |
+
$options['below_custom_size'] = ( $data['below_custom_size'] == '16' || $data['below_custom_size'] == 32 ) ? $data['below_custom_size'] : '' ;
|
708 |
+
$options['below_custom_services'] = sanitize_text_field( $data['below_custom_services'] );
|
709 |
+
$options['below_custom_preferred'] = sanitize_text_field( $data['below_custom_preferred'] );
|
710 |
+
$options['below_custom_more'] = isset($data['below_custom_more']);
|
711 |
+
}
|
712 |
+
|
713 |
|
714 |
|
715 |
// All the checkbox fields
|
809 |
|
810 |
add_filter('admin_menu', 'addthis_admin_menu');
|
811 |
|
812 |
+
if ( get_option('addthis_product') !== false && ! is_array( $options ) )
|
|
|
813 |
addthis_options_200();
|
814 |
|
815 |
+
// Upgrade to 210 from 200
|
816 |
+
if ( isset($options['username']) && ! isset($options['profile']) )
|
817 |
+
addthis_options_210();
|
818 |
|
819 |
+
add_action( 'addthis_widget', 'addthis_print_widget', 10, 3);
|
820 |
|
821 |
$product = get_option('addthis_product');
|
822 |
|
854 |
function addthis_widget_init()
|
855 |
{
|
856 |
require_once('addthis_sidebar_widget.php');
|
857 |
+
//require_once('addthis_content_feed_widget.php');
|
858 |
register_widget('AddThisSidebarWidget');
|
859 |
+
//register_widget('AddThisContentFeedWidget');
|
860 |
}
|
861 |
|
862 |
function addthis_sidebar_widget($args)
|
936 |
$url_below = "addthis:url='$url' ";
|
937 |
$url_below .= "addthis:title='$title'";
|
938 |
|
939 |
+
if (has_excerpt() && ! is_attachment() && isset($options['below']) && $options['below'] == 'custom')
|
940 |
+
{
|
941 |
+
$belowOptions['size'] = $options['below_custom_size'];
|
942 |
+
if ($options['below_do_custom_services'])
|
943 |
+
$belowOptions['services'] = $options['below_custom_services'];
|
944 |
+
if ($options['below_do_custom_preferred'])
|
945 |
+
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
946 |
+
$belowOptions['more'] = $options['below_custom_more'];
|
947 |
+
return $link_text . apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
|
948 |
+
}
|
949 |
+
|
950 |
+
elseif ( isset ($styles[$options['below']]) && has_excerpt() && ! is_attachment() )
|
951 |
{
|
952 |
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
953 |
}
|
955 |
{
|
956 |
$below = apply_filters('addthis_below_content','' );
|
957 |
}
|
958 |
+
return $link_text . sprintf($below, $url_below);
|
959 |
|
960 |
|
961 |
}
|
1004 |
else
|
1005 |
$display = false;
|
1006 |
|
1007 |
+
$custom_fields = get_post_custom($post->ID);
|
1008 |
+
if (isset ($custom_fields['addthis_exclude']) && $custom_fields['addthis_exclude'][0] == 'true')
|
1009 |
+
$display = false;
|
1010 |
+
|
1011 |
+
|
1012 |
remove_filter('wp_trim_excerpt', 'addthis_remove_tag', 9, 2);
|
1013 |
remove_filter('get_the_excerpt', 'addthis_late_widget');
|
1014 |
$url = get_permalink();
|
1023 |
{
|
1024 |
if (isset ($styles[$options['above']]))
|
1025 |
{
|
1026 |
+
$above = apply_filters('addthis_above_content', $styles[$options['above']]['src']);
|
1027 |
+
}
|
1028 |
+
elseif ($options['above'] == 'custom')
|
1029 |
+
{
|
1030 |
+
$aboveOptions['size'] = $options['above_custom_size'];
|
1031 |
+
if ($options['above_do_custom_services'])
|
1032 |
+
$aboveOptions['services'] = $options['above_custom_services'];
|
1033 |
+
if ($options['above_do_custom_preferred'])
|
1034 |
+
$aboveOptions['preferred'] = $options['above_custom_preferred'];
|
1035 |
+
$aboveOptions['more'] = $options['above_custom_more'];
|
1036 |
+
$above = apply_filters('addthis_above_content', addthis_custom_toolbox($aboveOptions, $url, $title) );
|
1037 |
}
|
1038 |
}
|
1039 |
+
elseif ($display)
|
1040 |
$above = apply_filters('addthis_above_content','' );
|
1041 |
+
else
|
1042 |
+
$above = '';
|
1043 |
+
|
1044 |
if ($options['below'] != 'none' && $display && ! $below_excerpt )
|
1045 |
{
|
1046 |
if (isset ($styles[$options['below']]))
|
1047 |
{
|
1048 |
+
$below = apply_filters('addthis_below_content', $styles[$options['below']]['src']);
|
1049 |
+
}
|
1050 |
+
elseif ($options['below'] == 'custom')
|
1051 |
+
{
|
1052 |
+
$belowOptions['size'] = $options['below_custom_size'];
|
1053 |
+
$belowOptions['services'] = $options['below_custom_services'];
|
1054 |
+
$belowOptions['preferred'] = $options['below_custom_preferred'];
|
1055 |
+
$belowOptions['more'] = $options['below_custom_more'];
|
1056 |
+
$below = apply_filters('addthis_below_content', addthis_custom_toolbox($belowOptions, $url, $title) );
|
1057 |
}
|
|
|
1058 |
}
|
1059 |
elseif ($below_excerpt && $display && $options['below'] != 'none' )
|
1060 |
{
|
1062 |
if ($options['addthis_showonexcerpts'] == true )
|
1063 |
add_filter('get_the_excerpt', 'addthis_late_widget', 14);
|
1064 |
}
|
1065 |
+
elseif ($display)
|
1066 |
+
$below = apply_filters('addthis_below_content','' );
|
1067 |
else
|
1068 |
$below = '';
|
1069 |
|
1099 |
|
1100 |
$script = "\n<!-- AddThis Button Begin -->\n"
|
1101 |
.'<script type="text/javascript">'
|
1102 |
+
."var addthis_product = 'wpp-252';\n";
|
1103 |
+
|
1104 |
|
1105 |
+
$pub = (isset($options['profile'])) ? $options['profile'] : false ;
|
1106 |
if (!$pub) {
|
1107 |
$pub = 'wp-'.cuid();
|
1108 |
}
|
1139 |
$script .= '</script>';
|
1140 |
|
1141 |
|
1142 |
+
$script .= '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid='.$pub.'"></script>';
|
1143 |
|
1144 |
echo $script;
|
1145 |
}
|
1290 |
}
|
1291 |
|
1292 |
$addthis_default_options = array(
|
1293 |
+
'profile' => '',
|
1294 |
'username' => '',
|
1295 |
'password' => '',
|
1296 |
'style' => addthis_style_default ,
|
1309 |
'addthis_header_background' => '',
|
1310 |
'addthis_header_color' => '',
|
1311 |
'addthis_options' => '',
|
1312 |
+
'addthis_showonexcerpts' => true,
|
1313 |
+
'above_custom_size' => '',
|
1314 |
+
'above_custom_services' => '',
|
1315 |
+
'above_custom_preferred' => '',
|
1316 |
+
'above_custom_more' => '',
|
1317 |
+
'below_custom_size' => '',
|
1318 |
+
'below_custom_services' => '',
|
1319 |
+
'below_custom_preferred' => '',
|
1320 |
+
'below_custom_more' => '',
|
1321 |
);
|
1322 |
|
1323 |
function addthis_plugin_options_php4() {
|
1324 |
+
|
1325 |
global $addthis_styles;
|
1326 |
global $addthis_languages;
|
1327 |
global $addthis_settings;
|
1348 |
|
1349 |
$addthis_options = get_option('addthis_settings');
|
1350 |
foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
|
1351 |
+
{
|
1352 |
if ( $addthis_options && ! isset($addthis_options[$option]) )
|
1353 |
$addthis_options[$option] = false;
|
1354 |
}
|
1381 |
}
|
1382 |
echo "<p class='above_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[above]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
|
1383 |
}
|
1384 |
+
|
1385 |
+
$class = 'hidden';
|
1386 |
+
$checked = '';
|
1387 |
+
if ($above == 'custom' || ($above == 'none' && 'custom' == $addthis_default_options['above'] ) ){
|
1388 |
+
$checked = 'checked="checked"';
|
1389 |
+
$class = '';
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
echo "<div class='above_option select_row $class '><input $checked type='radio' value='custom' name='addthis_settings[above]' id='above_custom_button' /> Custom / Build your own</input>";
|
1393 |
+
|
1394 |
+
echo "<ul class='above_option_custom hidden'>";
|
1395 |
+
$above_custom_16 = ($above_custom_size == 16) ? 'selected="selected"' : '' ;
|
1396 |
+
$above_custom_32 = ($above_custom_size == 32) ? 'selected="selected"' : '' ;
|
1397 |
+
$above_do_custom_services = ($above_do_custom_services) ? 'checked="checked"' : '';
|
1398 |
+
$above_do_custom_preferred = ($above_do_custom_preferred) ? 'checked="checked"' : '';
|
1399 |
+
|
1400 |
+
echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[above_custom_size]'><option value='16' $above_custom_16 >16x16</option><option value='32' $above_custom_32 >32x32</option></select><br/><span class='description'>The size of the icons you want to display</span></li>";
|
1401 |
+
echo "<li><input $above_do_custom_services class='at_do_custom' type='checkbox' name='addthis_settings[above_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[above_custom_services]' value='$above_custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='http://addthis.com/services'>service codes</a> </span></li>";
|
1402 |
+
echo "<li><input type='checkbox' $above_do_custom_preferred class='at_do_custom' name='addthis_settings[above_do_custom_preferred]' value='true' /><span class='at_custom_label'>Auto Personalized:</span>
|
1403 |
+
<select name='addthis_settings[above_custom_preferred]' class='at_custom_input'>";
|
1404 |
+
for($i=0; $i <= 11; $i++)
|
1405 |
+
{
|
1406 |
+
$selected = '';
|
1407 |
+
if ($above_custom_preferred == $i)
|
1408 |
+
$selected = 'selected="selected"';
|
1409 |
+
|
1410 |
+
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
|
1411 |
+
|
1412 |
+
}
|
1413 |
+
echo "</select><br/><span class='description'>Enter the number of automatticly user personalized items you want displayed</span></li>";
|
1414 |
+
$above_custom_more = ( $above_custom_more ) ? 'checked="checked"' : '';
|
1415 |
+
|
1416 |
+
echo "<li><input $above_custom_more type='checkbox' class='at_do_custom' name='addthis_settings[above_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic orange plus sign that offers sharing to over 300 destinations</span></li>";
|
1417 |
+
echo "</ul></div>";
|
1418 |
+
|
1419 |
?>
|
1420 |
+
|
1421 |
+
|
1422 |
<a class="above_option" href="#above_more" id="above_more">addtional style options</a>
|
1423 |
</td>
|
1424 |
</tr>
|
1434 |
$checked = 'checked="checked"';
|
1435 |
$class = '';
|
1436 |
}
|
1437 |
+
|
1438 |
+
echo "<p class='below_option select_row $class '><input $checked type='radio' value='".$k."' name='addthis_settings[below]' /><img alt='".$k."' src='".plugins_url( '/addthis/img/' . $v['img'], basename(dirname(__FILE__)) ) ."'/></p>";
|
1439 |
+
}
|
1440 |
+
$class = 'hidden';
|
1441 |
+
$checked = '';
|
1442 |
+
if ($below == 'custom' || ($below == 'none' && 'custom' == $addthis_default_options['below'] ) ){
|
1443 |
+
$checked = 'checked="checked"';
|
1444 |
+
$class = '';
|
1445 |
+
}
|
1446 |
+
echo "<div class='below_option select_row $class '><input $checked type='radio' value='custom' name='addthis_settings[below]' id='below_custom_button' /> Custom / Build your own</input>";
|
1447 |
+
|
1448 |
+
echo "<ul class='below_option_custom hidden'>";
|
1449 |
+
$below_custom_16 = ($below_custom_size == 16) ? 'selected="selected"' : '' ;
|
1450 |
+
$below_custom_32 = ($below_custom_size == 32) ? 'selected="selected"' : '' ;
|
1451 |
+
$below_do_custom_services = ($below_do_custom_services) ? 'checked="checked"' : '';
|
1452 |
+
$below_do_custom_preferred = ($below_do_custom_preferred) ? 'checked="checked"' : '';
|
1453 |
+
|
1454 |
+
echo "<li class='nocheck'><span class='at_custom_label'>Size:</span><select name='addthis_settings[below_custom_size]'><option value='16' $below_custom_16 >16x16</option><option value='32' $below_custom_32 >32x32</option></select><br/><span class='description'>The size of the icons you want to display</span></li>";
|
1455 |
+
echo "<li><input class='at_do_custom' type='checkbox' $below_do_custom_services name='addthis_settings[below_do_custom_services]' value='true' /><span class='at_custom_label'>Services to always show:</span><input class='at_custom_input' name='addthis_settings[below_custom_services]' value='$below_custom_services'/><br/><span class='description'>Enter a comma-separated list of <a href='http://addthis.com/services'>service codes</a> </span></li>";
|
1456 |
+
echo "<li><input type='checkbox' class='at_do_custom' $below_do_custom_preferred name='addthis_settings[below_do_custom_preferred]' value='true' /><span class='at_custom_label'>Auto Personalized:</span>
|
1457 |
+
<select name='addthis_settings[below_custom_preferred]' class='at_custom_input'>";
|
1458 |
+
for($i=0; $i <= 11; $i++)
|
1459 |
+
{
|
1460 |
+
$selected = '';
|
1461 |
+
if ($below_custom_preferred == $i)
|
1462 |
+
$selected = 'selected="selected"';
|
1463 |
+
|
1464 |
+
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
|
1465 |
+
|
1466 |
+
}
|
1467 |
+
echo "</select><br/><span class='description'>Enter the number of automatticly user personalized items you want displayed</span></li>";
|
1468 |
+
|
1469 |
+
$below_custom_more = ($below_custom_more) ? 'checked="checked""' : '';
|
1470 |
+
|
1471 |
+
echo "<li><input $below_custom_more type='checkbox' class='at_do_custom' name='addthis_settings[below_custom_more]' value='true' /><span class='at_custom_label'>More</span><br/><span class='description'>Display our iconic orange plus sign that offers sharing to over 300 destinations</span></li>";
|
1472 |
+
echo "</ul></div>";
|
1473 |
+
|
1474 |
?>
|
1475 |
<a class="below_option" href="#below_more" id="below_more">additional style options</a>
|
1476 |
</td>
|
1477 |
</tr>
|
1478 |
<tr valign="top">
|
1479 |
+
<td colspan="2"><?php _e('Enter a profile, username and password to discover how your content is being shared, and how your most influential audience members are bringing traffic back to your site. Learn what interests them – and to what degree – and how thoses interests are driving sharing. <a href="http://addthis.com/features" target="_blank">Click here for more information on the benefits of register</a>.<a href="http://www.addthis.com/help/faq#accounts" target="_blank">Click here for more information on usernames and profiles</a> ', 'addthis_trans_domain');?> </td>
|
1480 |
+
</tr>
|
1481 |
+
<tr valign="top">
|
1482 |
+
<th scope="row"><?php _e("AddThis profile id:", 'addthis_trans_domain' ); ?></th>
|
1483 |
+
<td><input id="addthis_profile" type="text" name="addthis_settings[addthis_profile]" value="<?php echo $profile; ?>" autofill='off' autocomplete='off' /></td>
|
1484 |
</tr>
|
1485 |
<tr valign="top">
|
1486 |
<th scope="row"><?php _e("AddThis username:", 'addthis_trans_domain' ); ?></th>
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
=== AddThis ===
|
2 |
Contributors: _mjk_, jorbin
|
3 |
-
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.1.0
|
6 |
-
Stable tag: 2.0.
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
@@ -74,6 +74,18 @@ PHP 5+ is preferred; PHP 4 is supported.
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
= 2.0.1 =
|
78 |
* Fix theme compatablity issues
|
79 |
* Fix excerpts bug
|
1 |
+
=== AddThis featuring Sharing Buttons / Facebook Like / Tweet Button ===
|
2 |
Contributors: _mjk_, jorbin
|
3 |
+
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.1.0
|
6 |
+
Stable tag: 2.0.2
|
7 |
|
8 |
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
|
9 |
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 2.0.2 =
|
78 |
+
* Bug Fixes
|
79 |
+
* set addthis_exclude custom field to 'true' to not display addthis on that post / page
|
80 |
+
* Added additional paramater to
|
81 |
+
* Ability to specify custom toolboxes for both above and below
|
82 |
+
* Added additional paramater to do_action('addthis_widget'). Paramaters are now:
|
83 |
+
* * url (use get_permalink() if you are calling it inside the loop)
|
84 |
+
* * title (use the_title() if calling inside the loop)
|
85 |
+
* * Style (specify the style to display) See $addthis_new_styles for the styles. may also pass an arra (see addthis_custom_toolbox for array values to pass)
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
= 2.0.1 =
|
90 |
* Fix theme compatablity issues
|
91 |
* Fix excerpts bug
|