AddToAny Share Buttons - Version 0.9.9.9.2

Version Description

Download this release

Release Info

Developer micropat
Plugin Icon 128x128 AddToAny Share Buttons
Version 0.9.9.9.2
Comparing to
See all releases

Code changes from version 0.9.9.9.1 to 0.9.9.9.2

Files changed (2) hide show
  1. README.txt +11 -2
  2. add-to-any.php +107 -16
README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: micropat
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, widget, email, e-mail, seo, button, delicious, google buzz, buzz, google, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus one, plus one, messenger, stumbleupon, technorati, addthis, sexybookmarks, sociable, sharedaddy, icon, icons, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.2
6
- Stable tag: 0.9.9.9.1
7
 
8
  Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google, StumbleUpon, Digg and many more.
9
 
@@ -159,12 +159,16 @@ To change the title, description and/or image on Facebook, you will need to modi
159
 
160
  For more technical information on setting your pages up for Facebook sharing, see "Step 2 - Get Open Graph Tags" in <a href="http://developers.facebook.com/docs/reference/plugins/like/">Facebook's documentation</a>.
161
 
162
- = Why does the Facebook Like Button have so much whitespace to the right of it? =
163
 
164
  The minimum width for the Facebook Like Button is 90 pixels. This is required to display the total number of Likes to the right of the button. See Facebook's <a href="http://developers.facebook.com/docs/reference/plugins/like">Like Button documentation</a> for details.
165
 
166
  It's not recommended, but you can change the width of the Facebook Like Button using CSS code, for instance: `.facebook_like { width:50px !important; }`
167
 
 
 
 
 
168
  = Does the plugin output W3C valid code? =
169
 
170
  Yes, AddToAny outputs 100% W3C valid XHTML & HTML5 and W3C valid CSS 3.0 by default.
@@ -205,6 +209,11 @@ Upload the plugin directory (including all files and directories within) to the
205
 
206
  == Changelog ==
207
 
 
 
 
 
 
208
  = .9.9.9.1 =
209
  * Major fixes
210
  * Fix execution of Additional Options
3
  Tags: sharing, share, sharethis, bookmarking, social, social bookmarking, social bookmarks, bookmark, bookmarks, save, Post, posts, page, pages, images, image, admin, statistics, stats, links, plugin, widget, email, e-mail, seo, button, delicious, google buzz, buzz, google, digg, reddit, facebook, facebook like, like, myspace, twitter, tweet, +1, plus 1, google plus one, plus one, messenger, stumbleupon, technorati, addthis, sexybookmarks, sociable, sharedaddy, icon, icons, wpmu, addtoany
4
  Requires at least: 2.8
5
  Tested up to: 3.2
6
+ Stable tag: 0.9.9.9.2
7
 
8
  Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google, StumbleUpon, Digg and many more.
9
 
159
 
160
  For more technical information on setting your pages up for Facebook sharing, see "Step 2 - Get Open Graph Tags" in <a href="http://developers.facebook.com/docs/reference/plugins/like/">Facebook's documentation</a>.
161
 
162
+ = Why does the Facebook Like Button, Twitter Tweet Button, or Google +1 Button have so much whitespace to the right of it? =
163
 
164
  The minimum width for the Facebook Like Button is 90 pixels. This is required to display the total number of Likes to the right of the button. See Facebook's <a href="http://developers.facebook.com/docs/reference/plugins/like">Like Button documentation</a> for details.
165
 
166
  It's not recommended, but you can change the width of the Facebook Like Button using CSS code, for instance: `.facebook_like { width:50px !important; }`
167
 
168
+ The Twitter Tweet Button with 'total count' enabled is 130 pixels. You can change the width using CSS code, for instance: `.twitter_tweet { width:100px !important; }`
169
+
170
+ The Google +1 Button with 'total count' enabled is 90 pixels. You can change the width using CSS code, for instance: `.google_plusone { width:65px !important; }`
171
+
172
  = Does the plugin output W3C valid code? =
173
 
174
  Yes, AddToAny outputs 100% W3C valid XHTML & HTML5 and W3C valid CSS 3.0 by default.
209
 
210
  == Changelog ==
211
 
212
+ = .9.9.9.2 =
213
+ * Facebook Like Button can be changed to Facebook Recommend Button (verb/action)
214
+ * Twitter Tweet Button count (optional - see FAQ for width adjustment)
215
+ * Google +1 Button count (optional - see FAQ for width adjustment)
216
+
217
  = .9.9.9.1 =
218
  * Major fixes
219
  * Fix execution of Additional Options
add-to-any.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AddToAny: Share/Bookmark/Email Buttons
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google, StumbleUpon, Digg and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
- Version: .9.9.9.1
7
  Author: AddToAny
8
  Author URI: http://www.addtoany.com/
9
  */
@@ -324,6 +324,8 @@ function ADDTOANY_SHARE_SAVE_BUTTON( $args = array() ) {
324
  function ADDTOANY_SHARE_SAVE_SPECIAL($special_service_code, $args = array() ) {
325
  // $args array = output_later, linkname, linkurl
326
 
 
 
327
  $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
328
  $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
329
 
@@ -340,12 +342,34 @@ function ADDTOANY_SHARE_SAVE_SPECIAL($special_service_code, $args = array() ) {
340
  . $iframe_template_begin . ' frameborder="0" allowTransparency="true"' . $iframe_template_end
341
  . '<![endif]--><!--[if !IE]><!-->' . $iframe_template . '<!--<![endif]-->';
342
 
343
- if ($special_service_code == 'facebook_like')
344
- $special_html = sprintf($iframe_template, $special_service_code, $http_or_https . '://www.facebook.com/plugins/like.php?href=' . $linkurl_enc . '&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=like&amp;colorscheme=light&amp;height=20&amp;ref=addtoany', 90, 21);
345
- elseif ($special_service_code == 'twitter_tweet')
346
- $special_html = sprintf($iframe_template, $special_service_code, $http_or_https . '://platform.twitter.com/widgets/tweet_button.html?url=' . $linkurl_enc . '&amp;counturl=' . $linkurl_enc . '&amp;count=horizontal&amp;text=' . $linkname_enc, 55, 20);
347
- elseif ($special_service_code == 'google_plusone')
348
- $special_html = sprintf($iframe_template, $special_service_code, 'https://plusone.google.com/u/0/_/%2B1/button#url=' . $linkurl_enc . '&size=medium', 32, 20);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
  if ( $output_later )
351
  return $special_html;
@@ -826,7 +850,18 @@ function A2A_SHARE_SAVE_options_page() {
826
  $active_services[] = substr($sitename, 7);
827
  $new_options['active_services'] = $active_services;
828
 
829
- update_option('addtoany_options', $new_options);
 
 
 
 
 
 
 
 
 
 
 
830
 
831
  ?>
832
  <div class="updated fade"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
@@ -1154,9 +1189,19 @@ function A2A_SHARE_SAVE_admin_head() {
1154
  services_size = services_array.length;
1155
  if(services_size<1) return;
1156
 
1157
- for(var i=0;i<services_size;i++){
1158
- if(services_array[i]!='') // Exclude dummy icon
1159
  jQuery('form:first').append('<input name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+services_array[i]+'"/>');
 
 
 
 
 
 
 
 
 
 
1160
  }
1161
  };
1162
 
@@ -1171,19 +1216,46 @@ function A2A_SHARE_SAVE_admin_head() {
1171
 
1172
  // Service click = move to sortable list
1173
  var moveToSortableList = function(){
1174
- if( jQuery('#addtoany_services_sortable li').not('.dummy').length==0 )
 
 
 
 
 
 
1175
  jQuery('#addtoany_services_sortable').find('.dummy').hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1176
 
1177
- jQuery(this).toggleClass('addtoany_selected')
1178
  .unbind('click', moveToSortableList)
1179
  .bind('click', moveToSelectableList)
1180
  .clone()
1181
- .html( jQuery(this).find('img').clone().attr('alt', jQuery(this).attr('title')) )
 
 
 
1182
  .hide()
1183
  .insertBefore('#addtoany_services_sortable .dummy')
1184
  .fadeIn('fast');
1185
 
1186
- jQuery(this).attr( 'id', 'old_'+jQuery(this).attr('id') );
1187
  };
1188
 
1189
  // Service click again = move back to selectable list
@@ -1229,7 +1301,22 @@ function A2A_SHARE_SAVE_admin_head() {
1229
  $active_services_quoted .= ',';
1230
  }
1231
  ?>
1232
- var services = [<?php echo $active_services_quoted; ?>];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1233
  jQuery.each(services, function(i, val){
1234
  jQuery('#a2a_wp_'+val).click();
1235
  });
@@ -1271,7 +1358,11 @@ function A2A_SHARE_SAVE_admin_head() {
1271
  #addtoany_services_sortable li:hover{border:1px solid #AAA;background-color:#FFF;}
1272
  #addtoany_services_sortable li.dummy, #addtoany_services_sortable li.dummy:hover{cursor:auto;background-color:transparent;}
1273
  #addtoany_services_sortable img{width:16px;height:16px;border:0;vertical-align:middle;}
1274
- #addtoany_services_sortable .addtoany_special_service img{width:auto;height:20px;}
 
 
 
 
1275
 
1276
  li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;}
1277
  li#addtoany_show_services:hover{border:1px solid #AAA;}
3
  Plugin Name: AddToAny: Share/Bookmark/Email Buttons
4
  Plugin URI: http://www.addtoany.com/
5
  Description: Help people share, bookmark, and email your posts & pages using any service, such as Facebook, Twitter, Google, StumbleUpon, Digg and many more. [<a href="options-general.php?page=add-to-any.php">Settings</a>]
6
+ Version: .9.9.9.2
7
  Author: AddToAny
8
  Author URI: http://www.addtoany.com/
9
  */
324
  function ADDTOANY_SHARE_SAVE_SPECIAL($special_service_code, $args = array() ) {
325
  // $args array = output_later, linkname, linkurl
326
 
327
+ $options = get_option('addtoany_options');
328
+
329
  $linkname = (isset($args['linkname'])) ? $args['linkname'] : FALSE;
330
  $linkurl = (isset($args['linkurl'])) ? $args['linkurl'] : FALSE;
331
 
342
  . $iframe_template_begin . ' frameborder="0" allowTransparency="true"' . $iframe_template_end
343
  . '<![endif]--><!--[if !IE]><!-->' . $iframe_template . '<!--<![endif]-->';
344
 
345
+ if ($special_service_code == 'facebook_like') {
346
+ if ($options['special_facebook_like_options']['verb'] == 'recommend') {
347
+ $action_param_value = 'recommend';
348
+ } else {
349
+ $action_param_value = 'like';
350
+ }
351
+ $special_html = sprintf($iframe_template, $special_service_code, $http_or_https . '://www.facebook.com/plugins/like.php?href=' . $linkurl_enc . '&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=' . $action_param_value . '&amp;colorscheme=light&amp;height=20&amp;ref=addtoany', 90, 21);
352
+ }
353
+ elseif ($special_service_code == 'twitter_tweet') {
354
+ if ($options['special_twitter_tweet_options']['show_count'] == '1') {
355
+ $count_param_value = 'horizontal';
356
+ $width = 130;
357
+ } else {
358
+ $count_param_value = 'none';
359
+ $width = 55;
360
+ }
361
+ $special_html = sprintf($iframe_template, $special_service_code, $http_or_https . '://platform.twitter.com/widgets/tweet_button.html?url=' . $linkurl_enc . '&amp;counturl=' . $linkurl_enc . '&amp;count=' . $count_param_value . '&amp;text=' . $linkname_enc, $width, 20);
362
+ }
363
+ elseif ($special_service_code == 'google_plusone') {
364
+ if ($options['special_google_plusone_options']['show_count'] == '1') {
365
+ $count_param_value = 'true';
366
+ $width = 90;
367
+ } else {
368
+ $count_param_value = 'false';
369
+ $width = 32;
370
+ }
371
+ $special_html = sprintf($iframe_template, $special_service_code, 'https://plusone.google.com/u/0/_/%2B1/button#url=' . $linkurl_enc . '&size=medium&count=' . $count_param_value, $width, 20);
372
+ }
373
 
374
  if ( $output_later )
375
  return $special_html;
850
  $active_services[] = substr($sitename, 7);
851
  $new_options['active_services'] = $active_services;
852
 
853
+ // Store special service options
854
+ $new_options['special_facebook_like_options'] = array(
855
+ 'verb' => ((@$_POST['addtoany_facebook_like_verb'] == 'recommend') ? 'recommend' : 'like')
856
+ );
857
+ $new_options['special_twitter_tweet_options'] = array(
858
+ 'show_count' => ((@$_POST['addtoany_twitter_tweet_show_count'] == '1') ? '1' : '-1')
859
+ );
860
+ $new_options['special_google_plusone_options'] = array(
861
+ 'show_count' => ((@$_POST['addtoany_google_plusone_show_count'] == '1') ? '1' : '-1')
862
+ );
863
+
864
+ update_option('addtoany_options', $new_options);
865
 
866
  ?>
867
  <div class="updated fade"><p><strong><?php _e('Settings saved.'); ?></strong></p></div>
1189
  services_size = services_array.length;
1190
  if(services_size<1) return;
1191
 
1192
+ for(var i=0, service_name; i < services_size; i++){
1193
+ if(services_array[i]!='') { // Exclude dummy icon
1194
  jQuery('form:first').append('<input name="A2A_SHARE_SAVE_active_services[]" type="hidden" value="'+services_array[i]+'"/>');
1195
+
1196
+ // Special service options?
1197
+ service_name = services_array[i].substr(7);
1198
+ if (service_name == 'facebook_like' || service_name == 'twitter_tweet' || service_name == 'google_plusone') {
1199
+ if ((service_name == 'twitter_tweet' || service_name == 'google_plusone') && jQuery('#' + services_array[i] + '_show_count').is(':checked'))
1200
+ jQuery('form:first').append('<input name="addtoany_' + service_name + '_show_count" type="hidden" value="1"/>');
1201
+ if ((service_name == 'facebook_like') && jQuery('#' + services_array[i] + '_verb').val() == 'recommend')
1202
+ jQuery('form:first').append('<input name="addtoany_' + service_name + '_verb" type="hidden" value="recommend"/>');
1203
+ }
1204
+ }
1205
  }
1206
  };
1207
 
1216
 
1217
  // Service click = move to sortable list
1218
  var moveToSortableList = function(){
1219
+ var configurable_html = '',
1220
+ this_service = jQuery(this),
1221
+ this_service_name = this_service.attr('id').substr(7),
1222
+ checked = '',
1223
+ special_options = '';
1224
+
1225
+ if (jQuery('#addtoany_services_sortable li').not('.dummy').length == 0)
1226
  jQuery('#addtoany_services_sortable').find('.dummy').hide();
1227
+
1228
+ if (this_service.hasClass('addtoany_special_service')) {
1229
+ if (this_service_name == 'facebook_like') {
1230
+ if (service_options[this_service_name] && service_options[this_service_name].verb)
1231
+ checked = ' selected="selected"';
1232
+ special_options_html = '<select id="' + this_service.attr('id') + '_verb" name="' + this_service.attr('id') + '_verb">'
1233
+ + '<option value="like">Like</option>'
1234
+ + '<option' + checked + ' value="recommend">Recommend</option>'
1235
+ + '</select>';
1236
+ } else {
1237
+ // twitter_tweet & google_plusone
1238
+ if (service_options[this_service_name] && service_options[this_service_name].show_count)
1239
+ checked = ' checked="checked"';
1240
+ 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>';
1241
+ }
1242
+
1243
+ configurable_html = '<span class="down_arrow"></span><br style="clear:both"/><div class="special_options">' + special_options_html + '</div>';
1244
+ }
1245
 
1246
+ this_service.toggleClass('addtoany_selected')
1247
  .unbind('click', moveToSortableList)
1248
  .bind('click', moveToSelectableList)
1249
  .clone()
1250
+ .html( this_service.find('img').clone().attr('alt', this_service.attr('title')) ).append(configurable_html)
1251
+ .click(function(){
1252
+ jQuery(this).not('.addtoany_special_service_options_selected').find('.special_options').slideDown('fast').parent().addClass('addtoany_special_service_options_selected');
1253
+ })
1254
  .hide()
1255
  .insertBefore('#addtoany_services_sortable .dummy')
1256
  .fadeIn('fast');
1257
 
1258
+ this_service.attr( 'id', 'old_'+this_service.attr('id') );
1259
  };
1260
 
1261
  // Service click again = move back to selectable list
1301
  $active_services_quoted .= ',';
1302
  }
1303
  ?>
1304
+ var services = [<?php echo $active_services_quoted; ?>],
1305
+ service_options = {};
1306
+
1307
+ <?php
1308
+ // Special service options
1309
+ if ( $_POST['addtoany_facebook_like_verb'] == 'recommend' || $options['special_facebook_like_options']['verb'] == 'recommend') {
1310
+ ?>service_options.facebook_like = {verb: 'recommend'};<?php
1311
+ }
1312
+ if ( $_POST['addtoany_twitter_tweet_show_count'] == '1' || $options['special_twitter_tweet_options']['show_count'] == '1') {
1313
+ ?>service_options.twitter_tweet = {show_count: 1};<?php
1314
+ }
1315
+ if ( $_POST['addtoany_google_plusone_show_count'] == '1' || $options['special_google_plusone_options']['show_count'] == '1') {
1316
+ ?>service_options.google_plusone = {show_count: 1};<?php
1317
+ }
1318
+ ?>
1319
+
1320
  jQuery.each(services, function(i, val){
1321
  jQuery('#a2a_wp_'+val).click();
1322
  });
1358
  #addtoany_services_sortable li:hover{border:1px solid #AAA;background-color:#FFF;}
1359
  #addtoany_services_sortable li.dummy, #addtoany_services_sortable li.dummy:hover{cursor:auto;background-color:transparent;}
1360
  #addtoany_services_sortable img{width:16px;height:16px;border:0;vertical-align:middle;}
1361
+ #addtoany_services_sortable .addtoany_special_service img{width:auto;height:20px;float:left;}
1362
+ #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;}
1363
+ #addtoany_services_sortable .addtoany_special_service div.special_options{display:none;font-size:11px;margin-top:9px;}
1364
+ #addtoany_services_sortable .addtoany_special_service_options_selected{border:1px solid #AAA;background-color:#FFF;}
1365
+ #addtoany_services_sortable .addtoany_special_service_options_selected span.down_arrow{display:none;}
1366
 
1367
  li#addtoany_show_services{border:1px solid #DFDFDF;background-color:#FFF;cursor:pointer;}
1368
  li#addtoany_show_services:hover{border:1px solid #AAA;}