PowerPress Podcasting plugin by Blubrry - Version 0.3.0

Version Description

Download this release

Release Info

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

Code changes from version 0.2.1 to 0.3.0

Files changed (3) hide show
  1. powerpress.php +62 -27
  2. powerpressadmin.php +10 -0
  3. readme.txt +4 -1
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.2.1
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
 
10
  2008-09-17 - v0.2.1: Fixed itunes:subtitle bug, itunes:summary is now enabled by default, add ending trailing slash to media url if missing, and copy blubrry keyword from podpress fix.
11
  2008-08-05 - v0.2.0: First beta release of Blubrry Powerpress plugin.
12
  2008-08-05 - v0.1.2: Fixed minor bugs, trimming empty hour values in duration.
@@ -32,7 +33,7 @@ License: Apache License version 2.0 (http://www.apache.org/licenses/)
32
  is interpreted as GPL version 3.0 for compatibility with Apache 2.0 license.
33
  */
34
 
35
- define('POWERPRESS_VERSION', '0.2.1' );
36
  //define('POWERPRESS_ITEM_SUMMARY', true); // Uncomment to include itunes:summary within feed items.
37
  // Please place define above in your wp-config.php.
38
 
@@ -94,9 +95,9 @@ function powerpress_content($content)
94
  if( $Powerpress['display_player'] == 0 )
95
  return $content;
96
 
97
- // Create the redirect URL
98
- $EnclosureURL = 'http://' .str_replace('http://', '', $Powerpress['redirect1'] . $Powerpress['redirect2'] . $Powerpress['redirect3'] . $EnclosureURL );
99
-
100
  // Build links for player
101
  $player_links = '';
102
  switch( $Powerpress['player_function'] )
@@ -440,7 +441,9 @@ function powerpress_rss2_item()
440
  }
441
 
442
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
443
- $content_no_html = strip_shortcodes( $post->post_content );
 
 
444
  $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
445
  $content_no_html = strip_tags($content_no_html);
446
 
@@ -467,10 +470,19 @@ add_action('rss2_item', 'powerpress_rss2_item');
467
 
468
  function powerpress_filter_rss_enclosure($content)
469
  {
470
- // Add the redirect url if there is one...
471
- $RedirectURL = powerpress_get_redirect_url();
472
- if( $RedirectURL )
473
- $content = str_replace('http://', $RedirectURL, $content);
 
 
 
 
 
 
 
 
 
474
  return $content;
475
  }
476
 
@@ -491,21 +503,30 @@ function powerpress_init()
491
  add_action('init', 'powerpress_init');
492
 
493
 
494
- function powerpress_posts_join($join) {
495
- if ( is_feed() && get_query_var('feed') == 'podcast' ) {
496
- global $wpdb;
497
- // Future feature: only display posts that have enclosures...
498
- // $query->set('cat','-20,-21,-22');
499
- //$join .= " LEFT JOIN {$wpdb->postmeta} ";
500
- //$join .= " ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = 'enclosure' ";
501
- // $wpdb->postmeta
502
- }
503
- return $join;
504
  }
505
 
506
  add_filter('posts_join', 'powerpress_posts_join' );
507
 
508
- //add_filter('pre_get_posts','my_cat_exclude');
 
 
 
 
 
 
 
 
 
 
509
 
510
  /*
511
  Helper functions:
@@ -648,15 +669,29 @@ function powerpress_smart_trim($value, $char_limit = 250, $remove_new_lines = fa
648
  return $return;
649
  }
650
 
651
- function powerpress_get_redirect_url()
652
  {
653
- global $powerpress_redirect_url;
654
- if( !isset($powerpress_redirect_url) )
 
 
 
 
 
 
 
 
655
  {
656
- $Powerpress = get_option('powerpress_general');
657
- $powerpress_redirect_url = 'http://' .str_replace('http://', '', $Powerpress['redirect1'] . $Powerpress['redirect2'] . $Powerpress['redirect3'] );
 
 
 
 
 
658
  }
659
- return $powerpress_redirect_url;
 
660
  }
661
  /*
662
  End Helper Functions
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.3.0
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
10
+ 2008-09-24 - v0.3.0: Added important feeds list in feed settings, logic to prevent stats redirect duplication and added podcast only feed.
11
  2008-09-17 - v0.2.1: Fixed itunes:subtitle bug, itunes:summary is now enabled by default, add ending trailing slash to media url if missing, and copy blubrry keyword from podpress fix.
12
  2008-08-05 - v0.2.0: First beta release of Blubrry Powerpress plugin.
13
  2008-08-05 - v0.1.2: Fixed minor bugs, trimming empty hour values in duration.
33
  is interpreted as GPL version 3.0 for compatibility with Apache 2.0 license.
34
  */
35
 
36
+ define('POWERPRESS_VERSION', '0.3' );
37
  //define('POWERPRESS_ITEM_SUMMARY', true); // Uncomment to include itunes:summary within feed items.
38
  // Please place define above in your wp-config.php.
39
 
95
  if( $Powerpress['display_player'] == 0 )
96
  return $content;
97
 
98
+ // Add redirects to Media URL
99
+ $EnclosureURL = powerpress_add_redirect_url($EnclosureURL, $Powerpress);
100
+
101
  // Build links for player
102
  $player_links = '';
103
  switch( $Powerpress['player_function'] )
441
  }
442
 
443
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
444
+ $content_no_html = $post->post_content;
445
+ if( function_exists('strip_shortcodes') )
446
+ $content_no_html = strip_shortcodes( $content_no_html );
447
  $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
448
  $content_no_html = strip_tags($content_no_html);
449
 
470
 
471
  function powerpress_filter_rss_enclosure($content)
472
  {
473
+ $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches);
474
+ if( count($matches) != 2)
475
+ return $content;
476
+
477
+ // Original Media URL
478
+ $OrigURL = $matches[1];
479
+
480
+ // Modified Media URL
481
+ $ModifiedURL = powerpress_add_redirect_url($OrigURL);
482
+
483
+ // Replace the original url with the modified one...
484
+ if( $OrigURL != $ModifiedURL )
485
+ return str_replace($OrigURL, $ModifiedURL, $content);
486
  return $content;
487
  }
488
 
503
  add_action('init', 'powerpress_init');
504
 
505
 
506
+ function powerpress_posts_join($join)
507
+ {
508
+ if( is_feed() && get_query_var('feed') == 'podcast' )
509
+ {
510
+ global $wpdb;
511
+ $join .= " INNER JOIN {$wpdb->postmeta} ";
512
+ $join .= " ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id ";
513
+ }
514
+ return $join;
 
515
  }
516
 
517
  add_filter('posts_join', 'powerpress_posts_join' );
518
 
519
+ function powerpress_posts_where($where)
520
+ {
521
+ if( is_feed() && get_query_var('feed') == 'podcast' )
522
+ {
523
+ global $wpdb;
524
+ $where .= " AND {$wpdb->postmeta}.meta_key = 'enclosure' ";
525
+ }
526
+ return $where;
527
+ }
528
+
529
+ add_filter('posts_where', 'powerpress_posts_where' );
530
 
531
  /*
532
  Helper functions:
669
  return $return;
670
  }
671
 
672
+ function powerpress_add_redirect_url($MediaURL, $GeneralSettings = false)
673
  {
674
+ $NewURL = $MediaURL;
675
+ if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
676
+ {
677
+ global $powerpress_general_settings;
678
+ if( !$powerpress_general_settings )
679
+ $powerpress_general_settings = get_option('powerpress_general');
680
+ $GeneralSettings = $powerpress_general_settings;
681
+ }
682
+
683
+ for( $x = 3; $x > 0; $x-- )
684
  {
685
+ $key = sprintf('redirect%d', $x);
686
+ if( $GeneralSettings[ $key ] )
687
+ {
688
+ $RedirectClean = str_replace('http://', '', $GeneralSettings[ $key ]);
689
+ if( !strstr($NewURL, $RedirectClean) )
690
+ $NewURL = 'http://'. $RedirectClean . str_replace('http://', '', $NewURL);
691
+ }
692
  }
693
+
694
+ return $NewURL;
695
  }
696
  /*
697
  End Helper Functions
powerpressadmin.php CHANGED
@@ -749,6 +749,16 @@ while( list($value,$desc) = each($applyoptions) )
749
  <tr valign="top">
750
  <th scope="row">
751
 
 
 
 
 
 
 
 
 
 
 
752
  <?php _e("iTunes Summary"); ?></th>
753
  <td>
754
  <p>Your summary may not contain HTML and cannot exceed 4,000 characters in length.</p>
749
  <tr valign="top">
750
  <th scope="row">
751
 
752
+ <?php _e("Important Feeds"); ?></th>
753
+ <td>
754
+ <p>Main RSS2 Feed: <a href="<?php echo get_bloginfo('rss2_url'); ?>" title="Main RSS 2 Feed" target="_blank"><?php echo get_bloginfo('rss2_url'); ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_bloginfo('rss2_url')); ?>" title="Validate Feed" target="_blank">validate</a></p>
755
+ <p>Special Podcast only Feed: <a href="<?php echo get_feed_link('podcast'); ?>" title="Podcast Feed" target="_blank"><?php echo get_feed_link('podcast'); ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_feed_link('podcast')); ?>" title="Validate Feed" target="_blank">validate</a></p>
756
+ </td>
757
+ </tr>
758
+
759
+ <tr valign="top">
760
+ <th scope="row">
761
+
762
  <?php _e("iTunes Summary"); ?></th>
763
  <td>
764
  <p>Your summary may not contain HTML and cannot exceed 4,000 characters in length.</p>
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.6.2
6
- Stable tag: 0.2.1
7
 
8
  Add podcasting support to your blog.
9
 
@@ -56,5 +56,8 @@ Initial release of Blubrry Powerpress
56
  0.2.1 released on 09/17/2008
57
  Fixed bugs: itunes:subtitle bug, itunes:summary is now enabled by default, add ending trailing slash to media url if missing, and copy blubrry keyword from podpress fix.
58
 
 
 
 
59
  == Feedback ==
60
  http://www.blubrry.com/powerpress/
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.6.2
6
+ Stable tag: 0.3.0
7
 
8
  Add podcasting support to your blog.
9
 
56
  0.2.1 released on 09/17/2008
57
  Fixed bugs: itunes:subtitle bug, itunes:summary is now enabled by default, add ending trailing slash to media url if missing, and copy blubrry keyword from podpress fix.
58
 
59
+ 0.3.0 released on 09/24/2008
60
+ New features: Added important feeds list in feed settings, logic to prevent stats redirect duplication and added podcast only feed.
61
+
62
  == Feedback ==
63
  http://www.blubrry.com/powerpress/