Sociable - Version 3.3.3

Version Description

Download this release

Release Info

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

Code changes from version 3.3.1 to 3.3.3

Files changed (95) hide show
  1. images/barrapunto.png +0 -0
  2. images/bitacoras.png +0 -0
  3. images/blinklist.png +0 -0
  4. images/blogmarks.png +0 -0
  5. images/blogmemes.png +0 -0
  6. images/blogospherenews.png +0 -0
  7. images/blogter.png +0 -0
  8. images/bluedot.png +0 -0
  9. images/co.mments.png +0 -0
  10. images/connotea.png +0 -0
  11. images/current.png +0 -0
  12. images/delicious.png +0 -0
  13. images/designfloat.png +0 -0
  14. images/digg.png +0 -0
  15. images/diigo.png +0 -0
  16. images/dotnetkicks.png +0 -0
  17. images/dzone.png +0 -0
  18. images/ekudos.png +0 -0
  19. images/email.png +0 -0
  20. images/email_link.png +0 -0
  21. images/facebook.png +0 -0
  22. images/fark.png +0 -0
  23. images/fleck.png +0 -0
  24. images/friendfeed.png +0 -0
  25. images/fsdaily.png +0 -0
  26. images/globalgrind.png +0 -0
  27. images/googlebookmark.png +0 -0
  28. images/hackernews.png +0 -0
  29. images/haohao.png +0 -0
  30. images/healthranker.png +0 -0
  31. images/hellotxt.png +0 -0
  32. images/hemidemi.png +0 -0
  33. images/identica.png +0 -0
  34. images/im.png +0 -0
  35. images/indianpad.png +0 -0
  36. images/kirtsy.png +0 -0
  37. images/laaikit.png +0 -0
  38. images/linkagogo.png +0 -0
  39. images/linkarena.png +0 -0
  40. images/linkedin.png +0 -0
  41. images/linkter.png +0 -0
  42. images/live.png +0 -0
  43. images/magnolia.png +0 -0
  44. images/meneame.png +0 -0
  45. images/misterwong.png +0 -0
  46. images/mixx.png +0 -0
  47. images/msnreporter.png +0 -0
  48. images/muti.png +0 -0
  49. images/myshare.png +0 -0
  50. images/myspace.png +0 -0
  51. images/n4g.png +0 -0
  52. images/netvibes.png +0 -0
  53. images/netvouz.png +0 -0
  54. images/newsvine.png +0 -0
  55. images/nujij.png +0 -0
  56. images/pdf.png +0 -0
  57. images/ping.png +0 -0
  58. images/posterous.png +0 -0
  59. images/ppnow.png +0 -0
  60. images/print.png +0 -0
  61. images/printer.png +0 -0
  62. images/printfriendly.png +0 -0
  63. images/propeller.png +0 -0
  64. images/ratimarks.png +0 -0
  65. images/rec6.png +0 -0
  66. images/reddit.png +0 -0
  67. images/rss.png +0 -0
  68. images/scoopeo.png +0 -0
  69. images/segnalo.png +0 -0
  70. images/simpy.png +0 -0
  71. images/slashdot.png +0 -0
  72. images/socialogs.png +0 -0
  73. images/sphere.png +0 -0
  74. images/sphinn.png +0 -0
  75. images/stumbleupon.png +0 -0
  76. images/symbaloo.png +0 -0
  77. images/techmeme.png +0 -0
  78. images/technorati.png +0 -0
  79. images/thisnext.png +0 -0
  80. images/tipd.png +0 -0
  81. images/tumblr.png +0 -0
  82. images/twitter.png +0 -0
  83. images/upnews.png +0 -0
  84. images/webnews.png +0 -0
  85. images/webride.png +0 -0
  86. images/wikio.png +0 -0
  87. images/wists.png +0 -0
  88. images/wykop.png +0 -0
  89. images/xerpi.png +0 -0
  90. images/yahoobuzz.png +0 -0
  91. images/yahoomyweb.png +0 -0
  92. images/yiggit.png +0 -0
  93. readme.txt +10 -3
  94. sociable.php +59 -30
  95. yoast-posts.php +0 -63
images/barrapunto.png CHANGED
Binary file
images/bitacoras.png CHANGED
Binary file
images/blinklist.png CHANGED
Binary file
images/blogmarks.png CHANGED
Binary file
images/blogmemes.png CHANGED
Binary file
images/blogospherenews.png CHANGED
Binary file
images/blogter.png CHANGED
Binary file
images/bluedot.png CHANGED
Binary file
images/co.mments.png CHANGED
Binary file
images/connotea.png CHANGED
Binary file
images/current.png CHANGED
Binary file
images/delicious.png CHANGED
Binary file
images/designfloat.png CHANGED
Binary file
images/digg.png CHANGED
Binary file
images/diigo.png CHANGED
Binary file
images/dotnetkicks.png CHANGED
Binary file
images/dzone.png CHANGED
Binary file
images/ekudos.png CHANGED
Binary file
images/email.png CHANGED
Binary file
images/email_link.png CHANGED
Binary file
images/facebook.png CHANGED
Binary file
images/fark.png CHANGED
Binary file
images/fleck.png CHANGED
Binary file
images/friendfeed.png CHANGED
Binary file
images/fsdaily.png CHANGED
Binary file
images/globalgrind.png CHANGED
Binary file
images/googlebookmark.png CHANGED
Binary file
images/hackernews.png CHANGED
Binary file
images/haohao.png CHANGED
Binary file
images/healthranker.png CHANGED
Binary file
images/hellotxt.png CHANGED
Binary file
images/hemidemi.png CHANGED
Binary file
images/identica.png CHANGED
Binary file
images/im.png CHANGED
Binary file
images/indianpad.png CHANGED
Binary file
images/kirtsy.png CHANGED
Binary file
images/laaikit.png CHANGED
Binary file
images/linkagogo.png CHANGED
Binary file
images/linkarena.png CHANGED
Binary file
images/linkedin.png CHANGED
Binary file
images/linkter.png CHANGED
Binary file
images/live.png CHANGED
Binary file
images/magnolia.png CHANGED
Binary file
images/meneame.png CHANGED
Binary file
images/misterwong.png CHANGED
Binary file
images/mixx.png CHANGED
Binary file
images/msnreporter.png CHANGED
Binary file
images/muti.png CHANGED
Binary file
images/myshare.png CHANGED
Binary file
images/myspace.png CHANGED
Binary file
images/n4g.png CHANGED
Binary file
images/netvibes.png CHANGED
Binary file
images/netvouz.png CHANGED
Binary file
images/newsvine.png CHANGED
Binary file
images/nujij.png CHANGED
Binary file
images/pdf.png CHANGED
Binary file
images/ping.png CHANGED
Binary file
images/posterous.png ADDED
Binary file
images/ppnow.png CHANGED
Binary file
images/print.png CHANGED
Binary file
images/printer.png CHANGED
Binary file
images/printfriendly.png CHANGED
Binary file
images/propeller.png CHANGED
Binary file
images/ratimarks.png CHANGED
Binary file
images/rec6.png CHANGED
Binary file
images/reddit.png CHANGED
Binary file
images/rss.png CHANGED
Binary file
images/scoopeo.png CHANGED
Binary file
images/segnalo.png CHANGED
Binary file
images/simpy.png CHANGED
Binary file
images/slashdot.png CHANGED
Binary file
images/socialogs.png CHANGED
Binary file
images/sphere.png CHANGED
Binary file
images/sphinn.png CHANGED
Binary file
images/stumbleupon.png CHANGED
Binary file
images/symbaloo.png CHANGED
Binary file
images/techmeme.png CHANGED
Binary file
images/technorati.png CHANGED
Binary file
images/thisnext.png CHANGED
Binary file
images/tipd.png CHANGED
Binary file
images/tumblr.png CHANGED
Binary file
images/twitter.png CHANGED
Binary file
images/upnews.png CHANGED
Binary file
images/webnews.png CHANGED
Binary file
images/webride.png CHANGED
Binary file
images/wikio.png CHANGED
Binary file
images/wists.png CHANGED
Binary file
images/wykop.png CHANGED
Binary file
images/xerpi.png CHANGED
Binary file
images/yahoobuzz.png CHANGED
Binary file
images/yahoomyweb.png CHANGED
Binary file
images/yiggit.png CHANGED
Binary file
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Sociable ===
2
- Contributors: joostdevalk
3
  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.3.1
8
 
9
  Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites.
10
 
@@ -25,6 +25,13 @@ More info:
25
 
26
  == Changelog ==
27
 
 
 
 
 
 
 
 
28
  = 3.3.1 =
29
  * Added new option to use pure text links, instead of image links.
30
  * Fixed small issue with using target=blank links and the new awe.sm options.
1
  === Sociable ===
2
+ Contributors: joostdevalk, sociable
3
  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.1
7
+ Stable tag: 3.3.3
8
 
9
  Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites.
10
 
25
 
26
  == Changelog ==
27
 
28
+ = 3.3.2 =
29
+ * Brought back Tumblr
30
+ * Updated PDF link
31
+ * Added Posterous
32
+ * Smushed all images using [Smush.it](http://smush.it/), reducing the total image file size with 31.72 KB (42.03%)!
33
+ * Removed pre - 2.6 compatibility code
34
+
35
  = 3.3.1 =
36
  * Added new option to use pure text links, instead of image links.
37
  * Fixed small issue with using target=blank links and the new awe.sm options.
sociable.php CHANGED
@@ -2,8 +2,8 @@
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. 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.
6
- Version: 3.3.1
7
  Author: Joost de Valk
8
  Author URI: http://yoast.com/
9
 
@@ -25,8 +25,8 @@ along with this program; if not, write to the Free Software
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
  */
27
 
28
- // Guess the location
29
- $sociablepluginpath = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/';
30
 
31
  function sociable_init_locale(){
32
  global $sociablepluginpath;
@@ -329,6 +329,11 @@ $sociable_known_sites = Array(
329
  'url' => 'http://ping.fm/ref/?link=PERMALINK&amp;title=TITLE&amp;body=EXCERPT',
330
  ),
331
 
 
 
 
 
 
332
  'ppnow' => Array(
333
  'favicon' => 'ppnow.png',
334
  'url' => 'http://www.ppnow.net/submit.php?url=PERMALINK',
@@ -336,7 +341,7 @@ $sociable_known_sites = Array(
336
 
337
  'PDF' => Array(
338
  'favicon' => 'pdf.png',
339
- 'url' => 'http://www.printfriendly.com/getpf?url=PERMALINK&amp;partner=sociable',
340
  'description' => __('Turn this article into a PDF!', 'sociable'),
341
  ),
342
 
@@ -438,6 +443,11 @@ $sociable_known_sites = Array(
438
  'url' => 'http://tipd.com/submit.php?url=PERMALINK',
439
  ),
440
 
 
 
 
 
 
441
  'Twitter' => Array(
442
  'favicon' => 'twitter.png',
443
  'awesm_channel' => 'twitter',
@@ -507,13 +517,6 @@ $sociable_known_sites = Array(
507
  ),
508
  );
509
 
510
- // For maintaining backwards compatability
511
- if (!function_exists('strip_shortcodes')) {
512
- function strip_shortcodes($content) {
513
- return $content;
514
- }
515
- }
516
-
517
  function sociable_html($display=array()) {
518
  global $sociable_known_sites, $sociablepluginpath, $wp_query, $post;
519
 
@@ -576,7 +579,6 @@ function sociable_html($display=array()) {
576
  $site = $sociable_known_sites[$sitename];
577
 
578
  $url = $site['url'];
579
- // Removed $url = str_replace('PERMALINK', $permalink, $url);
580
  $url = str_replace('TITLE', $title, $url);
581
  $url = str_replace('RSS', $rss, $url);
582
  $url = str_replace('BLOGNAME', $blogname, $url);
@@ -589,21 +591,19 @@ function sociable_html($display=array()) {
589
  $description = $sitename;
590
  }
591
 
592
- // Added Start
593
  if (get_option('sociable_awesmenable') == true &! empty($site['awesm_channel']) ){
594
  // if awe.sm is enabled and it is an awe.sm supported site, be awe.sm
595
  $permalink = str_replace('&', '%26', $permalink);
596
  $destination = str_replace('PERMALINK', 'TARGET', $url);
597
  $destination = str_replace('&amp;', '%26', $destination);
598
  $channel = urlencode($site['awesm_channel']);
 
 
599
  if ($_GET['awesm']) {
600
  // if the page was arrived at through an awe.sm URL, make that the parent
601
  $parent = $_GET['awesm'];
602
  $parentargument = '&p=' . $parent;
603
- } else {
604
- // otherwise, there is no parent
605
- $parentargument = '';
606
- }
607
 
608
  if (strpos($channel, 'direct') != false) {
609
  $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.'&dir=true'.$parentargument;
@@ -611,7 +611,6 @@ function sociable_html($display=array()) {
611
  $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.$parentargument;
612
  }
613
  } else {
614
- // otherwise, just be plain
615
  $url = str_replace('PERMALINK', $permalink, $url);
616
  }
617
 
@@ -651,7 +650,6 @@ $sociable_contitionals = get_option('sociable_conditionals');
651
  if (is_array($sociable_contitionals) and in_array(true, $sociable_contitionals)) {
652
  add_filter('the_content', 'sociable_display_hook');
653
  add_filter('the_excerpt', 'sociable_display_hook');
654
- // add_filter('the_excerpt_rss', 'sociable_display_hook');
655
 
656
  function sociable_display_hook($content='') {
657
  $conditionals = get_option('sociable_conditionals');
@@ -673,16 +671,13 @@ if (is_array($sociable_contitionals) and in_array(true, $sociable_contitionals))
673
  }
674
  }
675
 
676
- // Plugin config/data setup
677
  register_activation_hook(__FILE__, 'sociable_activation_hook');
678
 
679
  function sociable_activation_hook() {
680
  return sociable_restore_config(False);
681
  }
682
 
683
- // restore built-in defaults, optionally overwriting existing values
684
  function sociable_restore_config($force=False) {
685
- // Load defaults, taking care not to smash already-set options
686
  global $sociable_known_sites;
687
 
688
  if ($force or !is_array(get_option('sociable_active_sites')))
@@ -696,11 +691,9 @@ function sociable_restore_config($force=False) {
696
  'Google',
697
  ));
698
 
699
- // tagline defaults to a Hitchiker's Guide to the Galaxy reference
700
  if ($force or !is_string(get_option('sociable_tagline')))
701
  update_option('sociable_tagline', "<strong>" . __("Share and Enjoy:", 'sociable') . "</strong>");
702
 
703
- // only display on single posts and pages by default
704
  if ($force or !is_array(get_option('sociable_conditionals')))
705
  update_option('sociable_conditionals', array(
706
  'is_home' => False,
@@ -718,7 +711,6 @@ function sociable_restore_config($force=False) {
718
  update_option('sociable_usecss', true);
719
  }
720
 
721
- // Hook the admin_menu display to add admin page
722
  add_action('admin_menu', 'sociable_admin_menu');
723
  function sociable_admin_menu() {
724
  add_submenu_page('options-general.php', 'Sociable', 'Sociable', 8, 'Sociable', 'sociable_submenu');
@@ -787,18 +779,15 @@ function sociable_insert_post($pID) {
787
  }
788
  add_action('wp_insert_post', 'sociable_insert_post');
789
 
790
- // The admin page
791
  function sociable_submenu() {
792
  global $sociable_known_sites, $sociable_date, $sociablepluginpath;
793
 
794
- // update options in db if requested
795
  if (isset($_REQUEST['restore']) && $_REQUEST['restore']) {
796
  check_admin_referer('sociable-config');
797
  sociable_restore_config(True);
798
  sociable_message(__("Restored all settings to defaults.", 'sociable'));
799
  } else if (isset($_REQUEST['save']) && $_REQUEST['save']) {
800
  check_admin_referer('sociable-config');
801
- // update active sites
802
  $active_sites = Array();
803
  if (!$_REQUEST['active_sites'])
804
  $_REQUEST['active_sites'] = Array();
@@ -863,6 +852,7 @@ function sociable_submenu() {
863
  ?>
864
 
865
  <div class="wrap">
 
866
  <h2><?php _e("Sociable Options", 'sociable'); ?></h2>
867
  <table class="form-table">
868
  <tr>
@@ -1018,5 +1008,44 @@ if (get_option('sociable_usecss_set_once') != true) {
1018
  update_option('sociable_usecss_set_once', true);
1019
  }
1020
 
1021
- require_once("yoast-posts.php");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  ?>
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.3.3
7
  Author: Joost de Valk
8
  Author URI: http://yoast.com/
9
 
25
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
  */
27
 
28
+ // Determine the location
29
+ $sociablepluginpath = plugins_url('', __FILE__).'/';
30
 
31
  function sociable_init_locale(){
32
  global $sociablepluginpath;
329
  'url' => 'http://ping.fm/ref/?link=PERMALINK&amp;title=TITLE&amp;body=EXCERPT',
330
  ),
331
 
332
+ 'Posterous' => Array(
333
+ 'favicon' => 'posterous.png',
334
+ 'url' => 'http://posterous.com/share?linkto=PERMALINK&amp;title=TITLE&amp;selection=EXCERPT',
335
+ ),
336
+
337
  'ppnow' => Array(
338
  'favicon' => 'ppnow.png',
339
  'url' => 'http://www.ppnow.net/submit.php?url=PERMALINK',
341
 
342
  'PDF' => Array(
343
  'favicon' => 'pdf.png',
344
+ 'url' => 'http://www.printfriendly.com/print?url=PERMALINK&amp;partner=sociable',
345
  'description' => __('Turn this article into a PDF!', 'sociable'),
346
  ),
347
 
443
  'url' => 'http://tipd.com/submit.php?url=PERMALINK',
444
  ),
445
 
446
+ 'Tumblr' => Array(
447
+ 'favicon' => 'tumblr.png',
448
+ 'url' => 'http://www.tumblr.com/share?v=3&amp;u=PERMALINK&amp;t=TITLE&amp;s=EXCERPT',
449
+ ),
450
+
451
  'Twitter' => Array(
452
  'favicon' => 'twitter.png',
453
  'awesm_channel' => 'twitter',
517
  ),
518
  );
519
 
 
 
 
 
 
 
 
520
  function sociable_html($display=array()) {
521
  global $sociable_known_sites, $sociablepluginpath, $wp_query, $post;
522
 
579
  $site = $sociable_known_sites[$sitename];
580
 
581
  $url = $site['url'];
 
582
  $url = str_replace('TITLE', $title, $url);
583
  $url = str_replace('RSS', $rss, $url);
584
  $url = str_replace('BLOGNAME', $blogname, $url);
591
  $description = $sitename;
592
  }
593
 
 
594
  if (get_option('sociable_awesmenable') == true &! empty($site['awesm_channel']) ){
595
  // if awe.sm is enabled and it is an awe.sm supported site, be awe.sm
596
  $permalink = str_replace('&', '%26', $permalink);
597
  $destination = str_replace('PERMALINK', 'TARGET', $url);
598
  $destination = str_replace('&amp;', '%26', $destination);
599
  $channel = urlencode($site['awesm_channel']);
600
+
601
+ $parentargument = '';
602
  if ($_GET['awesm']) {
603
  // if the page was arrived at through an awe.sm URL, make that the parent
604
  $parent = $_GET['awesm'];
605
  $parentargument = '&p=' . $parent;
606
+ }
 
 
 
607
 
608
  if (strpos($channel, 'direct') != false) {
609
  $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.'&dir=true'.$parentargument;
611
  $url = $sociablepluginpath.'awesmate.php?c='.$channel.'&t='.$permalink.'&d='.$destination.$parentargument;
612
  }
613
  } else {
 
614
  $url = str_replace('PERMALINK', $permalink, $url);
615
  }
616
 
650
  if (is_array($sociable_contitionals) and in_array(true, $sociable_contitionals)) {
651
  add_filter('the_content', 'sociable_display_hook');
652
  add_filter('the_excerpt', 'sociable_display_hook');
 
653
 
654
  function sociable_display_hook($content='') {
655
  $conditionals = get_option('sociable_conditionals');
671
  }
672
  }
673
 
 
674
  register_activation_hook(__FILE__, 'sociable_activation_hook');
675
 
676
  function sociable_activation_hook() {
677
  return sociable_restore_config(False);
678
  }
679
 
 
680
  function sociable_restore_config($force=False) {
 
681
  global $sociable_known_sites;
682
 
683
  if ($force or !is_array(get_option('sociable_active_sites')))
691
  'Google',
692
  ));
693
 
 
694
  if ($force or !is_string(get_option('sociable_tagline')))
695
  update_option('sociable_tagline', "<strong>" . __("Share and Enjoy:", 'sociable') . "</strong>");
696
 
 
697
  if ($force or !is_array(get_option('sociable_conditionals')))
698
  update_option('sociable_conditionals', array(
699
  'is_home' => False,
711
  update_option('sociable_usecss', true);
712
  }
713
 
 
714
  add_action('admin_menu', 'sociable_admin_menu');
715
  function sociable_admin_menu() {
716
  add_submenu_page('options-general.php', 'Sociable', 'Sociable', 8, 'Sociable', 'sociable_submenu');
779
  }
780
  add_action('wp_insert_post', 'sociable_insert_post');
781
 
 
782
  function sociable_submenu() {
783
  global $sociable_known_sites, $sociable_date, $sociablepluginpath;
784
 
 
785
  if (isset($_REQUEST['restore']) && $_REQUEST['restore']) {
786
  check_admin_referer('sociable-config');
787
  sociable_restore_config(True);
788
  sociable_message(__("Restored all settings to defaults.", 'sociable'));
789
  } else if (isset($_REQUEST['save']) && $_REQUEST['save']) {
790
  check_admin_referer('sociable-config');
 
791
  $active_sites = Array();
792
  if (!$_REQUEST['active_sites'])
793
  $_REQUEST['active_sites'] = Array();
852
  ?>
853
 
854
  <div class="wrap">
855
+ <?php screen_icon(); ?>
856
  <h2><?php _e("Sociable Options", 'sociable'); ?></h2>
857
  <table class="form-table">
858
  <tr>
1008
  update_option('sociable_usecss_set_once', true);
1009
  }
1010
 
1011
+ if (!function_exists('yst_db_widget')) {
1012
+ function yst_db_widget($image = 'normal', $num = 3, $excerptsize = 250, $showdate = true) {
1013
+ require_once(ABSPATH.WPINC.'/rss.php');
1014
+ if ( $rss = fetch_rss( 'http://feeds2.feedburner.com/joostdevalk' ) ) {
1015
+ echo '<div class="rss-widget">';
1016
+ if ($image == 'normal') {
1017
+ echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
1018
+ } else {
1019
+ echo '<a href="http://yoast.com/" title="Go to Yoast.com"><img width="80" src="http://cdn.yoast.com/yoast-logo-rss.png" class="alignright" alt="Yoast"/></a>';
1020
+ }
1021
+ echo '<ul>';
1022
+ $rss->items = array_slice( $rss->items, 0, $num );
1023
+ foreach ( (array) $rss->items as $item ) {
1024
+ echo '<li>';
1025
+ echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. htmlentities($item['title']) .'</a> ';
1026
+ if ($showdate)
1027
+ echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
1028
+ echo '<div class="rssSummary">'. yst_text_limit($item['summary'],$excerptsize) .'</div>';
1029
+ echo '</li>';
1030
+ }
1031
+ echo '</ul>';
1032
+ echo '<div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">';
1033
+ echo '<a href="http://feeds2.feedburner.com/joostdevalk"><img src="'.get_bloginfo('wpurl').'/wp-includes/images/rss.png" alt=""/> Subscribe with RSS</a>';
1034
+ if ($image == 'normal') {
1035
+ echo ' &nbsp; &nbsp; &nbsp; ';
1036
+ } else {
1037
+ echo '<br/>';
1038
+ }
1039
+ echo '<a href="http://yoast.com/email-blog-updates/"><img src="http://cdn.yoast.com/email_sub.png" alt=""/> Subscribe by email</a>';
1040
+ echo '</div>';
1041
+ echo '</div>';
1042
+ }
1043
+ }
1044
+
1045
+ function yst_widget_setup() {
1046
+ wp_add_dashboard_widget( 'yst_db_widget' , 'The Latest news from Yoast' , 'yst_db_widget');
1047
+ }
1048
+
1049
+ add_action('wp_dashboard_setup', 'yst_widget_setup');
1050
+ }
1051
  ?>
yoast-posts.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- if (!class_exists('YoastPosts')) {
4
- class YoastPosts {
5
-
6
- // Class initialization
7
- function YoastPosts() {
8
- if (isset($_GET['show_yoast_widget'])) {
9
- if ($_GET['show_yoast_widget'] == "true") {
10
- update_option( 'show_yoast_widget', 'noshow' );
11
- } else {
12
- update_option( 'show_yoast_widget', 'show' );
13
- }
14
- }
15
-
16
- // Add the widget to the dashboard
17
- add_action( 'wp_dashboard_setup', array(&$this, 'register_widget') );
18
- add_filter( 'wp_dashboard_widgets', array(&$this, 'add_widget') );
19
- }
20
-
21
- // Register this widget -- we use a hook/function to make the widget a dashboard-only widget
22
- function register_widget() {
23
- wp_register_sidebar_widget( 'yoast_posts', __( 'Yoast - Tweaking Websites', 'yoast-posts' ), array(&$this, 'widget'), array( 'all_link' => 'http://yoast.com/', 'feed_link' => 'http://yoast.com/feed/', 'edit_link' => 'options.php' ) );
24
- }
25
-
26
- // Modifies the array of dashboard widgets and adds this plugin's
27
- function add_widget( $widgets ) {
28
- global $wp_registered_widgets;
29
- if ( !isset($wp_registered_widgets['yoast_posts']) ) return $widgets;
30
- array_splice( $widgets, 2, 0, 'yoast_posts' );
31
- return $widgets;
32
- }
33
-
34
- function widget($args = array()) {
35
- $show = get_option('show_yoast_widget');
36
- if ($show != 'noshow') {
37
- if (is_array($args))
38
- extract( $args, EXTR_SKIP );
39
- echo $before_widget.$before_title.$widget_name.$after_title;
40
- echo '<a href="http://yoast.com/"><img style="margin: 0 0 5px 5px;" src="http://yoast.com/images/yoast-logo-rss.png" align="right" alt="Yoast"/></a>';
41
- include_once(ABSPATH . WPINC . '/rss.php');
42
- $rss = fetch_rss('http://feeds2.feedburner.com/joostdevalk');
43
- if ($rss) {
44
- $items = array_slice($rss->items, 0, 2);
45
- if (empty($items))
46
- echo '<li>No items</li>';
47
- else {
48
- foreach ( $items as $item ) { ?>
49
- <a style="font-size: 14px; font-weight:bold;" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a><br/>
50
- <p style="font-size: 10px; color: #aaa;"><?php echo date('j F Y',strtotime($item['pubdate'])); ?></p>
51
- <p><?php echo substr($item['summary'],0,strpos($item['summary'], "This is a post from")); ?></p>
52
- <?php }
53
- }
54
- }
55
- echo $after_widget;
56
- }
57
- }
58
- }
59
-
60
- // Start this plugin once all other plugins are fully loaded
61
- add_action( 'plugins_loaded', create_function( '', 'global $YoastPosts; $YoastPosts = new YoastPosts();' ) );
62
- }
63
- ?>