Social Sharing Toolkit - Version 1.2.0

Version Description

New widget included in version 1.2.0.

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.2.0

Files changed (3) hide show
  1. readme.txt +17 -3
  2. social_sharing_toolkit.php +245 -2
  3. style.css +10 -6
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
  === Social Sharing Toolkit ===
2
  Contributors: MarijnRongen
3
- Tags: Facebook, Like, LinkedIn, Share, Google, Plus, +1, Twitter, Tweet, StumbleUpon, Stumble, Tumblr, Digg, Reddit, MySpace, Hyves, recommend, social, sharing
 
4
  Requires at least: 3.0
5
  Tested up to: 3.2.1
6
- Stable tag: 1.0.1
7
  License: GPLv2 or later
8
 
9
  This plugin enables sharing of your content via popular social networks and can convert Twitter names and hashtags to links. Easy & configurable.
@@ -29,6 +30,11 @@ You can decide which networks to support on your blog and where the buttons will
29
 
30
  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.
31
 
 
 
 
 
 
32
  = Styling =
33
 
34
  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.
@@ -40,7 +46,7 @@ Twitter names will link to their Twitter profile and hashtags will link to the T
40
 
41
  == Installation ==
42
 
43
- Upload the Social Sharing Toolkit plugin to your blog, activate it and use the Social Sharing Toolkit page under Settings to configure your toolkit.
44
 
45
  == Screenshots ==
46
 
@@ -51,10 +57,18 @@ Upload the Social Sharing Toolkit plugin to your blog, activate it and use the S
51
 
52
  == Upgrade Notice ==
53
 
 
 
 
 
 
54
  Please update to version 1.0.1 to prevent an unexpected printing of the page title.
55
 
56
  == Changelog ==
57
 
 
 
 
58
  = 1.0.1 =
59
  * Fixed unexpected printing of the page title
60
 
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
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.
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.
32
 
33
+ = Widget =
34
+
35
+ Since version 1.2.0 a widget is included in the toolkit. It will display the same buttons selected in the plugin configuration.
36
+ 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.
37
+
38
  = Styling =
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.
46
 
47
  == Installation ==
48
 
49
+ Upload the Social Sharing Toolkit plugin to the wp-content/plugins/ folder on your website, activate it and use the Social Sharing Toolkit page under Settings to configure your toolkit.
50
 
51
  == Screenshots ==
52
 
57
 
58
  == Upgrade Notice ==
59
 
60
+ = 1.2.0 =
61
+ New widget included in version 1.2.0.
62
+
63
+ = 1.0.1 =
64
+
65
  Please update to version 1.0.1 to prevent an unexpected printing of the page title.
66
 
67
  == Changelog ==
68
 
69
+ = 1.2.0 =
70
+ * Added widget
71
+
72
  = 1.0.1 =
73
  * Fixed unexpected printing of the page title
74
 
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.0.1
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
@@ -209,7 +209,7 @@ class MR_Social_Sharing_Toolkit {
209
  $url = get_permalink();
210
  $class = 'mr_social_sharing_'.$this->options['layout'];
211
  $bookmarks = '<ul class="mr_social_sharing">
212
- <!-- Social Sharing Toolkit v1.0.0 | http://www.marijnrongen.com/wordpress-plugins/social_sharing_toolkit/ -->';
213
  if ($this->options['like'] == 1) {
214
  $bookmarks .= '
215
  <li class="'.$class.'">
@@ -442,6 +442,247 @@ class MR_Social_Sharing_Toolkit {
442
  return $content;
443
  }
444
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
446
  if ($MR_Social_Sharing_Toolkit->should_linkify_content()) {
447
  add_filter('the_content', array($MR_Social_Sharing_Toolkit, 'linkify'));
@@ -453,5 +694,7 @@ if ($MR_Social_Sharing_Toolkit->should_share_content()) {
453
  add_filter( 'the_content', array($MR_Social_Sharing_Toolkit, 'share'));
454
  }
455
  add_shortcode('social_share', array($MR_Social_Sharing_Toolkit, 'share_shortcode'));
 
 
456
  /* Register plugin admin page */
457
  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: 1.2.0
7
  Author: Marijn Rongen
8
  Author URI: http://www.marijnrongen.com
9
  */
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.'">
442
  return $content;
443
  }
444
  }
445
+ class MR_Social_Sharing_Toolkit_Widget extends WP_Widget {
446
+ function MR_Social_Sharing_Toolkit_Widget() {
447
+ $widget_ops = array( 'classname' => 'MR_Social_Sharing_Toolkit_Widget', 'description' => '' );
448
+ $control_ops = array( 'id_base' => 'mr-social-sharing-toolkit-widget' );
449
+ $this->WP_Widget( 'mr-social-sharing-toolkit-widget', 'Social Sharing Toolkit Widget', $widget_ops, $control_ops );
450
+ }
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;
656
+ }
657
+
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%;">
670
+ <option ';
671
+ if ( "none" == $instance['widget_layout'] ) echo 'selected="selected" ';
672
+ echo 'value="none">Small buttons without counters</option>
673
+ <option ';
674
+ if ( "horizontal" == $instance['widget_layout'] ) echo 'selected="selected" ';
675
+ echo 'value="horizontal">Wider buttons with counters</option>
676
+ <option ';
677
+ if ( "vertical" == $instance['widget_layout'] ) echo 'selected="selected" ';
678
+ echo 'value="vertical">Higher buttons with counters</option>
679
+ </select>
680
+ </p>
681
+ <p>
682
+ Further configuration is done via the plugin admin screen under Settings &rarr; Social Sharing Toolkit.
683
+ </p>';
684
+ }
685
+ }
686
  $MR_Social_Sharing_Toolkit = new MR_Social_Sharing_Toolkit();
687
  if ($MR_Social_Sharing_Toolkit->should_linkify_content()) {
688
  add_filter('the_content', array($MR_Social_Sharing_Toolkit, 'linkify'));
694
  add_filter( 'the_content', array($MR_Social_Sharing_Toolkit, 'share'));
695
  }
696
  add_shortcode('social_share', array($MR_Social_Sharing_Toolkit, 'share_shortcode'));
697
+ /* Register plugin */
698
+ add_action('widgets_init', create_function('', 'return register_widget("MR_Social_Sharing_Toolkit_Widget");'));
699
  /* Register plugin admin page */
700
  add_action('admin_menu', array($MR_Social_Sharing_Toolkit, 'plugin_menu'));
style.css CHANGED
@@ -1,4 +1,4 @@
1
- ul.mr_social_sharing {
2
  list-style-type: none;
3
  float: left;
4
  clear: both;
@@ -6,36 +6,40 @@ ul.mr_social_sharing {
6
  width: 100%;
7
  margin: 0;
8
  padding: 0;
 
9
  }
10
 
11
- li.mr_social_sharing_none {
12
  float: left;
13
  width: auto;
14
  height: 24px;
15
  margin: 0;
16
  padding: 4px;
 
17
  }
18
 
19
- li.mr_social_sharing_horizontal {
20
  float: left;
21
  width: 150px;
22
  height: 24px;
23
  margin: 0;
24
  padding: 0;
25
  text-align: left;
 
26
  }
27
 
28
- li.mr_social_sharing_vertical {
29
  float: left;
30
  width: 64px;
31
  height: 70px;
32
  margin: 0;
33
  padding: 0;
34
  text-align: center;
 
35
  }
36
 
37
- li.mr_social_sharing_none img, li.mr_social_sharing_horizontal img, li.mr_social_sharing_vertical img {
38
  margin: 0;
39
  padding: 0;
40
- border: 0;
41
  }
1
+ ul.mr_social_sharing, ul.mr_social_sharing_widget {
2
  list-style-type: none;
3
  float: left;
4
  clear: both;
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 {
13
  float: left;
14
  width: auto;
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 {
22
  float: left;
23
  width: 150px;
24
  height: 24px;
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 {
32
  float: left;
33
  width: 64px;
34
  height: 70px;
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
  }