Woocommerce Social Media Share Buttons - Version 1.2.0

Version Description

Added open graph option to help sharing settings.

=

Download this release

Release Info

Developer toastiestudio
Plugin Icon 128x128 Woocommerce Social Media Share Buttons
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.4 to 1.2.0

Files changed (3) hide show
  1. README.txt +4 -2
  2. img/Thumbs.db +0 -0
  3. index.php +44 -10
README.txt CHANGED
@@ -5,8 +5,8 @@ Contributors: Toastie Studio
5
  Tags: facebook, twitter, pinterest, google plus, linkedin, tumblr, stumbleupon, share button, social media buttons, social media share buttons, woocommerce, woocommerce social media share buttons, horizontal, vertical, social icons.
6
  Requires at least:3.5
7
 
8
- Tested up to:4.2.4
9
- Stable tag: 4.2.4
10
  License: GPLv2 or later
11
 
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -103,6 +103,8 @@ https://help.instagram.com/158826297591430
103
  = 1.1.1 = Small CSS fix
104
  = 1.1.2 = Small CSS fix
105
  = 1.1.3 = Shortcode placement fix
 
 
106
 
107
 
108
 
5
  Tags: facebook, twitter, pinterest, google plus, linkedin, tumblr, stumbleupon, share button, social media buttons, social media share buttons, woocommerce, woocommerce social media share buttons, horizontal, vertical, social icons.
6
  Requires at least:3.5
7
 
8
+ Tested up to:4.3.1
9
+ Stable tag: 4.3.1
10
  License: GPLv2 or later
11
 
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
103
  = 1.1.1 = Small CSS fix
104
  = 1.1.2 = Small CSS fix
105
  = 1.1.3 = Shortcode placement fix
106
+ = 1.1.4 = Small CSS fix
107
+ = 1.2.0 = Added open graph option to help sharing settings.
108
 
109
 
110
 
img/Thumbs.db ADDED
Binary file
index.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin Name: WooCommerce Social Media Share Buttons
4
  * Plugin URI: http://www.toastiestudio.com
5
  * Description: The Woocommerce Social Media Share Buttons plugin allows visitors to your woocommerce shop to easily share your products on popular social media platforms.
6
- * Version: 1.1.4
7
  * Author: Toastie Studio
8
  * Author URI: http://www.toastiestudio.com
9
  * Requires at least: 3.5
10
- * Tested up to: 4.2
11
  * Text Domain: woocommerce-social-media-share-buttons
12
  * Domain Path: /lang
13
  *
@@ -46,8 +46,8 @@ function toastie_wc_smsb_li_reg_like_settings() {
46
  register_setting('toastie_wc_share_like', 'toastie_smsb_vk');
47
  register_setting('toastie_wc_share_like', 'toastie_smsb_em');
48
  register_setting('toastie_wc_share_like', 'toastie_smsb_format');
 
49
  }
50
-
51
  if (is_admin()) {
52
  add_action('admin_init', 'toastie_wc_smsb_li_reg_like_settings');
53
  }
@@ -61,6 +61,7 @@ add_option('toastie_smsb_st', 'true');
61
  add_option('toastie_smsb_vk', 'true');
62
  add_option('toastie_smsb_em', 'true');
63
  add_option('toastie_smsb_format', 'button');
 
64
 
65
  function toastie_wc_smsb_form_code() {
66
  global $post;
@@ -76,7 +77,7 @@ function toastie_wc_smsb_form_code() {
76
  $social_val.='<span class="smsb_googleplus nocount"><span class="g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span></span>';
77
  }
78
  if (get_option('toastie_smsb_pi') == 'true') {
79
- $social_val.='<span class="smsb_pinterest nocount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-color="red" >
80
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
81
  }
82
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -108,7 +109,7 @@ function toastie_wc_smsb_form_code() {
108
  $social_val.='<span class="smsb_googleplus hcount"><span class="g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
109
  }
110
  if (get_option('toastie_smsb_pi') == 'true') {
111
- $social_val.='<span class="smsb_pinterest hcount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-config="beside" data-pin-color="red" >
112
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
113
  }
114
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -140,7 +141,7 @@ function toastie_wc_smsb_form_code() {
140
  $social_val.='<span class="smsb_googleplus vcount"><span class="g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
141
  }
142
  if (get_option('toastie_smsb_pi') == 'true') {
143
- $social_val.='<span class="smsb_pinterest vcount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-config="above" data-pin-color="red" >
144
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
145
  }
146
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -177,7 +178,7 @@ function toastie_wc_smsb_form_short_code() {
177
  $social_val.='<span class="smsb_googleplus nocount"><span class="g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span></span>';
178
  }
179
  if (get_option('toastie_smsb_pi') == 'true') {
180
- $social_val.='<span class="smsb_pinterest nocount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-color="red" >
181
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
182
  }
183
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -209,7 +210,7 @@ function toastie_wc_smsb_form_short_code() {
209
  $social_val.='<span class="smsb_googleplus hcount"><span class="g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
210
  }
211
  if (get_option('toastie_smsb_pi') == 'true') {
212
- $social_val.='<span class="smsb_pinterest hcount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-config="beside" data-pin-color="red" >
213
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
214
  }
215
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -241,7 +242,7 @@ function toastie_wc_smsb_form_short_code() {
241
  $social_val.='<span class="smsb_googleplus vcount"><span class="g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
242
  }
243
  if (get_option('toastie_smsb_pi') == 'true') {
244
- $social_val.='<span class="smsb_pinterest vcount"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-config="above" data-pin-color="red" >
245
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
246
  }
247
  if (get_option('toastie_smsb_tu') == 'true') {
@@ -270,6 +271,7 @@ add_action('woocommerce_single_product_summary', 'toastie_wc_smsb_form_code', 31
270
  add_action('admin_menu', 'toastie_wc_smsb_social_menu');
271
  add_action('wp_footer', 'toastie_wc_smsb_social_footer');
272
  load_plugin_textdomain( 'woocommerce-social-media-share-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
 
273
 
274
  function toastie_wc_smsb_social_menu() {
275
  add_menu_page('Woocommerce Social Media Share Button Page', 'Share Buttons', 'manage_options', 'Woocommerce-social-media-share-button-plugin', 'toastie_wc_smsb_social_init', plugins_url('/img/woo_16.png', __FILE__));
@@ -293,6 +295,29 @@ function toastie_wc_smsb_social_footer() {
293
  </style>";
294
  }
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  function toastie_wc_smsb_social_init() {
297
  $submited = 0;
298
  if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Submit'])) {
@@ -307,6 +332,7 @@ function toastie_wc_smsb_social_init() {
307
  $smsb_vk = sanitize_text_field($_REQUEST['smsb_vk']);
308
  $smsb_em = sanitize_text_field($_REQUEST['smsb_em']);
309
  $smsb_format = sanitize_text_field($_REQUEST['smsb_format']);
 
310
  update_option('toastie_smsb_fb', $smsb_fb);
311
  update_option('toastie_smsb_tw', $smsb_tw);
312
  update_option('toastie_smsb_gp', $smsb_gp);
@@ -317,6 +343,7 @@ function toastie_wc_smsb_social_init() {
317
  update_option('toastie_smsb_vk', $smsb_vk);
318
  update_option('toastie_smsb_em', $smsb_em);
319
  update_option('toastie_smsb_format', $smsb_format);
 
320
  $submited = 1;
321
  }
322
  ?>
@@ -360,7 +387,7 @@ function toastie_wc_smsb_social_init() {
360
  <label> <input type="checkbox" name="smsb_em" value="true" <?php echo (get_option('toastie_smsb_em') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('Email', 'woocommerce-social-media-share-buttons'); ?></span></label>
361
  </fieldset></td>
362
  </tr>
363
- <tr><th><h3 class="smsb_optionheader" ><?php _e("What format do you want the share buttons?", "woocommerce-social-media-share-buttons"); ?></h3></th></tr>
364
  <tr valign="top">
365
  <td><fieldset>
366
  <img src="<? echo plugins_url( 'img/smsb_formatoptions.png', __FILE__ );?>" alt="Format Options"/><br/>
@@ -374,6 +401,13 @@ function toastie_wc_smsb_social_init() {
374
  <?php _e('Note: Some buttons do not show the share count until the url has been shared atleast once. Email does not show the share count at all.', 'woocommerce-social-media-share-buttons'); ?>
375
  </td>
376
  </tr>
 
 
 
 
 
 
 
377
  </table>
378
  <p>&nbsp;</p>
379
  <p><input type="submit" name="Submit" class="smsb_button" value="<?php _e("Save Settings", "woocommerce-social-media-share-buttons"); ?>"></p>
3
  * Plugin Name: WooCommerce Social Media Share Buttons
4
  * Plugin URI: http://www.toastiestudio.com
5
  * Description: The Woocommerce Social Media Share Buttons plugin allows visitors to your woocommerce shop to easily share your products on popular social media platforms.
6
+ * Version: 1.2.0
7
  * Author: Toastie Studio
8
  * Author URI: http://www.toastiestudio.com
9
  * Requires at least: 3.5
10
+ * Tested up to: 4.3.1
11
  * Text Domain: woocommerce-social-media-share-buttons
12
  * Domain Path: /lang
13
  *
46
  register_setting('toastie_wc_share_like', 'toastie_smsb_vk');
47
  register_setting('toastie_wc_share_like', 'toastie_smsb_em');
48
  register_setting('toastie_wc_share_like', 'toastie_smsb_format');
49
+ register_setting('toastie_wc_share_like', 'toastie_smsb_opengraph');
50
  }
 
51
  if (is_admin()) {
52
  add_action('admin_init', 'toastie_wc_smsb_li_reg_like_settings');
53
  }
61
  add_option('toastie_smsb_vk', 'true');
62
  add_option('toastie_smsb_em', 'true');
63
  add_option('toastie_smsb_format', 'button');
64
+ add_option('toastie_smsb_opengraph', 'false');
65
 
66
  function toastie_wc_smsb_form_code() {
67
  global $post;
77
  $social_val.='<span class="smsb_googleplus nocount"><span class="g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span></span>';
78
  }
79
  if (get_option('toastie_smsb_pi') == 'true') {
80
+ $social_val.='<span class="smsb_pinterest nocount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" null data-pin-color="red" >
81
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
82
  }
83
  if (get_option('toastie_smsb_tu') == 'true') {
109
  $social_val.='<span class="smsb_googleplus hcount"><span class="g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
110
  }
111
  if (get_option('toastie_smsb_pi') == 'true') {
112
+ $social_val.='<span class="smsb_pinterest hcount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" null data-pin-config="beside" data-pin-color="red" >
113
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
114
  }
115
  if (get_option('toastie_smsb_tu') == 'true') {
141
  $social_val.='<span class="smsb_googleplus vcount"><span class="g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
142
  }
143
  if (get_option('toastie_smsb_pi') == 'true') {
144
+ $social_val.='<span class="smsb_pinterest vcount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-config="above" null data-pin-color="red" >
145
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
146
  }
147
  if (get_option('toastie_smsb_tu') == 'true') {
178
  $social_val.='<span class="smsb_googleplus nocount"><span class="g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span></span>';
179
  }
180
  if (get_option('toastie_smsb_pi') == 'true') {
181
+ $social_val.='<span class="smsb_pinterest nocount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" null data-pin-color="red" >
182
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
183
  }
184
  if (get_option('toastie_smsb_tu') == 'true') {
210
  $social_val.='<span class="smsb_googleplus hcount"><span class="g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
211
  }
212
  if (get_option('toastie_smsb_pi') == 'true') {
213
+ $social_val.='<span class="smsb_pinterest hcount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" null data-pin-config="beside" data-pin-color="red" >
214
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
215
  }
216
  if (get_option('toastie_smsb_tu') == 'true') {
242
  $social_val.='<span class="smsb_googleplus vcount"><span class="g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span></span>';
243
  }
244
  if (get_option('toastie_smsb_pi') == 'true') {
245
+ $social_val.='<span class="smsb_pinterest vcount"><a href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" null data-pin-config="above" data-pin-color="red" >
246
  <img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_red_20.png" /></a><script type="text/javascript" async defer src="//assets.pinterest.com/js/pinit.js"></script></span>';
247
  }
248
  if (get_option('toastie_smsb_tu') == 'true') {
271
  add_action('admin_menu', 'toastie_wc_smsb_social_menu');
272
  add_action('wp_footer', 'toastie_wc_smsb_social_footer');
273
  load_plugin_textdomain( 'woocommerce-social-media-share-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
274
+ if (get_option('toastie_smsb_opengraph') == 'true') { add_action('wp_head', 'toastie_wc_smsb_social_meta'); };
275
 
276
  function toastie_wc_smsb_social_menu() {
277
  add_menu_page('Woocommerce Social Media Share Button Page', 'Share Buttons', 'manage_options', 'Woocommerce-social-media-share-button-plugin', 'toastie_wc_smsb_social_init', plugins_url('/img/woo_16.png', __FILE__));
295
  </style>";
296
  }
297
 
298
+ function toastie_wc_smsb_social_meta() {
299
+ echo '<!-- Open Graph data -->
300
+ <meta property="og:title" content="'.get_the_title($post->ID).'" />
301
+ <meta property="og:type" content="website" />
302
+ <meta property="og:url" content="'.get_permalink($post->ID).'" />
303
+ <meta property="og:image" content="'.wp_get_attachment_url( get_post_thumbnail_id() ).'" />
304
+ <meta property="og:description" content="'.get_the_title($post->ID).'" />
305
+ <meta property="og:site_name" content="'.get_bloginfo( 'name', 'display' ).'"/>
306
+
307
+ <!-- Twitter Card data -->
308
+ <meta name="twitter:card" content="summary">
309
+ <meta name="twitter:title" content="'.get_the_title($post->ID).'">
310
+ <meta name="twitter:description" content="'.get_the_title($post->ID).'">
311
+ <!-- Twitter Summary card images must be at least 120x120px -->
312
+ <meta name="twitter:image" content="'.wp_get_attachment_url( get_post_thumbnail_id() ).'">
313
+
314
+ <!-- Schema.org markup for Google+ -->
315
+ <meta itemprop="name" content="'.get_the_title($post->ID).'">
316
+ <meta itemprop="description" content="'.get_the_title($post->ID).'">
317
+ <meta itemprop="image" content="'.wp_get_attachment_url( get_post_thumbnail_id() ).'">
318
+ ';
319
+ };
320
+
321
  function toastie_wc_smsb_social_init() {
322
  $submited = 0;
323
  if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Submit'])) {
332
  $smsb_vk = sanitize_text_field($_REQUEST['smsb_vk']);
333
  $smsb_em = sanitize_text_field($_REQUEST['smsb_em']);
334
  $smsb_format = sanitize_text_field($_REQUEST['smsb_format']);
335
+ $smsb_opengraph = sanitize_text_field($_REQUEST['smsb_opengraph']);
336
  update_option('toastie_smsb_fb', $smsb_fb);
337
  update_option('toastie_smsb_tw', $smsb_tw);
338
  update_option('toastie_smsb_gp', $smsb_gp);
343
  update_option('toastie_smsb_vk', $smsb_vk);
344
  update_option('toastie_smsb_em', $smsb_em);
345
  update_option('toastie_smsb_format', $smsb_format);
346
+ update_option('toastie_smsb_opengraph', $smsb_opengraph);
347
  $submited = 1;
348
  }
349
  ?>
387
  <label> <input type="checkbox" name="smsb_em" value="true" <?php echo (get_option('toastie_smsb_em') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('Email', 'woocommerce-social-media-share-buttons'); ?></span></label>
388
  </fieldset></td>
389
  </tr>
390
+ <tr><th><h3 class="smsb_optionheader" ><?php _e('What format do you want the share buttons?', 'woocommerce-social-media-share-buttons'); ?></h3></th></tr>
391
  <tr valign="top">
392
  <td><fieldset>
393
  <img src="<? echo plugins_url( 'img/smsb_formatoptions.png', __FILE__ );?>" alt="Format Options"/><br/>
401
  <?php _e('Note: Some buttons do not show the share count until the url has been shared atleast once. Email does not show the share count at all.', 'woocommerce-social-media-share-buttons'); ?>
402
  </td>
403
  </tr>
404
+ <tr valign="top">
405
+ <td><h3 class="smsb_optionheader" ><?php _e('Open Graph Settings', 'woocommerce-social-media-share-buttons'); ?></h3>
406
+ <fieldset>
407
+ <label><input type="checkbox" name="smsb_opengraph" value="true" <?php echo (get_option('toastie_smsb_opengraph') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"> <?php _e('Automatically add open graph meta data to site header. ', 'woocommerce-social-media-share-buttons'); ?></span></label>
408
+ </fieldset>
409
+ </td>
410
+ </tr>
411
  </table>
412
  <p>&nbsp;</p>
413
  <p><input type="submit" name="Submit" class="smsb_button" value="<?php _e("Save Settings", "woocommerce-social-media-share-buttons"); ?>"></p>