Sociable - Version 3.3

Version Description

Download this release

Release Info

Developer joostdevalk
Plugin Icon wp plugin Sociable
Version 3.3
Comparing to
See all releases

Code changes from version 3.2.3 to 3.3

Files changed (5) hide show
  1. awesmate.php +33 -0
  2. images/hackernews.png +0 -0
  3. images/techmeme.png +0 -0
  4. readme.txt +2 -1
  5. sociable.php +82 -9
awesmate.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define('DOING_AJAX',true);
3
+
4
+ require('../../../wp-load.php');
5
+
6
+ header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
7
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
8
+
9
+ $awesmapikey = get_option('sociable_awesmapikey');
10
+ $destination = str_replace('TARGET', 'AWESM_TARGET', urldecode( $_GET['d'] ) );
11
+ $channel = urldecode( $_GET['c'] );
12
+ $permalink = urldecode( $_GET['t'] );
13
+
14
+ if ($_GET['dir']) {
15
+ $direct = '&direct=true';
16
+ } else {
17
+ $direct = '';
18
+ }
19
+
20
+ if ($_GET['p']) {
21
+ // if the page was arrived at through an awe.sm URL, make that the parent
22
+ $parent = $_GET['p'];
23
+ $parentargument = '&parent_awesm=' . $parent;
24
+ } else {
25
+ // otherwise, there is no parent
26
+ $parentargument = '';
27
+ }
28
+
29
+ $url = 'http://create.awe.sm/url/share?api_key='.$awesmapikey.'&version=1&share_type='.urlencode($channel).'&create_type=sociable-wordpress&target='.urlencode($permalink).'&destination='.urlencode($destination).$direct.$parentargument;
30
+
31
+ $url = str_replace("+","%20",$url);
32
+ header("Location: ".$url);
33
+ ?>
images/hackernews.png ADDED
Binary file
images/techmeme.png ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://yoast.com/donate/
4
  Tags: social, bookmark, bookmarks, bookmarking, social bookmarking, social bookmarks
5
  Requires at least: 2.6
6
  Tested up to: 2.8
7
- Stable tag: 3.2.3
8
 
9
  Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites. WordPress 2.6 or above required!
10
 
@@ -19,6 +19,7 @@ More info:
19
 
20
  **Changelog**
21
 
 
22
  * 3.2.3 Removed the last bit of non jQuery javascript, improved styling and visual feedback when selecting a site
23
  * 3.2.2 Moved style loading to admin_print_styles and scripts to admin_print_scripts
24
  * 3.2.1 Fixed a bug with printing styles in 2.8 beta
4
  Tags: social, bookmark, bookmarks, bookmarking, social bookmarking, social bookmarks
5
  Requires at least: 2.6
6
  Tested up to: 2.8
7
+ Stable tag: 3.3
8
 
9
  Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites. WordPress 2.6 or above required!
10
 
19
 
20
  **Changelog**
21
 
22
+ * 3.3 Added awe.sm integration and some sites.
23
  * 3.2.3 Removed the last bit of non jQuery javascript, improved styling and visual feedback when selecting a site
24
  * 3.2.2 Moved style loading to admin_print_styles and scripts to admin_print_scripts
25
  * 3.2.1 Fixed a bug with printing styles in 2.8 beta
sociable.php CHANGED
@@ -1,9 +1,10 @@
1
  <?php
 
2
  /*
3
  Plugin Name: Sociable
4
  Plugin URI: http://yoast.com/wordpress/sociable/
5
- Description: Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites.
6
- Version: 3.2.3
7
  Author: Joost de Valk
8
  Author URI: http://yoast.com/
9
 
@@ -135,11 +136,13 @@ $sociable_known_sites = Array(
135
  'email' => Array(
136
  'favicon' => 'email_link.png',
137
  'url' => 'mailto:?subject=TITLE&amp;body=PERMALINK',
 
138
  'description' => __('E-mail this story to a friend!','sociable'),
139
  ),
140
 
141
  'Facebook' => Array(
142
  'favicon' => 'facebook.png',
 
143
  'url' => 'http://www.facebook.com/share.php?u=PERMALINK&amp;t=TITLE',
144
  ),
145
 
@@ -179,6 +182,11 @@ $sociable_known_sites = Array(
179
  'url' => 'http://www.gwar.pl/DodajGwar.html?u=PERMALINK',
180
  ),
181
 
 
 
 
 
 
182
  'Haohao' => Array(
183
  'favicon' => 'haohao.png',
184
  'url' => 'http://www.haohaoreport.com/submit.php?url=PERMALINK&amp;title=TITLE',
@@ -281,6 +289,7 @@ $sociable_known_sites = Array(
281
 
282
  'MySpace' => Array(
283
  'favicon' => 'myspace.png',
 
284
  'url' => 'http://www.myspace.com/Modules/PostTo/Pages/?u=PERMALINK&amp;t=TITLE',
285
  ),
286
 
@@ -317,6 +326,7 @@ $sociable_known_sites = Array(
317
 
318
  'Ping.fm' => Array(
319
  'favicon' => 'ping.png',
 
320
  'url' => 'http://ping.fm/ref/?link=PERMALINK&amp;title=TITLE&amp;body=EXCERPT',
321
  ),
322
 
@@ -327,13 +337,13 @@ $sociable_known_sites = Array(
327
 
328
  'PDF' => Array(
329
  'favicon' => 'pdf.png',
330
- 'url' => 'http://www.printfriendly.com/getpf?url=PERMALINK',
331
  'description' => __('Turn this article into a PDF!', 'sociable'),
332
  ),
333
 
334
  'Print' => Array(
335
  'favicon' => 'printfriendly.png',
336
- 'url' => 'http://www.printfriendly.com/print?url=PERMALINK',
337
  'description' => __('Print this article!', 'sociable'),
338
  ),
339
 
@@ -407,6 +417,13 @@ $sociable_known_sites = Array(
407
  'url' => 'http://www.symbaloo.com/nl/add/url=PERMALINK&amp;title=TITLE&amp;icon=http%3A//static01.symbaloo.com/_img/favicon.png',
408
  ),
409
 
 
 
 
 
 
 
 
410
  'Technorati' => Array(
411
  'favicon' => 'technorati.png',
412
  'url' => 'http://technorati.com/faves?add=PERMALINK',
@@ -422,9 +439,10 @@ $sociable_known_sites = Array(
422
  'url' => 'http://tipd.com/submit.php?url=PERMALINK',
423
  ),
424
 
425
- 'TwitThis' => Array(
426
  'favicon' => 'twitter.png',
427
- 'url' => 'http://twitter.com/home?status=PERMALINK',
 
428
  ),
429
 
430
  'Upnews' => Array(
@@ -497,7 +515,7 @@ if (!function_exists('strip_shortcodes')) {
497
  }
498
  }
499
 
500
- function sociable_html($display=Array()) {
501
  global $sociable_known_sites, $sociablepluginpath, $wp_query, $post;
502
 
503
  $sociableooffmeta = get_post_meta($post->ID,'sociableoff',true);
@@ -513,6 +531,8 @@ function sociable_html($display=Array()) {
513
  $imagepath = $sociablepluginpath.'images/';
514
  else
515
  $imagepath = get_option('sociable_imagedir');
 
 
516
 
517
  // if no sites are specified, display all active
518
  // have to check $active_sites has content because WP
@@ -562,7 +582,7 @@ function sociable_html($display=Array()) {
562
  $site = $sociable_known_sites[$sitename];
563
 
564
  $url = $site['url'];
565
- $url = str_replace('PERMALINK', $permalink, $url);
566
  $url = str_replace('TITLE', $title, $url);
567
  $url = str_replace('RSS', $rss, $url);
568
  $url = str_replace('BLOGNAME', $blogname, $url);
@@ -574,6 +594,33 @@ function sociable_html($display=Array()) {
574
  } else {
575
  $description = $sitename;
576
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  if ($i == 0) {
578
  $link = '<li class="sociablefirst">';
579
  } else if ($totalsites == ($i+1)) {
@@ -582,7 +629,7 @@ function sociable_html($display=Array()) {
582
  $link = '<li>';
583
  }
584
  $link .= "<a rel=\"nofollow\"";
585
- if (get_option('sociable_usetargetblank')) {
586
  $link .= " target=\"_blank\"";
587
  }
588
  $link .= " href=\"$url\" title=\"$description\">";
@@ -772,6 +819,19 @@ function sociable_submenu() {
772
  update_option('sociable_usetargetblank',false);
773
  }
774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
775
  // update conditional displays
776
  $conditionals = Array();
777
  if (!$_POST['conditionals'])
@@ -817,6 +877,8 @@ function sociable_submenu() {
817
  $conditionals = get_option('sociable_conditionals');
818
  $updated = get_option('sociable_updated');
819
  $usetargetblank = get_option('sociable_usetargetblank');
 
 
820
 
821
  // display options
822
  ?>
@@ -907,6 +969,16 @@ function sociable_submenu() {
907
  <input type="checkbox" name="usetargetblank" <?php echo (get_option('sociable_usetargetblank')) ? ' checked="checked"' : ''; ?> /> <?php _e("Use <code>target=_blank</code> on links? (Forces links to open a new window)", "sociable"); ?>
908
  </td>
909
  </tr>
 
 
 
 
 
 
 
 
 
 
910
  <tr>
911
  <td>&nbsp;</td>
912
  <td>
@@ -929,6 +1001,7 @@ function sociable_submenu() {
929
  <h2><?php _e('Credits','sociable'); ?></h2>
930
  <p><?php _e('<a href="http://yoast.com/wordpress/sociable/">Sociable</a> was originally developed by <a href="http://push.cx/">Peter Harkins</a> and has been maintained by <a href="http://yoast.com/">Joost de Valk</a> since the beginning of 2008. It\'s released under the GNU GPL version 2.','Sociable'); ?></p>
931
 
 
932
  </div>
933
  </form>
934
  <?php
1
  <?php
2
+ // return;
3
  /*
4
  Plugin Name: Sociable
5
  Plugin URI: http://yoast.com/wordpress/sociable/
6
+ Description: Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites. Go to <a href="options-general.php?page=Sociable">Settings -> Sociable</a> for setup. This is based on the original <a href="http://yoast.com/wordpress/sociable">Sociable plugin</a> by Joost de Valk and has only been modified to support using awe.sm for links.
7
+ Version: 3.3
8
  Author: Joost de Valk
9
  Author URI: http://yoast.com/
10
 
136
  'email' => Array(
137
  'favicon' => 'email_link.png',
138
  'url' => 'mailto:?subject=TITLE&amp;body=PERMALINK',
139
+ 'awesm_channel' => 'mailto',
140
  'description' => __('E-mail this story to a friend!','sociable'),
141
  ),
142
 
143
  'Facebook' => Array(
144
  'favicon' => 'facebook.png',
145
+ 'awesm_channel' => 'facebook-post',
146
  'url' => 'http://www.facebook.com/share.php?u=PERMALINK&amp;t=TITLE',
147
  ),
148
 
182
  'url' => 'http://www.gwar.pl/DodajGwar.html?u=PERMALINK',
183
  ),
184
 
185
+ 'HackerNews' => Array(
186
+ 'favicon' => 'hackernews.png',
187
+ 'url' => 'http://news.ycombinator.com/submitlink?u=PERMALINK&amp;t=TITLE',
188
+ ),
189
+
190
  'Haohao' => Array(
191
  'favicon' => 'haohao.png',
192
  'url' => 'http://www.haohaoreport.com/submit.php?url=PERMALINK&amp;title=TITLE',
289
 
290
  'MySpace' => Array(
291
  'favicon' => 'myspace.png',
292
+ 'awesm_channel' => 'myspace',
293
  'url' => 'http://www.myspace.com/Modules/PostTo/Pages/?u=PERMALINK&amp;t=TITLE',
294
  ),
295
 
326
 
327
  'Ping.fm' => Array(
328
  'favicon' => 'ping.png',
329
+ 'awesm_channel' => 'pingfm',
330
  'url' => 'http://ping.fm/ref/?link=PERMALINK&amp;title=TITLE&amp;body=EXCERPT',
331
  ),
332
 
337
 
338
  'PDF' => Array(
339
  'favicon' => 'pdf.png',
340
+ 'url' => 'http://www.printfriendly.com/getpf?url=PERMALINK&amp;partner=sociable',
341
  'description' => __('Turn this article into a PDF!', 'sociable'),
342
  ),
343
 
344
  'Print' => Array(
345
  'favicon' => 'printfriendly.png',
346
+ 'url' => 'http://www.printfriendly.com/print?url=PERMALINK&amp;partner=sociable',
347
  'description' => __('Print this article!', 'sociable'),
348
  ),
349
 
417
  'url' => 'http://www.symbaloo.com/nl/add/url=PERMALINK&amp;title=TITLE&amp;icon=http%3A//static01.symbaloo.com/_img/favicon.png',
418
  ),
419
 
420
+ 'Techmeme' => Array(
421
+ 'favicon' => 'techmeme.png',
422
+ 'awesm_channel' => 'twitter-techmeme',
423
+ 'url' => 'http://twitter.com/home/?status=tip%20@Techmeme%20PERMALINK%20TITLE',
424
+ 'description' => 'Suggest to Techmeme via Twitter'
425
+ ),
426
+
427
  'Technorati' => Array(
428
  'favicon' => 'technorati.png',
429
  'url' => 'http://technorati.com/faves?add=PERMALINK',
439
  'url' => 'http://tipd.com/submit.php?url=PERMALINK',
440
  ),
441
 
442
+ 'Twitter' => Array(
443
  'favicon' => 'twitter.png',
444
+ 'awesm_channel' => 'twitter',
445
+ 'url' => 'http://twitter.com/home?status=TITLE%20-%20PERMALINK',
446
  ),
447
 
448
  'Upnews' => Array(
515
  }
516
  }
517
 
518
+ function sociable_html($display=array()) {
519
  global $sociable_known_sites, $sociablepluginpath, $wp_query, $post;
520
 
521
  $sociableooffmeta = get_post_meta($post->ID,'sociableoff',true);
531
  $imagepath = $sociablepluginpath.'images/';
532
  else
533
  $imagepath = get_option('sociable_imagedir');
534
+
535
+ $awesmapikey = get_option('sociable_awesmapikey');
536
 
537
  // if no sites are specified, display all active
538
  // have to check $active_sites has content because WP
582
  $site = $sociable_known_sites[$sitename];
583
 
584
  $url = $site['url'];
585
+ // Removed $url = str_replace('PERMALINK', $permalink, $url);
586
  $url = str_replace('TITLE', $title, $url);
587
  $url = str_replace('RSS', $rss, $url);
588
  $url = str_replace('BLOGNAME', $blogname, $url);
594
  } else {
595
  $description = $sitename;
596
  }
597
+
598
+ // Added Start
599
+ if (get_option('sociable_awesmenable') == true &! empty($site['awesm_channel']) ){
600
+ // if awe.sm is enabled and it is an awe.sm supported site, be awe.sm
601
+ $permalink = str_replace('&', '%26', $permalink);
602
+ $destination = str_replace('PERMALINK', 'TARGET', $url);
603
+ $destination = str_replace('&amp;', '%26', $destination);
604
+ $channel = urlencode($site['awesm_channel']);
605
+ if ($_GET['awesm']) {
606
+ // if the page was arrived at through an awe.sm URL, make that the parent
607
+ $parent = $_GET['awesm'];
608
+ $parentargument = '&p=' . $parent;
609
+ } else {
610
+ // otherwise, there is no parent
611
+ $parentargument = '';
612
+ }
613
+
614
+ if (strpos($channel, 'direct') != false) {
615
+ $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.'&dir=true'.$parentargument;
616
+ } else {
617
+ $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.$parentargument;
618
+ }
619
+ } else {
620
+ // otherwise, just be plain
621
+ $url = str_replace('PERMALINK', $permalink, $url);
622
+ }
623
+
624
  if ($i == 0) {
625
  $link = '<li class="sociablefirst">';
626
  } else if ($totalsites == ($i+1)) {
629
  $link = '<li>';
630
  }
631
  $link .= "<a rel=\"nofollow\"";
632
+ if (get_option('sociable_usetargetblank') && empty($site['awesm_channel'])) {
633
  $link .= " target=\"_blank\"";
634
  }
635
  $link .= " href=\"$url\" title=\"$description\">";
819
  update_option('sociable_usetargetblank',false);
820
  }
821
 
822
+ // Added Start
823
+ // update awe.sm settings
824
+ if (isset($_POST['awesmenable']) && $_POST['awesmenable']) {
825
+ update_option('sociable_awesmenable',true);
826
+ } else {
827
+ update_option('sociable_awesmenable',false);
828
+ }
829
+
830
+ if (!$_REQUEST['awesmapikey'])
831
+ $_REQUEST['awesmapikey'] = "";
832
+ update_option('sociable_awesmapikey', $_REQUEST['awesmapikey']);
833
+ // Added End
834
+
835
  // update conditional displays
836
  $conditionals = Array();
837
  if (!$_POST['conditionals'])
877
  $conditionals = get_option('sociable_conditionals');
878
  $updated = get_option('sociable_updated');
879
  $usetargetblank = get_option('sociable_usetargetblank');
880
+ $awesmapikey = get_option('sociable_awesmapikey'); // Added
881
+ $awesmenable = get_option('sociable_awesmenable'); // Added
882
 
883
  // display options
884
  ?>
969
  <input type="checkbox" name="usetargetblank" <?php echo (get_option('sociable_usetargetblank')) ? ' checked="checked"' : ''; ?> /> <?php _e("Use <code>target=_blank</code> on links? (Forces links to open a new window)", "sociable"); ?>
970
  </td>
971
  </tr>
972
+ <tr>
973
+ <th scope="row" valign="top">
974
+ <?php _e("awe.sm:", "sociable"); ?>
975
+ </th>
976
+ <td>
977
+ <?php _e("You can choose to automatically have the links posted to certain sites shortened via awe.sm and encoded with the channel info and your API Key.", 'sociable'); ?><br/>
978
+ <input type="checkbox" name="awesmenable" <?php echo (get_option('sociable_awesmenable')) ? ' checked="checked"' : ''; ?> /> <?php _e("Enable awe.sm URLs? (When this is enabled, <strong>all sites</strong> to which awe.sm URLs are posted will open in a new window)", "sociable"); ?><br/>
979
+ <?php _e("awe.sm API Key:", 'sociable'); ?> <input size="65" type="text" name="awesmapikey" value="<?php echo $awesmapikey; ?>" />
980
+ </td>
981
+ </tr>
982
  <tr>
983
  <td>&nbsp;</td>
984
  <td>
1001
  <h2><?php _e('Credits','sociable'); ?></h2>
1002
  <p><?php _e('<a href="http://yoast.com/wordpress/sociable/">Sociable</a> was originally developed by <a href="http://push.cx/">Peter Harkins</a> and has been maintained by <a href="http://yoast.com/">Joost de Valk</a> since the beginning of 2008. It\'s released under the GNU GPL version 2.','Sociable'); ?></p>
1003
 
1004
+
1005
  </div>
1006
  </form>
1007
  <?php