Social Sharing Toolkit - Version 2.0.1

Version Description

Version 2.0.1 is a major update with more possibilities. You will have to reconfigure the plugin because of this (it's gotten much better, I promise).

Download this release

Release Info

Developer MarijnRongen
Plugin Icon wp plugin Social Sharing Toolkit
Version 2.0.1
Comparing to
See all releases

Code changes from version 1.3.2 to 2.0.1

Files changed (73) hide show
  1. admin.css +115 -0
  2. admin.js +5 -0
  3. images/buttons/delicious.png +0 -0
  4. images/buttons/digg.png +0 -0
  5. images/buttons/email.png +0 -0
  6. images/buttons/myspace.png +0 -0
  7. images/buttons/reddit.png +0 -0
  8. images/buttons/stumbleupon.png +0 -0
  9. images/buttons/tumblr.png +0 -0
  10. images/buttons/twitter.png +0 -0
  11. images/delicious_counters.png +0 -0
  12. images/icons_large/delicious.png +0 -0
  13. images/icons_large/deviantart.png +0 -0
  14. images/icons_large/digg.png +0 -0
  15. images/icons_large/email.png +0 -0
  16. images/icons_large/facebook.png +0 -0
  17. images/icons_large/flickr.png +0 -0
  18. images/icons_large/googleplus.png +0 -0
  19. images/icons_large/hyves.png +0 -0
  20. images/icons_large/linkedin.png +0 -0
  21. images/icons_large/myspace.png +0 -0
  22. images/icons_large/picasa.png +0 -0
  23. images/icons_large/reddit.png +0 -0
  24. images/icons_large/rss.png +0 -0
  25. images/icons_large/stumbleupon.png +0 -0
  26. images/icons_large/tumblr.png +0 -0
  27. images/icons_large/twitter.png +0 -0
  28. images/icons_large/youtube.png +0 -0
  29. images/icons_medium/delicious.png +0 -0
  30. images/icons_medium/deviantart.png +0 -0
  31. images/icons_medium/digg.png +0 -0
  32. images/icons_medium/email.png +0 -0
  33. images/icons_medium/facebook.png +0 -0
  34. images/icons_medium/flickr.png +0 -0
  35. images/icons_medium/googleplus.png +0 -0
  36. images/icons_medium/hyves.png +0 -0
  37. images/icons_medium/linkedin.png +0 -0
  38. images/icons_medium/myspace.png +0 -0
  39. images/icons_medium/picasa.png +0 -0
  40. images/icons_medium/reddit.png +0 -0
  41. images/icons_medium/rss.png +0 -0
  42. images/icons_medium/stumbleupon.png +0 -0
  43. images/icons_medium/tumblr.png +0 -0
  44. images/icons_medium/twitter.png +0 -0
  45. images/icons_medium/youtube.png +0 -0
  46. images/icons_small/delicious.png +0 -0
  47. images/icons_small/deviantart.png +0 -0
  48. images/icons_small/digg.png +0 -0
  49. images/icons_small/email.png +0 -0
  50. images/icons_small/facebook.png +0 -0
  51. images/icons_small/flickr.png +0 -0
  52. images/icons_small/googleplus.png +0 -0
  53. images/icons_small/hyves.png +0 -0
  54. images/icons_small/linkedin.png +0 -0
  55. images/icons_small/myspace.png +0 -0
  56. images/icons_small/picasa.png +0 -0
  57. images/icons_small/reddit.png +0 -0
  58. images/icons_small/rss.png +0 -0
  59. images/icons_small/stumbleupon.png +0 -0
  60. images/icons_small/tumblr.png +0 -0
  61. images/icons_small/twitter.png +0 -0
  62. images/icons_small/youtube.png +0 -0
  63. images/move.png +0 -0
  64. readme.txt +81 -23
  65. screenshot-1.png +0 -0
  66. screenshot-2.png +0 -0
  67. screenshot-3.png +0 -0
  68. screenshot-4.png +0 -0
  69. screenshot-5.png +0 -0
  70. screenshot-6.png +0 -0
  71. script.js +37 -0
  72. social_sharing_toolkit.php +810 -354
  73. style.css +93 -38
admin.css ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.mr_social_sharing_networks {
2
+ -webkit-box-shadow: white 0px 1px 0px 0px inset;
3
+ -webkit-user-select: none;
4
+ background-attachment: scroll;
5
+ background-clip: border-box;
6
+ background-color: #FEFEFE;
7
+ background-image: -webkit-linear-gradient(top, #F9F9F9, #FEFEFE);
8
+ background-origin: padding-box;
9
+ border-color: #DFDFDF;
10
+ border-radius: 3px;
11
+ border-style: solid;
12
+ border-width: 1px;
13
+ box-shadow: white 0px 1px 0px 0px inset;
14
+ display: block;
15
+ margin: 1px 0 8px 0;
16
+ outline-color: #222;
17
+ outline-style: none;
18
+ outline-width: 0px;
19
+ width: 540px;
20
+ padding: 0 0 10px 0;
21
+ }
22
+
23
+ .mr_social_sharing_networks h3, .mr_social_sharing_networks p {
24
+ padding: 0 0 0 10px;
25
+ }
26
+
27
+ .mr_social_sharing_networks label {
28
+ display: inline-block;
29
+ width: 130px;
30
+ padding: 0 0 0 10px;
31
+ }
32
+
33
+ ul#mr_social_sharing_networks, ul#mr_social_sharing_widget_networks, ul#mr_social_sharing_follow_networks {
34
+ width: 520px;
35
+ padding: 10px;
36
+ }
37
+
38
+ ul#mr_social_sharing_networks li, ul#mr_social_sharing_widget_networks li, ul#mr_social_sharing_follow_networks li {
39
+ -webkit-box-shadow: white 0px 1px 0px 0px inset;
40
+ -webkit-user-select: none;
41
+ background-attachment: scroll;
42
+ background-clip: border-box;
43
+ background-color: whiteSmoke;
44
+ background-image: -webkit-linear-gradient(top, #F9F9F9, whiteSmoke);
45
+ background-origin: padding-box;
46
+ border-color: #DFDFDF;
47
+ border-radius: 3px;
48
+ border-style: solid;
49
+ border-width: 1px;
50
+ box-shadow: white 0px 1px 0px 0px inset;
51
+ cursor: move;
52
+ display: block;
53
+ margin: 1px 0 0 0;
54
+ outline-color: #222;
55
+ outline-style: none;
56
+ outline-width: 0px;
57
+ padding: 3px 10px 0 10px;
58
+ text-shadow: white 0px 1px 0px;
59
+ width: 500px;
60
+ height: 24px;
61
+ }
62
+
63
+ ul#mr_social_sharing_networks li img, ul#mr_social_sharing_widget_networks li img, ul#mr_social_sharing_follow_networks li img {
64
+ width: 16px;
65
+ height: 16px;
66
+ margin: 2px 10px 2px 0;
67
+ }
68
+
69
+ ul#mr_social_sharing_networks li img.right, ul#mr_social_sharing_widget_networks li img.right, ul#mr_social_sharing_follow_networks li img.right {
70
+ float: right;
71
+ margin: 2px -4px 2px 5px;
72
+ }
73
+
74
+ ul#mr_social_sharing_networks li label, ul#mr_social_sharing_widget_networks li label, ul#mr_social_sharing_follow_networks li label {
75
+ display: inline-block;
76
+ margin: -10px 10px 0 0;
77
+ width: auto;
78
+ height: 20px;
79
+ padding: 0;
80
+ }
81
+
82
+ ul#mr_social_sharing_networks li input, ul#mr_social_sharing_widget_networks li input, ul#mr_social_sharing_follow_networks li input {
83
+ margin: 0 10px 0 0;
84
+ padding: 0;
85
+ }
86
+
87
+ ul#mr_social_sharing_networks li input.text, ul#mr_social_sharing_widget_networks li input.text, ul#mr_social_sharing_follow_networks li input.text {
88
+ display: inline-block;
89
+ float: right;
90
+ width: 140px;
91
+ height: 20px;
92
+ margin: 0 10px 0 0;
93
+ padding: 0;
94
+ }
95
+
96
+ ul#mr_social_sharing_networks li label.text, ul#mr_social_sharing_widget_networks li label.text, ul#mr_social_sharing_follow_networks li label.text {
97
+ display: inline-block;
98
+ float: right;
99
+ width: auto;
100
+ height: 20px;
101
+ margin: 0 6px 0 0;
102
+ padding: 0;
103
+ }
104
+
105
+ ul#mr_social_sharing_networks li select, ul#mr_social_sharing_widget_networks li select, ul#mr_social_sharing_follow_networks li select {
106
+ display: inline-block;
107
+ float: right;
108
+ width: 160px;
109
+ height: 20px;
110
+ padding: 0;
111
+ }
112
+
113
+ label.check {
114
+ width: 400px;
115
+ }
admin.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ jQuery(document).ready( function($) {
2
+ $( "#mr_social_sharing_networks" ).sortable();
3
+ $( "#mr_social_sharing_widget_networks" ).sortable();
4
+ $( "#mr_social_sharing_follow_networks" ).sortable();
5
+ });
images/buttons/delicious.png ADDED
Binary file
images/buttons/digg.png ADDED
Binary file
images/buttons/email.png ADDED
Binary file
images/buttons/myspace.png ADDED
Binary file
images/buttons/reddit.png ADDED
Binary file
images/buttons/stumbleupon.png ADDED
Binary file
images/buttons/tumblr.png ADDED
Binary file
images/buttons/twitter.png ADDED
Binary file
images/delicious_counters.png ADDED
Binary file
images/icons_large/delicious.png ADDED
Binary file
images/icons_large/deviantart.png ADDED
Binary file
images/icons_large/digg.png ADDED
Binary file
images/icons_large/email.png ADDED
Binary file
images/icons_large/facebook.png ADDED
Binary file
images/icons_large/flickr.png ADDED
Binary file
images/icons_large/googleplus.png ADDED
Binary file
images/icons_large/hyves.png ADDED
Binary file
images/icons_large/linkedin.png ADDED
Binary file
images/icons_large/myspace.png ADDED
Binary file
images/icons_large/picasa.png ADDED
Binary file
images/icons_large/reddit.png ADDED
Binary file
images/icons_large/rss.png ADDED
Binary file
images/icons_large/stumbleupon.png ADDED
Binary file
images/icons_large/tumblr.png ADDED
Binary file
images/icons_large/twitter.png ADDED
Binary file
images/icons_large/youtube.png ADDED
Binary file
images/icons_medium/delicious.png ADDED
Binary file
images/icons_medium/deviantart.png ADDED
Binary file
images/icons_medium/digg.png ADDED
Binary file
images/icons_medium/email.png ADDED
Binary file
images/icons_medium/facebook.png ADDED
Binary file
images/icons_medium/flickr.png ADDED
Binary file
images/icons_medium/googleplus.png ADDED
Binary file
images/icons_medium/hyves.png ADDED
Binary file
images/icons_medium/linkedin.png ADDED
Binary file
images/icons_medium/myspace.png ADDED
Binary file
images/icons_medium/picasa.png ADDED
Binary file
images/icons_medium/reddit.png ADDED
Binary file
images/icons_medium/rss.png ADDED
Binary file
images/icons_medium/stumbleupon.png ADDED
Binary file
images/icons_medium/tumblr.png ADDED
Binary file
images/icons_medium/twitter.png ADDED
Binary file
images/icons_medium/youtube.png ADDED
Binary file
images/icons_small/delicious.png ADDED
Binary file
images/icons_small/deviantart.png ADDED
Binary file
images/icons_small/digg.png ADDED
Binary file
images/icons_small/email.png ADDED
Binary file
images/icons_small/facebook.png ADDED
Binary file
images/icons_small/flickr.png ADDED
Binary file
images/icons_small/googleplus.png ADDED
Binary file
images/icons_small/hyves.png ADDED
Binary file
images/icons_small/linkedin.png ADDED
Binary file
images/icons_small/myspace.png ADDED
Binary file
images/icons_small/picasa.png ADDED
Binary file
images/icons_small/reddit.png ADDED
Binary file
images/icons_small/rss.png ADDED
Binary file
images/icons_small/stumbleupon.png ADDED
Binary file
images/icons_small/tumblr.png ADDED
Binary file
images/icons_small/twitter.png ADDED
Binary file
images/icons_small/youtube.png ADDED
Binary file
images/move.png ADDED
Binary file
readme.txt CHANGED
@@ -1,32 +1,51 @@
1
  === Social Sharing Toolkit ===
2
  Contributors: MarijnRongen
3
- Donate link: http://www.marijnrongen.com/wordpress-plugins/
4
- Tags: Facebook, Like, LinkedIn, Share, Google, Plus, +1, Twitter, Tweet, StumbleUpon, Stumble, Tumblr, Digg, Reddit, MySpace, Hyves, recommend, social, sharing, widget, shortcode, page, post
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
- Stable tag: 1.3.2
8
  License: GPLv2 or later
9
 
10
- This plugin enables sharing of your content via popular social networks and can convert Twitter names and hashtags to links. Easy & configurable.
11
 
12
  == Description ==
13
 
14
- The plugin currently supports the following networks:
15
 
16
- * Facebook
 
 
17
  * Twitter
18
  * Google +1
19
  * LinkedIn
20
  * Tumblr
21
  * StumbleUpon
 
22
  * Digg
23
  * Reddit
24
- * MySpace
25
- * Hyves (a social network especially popular in the Netherlands).
 
 
 
 
 
 
26
 
27
- You can decide which networks to support on your blog and where the buttons will appear (either above or below the content). You can also choose between different layouts; small without counters, wide with counters or high with counters. Be aware that not every network has a dedicated button for every layout.
 
 
 
 
 
 
 
28
 
29
- Since version 1.2.5 you can also specify a Twitter handle which is then appended to the tweet a visitor sends (like "... via @WordPress").
 
 
 
30
 
31
  = Shortcode =
32
 
@@ -34,20 +53,35 @@ It is also possible to only let the buttons appear where you want by using short
34
 
35
  = Widget =
36
 
37
- Since version 1.2.0 a widget is included in the toolkit. It will display the same buttons selected in the plugin configuration.
38
- You can however choose a different button layout for the widget. For example you can have wide buttons below your posts and high buttons in your sidebar.
39
 
40
- = Styling =
41
 
42
- The plugin uses a list to position the buttons. You can easily change the css to match your blog style by changing the css file in the plugin directory.
43
 
44
- = Posts, pages or both =
45
 
46
- Since version 1.3.0 it is possible to choose if the buttons should be displayed on posts, pages or both. The shortcode will work on both regardless of this choice.
 
 
 
 
 
 
 
 
 
 
47
 
48
- = Excerpts =
49
 
50
- Version 1.3.0 removed the buttons from excerpts because some themes did not parse the buttons correctly in the excerpt. Version 1.3.1 includes an option where you can choose to display buttons in excerpts. This is enabled by default, you can disable it if your theme has problems displaying the buttons.
 
 
 
 
 
 
51
 
52
  = Automatic Twitter links =
53
 
@@ -56,7 +90,7 @@ Twitter names will link to their Twitter profile and hashtags will link to the T
56
 
57
  == Frequently Asked Questions ==
58
 
59
- = My excerpts aren't displaying the buttons but some text is displayed =
60
 
61
  You must disable the option "Include buttons in excerpts", it is enabled by default but some themes use custom excerpts which do not correctly parse the buttons.
62
 
@@ -72,6 +106,15 @@ If you want to display the buttons somewhere else on your site you can use the f
72
  echo $social_sharing_toolkit->create_bookmarks();
73
  ?>`
74
 
 
 
 
 
 
 
 
 
 
75
 
76
  == Installation ==
77
 
@@ -79,13 +122,19 @@ Upload the Social Sharing Toolkit plugin to the `/wp-content/plugins/` folder on
79
 
80
  == Screenshots ==
81
 
82
- 1. Plugin configuration page
83
- 2. Without counters (Facebook demands some space)
84
- 3. Several wide buttons
85
- 4. Several high buttons
 
 
86
 
87
  == Upgrade Notice ==
88
 
 
 
 
 
89
  = 1.3.1 =
90
 
91
  Version 1.3.1 includes an option to display buttons in excerpts.
@@ -107,6 +156,15 @@ Please update to version 1.0.1 to prevent an unexpected printing of the page tit
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
 
110
  = 1.3.2 =
111
  * Added FAQ to readme
112
  * Enabled "Include buttons in excerpts" option by default
1
  === Social Sharing Toolkit ===
2
  Contributors: MarijnRongen
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P8ZVNC57E58FE&lc=NL&item_name=WordPress%20plugins%20by%20Marijn%20Rongen&item_number=Social%20Sharing%20Toolkit&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
+ Tags: Facebook, Like, LinkedIn, Share, Google, Plus, +1, Google+, Twitter, Tweet, Follow, StumbleUpon, Stumble, Tumblr, Delicious, Digg, Reddit, Myspace, Hyves, YouTube, Flickr, Picasa, deaviantART, mail, RSS, feed, connect, recommend, social, sharing, widget, shortcode, page, post, button, counter, icon
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
+ Stable tag: 2.0.1
8
  License: GPLv2 or later
9
 
10
+ Easy sharing and connecting on social networks. Display on posts or use widgets or shortcode. Also Twitter name/hashtag to link converter.
11
 
12
  == Description ==
13
 
14
+ = Sharing posts & pages =
15
 
16
+ The plugin currently supports the following networks for sharing:
17
+
18
+ * Facebook (like and send buttons)
19
  * Twitter
20
  * Google +1
21
  * LinkedIn
22
  * Tumblr
23
  * StumbleUpon
24
+ * Delicious
25
  * Digg
26
  * Reddit
27
+ * Myspace
28
+ * Hyves
29
+
30
+ On Tweet buttons you can specify a Twitter handle which is then appended to the tweet a visitor sends (like "... via @WordPress"). An email send button is also included.
31
+
32
+ You can decide which networks to support on your blog, where the buttons will appear (either above or below the content). Through drag and drop you can easily change the order in which the buttons appear.
33
+
34
+ For each button you can choose a different type (not all types are available for each button):
35
 
36
+ * button
37
+ * button with counter on the side
38
+ * button with counter on top
39
+ * small icon
40
+ * small icon with text
41
+ * medium icon
42
+ * medium icon with text
43
+ * large icon
44
 
45
+ You can also choose the orientation of the buttons:
46
+
47
+ * horizontal (buttons are placed side by side)
48
+ * vertical (buttons are placed below each other)
49
 
50
  = Shortcode =
51
 
53
 
54
  = Widget =
55
 
56
+ The widget has it's own list of buttons with the same possibilities as the list for posts & pages. You can however specify a fixed title and url to use for the buttons in the widget.
 
57
 
58
+ = Follow Widget =
59
 
60
+ Since version 2.0.0 an extra widget is added with the possibility to provide easy links to your profiles on other social networks.
61
 
62
+ The networks currently supported for the Follow Widget are:
63
 
64
+ * Facebook
65
+ * Twitter
66
+ * Google+
67
+ * LinkedIn
68
+ * Tumblr
69
+ * Myspace
70
+ * Hyves
71
+ * YouTube
72
+ * Flickr
73
+ * Picasa
74
+ * DeviantArt
75
 
76
+ A button for an RSS feed is also included. Of course the type, order and orientation of the buttons is also configurable for the Follow Widget. Each button for the Follow Widget supports the following types:
77
 
78
+ * small icon
79
+ * small icon with text
80
+ * medium icon
81
+ * medium icon with text
82
+ * large icon
83
+
84
+ To use a button you must enter your user id or username for the network. To use the RSS feed button you must enter the full url.
85
 
86
  = Automatic Twitter links =
87
 
90
 
91
  == Frequently Asked Questions ==
92
 
93
+ = My excerpts aren't displaying the buttons but some strange text is displayed =
94
 
95
  You must disable the option "Include buttons in excerpts", it is enabled by default but some themes use custom excerpts which do not correctly parse the buttons.
96
 
106
  echo $social_sharing_toolkit->create_bookmarks();
107
  ?>`
108
 
109
+ You can also supply an url and title to use on the buttons:
110
+ ` echo $social_sharing_toolkit->create_bookmarks('{YOUR URL}', '{YOUR TITLE}');`
111
+
112
+ To display the follow buttons somewhere else you can use the following code:
113
+ `<?php
114
+ $social_sharing_toolkit = new MR_Social_Sharing_Toolkit();
115
+ echo $social_sharing_toolkit->create_followers();
116
+ ?>`
117
+
118
 
119
  == Installation ==
120
 
122
 
123
  == Screenshots ==
124
 
125
+ 1. Plugin configuration for posts and pages
126
+ 2. Plugin configuration for Share Widget
127
+ 3. Plugin configuration for Follow Widget
128
+ 4. Automatic Twitter links configuration
129
+ 5. Some buttons
130
+ 6. Some other buttons
131
 
132
  == Upgrade Notice ==
133
 
134
+ = 2.0.1 =
135
+
136
+ Version 2.0.1 is a major update with more possibilities. You will have to reconfigure the plugin because of this (it's gotten much better, I promise).
137
+
138
  = 1.3.1 =
139
 
140
  Version 1.3.1 includes an option to display buttons in excerpts.
156
 
157
  == Changelog ==
158
 
159
+ = 2.0.0 =
160
+ * Added Follow Widget
161
+ * Added icon buttons
162
+ * Added possibility to control order of buttons
163
+ * Added choice between horizontal and vertical button orientation
164
+ * Share Widget now has it's own list of buttons
165
+ * Added support for Delicious and sending though email
166
+ * Several minor fixes
167
+
168
  = 1.3.2 =
169
  * Added FAQ to readme
170
  * Enabled "Include buttons in excerpts" option by default
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png ADDED
Binary file
screenshot-6.png ADDED
Binary file
script.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ // Delicious:
3
+ $.each($("span.delicious_hash"), function () {
4
+ var elem = $(this);
5
+ $.ajax({ type: "GET",
6
+ dataType: "jsonp",
7
+ url: "http://feeds.delicious.com/v2/json/urlinfo/"+$(this).html(),
8
+ success: function(data){
9
+ if (data.length > 0) {
10
+ var posts = parseInt(data[0].total_posts);
11
+ if (posts > 1000000) {
12
+ var txt = parseInt(posts/1000000);
13
+ elem.next().prepend(txt + 'M');
14
+ } else if (posts > 1000) {
15
+ var txt = parseInt(posts/1000);
16
+ elem.next().prepend(txt + 'K');
17
+ } else {
18
+ elem.next().prepend(posts);
19
+ }
20
+ } else {
21
+ elem.next().prepend('0');
22
+ }
23
+ }
24
+ });
25
+ });
26
+ // Link popup handler:
27
+ $.each($("a.mr_social_sharing_popup_link"), function() {
28
+ var elem = $(this);
29
+ elem.click( function (event) {
30
+ event.preventDefault();
31
+ var popup = window.open(elem.attr('href'),'mr_social_sharing','height=400,width=650');
32
+ if (popup) {
33
+ popup.focus();
34
+ }
35
+ });
36
+ });
37
+ });
social_sharing_toolkit.php CHANGED
@@ -3,23 +3,95 @@
3
  Plugin Name: Social Sharing Toolkit
4
  Plugin URI: http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/
5
  Description: This plugin enables sharing of your content via popular social networks and can also convert Twitter names and hashtags to links. Easy & configurable.
6
- Version: 1.3.2
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
10
 
11
  class MR_Social_Sharing_Toolkit {
12
  var $options;
 
 
 
13
 
14
  function MR_Social_Sharing_Toolkit() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  $this->get_options();
16
  }
17
 
18
  function get_options() {
19
- $this->options = array('share' => 1, 'like' => 1, 'tweet' => 1, 'tumblr' => 1, 'stumble' => 1, 'plus' => 1, 'digg' => 1, 'reddit' => 1, 'myspace' => 1, 'hyves' => 1, 'twitter_handle' => '', 'position' => 'none', 'types' => 'both', 'include_excerpts' => 1, 'layout' => 'none', 'linkify_content' => 0, 'linkify_comments' => 0, 'twitter_handles' => 0, 'twitter_hashtags' => 0);
 
 
 
 
 
 
 
 
 
 
20
  foreach ($this->options as $key => $val) {
21
  $this->options[$key] = get_option( $key, $val );
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  return $this->options;
24
  }
25
 
@@ -39,13 +111,24 @@ class MR_Social_Sharing_Toolkit {
39
 
40
  function plugin_menu() {
41
  add_options_page('Social Sharing', 'Social Sharing Toolkit', 'manage_options', 'mr_social_sharing', array($this, 'plugin_admin_page'));
 
 
 
 
42
  }
43
 
 
 
 
 
 
 
 
44
  function plugin_admin_page() {
45
  if (!current_user_can('manage_options')) {
46
  wp_die( __('You do not have sufficient permissions to access this page.') );
47
  }
48
- if( isset($_POST['mr_save_options']) && $_POST['mr_save_options'] == 'Y' ) {
49
  $this->save_options($_POST);
50
  echo '
51
  <div class="updated"><p><strong>'.__('settings saved.', 'mr_social_sharing' ).'</strong></p></div>';
@@ -53,170 +136,257 @@ class MR_Social_Sharing_Toolkit {
53
  echo '
54
  <div class="wrap">
55
  <form method="post" action="">
56
- <input type="hidden" name="mr_save_options" value="Y"/>
57
  <h2>Social Sharing Toolkit</h2>
58
- <h3>Configure buttons</h3>
59
- <table class="form-table">
60
- <tbody>
61
- <tr valign="top">
62
- <th scope="row">
63
- <label for="position">Button location</label>
64
- </th>
65
- <td>
66
- <select name="position" id="position">
67
- <option value="none"';
68
- if ($this->options['position'] == 'none') { echo ' selected="selected"';}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  echo '>Do not display social bookmarks</option>
70
  <option value="top"';
71
- if ($this->options['position'] == 'top') { echo ' selected="selected"';}
72
  echo '>Display above content</option>
73
  <option value="bottom"';
74
- if ($this->options['position'] == 'bottom') { echo ' selected="selected"';}
75
  echo '>Display below content</option>
76
  <option value="shortcode"';
77
- if ($this->options['position'] == 'shortcode') { echo ' selected="selected"';}
78
  echo '>Let me decide by using shortcode</option>
79
- </select>';
80
- if ($this->options['position'] == 'shortcode') {
81
- echo '<span class="description"> '.__("Use the shortcode [social_share/] where you want the buttons to appear", 'mr_social_sharing').'</span>';
82
  }
83
  echo '
84
- </td>
85
- </tr>
86
- <tr valign="top">
87
- <th scope="row">
88
- <label for="types">Place buttons on</label>
89
- </th>
90
- <td>
91
- <select name="types" id="types">
92
- <option value="both"';
93
- if ($this->options['types'] == 'both') { echo ' selected="selected"';}
94
  echo '>On posts and pages</option>
95
- <option value="posts"';
96
- if ($this->options['types'] == 'posts') { echo ' selected="selected"';}
97
  echo '>Only on posts</option>
98
- <option value="pages"';
99
- if ($this->options['types'] == 'pages') { echo ' selected="selected"';}
100
  echo '>Only on pages</option>
101
- </select>';
102
- if ($this->options['position'] == 'shortcode') {
103
- echo '<span class="description"> '.__("The shortcode [social_share/] can always be used on posts and pages", 'mr_social_sharing').'</span>';
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  echo '
106
- </td>
107
- </tr>
108
- <tr valign="top">
109
- <th scope="row">
110
- </th>
111
- <td>
112
- <label for="include_excerpts"><input type="checkbox" name="include_excerpts" id="include_excerpts"';
113
- if ($this->options['include_excerpts'] == 1) { echo ' checked="checked"';}
114
- echo ' value="1" /> Include buttons in excerpts</label><span class="description"> '.__("Some themes will not correctly display the buttons in excerpts", 'mr_social_sharing').'</span>
115
- </td>
116
- </tr>
117
- <tr valign="top">
118
- <th scope="row">
119
- <label for="layout">Choose a layout</label>
120
- </th>
121
- <td>
122
- <select name="layout" id="layout">
123
- <option value="none"';
124
- if ($this->options['layout'] == 'none') { echo ' selected="selected"';}
125
- echo '>Small buttons without counters</option>
126
- <option value="horizontal"';
127
- if ($this->options['layout'] == 'horizontal') { echo ' selected="selected"';}
128
- echo '>Wider buttons with counters</option>
129
- <option value="vertical"';
130
- if ($this->options['layout'] == 'vertical') { echo ' selected="selected"';}
131
- echo '>Higher buttons with counters</option>
132
- </select>';
133
- if ($this->options['layout'] != 'none') {
134
- echo '<span class="description"> '.__("Counters may not be available for every network", 'mr_social_sharing').'</span>';
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  echo '
137
- </td>
138
- </tr>
139
- <tr valign="top">
140
- <th scope="row">
141
- <label>Select networks to use</label>
142
- </th>
143
- <td>
144
- <label for="like"><input type="checkbox" name="like" id="like"';
145
- if ($this->options['like'] == 1) { echo ' checked="checked"';}
146
- echo ' value="1" /> Facebook</label><br/>
147
- <label for="tweet"><input type="checkbox" name="tweet" id="tweet"';
148
- if ($this->options['tweet'] == 1) { echo ' checked="checked"';}
149
- echo ' value="1" /> Twitter</label><br/>
150
- <label for="plus"><input type="checkbox" name="plus" id="plus"';
151
- if ($this->options['plus'] == 1) { echo ' checked="checked"';}
152
- echo ' value="1" /> Google +1</label><br/>
153
- <label for="share"><input type="checkbox" name="share" id="share"';
154
- if ($this->options['share'] == 1) { echo ' checked="checked"';}
155
- echo ' value="1" /> LinkedIn</label><br/>
156
- <label for="tumblr"><input type="checkbox" name="tumblr" id="tumblr"';
157
- if ($this->options['tumblr'] == 1) { echo ' checked="checked"';}
158
- echo ' value="1" /> Tumblr</label><span class="description"> '.__("Only available without counters", 'mr_social_sharing').'</span><br/>
159
- <label for="stumble"><input type="checkbox" name="stumble" id="stumble"';
160
- if ($this->options['stumble'] == 1) { echo ' checked="checked"';}
161
- echo ' value="1" /> StumbleUpon</label><br/>
162
- <label for="digg"><input type="checkbox" name="digg" id="digg"';
163
- if ($this->options['digg'] == 1) { echo ' checked="checked"';}
164
- echo ' value="1" /> Digg</label><br/>
165
- <label for="reddit"><input type="checkbox" name="reddit" id="reddit"';
166
- if ($this->options['reddit'] == 1) { echo ' checked="checked"';}
167
- echo ' value="1" /> Reddit</label><br/>
168
- <label for="myspace"><input type="checkbox" name="myspace" id="myspace"';
169
- if ($this->options['myspace'] == 1) { echo ' checked="checked"';}
170
- echo ' value="1" /> MySpace</label><span class="description"> '.__("Only available without counters", 'mr_social_sharing').'</span><br/>
171
- <label for="hyves"><input type="checkbox" name="hyves" id="hyves"';
172
- if ($this->options['hyves'] == 1) { echo ' checked="checked"';}
173
- echo ' value="1" /> Hyves</label><span class="description"> '.__("Only available with horizontal counters", 'mr_social_sharing').'</span>
174
- </td>
175
- </tr>
176
- <tr valign="top">
177
- <th scope="row">
178
- <label for="twitter_handle">Attribute tweets to:</label>
179
- </th>
180
- <td>
181
- @<input type="text" name="twitter_handle" id="twitter_handle" value="'.$this->options['twitter_handle'].'"/>
182
- </td>
183
- </tr>
184
- </tbody>
185
- </table>
186
- <h3>Automatic Twitter links</h3>
187
- <table class="form-table">
188
- <tbody>
189
- <tr valign="top">
190
- <th scope="row">
191
- <label>Select what you want to convert...</label>
192
- </th>
193
- <td>
194
- <label><input type="checkbox" name="twitter_handles" id="twitter_handles"';
195
- if ($this->options['twitter_handles'] == 1) { echo ' checked="checked"';}
196
  echo ' value="1" /> '.__("Convert Twitter usernames", 'mr_social_sharing').'</label><br/>
197
- <label><input type="checkbox" name="twitter_hashtags" id="twitter_hashtags"';
198
- if ($this->options['twitter_hashtags'] == 1) { echo ' checked="checked"';}
199
  echo ' value="1" /> '.__("Convert hashtags", 'mr_social_sharing').'</label>
200
- </td>
201
- </tr>
202
- <tr valign="top">
203
- <th scope="row">
204
- <label>... and where it should be converted</label>
205
- </th>
206
- <td>
207
- <label><input type="checkbox" name="linkify_content" id="linkify_content"';
208
- if ($this->options['linkify_content'] == 1) { echo ' checked="checked"';}
209
  echo ' value="1" /> '.__("Convert in posts and pages", 'mr_social_sharing').'</label><br/>
210
- <label><input type="checkbox" name="linkify_comments" id="linkify_comments"';
211
- if ($this->options['linkify_comments'] == 1) { echo ' checked="checked"';}
212
  echo ' value="1" /> '.__("Convert in comments", 'mr_social_sharing').'</label>
213
- </td>
214
- </tr>
215
- </tbody>
216
- </table>
217
  <p class="submit">
218
  <input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
219
  </p>
 
 
 
 
 
 
 
220
  </form>
221
  </div>';
222
  }
@@ -225,232 +395,483 @@ class MR_Social_Sharing_Toolkit {
225
 
226
  function should_share_content() {
227
  wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
228
- if ($this->options['plus'] == 1) {
229
- wp_enqueue_script('GooglePlus', 'https://apis.google.com/js/plusone.js');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
- if ($this->options['tumblr'] == 1) {
232
- wp_enqueue_script('Tumblr', 'http://platform.tumblr.com/v1/share.js', array(), false, true);
 
 
 
 
233
  }
234
- if ($this->options['digg'] == 1) {
235
- wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__));
 
 
 
 
 
 
236
  }
237
- if ($this->options['position'] == 'none' || $this->options['position'] == 'shortcode') {
238
  return false;
239
  }
240
  return true;
241
  }
242
 
243
- function create_bookmarks($url = '', $title = '', $layout = '') {
244
  $url = trim($url);
245
  $title = trim($title);
246
  if ($url == '') {
247
  $url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
248
  }
249
- $layout = ($layout != '') ? $layout : $this->options['layout'];
250
- $class = 'mr_social_sharing_'.$layout;
251
- $bookmarks = '<div class="mr_social_sharing">
252
- <ul class="mr_social_sharing">
253
- <!-- Social Sharing Toolkit v1.3.2 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->';
254
- if ($this->options['like'] == 1) {
255
- $bookmarks .= '
256
- <li class="'.$class.'">
257
- <iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&amp;href='.urlencode($url).'&amp;layout=';
258
- switch ($layout) {
259
- case 'horizontal':
260
- $bookmarks .= 'button_count';
261
- $width = '90px';
262
- $height = '20px';
263
- break;
264
- case 'vertical':
265
- $bookmarks .= 'box_count';
266
- $width = '55px';
267
- $height = '65px';
268
- break;
269
- default:
270
- $bookmarks .= 'standard';
271
- $width = '225%';
272
- $height = '35px';
273
- break;
274
  }
275
- $bookmarks .= '&amp;show_faces=false&amp;width='.$width.'&amp;height='.$height.'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'.$width.'; height:'.$height.';" allowTransparency="true"></iframe>
276
- </li>';
277
- }
278
- if ($this->options['tweet'] == 1) {
279
- $bookmarks .= '
280
- <li class="'.$class.'">
281
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="';
282
- switch ($layout) {
283
- case 'horizontal':
284
- $bookmarks .= 'horizontal"';
285
- break;
286
- case 'vertical':
287
- $bookmarks .= 'vertical"';
288
- break;
289
- default:
290
- $bookmarks .= 'none"';
291
- break;
292
- }
293
- if ($this->options['twitter_handle'] != '') {
294
- $bookmarks .= ' data-text="'.$title.'" data-via="'.$this->options['twitter_handle'].'"';
295
  }
296
- $bookmarks .= '>Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
297
- </li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
- if ($this->options['plus'] == 1) {
300
- $bookmarks .= '
301
- <li class="'.$class.'">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  <g:plusone';
303
- switch ($layout) {
304
- case 'horizontal':
305
- $bookmarks .= ' size="medium"';
306
- break;
307
- case 'vertical':
308
- $bookmarks .= ' size="tall"';
309
- break;
310
- default:
311
- $bookmarks .= ' size="medium" count="false"';
312
- break;
313
- }
314
- $bookmarks .= ' href="'.$url.'"></g:plusone>
315
- </li>';
316
- }
317
- if ($this->options['share'] == 1) {
318
- $bookmarks .= '
319
- <li class="'.$class.'">
320
- <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$url.'"';
321
- switch ($layout) {
322
- case 'horizontal':
323
- $bookmarks .= ' data-counter="right"';
324
- break;
325
- case 'vertical':
326
- $bookmarks .= ' data-counter="top"';
327
- break;
328
- default:
329
- $bookmarks .= '';
330
- break;
331
- }
332
- $bookmarks .= '></script>
333
- </li>';
334
  }
335
- if ($this->options['tumblr'] == 1) {
336
- $bookmarks .= '
337
- <li class="'.$class.'">
338
- <a href="http://www.tumblr.com/share/link?url='.urlencode($url).'&name='.urlencode($title).'" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; ';
339
- switch ($layout) {
340
- case 'horizontal':
341
- $bookmarks .= 'width:81px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_1.png\')';
342
- break;
343
- case 'vertical':
344
- $bookmarks .= 'width:61px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_2.png\')';
345
- break;
346
- default:
347
- $bookmarks .= 'width:61px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_2.png\')';
348
- break;
349
- }
350
- $bookmarks .= ' top left no-repeat transparent;">Share on Tumblr</a>
351
- </li>';
 
 
 
 
 
 
 
 
352
  }
353
- if ($this->options['stumble'] == 1) {
354
- $bookmarks .= '
355
- <li class="'.$class.'">
356
- <script src="http://www.stumbleupon.com/hostedbadge.php?s=';
357
- switch ($layout) {
358
- case 'horizontal':
359
- $bookmarks .= '1';
360
- break;
361
- case 'vertical':
362
- $bookmarks .= '5';
363
- break;
364
- default:
365
- $bookmarks .= '4';
366
- break;
367
- }
368
- $bookmarks .= '&amp;r='.urlencode($url).'"></script>
369
- </li>';
 
 
 
 
 
 
 
 
 
 
 
370
  }
371
- if ($this->options['digg'] == 1) {
372
- $bookmarks .= '
373
- <li class="'.$class.'">
374
- <a class="DiggThisButton ';
375
- switch ($layout) {
376
- case 'horizontal':
377
- $bookmarks .= 'DiggCompact';
378
- break;
379
- case 'vertical':
380
- $bookmarks .= 'DiggMedium';
381
- break;
382
- default:
383
- $bookmarks .= 'DiggIcon';
384
- break;
385
- }
386
- $bookmarks .= '" href="http://digg.com/submit?url='.urlencode($url).'&amp;title='.urlencode($title).'"></a>
387
- </li>';
 
 
 
 
 
 
 
 
 
388
  }
389
- if ($this->options['reddit'] == 1) {
390
- $bookmarks .= '
391
- <li class="'.$class.'">';
392
- switch ($layout) {
393
- case 'horizontal':
394
- $bookmarks .= '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  <script type="text/javascript">
396
  reddit_url = "'.$url.'";
397
  reddit_title = "'.$title.'";
398
  </script>
399
  <script type="text/javascript" src="http://www.reddit.com/static/button/button1.js"></script>';
400
- break;
401
- case 'vertical':
402
- $bookmarks .= '
403
  <script type="text/javascript">
404
  reddit_url = "'.$url.'";
405
  reddit_title = "'.$title.'";
406
  </script>
407
  <script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script>';
408
- break;
409
- default:
410
- $bookmarks .= '
411
- <a href="http://www.reddit.com/submit" onclick="window.location = \'http://www.reddit.com/submit?url='.urlencode($url).'\'; return false"><img src="http://www.reddit.com/static/spreddit1.gif" alt="submit to reddit" border="0" /></a>';
412
- break;
413
- }
414
- $bookmarks .= '
415
- </li>';
416
  }
417
- if ($this->options['myspace'] == 1) {
418
- $bookmarks .= '
419
- <li class="'.$class.'">
420
- <a href="javascript:void(window.open(\'http://www.myspace.com/Modules/PostTo/Pages/?t='.urlencode($title).'&amp;u='.urlencode($url).'\',\'ptm\',\'height=450,width=550\').focus())">
421
- <img src="http://cms.myspacecdn.com/cms//ShareOnMySpace/Myspace_btn_';
422
- switch ($layout) {
423
- case 'horizontal':
424
- $bookmarks .= 'ShareOnMyspace';
425
- break;
426
- default:
427
- $bookmarks .= 'Share';
428
- break;
429
- }
430
- $bookmarks .= '.png" border="0" alt="Share on Myspace" />
431
- </a>
432
- </li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  }
434
- if ($this->options['hyves'] == 1) {
435
- $bookmarks .= '
436
- <li class="'.$class.'">
437
- <iframe src="http://www.hyves.nl/respect/button?url='.urlencode($url).'&amp;title='.urlencode($title).'" style="border: medium none; overflow:hidden; width:150px; height:21px;" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
438
- </li>';
439
  }
440
- $bookmarks .= '
441
- </ul>
442
- </div>';
443
- return $bookmarks;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  }
445
 
446
  function share($content) {
447
  $type = get_post_type().'s';
448
- if (($this->options['types'] == $type || $this->options['types'] == 'both') && (($type != 'pages' && (is_single() || $this->options['include_excerpts'] == 1)) || $type == 'pages' && !is_single())) {
449
- if ($this->options['position'] == 'top') {
450
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
451
  $content = $bookmarks.$content;
452
  }
453
- if ($this->options['position'] == 'bottom') {
454
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
455
  $content .= $bookmarks;
456
  }
@@ -460,31 +881,31 @@ class MR_Social_Sharing_Toolkit {
460
 
461
  function share_shortcode() {
462
  $bookmarks = '';
463
- if ($this->options['position'] == 'shortcode' && (is_single() || $this->options['include_excerpts'] == 1)) {
464
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
465
  }
466
  return $bookmarks;
467
  }
468
 
469
  function should_linkify_content() {
470
- if ($this->options['linkify_content'] == 1) {
471
  return true;
472
  }
473
  return false;
474
  }
475
 
476
  function should_linkify_comments() {
477
- if ($this->options['linkify_comments'] == 1) {
478
  return true;
479
  }
480
  return false;
481
  }
482
 
483
  function linkify($content) {
484
- if ($this->options['twitter_handles'] == 1) {
485
  $content = preg_replace("/(^|\s)*(@([a-zA-Z0-9-_]{1,15}))(\.*[^|\n|\r|\t|\s|\<|\&]*)/i", "$1<a href=\"http://twitter.com/$3\">$2</a>$4", $content);
486
  }
487
- if ($this->options['twitter_hashtags'] == 1) {
488
  $content = preg_replace("/(^|\s)*((?:(?<!&))#([a-zA-Z0-9]+^[-|;]))([^|\n|\r|\t|\s|\.|\<|\&]*)/i", "$1<a href=\"http://twitter.com/search/$3\">$2</a>$4", $content);
489
  }
490
  return $content;
@@ -494,15 +915,16 @@ class MR_Social_Sharing_Toolkit_Widget extends WP_Widget {
494
  function MR_Social_Sharing_Toolkit_Widget() {
495
  $widget_ops = array( 'classname' => 'MR_Social_Sharing_Toolkit_Widget', 'description' => '' );
496
  $control_ops = array( 'id_base' => 'mr-social-sharing-toolkit-widget' );
497
- $this->WP_Widget( 'mr-social-sharing-toolkit-widget', 'Social Sharing Toolkit Widget', $widget_ops, $control_ops );
498
  }
499
 
500
  function widget ( $args, $instance) {
501
  extract( $args );
502
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
503
- $widget_layout = empty($instance['widget_layout']) ? 'none' : $instance['widget_layout'];
504
  $widget_title = empty($instance['widget_title']) ? '' : $instance['widget_title'];
505
- $bookmarks = $MR_Social_Sharing_Toolkit->create_bookmarks('', wp_title('', false), $widget_layout);
 
 
506
  echo $before_widget;
507
  if ($widget_title != '') {
508
  echo $before_title . $widget_title . $after_title;
@@ -513,34 +935,67 @@ class MR_Social_Sharing_Toolkit_Widget extends WP_Widget {
513
 
514
  function update($new_instance, $old_instance) {
515
  $instance = $old_instance;
516
- $instance['widget_layout'] = $new_instance['widget_layout'];
517
  $instance['widget_title'] = $new_instance['widget_title'];
 
 
518
  return $instance;
519
  }
520
 
521
  function form($instance) {
522
- $instance = wp_parse_args((array) $instance, array( 'widget_title' => '', 'widget_layout' => 'none'));
523
  echo '
524
  <p>
525
  <label for="'.$this->get_field_id( 'widget_title' ).'">Title:</label>
526
  <input class="widefat" id="'.$this->get_field_id( 'widget_title' ).'" name="'.$this->get_field_name( 'widget_title' ).'" value="'.$instance['widget_title'].'" />
 
 
 
 
 
 
 
 
527
  </p>
528
  <p>
529
- <label for="'.$this->get_field_id( 'widget_layout' ).'">Widget layout:</label>
530
- <select id="'.$this->get_field_id( 'widget_layout' ).'" name="'.$this->get_field_name( 'widget_layout' ).'" class="widefat" style="width:100%;">
531
- <option ';
532
- if ( "none" == $instance['widget_layout'] ) echo 'selected="selected" ';
533
- echo 'value="none">Small buttons without counters</option>
534
- <option ';
535
- if ( "horizontal" == $instance['widget_layout'] ) echo 'selected="selected" ';
536
- echo 'value="horizontal">Wider buttons with counters</option>
537
- <option ';
538
- if ( "vertical" == $instance['widget_layout'] ) echo 'selected="selected" ';
539
- echo 'value="vertical">Higher buttons with counters</option>
540
- </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  </p>
542
  <p>
543
- Further configuration is done via the plugin admin screen under Settings &rarr; Social Sharing Toolkit.
544
  </p>';
545
  }
546
  }
@@ -555,7 +1010,8 @@ if ($MR_Social_Sharing_Toolkit->should_share_content()) {
555
  add_filter( 'the_content', array($MR_Social_Sharing_Toolkit, 'share'));
556
  }
557
  add_shortcode('social_share', array($MR_Social_Sharing_Toolkit, 'share_shortcode'));
558
- /* Register plugin */
559
  add_action('widgets_init', create_function('', 'return register_widget("MR_Social_Sharing_Toolkit_Widget");'));
 
560
  /* Register plugin admin page */
561
  add_action('admin_menu', array($MR_Social_Sharing_Toolkit, 'plugin_menu'));
3
  Plugin Name: Social Sharing Toolkit
4
  Plugin URI: http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/
5
  Description: This plugin enables sharing of your content via popular social networks and can also convert Twitter names and hashtags to links. Easy & configurable.
6
+ Version: 2.0.1
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
10
 
11
  class MR_Social_Sharing_Toolkit {
12
  var $options;
13
+ var $types;
14
+ var $share_buttons;
15
+ var $follow_buttons;
16
 
17
  function MR_Social_Sharing_Toolkit() {
18
+ /* Declare button types */
19
+ $this->types['none'] = 'Button';
20
+ $this->types['horizontal'] = 'Button + side counter';
21
+ $this->types['vertical'] = 'Button + top counter';
22
+ $this->types['icon_small'] = 'Small icon';
23
+ $this->types['icon_small_text'] = 'Small icon + text';
24
+ $this->types['icon_medium'] = 'Medium icon';
25
+ $this->types['icon_medium_text'] = 'Medium icon + text';
26
+ $this->types['icon_large'] = 'Large icon';
27
+ /* Declare bookmark buttons with options */
28
+ $this->share_buttons['fb_like'] = array('icon' => 'facebook', 'title' => 'Facebook Like', 'types' => array('none', 'horizontal', 'vertical'));
29
+ $this->share_buttons['fb_send'] = array('icon' => 'facebook', 'title' => 'Facebook Send', 'types' => array('none'));
30
+ $this->share_buttons['tw_tweet'] = array('icon' => 'twitter', 'title' => 'Twitter', 'id' => '@', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
31
+ $this->share_buttons['gl_plus'] = array('icon' => 'googleplus', 'title' => 'Google+', 'types' => array('none', 'horizontal', 'vertical'));
32
+ $this->share_buttons['li_share'] = array('icon' => 'linkedin', 'title' => 'LinkedIn', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large', 'horizontal', 'vertical'));
33
+ $this->share_buttons['tu_tumblr'] = array('icon' => 'tumblr', 'title' => 'Tumblr', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
34
+ $this->share_buttons['su_stumble'] = array('icon' => 'stumbleupon', 'title' => 'StumbleUpon', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
35
+ $this->share_buttons['dl_delicious'] = array('icon' => 'delicious', 'title' => 'Delicious', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
36
+ $this->share_buttons['dg_digg'] = array('icon' => 'digg', 'title' => 'Digg', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
37
+ $this->share_buttons['rd_reddit'] = array('icon' => 'reddit', 'title' => 'Reddit', 'types' => array('none', 'horizontal', 'vertical', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
38
+ $this->share_buttons['ms_myspace'] = array('icon' => 'myspace', 'title' => 'Myspace', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
39
+ $this->share_buttons['hv_respect'] = array('icon' => 'hyves', 'title' => 'Hyves Respect', 'types' => array('horizontal'));
40
+ $this->share_buttons['ml_send'] = array('icon' => 'email', 'title' => 'Send email', 'types' => array('none', 'icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
41
+ /* Declare follow buttons with options */
42
+ $this->follow_buttons['follow_facebook'] = array('icon' => 'facebook', 'title' => 'Facebook', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
43
+ $this->follow_buttons['follow_twitter'] = array('icon' => 'twitter', 'title' => 'Twitter', 'id' => '@', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
44
+ $this->follow_buttons['follow_plus'] = array('icon' => 'googleplus', 'title' => 'Google+', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
45
+ $this->follow_buttons['follow_linked'] = array('icon' => 'linkedin', 'title' => 'LinkedIn', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
46
+ $this->follow_buttons['follow_tumblr'] = array('icon' => 'tumblr', 'title' => 'Tumblr', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
47
+ $this->follow_buttons['follow_myspace'] = array('icon' => 'myspace', 'title' => 'Myspace', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
48
+ $this->follow_buttons['follow_hyves'] = array('icon' => 'hyves', 'title' => 'Hyves', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
49
+ $this->follow_buttons['follow_youtube'] = array('icon' => 'youtube', 'title' => 'YouTube', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
50
+ $this->follow_buttons['follow_flickr'] = array('icon' => 'flickr', 'title' => 'Flickr', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
51
+ $this->follow_buttons['follow_picasa'] = array('icon' => 'picasa', 'title' => 'Picasa', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
52
+ $this->follow_buttons['follow_deviant'] = array('icon' => 'deviantart', 'title' => 'deviantArt', 'id' => 'id:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
53
+ $this->follow_buttons['follow_rss'] = array('icon' => 'rss', 'title' => 'RSS Feed', 'id' => 'url:', 'types' => array('icon_small', 'icon_small_text', 'icon_medium', 'icon_medium_text', 'icon_large'));
54
+ /* Set defaults and load user options */
55
  $this->get_options();
56
  }
57
 
58
  function get_options() {
59
+ foreach ($this->share_buttons as $key => $val) {
60
+ $buttons[$key] = array('enable' => 1, 'type' => $val['types'][0]);
61
+ $widgets[$key] = array('enable' => 1, 'type' => $val['types'][0]);
62
+ $button_order[] = $key;
63
+ $widget_order[] = $key;
64
+ }
65
+ foreach ($this->follow_buttons as $key => $val) {
66
+ $followers[$key] = array('enable' => 1, 'type' => $val['types'][0], 'id' => '');
67
+ $follow_order[] = $key;
68
+ }
69
+ $this->options = array('mr_social_sharing_buttons' => $buttons, 'mr_social_sharing_widget_buttons' => $widgets, 'mr_social_sharing_follow_buttons' => $followers, 'mr_social_sharing_display' => 'span', 'mr_social_sharing_widget_display' => 'span', 'mr_social_sharing_follow_display' => 'span', 'mr_social_sharing_align' => '', 'mr_social_sharing_widget_align' => '', 'mr_social_sharing_follow_align' => '', 'mr_social_sharing_position' => 'none', 'mr_social_sharing_types' => 'both', 'mr_social_sharing_include_excerpts' => 1, 'mr_social_sharing_button_order' => $button_order, 'mr_social_sharing_widget_button_order' => $widget_order, 'mr_social_sharing_follow_button_order' => $follow_order, 'mr_social_sharing_linkify_content' => 0, 'mr_social_sharing_linkify_comments' => 0, 'mr_social_sharing_twitter_handles' => 0, 'mr_social_sharing_twitter_hashtags' => 0, 'mr_social_sharing_js_footer' => 0);
70
  foreach ($this->options as $key => $val) {
71
  $this->options[$key] = get_option( $key, $val );
72
  }
73
+ foreach ($this->share_buttons as $key => $val) {
74
+ if (!array_key_exists($key, $this->options['mr_social_sharing_buttons'])) {
75
+ $this->options['mr_social_sharing_buttons'][$key] = array('enable' => 1, 'type' => $val['types'][0]);
76
+ }
77
+ if (!array_key_exists($key, $this->options['mr_social_sharing_widget_buttons'])) {
78
+ $this->options['mr_social_sharing_widget_buttons'][$key] = array('enable' => 1, 'type' => $val['types'][0]);
79
+ }
80
+ if (!in_array($key, $this->options['mr_social_sharing_button_order'])) {
81
+ $this->options['mr_social_sharing_button_order'][] = $key;
82
+ }
83
+ if (!in_array($key, $this->options['mr_social_sharing_widget_button_order'])) {
84
+ $this->options['mr_social_sharing_widget_button_order'][] = $key;
85
+ }
86
+ }
87
+ foreach ($this->follow_buttons as $key => $val) {
88
+ if (!array_key_exists($key, $this->options['mr_social_sharing_follow_buttons'])) {
89
+ $this->options['mr_social_sharing_follow_buttons'][$key] = array('enable' => 1, 'type' => $val['types'][0], 'id' => '');
90
+ }
91
+ if (!in_array($key, $this->options['mr_social_sharing_follow_button_order'])) {
92
+ $this->options['mr_social_sharing_follow_button_order'][] = $key;
93
+ }
94
+ }
95
  return $this->options;
96
  }
97
 
111
 
112
  function plugin_menu() {
113
  add_options_page('Social Sharing', 'Social Sharing Toolkit', 'manage_options', 'mr_social_sharing', array($this, 'plugin_admin_page'));
114
+ add_filter('plugin_row_meta', array('MR_Social_Sharing_Toolkit', 'plugin_links'),10,2);
115
+ wp_enqueue_style('mr_social_sharing-admin', plugins_url('/admin.css', __FILE__));
116
+ wp_enqueue_script('mr_social_sharing-admin', plugins_url('/admin.js', __FILE__));
117
+ wp_enqueue_script('jquery-ui-sortable');
118
  }
119
 
120
+ function plugin_links($links, $file) {
121
+ if ($file == plugin_basename(__FILE__)) {
122
+ $links[] = '<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P8ZVNC57E58FE&lc=NL&item_name=WordPress%20plugins%20by%20Marijn%20Rongen&item_number=Social%20Sharing%20Toolkit&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">Donate</a>';
123
+ }
124
+ return $links;
125
+ }
126
+
127
  function plugin_admin_page() {
128
  if (!current_user_can('manage_options')) {
129
  wp_die( __('You do not have sufficient permissions to access this page.') );
130
  }
131
+ if( isset($_POST['mr_social_sharing_save_options']) && $_POST['mr_social_sharing_save_options'] == 'Y' ) {
132
  $this->save_options($_POST);
133
  echo '
134
  <div class="updated"><p><strong>'.__('settings saved.', 'mr_social_sharing' ).'</strong></p></div>';
136
  echo '
137
  <div class="wrap">
138
  <form method="post" action="">
139
+ <input type="hidden" name="mr_social_sharing_save_options" value="Y"/>
140
  <h2>Social Sharing Toolkit</h2>
141
+ <p>
142
+ Jump to: <a href="#mr_social_sharing_widget_networks">Posts & pages</a> | <a href="#mr_social_sharing_widget_networks">Share Widget</a> | <a href="#mr_social_sharing_follow_networks">Follow Widget</a> | <a href="#mr_twitter_links">Automatic Twitter links</a><br/>
143
+ <br/>
144
+ <label for="mr_social_sharing_js_footer" class="check"><input type="checkbox" name="mr_social_sharing_js_footer" id="mr_social_sharing_js_footer"';
145
+ if ($this->options['mr_social_sharing_js_footer'] == 1) { echo ' checked="checked"';}
146
+ echo ' value="1" /> Load JavaScript in footer</label><br/>
147
+ <span class="description"> '.__("Improves performance but may not work on some themes", 'mr_social_sharing').'</span>
148
+ </p>
149
+ <div class="mr_social_sharing_networks">
150
+ <h3>Posts & pages:</h3>
151
+ <p>
152
+ Check the boxes to display the button on your website. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list. For the tweet button you can also fill in your Twitter username which will then be appended to the tweet (like via @WordPress).
153
+ </p>
154
+ <ul id="mr_social_sharing_networks">';
155
+ foreach ($this->options['mr_social_sharing_button_order'] as $button) {
156
+ echo '
157
+ <li>
158
+ <img src="'.plugins_url('/images/icons_small/'.$this->share_buttons[$button]['icon'].'.png', __FILE__).'" title="'.$this->share_buttons[$button]['title'].'" alt="'.$this->share_buttons[$button]['title'].'"/>
159
+ <label for="mr_social_sharing_'.$button.'"><input type="checkbox" name="mr_social_sharing_buttons['.$button.'][enable]" id="mr_social_sharing_'.$button.'"';
160
+ if ($this->options['mr_social_sharing_buttons'][$button]['enable'] == 1) { echo ' checked="checked"';}
161
+ echo ' value="1" />'.$this->share_buttons[$button]['title'].'</label>
162
+ <img class="right" src="'.plugins_url('/images/move.png', __FILE__).'" title="Change button order" alt="Change button order"/>
163
+ <select name="mr_social_sharing_buttons['.$button.'][type]" id="mr_social_sharing_'.$button.'_type">';
164
+ foreach ($this->share_buttons[$button]['types'] as $type) {
165
+ echo '<option value="'.$type.'"';
166
+ if ($this->options['mr_social_sharing_buttons'][$button]['type'] == $type) { echo ' selected="selected"';}
167
+ echo '>'.$this->types[$type].'</option>';
168
+ }
169
+ if (array_key_exists('id', $this->share_buttons[$button])) {
170
+ echo '
171
+ <input type="text" class="text" name="mr_social_sharing_buttons['.$button.'][id]" id="mr_social_sharing_'.$button.'_id" value="'.$this->options['mr_social_sharing_buttons'][$button]['id'].'"/>
172
+ <label for="mr_social_sharing_'.$button.'_id" class="text">'.$this->share_buttons[$button]['id'].'</label>';
173
+ }
174
+ echo '
175
+ <input type="hidden" name="mr_social_sharing_button_order[]" value="'.$button.'"/>
176
+ </li>';
177
+ }
178
+ echo '
179
+ </ul>
180
+ <p>
181
+ Choose button orientation horizontal to display the buttons side by side, vertical will place them below each other. You can also select an alignment to better suit your theme.
182
+ </p>
183
+ <label for="mr_social_sharing_display">Button orientation</label>
184
+ <select name="mr_social_sharing_display" id="mr_social_sharing_display">
185
+ <option value="span"';
186
+ if ($this->options['mr_social_sharing_display'] == 'span') { echo ' selected="selected"';}
187
+ echo '>Horizontal</option>
188
+ <option value="div"';
189
+ if ($this->options['mr_social_sharing_display'] == 'div') { echo ' selected="selected"';}
190
+ echo '>Vertical</option>
191
+ </select><br/>
192
+ <label for="mr_social_sharing_align">Button alignment</label>
193
+ <select name="mr_social_sharing_align" id="mr_social_sharing_align">
194
+ <option value=""';
195
+ if ($this->options['mr_social_sharing_align'] == '') { echo ' selected="selected"';}
196
+ echo '>Align to bottom</option>
197
+ <option value="_top"';
198
+ if ($this->options['mr_social_sharing_align'] == '_top') { echo ' selected="selected"';}
199
+ echo '>Align to top</option>
200
+ </select>
201
+ <p>
202
+ Choose where the buttons must be displayed and if the buttons should be displayed on posts, pages or both.
203
+ </p>
204
+ <label for="mr_social_sharing_position">Button location</label>
205
+ <select name="mr_social_sharing_position" id="mr_social_sharing_position">
206
+ <option value="none"';
207
+ if ($this->options['mr_social_sharing_position'] == 'none') { echo ' selected="selected"';}
208
  echo '>Do not display social bookmarks</option>
209
  <option value="top"';
210
+ if ($this->options['mr_social_sharing_position'] == 'top') { echo ' selected="selected"';}
211
  echo '>Display above content</option>
212
  <option value="bottom"';
213
+ if ($this->options['mr_social_sharing_position'] == 'bottom') { echo ' selected="selected"';}
214
  echo '>Display below content</option>
215
  <option value="shortcode"';
216
+ if ($this->options['mr_social_sharing_position'] == 'shortcode') { echo ' selected="selected"';}
217
  echo '>Let me decide by using shortcode</option>
218
+ </select><br/>';
219
+ if ($this->options['mr_social_sharing_position'] == 'shortcode') {
220
+ echo '<span class="description"> '.__("Use the shortcode [social_share/] where you want the buttons to appear", 'mr_social_sharing').'</span><br/>';
221
  }
222
  echo '
223
+ <label for="mr_social_sharing_types">Place buttons on</label>
224
+ <select name="mr_social_sharing_types" id="mr_social_sharing_types">
225
+ <option value="both"';
226
+ if ($this->options['mr_social_sharing_types'] == 'both') { echo ' selected="selected"';}
 
 
 
 
 
 
227
  echo '>On posts and pages</option>
228
+ <option value="posts"';
229
+ if ($this->options['mr_social_sharing_types'] == 'posts') { echo ' selected="selected"';}
230
  echo '>Only on posts</option>
231
+ <option value="pages"';
232
+ if ($this->options['mr_social_sharing_types'] == 'pages') { echo ' selected="selected"';}
233
  echo '>Only on pages</option>
234
+ </select>
235
+ <p>
236
+ Uncheck this box if you are having issues displaying the buttons with excerpts (some themes have custom excerpt functions which do not play nice with the plugin).
237
+ </p>
238
+ <label for="mr_social_sharing_include_excerpts" class="check"><input type="checkbox" name="mr_social_sharing_include_excerpts" id="mr_social_sharing_include_excerpts"';
239
+ if ($this->options['mr_social_sharing_include_excerpts'] == 1) { echo ' checked="checked"';}
240
+ echo ' value="1" /> Include buttons in excerpts</label>
241
+ </div>
242
+ <p class="submit">
243
+ <input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
244
+ </p>
245
+ <div class="mr_social_sharing_networks">
246
+ <h3>Share Widget:</h3>
247
+ <p>
248
+ Check the boxes to display the button on Social Sharing Toolkit Share widget. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list. For the tweet button you can also fill in your Twitter username which will then be appended to the tweet (like via @WordPress).<br/>
249
+ <br/>
250
+ For each widget you can enter a fixed url and title for the buttons, to do this <a href="widgets.php">go to the widget configuration page</a>.
251
+ </p>
252
+ <ul id="mr_social_sharing_widget_networks">';
253
+ foreach ($this->options['mr_social_sharing_widget_button_order'] as $button) {
254
+ echo '
255
+ <li>
256
+ <img src="'.plugins_url('/images/icons_small/'.$this->share_buttons[$button]['icon'].'.png', __FILE__).'" title="'.$this->share_buttons[$button]['title'].'" alt="'.$this->share_buttons[$button]['title'].'"/>
257
+ <label for="mr_social_sharing_widget_'.$button.'"><input type="checkbox" name="mr_social_sharing_widget_buttons['.$button.'][enable]" id="mr_social_sharing_widget_'.$button.'"';
258
+ if ($this->options['mr_social_sharing_widget_buttons'][$button]['enable'] == 1) { echo ' checked="checked"';}
259
+ echo ' value="1" />'.$this->share_buttons[$button]['title'].'</label>
260
+ <img class="right" src="'.plugins_url('/images/move.png', __FILE__).'" title="Change button order" alt="Change button order"/>
261
+ <select name="mr_social_sharing_widget_buttons['.$button.'][type]" id="mr_social_sharing_widget_'.$button.'_type">';
262
+ foreach ($this->share_buttons[$button]['types'] as $type) {
263
+ echo '<option value="'.$type.'"';
264
+ if ($this->options['mr_social_sharing_widget_buttons'][$button]['type'] == $type) { echo ' selected="selected"';}
265
+ echo '>'.$this->types[$type].'</option>';
266
+ }
267
+ if (array_key_exists('id', $this->share_buttons[$button])) {
268
+ echo '
269
+ <input type="text" class="text" name="mr_social_sharing_widget_buttons['.$button.'][id]" id="mr_social_sharing_widget_'.$button.'_id" value="'.$this->options['mr_social_sharing_widget_buttons'][$button]['id'].'"/>
270
+ <label for="mr_social_sharing_widget_'.$button.'_id" class="text">'.$this->share_buttons[$button]['id'].'</label>';
271
+ }
272
+ echo '
273
+ <input type="hidden" name="mr_social_sharing_widget_button_order[]" value="'.$button.'"/>
274
+ </li>';
275
+ }
276
  echo '
277
+ </ul>
278
+ <p>
279
+ Choose button orientation horizontal to display the buttons side by side, vertical will place them below each other. You can also select an alignment to better suit your theme.
280
+ </p>
281
+ <label for="mr_social_sharing_widget_display">Button orientation</label>
282
+ <select name="mr_social_sharing_widget_display" id="mr_social_sharing_widget_display">
283
+ <option value="span"';
284
+ if ($this->options['mr_social_sharing_widget_display'] == 'span') { echo ' selected="selected"';}
285
+ echo '>Horizontal</option>
286
+ <option value="div"';
287
+ if ($this->options['mr_social_sharing_widget_display'] == 'div') { echo ' selected="selected"';}
288
+ echo '>Vertical</option>
289
+ </select><br/>
290
+ <label for="mr_social_sharing_widget_align">Button alignment</label>
291
+ <select name="mr_social_sharing_widget_align" id="mr_social_widget_sharing_align">
292
+ <option value=""';
293
+ if ($this->options['mr_social_sharing_widget_align'] == '') { echo ' selected="selected"';}
294
+ echo '>Align to bottom</option>
295
+ <option value="_top"';
296
+ if ($this->options['mr_social_sharing_widget_align'] == '_top') { echo ' selected="selected"';}
297
+ echo '>Align to top</option>
298
+ </select>
299
+ </div>
300
+ <p class="submit">
301
+ <input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
302
+ </p>
303
+ <div class="mr_social_sharing_networks">
304
+ <h3>Follow Widget:</h3>
305
+ <p>
306
+ Check the boxes to display the button on Social Sharing Toolkit Follow widget. For each button you can select a separate style from the dropdown box. You can change the order of the buttons by dragging them to the desired location in the list.<br/>
307
+ <br/>
308
+ For each button you only have to enter your id or username of the network as it appears in the url of your profile page. You will need to enter the complete url for the RSS Feed (including the http:// part) if you wish to display this button.<br/>
309
+ <br/>
310
+ To add the widget to your website <a href="widgets.php">go to the widget configuration page</a>.
311
+ </p>
312
+ <ul id="mr_social_sharing_follow_networks">';
313
+ foreach ($this->options['mr_social_sharing_follow_button_order'] as $button) {
314
+ echo '
315
+ <li>
316
+ <img src="'.plugins_url('/images/icons_small/'.$this->follow_buttons[$button]['icon'].'.png', __FILE__).'" title="'.$this->follow_buttons[$button]['title'].'" alt="'.$this->follow_buttons[$button]['title'].'"/>
317
+ <label for="mr_social_sharing_follow_'.$button.'"><input type="checkbox" name="mr_social_sharing_follow_buttons['.$button.'][enable]" id="mr_social_sharing_follow_'.$button.'"';
318
+ if ($this->options['mr_social_sharing_follow_buttons'][$button]['enable'] == 1) { echo ' checked="checked"';}
319
+ echo ' value="1" />'.$this->follow_buttons[$button]['title'].'</label>
320
+ <img class="right" src="'.plugins_url('/images/move.png', __FILE__).'" title="Change button order" alt="Change button order"/>
321
+ <select name="mr_social_sharing_follow_buttons['.$button.'][type]" id="mr_social_sharing_follow_'.$button.'_type">';
322
+ foreach ($this->follow_buttons[$button]['types'] as $type) {
323
+ echo '<option value="'.$type.'"';
324
+ if ($this->options['mr_social_sharing_follow_buttons'][$button]['type'] == $type) { echo ' selected="selected"';}
325
+ echo '>'.$this->types[$type].'</option>';
326
+ }
327
+ if (array_key_exists('id', $this->follow_buttons[$button])) {
328
+ echo '
329
+ <input type="text" class="text" name="mr_social_sharing_follow_buttons['.$button.'][id]" id="mr_social_sharing_follow_'.$button.'_id" value="'.$this->options['mr_social_sharing_follow_buttons'][$button]['id'].'"/>
330
+ <label for="mr_social_sharing_follow_'.$button.'_id" class="text">'.$this->follow_buttons[$button]['id'].'</label>';
331
+ }
332
+ echo '
333
+ <input type="hidden" name="mr_social_sharing_follow_button_order[]" value="'.$button.'"/>
334
+ </li>';
335
+ }
336
  echo '
337
+ </ul>
338
+ <p>
339
+ Choose button orientation horizontal to display the buttons side by side, vertical will place them below each other. You can also select an alignment to better suit your theme.
340
+ </p>
341
+ <label for="mr_social_sharing_follow_display">Button orientation</label>
342
+ <select name="mr_social_sharing_follow_display" id="mr_social_sharing_follow_display">
343
+ <option value="span"';
344
+ if ($this->options['mr_social_sharing_follow_display'] == 'span') { echo ' selected="selected"';}
345
+ echo '>Horizontal</option>
346
+ <option value="div"';
347
+ if ($this->options['mr_social_sharing_follow_display'] == 'div') { echo ' selected="selected"';}
348
+ echo '>Vertical</option>
349
+ </select><br/>
350
+ <label for="mr_social_sharing_follow_align">Button alignment</label>
351
+ <select name="mr_social_sharing_follow_align" id="mr_social_widget_sharing_align">
352
+ <option value=""';
353
+ if ($this->options['mr_social_sharing_follow_align'] == '') { echo ' selected="selected"';}
354
+ echo '>Align to bottom</option>
355
+ <option value="_top"';
356
+ if ($this->options['mr_social_sharing_follow_align'] == '_top') { echo ' selected="selected"';}
357
+ echo '>Align to top</option>
358
+ </select>
359
+ </div>
360
+ <p class="submit">
361
+ <input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
362
+ </p>
363
+ <div class="mr_social_sharing_networks" id="mr_twitter_links">
364
+ <h3>Automatic Twitter links</h3>
365
+ <p>Select what you want to convert…</p>
366
+ <label for="mr_social_sharing_twitter_handles" class="check"><input type="checkbox" name="mr_social_sharing_twitter_handles" id="mr_social_sharing_twitter_handles"';
367
+ if ($this->options['mr_social_sharing_twitter_handles'] == 1) { echo ' checked="checked"';}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  echo ' value="1" /> '.__("Convert Twitter usernames", 'mr_social_sharing').'</label><br/>
369
+ <label for="mr_social_sharing_twitter_hashtags" class="check"><input type="checkbox" name="mr_social_sharing_twitter_hashtags" id="mr_social_sharing_twitter_hashtags"';
370
+ if ($this->options['mr_social_sharing_twitter_hashtags'] == 1) { echo ' checked="checked"';}
371
  echo ' value="1" /> '.__("Convert hashtags", 'mr_social_sharing').'</label>
372
+ <p>... and where it should be converted</p>
373
+ <label for="mr_social_sharing_linkify_content" class="check"><input type="checkbox" name="mr_social_sharing_linkify_content" id="mr_social_sharing_linkify_content"';
374
+ if ($this->options['mr_social_sharing_linkify_content'] == 1) { echo ' checked="checked"';}
 
 
 
 
 
 
375
  echo ' value="1" /> '.__("Convert in posts and pages", 'mr_social_sharing').'</label><br/>
376
+ <label for="mr_social_sharing_linkify_comments" class="check"><input type="checkbox" name="mr_social_sharing_linkify_comments" id="mr_social_sharing_linkify_comments"';
377
+ if ($this->options['mr_social_sharing_linkify_comments'] == 1) { echo ' checked="checked"';}
378
  echo ' value="1" /> '.__("Convert in comments", 'mr_social_sharing').'</label>
379
+ </div>
 
 
 
380
  <p class="submit">
381
  <input type="submit" name="Submit" class="button-primary" value="'.esc_attr__('Save Changes').'" />
382
  </p>
383
+ <div class="mr_social_sharing_networks">
384
+ <h3>Thank you for using the Social Sharing Toolkit!</h3>
385
+ <p>
386
+ For questions or requests about this plugin please use the <a href="http://www.marijnrongen.com/wordpress-plugins/social-sharing-toolkit/" target="_blank">official plugin page</a>.
387
+ If you like the plugin I would appreciate it if you provide a rating of the <a href="http://wordpress.org/extend/plugins/social-sharing-toolkit/" target="_blank">plugin on WordPress.org</a>. If you really like the plugin you can also <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=P8ZVNC57E58FE&lc=NL&item_name=WordPress%20plugins%20by%20Marijn%20Rongen&item_number=Social%20Sharing%20Toolkit&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank">donate here</a>.
388
+ </p>
389
+ </div>
390
  </form>
391
  </div>';
392
  }
395
 
396
  function should_share_content() {
397
  wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
398
+ wp_enqueue_script('mr_social_sharing', plugins_url('script.js', __FILE__), array('jquery'), array(), false, true);
399
+ if ($this->options['mr_social_sharing_buttons']['gl_plus']['enable'] == 1 || $this->options['mr_social_sharing_widget_buttons']['gl_plus']['enable'] == 1) {
400
+ if ($this->options['mr_social_sharing_js_footer'] == 1) {
401
+ wp_enqueue_script('GooglePlus', 'http://apis.google.com/js/plusone.js', array(), false, true);
402
+ } else {
403
+ wp_enqueue_script('GooglePlus', 'http://apis.google.com/js/plusone.js');
404
+ }
405
+ }
406
+ if ($this->options['mr_social_sharing_buttons']['dg_digg']['enable'] == 1 || $this->options['mr_social_sharing_widget_buttons']['dg_digg']['enable'] == 1) {
407
+ if ($this->options['mr_social_sharing_buttons']['dg_digg']['type'] == 'horizontal' || $this->options['mr_social_sharing_buttons']['dg_digg']['type'] == 'vertical' || $this->options['mr_social_sharing_widget_buttons']['dg_digg']['type'] == 'horizontal' || $this->options['mr_social_sharing_widget_buttons']['dg_digg']['type'] == 'vertical') {
408
+ if ($this->options['mr_social_sharing_js_footer'] == 1) {
409
+ wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__), array(), false, true);
410
+ } else {
411
+ wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__));
412
+ }
413
+ }
414
+ }
415
+ if ($this->options['mr_social_sharing_buttons']['li_share']['enable'] == 1 || $this->options['mr_social_sharing_widget_buttons']['li_share']['enable'] == 1) {
416
+ if ($this->options['mr_social_sharing_buttons']['li_share']['type'] == 'horizontal' || $this->options['mr_social_sharing_buttons']['li_share']['type'] == 'vertical' || $this->options['mr_social_sharing_buttons']['li_share']['type'] == 'none' || $this->options['mr_social_sharing_widget_buttons']['li_share']['type'] == 'horizontal' || $this->options['mr_social_sharing_widget_buttons']['li_share']['type'] == 'vertical' || $this->options['mr_social_sharing_widget_buttons']['li_share']['type'] == 'none') {
417
+ if ($this->options['mr_social_sharing_js_footer'] == 1) {
418
+ wp_enqueue_script('LinkedIn', 'http://platform.linkedin.com/in.js', array(), false, true);
419
+ } else {
420
+ wp_enqueue_script('LinkedIn', 'http://platform.linkedin.com/in.js');
421
+ }
422
+ }
423
  }
424
+ if ($this->options['mr_social_sharing_buttons']['fb_send']['enable'] == 1 || $this->options['mr_social_sharing_widget_buttons']['fb_send']['enable'] == 1) {
425
+ if ($this->options['mr_social_sharing_js_footer'] == 1) {
426
+ wp_enqueue_script('FacebookSend', 'http://connect.facebook.net/en_US/all.js#xfbml=1', array(), false, true);
427
+ } else {
428
+ wp_enqueue_script('FacebookSend', 'http://connect.facebook.net/en_US/all.js#xfbml=1');
429
+ }
430
  }
431
+ if ($this->options['mr_social_sharing_buttons']['tw_tweet']['enable'] == 1 || $this->options['mr_social_sharing_widget_buttons']['tw_tweet']['enable'] == 1) {
432
+ if ($this->options['mr_social_sharing_buttons']['tw_tweet']['type'] == 'horizontal' || $this->options['mr_social_sharing_buttons']['tw_tweet']['type'] == 'vertical' || $this->options['mr_social_sharing_widget_buttons']['tw_tweet']['type'] == 'horizontal' || $this->options['mr_social_sharing_widget_buttons']['tw_tweet']['type'] == 'vertical') {
433
+ if ($this->options['mr_social_sharing_js_footer'] == 1) {
434
+ wp_enqueue_script('Twitter', 'http://platform.twitter.com/widgets.js', array(), false, true);
435
+ } else {
436
+ wp_enqueue_script('Twitter', 'http://platform.twitter.com/widgets.js');
437
+ }
438
+ }
439
  }
440
+ if ($this->options['mr_social_sharing_position'] == 'none' || $this->options['mr_social_sharing_position'] == 'shortcode') {
441
  return false;
442
  }
443
  return true;
444
  }
445
 
446
+ function create_bookmarks($url = '', $title = '', $type = '') {
447
  $url = trim($url);
448
  $title = trim($title);
449
  if ($url == '') {
450
  $url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
451
  }
452
+ $bookmarks = '
453
+ <!-- Social Sharing Toolkit v2.0.1 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->
454
+ <div class="mr_social_sharing_wrapper">';
455
+ foreach ($this->options['mr_social_sharing_'.$type.'button_order'] as $button) {
456
+ if ($this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable'] == 1) {
457
+ $id = array_key_exists('id', $this->options['mr_social_sharing_'.$type.'buttons'][$button]) ? $this->options['mr_social_sharing_'.$type.'buttons'][$button]['id'] : '';
458
+ $bookmarks .= $this->get_bookmark_button($button, $url, $title, $this->options['mr_social_sharing_'.$type.'buttons'][$button]['type'], $this->options['mr_social_sharing_'.$type.'display'], $this->options['mr_social_sharing_'.$type.'align'], $id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  }
460
+ }
461
+ $bookmarks .= '
462
+ </div>';
463
+ return $bookmarks;
464
+ }
465
+
466
+ function create_followers() {
467
+ $followers = '
468
+ <!-- Social Sharing Toolkit v2.0.1 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->
469
+ <div class="mr_social_sharing_wrapper">';
470
+ foreach ($this->options['mr_social_sharing_follow_button_order'] as $button) {
471
+ if ($this->options['mr_social_sharing_follow_buttons'][$button]['enable'] == 1) {
472
+ $id = array_key_exists('id', $this->options['mr_social_sharing_follow_buttons'][$button]) ? $this->options['mr_social_sharing_follow_buttons'][$button]['id'] : '';
473
+ $followers .= $this->get_follow_button($button, $this->options['mr_social_sharing_follow_buttons'][$button]['type'], $this->options['mr_social_sharing_follow_display'], $this->options['mr_social_sharing_follow_align'], $id);
 
 
 
 
 
 
474
  }
475
+ }
476
+ $followers .= '
477
+ </div>';
478
+ return $followers;
479
+ }
480
+
481
+ function get_bookmark_button($button, $url, $title, $type, $display = 'span', $align = '', $id = '') {
482
+ $button = 'get_'.$button;
483
+ $retval = '
484
+ <'.$display.' class="mr_social_sharing'.$align.'">'.$this->$button($url, $title, $type, $id).'
485
+ </'.$display.'>';
486
+ return $retval;
487
+ }
488
+
489
+ function get_follow_button($button, $type, $display = 'span', $align = '', $id = '') {
490
+ $button = 'get_'.$button;
491
+ $retval = '
492
+ <'.$display.' class="mr_social_sharing'.$align.'">'.$this->$button($type, $id).'
493
+ </'.$display.'>';
494
+ return $retval;
495
+ }
496
+
497
+ function get_fb_like($url, $title, $type, $id) {
498
+ $retval = '
499
+ <iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&amp;href='.urlencode($url).'&amp;layout=';
500
+ switch ($type) {
501
+ case 'horizontal':
502
+ $retval .= 'button_count';
503
+ $width = 'auto';
504
+ $height = '20px';
505
+ break;
506
+ case 'vertical':
507
+ $retval .= 'box_count';
508
+ $width = '55px';
509
+ $height = '65px';
510
+ break;
511
+ default:
512
+ $retval .= 'standard';
513
+ $width = 'auto';
514
+ $height = '24px';
515
+ break;
516
  }
517
+ $retval .= '&amp;show_faces=false&amp;width='.$width.'&amp;height='.$height.'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'.$width.'; height:'.$height.';" allowTransparency="true"></iframe>';
518
+ return $retval;
519
+ }
520
+
521
+ function get_fb_send($url, $title, $type, $id) {
522
+ $retval = '
523
+ <div id="fb-root"></div>
524
+ <fb:send href="'.$url.'" font=""></fb:send>';
525
+ return $retval;
526
+ }
527
+
528
+ function get_tw_tweet($url, $title, $type, $id) {
529
+ switch ($type) {
530
+ case 'horizontal':
531
+ $retval = '
532
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="horizontal"';
533
+ if ($id != '') {
534
+ $retval .= ' data-via="'.$id.'"';
535
+ }
536
+ $retval .= ' data-text="'.$title.'">Tweet</a>';
537
+ break;
538
+ case 'vertical':
539
+ $retval = '
540
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="vertical"';
541
+ if ($id != '') {
542
+ $retval .= ' data-via="'.$id.'"';
543
+ }
544
+ $retval .= ' data-text="'.$title.'">Tweet</a>';
545
+ break;
546
+ default:
547
+ $url = 'http://twitter.com/share?url='.urlencode($url).'&amp;text='.urlencode($title);
548
+ if ($id != '') {
549
+ $url .= '&amp;via='.$id;
550
+ }
551
+ $title = 'Share on Twitter';
552
+ $text = 'Share on Twitter';
553
+ $icon = 'twitter';
554
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
555
+ break;
556
+ }
557
+ return $retval;
558
+ }
559
+
560
+ function get_gl_plus($url, $title, $type, $id) {
561
+ $retval = '
562
  <g:plusone';
563
+ switch ($type) {
564
+ case 'horizontal':
565
+ $retval .= ' size="medium"';
566
+ break;
567
+ case 'vertical':
568
+ $retval .= ' size="tall"';
569
+ break;
570
+ default:
571
+ $retval .= ' size="medium" count="false"';
572
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  }
574
+ $retval .= ' href="'.$url.'"></g:plusone>';
575
+ return $retval;
576
+ }
577
+
578
+ function get_li_share($url, $title, $type, $id) {
579
+ switch ($type) {
580
+ case 'horizontal':
581
+ $retval = '
582
+ <script type="IN/Share" data-url="'.$url.'" data-counter="right"></script>';
583
+ break;
584
+ case 'vertical':
585
+ $retval = '
586
+ <script type="IN/Share" data-url="'.$url.'" data-counter="top"></script>';
587
+ break;
588
+ case 'none':
589
+ $retval = '
590
+ <script type="IN/Share" data-url="'.$url.'"></script>';
591
+ break;
592
+ default:
593
+ $url = 'http://www.linkedin.com/shareArticle?mini=true&amp;url='.urlencode($url).'&amp;title='.urlencode($title);
594
+ $title = 'Share on LinkedIn';
595
+ $text = 'Share on LinkedIn';
596
+ $icon = 'linkedin';
597
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
598
+ break;
599
  }
600
+ return $retval;
601
+ }
602
+
603
+ function get_tu_tumblr($url, $title, $type, $id) {
604
+ $url = 'http://www.tumblr.com/share/link?url='.urlencode($url).'&amp;name='.urlencode($title);
605
+ $title = 'Share on Tumblr';
606
+ $text = 'Share on Tumblr';
607
+ $icon = 'tumblr';
608
+ return $this->get_icon($type, $url, $title, $text, $icon, true);
609
+ }
610
+
611
+ function get_su_stumble($url, $title, $type, $id) {
612
+ switch ($type) {
613
+ case 'horizontal':
614
+ $retval = '
615
+ <script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r='.urlencode($url).'"></script>';
616
+ break;
617
+ case 'vertical':
618
+ $retval = '
619
+ <script src="http://www.stumbleupon.com/hostedbadge.php?s=5&amp;r='.urlencode($url).'"></script>';
620
+ break;
621
+ default:
622
+ $url = 'http://www.stumbleupon.com/submit?url='.urlencode($url).'&amp;title='.urlencode($title);
623
+ $title = 'Submit to StumbleUpon';
624
+ $text = 'Submit to StumbleUpon';
625
+ $icon = 'stumbleupon';
626
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
627
+ break;
628
  }
629
+ return $retval;
630
+ }
631
+
632
+ function get_dl_delicious($url, $title, $type, $id) {
633
+ switch ($type) {
634
+ case 'horizontal':
635
+ $hash = md5($url);
636
+ $retval = '
637
+ <div class="delicious_horizontal">
638
+ <span class="delicious_hash">'.$hash.'</span><a class="mr_social_sharing_popup_link" href="http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url='.urlencode($url).'&amp;title='.urlencode($title).'" target="_blank"></a>
639
+ </div>';
640
+ break;
641
+ case 'vertical':
642
+ $hash = md5($url);
643
+ $retval = '
644
+ <div class="delicious_vertical">
645
+ <span class="delicious_hash">'.$hash.'</span><a class="mr_social_sharing_popup_link" href="http://del.icio.us/post?v=4&amp;noui&amp;jump=close&amp;url='.urlencode($url).'&amp;title='.urlencode($title).'" target="_blank"></a>
646
+ </div>';
647
+ break;
648
+ default:
649
+ $url = 'http://del.icio.us/post?url='.urlencode($url).'&amp;title='.urlencode($title);
650
+ $title = 'Save on Delicious';
651
+ $text = 'Save on Delicious';
652
+ $icon = 'delicious';
653
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
654
+ break;
655
  }
656
+ return $retval;
657
+ }
658
+
659
+ function get_dg_digg($url, $title, $type, $id) {
660
+ switch ($type) {
661
+ case 'horizontal':
662
+ $retval = '
663
+ <a class="DiggThisButton DiggCompact" href="http://digg.com/submit?url='.urlencode($url).'&amp;title='.urlencode($title).'"></a>';
664
+ break;
665
+ case 'vertical':
666
+ $retval = '
667
+ <a class="DiggThisButton DiggMedium" href="http://digg.com/submit?url='.urlencode($url).'&amp;title='.urlencode($title).'"></a>';
668
+ break;
669
+ default:
670
+ $url = 'http://digg.com/submit?url='.urlencode($url).'&amp;title='.urlencode($title);
671
+ $title = 'Digg This';
672
+ $text = 'Digg This';
673
+ $icon = 'digg';
674
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
675
+ break;
676
+ }
677
+ return $retval;
678
+ }
679
+
680
+ function get_rd_reddit($url, $title, $type, $id) {
681
+ switch ($type) {
682
+ case 'horizontal':
683
+ $retval = '
684
  <script type="text/javascript">
685
  reddit_url = "'.$url.'";
686
  reddit_title = "'.$title.'";
687
  </script>
688
  <script type="text/javascript" src="http://www.reddit.com/static/button/button1.js"></script>';
689
+ break;
690
+ case 'vertical':
691
+ $retval = '
692
  <script type="text/javascript">
693
  reddit_url = "'.$url.'";
694
  reddit_title = "'.$title.'";
695
  </script>
696
  <script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script>';
697
+ break;
698
+ default:
699
+ $url = 'http://www.reddit.com/submit?url='.urlencode($url);
700
+ $title = 'Submit to reddit';
701
+ $text = 'Submit to reddit';
702
+ $icon = 'reddit';
703
+ $retval = $this->get_icon($type, $url, $title, $text, $icon, true);
704
+ break;
705
  }
706
+ return $retval;
707
+ }
708
+
709
+ function get_ms_myspace($url, $title, $type, $id) {
710
+ $url = 'http://www.myspace.com/Modules/PostTo/Pages/?t='.urlencode($title).'&amp;u='.urlencode($url);
711
+ $title = 'Share on Myspace';
712
+ $text = 'Share on Myspace';
713
+ $icon = 'myspace';
714
+ return $this->get_icon($type, $url, $title, $text, $icon, true);
715
+ }
716
+
717
+ function get_hv_respect($url, $title, $type, $id) {
718
+ $retval = '
719
+ <iframe src="http://www.hyves.nl/respect/button?url='.urlencode($url).'&amp;title='.urlencode($title).'" style="border: medium none; overflow:hidden; width:150px; height:21px;" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>';
720
+ return $retval;
721
+ }
722
+
723
+ function get_ml_send($url, $title, $type, $id) {
724
+ $url = 'mailto:?subject='.$title.'&amp;body='.$url;
725
+ $title = 'Share via email';
726
+ $text = 'Share via email';
727
+ $icon = 'email';
728
+ return $this->get_icon($type, $url, $title, $text, $icon);
729
+ }
730
+
731
+ function get_follow_facebook($type, $id) {
732
+ $url = 'http://www.facebook.com/'.$id;
733
+ $title = 'Friend me on Facebook';
734
+ $text = 'Facebook';
735
+ $icon = 'facebook';
736
+ return $this->get_icon($type, $url, $title, $text, $icon);
737
+ }
738
+
739
+ function get_follow_twitter($type, $id) {
740
+ $url = 'http://twitter.com/'.$id;
741
+ $title = 'Follow me on Twitter';
742
+ $text = 'Twitter';
743
+ $icon = 'twitter';
744
+ return $this->get_icon($type, $url, $title, $text, $icon);
745
+ }
746
+
747
+ function get_follow_plus($type, $id) {
748
+ $url = 'http://plus.google.com/'.$id;
749
+ $title = 'Add me to your circles';
750
+ $text = 'Google+';
751
+ $icon = 'googleplus';
752
+ return $this->get_icon($type, $url, $title, $text, $icon);
753
+ }
754
+
755
+ function get_follow_linked($type, $id) {
756
+ $url = 'http://www.linkedin.com/in/'.$id;
757
+ $title = 'Connect to me on LinkedIn';
758
+ $text = 'LinkedIn';
759
+ $icon = 'linkedin';
760
+ return $this->get_icon($type, $url, $title, $text, $icon);
761
+ }
762
+
763
+ function get_follow_tumblr($type, $id) {
764
+ $url = 'http://'.$id.'.tumblr.com';
765
+ $title = 'Follow me on Tumblr';
766
+ $text = 'Tumblr';
767
+ $icon = 'tumblr';
768
+ return $this->get_icon($type, $url, $title, $text, $icon);
769
+ }
770
+
771
+ function get_follow_myspace($type, $id) {
772
+ $url = 'http://www.myspace.com/'.$id;
773
+ $title = 'Friend me on Myspace';
774
+ $text = 'Myspace';
775
+ $icon = 'myspace';
776
+ return $this->get_icon($type, $url, $title, $text, $icon);
777
+ }
778
+
779
+ function get_follow_hyves($type, $id) {
780
+ $url = 'http://'.$id.'.hyves.nl';
781
+ $title = 'Friend me on Hyves';
782
+ $text = 'Hyves';
783
+ $icon = 'hyves';
784
+ return $this->get_icon($type, $url, $title, $text, $icon);
785
+ }
786
+
787
+ function get_follow_youtube($type, $id) {
788
+ $url = 'http://www.youtube.com/user/'.$id;
789
+ $title = 'Watch me on YouTube';
790
+ $text = 'YouTube';
791
+ $icon = 'youtube';
792
+ return $this->get_icon($type, $url, $title, $text, $icon);
793
+ }
794
+
795
+ function get_follow_flickr($type, $id) {
796
+ $url = 'http://www.flickr.com/photos/'.$id;
797
+ $title = 'My photostream on Flickr';
798
+ $text = 'Flickr';
799
+ $icon = 'flickr';
800
+ return $this->get_icon($type, $url, $title, $text, $icon);
801
+ }
802
+
803
+ function get_follow_picasa($type, $id) {
804
+ $url = 'http://picasaweb.google.com/'.$id;
805
+ $title = 'My Picasa Web Albums';
806
+ $text = 'Picasa';
807
+ $icon = 'picasa';
808
+ return $this->get_icon($type, $url, $title, $text, $icon);
809
+ }
810
+
811
+ function get_follow_deviant($type, $id) {
812
+ $url = 'http://'.$id.'.deviantart.com/';
813
+ $title = 'My deviantArt';
814
+ $text = 'deviantArt';
815
+ $icon = 'deviantart';
816
+ return $this->get_icon($type, $url, $title, $text, $icon);
817
+ }
818
+
819
+ function get_follow_rss($type, $id) {
820
+ $url = $id;
821
+ $title = 'RSS Feed';
822
+ $text = 'RSS Feed';
823
+ $icon = 'rss';
824
+ return $this->get_icon($type, $url, $title, $text, $icon);
825
+ }
826
+
827
+ function get_icon($type, $url, $title, $text, $icon, $popup = false) {
828
+ if ($icon != 'email') {
829
+ $url .= '" target="_blank';
830
  }
831
+ if ($popup) {
832
+ $url .= '" class="mr_social_sharing_popup_link';
 
 
 
833
  }
834
+ switch ($type) {
835
+ case 'none':
836
+ $retval = '
837
+ <a href="'.$url.'"><img src="'.plugins_url('/images/buttons/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/></a>';
838
+ break;
839
+ case 'icon_small':
840
+ $retval = '
841
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_small/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/></a>';
842
+ break;
843
+ case 'icon_small_text':
844
+ $retval = '
845
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_small/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/><span class="mr_small_icon">'.$text.'</span></a>';
846
+ break;
847
+ case 'icon_medium':
848
+ $retval = '
849
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_medium/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/></a>';
850
+ break;
851
+ case 'icon_medium_text':
852
+ $retval = '
853
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_medium/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/><span class="mr_medium_icon">'.$text.'</span></a>';
854
+ break;
855
+ case 'icon_large':
856
+ $retval = '
857
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_large/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/></a>';
858
+ break;
859
+ default:
860
+ $retval = '
861
+ <a href="'.$url.'"><img src="'.plugins_url('/images/icons_small/'.$icon.'.png', __FILE__).'" alt="'.$title.'" title="'.$title.'"/></a>';
862
+ break;
863
+ }
864
+ return $retval;
865
  }
866
 
867
  function share($content) {
868
  $type = get_post_type().'s';
869
+ if (($this->options['mr_social_sharing_types'] == $type || $this->options['mr_social_sharing_types'] == 'both') && (($type != 'pages' && (is_single() || $this->options['mr_social_sharing_include_excerpts'] == 1)) || $type == 'pages' && !is_single())) {
870
+ if ($this->options['mr_social_sharing_position'] == 'top') {
871
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
872
  $content = $bookmarks.$content;
873
  }
874
+ if ($this->options['mr_social_sharing_position'] == 'bottom') {
875
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
876
  $content .= $bookmarks;
877
  }
881
 
882
  function share_shortcode() {
883
  $bookmarks = '';
884
+ if ($this->options['mr_social_sharing_position'] == 'shortcode' && (is_single() || $this->options['mr_social_sharing_include_excerpts'] == 1)) {
885
  $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
886
  }
887
  return $bookmarks;
888
  }
889
 
890
  function should_linkify_content() {
891
+ if ($this->options['mr_social_sharing_linkify_content'] == 1) {
892
  return true;
893
  }
894
  return false;
895
  }
896
 
897
  function should_linkify_comments() {
898
+ if ($this->options['mr_social_sharing_linkify_comments'] == 1) {
899
  return true;
900
  }
901
  return false;
902
  }
903
 
904
  function linkify($content) {
905
+ if ($this->options['mr_social_sharing_twitter_handles'] == 1) {
906
  $content = preg_replace("/(^|\s)*(@([a-zA-Z0-9-_]{1,15}))(\.*[^|\n|\r|\t|\s|\<|\&]*)/i", "$1<a href=\"http://twitter.com/$3\">$2</a>$4", $content);
907
  }
908
+ if ($this->options['mr_social_sharing_twitter_hashtags'] == 1) {
909
  $content = preg_replace("/(^|\s)*((?:(?<!&))#([a-zA-Z0-9]+^[-|;]))([^|\n|\r|\t|\s|\.|\<|\&]*)/i", "$1<a href=\"http://twitter.com/search/$3\">$2</a>$4", $content);
910
  }
911
  return $content;
915
  function MR_Social_Sharing_Toolkit_Widget() {
916
  $widget_ops = array( 'classname' => 'MR_Social_Sharing_Toolkit_Widget', 'description' => '' );
917
  $control_ops = array( 'id_base' => 'mr-social-sharing-toolkit-widget' );
918
+ $this->WP_Widget( 'mr-social-sharing-toolkit-widget', 'Social Sharing Toolkit Share Widget', $widget_ops, $control_ops );
919
  }
920
 
921
  function widget ( $args, $instance) {
922
  extract( $args );
923
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
 
924
  $widget_title = empty($instance['widget_title']) ? '' : $instance['widget_title'];
925
+ $url = empty($instance['fixed_url']) ? '' : $instance['fixed_url'];
926
+ $title = empty($instance['fixed_title']) ? wp_title('', false) : $instance['fixed_title'];
927
+ $bookmarks = $MR_Social_Sharing_Toolkit->create_bookmarks($url, $title, 'widget_');
928
  echo $before_widget;
929
  if ($widget_title != '') {
930
  echo $before_title . $widget_title . $after_title;
935
 
936
  function update($new_instance, $old_instance) {
937
  $instance = $old_instance;
 
938
  $instance['widget_title'] = $new_instance['widget_title'];
939
+ $instance['fixed_title'] = $new_instance['fixed_title'];
940
+ $instance['fixed_url'] = $new_instance['fixed_url'];
941
  return $instance;
942
  }
943
 
944
  function form($instance) {
945
+ $instance = wp_parse_args((array) $instance, array( 'widget_title' => '', 'fixed_title' => '', 'fixed_url' => ''));
946
  echo '
947
  <p>
948
  <label for="'.$this->get_field_id( 'widget_title' ).'">Title:</label>
949
  <input class="widefat" id="'.$this->get_field_id( 'widget_title' ).'" name="'.$this->get_field_name( 'widget_title' ).'" value="'.$instance['widget_title'].'" />
950
+ </p>
951
+ <p>
952
+ <label for="'.$this->get_field_id( 'fixed_title' ).'">Title:</label>
953
+ <input class="widefat" id="'.$this->get_field_id( 'fixed_title' ).'" name="'.$this->get_field_name( 'fixed_title' ).'" value="'.$instance['fixed_title'].'" />
954
+ </p>
955
+ <p>
956
+ <label for="'.$this->get_field_id( 'fixed_url' ).'">Url:</label>
957
+ <input class="widefat" id="'.$this->get_field_id( 'fixed_url' ).'" name="'.$this->get_field_name( 'fixed_url' ).'" value="'.$instance['fixed_url'].'" />
958
  </p>
959
  <p>
960
+ Further configuration is done via the <a href="options-general.php?page=mr_social_sharing#mr_social_sharing_widget_networks">plugin admin screen</a>.
961
+ </p>';
962
+ }
963
+ }
964
+ class MR_Social_Sharing_Toolkit_Follow_Widget extends WP_Widget {
965
+ function MR_Social_Sharing_Toolkit_Follow_Widget() {
966
+ $widget_ops = array( 'classname' => 'MR_Social_Sharing_Toolkit_Follow_Widget', 'description' => '' );
967
+ $control_ops = array( 'id_base' => 'mr-social-sharing-toolkit-follow-widget' );
968
+ $this->WP_Widget( 'mr-social-sharing-toolkit-follow-widget', 'Social Sharing Toolkit Follow Widget', $widget_ops, $control_ops );
969
+ }
970
+
971
+ function widget ( $args, $instance) {
972
+ extract( $args );
973
+ $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
974
+ $widget_title = empty($instance['widget_title']) ? '' : $instance['widget_title'];
975
+ $followers = $MR_Social_Sharing_Toolkit->create_followers();
976
+ echo $before_widget;
977
+ if ($widget_title != '') {
978
+ echo $before_title . $widget_title . $after_title;
979
+ }
980
+ echo $followers;
981
+ echo $after_widget;
982
+ }
983
+
984
+ function update($new_instance, $old_instance) {
985
+ $instance = $old_instance;
986
+ $instance['widget_title'] = $new_instance['widget_title'];
987
+ return $instance;
988
+ }
989
+
990
+ function form($instance) {
991
+ $instance = wp_parse_args((array) $instance, array( 'widget_title' => ''));
992
+ echo '
993
+ <p>
994
+ <label for="'.$this->get_field_id( 'widget_title' ).'">Title:</label>
995
+ <input class="widefat" id="'.$this->get_field_id( 'widget_title' ).'" name="'.$this->get_field_name( 'widget_title' ).'" value="'.$instance['widget_title'].'" />
996
  </p>
997
  <p>
998
+ Further configuration is done via the <a href="options-general.php?page=mr_social_sharing#mr_social_sharing_follow_networks">plugin admin screen</a>.
999
  </p>';
1000
  }
1001
  }
1010
  add_filter( 'the_content', array($MR_Social_Sharing_Toolkit, 'share'));
1011
  }
1012
  add_shortcode('social_share', array($MR_Social_Sharing_Toolkit, 'share_shortcode'));
1013
+ /* Register widgets */
1014
  add_action('widgets_init', create_function('', 'return register_widget("MR_Social_Sharing_Toolkit_Widget");'));
1015
+ add_action('widgets_init', create_function('', 'return register_widget("MR_Social_Sharing_Toolkit_Follow_Widget");'));
1016
  /* Register plugin admin page */
1017
  add_action('admin_menu', array($MR_Social_Sharing_Toolkit, 'plugin_menu'));
style.css CHANGED
@@ -1,63 +1,118 @@
1
- div.mr_social_sharing, div.mr_social_sharing {
2
- height: auto;
3
  width: 100%;
4
- overflow: hidden;
5
- margin: 0 !important;
6
  padding: 0 !important;
7
  border: 0 !important;
8
  }
9
 
10
- ul.mr_social_sharing, ul.mr_social_sharing {
11
- list-style-type: none !important;
12
- float: left;
13
- clear: both;
14
  display: block;
15
- width: 100%;
16
- height: auto;
17
- text-align: left;
18
- margin: 0 !important;
19
  padding: 0 !important;
20
- border: 0 !important;
21
  }
22
 
23
- li.mr_social_sharing_none, li.mr_social_sharing_widget_none {
24
- list-style-type: none !important;
25
- float: left;
26
- width: auto;
27
- height: 24px;
28
- margin: 0 !important;
29
- padding: 4px !important;
30
- border: 0 !important;
31
  }
32
 
33
- li.mr_social_sharing_horizontal, li.mr_social_sharing_widget_horizontal {
34
- list-style-type: none !important;
35
- float: left;
36
- width: 150px;
37
- height: 24px;
 
38
  margin: 0 !important;
39
  padding: 0 !important;
40
  border: 0 !important;
 
41
  }
42
 
43
- li.mr_social_sharing_vertical, li.mr_social_sharing_widget_vertical {
44
- list-style-type: none !important;
45
- float: left;
46
- width: 64px;
47
- height: 70px;
48
- text-align: center;
49
  margin: 0 !important;
50
  padding: 0 !important;
51
  border: 0 !important;
 
52
  }
53
 
54
- li.mr_social_sharing_none img, li.mr_social_sharing_horizontal img, li.mr_social_sharing_vertical img, li.mr_social_sharing_widget_none img, li.mr_social_sharing_widget_horizontal img, li.mr_social_sharing_widget_vertical img {
55
- margin: 0 !important;
 
 
 
 
 
56
  padding: 0 !important;
57
- border: 0 !important;
58
  }
59
 
60
- li.mr_social_sharing_none a, li.mr_social_sharing_horizontal a, li.mr_social_sharing_vertical a, li.mr_social_sharing_widget_none a, li.mr_social_sharing_widget_horizontal a, li.mr_social_sharing_widget_vertical a, li.mr_social_sharing_none a:HOVER, li.mr_social_sharing_horizontal a:HOVER, li.mr_social_sharing_vertical a:HOVER, li.mr_social_sharing_widget_none a:HOVER, li.mr_social_sharing_widget_horizontal a:HOVER, li.mr_social_sharing_widget_vertical a:HOVER {
61
- background: none;
62
- border: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
1
+ div.mr_social_sharing_wrapper {
2
+ height: auto!important;
3
  width: 100%;
4
+ margin: 4px 0 !important;
 
5
  padding: 0 !important;
6
  border: 0 !important;
7
  }
8
 
9
+ div.mr_social_sharing, span.mr_social_sharing, div.mr_social_sharing_top, span.mr_social_sharing_top {
 
 
 
10
  display: block;
11
+ height: auto !important;
12
+ vertical-align: bottom !important;
13
+ margin: 2px !important;
 
14
  padding: 0 !important;
 
15
  }
16
 
17
+ span.mr_social_sharing, span.mr_social_sharing_top {
18
+ display: inline-block;
 
 
 
 
 
 
19
  }
20
 
21
+ div.mr_social_sharing_top, span.mr_social_sharing_top {
22
+ vertical-align: top !important;
23
+ }
24
+
25
+ a.mr_social_sharing_popup_link, a.mr_social_sharing_popup_link:HOVER {
26
+ display: inline-block;
27
  margin: 0 !important;
28
  padding: 0 !important;
29
  border: 0 !important;
30
+ vertical-align: bottom !important;
31
  }
32
 
33
+ .mr_social_sharing img, .mr_social_sharing_top img {
 
 
 
 
 
34
  margin: 0 !important;
35
  padding: 0 !important;
36
  border: 0 !important;
37
+ vertical-align: bottom !important;
38
  }
39
 
40
+ .mr_social_sharing span.mr_small_icon, .mr_social_sharing span.mr_medium_icon, .mr_social_sharing_top span.mr_small_icon, .mr_social_sharing_top span.mr_medium_icon {
41
+ display: inline-block;
42
+ font-family: 'Droid Sans',arial,sans-serif !important;
43
+ vertical-align: bottom !important;
44
+ font-size:10px !important;
45
+ font-weight: 200 !important;
46
+ margin: 4px 0 -4px 4px !important;
47
  padding: 0 !important;
 
48
  }
49
 
50
+ .mr_social_sharing span.mr_medium_icon, .mr_social_sharing_top span.mr_medium_icon {
51
+ font-size:12px !important;
52
+ }
53
+
54
+ .mr_social_sharing_top span.mr_small_icon, .mr_social_sharing_top span.mr_medium_icon {
55
+ vertical-align: top !important;
56
+ }
57
+
58
+ /* Delicious */
59
+
60
+ .delicious_vertical {
61
+ display:inline-block;
62
+ width: 50px !important;
63
+ height:60px !important;
64
+ padding: 0px;
65
+ margin: 0px;
66
+ text-align:center;
67
+ }
68
+
69
+ .delicious_vertical a {
70
+ display: block;
71
+ font-family:'Droid Sans',arial,sans-serif !important;
72
+ font-size:15px !important;
73
+ font-weight: 200 !important;
74
+ color: #7e7e7e !important;
75
+ background:transparent url(images/delicious_counters.png) no-repeat scroll left top !important;
76
+ padding:7px 0px 40px 0px !important;
77
+ width: 50px !important;
78
+ height:13px !important;
79
+ line-height:12px;
80
+ text-decoration: none;
81
+ }
82
+
83
+ .delicious_vertical a:hover {
84
+ color: #0090ff !important;
85
+ text-decoration: none !important;
86
+ }
87
+
88
+ .delicious_horizontal {
89
+ display:inline-block;
90
+ height:20px !important;
91
+ width:120px !important;
92
+ padding: 0px;
93
+ margin: 0px;
94
+ }
95
+
96
+ .delicious_horizontal a {
97
+ display: block;
98
+ font-family:'Droid Sans',arial,sans-serif !important;
99
+ font-size:12px !important;
100
+ font-weight: 300 !important;
101
+ background:transparent url(images/delicious_counters.png) no-repeat scroll left bottom;
102
+ height:15px !important;
103
+ width:35px !important;
104
+ padding:0px 5px 5px 80px !important;
105
+ color: #7e7e7e !important;
106
+ text-decoration: none;
107
+ text-align:center;
108
+ white-space:nowrap;
109
+ }
110
+
111
+ .delicious_horizontal a:hover {
112
+ color: #0090ff !important;
113
+ text-decoration: none;
114
+ }
115
+
116
+ .delicious_vertical span.delicious_hash, .delicious_horizontal span.delicious_hash {
117
+ display: none !important;
118
  }