Social Sharing Toolkit - Version 1.2.5

Version Description

Please update to version 1.2.5 for several bug fixes and enhancements.

Download this release

Release Info

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

Code changes from version 1.2.0 to 1.2.5

Files changed (4) hide show
  1. digg.js +7 -0
  2. readme.txt +23 -2
  3. social_sharing_toolkit.php +50 -227
  4. style.css +10 -5
digg.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ (function() {
2
+ var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
3
+ s.type = 'text/javascript';
4
+ s.async = true;
5
+ s.src = 'http://widgets.digg.com/buttons.js';
6
+ s1.parentNode.insertBefore(s, s1.nextSibling);
7
+ })();
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
- Stable tag: 1.2.0
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.
@@ -26,6 +26,8 @@ The plugin currently supports the following networks:
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
  = Shortcode =
30
 
31
  It is also possible to only let the buttons appear where you want by using shortcode. To do this you need to set the button position to the shortcode option and use the shortcode [social_share/] in the content where you would like to display the buttons.
@@ -39,6 +41,14 @@ You can however choose a different button layout for the widget. For example you
39
 
40
  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.
41
 
 
 
 
 
 
 
 
 
42
  = Automatic Twitter links =
43
 
44
  This plugin also includes a configurable & improved version of my earlier Automatic Twitter Links plugin. You can decide if you want to convert Twitter names and/or hashtags to links.
@@ -50,13 +60,17 @@ Upload the Social Sharing Toolkit plugin to the wp-content/plugins/ folder on yo
50
 
51
  == Screenshots ==
52
 
53
- 1. Plugin configuration page
54
  2. Without counters (Facebook demands some space)
55
  3. Several wide buttons
56
  4. Several high buttons
57
 
58
  == Upgrade Notice ==
59
 
 
 
 
 
60
  = 1.2.0 =
61
  New widget included in version 1.2.0.
62
 
@@ -66,6 +80,13 @@ Please update to version 1.0.1 to prevent an unexpected printing of the page tit
66
 
67
  == Changelog ==
68
 
 
 
 
 
 
 
 
69
  = 1.2.0 =
70
  * Added widget
71
 
4
  Tags: Facebook, Like, LinkedIn, Share, Google, Plus, +1, Twitter, Tweet, StumbleUpon, Stumble, Tumblr, Digg, Reddit, MySpace, Hyves, recommend, social, sharing, widget
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
+ Stable tag: 1.2.5
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.
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
 
33
  It is also possible to only let the buttons appear where you want by using shortcode. To do this you need to set the button position to the shortcode option and use the shortcode [social_share/] in the content where you would like to display the buttons.
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
+ = Using it somewhere else =
45
+
46
+ If you want to display the buttons outside of your content you can use the following code where you want the buttons to appear:
47
+ `<?php
48
+ $social_sharing_toolkit = new MR_Social_Sharing_Toolkit();
49
+ echo $social_sharing_toolkit->create_bookmarks();
50
+ ?>`
51
+
52
  = Automatic Twitter links =
53
 
54
  This plugin also includes a configurable & improved version of my earlier Automatic Twitter Links plugin. You can decide if you want to convert Twitter names and/or hashtags to links.
60
 
61
  == Screenshots ==
62
 
63
+ 1. Plugin configuration page (before 1.2.5)
64
  2. Without counters (Facebook demands some space)
65
  3. Several wide buttons
66
  4. Several high buttons
67
 
68
  == Upgrade Notice ==
69
 
70
+ = 1.2.5 =
71
+
72
+ Please update to version 1.2.5 for several bug fixes and enhancements.
73
+
74
  = 1.2.0 =
75
  New widget included in version 1.2.0.
76
 
80
 
81
  == Changelog ==
82
 
83
+ = 1.2.5 =
84
+ * Added title field to widget
85
+ * Added field for Twitter handle to attribute tweets to
86
+ * Fixed Digg buttons
87
+ * Fixed rendering of the list (missing closing tag)
88
+ * Reduced size of plugin code
89
+
90
  = 1.2.0 =
91
  * Added widget
92
 
social_sharing_toolkit.php CHANGED
@@ -3,7 +3,7 @@
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.2.0
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
@@ -16,7 +16,7 @@ class MR_Social_Sharing_Toolkit {
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, 'position' => 'none', '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
  }
@@ -142,6 +142,14 @@ class MR_Social_Sharing_Toolkit {
142
  echo ' value="1" /> Hyves</label><span class="description"> '.__("Only available with horizontal counters", 'mr_social_sharing').'</span>
143
  </td>
144
  </tr>
 
 
 
 
 
 
 
 
145
  </tbody>
146
  </table>
147
  <h3>Automatic Twitter links</h3>
@@ -185,9 +193,6 @@ class MR_Social_Sharing_Toolkit {
185
  /* Output functions */
186
 
187
  function should_share_content() {
188
- if ($this->options['position'] == 'none') {
189
- return false;
190
- }
191
  wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
192
  if ($this->options['plus'] == 1) {
193
  wp_enqueue_script('GooglePlus', 'https://apis.google.com/js/plusone.js');
@@ -196,25 +201,27 @@ class MR_Social_Sharing_Toolkit {
196
  wp_enqueue_script('Tumblr', 'http://platform.tumblr.com/v1/share.js', array(), false, true);
197
  }
198
  if ($this->options['digg'] == 1) {
199
- wp_enqueue_script('digg', 'http://widgets.digg.com/buttons.js');
200
  }
201
- if ($this->options['position'] == 'shortcode') {
202
  return false;
203
  }
204
  return true;
205
  }
206
 
207
- function create_bookmarks() {
208
- $title = the_title('','',false);
209
- $url = get_permalink();
210
- $class = 'mr_social_sharing_'.$this->options['layout'];
 
 
211
  $bookmarks = '<ul class="mr_social_sharing">
212
- <!-- Social Sharing Toolkit v1.2.0 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->';
213
  if ($this->options['like'] == 1) {
214
  $bookmarks .= '
215
  <li class="'.$class.'">
216
  <iframe src="http://www.facebook.com/plugins/like.php?href='.$url.'&amp;layout=';
217
- switch ($this->options['layout']) {
218
  case 'horizontal':
219
  $bookmarks .= 'button_count';
220
  $width = '90px';
@@ -238,25 +245,28 @@ class MR_Social_Sharing_Toolkit {
238
  $bookmarks .= '
239
  <li class="'.$class.'">
240
  <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="';
241
- switch ($this->options['layout']) {
242
  case 'horizontal':
243
- $bookmarks .= 'horizontal';
244
  break;
245
  case 'vertical':
246
- $bookmarks .= 'vertical';
247
  break;
248
  default:
249
- $bookmarks .= 'none';
250
  break;
251
  }
252
- $bookmarks .= '">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
 
 
 
253
  </li>';
254
  }
255
  if ($this->options['plus'] == 1) {
256
  $bookmarks .= '
257
  <li class="'.$class.'">
258
  <g:plusone';
259
- switch ($this->options['layout']) {
260
  case 'horizontal':
261
  $bookmarks .= ' size="medium"';
262
  break;
@@ -274,7 +284,7 @@ class MR_Social_Sharing_Toolkit {
274
  $bookmarks .= '
275
  <li class="'.$class.'">
276
  <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$url.'"';
277
- switch ($this->options['layout']) {
278
  case 'horizontal':
279
  $bookmarks .= ' data-counter="right"';
280
  break;
@@ -292,7 +302,7 @@ class MR_Social_Sharing_Toolkit {
292
  $bookmarks .= '
293
  <li class="'.$class.'">
294
  <a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; ';
295
- switch ($this->options['layout']) {
296
  case 'horizontal':
297
  $bookmarks .= 'width:81px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_1.png\')';
298
  break;
@@ -310,7 +320,7 @@ class MR_Social_Sharing_Toolkit {
310
  $bookmarks .= '
311
  <li class="'.$class.'">
312
  <script src="http://www.stumbleupon.com/hostedbadge.php?s=';
313
- switch ($this->options['layout']) {
314
  case 'horizontal':
315
  $bookmarks .= '1';
316
  break;
@@ -328,7 +338,7 @@ class MR_Social_Sharing_Toolkit {
328
  $bookmarks .= '
329
  <li class="'.$class.'">
330
  <a class="DiggThisButton ';
331
- switch ($this->options['layout']) {
332
  case 'horizontal':
333
  $bookmarks .= 'DiggCompact';
334
  break;
@@ -345,7 +355,7 @@ class MR_Social_Sharing_Toolkit {
345
  if ($this->options['reddit'] == 1) {
346
  $bookmarks .= '
347
  <li class="'.$class.'">';
348
- switch ($this->options['layout']) {
349
  case 'horizontal':
350
  $bookmarks .= '
351
  <script type="text/javascript">
@@ -375,7 +385,7 @@ class MR_Social_Sharing_Toolkit {
375
  <li class="'.$class.'">
376
  <a href="javascript:void(window.open(\'http://www.myspace.com/Modules/PostTo/Pages/?u='.$url.'\',\'ptm\',\'height=450,width=550\').focus())">
377
  <img src="http://cms.myspacecdn.com/cms//ShareOnMySpace/Myspace_btn_';
378
- switch ($this->options['layout']) {
379
  case 'horizontal':
380
  $bookmarks .= 'ShareOnMyspace';
381
  break;
@@ -392,19 +402,19 @@ class MR_Social_Sharing_Toolkit {
392
  <li class="'.$class.'">
393
  <iframe src="http://www.hyves.nl/respect/button?url='.$url.'&amp;title='.$title.'" style="border: medium none; overflow:hidden; width:150px; height:21px;" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
394
  </li>';
 
395
  $bookmarks .= '
396
  </ul>';
397
- }
398
  return $bookmarks;
399
  }
400
 
401
  function share($content) {
402
  if ($this->options['position'] == 'top') {
403
- $bookmarks = $this->create_bookmarks();
404
  $content = $bookmarks.$content;
405
  }
406
  if ($this->options['position'] == 'bottom') {
407
- $bookmarks = $this->create_bookmarks();
408
  $content .= $bookmarks;
409
  }
410
  return $content;
@@ -451,205 +461,13 @@ class MR_Social_Sharing_Toolkit_Widget extends WP_Widget {
451
 
452
  function widget ( $args, $instance) {
453
  extract( $args );
454
- echo $before_widget;
455
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
456
- $options = $MR_Social_Sharing_Toolkit->get_options();
457
- $options['widget_layout'] = empty($instance['widget_layout']) ? 'none' : $instance['widget_layout'];
458
- wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
459
- if ($this->options['plus'] == 1) {
460
- wp_enqueue_script('GooglePlus', 'https://apis.google.com/js/plusone.js');
461
- }
462
- if ($this->options['tumblr'] == 1) {
463
- wp_enqueue_script('Tumblr', 'http://platform.tumblr.com/v1/share.js', array(), false, true);
464
- }
465
- if ($this->options['digg'] == 1) {
466
- wp_enqueue_script('digg', 'http://widgets.digg.com/buttons.js');
467
- }
468
- $url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
469
- $class = 'mr_social_sharing_widget_'.$options['widget_layout'];
470
- $bookmarks = '<ul class="mr_social_sharing_widget">
471
- <!-- Social Sharing Toolkit v1.2.0 widget | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->';
472
- if ($options['like'] == 1) {
473
- $bookmarks .= '
474
- <li class="'.$class.'">
475
- <iframe src="http://www.facebook.com/plugins/like.php?href='.$url.'&amp;layout=';
476
- switch ($options['widget_layout']) {
477
- case 'horizontal':
478
- $bookmarks .= 'button_count';
479
- $width = '90px';
480
- $height = '20px';
481
- break;
482
- case 'vertical':
483
- $bookmarks .= 'box_count';
484
- $width = '55px';
485
- $height = '65px';
486
- break;
487
- default:
488
- $bookmarks .= 'standard';
489
- $width = '225%';
490
- $height = '35px';
491
- break;
492
- }
493
- $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>
494
- </li>';
495
- }
496
- if ($options['tweet'] == 1) {
497
- $bookmarks .= '
498
- <li class="'.$class.'">
499
- <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="';
500
- switch ($options['widget_layout']) {
501
- case 'horizontal':
502
- $bookmarks .= 'horizontal';
503
- break;
504
- case 'vertical':
505
- $bookmarks .= 'vertical';
506
- break;
507
- default:
508
- $bookmarks .= 'none';
509
- break;
510
- }
511
- $bookmarks .= '">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
512
- </li>';
513
- }
514
- if ($options['plus'] == 1) {
515
- $bookmarks .= '
516
- <li class="'.$class.'">
517
- <g:plusone';
518
- switch ($options['widget_layout']) {
519
- case 'horizontal':
520
- $bookmarks .= ' size="medium"';
521
- break;
522
- case 'vertical':
523
- $bookmarks .= ' size="tall"';
524
- break;
525
- default:
526
- $bookmarks .= ' size="medium" count="false"';
527
- break;
528
- }
529
- $bookmarks .= ' href="'.$url.'"></g:plusone>
530
- </li>';
531
- }
532
- if ($options['share'] == 1) {
533
- $bookmarks .= '
534
- <li class="'.$class.'">
535
- <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$url.'"';
536
- switch ($options['widget_layout']) {
537
- case 'horizontal':
538
- $bookmarks .= ' data-counter="right"';
539
- break;
540
- case 'vertical':
541
- $bookmarks .= ' data-counter="top"';
542
- break;
543
- default:
544
- $bookmarks .= '';
545
- break;
546
- }
547
- $bookmarks .= '></script>
548
- </li>';
549
- }
550
- if ($options['tumblr'] == 1) {
551
- $bookmarks .= '
552
- <li class="'.$class.'">
553
- <a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; ';
554
- switch ($options['widget_layout']) {
555
- case 'horizontal':
556
- $bookmarks .= 'width:81px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_1.png\')';
557
- break;
558
- case 'vertical':
559
- $bookmarks .= 'width:61px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_2.png\')';
560
- break;
561
- default:
562
- $bookmarks .= 'width:61px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_2.png\')';
563
- break;
564
- }
565
- $bookmarks .= ' top left no-repeat transparent;">Share on Tumblr</a>
566
- </li>';
567
- }
568
- if ($options['stumble'] == 1) {
569
- $bookmarks .= '
570
- <li class="'.$class.'">
571
- <script src="http://www.stumbleupon.com/hostedbadge.php?s=';
572
- switch ($options['widget_layout']) {
573
- case 'horizontal':
574
- $bookmarks .= '1';
575
- break;
576
- case 'vertical':
577
- $bookmarks .= '5';
578
- break;
579
- default:
580
- $bookmarks .= '4';
581
- break;
582
- }
583
- $bookmarks .= '&r='.$url.'"></script>
584
- </li>';
585
- }
586
- if ($options['digg'] == 1) {
587
- $bookmarks .= '
588
- <li class="'.$class.'">
589
- <a class="DiggThisButton ';
590
- switch ($options['widget_layout']) {
591
- case 'horizontal':
592
- $bookmarks .= 'DiggCompact';
593
- break;
594
- case 'vertical':
595
- $bookmarks .= 'DiggMedium';
596
- break;
597
- default:
598
- $bookmarks .= 'DiggIcon';
599
- break;
600
- }
601
- $bookmarks .= '" href="http://digg.com/submit?url='.$url.'"></a>
602
- </li>';
603
- }
604
- if ($options['reddit'] == 1) {
605
- $bookmarks .= '
606
- <li class="'.$class.'">';
607
- switch ($options['widget_layout']) {
608
- case 'horizontal':
609
- $bookmarks .= '
610
- <script type="text/javascript">
611
- reddit_url = "'.$url.'";
612
- </script>
613
- <script type="text/javascript" src="http://www.reddit.com/static/button/button1.js"></script>';
614
- break;
615
- case 'vertical':
616
- $bookmarks .= '
617
- <script type="text/javascript">
618
- reddit_url = "'.$url.'";
619
- </script>
620
- <script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script>';
621
- break;
622
- default:
623
- $bookmarks .= '
624
- <a href="http://www.reddit.com/submit" onclick="window.location = \'http://www.reddit.com/submit?url='.$url.'\'; return false"><img src="http://www.reddit.com/static/spreddit1.gif" alt="submit to reddit" border="0" /></a>';
625
- break;
626
- }
627
- $bookmarks .= '
628
- </li>';
629
- }
630
- if ($options['myspace'] == 1) {
631
- $bookmarks .= '
632
- <li class="'.$class.'">
633
- <a href="javascript:void(window.open(\'http://www.myspace.com/Modules/PostTo/Pages/?u='.$url.'\',\'ptm\',\'height=450,width=550\').focus())">
634
- <img src="http://cms.myspacecdn.com/cms//ShareOnMySpace/Myspace_btn_';
635
- switch ($options['widget_layout']) {
636
- case 'horizontal':
637
- $bookmarks .= 'ShareOnMyspace';
638
- break;
639
- default:
640
- $bookmarks .= 'Share';
641
- break;
642
- }
643
- $bookmarks .= '.png" border="0" alt="Share on Myspace" />
644
- </a>
645
- </li>';
646
- }
647
- if ($options['hyves'] == 1) {
648
- $bookmarks .= '
649
- <li class="'.$class.'">
650
- <iframe src="http://www.hyves.nl/respect/button?url='.$url.'" style="border: medium none; overflow:hidden; width:150px; height:21px;" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
651
- </li>
652
- </ul>';
653
  }
654
  echo $bookmarks;
655
  echo $after_widget;
@@ -658,12 +476,17 @@ class MR_Social_Sharing_Toolkit_Widget extends WP_Widget {
658
  function update($new_instance, $old_instance) {
659
  $instance = $old_instance;
660
  $instance['widget_layout'] = $new_instance['widget_layout'];
 
661
  return $instance;
662
  }
663
 
664
  function form($instance) {
665
- $instance = wp_parse_args((array) $instance, array( 'widget_layout' => 'none'));
666
  echo '
 
 
 
 
667
  <p>
668
  <label for="'.$this->get_field_id( 'widget_layout' ).'">Widget layout:</label>
669
  <select id="'.$this->get_field_id( 'widget_layout' ).'" name="'.$this->get_field_name( 'widget_layout' ).'" class="widefat" style="width:100%;">
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.2.5
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
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', '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
  }
142
  echo ' value="1" /> Hyves</label><span class="description"> '.__("Only available with horizontal counters", 'mr_social_sharing').'</span>
143
  </td>
144
  </tr>
145
+ <tr valign="top">
146
+ <th scope="row">
147
+ <label for="twitter_handle">Attribute tweets to:</label>
148
+ </th>
149
+ <td>
150
+ @<input type="text" name="twitter_handle" id="twitter_handle" value="'.$this->options['twitter_handle'].'"/>
151
+ </td>
152
+ </tr>
153
  </tbody>
154
  </table>
155
  <h3>Automatic Twitter links</h3>
193
  /* Output functions */
194
 
195
  function should_share_content() {
 
 
 
196
  wp_enqueue_style('mr_social_sharing', plugins_url('/style.css', __FILE__));
197
  if ($this->options['plus'] == 1) {
198
  wp_enqueue_script('GooglePlus', 'https://apis.google.com/js/plusone.js');
201
  wp_enqueue_script('Tumblr', 'http://platform.tumblr.com/v1/share.js', array(), false, true);
202
  }
203
  if ($this->options['digg'] == 1) {
204
+ wp_enqueue_script('Digg', plugins_url('/digg.js', __FILE__));
205
  }
206
+ if ($this->options['position'] == 'none' || $this->options['position'] == 'shortcode') {
207
  return false;
208
  }
209
  return true;
210
  }
211
 
212
+ function create_bookmarks($url = '', $title = '', $layout = '') {
213
+ if ($url == '') {
214
+ $url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
215
+ }
216
+ $layout = ($layout != '') ? $layout : $this->options['layout'];
217
+ $class = 'mr_social_sharing_'.$layout;
218
  $bookmarks = '<ul class="mr_social_sharing">
219
+ <!-- Social Sharing Toolkit v1.2.5 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->';
220
  if ($this->options['like'] == 1) {
221
  $bookmarks .= '
222
  <li class="'.$class.'">
223
  <iframe src="http://www.facebook.com/plugins/like.php?href='.$url.'&amp;layout=';
224
+ switch ($layout) {
225
  case 'horizontal':
226
  $bookmarks .= 'button_count';
227
  $width = '90px';
245
  $bookmarks .= '
246
  <li class="'.$class.'">
247
  <a href="http://twitter.com/share" class="twitter-share-button" data-url="'.$url.'" data-count="';
248
+ switch ($layout) {
249
  case 'horizontal':
250
+ $bookmarks .= 'horizontal"';
251
  break;
252
  case 'vertical':
253
+ $bookmarks .= 'vertical"';
254
  break;
255
  default:
256
+ $bookmarks .= 'none"';
257
  break;
258
  }
259
+ if ($this->options['twitter_handle'] != '') {
260
+ $bookmarks .= ' data-via="'.$this->options['twitter_handle'].'"';
261
+ }
262
+ $bookmarks .= '>Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
263
  </li>';
264
  }
265
  if ($this->options['plus'] == 1) {
266
  $bookmarks .= '
267
  <li class="'.$class.'">
268
  <g:plusone';
269
+ switch ($layout) {
270
  case 'horizontal':
271
  $bookmarks .= ' size="medium"';
272
  break;
284
  $bookmarks .= '
285
  <li class="'.$class.'">
286
  <script src="http://platform.linkedin.com/in.js" type="text/javascript"></script><script type="IN/Share" data-url="'.$url.'"';
287
+ switch ($layout) {
288
  case 'horizontal':
289
  $bookmarks .= ' data-counter="right"';
290
  break;
302
  $bookmarks .= '
303
  <li class="'.$class.'">
304
  <a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; ';
305
+ switch ($layout) {
306
  case 'horizontal':
307
  $bookmarks .= 'width:81px; height:20px; background:url(\'http://platform.tumblr.com/v1/share_1.png\')';
308
  break;
320
  $bookmarks .= '
321
  <li class="'.$class.'">
322
  <script src="http://www.stumbleupon.com/hostedbadge.php?s=';
323
+ switch ($layout) {
324
  case 'horizontal':
325
  $bookmarks .= '1';
326
  break;
338
  $bookmarks .= '
339
  <li class="'.$class.'">
340
  <a class="DiggThisButton ';
341
+ switch ($layout) {
342
  case 'horizontal':
343
  $bookmarks .= 'DiggCompact';
344
  break;
355
  if ($this->options['reddit'] == 1) {
356
  $bookmarks .= '
357
  <li class="'.$class.'">';
358
+ switch ($layout) {
359
  case 'horizontal':
360
  $bookmarks .= '
361
  <script type="text/javascript">
385
  <li class="'.$class.'">
386
  <a href="javascript:void(window.open(\'http://www.myspace.com/Modules/PostTo/Pages/?u='.$url.'\',\'ptm\',\'height=450,width=550\').focus())">
387
  <img src="http://cms.myspacecdn.com/cms//ShareOnMySpace/Myspace_btn_';
388
+ switch ($layout) {
389
  case 'horizontal':
390
  $bookmarks .= 'ShareOnMyspace';
391
  break;
402
  <li class="'.$class.'">
403
  <iframe src="http://www.hyves.nl/respect/button?url='.$url.'&amp;title='.$title.'" style="border: medium none; overflow:hidden; width:150px; height:21px;" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
404
  </li>';
405
+ }
406
  $bookmarks .= '
407
  </ul>';
 
408
  return $bookmarks;
409
  }
410
 
411
  function share($content) {
412
  if ($this->options['position'] == 'top') {
413
+ $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
414
  $content = $bookmarks.$content;
415
  }
416
  if ($this->options['position'] == 'bottom') {
417
+ $bookmarks = $this->create_bookmarks(get_permalink(), the_title('','',false));
418
  $content .= $bookmarks;
419
  }
420
  return $content;
461
 
462
  function widget ( $args, $instance) {
463
  extract( $args );
 
464
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
465
+ $widget_layout = empty($instance['widget_layout']) ? 'none' : $instance['widget_layout'];
466
+ $widget_title = empty($instance['widget_title']) ? '' : $instance['widget_title'];
467
+ $bookmarks = $MR_Social_Sharing_Toolkit->create_bookmarks('', '', $widget_layout);
468
+ echo $before_widget;
469
+ if ($widget_title != '') {
470
+ echo $before_title . $widget_title . $after_title;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  }
472
  echo $bookmarks;
473
  echo $after_widget;
476
  function update($new_instance, $old_instance) {
477
  $instance = $old_instance;
478
  $instance['widget_layout'] = $new_instance['widget_layout'];
479
+ $instance['widget_title'] = $new_instance['widget_title'];
480
  return $instance;
481
  }
482
 
483
  function form($instance) {
484
+ $instance = wp_parse_args((array) $instance, array( 'widget_title' => '', 'widget_layout' => 'none'));
485
  echo '
486
+ <p>
487
+ <label for="'.$this->get_field_id( 'widget_title' ).'">Title:</label>
488
+ <input class="widefat" id="'.$this->get_field_id( 'widget_title' ).'" name="'.$this->get_field_name( 'widget_title' ).'" value="'.$instance['widget_title'].'" />
489
+ </p>
490
  <p>
491
  <label for="'.$this->get_field_id( 'widget_layout' ).'">Widget layout:</label>
492
  <select id="'.$this->get_field_id( 'widget_layout' ).'" name="'.$this->get_field_name( 'widget_layout' ).'" class="widefat" style="width:100%;">
style.css CHANGED
@@ -6,7 +6,7 @@ ul.mr_social_sharing, ul.mr_social_sharing_widget {
6
  width: 100%;
7
  margin: 0;
8
  padding: 0;
9
- border-width: 0px;
10
  }
11
 
12
  li.mr_social_sharing_none, li.mr_social_sharing_widget_none {
@@ -15,7 +15,7 @@ li.mr_social_sharing_none, li.mr_social_sharing_widget_none {
15
  height: 24px;
16
  margin: 0;
17
  padding: 4px;
18
- border-width: 0px;
19
  }
20
 
21
  li.mr_social_sharing_horizontal, li.mr_social_sharing_widget_horizontal {
@@ -25,7 +25,7 @@ li.mr_social_sharing_horizontal, li.mr_social_sharing_widget_horizontal {
25
  margin: 0;
26
  padding: 0;
27
  text-align: left;
28
- border-width: 0px;
29
  }
30
 
31
  li.mr_social_sharing_vertical, li.mr_social_sharing_widget_vertical {
@@ -35,11 +35,16 @@ li.mr_social_sharing_vertical, li.mr_social_sharing_widget_vertical {
35
  margin: 0;
36
  padding: 0;
37
  text-align: center;
38
- border-width: 0px;
39
  }
40
 
41
  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 {
42
  margin: 0;
43
  padding: 0;
44
- border-width: 0px;
 
 
 
 
 
45
  }
6
  width: 100%;
7
  margin: 0;
8
  padding: 0;
9
+ border: 0;
10
  }
11
 
12
  li.mr_social_sharing_none, li.mr_social_sharing_widget_none {
15
  height: 24px;
16
  margin: 0;
17
  padding: 4px;
18
+ border: 0;
19
  }
20
 
21
  li.mr_social_sharing_horizontal, li.mr_social_sharing_widget_horizontal {
25
  margin: 0;
26
  padding: 0;
27
  text-align: left;
28
+ border: 0;
29
  }
30
 
31
  li.mr_social_sharing_vertical, li.mr_social_sharing_widget_vertical {
35
  margin: 0;
36
  padding: 0;
37
  text-align: center;
38
+ border: 0;
39
  }
40
 
41
  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 {
42
  margin: 0;
43
  padding: 0;
44
+ border: 0;
45
+ }
46
+
47
+ 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 {
48
+ background: none;
49
+ border: 0;
50
  }