Woocommerce Social Media Share Buttons - Version 1.0.1

Version Description

Download this release

Release Info

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

Version 1.0.1

README.txt ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Woocommerce Social Media Share Buttons ===
2
+
3
+ Contributors: Toastie Studio
4
+
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.2
9
+ Stable tag: 4.2.2
10
+ License: GPLv2 or later
11
+
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
+
14
+
15
+ The Woocommerce Social Media Share Buttons plugin allows visitors to your webshop to easily share your products on popular social media platforms.
16
+
17
+
18
+
19
+ == Description ==
20
+
21
+
22
+ By default the plugin adds social media share buttons to your woocommerce store products page (just below the 'add to cart' button). With the addition of a shortcode you can use it to add social media share buttons in posts, pages, products, events, widget etc.
23
+
24
+ You can also customize the plugin with the following features:
25
+
26
+ * Pick from 3 layout options, button, button with counter or box with counter.
27
+
28
+ * Select which social media share buttons to display. Pick from:
29
+
30
+ - Facebook
31
+
32
+ - Twitter
33
+
34
+ - Google+
35
+
36
+ - Pinterest
37
+
38
+ - Tumblr
39
+
40
+ - Linkedin
41
+
42
+ - StumbleUpon
43
+
44
+ - Email
45
+
46
+ * Use shortcode to add social media share buttons to posts, pages, products, events etc. [woocommerce_social_media_share_buttons]
47
+
48
+ * Add shortcode to your WordPress theme, or php widget. <?php echo do_shortcode( '[woocommerce_social_media_share_buttons]' ); ?>
49
+
50
+
51
+
52
+
53
+ == Screenshots ==
54
+
55
+
56
+ 1. Woocommerce Social Media Share Buttons Settings
57
+ 2. Woocommerce Social Media Share Buttons Front End
58
+
59
+
60
+
61
+ = Rate Us / Feedback =
62
+
63
+
64
+ Please take the time to let us and others know about your experiences by leaving a review, so that we can improve the plugin for you and other users.
65
+
66
+
67
+
68
+ == Installation ==
69
+
70
+
71
+ 1. Download the Woocommerce Social Media Share Buttons plugin.(woocommerce-social-media-share-buttons.zip file)
72
+ 2. Extract the zip file to the '/wp-content/plugins/' directory.
73
+
74
+ 3. Activate the plugin through the 'Plugins' menu in the WordPress admin area.
75
+ 4. Configur your share buttons via the 'Share Buttons' menu option in the left admin area menu.
76
+
77
+
78
+
79
+ == Frequently Asked Questions ==
80
+
81
+
82
+ = Have questions about Woocommerce Social Media Share Buttons Plugin?
83
+ =
84
+
85
+ Send us an email to toastiestudio@gmail.com and we will try to answer them.
86
+
87
+
88
+
89
+
90
+ == Changelog ==
91
+ = 1.0.0 = First version, no changes
92
+
93
+
94
+
95
+
96
+ == Upgrade Notice ==
97
+
98
+ = 1.0.0 = First version, no upgrades
img/email-share-button.png ADDED
Binary file
img/smsb_formatoptions.png ADDED
Binary file
img/stumbleupon-button.png ADDED
Binary file
img/woo_16.png ADDED
Binary file
index.php ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
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.0.1
7
+ * Author: Toastie Studio
8
+ * Author URI: http://www.toastiestudio.com
9
+ * Requires at least: 3.5
10
+ * Tested up to: 4.2
11
+ *
12
+ * Text Domain: woocommerce-social-media-share-buttons
13
+ * Domain Path: /languages/
14
+ *
15
+ * @author ToastieStudio
16
+ *
17
+ *
18
+ * Copyright 2015 Toastie Studio (email : toastiestudio@gmail.com)
19
+ *
20
+ * This file is part of WooCommerce Social Media Share Buttons
21
+ * plugin for WordPress.
22
+ *
23
+ * WooCommerce Social Media Share Buttons is free software:
24
+ * You can redistribute it and/or modify it under the terms of the
25
+ * GNU General Public License as published by the Free Software
26
+ * Foundation, either version 2 of the License, or (at your option)
27
+ * any later version.
28
+ *
29
+ * WooCommerce Social Media Share Buttons is distributed in the hope that
30
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the
31
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
32
+ * PURPOSE. See the GNU General Public License for more details.
33
+ *
34
+ * You should have received a copy of the GNU General Public License
35
+ * along with WordPress. If not, see <http://www.gnu.org/licenses/>.
36
+ */
37
+
38
+
39
+ function toastie_wc_smsb_li_reg_like_settings() {
40
+ register_setting('toastie_wc_share_like', 'toastie_smsb_fb');
41
+ register_setting('toastie_wc_share_like', 'toastie_smsb_tw');
42
+ register_setting('toastie_wc_share_like', 'toastie_smsb_gp');
43
+ register_setting('toastie_wc_share_like', 'toastie_smsb_pi');
44
+ register_setting('toastie_wc_share_like', 'toastie_smsb_tu');
45
+ register_setting('toastie_wc_share_like', 'toastie_smsb_li');
46
+ register_setting('toastie_wc_share_like', 'toastie_smsb_st');
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
+ }
54
+ add_option('toastie_smsb_fb', 'true');
55
+ add_option('toastie_smsb_tw', 'true');
56
+ add_option('toastie_smsb_gp', 'true');
57
+ add_option('toastie_smsb_pi', 'true');
58
+ add_option('toastie_smsb_tu', 'true');
59
+ add_option('toastie_smsb_li', 'true');
60
+ add_option('toastie_smsb_st', 'true');
61
+ add_option('toastie_smsb_em', 'true');
62
+ add_option('toastie_smsb_format', 'button');
63
+
64
+ function toastie_wc_smsb_form_code() {
65
+ global $post;
66
+ $social_val = '<div class="woo-social-buttons">';
67
+ if (get_option('toastie_smsb_format') == 'button') {
68
+ if (get_option('toastie_smsb_fb') == 'true') {
69
+ $social_val.='<span class="smsb_facebook fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="button"></span>&nbsp;&nbsp;';
70
+ }
71
+ if (get_option('toastie_smsb_tw') == 'true') {
72
+ $social_val.='<span class="smsb_twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a></span>&nbsp;&nbsp;';
73
+ }
74
+ if (get_option('toastie_smsb_gp') == 'true') {
75
+ $social_val.='<span class="smsb_googleplus g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
76
+ }
77
+ if (get_option('toastie_smsb_pi') == 'true') {
78
+ $social_val.='<span class="smsb_pinterest"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-color="red" >
79
+ <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>&nbsp;&nbsp;';
80
+ }
81
+ if (get_option('toastie_smsb_tu') == 'true') {
82
+ $social_val.='<span class="smsb_tumblr"><a class="tumblr-share-button" data-color="blue" data-notes="none" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
83
+ }
84
+ if (get_option('toastie_smsb_li') == 'true') {
85
+ $social_val.='<span class="smsb_linkedin"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share"></script></span>&nbsp;&nbsp;';
86
+ }
87
+ if (get_option('toastie_smsb_st') == 'true') {
88
+ $social_val.='<span class="smsb_stumbleupon" style="position: relative; top: -7px;"><a href="http://www.stumbleupon.com/submit?url=' . get_permalink($post->ID) . '&amp;title='.get_the_title($post->ID).'" target="_blank"><img src="'. plugins_url( 'img/stumbleupon-button.png', __FILE__ ) . '" alt="StumbleUpon" /></a></span>&nbsp;&nbsp;';
89
+ }
90
+ if (get_option('toastie_smsb_em') == 'true') {
91
+ $social_val.='<span class="smsb_email" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
92
+ }
93
+ }
94
+
95
+
96
+ if (get_option('toastie_smsb_format') == 'button_count') {
97
+ if (get_option('toastie_smsb_fb') == 'true') {
98
+ $social_val.='<span class="smsb_facebook hcount fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="button_count"></span>&nbsp;&nbsp;';
99
+ }
100
+ if (get_option('toastie_smsb_tw') == 'true') {
101
+ $social_val.='<span class="smsb_twitter hcount"><a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></span>&nbsp;&nbsp;';
102
+ }
103
+ if (get_option('toastie_smsb_gp') == 'true') {
104
+ $social_val.='<span class="smsb_googleplus hcount g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
105
+ }
106
+ if (get_option('toastie_smsb_pi') == 'true') {
107
+ $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" >
108
+ <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>&nbsp;&nbsp;';
109
+ }
110
+ if (get_option('toastie_smsb_tu') == 'true') {
111
+ $social_val.='<span class="smsb_tumblr hcount"><a class="tumblr-share-button" data-color="blue" data-notes="right" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
112
+ }
113
+ if (get_option('toastie_smsb_li') == 'true') {
114
+ $social_val.='<span class="smsb_linkedin hcount"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share" data-counter="right"></script></span>&nbsp;&nbsp;';
115
+ }
116
+ if (get_option('toastie_smsb_st') == 'true') {
117
+ $social_val.='<span class="smsb_stumbleupon hcount" style="position: relative; top: -7px;"><a href="http://www.stumbleupon.com/submit?url=' . get_permalink($post->ID) . '&amp;title='.get_the_title($post->ID).'" target="_blank"><img src="'. plugins_url( 'img/stumbleupon-button.png', __FILE__ ) . '" alt="StumbleUpon" /></a></span>&nbsp;&nbsp;';
118
+ }
119
+ if (get_option('toastie_smsb_em') == 'true') {
120
+ $social_val.='<span class="smsb_email hcount" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
121
+ }
122
+ }
123
+
124
+
125
+ if (get_option('toastie_smsb_format') == 'box_count') {
126
+ if (get_option('toastie_smsb_fb') == 'true') {
127
+ $social_val.='<span class="smsb_facebook vcount fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="box_count"></span>&nbsp;&nbsp;';
128
+ }
129
+ if (get_option('toastie_smsb_tw') == 'true') {
130
+ $social_val.='<span class="smsb_twitter vcount"><a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet</a></span>&nbsp;&nbsp;';
131
+ }
132
+ if (get_option('toastie_smsb_gp') == 'true') {
133
+ $social_val.='<span class="smsb_googleplus vcount g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
134
+ }
135
+ if (get_option('toastie_smsb_pi') == 'true') {
136
+ $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" >
137
+ <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>&nbsp;&nbsp;';
138
+ }
139
+ if (get_option('toastie_smsb_tu') == 'true') {
140
+ $social_val.='<span class="smsb_tumblr vcount"><a class="tumblr-share-button" data-color="blue" data-notes="top" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
141
+ }
142
+ if (get_option('toastie_smsb_li') == 'true') {
143
+ $social_val.='<span class="smsb_linkedin vcount"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share" data-counter="top"></script></span>&nbsp;&nbsp;';
144
+ }
145
+ if (get_option('toastie_smsb_st') == 'true') {
146
+ $social_val.='<span class="smsb_stumbleupon vcount"><su:badge layout="5"></su:badge></span>&nbsp;&nbsp;';
147
+ }
148
+ if (get_option('toastie_smsb_em') == 'true') {
149
+ $social_val.='<span class="smsb_email vcount" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
150
+ }
151
+ }
152
+ $social_val.='</div>';
153
+ echo $social_val;
154
+ }
155
+
156
+ function toastie_wc_smsb_form_short_code() {
157
+ global $post;
158
+ $social_val = '<div class="woo-social-buttons">';
159
+ if (get_option('toastie_smsb_format') == 'button') {
160
+ if (get_option('toastie_smsb_fb') == 'true') {
161
+ $social_val.='<span class="smsb_facebook fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="button"></span>&nbsp;&nbsp;';
162
+ }
163
+ if (get_option('toastie_smsb_tw') == 'true') {
164
+ $social_val.='<span class="smsb_twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a></span>&nbsp;&nbsp;';
165
+ }
166
+ if (get_option('toastie_smsb_gp') == 'true') {
167
+ $social_val.='<span class="smsb_googleplus g-plus" data-action="share" data-annotation="none" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
168
+ }
169
+ if (get_option('toastie_smsb_pi') == 'true') {
170
+ $social_val.='<span class="smsb_pinterest"><a href="//gb.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark" data-pin-color="red" >
171
+ <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>&nbsp;&nbsp;';
172
+ }
173
+ if (get_option('toastie_smsb_tu') == 'true') {
174
+ $social_val.='<span class="smsb_tumblr"><a class="tumblr-share-button" data-color="blue" data-notes="none" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
175
+ }
176
+ if (get_option('toastie_smsb_li') == 'true') {
177
+ $social_val.='<span class="smsb_linkedin"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share"></script></span>&nbsp;&nbsp;';
178
+ }
179
+ if (get_option('toastie_smsb_st') == 'true') {
180
+ $social_val.='<span class="smsb_stumbleupon" style="position: relative; top: -7px;"><a href="http://www.stumbleupon.com/submit?url=' . get_permalink($post->ID) . '&amp;title='.get_the_title($post->ID).'" target="_blank"><img src="'. plugins_url( 'img/stumbleupon-button.png', __FILE__ ) . '" alt="StumbleUpon" /></a></span>&nbsp;&nbsp;';
181
+ }
182
+ if (get_option('toastie_smsb_em') == 'true') {
183
+ $social_val.='<span class="smsb_email" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
184
+ }
185
+ }
186
+
187
+
188
+ if (get_option('toastie_smsb_format') == 'button_count') {
189
+ if (get_option('toastie_smsb_fb') == 'true') {
190
+ $social_val.='<span class="smsb_facebook hcount fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="button_count"></span>&nbsp;&nbsp;';
191
+ }
192
+ if (get_option('toastie_smsb_tw') == 'true') {
193
+ $social_val.='<span class="smsb_twitter hcount"><a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a></span>&nbsp;&nbsp;';
194
+ }
195
+ if (get_option('toastie_smsb_gp') == 'true') {
196
+ $social_val.='<span class="smsb_googleplus hcount g-plus" data-action="share" data-annotation="bubble" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
197
+ }
198
+ if (get_option('toastie_smsb_pi') == 'true') {
199
+ $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" >
200
+ <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>&nbsp;&nbsp;';
201
+ }
202
+ if (get_option('toastie_smsb_tu') == 'true') {
203
+ $social_val.='<span class="smsb_tumblr hcount"><a class="tumblr-share-button" data-color="blue" data-notes="right" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
204
+ }
205
+ if (get_option('toastie_smsb_li') == 'true') {
206
+ $social_val.='<span class="smsb_linkedin hcount"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share" data-counter="right"></script></span>&nbsp;&nbsp;';
207
+ }
208
+ if (get_option('toastie_smsb_st') == 'true') {
209
+ $social_val.='<span class="smsb_stumbleupon hcount" style="position: relative; top: -7px;"><a href="http://www.stumbleupon.com/submit?url=' . get_permalink($post->ID) . '&amp;title='.get_the_title($post->ID).'" target="_blank"><img src="'. plugins_url( 'img/stumbleupon-button.png', __FILE__ ) . '" alt="StumbleUpon" /></a></span>&nbsp;&nbsp;';
210
+ }
211
+ if (get_option('toastie_smsb_em') == 'true') {
212
+ $social_val.='<span class="smsb_email hcount" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
213
+ }
214
+ }
215
+
216
+
217
+ if (get_option('toastie_smsb_format') == 'box_count') {
218
+ if (get_option('toastie_smsb_fb') == 'true') {
219
+ $social_val.='<span class="smsb_facebook vcount fb-share-button" data-href="' . get_permalink($post->ID) . '" data-layout="box_count"></span>&nbsp;&nbsp;';
220
+ }
221
+ if (get_option('toastie_smsb_tw') == 'true') {
222
+ $social_val.='<span class="smsb_twitter vcount"><a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical">Tweet</a></span>&nbsp;&nbsp;';
223
+ }
224
+ if (get_option('toastie_smsb_gp') == 'true') {
225
+ $social_val.='<span class="smsb_googleplus vcount g-plus" data-action="share" data-annotation="vertical-bubble" data-href="' . get_permalink($post->ID) . '"></span>&nbsp;&nbsp;';
226
+ }
227
+ if (get_option('toastie_smsb_pi') == 'true') {
228
+ $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" >
229
+ <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>&nbsp;&nbsp;';
230
+ }
231
+ if (get_option('toastie_smsb_tu') == 'true') {
232
+ $social_val.='<span class="smsb_tumblr vcount"><a class="tumblr-share-button" data-color="blue" data-notes="top" href="https://embed.tumblr.com/share"></a></span>&nbsp;&nbsp;';
233
+ }
234
+ if (get_option('toastie_smsb_li') == 'true') {
235
+ $social_val.='<span class="smsb_linkedin vcount"><script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script><script type="IN/Share" data-counter="top"></script></span>&nbsp;&nbsp;';
236
+ }
237
+ if (get_option('toastie_smsb_st') == 'true') {
238
+ $social_val.='<span class="smsb_stumbleupon vcount"><su:badge layout="5"></su:badge></span>&nbsp;&nbsp;';
239
+ }
240
+ if (get_option('toastie_smsb_em') == 'true') {
241
+ $social_val.='<span class="smsb_email vcount" style="position: relative; top: -7px;"><a href="mailto:?subject='.get_the_title($post->ID).'&amp;body=I%20saw%20this%20and%20thought%20of%20you!%20 ' . get_permalink($post->ID) . '"><img src="'. plugins_url( 'img/email-share-button.png', __FILE__ ) . '" alt="Email" /></a></span>';
242
+ }
243
+ }
244
+ $social_val.='</div>';
245
+ echo $social_val;
246
+ }
247
+
248
+
249
+ add_shortcode('woocommerce_social_media_share_buttons', 'toastie_wc_smsb_form_short_code');
250
+ add_action('woocommerce_single_product_summary', 'toastie_wc_smsb_form_code', 31);
251
+ add_action('admin_menu', 'toastie_wc_smsb_social_menu');
252
+ add_action('wp_footer', 'toastie_wc_smsb_social_footer');
253
+
254
+ function toastie_wc_smsb_social_menu() {
255
+ 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__));
256
+ }
257
+
258
+ function toastie_wc_smsb_social_footer() {
259
+ echo "<style type='text/css'>
260
+ .fb_iframe_widget > span {display: table !important;}
261
+ .woo-social-buttons {margin:10px 0; line-height:20px;}
262
+ .woo-social-buttons .smsb_tumblr iframe {height:20px !important; width:50px !important;}
263
+ .woo-social-buttons .smsb_tumblr.hcount iframe {height:20px !important; width:72px !important;}
264
+ .woo-social-buttons .smsb_tumblr.vcount iframe {height:40px !important; width:55px !important;}
265
+ .woo-social-buttons .smsb_stumbleupon.vcount iframe {height:60px !important; width:50px !important;}
266
+ .woo-social-buttons iframe {margin-bottom:0px; vertical-align:baseline;}
267
+ </style>";
268
+ }
269
+
270
+ function toastie_wc_smsb_social_init() {
271
+ $submited = 0;
272
+ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Submit'])) {
273
+
274
+ $smsb_fb = sanitize_text_field($_REQUEST['smsb_fb']);
275
+ $smsb_tw = sanitize_text_field($_REQUEST['smsb_tw']);
276
+ $smsb_gp = sanitize_text_field($_REQUEST['smsb_gp']);
277
+ $smsb_pi = sanitize_text_field($_REQUEST['smsb_pi']);
278
+ $smsb_tu = sanitize_text_field($_REQUEST['smsb_tu']);
279
+ $smsb_li = sanitize_text_field($_REQUEST['smsb_li']);
280
+ $smsb_st = sanitize_text_field($_REQUEST['smsb_st']);
281
+ $smsb_em = sanitize_text_field($_REQUEST['smsb_em']);
282
+ $smsb_format = sanitize_text_field($_REQUEST['smsb_format']);
283
+ update_option('toastie_smsb_fb', $smsb_fb);
284
+ update_option('toastie_smsb_tw', $smsb_tw);
285
+ update_option('toastie_smsb_gp', $smsb_gp);
286
+ update_option('toastie_smsb_pi', $smsb_pi);
287
+ update_option('toastie_smsb_tu', $smsb_tu);
288
+ update_option('toastie_smsb_li', $smsb_li);
289
+ update_option('toastie_smsb_st', $smsb_st);
290
+ update_option('toastie_smsb_em', $smsb_em);
291
+ update_option('toastie_smsb_format', $smsb_format);
292
+ $submited = 1;
293
+ }
294
+ ?>
295
+ <style type="text/css">
296
+ .smsb_pluginheader{width: 98%; margin:15px 0px; padding:10px; background:#ffffff; border-left: 5px solid #fdb435; font-size:22px; color:#fdb435; }
297
+ .smsb_optionheader{width: 400px; margin:15px 0px; padding:10px; background:#ffffff; border-left: 5px solid #fdb435; font-size:14px; color:#fdb435;}
298
+ .smsb_form{font-size: 14px;}
299
+ .smsb_button {background:#fdb435; color: #fff; border: 0 none; cursor: pointer;}
300
+ .smsb_button:hover {background:#9c8967;}
301
+ </style>
302
+ <div>
303
+ <h2 class="smsb_pluginheader"><?php _e("WooCoomerce Social Media Share Buttons - Settings", "woocommerce-social-media-share-buttons"); ?></h2>
304
+ <?php if (isset($submited) && $submited == 1) { ?>
305
+ <div id="setting-error-settings_updated" class="updated settings-error">
306
+ <p><strong><?php _e("Your settings have been saved.", "woocommerce-social-media-share-buttons"); ?></strong></p></div>
307
+ <?php } ?>
308
+ <?php _e("<p>By default the plugin adds social media share buttons to your woocommerce store products page (just below the 'add to cart' button). With the addition of a shortcode you can use it to add social media share buttons in posts, pages, products, events, widget etc.</p>
309
+ <p>Use shortcode to add social media share buttons to posts, pages, products, events etc. [woocommerce_social_media_share_buttons]</p>
310
+ <p>Add shortcode to your WordPress theme, or php widget. &lt;?php echo do_shortcode( '[woocommerce_social_media_share_buttons]' ); ?></p>", "woocommerce-social-media-share-buttons"); ?>
311
+ <form name="social" method="post" >
312
+ <table class="smsb_form" >
313
+ <tr><th><h3 class="smsb_optionheader"><?php _e("Which share buttons would you like to show?", "woocommerce-social-media-share-buttons"); ?></h3></th></tr>
314
+ <tr valign="top">
315
+ <td><fieldset>
316
+ <label><input type="checkbox" name="smsb_fb" value="true" <?php echo (get_option('toastie_smsb_fb') == 'true' ? 'checked' : ''); ?> /><span style="padding-left: 5px;font-weight: bold;"><?php _e('Facbook', 'woocommerce-social-media-share-buttons'); ?></span></label>
317
+ <br/>
318
+ <label> <input type="checkbox" name="smsb_tw" value="true" <?php echo (get_option('toastie_smsb_tw') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('Twitter', 'woocommerce-social-media-share-buttons'); ?></span></label>
319
+ <br/>
320
+ <label><input type="checkbox" name="smsb_gp" value="true" <?php echo (get_option('toastie_smsb_gp') == 'true' ? 'checked' : ''); ?> /><span style="padding-left: 5px;font-weight: bold;"><?php _e('Google Plus', 'woocommerce-social-media-share-buttons'); ?></span></label>
321
+ <br/>
322
+ <label> <input type="checkbox" name="smsb_pi" value="true" <?php echo (get_option('toastie_smsb_pi') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('Pinterest', 'woocommerce-social-media-share-buttons'); ?></span></label>
323
+ <br/>
324
+ <label> <input type="checkbox" name="smsb_tu" value="true" <?php echo (get_option('toastie_smsb_tu') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('Tumblr', 'woocommerce-social-media-share-buttons'); ?></span></label>
325
+ <br/>
326
+ <label> <input type="checkbox" name="smsb_li" value="true" <?php echo (get_option('toastie_smsb_li') == 'true' ? 'checked' : ''); ?> /><span style="padding-left: 5px;font-weight: bold;"><?php _e('Linkedin', 'woocommerce-social-media-share-buttons'); ?></span></label>
327
+ <br/>
328
+ <label> <input type="checkbox" name="smsb_st" value="true" <?php echo (get_option('toastie_smsb_st') == 'true' ? 'checked' : ''); ?> ><span style="padding-left: 5px;font-weight: bold;"><?php _e('StumbleUpon', 'woocommerce-social-media-share-buttons'); ?></span></label>
329
+ <br/>
330
+ <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>
331
+ </fieldset></td>
332
+ </tr>
333
+ <tr><th><h3 class="smsb_optionheader" ><?php _e("What format do you want the share buttons?", "woocommerce-social-media-share-buttons"); ?></h3></th></tr>
334
+ <tr valign="top">
335
+ <td><fieldset>
336
+ <img src="<? echo plugins_url( 'img/smsb_formatoptions.png', __FILE__ );?>" alt="Format Options"/><br/>
337
+ <label><input type="radio" name="smsb_format" value="button" <?php echo (get_option('toastie_smsb_format') == 'button' ? 'checked' : ''); ?> /> <span style="padding-left: 5px;font-weight: bold;"><?php _e('Button', 'woocommerce-social-media-share-buttons'); ?></span></label>
338
+ <br/>
339
+ <label><input type="radio" name="smsb_format" value="button_count" <?php echo (get_option('toastie_smsb_format') == 'button_count' ? 'checked' : ''); ?> /><span style="padding-left: 5px;font-weight: bold;"> <?php _e('Button with counter', 'woocommerce-social-media-share-buttons'); ?></span></label>
340
+ <br/>
341
+ <label><input type="radio" name="smsb_format" value="box_count" <?php echo (get_option('toastie_smsb_format') == 'box_count' ? 'checked' : ''); ?> /><span style="padding-left: 5px;font-weight: bold;"> <?php _e('Box with counter', 'woocommerce-social-media-share-buttons'); ?></span></label>
342
+ </fieldset></td>
343
+ </tr>
344
+ </table>
345
+ <p>&nbsp;</p>
346
+ <p><input type="submit" name="Submit" class="smsb_button" value="<?php _e("Save Settings", "woocommerce-social-media-share-buttons"); ?>"></p>
347
+ </form>
348
+ <p style="text-align:right">&copy; All rights reserved, <a href="http://www.toastiestudio.com" target="_blank">Toastie Studio</a></p>
349
+ </div>
350
+ <?php
351
+ }
352
+
353
+ function toastie_wc_smsb_my_enqueue() {
354
+ wp_enqueue_script('smsb_script', plugin_dir_url(__FILE__) . 'smsb_script.js', array(), '1.0.0', true);
355
+ }
356
+
357
+ add_action('wp_print_scripts', 'toastie_wc_smsb_my_enqueue');
358
+ ?>
smsb_script.js ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Plugin Name: WooCommerce Social Media Share Buttons
3
+ * Plugin URI: http://www.toastiestudio.com
4
+ * Description: The Woocommerce Social Media Share Buttons plugin allows visitors to your woocommerce shop to easily share your products on popular social media platforms.
5
+ * Author: Toastie Studio
6
+ * Author URI: http://www.toastiestudio.com
7
+ *
8
+ * Copyright 2015 Toastie Studio (email : toastiestudio@gmail.com)
9
+ *
10
+ * This file is part of WooCommerce Social Media Share Buttons
11
+ * plugin for WordPress.
12
+ *
13
+ * WooCommerce Social Media Share Buttons is free software:
14
+ * You can redistribute it and/or modify it under the terms of the
15
+ * GNU General Public License as published by the Free Software
16
+ * Foundation, either version 2 of the License, or (at your option)
17
+ * any later version.
18
+ *
19
+ * WooCommerce Social Media Share Buttons is distributed in the hope that
20
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the
21
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22
+ * PURPOSE. See the GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with WordPress. If not, see <http://www.gnu.org/licenses/>.
26
+ */
27
+
28
+
29
+ (function (d, s, id) {
30
+ var js, fjs = d.getElementsByTagName(s)[0];
31
+ if (d.getElementById(id))
32
+ return;
33
+ js = d.createElement(s);
34
+ js.id = id;
35
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
36
+ fjs.parentNode.insertBefore(js, fjs);
37
+ }(document, 'script', 'facebook-jssdk'));
38
+
39
+ (function (d, s, id) {
40
+ var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
41
+ if (!d.getElementById(id)) {
42
+ js = d.createElement(s);
43
+ js.id = id;
44
+ js.src = p + '://platform.twitter.com/widgets.js';
45
+ fjs.parentNode.insertBefore(js, fjs);
46
+ }
47
+ }(document, 'script', 'twitter-wjs'));
48
+
49
+
50
+ (function (d,s,id) {
51
+ var js, ajs = d.getElementsByTagName(s)[0];
52
+ if (!d.getElementById(id)) {
53
+ js = d.createElement(s);
54
+ js.id = id;
55
+ js.src = "https://secure.assets.tumblr.com/share-button.js";
56
+ ajs.parentNode.insertBefore(js, ajs);
57
+ }
58
+ }(document, "script", "tumblr-js"));
59
+
60
+
61
+ (function () {
62
+ var li = document.createElement("script");
63
+ li.type = "text/javascript";
64
+ li.async = true;
65
+ li.src = ("https:" == document.location.protocol ? "https:" : "http:") + "//platform.stumbleupon.com/1/widgets.js";
66
+ var s = document.getElementsByTagName("script")[0];
67
+ s.parentNode.insertBefore(li, s);
68
+ })();
69
+
70
+
71
+ (function () {
72
+ var po = document.createElement('script');
73
+ po.type = 'text/javascript';
74
+ po.async = true;
75
+ po.src = 'https://apis.google.com/js/platform.js';
76
+ var s = document.getElementsByTagName('script')[0];
77
+ s.parentNode.insertBefore(po, s);
78
+ })();