WP Social Bookmarking Light - Version 1.6.1

Version Description

  • Added: Service code check function.
Download this release

Release Info

Developer utahvich
Plugin Icon wp plugin WP Social Bookmarking Light
Version 1.6.1
Comparing to
See all releases

Code changes from version 1.6.0 to 1.6.1

Files changed (2) hide show
  1. readme.txt +4 -5
  2. wp-social-bookmarking-light.php +59 -16
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://pledgie.com/campaigns/14051
4
  Tags: links, social, bookmarks, bookmarking, Hatena, Livedoor Clip, BuzzURL, @nifty clip, Twitter, Tumblr, FC2 Bookmark, newsing, Choix, Yahoo!JAPAN Bookmark, Yahoo!Buzz, Google Bookmark, Delicious, Digg, FriendFeed, Google Buzz, Facebook, reddit, LinkedIn, Evernote, Instapaper, StumbleUpon, mixi, gree
5
  Requires at least: 2.9.0
6
  Tested up to: 3.0.1
7
- Stable tag: 1.6.0
8
 
9
  This plugin inserts social share links at the top or bottom of each post.
10
 
@@ -54,6 +54,9 @@ This is the list of used social sites:
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 1.6.0 =
58
  * Added: Hatena Bookmark Button.
59
  * Updated: admin setting page.
@@ -85,20 +88,16 @@ This is the list of used social sites:
85
  * Added Yahoo!Buzz, reddit, LinkedIn and TwitterButton.
86
 
87
  = 1.2.0 =
88
-
89
  * Added "Is Page" option.
90
  * The name of the option was changed from "Single Page" to "Is Singular".
91
 
92
  = 1.1.0 =
93
-
94
  * Bug fix: li style.
95
  * Added wp_social_bookmarking_light_output_e function. It can position the social-links manually inside your template.
96
 
97
  = 1.0.1 =
98
-
99
  * Bug fix: img style.
100
 
101
  = 1.0.0 =
102
-
103
  * First Release
104
 
4
  Tags: links, social, bookmarks, bookmarking, Hatena, Livedoor Clip, BuzzURL, @nifty clip, Twitter, Tumblr, FC2 Bookmark, newsing, Choix, Yahoo!JAPAN Bookmark, Yahoo!Buzz, Google Bookmark, Delicious, Digg, FriendFeed, Google Buzz, Facebook, reddit, LinkedIn, Evernote, Instapaper, StumbleUpon, mixi, gree
5
  Requires at least: 2.9.0
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.6.1
8
 
9
  This plugin inserts social share links at the top or bottom of each post.
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.6.1 =
58
+ * Added: Service code check function.
59
+
60
  = 1.6.0 =
61
  * Added: Hatena Bookmark Button.
62
  * Updated: admin setting page.
88
  * Added Yahoo!Buzz, reddit, LinkedIn and TwitterButton.
89
 
90
  = 1.2.0 =
 
91
  * Added "Is Page" option.
92
  * The name of the option was changed from "Single Page" to "Is Singular".
93
 
94
  = 1.1.0 =
 
95
  * Bug fix: li style.
96
  * Added wp_social_bookmarking_light_output_e function. It can position the social-links manually inside your template.
97
 
98
  = 1.0.1 =
 
99
  * Bug fix: img style.
100
 
101
  = 1.0.0 =
 
102
  * First Release
103
 
wp-social-bookmarking-light.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.ninxit.com/blog/2010/06/13/wp-social-bookmarking-light/
5
  Description: This plugin inserts social share links at the top or bottom of each post.
6
  Author: utahta
7
  Author URI: http://www.ninxit.com/blog/
8
- Version: 1.6.0
9
  */
10
  /*
11
  Copyright 2010 utahta (email : labs.ninxit@gmail.com)
@@ -71,6 +71,18 @@ class WpSocialBookmarkingLight
71
  ."</a>" );
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  /**
75
  * @brief Hatena Bookmark
76
  */
@@ -619,18 +631,19 @@ function wp_social_bookmarking_light_admin_head()
619
 
620
  <script type="text/javascript" charset="utf-8">
621
  //<![CDATA[
622
- function wsbl_options_toggle(service_id, is_simply)
 
623
  {
624
  var val = jQuery("#services_id").val();
625
- var vals = val.split(",");
626
- var has_option = false;
627
- for(var i = 0; i < vals.length; i++){
628
- val = vals[i].replace(/(^\s+)|(\s+$)/g, "");
629
- if(val == service_id){
630
- has_option = true;
631
- }
632
- }
633
 
 
 
 
 
634
  var service_id_settings = "#" + service_id + "_settings";
635
  if(is_simply){
636
  has_option ? jQuery(service_id_settings).show() : jQuery(service_id_settings).hide();
@@ -648,17 +661,44 @@ function wsbl_options_toggle_all(is_simply)
648
  wsbl_options_toggle("facebook_like", is_simply);
649
  }
650
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  // read onece
652
  jQuery(document).ready(function(){
653
- jQuery("#tabs").tabs();
654
-
655
- jQuery("#services_id").keyup(function(){
656
  wsbl_options_toggle_all(false);
657
- });
 
 
658
  wsbl_options_toggle_all(true);
 
 
659
  });
660
  //]]>
661
  </script>
 
662
  <?php
663
  }
664
 
@@ -764,7 +804,10 @@ function wp_social_bookmarking_light_options_page()
764
  </tr>
765
  <tr>
766
  <th scope="row">Services: <br/> <span style="font-size:10px">(comma-separated)</span></th>
767
- <td><input type="text" id='services_id' name='services' value="<?php echo $options['services'] ?>"size=120 style="font-size:12px !important" /></td>
 
 
 
768
  </tr>
769
  </table>
770
  </div>
@@ -888,7 +931,7 @@ function wp_social_bookmarking_light_options_page()
888
  <input type="submit" name='reset' value='<?php _e('Reset') ?>' />
889
  </p>
890
  </form>
891
-
892
  <table class='wp_social_bookmarking_light_options'>
893
  <tr><th><?php _e("Service Code") ?></th><th><?php _e("Explain") ?></th></tr>
894
  <tr><td>hatena</td><td>Hatena Bookmark</td></tr>
5
  Description: This plugin inserts social share links at the top or bottom of each post.
6
  Author: utahta
7
  Author URI: http://www.ninxit.com/blog/
8
+ Version: 1.6.1
9
  */
10
  /*
11
  Copyright 2010 utahta (email : labs.ninxit@gmail.com)
71
  ."</a>" );
72
  }
73
 
74
+ static function get_methods(){
75
+ $all_methods = get_class_methods("WpSocialBookmarkingLight");
76
+ $except_methods = array('WpSocialBookmarkingLight', 'to_utf8', 'link_raw', 'link', 'get_methods');
77
+ foreach($all_methods as $method){
78
+ if(in_array($method, $except_methods)){
79
+ continue;
80
+ }
81
+ $methods[] = $method;
82
+ }
83
+ return $methods;
84
+ }
85
+
86
  /**
87
  * @brief Hatena Bookmark
88
  */
631
 
632
  <script type="text/javascript" charset="utf-8">
633
  //<![CDATA[
634
+
635
+ function wsbl_get_service_codes()
636
  {
637
  var val = jQuery("#services_id").val();
638
+ return jQuery.map(val.split(","), function(n, i){
639
+ return jQuery.trim(n);
640
+ });
641
+ }
 
 
 
 
642
 
643
+ function wsbl_options_toggle(service_id, is_simply)
644
+ {
645
+ var has_option = jQuery.inArray(service_id, wsbl_get_service_codes()) >= 0;
646
+
647
  var service_id_settings = "#" + service_id + "_settings";
648
  if(is_simply){
649
  has_option ? jQuery(service_id_settings).show() : jQuery(service_id_settings).hide();
661
  wsbl_options_toggle("facebook_like", is_simply);
662
  }
663
 
664
+ function wsbl_check_service_code()
665
+ {
666
+ var methods = <?php echo "\"".implode(',', WpSocialBookmarkingLight::get_methods())."\""?>;
667
+ methods = jQuery.map(methods.split(','), function(n, i){
668
+ return jQuery.trim(n);
669
+ });
670
+
671
+ var unknown_services = new Array();
672
+ jQuery.map(wsbl_get_service_codes(), function(n, i){
673
+ if(n.length > 0){
674
+ if(jQuery.inArray(n, methods) < 0){
675
+ unknown_services.push(n);
676
+ }
677
+ }
678
+ });
679
+ if(unknown_services.length > 0){
680
+ var error_str = "Unknown service code: [" + unknown_services.join(", ") + "]";
681
+ jQuery("#unknown_services_id").text(error_str).slideDown();
682
+ }
683
+ else{
684
+ jQuery("#unknown_services_id").slideUp();
685
+ }
686
+ }
687
+
688
  // read onece
689
  jQuery(document).ready(function(){
690
+ setInterval(function(){
 
 
691
  wsbl_options_toggle_all(false);
692
+ wsbl_check_service_code();
693
+ }, 100);
694
+
695
  wsbl_options_toggle_all(true);
696
+ wsbl_check_service_code();
697
+ jQuery("#tabs").tabs();
698
  });
699
  //]]>
700
  </script>
701
+
702
  <?php
703
  }
704
 
804
  </tr>
805
  <tr>
806
  <th scope="row">Services: <br/> <span style="font-size:10px">(comma-separated)</span></th>
807
+ <td>
808
+ <input type="text" id='services_id' name='services' value="<?php echo $options['services'] ?>"size=120 style="font-size:12px !important" />
809
+ <div id='unknown_services_id' style='color:red;'></div>
810
+ </td>
811
  </tr>
812
  </table>
813
  </div>
931
  <input type="submit" name='reset' value='<?php _e('Reset') ?>' />
932
  </p>
933
  </form>
934
+
935
  <table class='wp_social_bookmarking_light_options'>
936
  <tr><th><?php _e("Service Code") ?></th><th><?php _e("Explain") ?></th></tr>
937
  <tr><td>hatena</td><td>Hatena Bookmark</td></tr>