PowerPress Podcasting plugin by Blubrry - Version 0.6.3

Version Description

Download this release

Release Info

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

Code changes from version 0.6.2 to 0.6.3

Files changed (5) hide show
  1. powerpress.php +102 -27
  2. powerpressadmin.php +19 -2
  3. readme.txt +4 -2
  4. screenshot-1.jpg +0 -0
  5. screenshot-3.jpg +0 -0
powerpress.php CHANGED
@@ -3,27 +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.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.
14
- 2008-12-10 - v0.5.1: Added podcast to pages option (Thanks @Frumph), added code to make sure the itunes:subtitle, keywords and summary feed tags never exceed their size limits.
15
- 2008-11-26 - v0.5.0: Added options to report media duration and file size next to download links, new Media URL check performed when adding episode to new post and fixed a number of bugs including the player auto play bug caused by version v0.4.2.
16
- 2008-10-24 - v0.4.2: Fixed quicktime in-page player bug, fixed bug which caused itunes keywords and subtitle to be blank and incremented version number.
17
- 2008-10-24 - v0.4.1: Fixed auto-play bug found in last update, only affected quicktime files with the play on page option.
18
- 2008-10-21 - v0.4.0: Added two new play options adding 'play on page' links with and without play in new window links and now use a customizable play image for quicktime media.
19
- 2008-10-05 - v0.3.2: Added alternative logic for those who host their blogs on servers with allow_url_fopen turned off.
20
- 2008-10-02 - v0.3.1: iTunes subtitle, keywords and summary values now properly escape html special characters such as &nbsp; added define for adding itunes:new-feed-url tag, added define to display player for legacy Podpress episodes only.
21
- 2008-09-24 - v0.3.0: Added important feeds list in feed settings, logic to prevent stats redirect duplication and added podcast only feed.
22
- 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.
23
- 2008-08-05 - v0.2.0: First beta release of Blubrry Powerpress plugin.
24
- 2008-08-05 - v0.1.2: Fixed minor bugs, trimming empty hour values in duration.
25
- 2008-08-04 - v0.1.1: Fixed minor bugs, PHP_EOL define, check if function exists for older versions of wordpress and more.
26
- 2008-08-04 - v0.1.0: Tentative initial release of Blubrry Powerpress plugin.
27
 
28
  Contributors:
29
  Angelo Mandato, CIO RawVoice - Plugin founder, architect and lead developer
@@ -44,13 +28,24 @@ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
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);
51
 
52
  // Display custom play image for quicktime media. Applies to on page player only.
53
- // define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
54
 
55
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
56
  if( !defined('POWERPRESS_LINK_SEPARATOR') )
@@ -67,6 +62,9 @@ function powerpress_content($content)
67
  if( is_feed() )
68
  return $content; // We don't want to do anything to the feed
69
 
 
 
 
70
  // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
71
  // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
72
  global $g_powerpress_excerpt_post_id;
@@ -83,6 +81,11 @@ function powerpress_content($content)
83
  // Powerpress settings:
84
  $Powerpress = get_option('powerpress_general');
85
 
 
 
 
 
 
86
  // Get the enclosure data
87
  $enclosureData = get_post_meta($post->ID, 'enclosure', true);
88
 
@@ -95,9 +98,19 @@ function powerpress_content($content)
95
  $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
96
  if( $podPressMedia )
97
  {
98
- $EnclosureURL = $podPressMedia[0]['URI'];
99
- $EnclosureSize = $podPressMedia[0]['size'];
100
- $EnclosureType = '';
 
 
 
 
 
 
 
 
 
 
101
  }
102
  if( !$EnclosureURL )
103
  return $content;
@@ -185,9 +198,17 @@ function powerpress_content($content)
185
  if( $Powerpress['player_function'] == 1 || $Powerpress['player_function'] == 2 ) // We have some kind of on-line player
186
  {
187
  $new_content .= '<div class="powerpress_player" id="powerpress_player_'. $post->ID .'"></div>'.PHP_EOL;
188
- $new_content .= '<script type="text/javascript">'.PHP_EOL;
189
- $new_content .= "powerpress_play_page('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
190
- $new_content .= '</script>'.PHP_EOL;
 
 
 
 
 
 
 
 
191
  }
192
  else if( $Powerpress['player_function'] == 4 || $Powerpress['player_function'] == 5 )
193
  {
@@ -478,6 +499,10 @@ function powerpress_rss2_item()
478
  {
479
  global $powerpress_feed, $powerpress_itunes_explicit, $powerpress_itunes_talent_name, $powerpress_default_url, $powerpress_process_podpress, $post;
480
  $duration = false;
 
 
 
 
481
  // are we processing a feed that powerpress should handle
482
  if( $powerpress_feed == false )
483
  return;
@@ -491,6 +516,13 @@ function powerpress_rss2_item()
491
  {
492
  //$Settings = get_option('powerpress_general');
493
  $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
 
 
 
 
 
 
 
494
  if( $podPressMedia )
495
  {
496
  $EnclosureURL = $podPressMedia[0]['URI'];
@@ -672,6 +704,36 @@ function powerpress_posts_groupby($groupby)
672
 
673
  add_filter('posts_groupby', 'powerpress_posts_groupby');
674
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  /*
676
  Helper functions:
677
  */
@@ -879,6 +941,19 @@ function powerpress_byte_size($ppbytes)
879
  }
880
  return $ppsize;
881
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
882
  /*
883
  End Helper Functions
884
  */
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.3
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
10
+ Please see readme.txt for detailed change log.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  Contributors:
13
  Angelo Mandato, CIO RawVoice - Plugin founder, architect and lead developer
28
  This project uses source that is GPL licensed.
29
  */
30
 
31
+ define('POWERPRESS_VERSION', '0.6.3' );
32
+
33
+ /////////////////////////////////////////////////////
34
+ // The following define options should be placed in your
35
+ // wp-config.php file so the setting is not disrupted when
36
+ // you upgrade the plugin.
37
+ /////////////////////////////////////////////////////
38
+
39
+ // Load players in the footer of the page, improves page load times but requires wp_footer() function to be included in WP Theme.
40
+ //define('POWERPRESS_USE_FOOTER', true);
41
+ // You can also define the delay.
42
+ //define('POWERPRESS_USE_FOOTER_DELAY', 500); // Milliseconds delay should occur, e.g. 500 is 1/2 of a second, 2000 is 2 seconds.
43
 
44
  // Display Powerpress player only for previously created Podpress episodes.
45
+ //define('POWERPRESS_USE_PLAYER_FOR_PODPRESS_EPISODES', true);
46
 
47
  // Display custom play image for quicktime media. Applies to on page player only.
48
+ //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
49
 
50
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
51
  if( !defined('POWERPRESS_LINK_SEPARATOR') )
62
  if( is_feed() )
63
  return $content; // We don't want to do anything to the feed
64
 
65
+ if( post_password_required($post) )
66
+ return $content;
67
+
68
  // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
69
  // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
70
  global $g_powerpress_excerpt_post_id;
81
  // Powerpress settings:
82
  $Powerpress = get_option('powerpress_general');
83
 
84
+ if( current_filter() == 'the_excerpt' && !$Powerpress['display_player_excerpt'] )
85
+ {
86
+ return $content; // We didn't want to modify this since the user didn't enable it for excerpts
87
+ }
88
+
89
  // Get the enclosure data
90
  $enclosureData = get_post_meta($post->ID, 'enclosure', true);
91
 
98
  $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
99
  if( $podPressMedia )
100
  {
101
+ if( !is_array($podPressMedia) )
102
+ {
103
+ // Sometimes the stored data gets messed up, we can fix it here:
104
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
105
+ $podPressMedia = @unserialize($podPressMedia);
106
+ }
107
+
108
+ if( is_array($podPressMedia) )
109
+ {
110
+ $EnclosureURL = $podPressMedia[0]['URI'];
111
+ $EnclosureSize = $podPressMedia[0]['size'];
112
+ $EnclosureType = '';
113
+ }
114
  }
115
  if( !$EnclosureURL )
116
  return $content;
198
  if( $Powerpress['player_function'] == 1 || $Powerpress['player_function'] == 2 ) // We have some kind of on-line player
199
  {
200
  $new_content .= '<div class="powerpress_player" id="powerpress_player_'. $post->ID .'"></div>'.PHP_EOL;
201
+ if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
202
+ {
203
+ global $g_powerpress_footer;
204
+ $g_powerpress_footer['player_js'] .= "powerpress_play_page('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
205
+ }
206
+ else
207
+ {
208
+ $new_content .= '<script type="text/javascript">'.PHP_EOL;
209
+ $new_content .= "powerpress_play_page('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
210
+ $new_content .= '</script>'.PHP_EOL;
211
+ }
212
  }
213
  else if( $Powerpress['player_function'] == 4 || $Powerpress['player_function'] == 5 )
214
  {
499
  {
500
  global $powerpress_feed, $powerpress_itunes_explicit, $powerpress_itunes_talent_name, $powerpress_default_url, $powerpress_process_podpress, $post;
501
  $duration = false;
502
+
503
+ if( post_password_required($post) )
504
+ return $content;
505
+
506
  // are we processing a feed that powerpress should handle
507
  if( $powerpress_feed == false )
508
  return;
516
  {
517
  //$Settings = get_option('powerpress_general');
518
  $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
519
+ if( !is_array($podPressMedia) )
520
+ {
521
+ // Sometimes the stored data gets messed up, we can fix it here:
522
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
523
+ $podPressMedia = @unserialize($podPressMedia);
524
+ }
525
+
526
  if( $podPressMedia )
527
  {
528
  $EnclosureURL = $podPressMedia[0]['URI'];
704
 
705
  add_filter('posts_groupby', 'powerpress_posts_groupby');
706
 
707
+
708
+ function powerpress_wp_footer()
709
+ {
710
+ global $g_powerpress_footer;
711
+
712
+ if( is_array($g_powerpress_footer) )
713
+ {
714
+ if( isset($g_powerpress_footer['player_js']) )
715
+ {
716
+ echo '<script type="text/javascript">'.PHP_EOL;
717
+ if( defined('POWERPRESS_USE_FOOTER_DELAY') && POWERPRESS_USE_FOOTER_DELAY && is_numeric(POWERPRESS_USE_FOOTER_DELAY) )
718
+ {
719
+ echo 'function powerpress_onload() {'.PHP_EOL;
720
+ echo $g_powerpress_footer['player_js'];
721
+ echo '}'.PHP_EOL;
722
+ echo "setTimeout('powerpress_onload()', ".POWERPRESS_USE_FOOTER_DELAY.");\n";
723
+ }
724
+ else
725
+ {
726
+ echo $g_powerpress_footer['player_js'];
727
+ }
728
+ echo '</script>'.PHP_EOL;
729
+ }
730
+ }
731
+ }
732
+
733
+ if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
734
+ add_action('wp_footer', 'powerpress_wp_footer');
735
+
736
+
737
  /*
738
  Helper functions:
739
  */
941
  }
942
  return $ppsize;
943
  }
944
+
945
+ // For grabbing data from Podpress data stored serialized, the strings for some values can sometimes get corrupted, so we fix it...
946
+ function powerpress_repair_serialize($string)
947
+ {
948
+ if( @unserialize($string) )
949
+ return $string; // Nothing to repair...
950
+ return preg_replace_callback('/(s:(\d+):"([^"]*)")/',
951
+ create_function(
952
+ '$matches',
953
+ 'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s"\', strlen($matches[3]), $matches[3]);'
954
+ ),
955
+ $string);
956
+ }
957
  /*
958
  End Helper Functions
959
  */
powerpressadmin.php CHANGED
@@ -745,9 +745,10 @@ $displayoptions = array(1=>"Below Post", 2=>"Above Post", 0=>"None");
745
 
746
  while( list($value,$desc) = each($displayoptions) )
747
  echo "\t<option value=\"$value\"". ($General['display_player']==$value?' selected':''). ">$desc</option>\n";
748
-
749
  ?>
750
  </select>
 
751
  </td>
752
  </tr>
753
 
@@ -766,7 +767,15 @@ while( list($value,$desc) = each($playeroptions) )
766
  <p style="margin-top: 0;">
767
  Note: "On Page Link" is a link to "play on page", the player is not displayed until link is clicked.
768
  </p>
 
 
 
 
 
769
  <p><input name="CheckSWF" type="checkbox" value="1" /> Verify flash player</p>
 
 
 
770
  </td>
771
  </tr>
772
 
@@ -898,7 +907,7 @@ while( list($value,$desc) = each($applyoptions) )
898
  <input type="text" name="Feed[itunes_new_feed_url_podcast]"style="width: 55%;" value="<?php echo $FeedSettings['itunes_new_feed_url_podcast']; ?>" maxlength="250" />
899
  </p>
900
  <p style="margin-left: 25%;margin-top: 0;font-size: 90%;">(Leave blank for no New Feed URL)</p>
901
- <p>More information regarding the iTunes New Feed URL is available at <a href="http://www.apple.com/itunes/whatson/podcasts/specs.html#changing" target="_blank">Apple.com</a></p>
902
  </div>
903
  </td>
904
  </tr>
@@ -1093,6 +1102,14 @@ while( list($value,$desc) = each($explicit) )
1093
  <?php
1094
  }
1095
 
 
 
 
 
 
 
 
 
1096
  /*
1097
  // Helper functions:
1098
  */
745
 
746
  while( list($value,$desc) = each($displayoptions) )
747
  echo "\t<option value=\"$value\"". ($General['display_player']==$value?' selected':''). ">$desc</option>\n";
748
+
749
  ?>
750
  </select>
751
+ <p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php if($General['display_player_excerpt']) echo 'checked '; ?>/> Display player in <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="Explanation of an excerpt in Wordpress" target="_blank">excerpts</a> (e.g. search results)</p>
752
  </td>
753
  </tr>
754
 
767
  <p style="margin-top: 0;">
768
  Note: "On Page Link" is a link to "play on page", the player is not displayed until link is clicked.
769
  </p>
770
+ <?php
771
+ global $wp_version;
772
+ if( version_compare($wp_version, '2.7') < 0 ) // Wordpress before version 2.7
773
+ {
774
+ ?>
775
  <p><input name="CheckSWF" type="checkbox" value="1" /> Verify flash player</p>
776
+ <?php
777
+ }
778
+ ?>
779
  </td>
780
  </tr>
781
 
907
  <input type="text" name="Feed[itunes_new_feed_url_podcast]"style="width: 55%;" value="<?php echo $FeedSettings['itunes_new_feed_url_podcast']; ?>" maxlength="250" />
908
  </p>
909
  <p style="margin-left: 25%;margin-top: 0;font-size: 90%;">(Leave blank for no New Feed URL)</p>
910
+ <p>More information regarding the iTunes New Feed URL is available <a href="http://www.apple.com/itunes/whatson/podcasts/specs.html#changing" target="_blank" title="Apple iTunes Podcasting Specificiations">here</a>.</p>
911
  </div>
912
  </td>
913
  </tr>
1102
  <?php
1103
  }
1104
 
1105
+ function powerpress_shutdown()
1106
+ {
1107
+ global $wpdb;
1108
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
1109
+ }
1110
+
1111
+ add_action('shutdown','powerpress_shutdown'); // disable the auto enclosure process
1112
+
1113
  /*
1114
  // Helper functions:
1115
  */
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  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.2
7
 
8
  Add podcasting support to your blog.
9
 
@@ -96,6 +96,8 @@ Player now handles Windows Media (wmv) in Firefox, offering link to preferred Fi
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
2
  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.1
6
+ Stable tag: 0.6.3
7
 
8
  Add podcasting support to your blog.
9
 
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
+ 0.6.3 released on 02/16/2009
100
+ Added new options to load all javascript for players in the wp_footer() function. Options are available as defines to add to the wp-config.php and are documented near the top of the powerpress.php. Added option in settings to display player in excerpts. Added code to repair corrupted Podpress data for displaying previously created podpress episodes. Note: Podpress data corruption was originally caused by previous versions of Podpress. Added code to prevent Wordpress from auto adding enclosures created from links to media found in the blog post.
101
 
102
  == Contributors ==
103
  Angelo Mandato, CIO [RawVoice](http://www.rawvoice.com) - Plugin founder, architect and lead developer
screenshot-1.jpg CHANGED
Binary file
screenshot-3.jpg ADDED
Binary file