PowerPress Podcasting plugin by Blubrry - Version 0.6.2

Version Description

Download this release

Release Info

Developer amandato
Plugin Icon 128x128 PowerPress Podcasting plugin by Blubrry
Version 0.6.2
Comparing to
See all releases

Code changes from version 0.6.1 to 0.6.2

Files changed (4) hide show
  1. license.txt +3 -0
  2. powerpress.php +53 -6
  3. powerpressadmin.php +4 -1
  4. readme.txt +9 -4
license.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE, Version 2, June 1991
2
+
3
+ Please refer to the license.txt found in the root folder of your Wordpress installation for more details.
powerpress.php CHANGED
@@ -3,10 +3,11 @@
3
  Plugin Name: Blubrry Powerpress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry Powerpress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics and iTunes integration.
6
- Version: 0.6.1
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
 
10
  2009-01-20 - v0.6.1: Player now handles Windows Media (wmv) in Firefox, offering link to preferred Firefox plugin, now using the wp_specialchars() function for adding entities to feed values, fix problem with themes using excerpts not displaying the player correctly (Thanks @wayofthegeek for your help), and a number of other syntactical changes.
11
  2008-12-17 - v0.6.0: Fixed bug with podcast feed in Wordpress 2.7, added defaults for file size and duration and added iTunes New Feed URL option.
12
  2008-12-14 - v0.5.2: Fixed bug with the feed channel itunes:summary being limited to 255 characters, the limit is now set to 4,000.
@@ -38,13 +39,12 @@ Credits:
38
 
39
  Copyright 2008-2009 RawVoice Inc. (http://www.rawvoice.com)
40
 
41
- License: Apache License version 2.0 (http://www.apache.org/licenses/)
42
 
43
- This project uses source that is GPL licensed that, for the sake of this plugin,
44
- is interpreted as GPL version 3.0 for compatibility with Apache 2.0 license.
45
  */
46
 
47
- define('POWERPRESS_VERSION', '0.6.1' );
48
 
49
  // Display Powerpress player only for previously created Podpress episodes.
50
  // define('POWERPRESS_USE_PLAYER_FOR_PODPRESS_EPISODES', true);
@@ -571,6 +571,14 @@ function powerpress_filter_rss_enclosure($content)
571
  // Original Media URL
572
  $OrigURL = $matches[1];
573
 
 
 
 
 
 
 
 
 
574
  // Modified Media URL
575
  $ModifiedURL = powerpress_add_redirect_url($OrigURL);
576
 
@@ -589,6 +597,24 @@ function powerpress_do_podcast_feed()
589
  load_template(ABSPATH . WPINC. '/feed-rss2.php');
590
  }
591
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  function powerpress_init()
593
  {
594
  add_feed('podcast', 'powerpress_do_podcast_feed');
@@ -623,8 +649,9 @@ function powerpress_posts_where($where)
623
 
624
  // Include Podpress data if exists...
625
  if( $Powerpress['process_podpress'] )
 
626
  $where .= " OR {$wpdb->postmeta}.meta_key = 'podPressMedia' ";
627
-
628
  $where .=") ";
629
  }
630
  return $where;
@@ -632,6 +659,19 @@ function powerpress_posts_where($where)
632
 
633
  add_filter('posts_where', 'powerpress_posts_where' );
634
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
  /*
636
  Helper functions:
637
  */
@@ -747,6 +787,10 @@ function powerpress_get_root_url()
747
 
748
  function powerpress_format_itunes_value($value, $char_limit = 255, $specialchars = true)
749
  {
 
 
 
 
750
  if( strlen($value) > $char_limit )
751
  return wp_specialchars(substr($value, 0, $char_limit));
752
  return wp_specialchars($value);
@@ -783,6 +827,9 @@ function powerpress_smart_trim($value, $char_limit = 250, $remove_new_lines = fa
783
 
784
  function powerpress_add_redirect_url($MediaURL, $GeneralSettings = false)
785
  {
 
 
 
786
  $NewURL = $MediaURL;
787
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
788
  {
3
  Plugin Name: Blubrry Powerpress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry Powerpress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics and iTunes integration.
6
+ Version: 0.6.2
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
10
+ 2009-01-26 - v0.6.2: Added option to reset rewrite rules when settings saved to fix problem with podcast feed returning 404, logic added to prevent FeedSmith plugin from redirecting podcast feed, and added support for the Kimili Flash Embed plugin
11
  2009-01-20 - v0.6.1: Player now handles Windows Media (wmv) in Firefox, offering link to preferred Firefox plugin, now using the wp_specialchars() function for adding entities to feed values, fix problem with themes using excerpts not displaying the player correctly (Thanks @wayofthegeek for your help), and a number of other syntactical changes.
12
  2008-12-17 - v0.6.0: Fixed bug with podcast feed in Wordpress 2.7, added defaults for file size and duration and added iTunes New Feed URL option.
13
  2008-12-14 - v0.5.2: Fixed bug with the feed channel itunes:summary being limited to 255 characters, the limit is now set to 4,000.
39
 
40
  Copyright 2008-2009 RawVoice Inc. (http://www.rawvoice.com)
41
 
42
+ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
43
 
44
+ This project uses source that is GPL licensed.
 
45
  */
46
 
47
+ define('POWERPRESS_VERSION', '0.6.2' );
48
 
49
  // Display Powerpress player only for previously created Podpress episodes.
50
  // define('POWERPRESS_USE_PLAYER_FOR_PODPRESS_EPISODES', true);
571
  // Original Media URL
572
  $OrigURL = $matches[1];
573
 
574
+ if( substr($OrigURL, 0, 5) != 'http:' && substr($OrigURL, 0, 6) != 'https:' )
575
+ return; // The URL value is invalid
576
+
577
+ global $post, $powerpress_rss_enclosure_post_id;
578
+ if( @$powerpress_rss_enclosure_post_id == $post->ID )
579
+ return; // we've already included one enclosure, lets not allow anymore
580
+ $powerpress_rss_enclosure_post_id = $post->ID;
581
+
582
  // Modified Media URL
583
  $ModifiedURL = powerpress_add_redirect_url($OrigURL);
584
 
597
  load_template(ABSPATH . WPINC. '/feed-rss2.php');
598
  }
599
 
600
+ function powerpress_template_redirect()
601
+ {
602
+ if( is_feed() && 'podcast' == get_query_var('feed') )
603
+ {
604
+ remove_action('template_redirect', 'ol_feed_redirect'); // Remove this action
605
+ $Feed = get_option('powerpress_feed');
606
+ if( trim(@$Feed['feed_redirect_url']) != '' && !preg_match("/feedburner|feedsqueezer|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'] ) )
607
+ {
608
+ if (function_exists('status_header')) status_header( 302 );
609
+ header("Location: " . trim($Feed['feed_redirect_url']));
610
+ header("HTTP/1.1 302 Temporary Redirect");
611
+ exit();
612
+ }
613
+ }
614
+ }
615
+
616
+ add_action('template_redirect', 'powerpress_template_redirect', 0);
617
+
618
  function powerpress_init()
619
  {
620
  add_feed('podcast', 'powerpress_do_podcast_feed');
649
 
650
  // Include Podpress data if exists...
651
  if( $Powerpress['process_podpress'] )
652
+ {
653
  $where .= " OR {$wpdb->postmeta}.meta_key = 'podPressMedia' ";
654
+ }
655
  $where .=") ";
656
  }
657
  return $where;
659
 
660
  add_filter('posts_where', 'powerpress_posts_where' );
661
 
662
+ // Add the groupby needed for enclosures only
663
+ function powerpress_posts_groupby($groupby)
664
+ {
665
+ if( is_feed() && get_query_var('feed') == 'podcast' )
666
+ {
667
+ global $wpdb;
668
+ $groupby = " {$wpdb->posts}.ID ";
669
+ }
670
+ return $groupby;
671
+ }
672
+
673
+ add_filter('posts_groupby', 'powerpress_posts_groupby');
674
+
675
  /*
676
  Helper functions:
677
  */
787
 
788
  function powerpress_format_itunes_value($value, $char_limit = 255, $specialchars = true)
789
  {
790
+ // Code added to solve issue with KimiliFlashEmbed plugin
791
+ // 99.9% of the time this code will not be necessary
792
+ $value = preg_replace("/\[(kml_(flash|swf)embed)\b(.*?)(?:(\/))?\]/s", '', $value);
793
+
794
  if( strlen($value) > $char_limit )
795
  return wp_specialchars(substr($value, 0, $char_limit));
796
  return wp_specialchars($value);
827
 
828
  function powerpress_add_redirect_url($MediaURL, $GeneralSettings = false)
829
  {
830
+ if( preg_match('/^http\:/i', $MediaURL) === false )
831
+ return $MediaURL; // If the user is hosting media not via http (e.g. https or ftp) then we can't handle the redirect
832
+
833
  $NewURL = $MediaURL;
834
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
835
  {
powerpressadmin.php CHANGED
@@ -354,7 +354,7 @@ add_action('admin_head', 'powerpress_admin_head');
354
 
355
  function powerpress_admin_page()
356
  {
357
- global $wp_version;
358
 
359
  if( isset($_POST['CheckSWF']) )
360
  {
@@ -453,6 +453,9 @@ function powerpress_admin_page()
453
  // Update the settings in the database:
454
  update_option( 'powerpress_general', $General);
455
  update_option( 'powerpress_feed', $Feed );
 
 
 
456
 
457
  ?>
458
  <div class="updated powerpress-notice"><?php _e('Blubrry Powerpress settings saved.'); ?></div>
354
 
355
  function powerpress_admin_page()
356
  {
357
+ global $wp_version, $wp_rewrite;
358
 
359
  if( isset($_POST['CheckSWF']) )
360
  {
453
  // Update the settings in the database:
454
  update_option( 'powerpress_general', $General);
455
  update_option( 'powerpress_feed', $Feed );
456
+
457
+ // Anytime settings are saved lets flush the rewrite rules
458
+ $wp_rewrite->flush_rules();
459
 
460
  ?>
461
  <div class="updated powerpress-notice"><?php _e('Blubrry Powerpress settings saved.'); ?></div>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Angelo Mandato, Blubrry.com
3
  Tags: podcast, podcasting, itunes, enclosure, zune, iphone, audio, video, rss2, feed, player, media, rss
4
  Requires at least: 2.5.0
5
  Tested up to: 2.7
6
- Stable tag: 0.6.1
7
 
8
  Add podcasting support to your blog.
9
 
@@ -93,11 +93,16 @@ Fixed bug with podcast feed in Wordpress 2.7, added defaults for file size and d
93
  0.6.1 released on 01/20/2009
94
  Player now handles Windows Media (wmv) in Firefox, offering link to preferred Firefox plugin, now using the wp_specialchars() function for adding entities to feed values, fix problem with themes using excerpts not displaying the player correctly (Thanks @wayofthegeek for your help), and a number of other syntactical changes.
95
 
 
 
 
96
 
97
  == Contributors ==
98
- Angelo Mandato, CIO RawVoice - Plugin founder, architect and lead developer
99
- Pat McSweeny, Developer for RawVoice - Developed initial version (v0.1.0) of plugin
100
- Jerry Stephens, Way of the Geek (http://wayofthegeek.org/) - Contributed initial code fix for excerpt bug resolved in v0.6.1
 
 
101
 
102
 
103
  == Feedback ==
3
  Tags: podcast, podcasting, itunes, enclosure, zune, iphone, audio, video, rss2, feed, player, media, rss
4
  Requires at least: 2.5.0
5
  Tested up to: 2.7
6
+ Stable tag: 0.6.2
7
 
8
  Add podcasting support to your blog.
9
 
93
  0.6.1 released on 01/20/2009
94
  Player now handles Windows Media (wmv) in Firefox, offering link to preferred Firefox plugin, now using the wp_specialchars() function for adding entities to feed values, fix problem with themes using excerpts not displaying the player correctly (Thanks @wayofthegeek for your help), and a number of other syntactical changes.
95
 
96
+ 0.6.2 released on 01/26/2009
97
+ Added option to reset rewrite rules when settings saved to fix problem with podcast feed returning 404, logic added to prevent FeedSmith plugin from redirecting podcast feed, and added support for the Kimili Flash Embed plugin
98
+
99
 
100
  == Contributors ==
101
+ Angelo Mandato, CIO [RawVoice](http://www.rawvoice.com) - Plugin founder, architect and lead developer
102
+
103
+ Pat McSweeny, Developer for [RawVoice](http://www.rawvoice.com) - Developed initial version (v0.1.0) of plugin
104
+
105
+ Jerry Stephens, Way of the Geek [wayofthegeek.org](http://wayofthegeek.org) - Contributed initial code fix for excerpt bug resolved in v0.6.1
106
 
107
 
108
  == Feedback ==